48 for (
const label pointi : indices)
50 accum |= (1u << sides[pointi]);
54 return (accum == 3 || accum >= 5);
62 Foam::label Foam::cuttingPlane::calcCellCuts
64 const primitiveMesh&
mesh,
72 const label nCells =
mesh.nCells();
73 const label nFaces =
mesh.nFaces();
74 const label nInternFaces =
mesh.nInternalFaces();
79 const plane& pln = *
this;
80 const label len = pts.size();
85 for (label i=0; i < len; ++i)
87 sides.set(i,
unsigned(1 + pln.sign(pts[i], SMALL)));
97 bitSet hasCut1(nCells);
100 bitSet hasCut2(nCells);
102 for (label facei = 0; facei < nInternFaces; ++facei)
106 const label own =
mesh.faceOwner()[facei];
107 const label nei =
mesh.faceNeighbour()[facei];
111 if (!hasCut1.set(own))
115 if (!hasCut1.set(nei))
122 for (label facei = nInternFaces; facei < nFaces; ++facei)
126 const label own =
mesh.faceOwner()[facei];
130 if (!hasCut1.set(own))
137 hasCut1.clearStorage();
141 cellCuts.resize(nCells);
146 Pout<<
"detected " << cellCuts.count() <<
"/" << nCells
147 <<
" cells cut, subsetted from "
148 << hasCut2.count() <<
"/" << nCells <<
" cells." <<
endl;
153 cellCuts = std::move(hasCut2);
157 Pout<<
"detected " << cellCuts.count() <<
"/" << nCells
158 <<
" cells cut." <<
endl;
165 const auto& fvmesh = dynamicCast<const fvMesh>(
mesh);
171 "cuttingPlane.cellCuts",
172 fvmesh.time().timeName(),
182 auto& cCutsFld = cCuts.primitiveFieldRef();
184 for (
const label celli : cellCuts)
189 Pout<<
"Writing cut types:" << cCuts.objectPath() <<
endl;