MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / extractCells

Function extractCells

src/fileFormats/vtk/vtkUnstructuredReader.C:100–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98
99
100void Foam::vtkUnstructuredReader::extractCells
101(
102 Istream& inFile,
103 const labelList& cellTypes,
104 const labelList& cellVertData
105)
106{
107 const cellModel& hex = *(cellModeller::lookup("hex"));
108 const cellModel& prism = *(cellModeller::lookup("prism"));
109 const cellModel& pyr = *(cellModeller::lookup("pyr"));
110 const cellModel& tet = *(cellModeller::lookup("tet"));
111
112 labelList tetPoints(4);
113 labelList pyrPoints(5);
114 labelList prismPoints(6);
115 labelList hexPoints(8);
116
117 label celli = cells_.size();
118 cells_.setSize(celli+cellTypes.size());
119 cellMap_.setSize(cells_.size(), -1);
120
121 label facei = faces_.size();
122 faces_.setSize(facei+cellTypes.size());
123 faceMap_.setSize(faces_.size(), -1);
124
125 label lineI = lines_.size();
126 lines_.setSize(lineI+cellTypes.size());
127 lineMap_.setSize(lines_.size(), -1);
128
129 label dataIndex = 0;
130
131
132 // To mark whether unhandled type has been visited.
133 labelHashSet warningGiven;
134
135 forAll(cellTypes, i)
136 {
137 switch (cellTypes[i])
138 {
139 case VTK_VERTEX:
140 {
141 warnUnhandledType(inFile, cellTypes[i], warningGiven);
142 label nRead = cellVertData[dataIndex++];
143 if (nRead != 1)
144 {
145 FatalIOErrorInFunction
146 (
147 inFile
148 ) << "Expected size 1 for VTK_VERTEX but found "
149 << nRead << exit(FatalIOError);
150 }
151 dataIndex += nRead;
152 }
153 break;
154
155 case VTK_POLY_VERTEX:
156 {
157 warnUnhandledType(inFile, cellTypes[i], warningGiven);

Callers 1

readFunction · 0.85

Calls 7

lookupFunction · 0.85
warnUnhandledTypeFunction · 0.85
forAllFunction · 0.50
exitFunction · 0.50
cellShapeClass · 0.50
sizeMethod · 0.45
setSizeMethod · 0.45

Tested by

no test coverage detected