37 const char* Foam::ccm::reader::cellTableOpti[] =
39 "MaterialId",
"PorosityId",
"SpinId",
"GroupId",
"ColorIdx",
nullptr
43 const char* Foam::ccm::reader::cellTableOptstr[] =
45 "MaterialType",
nullptr
52 int Foam::ccm::reader::ccmGetEntityIndex(ccmNODE node)
55 char name[kCCMIOMaxStringLength + 1];
68 char const *
pos = strrchr(
name,
'-');
88 std::string Foam::ccm::reader::ccmReadNodestr
123 std::string Foam::ccm::reader::ccmReadOptstr
146 char* strval =
new char[len + 1];
171 void Foam::ccm::reader::readMap
177 if (globalState_->hasError())
184 &(globalState_->error),
190 assertNoError(
"error reading map");
197 void Foam::ccm::reader::readProblemDescription
199 const ccmID& probNode
202 readInterfaceDefinitions();
203 readProblemDescription_boundaryRegion(probNode);
204 readProblemDescription_cellTable(probNode);
206 #ifdef DEBUG_CCMIOREAD
207 Info<<
"InterfaceDefinitions: " << interfaceDefinitions_ <<
nl
208 <<
"cellTable" << cellTable_ <<
nl
209 <<
"boundaryRegion" << boundaryRegion_ <<
endl;
218 void Foam::ccm::reader::readInterfaceDefinitions()
220 interfaceDefinitions_.clear();
226 CCMIONode interfaceDefNode;
234 (globalState_->root),
245 "InterfaceDefinitions",
251 CCMIONode interfaceNode;
257 CCMIOGetNextChildWithLabel
268 interfaceEntry ifentry(ccmGetEntityIndex(interfaceNode));
293 ccmReadNodestr(
"Configuration", interfaceNode)
297 interfaceDefinitions_.add(ifentry);
309 void Foam::ccm::reader::readProblemDescription_boundaryRegion
311 const ccmID& probNode
314 if (option().useNumberedNames())
316 Info<<
"using numbered patch/zone names" <<
endl;
319 boundaryRegion_.clear();
332 kCCMIOBoundaryRegion,
343 &(globalState_->error),
347 assertNoError(
"error reading boundaryRegion index");
355 const char* opt =
"BoundaryType";
356 std::string str = ccmReadOptstr(opt, node);
360 dict.add(opt,
"empty");
362 else if (str ==
"internal")
365 dict.add(opt,
"monitoring");
379 const char* opt =
"Label";
382 if (option().useNumberedNames())
388 option().renameInterfaces()
389 && interfaceDefinitions_.isInterface(Id)
392 #ifdef DEBUG_CCMIOREAD
393 Info<<
"boundary is on an interface: remap name for "
397 str = interfaceDefinitions_.interfaceName(Id);
401 (str = ccmReadOptstr(opt, node)).empty()
402 && (str = ccmReadOptstr(
"BoundaryName", node)).empty()
415 boundaryRegion_.insert(Id,
dict);
424 void Foam::ccm::reader::readProblemDescription_cellTable
426 const ccmID& probNode
453 &(globalState_->error),
457 assertNoError(
"error reading cellTable index");
463 const char* opt =
"Label";
466 if (!option().useNumberedNames())
468 str = ccmReadOptstr(opt, node);
481 for (
int i=0; cellTableOptstr[i]; ++i)
483 const char* opt = cellTableOptstr[i];
484 std::string str = ccmReadOptstr(opt, node);
493 for (
int i=0; cellTableOpti[i]; ++i)
495 const char* opt = cellTableOpti[i];
511 dict.add(opt, intval);
524 Info<<
"Mesh Information" <<
nl
525 <<
"----------------" <<
nl
527 <<
"nPoints: " << nPoints_ <<
nl
528 <<
"nCells: " << nCells_ <<
nl
529 <<
"nFaces: " << nFaces_ <<
nl
530 <<
"nInternalFaces: " << nInternalFaces_ <<
nl
531 <<
"nBaffles: " << bafInterfaces_.size() <<
endl;
537 const scalar scaleFactor
542 if (geometryStatus_ == OKAY)
546 readMeshTopology(scaleFactor <= VSMALL ? 1 : scaleFactor);
550 if (nCells_ && points_.size())
552 geometryStatus_ = READ;
556 geometryStatus_ = BAD;
560 return (geometryStatus_ == OKAY || geometryStatus_ == READ);
567 return (geometryStatus_ == OKAY || geometryStatus_ == READ);
574 return (solutionStatus_ == OKAY || solutionStatus_ == READ);
587 mesh.writeObject(streamOpt,
true);
600 if (remappingDictName.empty())
623 if (remapDict.empty())
630 if (remapDict.
isDict(
"cellTable"))
632 cellTable_.combine(remapDict.
subDict(
"cellTable"), cellTableId_);
637 if (remapDict.
isDict(
"boundaryRegion"))
639 boundaryRegion_.rename(remapDict.
subDict(
"boundaryRegion"));
653 options_(new options(opts)),
654 geometryStatus_(UNKNOWN),
655 solutionStatus_(UNKNOWN),
656 interfaceDefinitions_(),
678 if (!
option().keptSomeRegion())
681 <<
"must retain at least one region type: fluid | porous | solid"
688 <<
"Cannot read file " << file