40 void Foam::meshReader::createPolyCells()
48 cellPolys_.
setSize(cFaces.size());
54 cellPolys_[celli].
setSize(cFaces[celli].size(), -1);
56 maxFaces += cFaces[celli].size();
59 Info<<
"Maximum possible number of faces in mesh: " << maxFaces <<
endl;
68 forAll(baffleIds_, baffleI)
70 baffleIds_[baffleI].setSize(2);
86 label baffleOffset = cFaces.size();
89 label celli = -(baffleOffset + baffleI);
97 const labelList& curNeighbours = ptCells[curPoints[0]];
99 label nNeighbours = 0;
102 forAll(curNeighbours, neiI)
104 label curNei = curNeighbours[neiI];
107 const faceList& searchFaces = cFaces[curNei];
109 forAll(searchFaces, neiFacei)
125 #ifdef DEBUG_FACE_ORDERING 126 Info<<
"cmp " << cmp <<
" matched " << curFace
127 <<
" with " << searchFaces[neiFacei]
131 Info<<
"match " << baffleI
132 <<
" (" <<
origCellId_[baffleOffset+baffleI] <<
")" 134 <<
" against cell " << curNei
135 <<
" face " << neiFacei
136 <<
" curFace " << curFace[1]
137 <<
" neiFace " << searchFaces[neiFacei][1]
141 if (baffleIds_[baffleI][side].unused())
143 baffleIds_[baffleI][side] = cellFaceIdentifier
153 Info<<
"multiple matches for side " << side
154 <<
" of baffle " << baffleI
155 <<
" (original cell " 162 if (nNeighbours >= 2)
break;
165 if (nNeighbours == 2)
167 for (
label side = 0; side < nNeighbours; ++side)
169 label neiCell = baffleIds_[baffleI][side].cell;
170 label neiFace = baffleIds_[baffleI][side].face;
172 if (baffleIds_[baffleI][side].used())
174 cellPolys_[neiCell][neiFace] = celli;
180 Info<<
"drop baffle " << baffleI
181 <<
" (original cell " 183 <<
" with " << nNeighbours <<
" neighbours" <<
endl;
186 baffleIds_[baffleI].clear();
190 #ifdef DEBUG_CELLPOLY 191 Info<<
"cellPolys_" << cellPolys_ <<
endl;
193 Info<<
"baffleIds_" << baffleIds_ <<
endl;
208 const faceList& curFaces = cFaces[celli];
214 labelList faceOfNeiCell(curFaces.size(), -1);
216 label nNeighbours = 0;
222 if (cellPolys_[celli][facei] != -1)
continue;
226 const face& curFace = curFaces[facei];
235 const labelList& curNeighbours = ptCells[curPoints[pointi]];
238 forAll(curNeighbours, neiI)
240 label curNei = curNeighbours[neiI];
247 const faceList& searchFaces = cFaces[curNei];
249 forAll(searchFaces, neiFacei)
251 if (searchFaces[neiFacei] == curFace)
254 neiCells[facei] = curNei;
255 faceOfNeiCell[facei] = neiFacei;
257 #ifdef DEBUG_FACE_ORDERING 258 Info<<
" cell " << celli
260 <<
" point " << pointi
262 <<
" neiFace " << neiFacei
278 for (
label neiSearch = 0; neiSearch < nNeighbours; neiSearch++)
286 if (neiCells[ncI] > -1 && neiCells[ncI] < minNei)
289 minNei = neiCells[ncI];
296 meshFaces_[nInternalFaces_] = curFaces[nextNei];
299 cellPolys_[celli][nextNei] = nInternalFaces_;
302 cellPolys_[neiCells[nextNei]][faceOfNeiCell[nextNei]] =
306 neiCells[nextNei] = -1;
314 <<
"Error in internal face insertion" 320 #ifdef DEBUG_CELLPOLY 321 Info<<
"cellPolys = " << cellPolys_ <<
endl;
List< labelList > labelListList
A List of labelList.
List< faceList > faceListList
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t 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.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList origCellId_
Lookup original Cell number for a given cell.
void clear()
Clear the list, i.e. set size to zero.
static int compare(const face &, const face &)
Compare faces.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
void setSize(const label)
Reset size of List.
faceList baffleFaces_
List of each baffle face.