41 const label cellIndex,
46 const label fluentCellModelID
50 static List<const cellModel*> fluentCellModelLookup
53 reinterpret_cast<const cellModel*>(0)
61 static label faceMatchingOrder[7][6] =
63 {-1, -1, -1, -1, -1, -1},
64 {-1, -1, -1, -1, -1, -1},
65 { 0, 1, 2, 3, -1, -1},
66 {-1, -1, -1, -1, -1, -1},
72 const cellModel& curModel = *fluentCellModelLookup[fluentCellModelID];
75 if (faceLabels.size() != curModel.nFaces())
79 "create3DCellShape(const label cellIndex, "
80 "const labelList& faceLabels, const labelListList& faces, "
81 "const labelList& owner, const labelList& neighbour, "
82 "const label fluentCellModelID)"
83 ) <<
"Number of face labels not equal to"
84 <<
"number of face in the model. "
85 <<
"Number of face labels: " << faceLabels.size()
86 <<
" number of faces in model: " << curModel.nFaces()
95 const label curFaceLabel = faceLabels[faceI];
97 const labelList& curFace = faces[curFaceLabel];
99 if (owner[curFaceLabel] == cellIndex)
101 localFaces[faceI] = curFace;
103 else if (neighbour[curFaceLabel] == cellIndex)
106 localFaces[faceI].
setSize(curFace.size());
110 localFaces[faceI][curFace.size() - i - 1] =
118 "create3DCellShape(const label cellIndex, "
119 "const labelList& faceLabels, const labelListList& faces, "
120 "const labelList& owner, const labelList& neighbour, "
121 "const label fluentCellModelID)"
122 ) <<
"face " << curFaceLabel
123 <<
" does not belong to cell " << cellIndex
124 <<
". Face owner: " << owner[curFaceLabel] <<
" neighbour: "
125 << neighbour[curFaceLabel]
146 List<bool> meshFaceUsed(localFaces.size(),
false);
149 const faceList& modelFaces = curModel.modelFaces();
153 modelFaces[faceMatchingOrder[fluentCellModelID][0]];
157 forAll (localFaces, meshFaceI)
159 if (localFaces[meshFaceI].size() == firstModelFace.size())
164 const labelList& curMeshFace = localFaces[meshFaceI];
166 meshFaceUsed[meshFaceI] =
true;
168 forAll (curMeshFace, pointI)
170 pointLabels[firstModelFace[pointI]] = curMeshFace[pointI];
181 "create3DCellShape(const label cellIndex, "
182 "const labelList& faceLabels, const labelListList& faces, "
183 "const labelList& owner, const labelList& neighbour, "
184 "const label fluentCellModelID)"
185 ) <<
"Cannot find match for first face. "
186 <<
"cell model: " << curModel.name() <<
" first model face: "
187 << firstModelFace <<
" Mesh faces: " << localFaces
191 for (label modelFaceI = 1; modelFaceI < modelFaces.size(); modelFaceI++)
196 [faceMatchingOrder[fluentCellModelID][modelFaceI]];
201 forAll (localFaces, meshFaceI)
205 !meshFaceUsed[meshFaceI]
206 && localFaces[meshFaceI].size() == curModelFace.size()
210 labelList meshFaceLabels = localFaces[meshFaceI];
215 rotation < meshFaceLabels.size();
220 label nMatchedLabels = 0;
222 forAll (meshFaceLabels, pointI)
227 == meshFaceLabels[pointI]
234 if (nMatchedLabels >= 2)
243 forAll (meshFaceLabels, pointI)
246 meshFaceLabels[pointI];
249 meshFaceUsed[meshFaceI] =
true;
256 label firstLabel = meshFaceLabels[0];
258 for (label i = 1; i < meshFaceLabels.size(); i++)
260 meshFaceLabels[i - 1] = meshFaceLabels[i];
263 meshFaceLabels[meshFaceLabels.size() - 1] = firstLabel;
276 "create3DCellShape(const label cellIndex, "
277 "const labelList& faceLabels, const labelListList& faces, "
278 "const labelList& owner, const labelList& neighbour, "
279 "const label fluentCellModelID)"
280 ) <<
"Cannot find match for face "
282 <<
".\nModel: " << curModel.name() <<
" model face: "
283 << curModelFace <<
" Mesh faces: " << localFaces