48 cellsFromCell.clear();
50 const cell&
c = mesh_.cells()[cellI];
54 Pout <<
"New cells from cell " << cellI <<
endl;
57 const label startBoundary = mesh_.boundaries()[0].patchStart();
60 label nLayers(1), baseFace(-1);
63 const label bfI =
c[fI] - startBoundary;
65 if( (bfI < 0) || (bfI >= nLayersAtBndFace_.size()) )
68 if( nLayersAtBndFace_[bfI] < 2 )
72 Pout <<
"Boundary face " << bfI <<
endl;
75 nLayers = nLayersAtBndFace_[bfI];
80 Pout <<
"Number of layers " << nLayers <<
endl;
81 Pout <<
"Base face " << baseFace <<
" has points "
82 << mesh_.faces()[
c[baseFace]] <<
endl;
85 Pout <<
"Faces from face " << fI <<
" are "
86 << facesFromFace_[
c[fI]] <<
endl;
89 Pout <<
"Face " << facesFromFace_(
c[fI], i)
90 <<
" is " << newFaces_[facesFromFace_(
c[fI], i)] <<
endl;
95 cellsFromCell.setSize(nLayers);
98 label otherBaseFace(-1);
103 const label faceI = facesFromFace_(
c[fI], 0);
105 f = newFaces_[faceI];
106 cellsFromCell[nLayers-1].
append(
f);
108 else if( facesFromFace_.sizeOfRow(
c[fI]) == 1 )
110 const label faceI = facesFromFace_(
c[fI], 0);
113 f = newFaces_[faceI];
120 const label nfI = facesFromFace_(
c[fI], cfI);
125 if( owner[
c[fI]] != cellI )
128 cellsFromCell[
Foam::max(nLayers-1-cfI, 0)].append(cf);
135 const face& bf = faces[
c[baseFace]];
136 const face& obf = faces[
c[otherBaseFace]];
137 for(
label layerI=1;layerI<nLayers;++layerI)
143 const label pointI = bf[pI];
146 Pout <<
"Split edges at point " << pointI <<
" are "
147 << splitEdgesAtPoint_[pointI] <<
endl;
151 if( splitEdgesAtPoint_.sizeOfRow(pointI) == 1 )
153 seI = splitEdgesAtPoint_(pointI, 0);
157 forAllRow(splitEdgesAtPoint_, pointI, sepI)
159 const label seJ = splitEdgesAtPoint_(pointI, sepI);
160 const edge& se = splitEdges_[seJ];
170 cf.
append(newVerticesForSplitEdge_(seI, layerI));
174 cellsFromCell[nLayers-layerI].append(cf);
175 cellsFromCell[nLayers-1-layerI].append(cf);
179 Pout <<
"New cells from cell " << cellI <<
" are " << cellsFromCell <<
endl;
182 Pout <<
"1. Newly generated cells " << cellsFromCell <<
endl;
198 const edge e(
f[eI],
f.fcElement(eI));
215 if( nAppearances[eI] != 2 )
217 Pout <<
"Prism cell " << cI <<
" edge " << edges[eI]
218 <<
" is present " << nAppearances[eI] <<
" times!" <<
endl;
228 const bool reverseOrientation,
229 const label normalDirection,
230 const bool maxCoordinate,
231 const label nLayersI,
232 const label nLayersJ,
233 const label nLayersK,
238 sortFaceFaces(faceI, faceFaces, reverseOrientation);
240 const label maxI = nLayersI - 1;
241 const label maxJ = nLayersJ - 1;
242 const label maxK = nLayersK - 1;
245 Pout <<
"Storing new faces from face " << faceI
246 <<
" reverseOrientation = " << reverseOrientation
247 <<
" normal direction " << normalDirection
248 <<
" maxCoordinate " << maxCoordinate <<
endl;
249 Pout <<
"faceFaces " << faceFaces <<
endl;
252 label i(-1), j(-1),
k(-1);
258 const label nfI = faceFaces[nI][nJ];
261 Pout <<
"nI = " << nI <<
" nJ = " << nJ <<
endl;
264 if( normalDirection == 0 )
269 k = maxCoordinate?maxK:0;
271 else if( normalDirection == 1 )
275 j = maxCoordinate?maxJ:0;
278 else if( normalDirection == 2 )
281 i = maxCoordinate?maxI:0;
290 k * nLayersI * nLayersJ +
295 Pout <<
"Storing face " << newFaces_[nfI]
296 <<
" i = " << i <<
" j = " << j <<
" k = " <<
k
297 <<
"\n cell label " << cI <<
endl;
300 cellsFromCell[cI].append(newFaces_[nfI]);
319 const label startBoundary = bnd[0].patchStart();
329 const label bfI =
c[fI] - startBoundary;
331 if( (bfI < 0) || (bfI >= nLayersAtBndFace.
size()) )
335 Pout <<
"Boundary face " << bfI <<
endl;
338 if( nLayersAtBndFace[bfI] < 2 )
341 layersInDirection[currDir] = nLayersAtBndFace[bfI];
342 dirFace[currDir] = fI;
352 const edge commonEdge =
357 determinedFace[dirFace[0]] =
true;
360 if( determinedFace[fI] )
366 determinedFace[fI] =
true;
373 determinedFace[dirFace[1]] =
true;
376 if( determinedFace[fI] )
382 determinedFace[fI] =
true;
388 Pout <<
"Common edge " << commonEdge <<
endl;
389 Pout <<
"Donor face " << dirFace[0] <<
endl;
390 Pout <<
"Donor face points " << faces[
c[dirFace[0]]] <<
endl;
397 if( determinedFace[fI] )
401 (faces[
c[fI]].which(commonEdge.
start()) >= 0) &&
407 (faces[
c[fI]].which(commonEdge.
end()) >= 0) &&
438 Pout <<
"Face in direction " << i <<
" is "
446 const cell&
c = bndLayers_.mesh_.cells()[cellI_];
447 const VRWGraph& facesFromFace = bndLayers_.facesFromFace_;
448 const VRWGraph& newFaces = bndLayers_.newFaces_;
450 cellsFromCell_.
setSize(nLayersI_ * nLayersJ_);
451 forAll(cellsFromCell_, cI)
452 cellsFromCell_[cI].clear();
455 bndLayers_.storeFacesIntoCells
457 c[faceInDirection_[0]], faceOrientation_[0],
459 nLayersI_, nLayersJ_, 1,
464 bndLayers_.storeFacesIntoCells
466 c[faceInDirection_[1]], faceOrientation_[1],
468 nLayersI_, nLayersJ_, 1,
473 forAllRow(facesFromFace,
c[faceInDirection_[2]], i)
475 const label faceI = facesFromFace(
c[faceInDirection_[2]], i);
476 cellsFromCell_[i].append(newFaces[faceI]);
480 const label maxJ = nLayersJ_ - 1;
481 forAllRow(facesFromFace,
c[faceInDirection_[3]], i)
483 const label faceI = facesFromFace(
c[faceInDirection_[3]], i);
484 cellsFromCell_[i + maxJ * nLayersI_].append(newFaces[faceI]);
488 forAllRow(facesFromFace,
c[faceInDirection_[4]], j)
490 const label faceI = facesFromFace(
c[faceInDirection_[4]], j);
491 cellsFromCell_[j * nLayersI_].append(newFaces[faceI]);
495 const label maxI = nLayersI_ - 1;
496 forAllRow(facesFromFace,
c[faceInDirection_[5]], j)
498 const label faceI = facesFromFace(
c[faceInDirection_[5]], j);
499 cellsFromCell_[j * nLayersI_ + maxI].append(newFaces[faceI]);
503 Pout <<
"New cells after populating existing faces "
504 << cellsFromCell_ <<
endl;
510 const cell&
c = bndLayers_.mesh_.cells()[cellI_];
517 bndLayers_.sortFacePoints
519 c[faceInDirection_[0]],
523 bndLayers_.sortFacePoints
525 c[faceInDirection_[1]],
532 const label maxI = nLayersI_ - 1;
533 const label maxJ = nLayersJ_ - 1;
535 for(
label i=1;i<nLayersI_;++i)
537 for(
label j=0;j<nLayersJ_;++j)
539 const label own = j * nLayersI_ + i - 1;
540 const label nei = own + 1;
548 mf[0] = cellPoints[0][i][j];
549 mf[1] = cellPoints[0][i][j+1];
550 mf[2] = cellPoints[1][i][j+1];
551 mf[3] = cellPoints[1][i][j];
554 Pout <<
"1. Adding missing face " << mf
555 <<
" to cells " << own <<
" and " << nei <<
endl;
558 cellsFromCell_[own].append(mf);
564 for(
label index=j;index<cellPoints[0][i].
size();++index)
565 mf.
append(cellPoints[0][i][index]);
566 for(
label index=cellPoints[1][i].size()-1;index>=j;--index)
567 mf.
append(cellPoints[1][i][index]);
570 Pout <<
"2. Adding missing face " << mf
571 <<
" to cells " << own <<
" and " << nei <<
endl;
574 cellsFromCell_[own].append(mf);
581 for(
label i=0;i<nLayersI_;++i)
583 for(
label j=1;j<nLayersJ_;++j)
585 const label nei = j * nLayersI_ + i;
586 const label own = (j - 1) * nLayersI_ + i;
594 mf[0] = cellPoints[0][i][j];
595 mf[1] = cellPoints[1][i][j];
596 mf[2] = cellPoints[1][i+1][j];
597 mf[3] = cellPoints[0][i+1][j];
600 Pout <<
"3. Adding missing face " << mf
601 <<
" to cells " << own <<
" and " << nei <<
endl;
604 cellsFromCell_[own].append(mf);
610 for(
label index=i;index<cellPoints[1].
size();++index)
611 mf.
append(cellPoints[1][index][j]);
612 for(
label index=cellPoints[0].size()-1;index>=i;--index)
613 mf.
append(cellPoints[0][index][j]);
616 Pout <<
"4. Adding missing face " << mf
617 <<
" to cells " << own <<
" and " << nei <<
endl;
620 cellsFromCell_[own].append(mf);
627 Pout <<
"Cell " << cellI_ <<
" new cells are " << cellsFromCell_ <<
endl;
647 determineFacesInDirections();
649 populateExistingFaces();
651 generateMissingFaces();
661 const labelList& nLayersAtBndFace = bndLayers_.nLayersAtBndFace_;
664 Pout <<
"Generating new cells from corner hex cell " << cellI_ <<
endl;
668 const label startBoundary =
mesh.boundaries()[0].patchStart();
677 const label bfI =
c[fI] - startBoundary;
679 if( (bfI < 0) || (bfI >= nLayersAtBndFace.
size()) )
683 Pout <<
"Boundary face " << bfI <<
endl;
686 if( nLayersAtBndFace[bfI] < 2 )
689 usedDirection[fI] =
true;
690 layersInDirection[currDir] = nLayersAtBndFace[bfI];
691 dirFace[currDir] = fI;
699 bndFaces[i] = faces[
c[dirFace[i]]];
705 Pout <<
"Used directions " << usedDirection <<
endl;
706 Pout <<
"Layers in direction " << layersInDirection <<
endl;
707 Pout <<
"dirFace " << dirFace <<
endl;
708 Pout <<
"Common point " << commonPoint <<
endl;
711 Pout <<
"bnd face " << i <<
" is " << faces[
c[dirFace[i]]] <<
endl;
715 const edgeLongList& splitEdges = bndLayers_.splitEdges_;
716 const VRWGraph& splitEdgesAtPoint = bndLayers_.splitEdgesAtPoint_;
718 const face& baseFace = faces[
c[dirFace[0]]];
719 const label posInBndFace = baseFace.
which(commonPoint);
722 forAllRow(splitEdgesAtPoint, commonPoint, i)
724 const edge& se = splitEdges[splitEdgesAtPoint(commonPoint, i)];
726 if( se == baseFace.
faceEdge(posInBndFace) )
729 splitEdgeInDirection_[1] = splitEdgesAtPoint(commonPoint, i);
731 else if( se == baseFace.
faceEdge(baseFace.rcIndex(posInBndFace)) )
734 splitEdgeInDirection_[0] = splitEdgesAtPoint(commonPoint, i);
736 else if( splitEdgesAtPoint.
sizeOfRow(commonPoint) == 3 )
739 splitEdgeInDirection_[2] = splitEdgesAtPoint(commonPoint, i);
746 "void refineBoundaryLayers::refineCornerHexCell::"
747 "determineFacesInDirections()"
753 const VRWGraph& newVerticesForSplitEdge =
754 bndLayers_.newVerticesForSplitEdge_;
755 forAll(splitEdgeInDirection_, i)
756 Pout <<
"Split edge in direction " << i <<
" has nodes "
757 << splitEdges[splitEdgeInDirection_[i]]
758 <<
" number of points on split edge "
759 << newVerticesForSplitEdge.
sizeOfRow(splitEdgeInDirection_[i])
770 baseFace.
faceEdge(baseFace.rcIndex(posInBndFace)),
786 nLayersI_ = layersInDirection[permutation[2]];
787 nLayersJ_ = layersInDirection[permutation[1]];
788 nLayersK_ = layersInDirection[permutation[0]];
793 faceInDirection_[0] = dirFace[permutation[0]];
794 faceOrientation_[0] =
true;
796 faceInDirection_[2] = dirFace[permutation[1]];
797 faceOrientation_[2] =
true;
799 faceInDirection_[4] = dirFace[permutation[2]];
800 faceOrientation_[4] =
true;
806 if( usedDirection[fI] )
809 const bool orientation = owner[
c[fI]]==cellI_?
false:
true;
814 faceInDirection_[1] = fI;
815 faceOrientation_[1] = orientation;
823 faceInDirection_[3] = fI;
824 faceOrientation_[3] = orientation;
832 faceInDirection_[5] = fI;
833 faceOrientation_[5] = orientation;
838 forAll(faceInDirection_, i)
839 Pout <<
"Face in direction " << i
840 <<
" is " << faces[
c[faceInDirection_[i]]]
841 <<
" orientation " << faceOrientation_[i] <<
endl;
842 Pout <<
"nLayersI = " << nLayersI_
843 <<
" nLayersJ = " << nLayersJ_
844 <<
" nLayersK = " << nLayersK_ <<
endl;
850 const cell&
c = bndLayers_.mesh_.cells()[cellI_];
853 cellsFromCell_.setSize(nLayersI_ * nLayersJ_ * nLayersK_);
855 cellsFromCell_[i].clear();
858 forAll(faceInDirection_, dirI)
860 bndLayers_.storeFacesIntoCells
862 c[faceInDirection_[dirI]], faceOrientation_[dirI],
864 nLayersI_, nLayersJ_, nLayersK_,
870 Pout <<
"cellsFromCell_ before new faces " << cellsFromCell_ <<
endl;
877 const cell&
c = bndLayers_.mesh_.cells()[cellI_];
880 cellPoints_.setSize(nLayersI_+1);
883 cellPoints_[i].setSize(nLayersJ_+1);
887 cellPoints_[i][j].setSize(nLayersK_+1);
888 cellPoints_[i][j] = -1;
893 forAll(faceInDirection_, dirI)
895 bndLayers_.sortFacePoints
897 c[faceInDirection_[dirI]],
899 faceOrientation_[dirI]
904 Pout <<
"Face points " << facePoints_ <<
endl;
912 cellPoints_[i][j][0] = facePoints_[0][i][j];
913 cellPoints_[i][j][nLayersK_] = facePoints_[1][i][j];
921 cellPoints_[i][0][
k] = facePoints_[2][
k][i];
922 cellPoints_[i][nLayersJ_][
k] = facePoints_[3][
k][i];
930 cellPoints_[0][j][
k] = facePoints_[4][j][
k];
931 cellPoints_[nLayersI_][j][
k] = facePoints_[5][j][
k];
936 const edgeLongList& splitEdges = bndLayers_.splitEdges_;
937 const edge& seDirI = splitEdges[splitEdgeInDirection_[0]];
938 const edge& seDirJ = splitEdges[splitEdgeInDirection_[1]];
939 const edge& seDirK = splitEdges[splitEdgeInDirection_[2]];
940 const VRWGraph& ptsAtEdge = bndLayers_.newVerticesForSplitEdge_;
947 const point v110 =
points[facePoints_[0].lastElement().lastElement()];
950 const point v101 =
points[facePoints_[1].lastElement()[0]];
951 const point v111 =
points[facePoints_[1].lastElement().lastElement()];
952 const point v011 =
points[facePoints_[1][0].lastElement()];
954 for(
label i=1;i<nLayersI_;++i)
960 points[ptsAtEdge(splitEdgeInDirection_[0], i)] -
966 for(
label j=1;j<nLayersJ_;++j)
972 points[ptsAtEdge(splitEdgeInDirection_[1], j)] -
984 points[ptsAtEdge(splitEdgeInDirection_[2],
k)] -
991 Pout <<
"Generating point in corner cell local coordinates "
992 <<
"u = " << u <<
" v = " << v <<
" w = " <<
w <<
endl;
997 (1.0 - u) * (1.0 - v) * (1.0 -
w) * v000 +
998 u * (1.0 - v) * (1.0 -
w) * v100 +
999 u * v * (1.0 -
w) * v110 +
1000 (1.0 - u) * v * (1.0 -
w) * v010 +
1001 (1.0 - u) * (1.0 - v) *
w * v001 +
1002 u * (1.0 - v) *
w * v101 +
1004 (1.0 - u) * v *
w * v011;
1007 Pout <<
"New point " <<
points.size() <<
" in corner hex "
1008 <<
"has coordinates " << newP <<
endl;
1012 cellPoints_[i][j][
k] =
points.size();
1019 Pout <<
"New cell points " << cellPoints_ <<
endl;
1027 for(
label i=1;i<nLayersI_;++i)
1030 for(
label j=0;j<nLayersJ_;++j)
1035 if( (j == (nLayersJ_-1)) && (
k == (nLayersK_-1)) )
1040 k * nLayersI_ * nLayersJ_ +
1044 const label nei = own + 1;
1048 mf[0] = cellPoints_[i][j][
k];
1049 mf[1] = cellPoints_[i][j+1][
k];
1050 mf[2] = cellPoints_[i][j+1][
k+1];
1051 mf[3] = cellPoints_[i][j][
k+1];
1053 cellsFromCell_[own].append(mf);
1061 mf.
append(cellPoints_[i][nLayersJ_-1][nLayersK_-1]);
1066 for(
label index=nLayersK_-1;index<f3.
size()-1;++index)
1071 for(
label index=
f1[i].size()-1;index>=nLayersJ_-1;--index)
1076 (nLayersK_-1) * nLayersI_ * nLayersJ_ +
1077 (nLayersJ_-1) * nLayersI_ +
1081 const label nei = own + 1;
1084 Pout <<
"Additional face in direction i = " << i
1085 <<
" j = " << (nLayersJ_-1)
1086 <<
" has owner " << own
1087 <<
" neighbour " << nei <<
" with nodes " << mf <<
endl;
1090 cellsFromCell_[own].append(mf);
1095 for(
label j=1;j<nLayersJ_;++j)
1098 for(
label i=0;i<nLayersI_;++i)
1103 if( (i == (nLayersI_-1)) && (
k == (nLayersK_-1)) )
1108 k * nLayersI_ * nLayersJ_ +
1115 k * nLayersI_ * nLayersJ_ +
1122 mf[0] = cellPoints_[i][j][
k];
1123 mf[1] = cellPoints_[i][j][
k+1];
1124 mf[2] = cellPoints_[i+1][j][
k+1];
1125 mf[3] = cellPoints_[i+1][j][
k];
1127 cellsFromCell_[own].append(mf);
1135 mf.
append(cellPoints_[nLayersI_-1][j][nLayersK_-1]);
1139 for(
label index=nLayersI_-1;index<fp1.
size()-1;++index)
1140 mf.
append(fp1[index][j]);
1144 for(
label index=fp5[j].size()-1;index>=nLayersK_-1;--index)
1145 mf.
append(fp5[j][index]);
1149 (nLayersK_-1) * nLayersI_ * nLayersJ_ +
1156 (nLayersK_-1) * nLayersI_ * nLayersJ_ +
1162 Pout <<
"Additional face at i = " << (nLayersI_-1)
1163 <<
" j = " << j <<
" k = " << (nLayersK_-1)
1164 <<
" has owner " << own
1165 <<
" neighbour " << nei <<
" with nodes " << mf <<
endl;
1168 cellsFromCell_[own].append(mf);
1176 for(
label i=0;i<nLayersI_;++i)
1178 for(
label j=0;j<nLayersJ_;++j)
1181 if( (i == (nLayersI_-1)) && (j == (nLayersJ_-1)) )
1186 (
k-1) * nLayersI_ * nLayersJ_ +
1193 k * nLayersI_ * nLayersJ_ +
1200 mf[0] = cellPoints_[i][j][
k];
1201 mf[1] = cellPoints_[i+1][j][
k];
1202 mf[2] = cellPoints_[i+1][j+1][
k];
1203 mf[3] = cellPoints_[i][j+1][
k];
1205 cellsFromCell_[own].append(mf);
1213 mf.
append(cellPoints_[nLayersI_-1][nLayersJ_-1][
k]);
1218 for(
label index=nLayersJ_-1;index<fp5.
size()-1;++index)
1223 for(
label index=fp3[
k].size()-1;index>=nLayersI_-1;--index)
1228 (
k-1) * nLayersI_ * nLayersJ_ +
1229 (nLayersJ_-1) * nLayersI_ +
1235 k * nLayersI_ * nLayersJ_ +
1236 (nLayersJ_-1) * nLayersI_ +
1241 Pout <<
"Additional face at position i = " << (nLayersI_-1)
1242 <<
" j = " << (nLayersJ_-1) <<
" k = " <<
k
1243 <<
" has owner " << own
1244 <<
" neighbour " << nei <<
" with nodes " << mf <<
endl;
1247 cellsFromCell_[own].append(mf);
1252 Pout <<
"Generated cells " << cellsFromCell_ <<
endl;
1254 forAll(cellsFromCell_, cI)
1267 const edge e(
f[eI],
f.fcElement(eI));
1278 ++nAppearances[
pos];
1284 if( nAppearances[eI] != 2 )
1286 Pout <<
"Edge hex cell " << cI <<
" edge " << edges[eI]
1287 <<
" is present " << nAppearances[eI] <<
" times!" <<
endl;
1306 splitEdgeInDirection_(),
1314 determineFacesInDirections();
1316 populateExistingFaces();
1318 generateNewPoints();
1320 generateMissingFaces();
1336 const label cellI = faceOwners[bfI];
1350 <<
" already exists. Skipping generation of a new subset"
1355 forAll(nCellsFromCell, cI)
1356 if( nCellsFromCell[cI] > 1 )
1362 forAll(nCellsFromCell, cellI)
1363 nNewCells += (nCellsFromCell[cellI] - 1);
1366 forAll(nCellsFromCell, cellI)
1368 Pout <<
"\nCell " << cellI <<
endl;
1369 Pout <<
"nCellsFromCell " << nCellsFromCell[cellI] <<
endl;
1370 Pout <<
"Ref type " << refType[cellI] <<
endl;
1375 Info <<
"Number of newly generated cells " << totalNumNewCells <<
endl;
1386 cells.setSize(nCells+nNewCells);
1396 forAll(nCellsFromCell, cellI)
1398 if( refType[cellI] == 0 )
1402 newCellsFromCell.
append(cellI, cellI);
1415 c.setSize(newC.
size());
1419 else if( refType[cellI] == 1 )
1425 forAll(cellsFromCell, cI)
1429 const label newCellI = cI==0?cellI:nCells++;
1431 newCellsFromCell.
append(cellI, newCellI);
1434 c.setSize(nc.
size());
1441 label faceLabel(-1);
1444 const label nfI = pointNewFaces(nf[0], pfI);
1464 else if( refType[cellI] == 2 )
1472 forAll(cellsFromCell, cI)
1477 Pout <<
"Adding cell " << (cI==0?cellI:nCells)
1478 <<
" originating from cell " << cellI <<
endl;
1481 const label newCellI = cI==0?cellI:nCells++;
1483 newCellsFromCell.
append(cellI, newCellI);
1486 c.setSize(nc.
size());
1493 label faceLabel(-1);
1496 const label nfI = pointNewFaces(nf[0], pfI);
1516 else if( refType[cellI] == 3 )
1529 forAll(cellsFromCell, cI)
1533 const label newCellI = cI==0?cellI:nCells++;
1535 newCellsFromCell.
append(cellI, newCellI);
1538 c.setSize(nc.
size());
1545 label faceLabel(-1);
1548 const label nfI = pointNewFaces(nf[0], pfI);
1572 "void refineBoundaryLayers::generateNewCells()"
1573 ) <<
"Cannot refine boundary layer for cell "
1583 # pragma omp parallel
1590 # pragma omp for schedule(dynamic, 40)
1592 for(
label fI=0;fI<nOrigInternalFaces;++fI)
1594 const label own = owner[fI];
1595 const label nei = neighbour[fI];
1605 label newOwner(-1), newNeighbour(-1);
1608 const cell& cOwn =
cells[newCellsFromCell(own, cI)];
1614 newOwner = newCellsFromCell(own, cI);
1621 const cell& cNei =
cells[newCellsFromCell(nei, cI)];
1627 newNeighbour = newCellsFromCell(nei, cI);
1632 if( newOwner > newNeighbour )
1657 Pout <<
"Copying internal faces " <<
endl;
1658 Pout <<
"Original number of internal faces " << nOrigInternalFaces <<
endl;
1666 for(
label faceI=0;faceI<nOrigInternalFaces;++faceI)
1670 face&
f = faces[currFace];
1671 newFaceLabel[currFace] = currFace;
1685 Pout <<
"Copying newly generated internal faces" <<
endl;
1686 Pout <<
"nNewInternalFaces " << currFace <<
endl;
1687 Pout <<
"numFacesBefore " << numFacesBefore <<
endl;
1693 newFaceLabel[faceI] = currFace;
1694 face&
f = faces[currFace];
1705 Pout <<
"Copying boundary faces " <<
endl;
1706 Pout <<
"currFace " << currFace <<
endl;
1712 forAll(boundaries, patchI)
1714 const label start = boundaries[patchI].patchStart();
1715 const label size = boundaries[patchI].patchSize();
1717 const label newStart = currFace;
1718 label nNewFacesInPatch(0);
1719 for(
label fI=0;fI<size;++fI)
1721 const label faceI = start + fI;
1725 face&
f = faces[currFace];
1729 newFaceLabel[origFaceI] = currFace;
1743 boundaries[patchI].patchStart() = newStart;
1744 boundaries[patchI].patchSize() = nNewFacesInPatch;
1750 Pout <<
"Copying processor faces" <<
endl;
1757 forAll(procBoundaries, patchI)
1759 const label start = procBoundaries[patchI].patchStart();
1760 const label size = procBoundaries[patchI].patchSize();
1762 const label newStart = currFace;
1763 label nNewFacesInPatch(0);
1764 for(
label fI=0;fI<size;++fI)
1766 const label faceI = start + fI;
1769 face&
f = faces[currFace];
1773 newFaceLabel[origFaceI] = currFace;
1787 procBoundaries[patchI].patchStart() = newStart;
1788 procBoundaries[patchI].patchSize() = nNewFacesInPatch;
1793 Pout <<
"Faces after refinement " << faces <<
endl;
1794 Pout <<
"newFaceLabel " << newFaceLabel <<
endl;
1804 Pout <<
"Updating cells to match new faces" <<
endl;
1812 c[fI] = newFaceLabel[
c[fI]];
1836 const face&
f = faces[
c[fI]];
1840 const edge e =
f.faceEdge(eI);
1851 ++nAppearances[
pos];
1856 bool badCell(
false);
1858 if( nAppearances[i] != 2 )
1867 Pout <<
"Cell " << cellI
1868 <<
" is not topologically closed" <<
endl;
1871 Pout <<
"Face " <<
c[fI] <<
" with points "
1872 << faces[
c[fI]] <<
endl;
1873 Pout <<
"Cell edges " << edges <<
endl;
1874 Pout <<
"nAppearances " << nAppearances <<
endl;
1893 if( faceI < nInternalFaces && neighbour[faceI] < 0 )
1895 Pout <<
"Num interface faces " << nInternalFaces
1896 <<
" current face " << faceI
1897 <<
" face points " << faces[faceI] <<
endl;
1900 Pout <<
"Face " << faceI <<
" owner " << owner[faceI]
1901 <<
" neighbour " << neighbour[faceI]
1902 <<
" face points " << faces[faceI] <<
endl;
1906 Pout <<
"Cell " << cellI <<
" has faces "
1914 Info <<
"Finished generating new cells " <<
endl;