38 const char* Foam::ccm::reader::cellTableOpti[] =
40 "MaterialId",
"PorosityId",
"SpinId",
"GroupId",
"ColorIdx",
nullptr
44 const char* Foam::ccm::reader::cellTableOptstr[] =
46 "MaterialType",
nullptr
53 int Foam::ccm::reader::ccmGetEntityIndex(ccmNODE node)
56 char name[kCCMIOMaxStringLength + 1];
69 char const *
pos = strrchr(
name,
'-');
89 std::string Foam::ccm::reader::ccmReadNodestr
124 std::string Foam::ccm::reader::ccmReadOptstr
147 char* strval =
new char[len + 1];
172 void Foam::ccm::reader::readMap
178 if (globalState_->hasError())
185 &(globalState_->error),
191 assertNoError(
"error reading map");
198 void Foam::ccm::reader::readProblemDescription
200 const ccmID& probNode
203 readInterfaceDefinitions();
204 readProblemDescription_boundaryRegion(probNode);
205 readProblemDescription_cellTable(probNode);
207 #ifdef DEBUG_CCMIOREAD
208 Info<<
"InterfaceDefinitions: " << interfaceDefinitions_ <<
nl
209 <<
"cellTable" << cellTable_ <<
nl
210 <<
"boundaryRegion" << boundaryRegion_ <<
endl;
219 void Foam::ccm::reader::readInterfaceDefinitions()
221 interfaceDefinitions_.clear();
227 CCMIONode interfaceDefNode;
235 (globalState_->root),
246 "InterfaceDefinitions",
252 CCMIONode interfaceNode;
258 CCMIOGetNextChildWithLabel
269 interfaceEntry ifentry(ccmGetEntityIndex(interfaceNode));
294 ccmReadNodestr(
"Configuration", interfaceNode)
298 interfaceDefinitions_.add(ifentry);
310 void Foam::ccm::reader::readProblemDescription_boundaryRegion
312 const ccmID& probNode
315 if (option().useNumberedNames())
317 Info<<
"using numbered patch/zone names" <<
endl;
320 boundaryRegion_.clear();
333 kCCMIOBoundaryRegion,
344 &(globalState_->error),
348 assertNoError(
"error reading boundaryRegion index");
356 const char* opt =
"BoundaryType";
357 std::string str = ccmReadOptstr(opt, node);
361 dict.add(opt,
"empty");
363 else if (str ==
"internal")
366 dict.add(opt,
"monitoring");
380 const char* opt =
"Label";
383 if (option().useNumberedNames())
389 option().renameInterfaces()
390 && interfaceDefinitions_.isInterface(Id)
393 #ifdef DEBUG_CCMIOREAD
394 Info<<
"boundary is on an interface: remap name for "
398 str = interfaceDefinitions_.interfaceName(Id);
402 (str = ccmReadOptstr(opt, node)).empty()
403 && (str = ccmReadOptstr(
"BoundaryName", node)).empty()
416 boundaryRegion_.insert(Id,
dict);
425 void Foam::ccm::reader::readProblemDescription_cellTable
427 const ccmID& probNode
454 &(globalState_->error),
458 assertNoError(
"error reading cellTable index");
464 const char* opt =
"Label";
467 if (!option().useNumberedNames())
469 str = ccmReadOptstr(opt, node);
482 for (
int i=0; cellTableOptstr[i]; ++i)
484 const char* opt = cellTableOptstr[i];
485 std::string str = ccmReadOptstr(opt, node);
494 for (
int i=0; cellTableOpti[i]; ++i)
496 const char* opt = cellTableOpti[i];
512 dict.add(opt, intval);
516 cellTable_.insert(Id,
dict);
525 Info<<
"Mesh Information" <<
nl
526 <<
"----------------" <<
nl
528 <<
"nPoints: " << nPoints_ <<
nl
529 <<
"nCells: " << nCells_ <<
nl
530 <<
"nFaces: " << nFaces_ <<
nl
531 <<
"nInternalFaces: " << nInternalFaces_ <<
nl
532 <<
"nBaffles: " << bafInterfaces_.size() <<
endl;
538 const scalar scaleFactor
543 if (geometryStatus_ == OKAY)
547 readMeshTopology(scaleFactor <= VSMALL ? 1 : scaleFactor);
551 if (nCells_ && points_.size())
553 geometryStatus_ = READ;
557 geometryStatus_ = BAD;
561 return (geometryStatus_ == OKAY || geometryStatus_ == READ);
568 return (geometryStatus_ == OKAY || geometryStatus_ == READ);
575 return (solutionStatus_ == OKAY || solutionStatus_ == READ);
605 if (remappingDictName.empty())
628 if (remapDict.empty())
635 if (remapDict.
isDict(
"cellTable"))
637 cellTable_.combine(remapDict.
subDict(
"cellTable"), cellTableId_);
642 if (remapDict.
isDict(
"boundaryRegion"))
644 boundaryRegion_.rename(remapDict.
subDict(
"boundaryRegion"));
659 geometryStatus_(UNKNOWN),
660 solutionStatus_(UNKNOWN),
661 interfaceDefinitions_(),
683 if (!
option().keptSomeRegion())
686 <<
"must retain at least one region type: fluid | porous | solid"
693 <<
"Cannot read file " << file