48 void Foam::sampledIsoSurface::getIsoFields()
const 50 const fvMesh& fvm =
static_cast<const fvMesh&
>(
mesh());
59 Info<<
"sampledIsoSurface::getIsoFields() : lookup volField " 62 storedVolFieldPtr_.clear();
71 Info<<
"sampledIsoSurface::getIsoFields() : checking " 72 << isoField_ <<
" for same time " << fvm.time().timeName()
78 storedVolFieldPtr_.empty()
79 || (fvm.time().timeName() != storedVolFieldPtr_().instance())
84 Info<<
"sampledIsoSurface::getIsoFields() : reading volField " 85 << isoField_ <<
" from time " << fvm.time().timeName()
92 fvm.time().timeName(),
99 if (vfHeader.headerOk())
101 storedVolFieldPtr_.reset
109 volFieldPtr_ = storedVolFieldPtr_.operator->();
114 <<
"Cannot find isosurface field " << isoField_
115 <<
" in database or directory " << vfHeader.path()
125 if (!subMeshPtr_.valid())
127 word pointFldName =
"volPointInterpolate(" + isoField_ +
')';
133 Info<<
"sampledIsoSurface::getIsoFields() : lookup pointField " 134 << pointFldName <<
endl;
144 Info<<
"sampledIsoSurface::getIsoFields() : " 145 <<
"checking pointField " << pointFldName
146 <<
" for same time " << fvm.time().timeName()
152 storedPointFieldPtr_.empty()
153 || (fvm.time().timeName() != storedPointFieldPtr_().instance())
158 Info<<
"sampledIsoSurface::getIsoFields() :" 159 <<
" interpolating volField " << volFieldPtr_->name()
160 <<
" to get pointField " << pointFldName <<
endl;
163 storedPointFieldPtr_.reset
168 storedPointFieldPtr_->checkOut();
169 pointFieldPtr_ = storedPointFieldPtr_.operator->();
178 storedVolFieldPtr_.reset
180 pointAverage(*pointFieldPtr_).ptr()
182 volFieldPtr_ = storedVolFieldPtr_.operator->();
188 Info<<
"sampledIsoSurface::getIsoFields() : volField " 189 << volFieldPtr_->name() <<
" min:" <<
min(*volFieldPtr_).value()
190 <<
" max:" <<
max(*volFieldPtr_).value() <<
endl;
191 Info<<
"sampledIsoSurface::getIsoFields() : pointField " 192 << pointFieldPtr_->name()
193 <<
" min:" <<
gMin(pointFieldPtr_->internalField())
194 <<
" max:" <<
gMax(pointFieldPtr_->internalField()) <<
endl;
200 const fvMesh& subFvm = subMeshPtr_().subMesh();
208 Info<<
"sampledIsoSurface::getIsoFields() :" 209 <<
" submesh lookup volField " 210 << isoField_ <<
endl;
212 storedVolSubFieldPtr_.clear();
213 volSubFieldPtr_ = &subFvm.lookupObject<
volScalarField>(isoField_);
219 Info<<
"sampledIsoSurface::getIsoFields() : " 220 <<
"subsetting volField " << isoField_ <<
endl;
222 storedVolSubFieldPtr_.reset
229 storedVolSubFieldPtr_->checkOut();
230 volSubFieldPtr_ = storedVolSubFieldPtr_.operator->();
237 "volPointInterpolate(" 238 + volSubFieldPtr_->
name()
245 Info<<
"sampledIsoSurface::getIsoFields() :" 246 <<
" submesh lookup pointField " << pointFldName <<
endl;
248 storedPointSubFieldPtr_.clear();
258 Info<<
"sampledIsoSurface::getIsoFields() :" 259 <<
" interpolating submesh volField " 260 << volSubFieldPtr_->name()
261 <<
" to get submesh pointField " << pointFldName <<
endl;
263 storedPointSubFieldPtr_.reset
270 storedPointSubFieldPtr_->checkOut();
271 pointSubFieldPtr_ = storedPointSubFieldPtr_.operator->();
279 storedVolSubFieldPtr_.reset
281 pointAverage(*pointSubFieldPtr_).ptr()
283 volSubFieldPtr_ = storedVolSubFieldPtr_.operator->();
289 Info<<
"sampledIsoSurface::getIsoFields() : volSubField " 290 << volSubFieldPtr_->name()
291 <<
" min:" <<
min(*volSubFieldPtr_).value()
292 <<
" max:" <<
max(*volSubFieldPtr_).value() <<
endl;
293 Info<<
"sampledIsoSurface::getIsoFields() : pointSubField " 294 << pointSubFieldPtr_->name()
295 <<
" min:" <<
gMin(pointSubFieldPtr_->internalField())
296 <<
" max:" <<
gMax(pointSubFieldPtr_->internalField()) <<
endl;
302 bool Foam::sampledIsoSurface::updateGeometry()
const 304 const fvMesh& fvm =
static_cast<const fvMesh&
>(
mesh());
307 if (fvm.time().timeIndex() == prevTimeIndex_)
313 if (zoneID_.index() != -1 && !subMeshPtr_.valid())
318 const label exposedPatchI = patches.findPatchID(exposedPatchName_);
322 Info<<
"Allocating subset of size " 324 <<
" with exposed faces into patch " 325 << patches[exposedPatchI].name() <<
endl;
330 new fvMeshSubset(fvm)
332 subMeshPtr_().setLargeCellSubset
340 prevTimeIndex_ = fvm.time().timeIndex();
350 if (subMeshPtr_.valid())
382 Pout<<
"sampledIsoSurface::updateGeometry() : constructed iso:" 384 <<
" regularise : " << regularise_ << nl
385 <<
" average : " << average_ << nl
386 <<
" isoField : " << isoField_ << nl
387 <<
" isoValue : " << isoVal_ <<
nl;
388 if (subMeshPtr_.valid())
390 Pout<<
" zone size : " << subMeshPtr_().subMesh().nCells()
394 <<
" tris : " << surface().size() << nl
395 <<
" cut cells : " << surface().meshCells().size()
413 isoField_(dict.
lookup(
"isoField")),
423 storedVolFieldPtr_(NULL),
425 storedPointFieldPtr_(NULL),
432 "sampledIsoSurface::sampledIsoSurface" 433 "(const word&, const polyMesh&, const dictionary&)",
435 ) <<
"Non-interpolated iso surface not supported since triangles" 439 if (zoneID_.index() != -1)
441 dict.
lookup(
"exposedPatchName") >> exposedPatchName_;
447 "sampledIsoSurface::sampledIsoSurface" 448 "(const word&, const polyMesh&, const dictionary&)",
450 ) <<
"Cannot find patch " << exposedPatchName_
451 <<
" in which to put exposed faces." <<
endl 456 if (debug && zoneID_.index() != -1)
458 Info<<
"Restricting to cellZone " << zoneID_.name()
459 <<
" with exposed internal faces into patch " 460 << exposedPatchName_ <<
endl;
492 if (prevTimeIndex_ == -1)
505 return updateGeometry();
514 return sampleField(vField);
523 return sampleField(vField);
532 return sampleField(vField);
541 return sampleField(vField);
550 return sampleField(vField);
559 return interpolateField(interpolator);
568 return interpolateField(interpolator);
576 return interpolateField(interpolator);
585 return interpolateField(interpolator);
594 return interpolateField(interpolator);
600 os <<
"sampledIsoSurface: " <<
name() <<
" :" 601 <<
" field :" << isoField_
602 <<
" value :" << isoVal_;
const cellZoneMesh & cellZones() const
Return cell zone mesh.
const pointField & points
Mesh data needed to do the Finite Volume discretisation.
label size() const
Return the number of elements in the PtrList.
An abstract class for surfaces with sampling.
word name(const complex &)
Return a string representation of a complex.
static const volPointInterpolation & New(const fvMesh &mesh)
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
virtual bool update()
Update the surface as required.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual ~sampledIsoSurface()
Destructor.
void size(const label)
Override size to be inconsistent with allocated storage.
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...
const Time & time() const
Return the top-level database.
sampledIsoSurface(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
wordList names() const
Return a list of patch names.
const double e
Elementary charge.
Ostream & endl(Ostream &os)
Add newline and flush stream.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
label timeIndex() const
Return current time index.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
Macros for easy insertion into run-time selection tables.
Type gMin(const FieldField< Field, Type > &f)
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
bool interpolate() const
Interpolation requested for surface.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
virtual const fileName & name() const
Return the name of the stream.
Mesh consisting of general polyhedral cells.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
virtual bool needsUpdate() const
Does the surface need an update?
An Ostream is an abstract base class for all output systems (streams, files, token lists...
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
addNamedToRunTimeSelectionTable(GAMGProcAgglomeration, noneGAMGProcAgglomeration, GAMGAgglomeration, none)
label findPatchID(const word &patchName) const
Find patch index given a name.
virtual void print(Ostream &) const
Write.
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
#define FatalIOErrorIn(functionName, ios)
Report an error message using Foam::FatalIOError.
Type gMax(const FieldField< Field, Type > &f)
A class for managing temporary objects.
virtual bool expire()
Mark the surface as needing an update.
static const word null
An empty word.
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout,"Pout")