48 void Foam::sampledIsoSurface::getIsoFields()
const 50 const fvMesh& fvm =
static_cast<const fvMesh&
>(
mesh());
60 <<
"Lookup volField " << isoField_ <<
endl;
62 storedVolFieldPtr_.clear();
72 <<
"Checking " << isoField_
73 <<
" for same time " << fvm.time().timeName()
79 storedVolFieldPtr_.empty()
80 || (fvm.time().timeName() != storedVolFieldPtr_().instance())
86 <<
"Reading volField " << isoField_
87 <<
" from time " << fvm.time().timeName()
94 fvm.time().timeName(),
103 storedVolFieldPtr_.reset
111 volFieldPtr_ = storedVolFieldPtr_.operator->();
116 <<
"Cannot find isosurface field " << isoField_
117 <<
" in database or directory " << vfHeader.path()
135 if (!subMeshPtr_.valid())
137 const word pointFldName =
138 "volPointInterpolate_" 149 <<
"lookup pointField " << pointFldName <<
endl;
156 if (!pfld.upToDate(*volFieldPtr_))
161 <<
"updating pointField " 162 << pointFldName <<
endl;
168 const_cast<pointScalarField&>(pfld)
172 pointFieldPtr_ = &pfld;
181 <<
"Checking pointField " << pointFldName
182 <<
" for same time " << fvm.time().timeName()
189 tmp<pointScalarField> tpfld
198 pointFieldPtr_ = tpfld.ptr();
207 storedVolFieldPtr_.reset
209 pointAverage(*pointFieldPtr_).ptr()
211 volFieldPtr_ = storedVolFieldPtr_.
operator->();
218 <<
"volField " << volFieldPtr_->name()
219 <<
" min:" <<
min(*volFieldPtr_).value()
220 <<
" max:" <<
max(*volFieldPtr_).value() <<
endl;
222 <<
"pointField " << pointFieldPtr_->name()
223 <<
" min:" <<
gMin(pointFieldPtr_->primitiveField())
224 <<
" max:" <<
gMax(pointFieldPtr_->primitiveField()) <<
endl;
230 const fvMesh& subFvm = subMeshPtr_().subMesh();
239 <<
"Sub-mesh lookup volField " 240 << isoField_ <<
endl;
242 storedVolSubFieldPtr_.clear();
243 volSubFieldPtr_ = &subFvm.lookupObject<
volScalarField>(isoField_);
250 <<
"Sub-setting volField " << isoField_ <<
endl;
252 storedVolSubFieldPtr_.reset
259 storedVolSubFieldPtr_->checkOut();
260 volSubFieldPtr_ = storedVolSubFieldPtr_.operator->();
267 "volPointInterpolate(" 268 + volSubFieldPtr_->
name()
276 <<
"Sub-mesh lookup pointField " << pointFldName <<
endl;
278 storedPointSubFieldPtr_.clear();
289 <<
"Interpolating submesh volField " 290 << volSubFieldPtr_->name()
291 <<
" to get submesh pointField " << pointFldName <<
endl;
293 storedPointSubFieldPtr_.reset
300 storedPointSubFieldPtr_->checkOut();
301 pointSubFieldPtr_ = storedPointSubFieldPtr_.operator->();
309 storedVolSubFieldPtr_.reset
311 pointAverage(*pointSubFieldPtr_).ptr()
313 volSubFieldPtr_ = storedVolSubFieldPtr_.operator->();
321 << volSubFieldPtr_->name()
322 <<
" min:" <<
min(*volSubFieldPtr_).value()
323 <<
" max:" <<
max(*volSubFieldPtr_).value() <<
endl;
326 << pointSubFieldPtr_->name()
327 <<
" min:" <<
gMin(pointSubFieldPtr_->primitiveField())
328 <<
" max:" <<
gMax(pointSubFieldPtr_->primitiveField()) <<
endl;
334 bool Foam::sampledIsoSurface::updateGeometry()
const 336 const fvMesh& fvm =
static_cast<const fvMesh&
>(
mesh());
339 if (fvm.time().timeIndex() == prevTimeIndex_)
345 if (zoneID_.index() != -1 && !subMeshPtr_.valid())
350 const label exposedPatchi = patches.findPatchID(exposedPatchName_);
354 Info<<
"Allocating subset of size " 356 <<
" with exposed faces into patch " 357 << patches[exposedPatchi].name() <<
endl;
362 new fvMeshSubset(fvm)
364 subMeshPtr_().setLargeCellSubset
372 prevTimeIndex_ = fvm.time().timeIndex();
382 if (subMeshPtr_.valid())
414 Pout<<
"sampledIsoSurface::updateGeometry() : constructed iso:" 416 <<
" regularise : " << regularise_ << nl
417 <<
" average : " << average_ << nl
418 <<
" isoField : " << isoField_ << nl
419 <<
" isoValue : " << isoVal_ <<
nl;
420 if (subMeshPtr_.valid())
422 Pout<<
" zone size : " << subMeshPtr_().subMesh().nCells()
426 <<
" tris : " << surface().size() << nl
427 <<
" cut cells : " << surface().meshCells().size()
445 isoField_(dict.
lookup(
"isoField")),
455 storedVolFieldPtr_(
nullptr),
456 volFieldPtr_(
nullptr),
457 pointFieldPtr_(
nullptr)
464 ) <<
"Non-interpolated iso surface not supported since triangles" 468 if (zoneID_.index() != -1)
470 dict.
lookup(
"exposedPatchName") >> exposedPatchName_;
477 ) <<
"Cannot find patch " << exposedPatchName_
478 <<
" in which to put exposed faces." <<
endl 483 if (debug && zoneID_.index() != -1)
485 Info<<
"Restricting to cellZone " << zoneID_.name()
486 <<
" with exposed internal faces into patch " 487 << exposedPatchName_ <<
endl;
519 if (prevTimeIndex_ == -1)
532 return updateGeometry();
541 return sampleField(vField);
550 return sampleField(vField);
559 return sampleField(vField);
568 return sampleField(vField);
577 return sampleField(vField);
586 return interpolateField(interpolator);
595 return interpolateField(interpolator);
603 return interpolateField(interpolator);
612 return interpolateField(interpolator);
621 return interpolateField(interpolator);
627 os <<
"sampledIsoSurface: " <<
name() <<
" :" 628 <<
" field :" << isoField_
629 <<
" value :" << isoVal_;
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
tmp< GeometricField< Type, pointPatchField, pointMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &) const
Interpolate volField using inverse distance weighting.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
An abstract class for surfaces with sampling.
Type gMin(const FieldField< Field, Type > &f)
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
void size(const label)
Override size to be inconsistent with allocated storage.
bool interpolate() const
Interpolation requested for surface.
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
virtual ~sampledIsoSurface()
Destructor.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label findPatchID(const word &patchName) const
Find patch index given a name.
const Time & time() const
Return the top-level database.
Macros for easy insertion into run-time selection tables.
static const volPointInterpolation & New(const fvMesh &mesh)
virtual bool update()
Update the surface as required.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
virtual bool needsUpdate() const
Does the surface need an update?
A class for handling words, derived from string.
const cellZoneMesh & cellZones() const
Return cell zone mesh.
virtual const fileName & name() const
Return the name of the stream.
wordList names() const
Return a list of patch names.
static const word null
An empty word.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
virtual void print(Ostream &) const
Write.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Type gMax(const FieldField< Field, Type > &f)
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
addNamedToRunTimeSelectionTable(GAMGProcAgglomeration, noneGAMGProcAgglomeration, GAMGAgglomeration, none)
label size() const
Return the number of elements in the UPtrList.
label timeIndex() const
Return current time index.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
prefixOSstream Pout(cout, "Pout")
Mesh data needed to do the Finite Volume discretisation.
friend Ostream & operator(Ostream &, const GeometricField< Type, PatchField, GeoMesh > &)
const doubleScalar e
Elementary charge.
virtual bool expire()
Mark the surface as needing an update.
Mesh consisting of general polyhedral cells.
sampledIsoSurface(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
A class for managing temporary objects.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
#define InfoInFunction
Report an information message using Foam::Info.