48 for (
const label pointi : indices)
50 accum |= (1u << sides[pointi]);
54 return (accum == 3 || accum >= 5);
62Foam::label Foam::cuttingPlane::calcCellCuts
64 const primitiveMesh&
mesh,
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)
111 if (!hasCut1.set(own))
115 if (!hasCut1.set(nei))
122 for (label facei = nInternFaces; facei <
nFaces; ++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;
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
A dynamic list of packed unsigned integers, with the number of bits per item specified by the <Width>...
label nFaces() const noexcept
Number of faces in the patch.
static int debug
Debug information.
plane()
Construct zero-initialised.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
virtual const labelList & faceNeighbour() const
Return face neighbour.
virtual const pointField & points() const
Return raw points.
label nInternalFaces() const noexcept
Number of internal faces.
label nCells() const noexcept
Number of mesh cells.
label nFaces() const noexcept
Number of mesh faces.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimless
Dimensionless.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
vectorField pointField
pointField is a vectorField.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static constexpr const zero Zero
Global zero (0)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
bool intersectsFace(const PackedList< 2 > &sides, const labelUList &indices)
List< face > faceList
A List of faces.