34 void Foam::sammMesh::addRegularCell
37 const label nCreatedCells
50 labels[2] == labels[3]
51 && labels[4] == labels[5]
52 && labels[5] == labels[6]
53 && labels[6] == labels[7]
56 labelsTet[0] = labels[0];
57 labelsTet[1] = labels[1];
58 labelsTet[2] = labels[2];
59 labelsTet[3] = labels[4];
60 cellShapes_[nCreatedCells] = cellShape(*tetPtr_, labelsTet);
65 labels[4] == labels[5]
66 && labels[5] == labels[6]
67 && labels[6] == labels[7]
70 labelsPyramid[0] = labels[0];
71 labelsPyramid[1] = labels[1];
72 labelsPyramid[2] = labels[2];
73 labelsPyramid[3] = labels[3];
74 labelsPyramid[4] = labels[4];
75 cellShapes_[nCreatedCells] = cellShape(*pyrPtr_, labelsPyramid);
80 labels[2] == labels[3]
81 && labels[4] == labels[5]
82 && labels[6] == labels[7]
85 labelsTetWedge[0] = labels[0];
86 labelsTetWedge[1] = labels[1];
87 labelsTetWedge[2] = labels[2];
88 labelsTetWedge[3] = labels[4];
89 labelsTetWedge[4] = labels[6];
90 cellShapes_[nCreatedCells] = cellShape(*tetWedgePtr_, labelsTetWedge);
95 labels[2] == labels[3]
96 && labels[6] == labels[7]
99 labelsPrism[0] = labels[0];
100 labelsPrism[1] = labels[1];
101 labelsPrism[2] = labels[2];
102 labelsPrism[3] = labels[4];
103 labelsPrism[4] = labels[5];
104 labelsPrism[5] = labels[6];
105 cellShapes_[nCreatedCells] = cellShape(*prismPtr_, labelsPrism);
110 labels[4] == labels[7]
113 labelsWedge[0] = labels[7];
114 labelsWedge[1] = labels[6];
115 labelsWedge[2] = labels[5];
116 labelsWedge[3] = labels[3];
117 labelsWedge[4] = labels[2];
118 labelsWedge[5] = labels[1];
119 labelsWedge[6] = labels[0];
120 cellShapes_[nCreatedCells] = cellShape(*wedgePtr_, labelsWedge);
125 labelsHex[0] = labels[0];
126 labelsHex[1] = labels[1];
127 labelsHex[2] = labels[2];
128 labelsHex[3] = labels[3];
129 labelsHex[4] = labels[4];
130 labelsHex[5] = labels[5];
131 labelsHex[6] = labels[6];
132 labelsHex[7] = labels[7];
133 cellShapes_[nCreatedCells] = cellShape(*hexPtr_, labelsHex);
138 void Foam::sammMesh::addSAMMcell
140 const label typeFlag,
142 const label nCreatedCells
147 if (!sammShapeLookup[typeFlag] || !sammAddressingTable[typeFlag])
150 <<
"SAMM type " << typeFlag <<
" has no registered label. BUG!" 154 const cellModel& curModel = *(sammShapeLookup[typeFlag]);
157 const label* addressing = sammAddressingTable[typeFlag];
160 labelList sammCellLabels(curModel.nPoints(), -1);
164 sammCellLabels[
labelI] = globalLabels[addressing[
labelI]];
167 cellShapes_[nCreatedCells] = cellShape(curModel, sammCellLabels);
171 void Foam::sammMesh::readCells()
176 fileName cellsFileName(casePrefix_ +
".cel");
179 IFstream cellsFile(cellsFileName);
181 if (cellsFile.good())
183 label lineLabel, cellLabel = -1, pointLabel, regionLabel, typeFlag;
186 while (!(cellsFile >> lineLabel).eof())
188 maxLabel =
max(maxLabel, lineLabel);
189 for (
int i=0; i<8; i++)
191 cellsFile >> pointLabel;
194 cellsFile >> regionLabel;
195 cellsFile >> typeFlag;
197 if (lineLabel != cellLabel)
199 cellLabel = lineLabel;
207 <<
"Cannot read file " 213 Info<<
"Number of cells = " << nCells << endl <<
endl;
217 starCellLabelLookup_.
setSize(maxLabel+1);
220 forAll(starCellLabelLookup_, i)
222 starCellLabelLookup_[i] = -1;
228 IFstream cellsFile(cellsFileName);
231 label lineLabel, sammLabel, regionLabel, typeFlag;
233 for (
label celli = 0; celli < nCells; celli++)
237 bool addOnToCell =
false;
244 <<
"Unknown SAMM cell. " 245 <<
"More than 24 vertices" 249 if ((cellsFile >> lineLabel).eof())
252 <<
"Reached end of cells file before " 253 <<
"all cells are read in." 260 for (
int i=nLabels-8; i<nLabels; i++)
262 cellsFile >> sammLabel;
267 labels[i] = starPointLabelLookup_[sammLabel];
271 Info<<
"Cell file not consistent with vertex file. " 272 <<
"Samm vertex number " << sammLabel
273 <<
" does not exist\n";
282 cellsFile >> regionLabel;
283 cellsFile >> typeFlag;
286 if (!addOnToCell && typeFlag == 255)
295 }
while (typeFlag == -1 || addOnToCell);
297 starCellLabelLookup_[lineLabel] = celli;
301 addRegularCell(labels, celli);
305 addSAMMcell(typeFlag, labels, celli);
312 <<
"No cells in file " #define forAll(list, i)
Loop across all elements in list.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const labelSphericalTensor labelI(1)
Identity labelTensor.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
void setSize(const label)
Reset size of List.