foamVtuSizing.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2016-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "foamVtuSizing.H"
29#include "foamVtkCore.H"
30#include "polyMesh.H"
31#include "cellShape.H"
33
34// Only used in this file
35#include "foamVtuSizingImpl.C"
36
37// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
38
39void Foam::vtk::vtuSizing::presizeMaps(foamVtkMeshMaps& maps) const
40{
41 maps.cellMap().resize(this->nFieldCells());
42 maps.additionalIds().resize(this->nAddPoints());
43}
44
45
47(
48 const vtk::vtuSizing& sizing,
49
50 const label cellTypes_size,
51 const label vertLabels_size,
52 const label vertOffset_size,
53 const label faceLabels_size,
54 const label faceOffset_size,
55
56 const enum contentType output,
57 const label cellMap_size,
58 const label addPointsIds_size
59)
60{
61 label nErrors = 0;
62
63 #undef CHECK_SIZING
64 #define CHECK_SIZING(what, sizeInput, sizeExpected) \
65 if (sizeInput != sizeExpected) \
66 { \
67 if (!nErrors++) \
68 { \
69 FatalErrorInFunction << "VTK sizing error" << nl; \
70 } \
71 FatalError \
72 << " " << what << " size=" << sizeInput \
73 << " expected " << sizeExpected << nl; \
74 }
75
76
77 CHECK_SIZING("cellTypes", cellTypes_size, sizing.nFieldCells());
78 CHECK_SIZING("cellMap", cellMap_size, sizing.nFieldCells());
79 CHECK_SIZING("addPointsIds", addPointsIds_size, sizing.nAddPoints());
80
81 switch (output)
82 {
83 case contentType::LEGACY:
84 {
85 CHECK_SIZING("legacy", vertLabels_size, sizing.sizeLegacy());
86 break;
87 }
88
89 case contentType::XML:
90 {
91 // XML uses connectivity/offset pair.
93 (
94 "connectivity",
95 vertLabels_size,
96 sizing.sizeXml(slotType::CELLS)
97 );
99 (
100 "offsets",
101 vertOffset_size,
102 sizing.sizeXml(slotType::CELLS_OFFSETS)
103 );
104 if (sizing.nFaceLabels())
105 {
107 (
108 "faces",
109 faceLabels_size,
110 sizing.sizeXml(slotType::FACES)
111 );
112
114 (
115 "faceOffsets",
116 faceOffset_size,
117 sizing.sizeXml(slotType::FACES_OFFSETS)
118 );
119 }
120 break;
121 }
122
123 case contentType::INTERNAL1:
124 {
125 // VTK-internal1 connectivity/offset pair.
127 (
128 "connectivity",
129 vertLabels_size,
130 sizing.sizeInternal1(slotType::CELLS)
131 );
133 (
134 "offsets",
135 vertOffset_size,
136 sizing.sizeInternal1(slotType::CELLS_OFFSETS)
137 );
138 if (sizing.nFaceLabels())
139 {
141 (
142 "faces",
143 faceLabels_size,
144 sizing.sizeInternal1(slotType::FACES)
145 );
147 (
148 "faceOffsets",
149 faceOffset_size,
150 sizing.sizeInternal1(slotType::FACES_OFFSETS)
151 );
152 }
153 break;
154 }
155
156 case contentType::INTERNAL2:
157 {
158 // VTK-internal2 connectivity/offset pair.
160 (
161 "connectivity",
162 vertLabels_size,
163 sizing.sizeInternal2(slotType::CELLS)
164 );
166 (
167 "offsets",
168 vertOffset_size,
169 sizing.sizeInternal2(slotType::CELLS_OFFSETS)
170 );
171 if (sizing.nFaceLabels())
172 {
174 (
175 "faces",
176 faceLabels_size,
177 sizing.sizeInternal2(slotType::FACES)
178 );
180 (
181 "faceOffsets",
182 faceOffset_size,
183 sizing.sizeInternal2(slotType::FACES_OFFSETS)
184 );
185 }
186 break;
187 }
188 }
189
190 if (nErrors)
191 {
193 << nl
194 << "Total of " << nErrors << " sizing errors encountered!"
195 << exit(FatalError);
196 }
197
198 #undef CHECK_SIZING
199}
200
201
202// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
203
205{
206 clear();
207}
208
209
211(
212 const polyMesh& mesh,
213 const bool decompose
214)
215{
216 clear();
217 reset(mesh, decompose);
218}
219
220
221// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
222
224{
225 decompose_ = false;
226 manifold_ = false;
227 selectionMode_ = FULL_MESH;
228 nCells_ = 0;
229 nPoints_ = 0;
230 nVertLabels_ = 0;
231
232 nFaceLabels_ = 0;
233 nCellsPoly_ = 0;
234 nVertPoly_ = 0;
235
236 nAddCells_ = 0;
237 nAddPoints_ = 0;
238 nAddVerts_ = 0;
239}
240
241
243(
244 const polyMesh& mesh,
245 const bool decompose
246)
247{
248 reset(mesh, labelUList::null(), decompose);
249}
250
251
253(
254 const polyMesh& mesh,
255 const labelUList& subsetCellsIds,
256 const bool decompose
257)
258{
259 // References to cell shape models
266
267 const cellShapeList& shapes = mesh.cellShapes();
269 const cellList& meshCells = manifoldCellsMeshObject::New(mesh).cells();
270 const faceList& meshFaces = mesh.faces();
271
272 // Unique vertex labels per polyhedral
273 labelHashSet hashUniqId(2*256);
274
275
276 // Special treatment for mesh subsets.
277 const bool isSubsetMesh
278 (
279 notNull(subsetCellsIds)
280 );
281
282 if (isSubsetMesh)
283 {
284 decompose_ = false; // Disallow decomposition for subset mode
285 selectionMode_ = selectionModeType::SUBSET_MESH;
286 }
287 else
288 {
289 decompose_ = decompose; // Disallow decomposition
290 selectionMode_ = selectionModeType::FULL_MESH;
291 }
292
293 // Manifold cells detected?
294 manifold_ = manifoldCellsMeshObject::New(mesh).manifold();
295
296 const label nInputCells =
297 (
298 isSubsetMesh
299 ? subsetCellsIds.size()
300 : shapes.size()
301 );
302
303 nCells_ = nInputCells;
304 nPoints_ = mesh.nPoints();
305 nAddCells_ = 0;
306 nAddVerts_ = 0;
307
308 nCellsPoly_ = nCells_;
309 nVertLabels_ = 0;
310 nFaceLabels_ = 0;
311 nVertPoly_ = 0;
312
313 for (label inputi = 0; inputi < nInputCells; ++inputi)
314 {
315 const label celli(isSubsetMesh ? subsetCellsIds[inputi] : inputi);
316
317 const cellShape& shape = shapes[celli];
318 const cellModel& model = shape.model();
319
320 if
321 (
322 model == tet
323 || model == pyr
324 || model == prism
325 || model == hex
326 )
327 {
328 // Normal primitive - not a poly
329 --nCellsPoly_;
330 nVertLabels_ += shape.size();
331 }
332 else if (model == tetWedge && decompose_)
333 {
334 nVertLabels_ += 6; // Treat as squeezed prism (VTK_WEDGE)
335 }
336 else if (model == wedge && decompose_)
337 {
338 nVertLabels_ += 8; // Treat as squeezed hex
339 }
340 else if (decompose_)
341 {
342 // Polyhedral: Decompose into tets + pyramids.
343 ++nAddPoints_;
344
345 // Count vertices into first decomposed cell
346 bool first = true;
347
348 const cell& cFaces = meshCells[celli];
349 for (const label facei : cFaces)
350 {
351 const face& f = meshFaces[facei];
352
353 // Face decomposed into triangles and quads
354 // Tri -> Tet, Quad -> Pyr
355 label nTria = 0, nQuad = 0;
356 f.nTrianglesQuads(mesh.points(), nTria, nQuad);
357
358 nAddCells_ += nTria + nQuad;
359 nAddVerts_ += (nTria * 4) + (nQuad * 5);
360
361 if (first)
362 {
363 first = false;
364 --nAddCells_;
365
366 const label nvrt = (nQuad ? 5 : 4);
367 nAddVerts_ -= nvrt;
368 nVertLabels_ += nvrt;
369 }
370 }
371 }
372 else
373 {
374 // Polyhedral: Not decomposed
375
376 const labelList& cFaces = meshCells[celli];
377
378 // Unique node ids used (XML/INTERNAL, not needed for LEGACY)
379 hashUniqId.clear();
380
381 // Face stream sizing:
382 // number of faces, size of each face, vertices per face
383 // [nFaces, nFace0Pts, id1, id2, ..., nFace1Pts, id1, id2, ...]
384
385 for (const label facei : cFaces)
386 {
387 const face& f = meshFaces[facei];
388 nFaceLabels_ += f.size();
389
390 hashUniqId.insert(f);
391 }
392
393 // Legacy format only uses the face-stream.
394 // - track what *NOT* to use for legacy
395 nVertLabels_ += hashUniqId.size();
396 nVertPoly_ += hashUniqId.size();
397
398 nFaceLabels_ += 1 + cFaces.size();
399 }
400 }
401
402 // Requested and actually required
403 decompose_ = (decompose_ && nCellsPoly_);
404}
405
406
407// Synchronize changes here with the following:
408// - vtuSizing::resetShapes
409// - vtuSizing::populateArrays
410//
412(
413 const UList<cellShape>& shapes
414)
415{
420
421 decompose_ = false; // Disallow decomposition
422 manifold_ = false; // Assume no manifold cells possible
423
424 selectionMode_ = SHAPE_MESH;
425
426 const label nInputCells = shapes.size();
427
428 nCells_ = nInputCells;
429 nPoints_ = 0;
430 nAddCells_ = 0;
431 nAddVerts_ = 0;
432
433 nCellsPoly_ = 0;
434 nVertLabels_ = 0;
435 nFaceLabels_ = 0;
436 nVertPoly_ = 0;
437
438 label nIgnored = 0;
439
440 for (label inputi = 0; inputi < nInputCells; ++inputi)
441 {
442 const cellShape& shape = shapes[inputi];
443 const cellModel& model = shape.model();
444
445 if
446 (
447 model == tet
448 || model == pyr
449 || model == prism
450 || model == hex
451 )
452 {
453 nVertLabels_ += shape.size();
454
455 // Guess for number of addressed points
456 nPoints_ = max(nPoints_, max(shape));
457 }
458 else
459 {
460 --nCells_;
461 ++nIgnored;
462 }
463 }
464
465 if (nIgnored)
466 {
468 << "Encountered " << nIgnored << " unsupported cell shapes"
469 << " ... this is likely not good" << nl
470 << exit(FatalError);
471 }
472
473 if (nCells_)
474 {
475 ++nPoints_;
476 }
477}
478
479
481(
482 const enum contentType output,
483 const enum slotType slot
484) const
485{
486 switch (output)
487 {
488 case contentType::LEGACY:
489 {
490 switch (slot)
491 {
492 case slotType::CELLS:
493 // legacy uses connectivity for primitives, but directly
494 // stores face streams into connectivity as well.
495 // size-prefix per cell
496 return
497 (
498 nVertLabels() + nAddVerts() - nVertPoly() // primitives
499 + nFaceLabels() // face-stream (poly)
500 + nFieldCells() // nFieldCells (size prefix)
501 );
502 break;
503
504 default:
505 break;
506 }
507 break;
508 }
509
510 case contentType::XML:
511 {
512 switch (slot)
513 {
514 case slotType::CELLS:
515 return (nVertLabels() + nAddVerts());
516 break;
517
518 case slotType::CELLS_OFFSETS:
519 return nFieldCells();
520 break;
521
522 case slotType::FACES:
523 return nFaceLabels();
524 break;
525
526 case slotType::FACES_OFFSETS:
527 return nFaceLabels() ? nFieldCells() : 0;
528 break;
529 }
530 break;
531 }
532
533 case contentType::INTERNAL1:
534 {
535 switch (slot)
536 {
537 case slotType::CELLS:
538 // size-prefix per cell
539 return (nVertLabels() + nAddVerts() + nFieldCells());
540 break;
541
542 case slotType::CELLS_OFFSETS:
543 return nFieldCells();
544 break;
545
546 case slotType::FACES:
547 return nFaceLabels();
548 break;
549
550 case slotType::FACES_OFFSETS:
551 return nFaceLabels() ? nFieldCells() : 0;
552 break;
553 }
554 break;
555 }
556
557 case contentType::INTERNAL2:
558 {
559 switch (slot)
560 {
561 case slotType::CELLS:
562 return (nVertLabels() + nAddVerts());
563 break;
564
565 case slotType::CELLS_OFFSETS:
566 return (nFieldCells() + 1);
567 break;
568
569 case slotType::FACES:
570 return nFaceLabels();
571 break;
572
573 case slotType::FACES_OFFSETS:
574 return nFaceLabels() ? nFieldCells() : 0;
575 break;
576 }
577 break;
578 }
579 }
580
581 return 0;
582}
583
584
585// * * * * * * * * * * * * * * Populate Lists * * * * * * * * * * * * * * * //
586
588(
589 const polyMesh& mesh,
591 labelUList& vertLabels,
592 foamVtkMeshMaps& maps
593) const
594{
595 // Leave as zero-sized so that populateArrays doesn't fill it.
596 List<label> unused;
597
598 presizeMaps(maps);
599
600 populateArrays
601 (
602 mesh,
603 *this,
604 cellTypes,
605 vertLabels,
606 unused, // offsets
607 unused, // faces
608 unused, // facesOffsets
609 contentType::LEGACY,
610 maps.cellMap(),
611 maps.additionalIds()
612 );
613}
614
615
617(
618 const UList<cellShape>& shapes,
620 labelUList& vertLabels,
621 foamVtkMeshMaps& maps
622) const
623{
624 // Leave as zero-sized so that populateArrays doesn't fill it.
625 List<label> unused;
626
627 presizeMaps(maps);
628
629 populateArrays
630 (
631 shapes,
632 *this,
633 cellTypes,
634 vertLabels,
635 unused, // offsets
636 unused, // faces
637 unused, // facesOffsets
638 contentType::LEGACY,
639 maps.cellMap(),
640 maps.additionalIds()
641 );
642}
643
644
646(
647 const polyMesh& mesh,
649 labelUList& connectivity,
650 labelUList& offsets,
651 labelUList& faces,
652 labelUList& facesOffsets,
653 foamVtkMeshMaps& maps
654) const
655{
656 presizeMaps(maps);
657
658 populateArrays
659 (
660 mesh,
661 *this,
662 cellTypes,
663 connectivity,
664 offsets,
665 faces,
666 facesOffsets,
667 contentType::XML,
668 maps.cellMap(),
669 maps.additionalIds()
670 );
671}
672
673
675(
676 const UList<cellShape>& shapes,
678 labelUList& connectivity,
679 labelUList& offsets,
680 labelUList& faces,
681 labelUList& facesOffsets,
682 foamVtkMeshMaps& maps
683) const
684{
685 // Leave as zero-sized so that populateArrays doesn't fill it.
686 List<label> unused;
687
688 presizeMaps(maps);
689
690 populateArrays
691 (
692 shapes,
693 *this,
694 cellTypes,
695 connectivity,
696 offsets,
697 unused, // faces
698 unused, // facesOffsets
699 contentType::XML,
700 maps.cellMap(),
701 maps.additionalIds()
702 );
703}
704
705
706#undef definePopulateInternalMethod
707#define definePopulateInternalMethod(Type) \
708 \
709 void Foam::vtk::vtuSizing::populateInternal \
710 ( \
711 const polyMesh& mesh, \
712 UList<uint8_t>& cellTypes, \
713 UList<Type>& connectivity, \
714 UList<Type>& offsets, \
715 UList<Type>& faces, \
716 UList<Type>& facesOffsets, \
717 foamVtkMeshMaps& maps, \
718 const enum contentType output \
719 ) const \
720 { \
721 presizeMaps(maps); \
722 \
723 populateArrays \
724 ( \
725 mesh, \
726 *this, \
727 cellTypes, \
728 connectivity, \
729 offsets, \
730 faces, \
731 facesOffsets, \
732 output, \
733 maps.cellMap(), \
734 maps.additionalIds() \
735 ); \
736 } \
737 \
738 void Foam::vtk::vtuSizing::populateInternal \
739 ( \
740 const polyMesh& mesh, \
741 UList<uint8_t>& cellTypes, \
742 UList<Type>& connectivity, \
743 UList<Type>& offsets, \
744 UList<Type>& faces, \
745 UList<Type>& facesOffsets, \
746 labelUList& cellMap, \
747 labelUList& addPointsIds, \
748 const enum contentType output \
749 ) const \
750 { \
751 populateArrays \
752 ( \
753 mesh, \
754 *this, \
755 cellTypes, \
756 connectivity, \
757 offsets, \
758 faces, \
759 facesOffsets, \
760 output, \
761 cellMap, \
762 addPointsIds \
763 ); \
764 }
765
766
770
771
772#undef definePopulateInternalMethod
773
774
775// * * * * * * * * * * * * * * Renumber vertices * * * * * * * * * * * * * * //
776
778(
779 const labelUList& vertLabels,
780 const label globalPointOffset
781)
782{
783 if (!globalPointOffset)
784 {
785 return vertLabels;
786 }
787
788 labelList output(vertLabels);
789 renumberVertLabelsLegacy(output, globalPointOffset);
790
791 return output;
792}
793
794
796(
797 labelUList& vertLabels,
798 const label globalPointOffset
799)
800{
801 if (!globalPointOffset)
802 {
803 return;
804 }
805
806 // LEGACY vertLabels = "cells" contains
807 // - connectivity
808 // [nLabels, vertex labels...]
809 // - face-stream
810 // [nLabels nFaces, nFace0Pts, id1,id2,..., nFace1Pts, id1,id2,...]
811
812 // Note the simplest volume cell is a tet (4 points, 4 faces)
813 // As a poly-face stream this would have
814 // 2 for nLabels, nFaces
815 // 4 labels (size + ids) per face * 4 == 16 labels
816 //
817 // Therefore anything with 18 labels or more must be a poly
818
819 auto iter = vertLabels.begin();
820 const auto last = vertLabels.end();
821
822 while (iter < last)
823 {
824 label nLabels = *iter; // nLabels (for this cell)
825 ++iter;
826
827 if (nLabels < 18)
828 {
829 // Normal primitive type
830
831 while (nLabels--)
832 {
833 *iter += globalPointOffset;
834 ++iter;
835 }
836 }
837 else
838 {
839 // Polyhedral face-stream (explained above)
840
841 label nFaces = *iter;
842 ++iter;
843
844 while (nFaces--)
845 {
846 nLabels = *iter; // nLabels (for this face)
847 ++iter;
848
849 while (nLabels--)
850 {
851 *iter += globalPointOffset;
852 ++iter;
853 }
854 }
855 }
856 }
857}
858
859
861(
862 const labelUList& vertLabels,
863 const label globalPointOffset
864)
865{
866 if (!globalPointOffset)
867 {
868 return vertLabels;
869 }
870
871 labelList output(vertLabels);
872 renumberVertLabelsXml(output, globalPointOffset);
873
874 return output;
875}
876
877
879(
880 labelUList& vertLabels,
881 const label globalPointOffset
882)
883{
884 if (!globalPointOffset)
885 {
886 return;
887 }
888
889 // XML vertLabels = "connectivity" contains
890 // [cell1-verts, cell2-verts, ...]
891
892 for (label& vertId : vertLabels)
893 {
894 vertId += globalPointOffset;
895 }
896}
897
898
900(
901 const labelUList& faceLabels,
902 const label globalPointOffset
903)
904{
905 if (!globalPointOffset)
906 {
907 return faceLabels;
908 }
909
910 labelList output(faceLabels);
911 renumberFaceLabelsXml(output, globalPointOffset);
912
913 return output;
914}
915
916
918(
919 labelUList& faceLabels,
920 const label globalPointOffset
921)
922{
923 if (!globalPointOffset)
924 {
925 return;
926 }
927
928 // XML face-stream
929 // [nFaces, nFace0Pts, id1,id2,..., nFace1Pts, id1,id2,...]
930
931 auto iter = faceLabels.begin();
932 const auto last = faceLabels.end();
933
934 while (iter < last)
935 {
936 label nFaces = *iter;
937 ++iter;
938
939 while (nFaces--)
940 {
941 label nLabels = *iter;
942 ++iter;
943
944 while (nLabels--)
945 {
946 *iter += globalPointOffset;
947 ++iter;
948 }
949 }
950 }
951}
952
953
955(
956 const labelUList& faceOffsets,
957 const label prevOffset
958)
959{
960 if (!prevOffset)
961 {
962 return faceOffsets;
963 }
964
965 labelList output(faceOffsets);
966 renumberFaceOffsetsXml(output, prevOffset);
967
968 return output;
969}
970
971
973(
974 labelUList& faceOffsets,
975 const label prevOffset
976)
977{
978 if (!prevOffset)
979 {
980 return;
981 }
982
983 // offsets
984 // [-1, off1, off2, ... -1, ..]
985
986 for (label& val : faceOffsets)
987 {
988 if (val != -1)
989 {
990 val += prevOffset;
991 }
992 }
993}
994
995
996// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
997
999{
1000 os << "nFieldCells:" << nFieldCells();
1001 if (nAddCells_)
1002 {
1003 os << " (" << nCells_ << "+" << nAddCells_ << ")";
1004 }
1005 else
1006 {
1007 os << " (poly:" << nCellsPoly_ << ")";
1008 }
1009
1010 os << " nFieldPoints:" << nFieldPoints();
1011 if (nAddPoints_)
1012 {
1013 os << " (" << nPoints_ << "+" << nAddPoints_ << ")";
1014 }
1015
1016 os << " nVertLabels:" << (nVertLabels_ + nAddVerts_);
1017 if (nAddVerts_)
1018 {
1019 os << " (" << nVertLabels_ << "+" << nAddVerts_ << ")";
1020 }
1021 else if (nVertPoly_)
1022 {
1023 os << " (poly:" << nVertPoly_ << ")";
1024 }
1025
1026 os << " nFaceLabels:" << nFaceLabels_;
1027 os << " legacy-count:" << sizeLegacy();
1028}
1029
1030
1031// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
1032
1034{
1035 return
1036 (
1037 decompose() == rhs.decompose()
1038 // required? && pointOffset() == rhs.pointOffset()
1039 && nCells() == rhs.nCells()
1040 && nPoints() == rhs.nPoints()
1041 && nVertLabels() == rhs.nVertLabels()
1042 && nFaceLabels() == rhs.nFaceLabels()
1043 && nCellsPoly() == rhs.nCellsPoly()
1044 && nVertPoly() == rhs.nVertPoly()
1045 && nAddCells() == rhs.nAddCells()
1046 && nAddPoints() == rhs.nAddPoints()
1047 && nAddVerts() == rhs.nAddVerts()
1048 );
1049}
1050
1051
1053{
1054 return !operator==(rhs);
1055}
1056
1057
1058// ************************************************************************* //
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
Definition: HashSet.H:191
label size() const noexcept
The number of elements in table.
Definition: HashTableI.H:52
void clear()
Clear all entries from table.
Definition: HashTable.C:678
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
iterator begin() noexcept
Return an iterator to begin traversing the UList.
Definition: UListI.H:329
iterator end() noexcept
Return an iterator to end traversing the UList.
Definition: UListI.H:350
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
Maps a geometry to a set of cell primitives.
Definition: cellModel.H:73
@ TETWEDGE
tetWedge
Definition: cellModel.H:87
@ WEDGE
wedge
Definition: cellModel.H:82
@ PRISM
prism
Definition: cellModel.H:83
An analytical geometric cellShape.
Definition: cellShape.H:72
const cellModel & model() const
Model reference.
Definition: cellShapeI.H:126
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:57
reference ref() const
A reference to the entry (Error if not found)
Definition: dictionary.H:225
InfoProxy< ensightCells > info() const
Return info proxy.
Definition: ensightCells.H:254
void reset()
Reset to defaults.
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Bookkeeping for mesh subsetting and/or polyhedral cell decomposition. Although the main use case is f...
const labelList & additionalIds() const noexcept
Any additional (user) labels.
const labelList & cellMap() const noexcept
Original cell ids for all cells (regular and decomposed).
void checkSizes() const
Check that all components of sizes() are non-negative.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
friend bool operator!=(const refineCell &rc1, const refineCell &rc2)
Definition: refineCell.H:106
friend bool operator==(const refineCell &rc1, const refineCell &rc2)
Definition: refineCell.H:97
Sizing descriptions and routines for transcribing an OpenFOAM volume mesh into a VTK unstructured gri...
label nAddCells() const noexcept
Number of additional (decomposed) cells for the mesh.
void clear() noexcept
Reset all sizes to zero.
vtuSizing() noexcept
Default construct.
void resetShapes(const UList< cellShape > &shapes)
Reset sizing using primitive shapes only (ADVANCED USAGE)
label sizeOf(const enum contentType output, const enum slotType slot) const
Return the required size for the storage slot.
static void renumberVertLabelsLegacy(labelUList &connectivity, const label globalPointOffset)
Renumber vertex labels by global point offset - legacy format.
void populateShapesXml(const UList< cellShape > &shapes, UList< uint8_t > &cellTypes, labelUList &connectivity, labelUList &offsets, labelUList &faces, labelUList &facesOffsets, foamVtkMeshMaps &maps) const
Reset list for primitive shapes only (ADVANCED USAGE)
label nCellsPoly() const noexcept
Number of polyhedral cells for the mesh.
static labelList copyFaceLabelsXml(const labelUList &faceLabels, const label globalPointOffset)
Copy faces stream labels with a global point offset - XML format.
static labelList copyFaceOffsetsXml(const labelUList &faceOffsets, const label prevOffset)
Copy face offsets with an offset from previous - XML format.
label nAddPoints() const noexcept
Number of additional (decomposed) points for the mesh.
bool decompose() const noexcept
Query the decompose flag (normally off)
label nVertPoly() const noexcept
Number of vertex labels for polyhedral cells of the mesh.
static void renumberFaceLabelsXml(labelUList &faceLabels, const label globalPointOffset)
Renumber faces stream labels by global point offset - XML format.
void populateShapesLegacy(const UList< cellShape > &shapes, UList< uint8_t > &cellTypes, labelUList &connectivity, foamVtkMeshMaps &maps) const
Reset list for primitive shapes only (ADVANCED USAGE)
slotType
The possible storage 'slots' that can be used.
contentType
Types of content that the storage may represent.
static labelList copyVertLabelsXml(const labelUList &connectivity, const label globalPointOffset)
Copy vertex labels with a global point offset - XML format.
label nAddVerts() const noexcept
Number of additional (decomposed) vertices for the mesh.
static void renumberFaceOffsetsXml(labelUList &faceOffsets, const label prevOffset)
Renumber face offsets with an offset from previous - XML format.
static labelList copyVertLabelsLegacy(const labelUList &connectivity, const label globalPointOffset)
Copy vertex labels with a global point offset - legacy format.
label nVertLabels() const noexcept
Number of vertex labels for the mesh.
label nPoints() const noexcept
Number of points for the mesh.
static void renumberVertLabelsXml(labelUList &connectivity, const label globalPointOffset)
Renumber vertex labels by global point offset - XML format.
label nCells() const noexcept
Number of cells for the mesh.
label nFaceLabels() const noexcept
Number of polyhedral face labels for the mesh.
void populateXml(const polyMesh &mesh, UList< uint8_t > &cellTypes, labelUList &connectivity, labelUList &offsets, labelUList &faces, labelUList &facesOffsets, foamVtkMeshMaps &maps) const
Populate lists for XML output.
void populateLegacy(const polyMesh &mesh, UList< uint8_t > &cellTypes, labelUList &connectivity, foamVtkMeshMaps &maps) const
Populate lists for Legacy output.
label nFieldCells() const noexcept
Number of field cells = nCells + nAddCells.
patchWriters clear()
const cellModel & hex
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
OBJstream os(runTime.globalPath()/outputName)
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
#define CHECK_SIZING(what, sizeInput, sizeExpected)
#define definePopulateInternalMethod(Type)
label nPoints
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
static Ostream & output(Ostream &os, const IntRange< T > &range)
Definition: IntRanges.C:66
bool notNull(const T *ptr)
True if ptr is not a pointer (of type T) to the nullObject.
Definition: nullObject.H:207
const direction noexcept
Definition: Scalar.H:223
error FatalError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
labelList f(nPoints)
const labelList & cellTypes
Definition: setCellMask.H:33