45 bool Foam::sampledSurfaces::verbose_ =
false;
46 Foam::scalar Foam::sampledSurfaces::mergeTol_ = 1
e-10;
51 void Foam::sampledSurfaces::writeGeometry()
const 56 const fileName outputDir = outputPath_/mesh_.time().timeName();
60 const sampledSurface& s = operator[](surfI);
70 mergeList_[surfI].points,
71 mergeList_[surfI].faces
75 else if (s.faces().size())
102 refCast<const fvMesh>
110 loadFromFiles_(
false),
119 outputPath_ = mesh_.time().path()/
".."/
"postProcessing"/
name;
123 outputPath_ = mesh_.time().path()/
"postProcessing"/
name;
137 const bool loadFromFiles
142 mesh_(refCast<const fvMesh>(obr)),
143 loadFromFiles_(loadFromFiles),
152 outputPath_ = mesh_.time().path()/
".."/
"postProcessing"/
name;
156 outputPath_ = mesh_.time().path()/
"postProcessing"/
name;
175 verbose_ = verbosity;
192 const label nFields = classifyFields();
198 Pout<<
"Creating directory " 199 << outputPath_/mesh_.time().timeName() <<
nl <<
endl;
203 mkDir(outputPath_/mesh_.time().timeName());
208 if (nFields == 0 || formatter_->separateGeometry())
215 sampleAndWrite<volScalarField>(
objects);
216 sampleAndWrite<volVectorField>(
objects);
217 sampleAndWrite<volSphericalTensorField>(
objects);
218 sampleAndWrite<volSymmTensorField>(
objects);
219 sampleAndWrite<volTensorField>(
objects);
221 sampleAndWrite<surfaceScalarField>(
objects);
222 sampleAndWrite<surfaceVectorField>(
objects);
223 sampleAndWrite<surfaceSphericalTensorField>(
objects);
224 sampleAndWrite<surfaceSymmTensorField>(
objects);
225 sampleAndWrite<surfaceTensorField>(
objects);
234 bool surfacesFound = dict.
found(
"surfaces");
238 dict.
lookup(
"fields") >> fieldSelection_;
240 dict.
lookup(
"interpolationScheme") >> interpolationScheme_;
241 const word writeType(dict.
lookup(
"surfaceFormat"));
255 mergeList_.setSize(size());
263 Info<<
"Reading surface description:" <<
nl;
266 Info<<
" " << operator[](surfI).name() <<
nl;
274 Pout<<
"sample fields:" << fieldSelection_ <<
nl 275 <<
"sample surfaces:" <<
nl <<
"(" <<
nl;
279 Pout<<
" " << operator[](surfI) <<
endl;
290 if (&mpm.
mesh() == &mesh_)
321 if (
operator[](surfI).needsUpdate())
333 bool justExpired =
false;
337 if (
operator[](surfI).expire())
345 mergeList_[surfI].clear();
356 bool updated =
false;
368 if (
operator[](surfI).update())
378 scalar mergeDim = mergeTol_ * mesh_.bounds().mag();
382 Pout<<
nl <<
"Merging all points within " 383 << mergeDim <<
" metre" <<
endl;
408 mergeList_[surfI].faces,
409 mergeList_[surfI].pointsMap
virtual bool write()
Sample and write.
virtual bool read(const dictionary &)
Read the sampledSurfaces dictionary.
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.
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 bool update()
Update the surfaces as required and merge surface points (parallel).
List of IOobjects with searching and retrieving facilities.
A list of keyword definitions, which are a keyword followed by any number of values (e...
An abstract class for surfaces with sampling.
static autoPtr< surfaceWriter > New(const word &writeType, const IOstream::streamFormat writeFormat)
Return a reference to the selected surfaceWriter.
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh - expires the surfaces.
void size(const label)
Override size to be inconsistent with allocated storage.
static const fileName null
An empty fileName.
static word defaultRegion
Return the default region name.
void verbose(const bool verbosity=true)
Set verbosity level.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
virtual void readUpdate(const polyMesh::readUpdateState state)
Update for changes of mesh due to readUpdate - expires the surfaces.
virtual ~sampledSurfaces()
Destructor.
Abstract base-class for Time/database functionObjects.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
virtual const faceList & faces() const =0
Faces of surface.
A list of faces which address into the list of points.
A List obtained as a section of another List.
bool read(const char *, int32_t &)
A class for handling words, derived from string.
static const word null
An empty word.
sampledSurfaces(const word &name, const Time &time, const dictionary &dict)
Construct from Time and dictionary.
virtual bool update()=0
Update the surface as required.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
virtual void movePoints(const polyMesh &)
Update for mesh point-motion - expires the surfaces.
defineTypeNameAndDebug(combustionModel, 0)
virtual bool execute()
Execute, currently does nothing.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
word name(const complex &)
Return a string representation of a complex.
static bool & parRun()
Is this a parallel run?
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
virtual const pointField & points() const =0
Points of surface.
prefixOSstream Pout(cout, "Pout")
const polyMesh & mesh() const
Return polyMesh.
virtual bool expire()
Mark the surfaces as needing an update.
const doubleScalar e
Elementary charge.
Mesh consisting of general polyhedral cells.
readUpdateState
Enumeration defining the state of the mesh after a read update.
Registry of regIOobjects.
virtual bool needsUpdate() const
Does any of the surfaces need an update?
Class used for the PtrLists read-construction.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.