45 namespace surfaceWriters
58 Foam::surfaceWriters::debugWriter::mergeField
66 "debugWriter::merge-field" 76 auto& allFld = tfield.ref();
147 mpiGatherv_(options.getOrDefault(
"gatherv", false)),
148 enableWrite_(options.getOrDefault(
"write", false)),
152 Info<<
"Using debug surface writer (" 153 << (this->
isPointData() ?
"point" :
"face") <<
" data):" 170 open(surf, outputPath, parallel);
191 void Foam::surfaceWriters::debugWriter::serialWriteGeometry
202 if (this->isPointData())
215 autoPtr<primitivePatch> ppPtr;
225 if (this->isPointData())
235 os << ppPtr().faceCentres();
253 fileName surfaceDir = outputPath_;
255 const meshedSurf& surf =
surface();
259 autoPtr<Time> dummyTimePtr;
267 Info<<
"Not writing: " << surf.faces().size() <<
" faces" <<
nl;
272 if (!
isDir(surfaceDir))
289 iopts.
note() = (this->isPointData() ?
"point data" :
"face data");
291 serialWriteGeometry(iopts, surf);
304 const word& fieldName,
329 Info<<
"Not writing: " << tfield().size()
334 const meshedSurf& surf =
surface();
357 iopts.
note() = (this->isPointData() ?
"point data" :
"face data");
359 serialWriteGeometry(iopts, surf);
375 iofld.note() = (this->isPointData() ?
"point data" :
"face data");
377 OFstream
os(iofld.objectPath(), streamOpt_);
381 iofld.writeHeader(
os);
void size(const label n)
Older name for setAddressableSize.
static void mpiGatherOp(const UList< Type > &sendData, OutputContainer &allData, const label comm=UPstream::worldComm, const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const int tag=UPstream::msgType())
Use MPI_Gatherv call to collect contiguous data when possible (in serial: performs a simple copy)...
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
const globalIndex & faceGlobalIndex() const noexcept
Const access to globalIndex used for faces gathering.
A class for handling file names.
static const Enum< commsTypes > commsTypeNames
Enumerated names for the communication types.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
vectorIOField pointIOField
pointIOField is a vectorIOField.
const labelList & pointsMap() const noexcept
Map for reordered points (old-to-new)
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing surface.
constexpr char nl
The newline '\n' character (0x0a)
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A traits class, which is primarily used for primitives.
static bool & parRun() noexcept
Test if this a parallel run.
const string & note() const noexcept
Return the optional note.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static int & msgType() noexcept
Message tag of standard messages.
A simple container for options an IOstream can normally have.
static std::string path(const std::string &str)
Return directory path name (part before last /)
bool parallel_
Writing in parallel (via master)
Ignore writing from objectRegistry::writeObject()
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
mergedSurf mergedSurf_
Surface after merging (parallel)
bool writeHeader(Ostream &os) const
Write header with current type()
UPstream::commsTypes commType_
Communication type (for field merging)
fileName objectPath() const
The complete path + object name.
Macros for easy insertion into run-time selection tables.
virtual const pointField & points() const noexcept
Const access to (global) points used for the surface.
defineSurfaceWriterWriteFields(Foam::surfaceWriters::debugWriter)
Abstract definition of a meshed surface defined by faces and points.
bool isPointData() const noexcept
Are the field data to be treated as point data?
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
static const char * name(const bool b) noexcept
A string representation of bool as "false" / "true".
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Generic templated field type.
A class for handling words, derived from Foam::string.
virtual fileName write()
Write surface geometry to file.
virtual const faceList & faces() const =0
The faces used for the surface.
const wordList surface
Standard surface field types (scalar, vector, tensor, etc)
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
Istream and Ostream manipulators taking arguments.
const globalIndex & pointGlobalIndex() const noexcept
Const access to globalIndex used for points gathering.
OBJstream os(runTime.globalPath()/outputName)
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field...
Convenience macros for instantiating surfaceWriter methods.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
defineTypeName(abaqusWriter)
static fileName envGlobalPath()
Global case (directory) from environment variable.
debugWriter()
Default construct.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool merge() const
Merge surfaces if they are not already upToDate (parallel) or simply mark the surface as being up-to-...
Base class for surface writers.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
static void gather(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking)
Collect data in processor order on master (== procIDs[0]).
A surfaceWriter for special purpose debugging. Its definition and behaviour are subject to change at ...
A class for managing temporary objects.
addToRunTimeSelectionTable(surfaceWriter, abaqusWriter, word)
Do not request registration (bool: false)
static autoPtr< surfaceWriter > New(const word &writeType)
Return a reference to the selected surfaceWriter.
bool upToDate_
The topology/surface is up-to-date?
virtual const pointField & points() const =0
The points used for the surface.