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

Function calcCellLoops

src/dynamicMesh/meshCut/cellCuts/cellCuts.C:1125–1280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1123
1124
1125void Foam::cellCuts::calcCellLoops(const labelList& cutCells)
1126{
1127 // Determine for every cut cell the loop (= face) it is cut by. Done by
1128 // starting from a cut edge or cut vertex and walking across faces, from
1129 // cut to cut, until starting cut hit.
1130 // If multiple loops are possible across a cell circumference takes the
1131 // first one found.
1132
1133 // Calculate cuts per face.
1134 const labelListList& allFaceCuts = faceCuts();
1135
1136 // Per cell the number of faces with valid cuts. Is used as quick
1137 // rejection to see if cell can be cut.
1138 labelList nCutFaces(mesh().nCells(), 0);
1139
1140 forAll(allFaceCuts, facei)
1141 {
1142 const labelList& fCuts = allFaceCuts[facei];
1143
1144 if (fCuts.size() == mesh().faces()[facei].size())
1145 {
1146 // Too many cuts on face. WalkCell would get very upset so disable.
1147 nCutFaces[mesh().faceOwner()[facei]] = labelMin;
1148
1149 if (mesh().isInternalFace(facei))
1150 {
1151 nCutFaces[mesh().faceNeighbour()[facei]] = labelMin;
1152 }
1153 }
1154 else if (fCuts.size() >= 2)
1155 {
1156 // Could be valid cut. Update count for owner and neighbour.
1157 nCutFaces[mesh().faceOwner()[facei]]++;
1158
1159 if (mesh().isInternalFace(facei))
1160 {
1161 nCutFaces[mesh().faceNeighbour()[facei]]++;
1162 }
1163 }
1164 }
1165
1166
1167 // Stack of visited cuts (nVisited used as stack pointer)
1168 // Size big enough.
1169 labelList visited(mesh().nPoints());
1170
1171 forAll(cutCells, i)
1172 {
1173 label celli = cutCells[i];
1174
1175 bool validLoop = false;
1176
1177 // Quick rejection: has enough faces that are cut?
1178 if (nCutFaces[celli] >= 3)
1179 {
1180 const labelList& cFaces = mesh().cells()[celli];
1181
1182 if (debug & 2)

Callers 1

calcLoopsAndAddressingFunction · 0.85

Calls 8

meshFunction · 0.85
writeUncutOBJFunction · 0.85
isInternalFaceMethod · 0.80
walkCellFunction · 0.70
forAllFunction · 0.50
sizeMethod · 0.45
facesMethod · 0.45
setSizeMethod · 0.45

Tested by

no test coverage detected