50 bool Foam::sampledSurfaces::verbose_ =
false;
51 Foam::scalar Foam::sampledSurfaces::mergeTol_ = 1
e-10;
56 void Foam::sampledSurfaces::writeGeometry()
const 61 const fileName outputDir = outputPath_/mesh_.time().timeName();
65 const sampledSurface& s = operator[](surfI);
75 mergeList_[surfI].points,
76 mergeList_[surfI].faces
80 else if (s.faces().size())
96 Foam::sampledSurfaces::sampledSurfaces
107 refCast<const fvMesh>
115 loadFromFiles_(
false),
124 outputPath_ = mesh_.time().path()/
".."/
"postProcessing"/
name;
128 outputPath_ = mesh_.time().path()/
"postProcessing"/
name;
135 Foam::sampledSurfaces::sampledSurfaces
140 const bool loadFromFiles
145 mesh_(refCast<const fvMesh>(obr)),
146 loadFromFiles_(loadFromFiles),
155 outputPath_ = mesh_.time().path()/
".."/
"postProcessing"/
name;
159 outputPath_ = mesh_.time().path()/
"postProcessing"/
name;
176 verbose_ = verbosity;
193 const label nFields = classifyFields();
199 Pout<<
"Creating directory " 200 << outputPath_/mesh_.time().timeName() <<
nl <<
endl;
204 mkDir(outputPath_/mesh_.time().timeName());
209 if (nFields == 0 || formatter_->separateGeometry())
214 const IOobjectList objects(mesh_, mesh_.time().timeName());
216 sampleAndWrite<volScalarField>(objects);
217 sampleAndWrite<volVectorField>(objects);
218 sampleAndWrite<volSphericalTensorField>(objects);
219 sampleAndWrite<volSymmTensorField>(objects);
220 sampleAndWrite<volTensorField>(objects);
222 sampleAndWrite<surfaceScalarField>(objects);
223 sampleAndWrite<surfaceVectorField>(objects);
224 sampleAndWrite<surfaceSphericalTensorField>(objects);
225 sampleAndWrite<surfaceSymmTensorField>(objects);
226 sampleAndWrite<surfaceTensorField>(objects);
235 bool surfacesFound = dict.
found(
"surfaces");
239 dict.
lookup(
"fields") >> fieldSelection_;
241 dict.
lookup(
"interpolationScheme") >> interpolationScheme_;
242 const word writeType(dict.
lookup(
"surfaceFormat"));
261 mergeList_.setSize(size());
269 Info<<
"Reading surface description:" <<
nl;
272 Info<<
" " << operator[](surfI).name() <<
nl;
280 Pout<<
"sample fields:" << fieldSelection_ <<
nl 281 <<
"sample surfaces:" <<
nl <<
"(" <<
nl;
285 Pout<<
" " << operator[](surfI) <<
endl;
296 if (&mpm.
mesh() == &mesh_)
327 if (
operator[](surfI).needsUpdate())
339 bool justExpired =
false;
343 if (
operator[](surfI).expire())
351 mergeList_[surfI].clear();
362 bool updated =
false;
374 if (
operator[](surfI).update())
384 scalar mergeDim = mergeTol_ * mesh_.bounds().mag();
388 Pout<<
nl <<
"Merging all points within " 389 << mergeDim <<
" metre" <<
endl;
414 mergeList_[surfI].faces,
415 mergeList_[surfI].pointsMap
virtual bool write()
Sample and write.
virtual bool read(const dictionary &)
Read the sampledSurfaces dictionary.
#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.
const double e
Elementary charge.
A list of keyword definitions, which are a keyword followed by any number of values (e...
An abstract class for surfaces with sampling.
dictionary subOrEmptyDict(const word &, const bool mustRead=false) const
Find and return a sub-dictionary as a copy, or.
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 function objects.
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.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
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.
virtual bool needsUpdate() const
Does any of the surfaces need an update?
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
virtual bool update()=0
Update the surface as required.
prefixOSstream Pout(cout,"Pout")
Istream and Ostream manipulators taking arguments.
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?
virtual const pointField & points() const =0
Points of surface.
virtual bool expire()
Mark the surfaces as needing an update.
Mesh consisting of general polyhedral cells.
readUpdateState
Enumeration defining the state of the mesh after a read update.
Registry of regIOobjects.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
static autoPtr< surfaceWriter > New(const word &writeType)
Return a reference to the selected surfaceWriter.
Class used for the PtrLists read-construction.
const polyMesh & mesh() const
Return polyMesh.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.