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;
137 Foam::sampledSurfaces::sampledSurfaces
142 const bool loadFromFiles
147 mesh_(refCast<const fvMesh>(obr)),
148 loadFromFiles_(loadFromFiles),
157 outputPath_ = mesh_.time().path()/
".."/
"postProcessing"/
name;
161 outputPath_ = mesh_.time().path()/
"postProcessing"/
name;
180 verbose_ = verbosity;
197 const label nFields = classifyFields();
203 Pout<<
"Creating directory " 204 << outputPath_/mesh_.time().timeName() <<
nl <<
endl;
208 mkDir(outputPath_/mesh_.time().timeName());
213 if (nFields == 0 || formatter_->separateGeometry())
218 const IOobjectList objects(mesh_, mesh_.time().timeName());
220 sampleAndWrite<volScalarField>(objects);
221 sampleAndWrite<volVectorField>(objects);
222 sampleAndWrite<volSphericalTensorField>(objects);
223 sampleAndWrite<volSymmTensorField>(objects);
224 sampleAndWrite<volTensorField>(objects);
226 sampleAndWrite<surfaceScalarField>(objects);
227 sampleAndWrite<surfaceVectorField>(objects);
228 sampleAndWrite<surfaceSphericalTensorField>(objects);
229 sampleAndWrite<surfaceSymmTensorField>(objects);
230 sampleAndWrite<surfaceTensorField>(objects);
239 bool surfacesFound = dict.
found(
"surfaces");
243 dict.
lookup(
"fields") >> fieldSelection_;
245 dict.
lookup(
"interpolationScheme") >> interpolationScheme_;
246 const word writeType(dict.
lookup(
"surfaceFormat"));
265 mergeList_.setSize(size());
273 Info<<
"Reading surface description:" <<
nl;
276 Info<<
" " << operator[](surfI).name() <<
nl;
284 Pout<<
"sample fields:" << fieldSelection_ <<
nl 285 <<
"sample surfaces:" <<
nl <<
"(" <<
nl;
289 Pout<<
" " << operator[](surfI) <<
endl;
300 if (&mpm.
mesh() == &mesh_)
331 if (
operator[](surfI).needsUpdate())
343 bool justExpired =
false;
347 if (
operator[](surfI).expire())
355 mergeList_[surfI].clear();
366 bool updated =
false;
378 if (
operator[](surfI).update())
388 scalar mergeDim = mergeTol_ * mesh_.bounds().mag();
392 Pout<<
nl <<
"Merging all points within " 393 << mergeDim <<
" metre" <<
endl;
418 mergeList_[surfI].faces,
419 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.
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.
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.
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.
virtual bool update()=0
Update the surface as required.
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?
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.
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?
static autoPtr< surfaceWriter > New(const word &writeType)
Return a reference to the selected surfaceWriter.
Class used for the PtrLists read-construction.
dictionary subOrEmptyDict(const word &, const bool mustRead=false) const
Find and return a sub-dictionary as a copy, or.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.