42 void Foam::ccm::writer::addLinearMap
44 const string& mapName,
68 data[i] = start + 1 + i;
85 Foam::label Foam::ccm::writer::findDefaultBoundary()
const
87 return mesh_.boundaryMesh().findPatchID(defaultBoundaryName);
91 void Foam::ccm::writer::writeBoundaryRegion
101 const dictionary&
dict = iter();
107 dict.readIfPresent(
"Label", nameEntry)
108 &&
dict.readIfPresent(
"BoundaryType", typeEntry)
109 && !typeDict.found(nameEntry)
112 typeDict.add(nameEntry, typeEntry);
116 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
118 label defaultId = findDefaultBoundary();
123 CCMIONewIndexedEntity
125 &(globalState_->error),
127 kCCMIOBoundaryRegion,
150 word patchName =
patches[patchI].name();
151 word patchType =
patches[patchI].type();
153 label regionId = patchI;
154 if (regionId == defaultId)
158 else if (defaultId == -1 || regionId < defaultId)
164 typeDict.readIfPresent(patchName, patchType);
167 CCMIONewIndexedEntity
169 &(globalState_->error),
171 kCCMIOBoundaryRegion,
194 void Foam::ccm::writer::writeCellTable
196 const ccmID& probNode
199 if (!cellTable_.size())
209 label intVal = iter.key();
210 const dictionary&
dict = iter();
212 CCMIONewIndexedEntity
214 &(globalState_->error),
223 for (
const word& keyword : toc)
225 int pos = keyword.find(
"Id");
230 dict.readEntry(keyword, intVal);
242 const word strVal(
dict.get<word>(keyword));
260 void Foam::ccm::writer::writeProblem
262 const ccmID& stateNode
268 &(globalState_->error),
269 (globalState_->root),
270 kCCMIOProblemDescription,
275 writeCellTable(probNode);
276 writeBoundaryRegion(probNode);
281 &(globalState_->error),
291 Foam::ccm::writer::writer
309 boundaryRegion_(
mesh),
317 Info<<
"moved existing file -> " <<
fileName(file +
".bak*") <<
nl;
320 else if (
exists(file,
false))
323 Info<<
"removed existing file: " << file <<
nl;
327 globalState_->error = CCMIOOpenFile
332 &(globalState_->root)
334 assertNoError(
"Error opening file for writing");
348 maps_->internalFaces,
349 mesh_.nInternalFaces()
352 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
353 maps_->boundary.setSize(
patches.size());
358 if (
patches[patchI].size() > 0)
360 string mapName =
"boundaryMap-" +
Foam::name(patchI);
365 maps_->boundary[patchI],