Go to the documentation of this file.
43 void Foam::ccm::writer::addLinearMap
45 const string& mapName,
69 data[i] =
start + 1 + i;
86 Foam::label Foam::ccm::writer::findDefaultBoundary()
const
88 return mesh_.boundaryMesh().findPatchID(defaultBoundaryName);
92 void Foam::ccm::writer::writeBoundaryRegion
102 const dictionary&
dict = iter();
108 dict.readIfPresent(
"Label", nameEntry)
109 &&
dict.readIfPresent(
"BoundaryType", typeEntry)
110 && !typeDict.found(nameEntry)
113 typeDict.add(nameEntry, typeEntry);
117 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
119 label defaultId = findDefaultBoundary();
124 CCMIONewIndexedEntity
126 &(globalState_->error),
128 kCCMIOBoundaryRegion,
151 word patchName =
patches[patchI].name();
152 word patchType =
patches[patchI].type();
154 label regionId = patchI;
155 if (regionId == defaultId)
159 else if (defaultId == -1 || regionId < defaultId)
165 typeDict.readIfPresent(patchName, patchType);
168 CCMIONewIndexedEntity
170 &(globalState_->error),
172 kCCMIOBoundaryRegion,
195 void Foam::ccm::writer::writeCellTable
197 const ccmID& probNode
200 if (!cellTable_.size())
210 label intVal = iter.key();
211 const dictionary&
dict = iter();
213 CCMIONewIndexedEntity
215 &(globalState_->error),
224 for (
const word& keyword : toc)
226 int pos = keyword.find(
"Id");
231 dict.readEntry(keyword, intVal);
243 const word strVal(
dict.get<word>(keyword));
261 void Foam::ccm::writer::writeProblem
263 const ccmID& stateNode
269 &(globalState_->error),
270 (globalState_->root),
271 kCCMIOProblemDescription,
276 writeCellTable(probNode);
277 writeBoundaryRegion(probNode);
282 &(globalState_->error),
292 Foam::ccm::writer::writer
310 boundaryRegion_(
mesh),
318 Info<<
"moved existing file -> " <<
fileName(file +
".bak*") <<
nl;
321 else if (
exists(file,
false))
324 Info<<
"removed existing file: " << file <<
nl;
328 globalState_->error = CCMIOOpenFile
333 &(globalState_->root)
335 assertNoError(
"Error opening file for writing");
349 maps_->internalFaces,
350 mesh_.nInternalFaces()
353 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
354 maps_->boundary.setSize(
patches.size());
359 if (
patches[patchI].size() > 0)
361 string mapName =
"boundaryMap-" +
Foam::name(patchI);
366 maps_->boundary[patchI],
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
A class for handling file names.
Template functions to aid in the implementation of demand driven data.
static string defaultMeshName
The name for the topology file reference.
ccmGlobalState * globalState_
Maintain overall global states (error, root-node)
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool assertNoError(int err, const char *msg)
Die with msg if there is an error.
A class for handling character strings derived from std::string.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
List< word > wordList
A List of words.
void deleteDemandDrivenData(DataPtr &dataPtr)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
~writer()
Destructor (closes file)
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
Internal bits for wrapping libccmio - do not use directly.
static const cellModel & ref(const modelType model)
Look up reference to cellModel by enumeration. Fatal on failure.
bool mvBak(const fileName &src, const std::string &ext="bak")
Rename to a corresponding backup file.
forAllConstIters(mixture.phases(), phase)
label ListType::const_reference const label start
const polyBoundaryMesh & patches
label index() const
Return index of model in the model list.
Base functionality common to reader and writer classes.
dimensionedScalar pos(const dimensionedScalar &ds)