70static label MSHLINE = 1;
72static label MSHTRI = 2;
73static label MSHQUAD = 3;
74static label MSHTET = 4;
77static label MSHHEX = 5;
78static label MSHPRISM = 6;
79static label MSHPYR = 7;
95 while (
line.size() < 4 ||
line.substr(0, 4) !=
"$End");
107 if (!meshPointMap.
found(meshF[0]))
109 Warning<<
"Not using gmsh face " << meshF
110 <<
" since zero vertex is not on boundary of polyMesh" <<
endl;
130 if (meshF.found(
f[fp]))
136 if (nMatched == meshF.size())
168 if (nMatched == meshF.
size())
187 for (
const face&
f : faces)
192 if (((
points[
f[0]] - cc) & areaNorm) < 0)
213 const auto zoneFnd = physToZone.
cfind(regPhys);
218 zoneCells[zoneFnd()].append(celli);
223 const label zonei = zoneCells.size();
224 zoneCells.setSize(zonei+1);
227 Info<<
"Mapping region " << regPhys <<
" to Foam cellZone "
229 physToZone.
insert(regPhys, zonei);
231 zoneToPhys[zonei] = regPhys;
232 zoneCells[zonei].
append(celli);
238scalar readMeshFormat(
IFstream& inFile)
240 Info<<
"Starting to read mesh format at line "
249 label asciiFlag, nBytes;
250 lineStr >>
version >> asciiFlag >> nBytes;
252 Info<<
"Read format version " <<
version <<
" ascii " << asciiFlag <<
endl;
257 <<
"Can only read ascii msh files."
265 if (tag !=
"$EndMeshFormat")
268 <<
"Did not find $ENDNOD tag on line "
289 Info<<
"Vertices to be read: " << nVerts <<
endl;
293 for (label pointi = 0; pointi < nVerts; pointi++)
296 scalar xVal, yVal, zVal;
302 lineStr >> mshLabel >> xVal >> yVal >> zVal;
310 mshToFoam.
insert(mshLabel, pointi);
319 if (tag !=
"$ENDNOD" && tag !=
"$EndNodes")
322 <<
"Did not find $ENDNOD tag on line "
338 label nEntities, nVerts;
339 lineStr >> nEntities >> nVerts;
341 Info<<
"Vertices to be read: " << nVerts <<
endl;
349 for (label entityi = 0; entityi < nEntities; entityi++)
351 label entityDim, entityLabel, isParametric, nNodes;
352 scalar xVal, yVal, zVal;
357 lineStr >> entityDim >> entityLabel >> isParametric >> nNodes;
358 List<label> nodeIDs(nNodes);
361 for (label eNode = 0; eNode < nNodes; ++eNode)
365 lineStr >> nodeIDs[eNode];
369 for (label eNode = 0; eNode < nNodes; ++eNode)
373 lineStr >> xVal >> yVal >> zVal;
378 mshToFoam.
insert(nodeIDs[eNode], pointi++);
389 if (tag !=
"$ENDNOD" && tag !=
"$EndNodes")
392 <<
"Did not find $ENDNOD tag on line "
402 Info<<
"Starting to read physical names at line " << inFile.
lineNumber()
412 Info<<
"Physical names:" << nNames <<
endl;
414 for (label i = 0; i < nNames; i++)
422 label nSpaces = lineStr.str().count(
' ');
428 Info<<
" " << regionI <<
'\t'
431 else if (nSpaces == 2)
438 Info<<
" " <<
"Line " << regionI <<
'\t'
441 else if (physType == 2)
443 Info<<
" " <<
"Surface " << regionI <<
'\t'
446 else if (physType == 3)
448 Info<<
" " <<
"Volume " << regionI <<
'\t'
464 if (tag !=
"$EndPhysicalNames")
467 <<
"Did not find $EndPhysicalNames tag on line "
475 const scalar versionFormat,
476 const bool keepOrientation,
520 cells.setSize(nElems);
536 for (label elemI = 0; elemI < nElems; elemI++)
542 label elmNumber, elmType, regPhys;
543 if (versionFormat >= 2)
545 lineStr >> elmNumber >> elmType;
554 for (label i = 1; i < nTags; i++)
563 label regElem, nNodes;
564 lineStr >> elmNumber >> elmType >> regPhys >> regElem >> nNodes;
568 if (elmType == MSHLINE)
571 lineStr >> meshPti >> meshPti;
573 else if (elmType == MSHTRI)
579 const auto regFnd = physToPatch.
cfind(regPhys);
590 patchi = patchFaces.size();
592 patchFaces.setSize(patchi + 1);
593 patchToPhys.
setSize(patchi + 1);
595 Info<<
"Mapping region " << regPhys <<
" to Foam patch "
597 physToPatch.
insert(regPhys, patchi);
598 patchToPhys[patchi] = regPhys;
604 else if (elmType == MSHQUAD)
607 >> quadPoints[0] >> quadPoints[1] >> quadPoints[2]
612 const auto regFnd = physToPatch.
cfind(regPhys);
623 patchi = patchFaces.size();
625 patchFaces.setSize(patchi + 1);
626 patchToPhys.
setSize(patchi + 1);
628 Info<<
"Mapping region " << regPhys <<
" to Foam patch "
630 physToPatch.
insert(regPhys, patchi);
631 patchToPhys[patchi] = regPhys;
635 patchFaces[patchi].append(quadPoints);
637 else if (elmType == MSHTET)
658 else if (elmType == MSHPYR)
670 >> pyrPoints[0] >> pyrPoints[1] >> pyrPoints[2]
671 >> pyrPoints[3] >> pyrPoints[4];
675 cells[celli++].reset(pyr, pyrPoints);
679 else if (elmType == MSHPRISM)
691 >> prismPoints[0] >> prismPoints[1] >> prismPoints[2]
692 >> prismPoints[3] >> prismPoints[4] >> prismPoints[5];
696 cells[celli].reset(prism, prismPoints);
700 if (!keepOrientation && !correctOrientation(
points,
cell))
702 Info<<
"Inverting prism " << celli <<
endl;
704 prismPoints[0] =
cell[0];
705 prismPoints[1] =
cell[2];
706 prismPoints[2] =
cell[1];
707 prismPoints[3] =
cell[3];
708 prismPoints[4] =
cell[4];
709 prismPoints[5] =
cell[5];
711 cells[celli].reset(prism, prismPoints);
718 else if (elmType == MSHHEX)
730 >> hexPoints[0] >> hexPoints[1]
731 >> hexPoints[2] >> hexPoints[3]
732 >> hexPoints[4] >> hexPoints[5]
733 >> hexPoints[6] >> hexPoints[7];
741 if (!keepOrientation && !correctOrientation(
points,
cell))
743 Info<<
"Inverting hex " << celli <<
endl;
745 hexPoints[0] =
cell[4];
746 hexPoints[1] =
cell[5];
747 hexPoints[2] =
cell[6];
748 hexPoints[3] =
cell[7];
749 hexPoints[4] =
cell[0];
750 hexPoints[5] =
cell[1];
751 hexPoints[6] =
cell[2];
752 hexPoints[7] =
cell[3];
763 Info<<
"Unhandled element " << elmType <<
" at line "
773 if (tag !=
"$ENDELM" && tag !=
"$EndElements")
776 <<
"Did not find $ENDELM tag on line "
781 cells.setSize(celli);
783 forAll(patchFaces, patchi)
785 patchFaces[patchi].shrink();
791 <<
" hex :" << nHex <<
endl
792 <<
" prism:" << nPrism <<
endl
793 <<
" pyr :" << nPyr <<
endl
794 <<
" tet :" << nTet <<
endl
797 if (
cells.size() == 0)
800 <<
"No cells read from file " << inFile.
name() <<
nl
801 <<
"Does your file specify any 3D elements (hex=" << MSHHEX
802 <<
", prism=" << MSHPRISM <<
", pyramid=" << MSHPYR
803 <<
", tet=" << MSHTET <<
")?" <<
nl
804 <<
"Perhaps you have not exported the 3D elements?"
809 <<
"Zone\tSize" <<
endl;
813 zoneCells[zonei].shrink();
815 const labelList& zCells = zoneCells[zonei];
827 const scalar versionFormat,
828 const bool keepOrientation,
862 label nEntities, nElems, minElemTag, maxElemTag;
863 lineStr >> nEntities >> nElems >> minElemTag >> maxElemTag;
868 cells.setSize(nElems);
884 for (label entityi = 0; entityi < nEntities; entityi++)
890 label entityDim, entityID, regPhys, elmType, nElemInBlock, elemID;
891 lineStr >> entityDim >> entityID >> elmType >> nElemInBlock;
894 regPhys = surfEntityToPhysSurface[entityID];
895 else if (entityDim == 3)
896 regPhys = volEntityToPhysVolume[entityID];
901 if (elmType == MSHLINE)
903 for (label entityElm = 0; entityElm < nElemInBlock; entityElm++)
908 lineStr >> elemID >> meshPti >> meshPti;
911 else if (elmType == MSHTRI)
913 for (label entityElm = 0; entityElm < nElemInBlock; entityElm++)
921 const auto regFnd = physToPatch.
cfind(regPhys);
932 patchi = patchFaces.size();
934 patchFaces.setSize(patchi + 1);
935 patchToPhys.
setSize(patchi + 1);
937 Info<<
"Mapping region " << regPhys <<
" to Foam patch "
939 physToPatch.
insert(regPhys, patchi);
940 patchToPhys[patchi] = regPhys;
947 else if (elmType == MSHQUAD)
949 for (label entityElm = 0; entityElm < nElemInBlock; entityElm++)
954 >> quadPoints[0] >> quadPoints[1] >> quadPoints[2]
959 const auto regFnd = physToPatch.
cfind(regPhys);
970 patchi = patchFaces.size();
972 patchFaces.setSize(patchi + 1);
973 patchToPhys.
setSize(patchi + 1);
975 Info<<
"Mapping region " << regPhys <<
" to Foam patch "
977 physToPatch.
insert(regPhys, patchi);
978 patchToPhys[patchi] = regPhys;
982 patchFaces[patchi].append(quadPoints);
985 else if (elmType == MSHTET)
987 nTet += nElemInBlock;
989 for (label entityElm = 0; entityElm < nElemInBlock; entityElm++)
1012 else if (elmType == MSHPYR)
1014 nPyr += nElemInBlock;
1016 for (label entityElm = 0; entityElm < nElemInBlock; entityElm++)
1031 >> pyrPoints[0] >> pyrPoints[1] >> pyrPoints[2]
1032 >> pyrPoints[3] >> pyrPoints[4];
1036 cells[celli++].reset(pyr, pyrPoints);
1039 else if (elmType == MSHPRISM)
1041 nPrism += nElemInBlock;
1043 for (label entityElm = 0; entityElm < nElemInBlock; entityElm++)
1058 >> prismPoints[0] >> prismPoints[1] >> prismPoints[2]
1059 >> prismPoints[3] >> prismPoints[4] >> prismPoints[5];
1063 cells[celli].reset(prism, prismPoints);
1067 if (!keepOrientation && !correctOrientation(
points,
cell))
1069 Info<<
"Inverting prism " << celli <<
endl;
1071 prismPoints[0] =
cell[0];
1072 prismPoints[1] =
cell[2];
1073 prismPoints[2] =
cell[1];
1074 prismPoints[3] =
cell[3];
1075 prismPoints[4] =
cell[4];
1076 prismPoints[5] =
cell[5];
1078 cells[celli].reset(prism, prismPoints);
1084 else if (elmType == MSHHEX)
1086 nHex += nElemInBlock;
1088 for (label entityElm = 0; entityElm < nElemInBlock; entityElm++)
1103 >> hexPoints[0] >> hexPoints[1]
1104 >> hexPoints[2] >> hexPoints[3]
1105 >> hexPoints[4] >> hexPoints[5]
1106 >> hexPoints[6] >> hexPoints[7];
1110 cells[celli].reset(
hex, hexPoints);
1114 if (!keepOrientation && !correctOrientation(
points,
cell))
1116 Info<<
"Inverting hex " << celli <<
endl;
1118 hexPoints[0] =
cell[4];
1119 hexPoints[1] =
cell[5];
1120 hexPoints[2] =
cell[6];
1121 hexPoints[3] =
cell[7];
1122 hexPoints[4] =
cell[0];
1123 hexPoints[5] =
cell[1];
1124 hexPoints[6] =
cell[2];
1125 hexPoints[7] =
cell[3];
1127 cells[celli].reset(
hex, hexPoints);
1135 Info<<
"Unhandled element " << elmType <<
" at line "
1136 << inFile.
lineNumber() <<
"in/on physical region ID: "
1138 Info <<
"Perhaps you created a higher order mesh?" <<
endl;
1147 if (tag !=
"$ENDELM" && tag !=
"$EndElements")
1150 <<
"Did not find $ENDELM tag on line "
1155 cells.setSize(celli);
1157 forAll(patchFaces, patchi)
1159 patchFaces[patchi].shrink();
1165 <<
" hex : " << nHex <<
endl
1166 <<
" prism: " << nPrism <<
endl
1167 <<
" pyr : " << nPyr <<
endl
1168 <<
" tet : " << nTet <<
endl
1171 if (
cells.size() == 0)
1174 <<
"No cells read from file " << inFile.
name() <<
nl
1175 <<
"Does your file specify any 3D elements (hex=" << MSHHEX
1176 <<
", prism=" << MSHPRISM <<
", pyramid=" << MSHPYR
1177 <<
", tet=" << MSHTET <<
")?" <<
nl
1178 <<
"Perhaps you have not exported the 3D elements?"
1182 Info<<
"CellZones:" <<
nl
1183 <<
"Zone\tSize" <<
endl;
1187 zoneCells[zonei].shrink();
1189 const labelList& zCells = zoneCells[zonei];
1206 label
nPoints, nCurves, nSurfaces, nVolumes;
1207 label entityID, physicalID, nPhysicalTags;
1213 lineStr >>
nPoints >> nCurves >> nSurfaces >> nVolumes;
1216 for (label i = 0; i <
nPoints; ++i)
1220 for (label i = 0; i < nCurves; ++i)
1224 for (label i = 0; i < nSurfaces; ++i)
1228 lineStr >> entityID;
1231 for (label j = 0; j < 6; ++j)
1235 lineStr >> nPhysicalTags;
1236 if (nPhysicalTags > 1)
1239 <<
"Cannot interpret multiple physical surfaces associated"
1240 <<
" with one surface on line number " << inFile.
lineNumber()
1244 lineStr >> physicalID;
1245 surfEntityToPhysSurface.
insert(entityID, physicalID);
1249 for (label i = 0; i < nVolumes; ++i)
1253 lineStr >> entityID;
1256 for (label j = 0; j < 6; ++j)
1260 lineStr >> nPhysicalTags;
1261 if (nPhysicalTags > 1)
1264 <<
"Cannot interpret multiple physical volumes associated"
1265 <<
" with one volume on line number " << inFile.
lineNumber()
1269 lineStr >> physicalID;
1270 volEntityToPhysVolume.
insert(entityID, physicalID);
1278 if (tag !=
"$EndEntities")
1281 <<
"Did not find $EndEntities tag on line "
1287int main(
int argc,
char *argv[])
1291 "Convert a gmsh .msh file to OpenFOAM"
1299 "Retain raw orientation for prisms/hexs"
1315 const bool keepOrientation =
args.found(
"keepOrientation");
1328 List<DynamicList<face>> patchFaces(0);
1333 List<DynamicList<label>> zoneCells(0);
1343 scalar versionFormat = 1;
1357 if (tag ==
"$MeshFormat")
1359 versionFormat = readMeshFormat(inFile);
1361 else if (tag ==
"$PhysicalNames")
1363 readPhysNames(inFile, physicalNames);
1365 else if (tag ==
"$Entities")
1368 readEntities(inFile,
1369 surfEntityToPhysSurface,
1370 volEntityToPhysVolume);
1372 else if (tag ==
"$NOD" || tag ==
"$Nodes")
1374 if (versionFormat < 4.0)
1375 readPointsLegacy(inFile,
points, mshToFoam);
1377 readPoints(inFile,
points, mshToFoam);
1379 else if (tag ==
"$ELM" || tag ==
"$Elements")
1381 if (versionFormat < 4.0)
1408 surfEntityToPhysSurface,
1409 volEntityToPhysVolume
1414 Info<<
"Skipping tag " << tag <<
" at line "
1418 if (!skipSection(inFile))
1423 }
while (inFile.
good());
1426 label nValidCellZones = 0;
1430 if (zoneCells[zonei].size())
1449 wordList boundaryPatchNames(boundaryFaces.size());
1451 forAll(boundaryPatchNames, patchi)
1453 boundaryPatchNames[patchi] =
1456 patchToPhys[patchi],
1460 Info<<
"Patch " << patchi <<
" gets name "
1461 << boundaryPatchNames[patchi] <<
endl;
1465 wordList boundaryPatchTypes(boundaryFaces.size(), polyPatch::typeName);
1468 wordList boundaryPatchPhysicalTypes
1470 boundaryFaces.size(),
1489 boundaryPatchPhysicalTypes
1503 List<DynamicList<label>> zoneFaces(patchFaces.size());
1507 forAll(patchFaces, patchi)
1509 const auto&
pFaces = patchFaces[patchi];
1511 Info<<
"Finding faces of patch " << patchi <<
endl;
1518 label patchFacei = findFace(
pp,
f);
1520 if (patchFacei != -1)
1522 label meshFacei =
pp.start() + patchFacei;
1524 repatcher.changePatchID(meshFacei, patchi);
1530 label meshFacei = findInternalFace(
mesh,
f);
1532 if (meshFacei != -1)
1534 zoneFaces[patchi].append(meshFacei);
1539 <<
"Could not match gmsh face " <<
f
1540 <<
" to any of the interior or exterior faces"
1541 <<
" that share the same 0th point" <<
endl;
1549 label nValidFaceZones = 0;
1551 Info<<
"FaceZones:" <<
nl
1552 <<
"Zone\tSize" <<
endl;
1556 zoneFaces[zonei].shrink();
1558 const labelList& zFaces = zoneFaces[zonei];
1574 repatcher.repatch();
1583 if (nValidCellZones > 0)
1587 nValidCellZones = 0;
1591 if (zoneCells[zonei].size())
1602 Info<<
"Writing zone " << zonei <<
" to cellZone "
1603 << zoneName <<
" and cellSet"
1621 if (nValidFaceZones > 0)
1625 nValidFaceZones = 0;
1629 if (zoneFaces[zonei].size())
1640 Info<<
"Writing zone " << zonei <<
" to faceZone "
1641 << zoneName <<
" and faceSet"
1662 mesh.addZones(List<pointZone*>(0), fz, cz);
1667 if (
mesh.boundaryMesh()[defaultPatchID].size() == 0)
1670 label newPatchi = 0;
1673 if (patchi != defaultPatchID)
1682 mesh.boundaryMesh(),
1691 repatcher.changePatches(newPatches);
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
const T & lookup(const Key &key, const T &deflt) const
Return hashed entry if it exists, or return the given default.
bool found(const Key &key) const
Same as contains().
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
label size() const noexcept
The number of elements in table.
Input from file stream as an ISstream, normally using std::ifstream for the actual input.
virtual const fileName & name() const override
Read/write access to the name of the stream.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
label lineNumber() const noexcept
Const access to the current stream line number.
bool good() const noexcept
True if next operation might succeed.
static unsigned int minPrecision(unsigned int prec) noexcept
Set the minimum default precision.
ISstream & getLine(std::string &str, char delim='\n')
Raw, low-level getline (until delimiter) into a string.
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
void append(const T &val)
Append an element at the end of the list.
void setSize(label n)
Alias for resize().
A HashTable to objects of type <T> with a label key.
bool found(const T &val, label pos=0) const
Same as contains().
void size(const label n)
Older name for setAddressableSize.
const Cmpt & x() const noexcept
Access to the vector x component.
const Cmpt & z() const noexcept
Access to the vector z component.
const Cmpt & y() const noexcept
Access to the vector y component.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void noParallel()
Remove the parallel options.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Maps a geometry to a set of cell primitives.
static const cellModel & ref(const modelType model)
Look up reference to cellModel by enumeration. Fatal on failure.
A collection of cell labels.
An analytical geometric cellShape.
point centre(const UList< point > &points) const
Centroid of the cell.
faceList faces() const
Faces of this cell.
A cell is defined as a list of faces with extra functionality.
A subset of mesh faces organised as a primitive patch.
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
static word defaultName(const label n=-1)
Default patch name: "patch" or "patchN".
Mesh consisting of general polyhedral cells.
static const word & regionName(const word ®ion)
The mesh region name or word::null if polyMesh::defaultRegion.
A patch is a list of labels that address the faces in the global face list.
Cell-face mesh analysis engine.
A mesh which allows changes in the patch distribution of the boundary faces. The change in patching i...
Tet point storage. Default constructable (tetrahedron is not).
Triangle point storage. Default constructable (triangle is not).
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
static word validate(const std::string &s, const bool prefix=false)
Construct validated word (no invalid characters).
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define WarningInFunction
Report a warning using Foam::Warning.
const std::string patch
OpenFOAM patch number as a std::string.
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
List< word > wordList
List of word.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values within a list.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
List< face > faceList
List of faces.
IOstream & hex(IOstream &io)
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< faceList > faceListList
List of faceList.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
vector point
Point is a vector.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< cellShape > cellShapeList
List of cellShape.
messageStream Warning
Warning stream (stdout output on master, null elsewhere), with additional 'FOAM Warning' header text.
constexpr char nl
The newline '\n' character (0x0a).
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::HEX);labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells].reset(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} pointMap[start]=pointMap[end]=Foam::min(start, end);} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};constexpr label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< DynamicList< face > > pFaces[nBCs]
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.