34 namespace sampledSurfaces
44 void Foam::sampledSurfaces::cuttingPlane::createGeometry()
48 Pout<<
"cuttingPlane::createGeometry :updating geometry." 55 pointDistance_.clear();
56 cellDistancePtr_.clear();
62 if (zoneKey_.size() && !subMeshPtr_.valid())
64 const polyBoundaryMesh& patches =
mesh().boundaryMesh();
67 const label exposedPatchi = patches.findPatchID(exposedPatchName_);
71 new fvMeshSubset(static_cast<const fvMesh&>(
mesh()))
73 subMeshPtr_().setLargeCellSubset
80 <<
"Allocating subset of size " << subMeshPtr_().subMesh().nCells()
81 <<
" with exposed faces into patch " 82 << patches[exposedPatchi].name() <<
endl;
89 ? subMeshPtr_().subMesh()
90 :
static_cast<const fvMesh&
>(this->
mesh())
97 cellDistancePtr_.
reset 104 mesh.time().timeName(),
119 scalarField& fld = cellDistance.primitiveFieldRef();
124 fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal();
128 volScalarField::Boundary& cellDistanceBf =
129 cellDistance.boundaryFieldRef();
133 forAll(cellDistanceBf, patchi)
137 isA<emptyFvPatchScalarField>
139 cellDistanceBf[patchi]
146 new calculatedFvPatchScalarField
153 const polyPatch& pp = mesh.boundary()[
patchi].patch();
157 fld.setSize(pp.size());
160 fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal();
170 fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal();
182 pointDistance_.setSize(mesh.nPoints());
188 pointDistance_[i] = (pts[i] - plane_.refPoint()) & plane_.normal();
195 Pout<<
"Writing cell distance:" << cellDistance.objectPath() <<
endl;
196 cellDistance.
write();
202 mesh.time().timeName(),
213 Pout<<
"Writing point distance:" << pDist.objectPath() <<
endl;
252 dict.
found(
"filtering")
260 subMeshPtr_(
nullptr),
261 cellDistancePtr_(
nullptr),
266 dict.
lookup(
"exposedPatchName") >> exposedPatchName_;
271 <<
"Cannot find patch " << exposedPatchName_
272 <<
" in which to put exposed faces." <<
endl 279 Info<<
"Restricting to cellZone " << zoneKey_
280 <<
" with exposed internal faces into patch " 281 << exposedPatchName_ <<
endl;
287 <<
"cellZone " << zoneKey_
288 <<
" not found - using entire mesh" <<
endl;
312 Pout<<
"cuttingPlane::expire :" 313 <<
" needsUpdate_:" << needsUpdate_ <<
endl;
334 Pout<<
"cuttingPlane::update :" 335 <<
" needsUpdate_:" << needsUpdate_ <<
endl;
345 needsUpdate_ =
false;
356 return sampleField(vField);
366 return sampleField(vField);
376 return sampleField(vField);
386 return sampleField(vField);
396 return sampleField(vField);
406 return interpolateField(interpolator);
416 return interpolateField(interpolator);
425 return interpolateField(interpolator);
435 return interpolateField(interpolator);
445 return interpolateField(interpolator);
451 os <<
"cuttingPlane: " <<
name() <<
" :" 452 <<
" plane:" << plane_
453 <<
" faces:" << faces().size()
454 <<
" points:" <<
points().size();
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
virtual Ostream & write(const char)=0
Write character.
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 meshCellZones & cellZones() const
Return cell zones.
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)
static const NamedEnum< filterType, 4 > filterTypeNames_
virtual ~cuttingPlane()
Destructor.
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
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.
const dimensionSet dimLength
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.
wordList names() const
Return a list of patch names.
static const word null
An empty word.
#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.
static pointMesh & New(polyMesh &mesh)
addToRunTimeSelectionTable(sampledSurface, distanceSurface, word)
word name(const complex &)
Return a string representation of a complex.
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,.
#define WarningInFunction
Report a warning using Foam::Warning.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
prefixOSstream Pout(cout, "Pout")
label findIndex(const wordRe &) const
Return zone index for the first match, return -1 if not found.
SubField< Type > subField
Declare type of subField.
Enum read(Istream &) const
Read a word from Istream and return the corresponding.
Mesh consisting of general polyhedral cells.
A class for managing temporary objects.
static const wordRe null
An empty wordRe.
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.