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();
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;
163 const fvMesh* fvMeshPtr =
nullptr;
164 if (
debug && (fvMeshPtr = isA<fvMesh>(
mesh)) !=
nullptr)
168 "cuttingPlane.cellCuts",
173 auto& cellCutsDebug = tcellCutsDebug.ref();
175 auto&
fld = cellCutsDebug.primitiveFieldRef();
177 for (
const label celli : cellCuts)
182 Pout<<
"Writing cut types:" << cellCutsDebug.objectPath() <<
endl;
183 cellCutsDebug.
write();
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimless
Dimensionless.
List< face > faceList
List of faces.
vectorField pointField
pointField is a vectorField.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
plane()
Construct zero-initialised.
static int debug
Debug information.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
bool intersectsFace(const PackedList< 2 > &sides, const labelUList &indices)
label nFaces() const noexcept
Number of faces in the patch.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Do not request registration (bool: false)