mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
triSurface/triSurfaceMesh adjustments
- typedefs to simplify code
- added scalePoints() member
* this is especially useful for the triSurfaceMesh dictionary constructor
when we have surfaces in mm or inches and don't wish to rescale in some
external program
This commit is contained in:
@ -188,7 +188,16 @@ Foam::triSurfaceMesh::triSurfaceMesh
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
surfaceClosed_(-1)
|
surfaceClosed_(-1)
|
||||||
{}
|
{
|
||||||
|
scalar scaleFactor = 0;
|
||||||
|
|
||||||
|
// allow rescaling of the surface points
|
||||||
|
// eg, CAD geometries are often done in millimeters
|
||||||
|
if (dict.readIfPresent("scale", scaleFactor) && scaleFactor > 0)
|
||||||
|
{
|
||||||
|
triSurface::scalePoints(scaleFactor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -109,6 +109,7 @@ public:
|
|||||||
triSurfaceMesh(const IOobject& io);
|
triSurfaceMesh(const IOobject& io);
|
||||||
|
|
||||||
//- Construct from dictionary (used by searchableSurface)
|
//- Construct from dictionary (used by searchableSurface)
|
||||||
|
// Dictionary may contain a 'scale' entry (eg, 0.001: mm -> m)
|
||||||
triSurfaceMesh
|
triSurfaceMesh
|
||||||
(
|
(
|
||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
|
|||||||
@ -35,15 +35,14 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
defineTypeNameAndDebug(Foam::triSurface, 0);
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
}
|
||||||
|
|
||||||
defineTypeNameAndDebug(Foam::triSurface, 0);
|
|
||||||
|
|
||||||
|
|
||||||
fileName triSurface::triSurfInstance(const Time& d)
|
Foam::fileName Foam::triSurface::triSurfInstance(const Time& d)
|
||||||
{
|
{
|
||||||
fileName foamName(d.caseName() + ".ftr");
|
fileName foamName(d.caseName() + ".ftr");
|
||||||
|
|
||||||
@ -93,7 +92,7 @@ fileName triSurface::triSurfInstance(const Time& d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<labelledTri> triSurface::convertToTri
|
Foam::List<Foam::labelledTri> Foam::triSurface::convertToTri
|
||||||
(
|
(
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const label defaultRegion
|
const label defaultRegion
|
||||||
@ -128,7 +127,7 @@ List<labelledTri> triSurface::convertToTri
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<labelledTri> triSurface::convertToTri
|
Foam::List<Foam::labelledTri> Foam::triSurface::convertToTri
|
||||||
(
|
(
|
||||||
const triFaceList& faces,
|
const triFaceList& faces,
|
||||||
const label defaultRegion
|
const label defaultRegion
|
||||||
@ -154,7 +153,7 @@ List<labelledTri> triSurface::convertToTri
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void triSurface::printTriangle
|
void Foam::triSurface::printTriangle
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const string& pre,
|
const string& pre,
|
||||||
@ -172,7 +171,7 @@ void triSurface::printTriangle
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string triSurface::getLineNoComment(IFstream& is)
|
Foam::string Foam::triSurface::getLineNoComment(IFstream& is)
|
||||||
{
|
{
|
||||||
string line;
|
string line;
|
||||||
do
|
do
|
||||||
@ -186,7 +185,7 @@ string triSurface::getLineNoComment(IFstream& is)
|
|||||||
|
|
||||||
|
|
||||||
// Remove non-triangles, double triangles.
|
// Remove non-triangles, double triangles.
|
||||||
void triSurface::checkTriangles(const bool verbose)
|
void Foam::triSurface::checkTriangles(const bool verbose)
|
||||||
{
|
{
|
||||||
// Simple check on indices ok.
|
// Simple check on indices ok.
|
||||||
const label maxPointI = points().size() - 1;
|
const label maxPointI = points().size() - 1;
|
||||||
@ -320,7 +319,7 @@ void triSurface::checkTriangles(const bool verbose)
|
|||||||
|
|
||||||
|
|
||||||
// Check/fix edges with more than two triangles
|
// Check/fix edges with more than two triangles
|
||||||
void triSurface::checkEdges(const bool verbose)
|
void Foam::triSurface::checkEdges(const bool verbose)
|
||||||
{
|
{
|
||||||
const labelListList& eFaces = edgeFaces();
|
const labelListList& eFaces = edgeFaces();
|
||||||
|
|
||||||
@ -349,7 +348,7 @@ void triSurface::checkEdges(const bool verbose)
|
|||||||
|
|
||||||
|
|
||||||
// Check normals and orientation
|
// Check normals and orientation
|
||||||
boolList triSurface::checkOrientation(const bool verbose)
|
Foam::boolList Foam::triSurface::checkOrientation(const bool verbose)
|
||||||
{
|
{
|
||||||
const edgeList& es = edges();
|
const edgeList& es = edges();
|
||||||
const labelListList& faceEs = faceEdges();
|
const labelListList& faceEs = faceEdges();
|
||||||
@ -470,7 +469,7 @@ boolList triSurface::checkOrientation(const bool verbose)
|
|||||||
|
|
||||||
|
|
||||||
// Read triangles, points from Istream
|
// Read triangles, points from Istream
|
||||||
bool triSurface::read(Istream& is)
|
bool Foam::triSurface::read(Istream& is)
|
||||||
{
|
{
|
||||||
is >> patches_ >> const_cast<pointField&>(points())
|
is >> patches_ >> const_cast<pointField&>(points())
|
||||||
>> static_cast<List<labelledTri>&>(*this);
|
>> static_cast<List<labelledTri>&>(*this);
|
||||||
@ -480,7 +479,12 @@ bool triSurface::read(Istream& is)
|
|||||||
|
|
||||||
|
|
||||||
// Read from file in given format
|
// Read from file in given format
|
||||||
bool triSurface::read(const fileName& name, const word& ext, const bool check)
|
bool Foam::triSurface::read
|
||||||
|
(
|
||||||
|
const fileName& name,
|
||||||
|
const word& ext,
|
||||||
|
const bool check
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (check && !exists(name))
|
if (check && !exists(name))
|
||||||
{
|
{
|
||||||
@ -549,7 +553,7 @@ bool triSurface::read(const fileName& name, const word& ext, const bool check)
|
|||||||
|
|
||||||
|
|
||||||
// Write to file in given format
|
// Write to file in given format
|
||||||
void triSurface::write
|
void Foam::triSurface::write
|
||||||
(
|
(
|
||||||
const fileName& name,
|
const fileName& name,
|
||||||
const word& ext,
|
const word& ext,
|
||||||
@ -618,7 +622,7 @@ void triSurface::write
|
|||||||
|
|
||||||
// Returns patch info. Sets faceMap to the indexing according to patch
|
// Returns patch info. Sets faceMap to the indexing according to patch
|
||||||
// numbers. Patch numbers start at 0.
|
// numbers. Patch numbers start at 0.
|
||||||
surfacePatchList triSurface::calcPatches(labelList& faceMap) const
|
Foam::surfacePatchList Foam::triSurface::calcPatches(labelList& faceMap) const
|
||||||
{
|
{
|
||||||
// Sort according to region numbers of labelledTri
|
// Sort according to region numbers of labelledTri
|
||||||
SortableList<label> sortedRegion(size());
|
SortableList<label> sortedRegion(size());
|
||||||
@ -698,7 +702,7 @@ surfacePatchList triSurface::calcPatches(labelList& faceMap) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void triSurface::setDefaultPatches()
|
void Foam::triSurface::setDefaultPatches()
|
||||||
{
|
{
|
||||||
labelList faceMap;
|
labelList faceMap;
|
||||||
|
|
||||||
@ -718,13 +722,9 @@ void triSurface::setDefaultPatches()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
triSurface::triSurface()
|
Foam::triSurface::triSurface()
|
||||||
:
|
:
|
||||||
PrimitivePatch<labelledTri, ::Foam::List, pointField>
|
MeshStorage(List<FaceType>(), pointField()),
|
||||||
(
|
|
||||||
List<labelledTri>(0),
|
|
||||||
pointField(0)
|
|
||||||
),
|
|
||||||
patches_(0),
|
patches_(0),
|
||||||
sortedEdgeFacesPtr_(NULL),
|
sortedEdgeFacesPtr_(NULL),
|
||||||
edgeOwnerPtr_(NULL)
|
edgeOwnerPtr_(NULL)
|
||||||
@ -732,21 +732,21 @@ triSurface::triSurface()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
triSurface::triSurface
|
Foam::triSurface::triSurface
|
||||||
(
|
(
|
||||||
const List<labelledTri>& triangles,
|
const List<labelledTri>& triangles,
|
||||||
const geometricSurfacePatchList& patches,
|
const geometricSurfacePatchList& patches,
|
||||||
const pointField& points
|
const pointField& points
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
PrimitivePatch<labelledTri, ::Foam::List, pointField>(triangles, points),
|
MeshStorage(triangles, points),
|
||||||
patches_(patches),
|
patches_(patches),
|
||||||
sortedEdgeFacesPtr_(NULL),
|
sortedEdgeFacesPtr_(NULL),
|
||||||
edgeOwnerPtr_(NULL)
|
edgeOwnerPtr_(NULL)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
triSurface::triSurface
|
Foam::triSurface::triSurface
|
||||||
(
|
(
|
||||||
List<labelledTri>& triangles,
|
List<labelledTri>& triangles,
|
||||||
const geometricSurfacePatchList& patches,
|
const geometricSurfacePatchList& patches,
|
||||||
@ -754,25 +754,20 @@ triSurface::triSurface
|
|||||||
const bool reUse
|
const bool reUse
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
PrimitivePatch<labelledTri, ::Foam::List, pointField>
|
MeshStorage(triangles, points, reUse),
|
||||||
(
|
|
||||||
triangles,
|
|
||||||
points,
|
|
||||||
reUse
|
|
||||||
),
|
|
||||||
patches_(patches),
|
patches_(patches),
|
||||||
sortedEdgeFacesPtr_(NULL),
|
sortedEdgeFacesPtr_(NULL),
|
||||||
edgeOwnerPtr_(NULL)
|
edgeOwnerPtr_(NULL)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
triSurface::triSurface
|
Foam::triSurface::triSurface
|
||||||
(
|
(
|
||||||
const List<labelledTri>& triangles,
|
const List<labelledTri>& triangles,
|
||||||
const pointField& points
|
const pointField& points
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
PrimitivePatch<labelledTri, ::Foam::List, pointField>(triangles, points),
|
MeshStorage(triangles, points),
|
||||||
patches_(),
|
patches_(),
|
||||||
sortedEdgeFacesPtr_(NULL),
|
sortedEdgeFacesPtr_(NULL),
|
||||||
edgeOwnerPtr_(NULL)
|
edgeOwnerPtr_(NULL)
|
||||||
@ -781,17 +776,13 @@ triSurface::triSurface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
triSurface::triSurface
|
Foam::triSurface::triSurface
|
||||||
(
|
(
|
||||||
const triFaceList& triangles,
|
const triFaceList& triangles,
|
||||||
const pointField& points
|
const pointField& points
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
PrimitivePatch<labelledTri, ::Foam::List, pointField>
|
MeshStorage(convertToTri(triangles, 0), points),
|
||||||
(
|
|
||||||
convertToTri(triangles, 0),
|
|
||||||
points
|
|
||||||
),
|
|
||||||
patches_(),
|
patches_(),
|
||||||
sortedEdgeFacesPtr_(NULL),
|
sortedEdgeFacesPtr_(NULL),
|
||||||
edgeOwnerPtr_(NULL)
|
edgeOwnerPtr_(NULL)
|
||||||
@ -800,13 +791,9 @@ triSurface::triSurface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
triSurface::triSurface(const fileName& name)
|
Foam::triSurface::triSurface(const fileName& name)
|
||||||
:
|
:
|
||||||
PrimitivePatch<labelledTri, ::Foam::List, pointField>
|
MeshStorage(List<FaceType>(), pointField()),
|
||||||
(
|
|
||||||
List<labelledTri>(0),
|
|
||||||
pointField(0)
|
|
||||||
),
|
|
||||||
patches_(),
|
patches_(),
|
||||||
sortedEdgeFacesPtr_(NULL),
|
sortedEdgeFacesPtr_(NULL),
|
||||||
edgeOwnerPtr_(NULL)
|
edgeOwnerPtr_(NULL)
|
||||||
@ -819,13 +806,9 @@ triSurface::triSurface(const fileName& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
triSurface::triSurface(Istream& is)
|
Foam::triSurface::triSurface(Istream& is)
|
||||||
:
|
:
|
||||||
PrimitivePatch<labelledTri, ::Foam::List, pointField>
|
MeshStorage(List<FaceType>(), pointField()),
|
||||||
(
|
|
||||||
List<labelledTri>(0),
|
|
||||||
pointField(0)
|
|
||||||
),
|
|
||||||
patches_(),
|
patches_(),
|
||||||
sortedEdgeFacesPtr_(NULL),
|
sortedEdgeFacesPtr_(NULL),
|
||||||
edgeOwnerPtr_(NULL)
|
edgeOwnerPtr_(NULL)
|
||||||
@ -836,13 +819,9 @@ triSurface::triSurface(Istream& is)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
triSurface::triSurface(const Time& d)
|
Foam::triSurface::triSurface(const Time& d)
|
||||||
:
|
:
|
||||||
PrimitivePatch<labelledTri, ::Foam::List, pointField>
|
MeshStorage(List<FaceType>(), pointField()),
|
||||||
(
|
|
||||||
List<labelledTri>(0),
|
|
||||||
pointField(0)
|
|
||||||
),
|
|
||||||
patches_(),
|
patches_(),
|
||||||
sortedEdgeFacesPtr_(NULL),
|
sortedEdgeFacesPtr_(NULL),
|
||||||
edgeOwnerPtr_(NULL)
|
edgeOwnerPtr_(NULL)
|
||||||
@ -859,9 +838,9 @@ triSurface::triSurface(const Time& d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
triSurface::triSurface(const triSurface& ts)
|
Foam::triSurface::triSurface(const triSurface& ts)
|
||||||
:
|
:
|
||||||
PrimitivePatch<labelledTri, ::Foam::List, pointField>(ts, ts.points()),
|
MeshStorage(ts, ts.points()),
|
||||||
patches_(ts.patches()),
|
patches_(ts.patches()),
|
||||||
sortedEdgeFacesPtr_(NULL),
|
sortedEdgeFacesPtr_(NULL),
|
||||||
edgeOwnerPtr_(NULL)
|
edgeOwnerPtr_(NULL)
|
||||||
@ -870,7 +849,7 @@ triSurface::triSurface(const triSurface& ts)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
triSurface::~triSurface()
|
Foam::triSurface::~triSurface()
|
||||||
{
|
{
|
||||||
clearOut();
|
clearOut();
|
||||||
}
|
}
|
||||||
@ -878,30 +857,30 @@ triSurface::~triSurface()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void triSurface::clearTopology()
|
void Foam::triSurface::clearTopology()
|
||||||
{
|
{
|
||||||
PrimitivePatch<labelledTri, ::Foam::List, pointField>::clearTopology();
|
MeshStorage::clearTopology();
|
||||||
deleteDemandDrivenData(sortedEdgeFacesPtr_);
|
deleteDemandDrivenData(sortedEdgeFacesPtr_);
|
||||||
deleteDemandDrivenData(edgeOwnerPtr_);
|
deleteDemandDrivenData(edgeOwnerPtr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void triSurface::clearPatchMeshAddr()
|
void Foam::triSurface::clearPatchMeshAddr()
|
||||||
{
|
{
|
||||||
PrimitivePatch<labelledTri, ::Foam::List, pointField>::clearPatchMeshAddr();
|
MeshStorage::clearPatchMeshAddr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void triSurface::clearOut()
|
void Foam::triSurface::clearOut()
|
||||||
{
|
{
|
||||||
PrimitivePatch<labelledTri, ::Foam::List, pointField>::clearOut();
|
MeshStorage::clearOut();
|
||||||
|
|
||||||
clearTopology();
|
clearTopology();
|
||||||
clearPatchMeshAddr();
|
clearPatchMeshAddr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const labelListList& triSurface::sortedEdgeFaces() const
|
const Foam::labelListList& Foam::triSurface::sortedEdgeFaces() const
|
||||||
{
|
{
|
||||||
if (!sortedEdgeFacesPtr_)
|
if (!sortedEdgeFacesPtr_)
|
||||||
{
|
{
|
||||||
@ -912,7 +891,7 @@ const labelListList& triSurface::sortedEdgeFaces() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const labelList& triSurface::edgeOwner() const
|
const Foam::labelList& Foam::triSurface::edgeOwner() const
|
||||||
{
|
{
|
||||||
if (!edgeOwnerPtr_)
|
if (!edgeOwnerPtr_)
|
||||||
{
|
{
|
||||||
@ -924,21 +903,38 @@ const labelList& triSurface::edgeOwner() const
|
|||||||
|
|
||||||
|
|
||||||
//- Move points
|
//- Move points
|
||||||
void triSurface::movePoints(const pointField& newPoints)
|
void Foam::triSurface::movePoints(const pointField& newPoints)
|
||||||
{
|
{
|
||||||
// Remove all geometry dependent data
|
// Remove all geometry dependent data
|
||||||
deleteDemandDrivenData(sortedEdgeFacesPtr_);
|
deleteDemandDrivenData(sortedEdgeFacesPtr_);
|
||||||
|
|
||||||
// Adapt for new point position
|
// Adapt for new point position
|
||||||
PrimitivePatch<labelledTri, ::Foam::List, pointField>::movePoints(newPoints);
|
MeshStorage::movePoints(newPoints);
|
||||||
|
|
||||||
// Copy new points
|
// Copy new points
|
||||||
const_cast<pointField&>(points()) = newPoints;
|
const_cast<pointField&>(points()) = newPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// scale points
|
||||||
|
void Foam::triSurface::scalePoints(const scalar& scaleFactor)
|
||||||
|
{
|
||||||
|
// avoid bad scaling
|
||||||
|
if (scaleFactor > 0 && scaleFactor != 1.0)
|
||||||
|
{
|
||||||
|
// Remove all geometry dependent data
|
||||||
|
clearTopology();
|
||||||
|
|
||||||
|
// Adapt for new point position
|
||||||
|
MeshStorage::movePoints(pointField());
|
||||||
|
|
||||||
|
const_cast<pointField&>(points()) *= scaleFactor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Remove non-triangles, double triangles.
|
// Remove non-triangles, double triangles.
|
||||||
void triSurface::cleanup(const bool verbose)
|
void Foam::triSurface::cleanup(const bool verbose)
|
||||||
{
|
{
|
||||||
// Merge points (already done for STL, TRI)
|
// Merge points (already done for STL, TRI)
|
||||||
stitchTriangles(pointField(points()), SMALL, verbose);
|
stitchTriangles(pointField(points()), SMALL, verbose);
|
||||||
@ -954,7 +950,7 @@ void triSurface::cleanup(const bool verbose)
|
|||||||
|
|
||||||
// Finds area, starting at faceI, delimited by borderEdge. Marks all visited
|
// Finds area, starting at faceI, delimited by borderEdge. Marks all visited
|
||||||
// faces (from face-edge-face walk) with currentZone.
|
// faces (from face-edge-face walk) with currentZone.
|
||||||
void triSurface::markZone
|
void Foam::triSurface::markZone
|
||||||
(
|
(
|
||||||
const boolList& borderEdge,
|
const boolList& borderEdge,
|
||||||
const label faceI,
|
const label faceI,
|
||||||
@ -1016,15 +1012,14 @@ void triSurface::markZone
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
changedFaces.transfer(newChangedFaces.shrink());
|
changedFaces.transfer(newChangedFaces);
|
||||||
newChangedFaces.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Finds areas delimited by borderEdge (or 'real' edges).
|
// Finds areas delimited by borderEdge (or 'real' edges).
|
||||||
// Fills faceZone accordingly
|
// Fills faceZone accordingly
|
||||||
label triSurface::markZones
|
Foam::label Foam::triSurface::markZones
|
||||||
(
|
(
|
||||||
const boolList& borderEdge,
|
const boolList& borderEdge,
|
||||||
labelList& faceZone
|
labelList& faceZone
|
||||||
@ -1075,7 +1070,7 @@ label triSurface::markZones
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void triSurface::subsetMeshMap
|
void Foam::triSurface::subsetMeshMap
|
||||||
(
|
(
|
||||||
const boolList& include,
|
const boolList& include,
|
||||||
labelList& pointMap,
|
labelList& pointMap,
|
||||||
@ -1133,7 +1128,7 @@ void triSurface::subsetMeshMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
triSurface triSurface::subsetMesh
|
Foam::triSurface Foam::triSurface::subsetMesh
|
||||||
(
|
(
|
||||||
const boolList& include,
|
const boolList& include,
|
||||||
labelList& pointMap,
|
labelList& pointMap,
|
||||||
@ -1175,13 +1170,17 @@ triSurface triSurface::subsetMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void triSurface::write(const fileName& name, const bool sortByRegion) const
|
void Foam::triSurface::write
|
||||||
|
(
|
||||||
|
const fileName& name,
|
||||||
|
const bool sortByRegion
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
write(name, name.ext(), sortByRegion);
|
write(name, name.ext(), sortByRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void triSurface::write(Ostream& os) const
|
void Foam::triSurface::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
os << patches() << endl;
|
os << patches() << endl;
|
||||||
|
|
||||||
@ -1194,7 +1193,7 @@ void triSurface::write(Ostream& os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void triSurface::write(const Time& d) const
|
void Foam::triSurface::write(const Time& d) const
|
||||||
{
|
{
|
||||||
fileName foamFile(d.caseName() + ".ftr");
|
fileName foamFile(d.caseName() + ".ftr");
|
||||||
|
|
||||||
@ -1206,7 +1205,7 @@ void triSurface::write(const Time& d) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void triSurface::writeStats(Ostream& os) const
|
void Foam::triSurface::writeStats(Ostream& os) const
|
||||||
{
|
{
|
||||||
// Unfortunately nPoints constructs meshPoints() so do compact version
|
// Unfortunately nPoints constructs meshPoints() so do compact version
|
||||||
// ourselves.
|
// ourselves.
|
||||||
@ -1244,7 +1243,7 @@ void triSurface::writeStats(Ostream& os) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void triSurface::operator=(const triSurface& ts)
|
void Foam::triSurface::operator=(const triSurface& ts)
|
||||||
{
|
{
|
||||||
List<labelledTri>::operator=(ts);
|
List<labelledTri>::operator=(ts);
|
||||||
clearOut();
|
clearOut();
|
||||||
@ -1255,15 +1254,11 @@ void triSurface::operator=(const triSurface& ts)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
Ostream& operator<<(Ostream& os, const triSurface& sm)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const triSurface& sm)
|
||||||
{
|
{
|
||||||
sm.write(os);
|
sm.write(os);
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -58,14 +58,34 @@ class IFstream;
|
|||||||
|
|
||||||
class triSurface
|
class triSurface
|
||||||
:
|
:
|
||||||
public PrimitivePatch<labelledTri, List, pointField>
|
public PrimitivePatch<labelledTri, List, pointField, point>
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Data
|
||||||
|
|
||||||
|
//- Typedef for similar code in keyedSurface and meshedSurface
|
||||||
|
typedef labelledTri FaceType;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private typedefs
|
||||||
|
|
||||||
|
typedef PrimitivePatch
|
||||||
|
<
|
||||||
|
FaceType,
|
||||||
|
::Foam::List,
|
||||||
|
pointField,
|
||||||
|
point
|
||||||
|
>
|
||||||
|
MeshStorage;
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- The number of bytes in the STL header
|
//- The number of bytes in the STL header
|
||||||
static const int STLheaderSize = 80;
|
static const int STLheaderSize = 80;
|
||||||
|
|
||||||
//- Patch information (face ordering nFaces/startFace only used
|
//- Patch information (face ordering nFaces/startFace only used
|
||||||
// during reading and writing)
|
// during reading and writing)
|
||||||
geometricSurfacePatchList patches_;
|
geometricSurfacePatchList patches_;
|
||||||
|
|
||||||
@ -131,7 +151,7 @@ class triSurface
|
|||||||
void writeSTLBINARY(std::ostream&) const;
|
void writeSTLBINARY(std::ostream&) const;
|
||||||
|
|
||||||
//- Write to Ostream in GTS (Gnu Tri Surface library)
|
//- Write to Ostream in GTS (Gnu Tri Surface library)
|
||||||
// format.
|
// format.
|
||||||
void writeGTS(const bool writeSorted, Ostream&) const;
|
void writeGTS(const bool writeSorted, Ostream&) const;
|
||||||
|
|
||||||
//- Write to Ostream in OBJ (Lightwave) format.
|
//- Write to Ostream in OBJ (Lightwave) format.
|
||||||
@ -287,6 +307,9 @@ public:
|
|||||||
//- Move points
|
//- Move points
|
||||||
virtual void movePoints(const pointField&);
|
virtual void movePoints(const pointField&);
|
||||||
|
|
||||||
|
//- Scale points. A non-positive factor is ignored
|
||||||
|
virtual void scalePoints(const scalar&);
|
||||||
|
|
||||||
//- Check/fix duplicate/degenerate triangles
|
//- Check/fix duplicate/degenerate triangles
|
||||||
void checkTriangles(const bool verbose);
|
void checkTriangles(const bool verbose);
|
||||||
|
|
||||||
@ -332,7 +355,7 @@ public:
|
|||||||
labelList& faceMap
|
labelList& faceMap
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return new surface. Returns pointMap, faceMap from
|
//- Return new surface. Returns pointMap, faceMap from
|
||||||
// subsetMeshMap
|
// subsetMeshMap
|
||||||
triSurface subsetMesh
|
triSurface subsetMesh
|
||||||
(
|
(
|
||||||
|
|||||||
@ -44,32 +44,55 @@ namespace Foam
|
|||||||
|
|
||||||
class triSurfaceGeoMesh
|
class triSurfaceGeoMesh
|
||||||
{
|
{
|
||||||
const triSurface& s_;
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Reference to Mesh
|
||||||
|
const triSurface& mesh_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef triSurface Mesh;
|
// Public typedefs
|
||||||
|
|
||||||
triSurfaceGeoMesh(const triSurface& s)
|
typedef triSurface Mesh;
|
||||||
:
|
|
||||||
s_(s)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Return size
|
|
||||||
label size() const
|
|
||||||
{
|
|
||||||
return size(s_);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return size
|
// Constructors
|
||||||
static label size(const Mesh& mesh)
|
|
||||||
{
|
//- Construct from Mesh
|
||||||
return mesh.size();
|
explicit triSurfaceGeoMesh(const triSurface& mesh)
|
||||||
}
|
:
|
||||||
|
mesh_(mesh)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return size
|
||||||
|
label size() const
|
||||||
|
{
|
||||||
|
return size(mesh_);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return size
|
||||||
|
static label size(const triSurface& mesh)
|
||||||
|
{
|
||||||
|
return mesh.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
//- Return reference to triSurface
|
||||||
|
const triSurface& operator()() const
|
||||||
|
{
|
||||||
|
return mesh_;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
Reference in New Issue
Block a user