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;
253 dict.
found(
"filtering")
261 subMeshPtr_(
nullptr),
262 cellDistancePtr_(
nullptr),
265 if (zoneID_.index() != -1)
267 dict.
lookup(
"exposedPatchName") >> exposedPatchName_;
272 <<
"Cannot find patch " << exposedPatchName_
273 <<
" in which to put exposed faces." <<
endl 278 if (debug && zoneID_.index() != -1)
280 Info<<
"Restricting to cellZone " << zoneID_.name()
281 <<
" with exposed internal faces into patch " 282 << exposedPatchName_ <<
endl;
306 Pout<<
"cuttingPlane::expire :" 307 <<
" needsUpdate_:" << needsUpdate_ <<
endl;
328 Pout<<
"cuttingPlane::update :" 329 <<
" needsUpdate_:" << needsUpdate_ <<
endl;
339 needsUpdate_ =
false;
350 return sampleField(vField);
360 return sampleField(vField);
370 return sampleField(vField);
380 return sampleField(vField);
390 return sampleField(vField);
400 return interpolateField(interpolator);
410 return interpolateField(interpolator);
419 return interpolateField(interpolator);
429 return interpolateField(interpolator);
439 return interpolateField(interpolator);
445 os <<
"cuttingPlane: " <<
name() <<
" :" 446 <<
" plane:" << plane_
447 <<
" faces:" << faces().size()
448 <<
" 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 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 NamedEnum< filterType, 3 > filterTypeNames_
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< 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.
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.