writer Class Reference

Write OpenFOAM meshes and/or results to CCM format. More...

Inheritance diagram for writer:
[legend]
Collaboration diagram for writer:
[legend]

Public Member Functions

 writer (const fileName &file, const polyMesh &mesh, const bool backup=true)
 Open a file for writing, with backup/overwrite existing file. More...
 
 ~writer ()
 Destructor (closes file) More...
 
void writeGeometry ()
 Write the mesh. More...
 
void writeSolution (const IOobjectList &objects, const fileName &remappingDictName=fileName::null)
 Write the solutions. More...
 
- Public Member Functions inherited from base
 base ()
 Default construct. Initializes the global-state. More...
 
 ~base ()
 Destructor: close file. More...
 
bool close ()
 Explicitly close the file and terminate ccmio access. More...
 

Static Public Attributes

static string defaultMeshName = "meshExport"
 The name for the topology file reference. More...
 

Additional Inherited Members

- Protected Types inherited from STARCDCore
enum  fileHeader { HEADER_CEL , HEADER_VRT , HEADER_BND }
 Enumeration defining the file headers. More...
 
enum  fileExt { CEL_FILE , VRT_FILE , BND_FILE , INP_FILE }
 Enumeration defining the file extensions. More...
 
enum  matlType {
  starcdFluidType = 1 , starcdSolidType = 2 , starcdBaffleType = 3 , starcdShellType = 4 ,
  starcdLineType = 5 , starcdPointType = 6
}
 Basic material type for STARCD/PROSTAR files. More...
 
enum  shapeType {
  starcdPoint = 1 , starcdLine = 2 , starcdShell = 3 , starcdHex = 11 ,
  starcdPrism = 12 , starcdTet = 13 , starcdPyr = 14 , starcdPoly = 255
}
 Shape-Type for STARCD/PROSTAR files. More...
 
- Protected Member Functions inherited from base
bool assertNoError (const char *msg) const
 check global state for errors and die as required More...
 
bool assertNoError (const std::string &msg) const
 check global state for errors and die as required More...
 
 base (const base &)=delete
 No copy construct. More...
 
void operator= (const base &)=delete
 No copy assignment. More...
 
- Protected Member Functions inherited from STARCDCore
 STARCDCore ()=default
 Construct null. More...
 
- Static Protected Member Functions inherited from base
static bool assertNoError (int err, const char *msg)
 Die with msg if there is an error. More...
 
static bool assertNoError (int err, const std::string &msg)
 Die with msg if there is an error. More...
 
- Static Protected Member Functions inherited from STARCDCore
static bool readHeader (IFstream &is, const enum fileHeader header)
 Read header and check signature PROSTAR_(CELL|VERTEX|BOUNDARY) More...
 
static void writeHeader (Ostream &os, const enum fileHeader header)
 Write header for fileType (CELL|VERTEX|BOUNDARY) More...
 
static fileName starFileName (const fileName &baseName, const enum fileExt ext)
 Resolve base file-name for the given file-type. More...
 
static void removeFiles (const fileName &baseName)
 Remove existing PROSTAR files for the given base file-name. More...
 
static label readPoints (IFstream &is, List< point > &points, List< label > &ids)
 Read points from a (.vrt) file, return the max prostar id used. More...
 
static void writePoints (Ostream &os, const UList< point > &points, const scalar scaleFactor=1.0)
 Write header and points to (.vrt) file, optionally with scaling. More...
 
- Protected Attributes inherited from base
std::unique_ptr< ccmGlobalState > globalState_
 Maintain overall global states (error, root-node) More...
 
- Static Protected Attributes inherited from STARCDCore
static const Map< FixedList< int, 6 > > starToFoamFaceAddr
 Face addressing from PROSTAR faces to OpenFOAM faces. More...
 
static const Map< FixedList< int, 6 > > foamToStarFaceAddr
 Face addressing from OpenFOAM faces to PROSTAR faces. More...
 
static const char *const defaultBoundaryName
 The name for default (unassigned) boundaries. More...
 
static const char *const defaultSolidBoundaryName
 The name we have chosen for default (unassigned) solid boundaries. More...
 

Detailed Description

Write OpenFOAM meshes and/or results to CCM format.

  • partial support for interfaces
  • no monitoring (internal) boundaries
  • does not handle Lagrangian data
Files

The constant/boundaryRegion and constant/cellTable files, which are described in ccmReader, are used to construct the CCM ProblemDescription node.

The constant/remapping file is an IOdictionary that is READ_IF_PRESENT and can be used to remap certain information. eg,

    // map OpenFOAM scalar fields to CCM output fields
    fields
    {
        tracer0
        {
            name    CONC_001;
            Label   "tracer0";
        }
        tracer1
        {
            name    CONC_002;
            Label   "tracer1";
        }
        tracer2
        {
            name    CONC_003;
            Label   "tracer2";
        }
        divPhi
        {
            name    CONC_004;
            Label   "divPhi";
        }
        // an example with units:
        p
        {
            name    P;
            Label   "Pressure";
            units   "Pa";
        }
    }
Note
This class is in development
  • any/all of the class names and members may change
Source files

Definition at line 119 of file ccmWriter.H.

Constructor & Destructor Documentation

◆ writer()

writer ( const fileName file,
const polyMesh mesh,
const bool  backup = true 
)

Open a file for writing, with backup/overwrite existing file.

Definition at line 291 of file ccmWriter.C.

References cellModel::HEX, cellModel::PRISM, cellModel::PYR, dictionary::Searcher< Const >::ref(), and cellModel::TET.

Here is the call graph for this function:

◆ ~writer()

~writer ( )

Destructor (closes file)

Definition at line 376 of file ccmWriter.C.

Member Function Documentation

◆ writeGeometry()

void writeGeometry ( )

Write the mesh.

Definition at line 717 of file ccmWriterMesh.C.

◆ writeSolution()

void writeSolution ( const IOobjectList objects,
const fileName remappingDictName = fileName::null 
)

Write the solutions.

provide optional remapping dictionary

Definition at line 125 of file ccmWriterSolution.C.

References GeometricField< Type, PatchField, GeoMesh >::component(), Foam::endl(), field(), Foam::flush(), forAll, forAllConstIters, dictionary::found(), Foam::Info, io(), dictionary::isDict(), Foam::name(), IOobject::NO_WRITE, patches, IOobject::READ_IF_PRESENT, dictionary::readEntry(), runTime, dictionary::subDict(), timeIndex, ensightPTraits< Type >::typeName, and WarningInFunction.

Here is the call graph for this function:

Member Data Documentation

◆ defaultMeshName

Foam::string defaultMeshName = "meshExport"
static

The name for the topology file reference.

Definition at line 218 of file ccmWriter.H.


The documentation for this class was generated from the following files: