33 namespace sampledSurfaces
43 void Foam::sampledSurfaces::cuttingPlane::createGeometry()
47 Pout<<
"cuttingPlane::createGeometry :updating geometry." 54 pointDistance_.clear();
55 cellDistancePtr_.clear();
61 if (zoneID_.index() != -1 && !subMeshPtr_.valid())
63 const polyBoundaryMesh& patches =
mesh().boundaryMesh();
66 const label exposedPatchi = patches.findPatchID(exposedPatchName_);
69 <<
"Allocating subset of size " 70 <<
mesh().cellZones()[zoneID_.index()].size()
71 <<
" with exposed faces into patch " 72 << patches[exposedPatchi].name() <<
endl;
76 new fvMeshSubset(static_cast<const fvMesh&>(
mesh()))
78 subMeshPtr_().setLargeCellSubset
90 ? subMeshPtr_().subMesh()
91 :
static_cast<const fvMesh&
>(this->
mesh())
98 cellDistancePtr_.
reset 105 mesh.time().timeName(),
120 scalarField& fld = cellDistance.primitiveFieldRef();
125 fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal();
129 volScalarField::Boundary& cellDistanceBf =
130 cellDistance.boundaryFieldRef();
134 forAll(cellDistanceBf, patchi)
138 isA<emptyFvPatchScalarField>
140 cellDistanceBf[patchi]
147 new calculatedFvPatchScalarField
154 const polyPatch& pp = mesh.boundary()[
patchi].patch();
158 fld.setSize(pp.size());
161 fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal();
171 fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal();
183 pointDistance_.setSize(mesh.nPoints());
189 pointDistance_[i] = (pts[i] - plane_.refPoint()) & plane_.normal();
196 Pout<<
"Writing cell distance:" << cellDistance.objectPath() <<
endl;
197 cellDistance.
write();
203 mesh.time().timeName(),
214 Pout<<
"Writing point distance:" << pDist.objectPath() <<
endl;
256 subMeshPtr_(
nullptr),
257 cellDistancePtr_(
nullptr),
260 if (zoneID_.index() != -1)
262 dict.
lookup(
"exposedPatchName") >> exposedPatchName_;
267 <<
"Cannot find patch " << exposedPatchName_
268 <<
" in which to put exposed faces." <<
endl 273 if (
debug && zoneID_.index() != -1)
275 Info<<
"Restricting to cellZone " << zoneID_.name()
276 <<
" with exposed internal faces into patch " 277 << exposedPatchName_ <<
endl;
301 Pout<<
"cuttingPlane::expire :" 302 <<
" needsUpdate_:" << needsUpdate_ <<
endl;
323 Pout<<
"cuttingPlane::update :" 324 <<
" needsUpdate_:" << needsUpdate_ <<
endl;
334 needsUpdate_ =
false;
345 return sampleField(vField);
355 return sampleField(vField);
365 return sampleField(vField);
375 return sampleField(vField);
385 return sampleField(vField);
395 return interpolateField(interpolator);
405 return interpolateField(interpolator);
414 return interpolateField(interpolator);
424 return interpolateField(interpolator);
434 return interpolateField(interpolator);
440 os <<
"cuttingPlane: " <<
name() <<
" :" 441 <<
" plane:" << plane_
442 <<
" faces:" << faces().size()
443 <<
" points:" <<
points().size();
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
cuttingPlane(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const word & name() const
Return the name of this functionObject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
An abstract class for surfaces with sampling.
virtual void print(Ostream &) const
Write.
defineTypeNameAndDebug(distanceSurface, 0)
virtual ~cuttingPlane()
Destructor.
virtual bool update()
Update the surface as required.
bool interpolate() const
Interpolation requested for surface.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label findPatchID(const word &patchName) const
Find patch index given a name.
Macros for easy insertion into run-time selection tables.
static const pointMesh & New(const polyMesh &mesh)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
vectorField pointField
pointField is a vectorField.
fvPatchField< scalar > fvPatchScalarField
A class for handling words, derived from string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const cellZoneMesh & cellZones() const
Return cell zone mesh.
wordList names() const
Return a list of patch names.
static const word null
An empty word.
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
#define DebugInfo
Report an information message using Foam::Info.
void reset(const label nPoints, const label nInternalFaces, const label nFaces, const label nCells)
Reset this primitiveMesh given the primitive array sizes.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Internal::FieldType & primitiveFieldRef()
Return a reference to the internal field.
addToRunTimeSelectionTable(sampledSurface, distanceSurface, word)
virtual bool needsUpdate() const
Does the surface need an update?
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
prefixOSstream Pout(cout, "Pout")
SubField< vector > subField
Declare type of subField.
virtual Ostream & write(const token &)=0
Write next token to stream.
Mesh consisting of general polyhedral cells.
A class for managing temporary objects.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
virtual bool expire()
Mark the surface as needing an update.