This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/utilities/finiteArea/createFaMeshFromStl/makePolyMesh.H
2015-05-12 15:55:51 +01:00

58 lines
1.2 KiB
C

triSurface patch(prefix + ".stl");
// Read patches
List<Tuple2<word, label> > patchNames(patch.patches().size());
forAll (patch.patches(), patchI)
{
patchNames[patchI] =
Tuple2<word, label>(patch.patches()[patchI].name(), patchI);
}
Info << "Patches: " << patchNames << endl;
// Create polyMesh
faceList faces(patch.size());
labelList faceLabels(patch.size());
labelList faceRegion(patch.size());
forAll (patch, faceI)
{
faces[faceI] = face(patch[faceI]);
faceLabels[faceI] = faceI;
faceRegion[faceI] = patch[faceI].region();
}
polyMesh mesh
(
IOobject
(
polyMesh::defaultRegion,
runTime.constant(),
runTime
),
xferCopy(patch.points()),
xferCopy(faces),
xferCopy(labelList(0)),
xferCopy(labelList(0)),
false
);
{
// Add zones
List<pointZone*> pz(0);
List<faceZone*> fz(1);
List<cellZone*> cz(0);
fz[0] = new faceZone
(
"roof",
faceLabels,
boolList(patch.size(), false),
0,
mesh.faceZones()
);
mesh.addPatches(List<polyPatch*>(0), true);
mesh.addZones(pz, fz, cz);
}