37 namespace functionObjects
50 bool Foam::functionObjects::sampledSurfaces::verbose_ =
false;
51 Foam::scalar Foam::functionObjects::sampledSurfaces::mergeTol_ = 1
e-10;
56 void Foam::functionObjects::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())
107 refCast<const fvMesh>
115 loadFromFiles_(
false),
127 outputPath_ = outputPath_/mesh_.name();
139 const bool loadFromFiles
144 mesh_(refCast<const fvMesh>(obr)),
145 loadFromFiles_(loadFromFiles),
157 outputPath_ = outputPath_/mesh_.name();
174 verbose_ = verbosity;
191 const label nFields = classifyFields();
197 Pout<<
"Creating directory " 198 << outputPath_/mesh_.time().timeName() <<
nl <<
endl;
202 mkDir(outputPath_/mesh_.time().timeName());
207 if (nFields == 0 || formatter_->separateGeometry())
214 sampleAndWrite<volScalarField>(
objects);
215 sampleAndWrite<volVectorField>(
objects);
216 sampleAndWrite<volSphericalTensorField>(
objects);
217 sampleAndWrite<volSymmTensorField>(
objects);
218 sampleAndWrite<volTensorField>(
objects);
220 sampleAndWrite<surfaceScalarField>(
objects);
221 sampleAndWrite<surfaceVectorField>(
objects);
222 sampleAndWrite<surfaceSphericalTensorField>(
objects);
223 sampleAndWrite<surfaceSymmTensorField>(
objects);
224 sampleAndWrite<surfaceTensorField>(
objects);
233 bool surfacesFound = dict.
found(
"surfaces");
237 dict.
lookup(
"fields") >> fieldSelection_;
239 dict.
lookup(
"interpolationScheme") >> interpolationScheme_;
240 const word writeType(dict.
lookup(
"surfaceFormat"));
254 mergeList_.setSize(size());
262 Info<<
"Reading surface description:" <<
nl;
265 Info<<
" " << operator[](surfI).name() <<
nl;
273 Pout<<
"sample fields:" << fieldSelection_ <<
nl 274 <<
"sample surfaces:" <<
nl <<
"(" <<
nl;
278 Pout<<
" " << operator[](surfI) <<
endl;
289 if (&mpm.
mesh() == &mesh_)
323 if (
operator[](surfI).needsUpdate())
335 bool justExpired =
false;
339 if (
operator[](surfI).expire())
347 mergeList_[surfI].clear();
358 bool updated =
false;
370 if (
operator[](surfI).update())
380 scalar mergeDim = mergeTol_ * mesh_.bounds().mag();
384 Pout<<
nl <<
"Merging all points within " 385 << mergeDim <<
" metre" <<
endl;
410 mergeList_[surfI].faces,
411 mergeList_[surfI].pointsMap
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 execute()
Execute, currently does nothing.
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.
sampledSurfaces(const word &name, const Time &time, const dictionary &dict)
Construct from Time and dictionary.
void size(const label)
Override size to be inconsistent with allocated storage.
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
static const fileName null
An empty fileName.
virtual bool needsUpdate() const
Does any of the surfaces need an update?
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion - expires the surfaces.
static bool master(const label communicator=0)
Am I the master process.
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.
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh - expires the surfaces.
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.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
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 &)
virtual bool write()
Sample and write.
static const word outputPrefix
Directory prefix.
A class for handling words, derived from string.
virtual ~sampledSurfaces()
Destructor.
static const word null
An empty word.
virtual bool update()=0
Update the surface as required.
virtual bool expire()
Mark the surfaces as needing an update.
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.
defineTypeNameAndDebug(Qdot, 0)
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,.
void verbose(const bool verbosity=true)
Set verbosity level.
virtual bool update()
Update the surfaces as required and merge surface points (parallel).
virtual const pointField & points() const =0
Points of surface.
prefixOSstream Pout(cout, "Pout")
const polyMesh & mesh() const
Return polyMesh.
virtual bool read(const dictionary &)
Read the sampledSurfaces dictionary.
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 void readUpdate(const polyMesh::readUpdateState state)
Update for changes of mesh due to readUpdate - expires the surfaces.
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.