57Foam::surfaceWriters::debugWriter::mergeField
85 enableMerge_(options.getOrDefault(
"merge", true)),
86 enableWrite_(options.getOrDefault(
"write", false)),
90 Info<<
"Using debug surface writer ("
91 << (this->
isPointData() ?
"point" :
"face") <<
" data):";
111 open(surf, outputPath, parallel);
132void Foam::surfaceWriters::debugWriter::serialWriteGeometry
143 if (this->isPointData())
156 autoPtr<primitivePatch> ppPtr;
166 if (this->isPointData())
176 os << ppPtr().faceCentres();
194 fileName surfaceDir = outputPath_;
196 if (parallel_ && !enableMerge_)
200 Info<<
"Not merging or writing" <<
nl;
209 const meshedSurf& surf =
surface();
213 autoPtr<Time> dummyTimePtr;
221 Info<<
"Not writing: " << surf.faces().size() <<
" faces" <<
nl;
226 if (!
isDir(surfaceDir))
243 iopts.
note() = (this->isPointData() ?
"point data" :
"face data");
245 serialWriteGeometry(iopts, surf);
258 const word& fieldName,
271 if (parallel_ && !enableMerge_)
275 Info<<
"Not merging or writing" <<
nl;
296 Info<<
"Not writing: " << tfield().size()
297 <<
' ' << pTraits<Type>::typeName
301 const meshedSurf& surf =
surface();
324 iopts.
note() = (this->isPointData() ?
"point data" :
"face data");
326 serialWriteGeometry(iopts, surf);
342 iofld.note() = (this->isPointData() ?
"point data" :
"face data");
344 OFstream
os(iofld.objectPath(), streamOpt_);
348 iofld.writeHeader(
os);
Istream and Ostream manipulators taking arguments.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
A primitive field of type <T> with automated input and output.
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
const string & note() const noexcept
Return the optional note.
fileName objectPath() const
The complete path + object name.
bool writeHeader(Ostream &os) const
Write header with current type().
A simple container for options an IOstream can normally have.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
static const char * name(bool b) noexcept
A string representation of bool as "false" / "true".
static autoPtr< Time > NewGlobalTime()
Construct (dummy) global Time - no functionObjects or libraries, using the global path information st...
void size(const label n)
Older name for setAddressableSize.
static const Enum< commsTypes > commsTypeNames
Enumerated names for the communication types.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
static std::string path(const std::string &str)
Return directory path name (part before last /).
Abstract definition of a meshed surface defined by faces and points.
virtual const faceList & faces() const =0
The faces used for the surface.
virtual const pointField & points() const =0
The points used for the surface.
A traits class, which is primarily used for primitives and vector-space.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Base class for surface writers.
surfaceWriter()
Default construct.
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing surface.
bool gatherv_
Prefer MPI gatherv intrinsic (for field merging) [experimental].
bool wroteGeom_
Track if geometry has been written since the last open.
const meshedSurf & surface() const
Merge surfaces (if not upToDate) and return merged (parallel) or regular surface (non-parallel).
bool isPointData() const noexcept
Are the field data to be treated as point data?
void checkOpen() const
Verify that the outputPath_ has been set or FatalError.
bool parallel_
Writing in parallel (via master).
UPstream::commsTypes commType_
Communication type (for field merging).
virtual bool merge() const
Merge surfaces if they are not already upToDate (parallel) or simply mark the surface as being up-to-...
bool verbose_
Additional output verbosity.
tmp< Field< label > > mergeField(const Field< label > &fld) const
fileName outputPath_
The full output directory and file (surface) name.
A surfaceWriter for special purpose debugging. Its definition and behaviour are subject to change at ...
debugWriter()
Default construct.
virtual fileName write()
Write surface geometry to file.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
OBJstream os(runTime.globalPath()/outputName)
const wordList surface
Standard surface field types (scalar, vector, tensor, etc).
Namespace for surface writers.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
messageStream Info
Information stream (stdout output on master, null elsewhere).
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
List< face > faceList
List of faces.
vectorIOField pointIOField
pointIOField is a vectorIOField.
Ostream & endl(Ostream &os)
Add newline and flush stream.
vectorField pointField
pointField is a vectorField.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
constexpr char nl
The newline '\n' character (0x0a).
#define addProfiling(Name,...)
Define profiling trigger with specified name and description string. The description is generated by ...
Convenience macros for instantiating surfaceWriter methods.
#define defineSurfaceWriterWriteFields(ThisClass)