mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
reworked surfMesh and PrimitivePatchExtra
- ditched PrimitivePatchExtra in favour of a PatchTools class that is currently just a collection of static functions. They could equally well live within PrimitivePatch itself, but isolated also has its advantages. - MeshedSurface, UnsortedMeshedSurface now have 'regions' instead of 'patches' since they are more like a faceZone for meshed surfaces than patches. This might avoid confusion at a later stage.
This commit is contained in:
@ -56,6 +56,7 @@ Note
|
|||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "triSurface.H"
|
#include "triSurface.H"
|
||||||
|
#include "PackedBoolList.H"
|
||||||
|
|
||||||
#include "MeshedSurfaces.H"
|
#include "MeshedSurfaces.H"
|
||||||
#include "UnsortedMeshedSurfaces.H"
|
#include "UnsortedMeshedSurfaces.H"
|
||||||
@ -115,7 +116,7 @@ int main(int argc, char *argv[])
|
|||||||
if (args.options().found("orient"))
|
if (args.options().found("orient"))
|
||||||
{
|
{
|
||||||
Info<< "Checking surface orientation" << endl;
|
Info<< "Checking surface orientation" << endl;
|
||||||
surf.checkOrientation(true);
|
PatchTools::checkOrientation(surf, true);
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +155,7 @@ int main(int argc, char *argv[])
|
|||||||
if (args.options().found("orient"))
|
if (args.options().found("orient"))
|
||||||
{
|
{
|
||||||
Info<< "Checking surface orientation" << endl;
|
Info<< "Checking surface orientation" << endl;
|
||||||
surf.checkOrientation(true);
|
PatchTools::checkOrientation(surf, true);
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +193,7 @@ int main(int argc, char *argv[])
|
|||||||
if (args.options().found("orient"))
|
if (args.options().found("orient"))
|
||||||
{
|
{
|
||||||
Info<< "Checking surface orientation" << endl;
|
Info<< "Checking surface orientation" << endl;
|
||||||
surf.checkOrientation(true);
|
PatchTools::checkOrientation(surf, true);
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +231,7 @@ int main(int argc, char *argv[])
|
|||||||
if (args.options().found("orient"))
|
if (args.options().found("orient"))
|
||||||
{
|
{
|
||||||
Info<< "Checking surface orientation" << endl;
|
Info<< "Checking surface orientation" << endl;
|
||||||
surf.checkOrientation(true);
|
PatchTools::checkOrientation(surf, true);
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -60,8 +60,6 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
class patchZones;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class cyclicPolyPatch Declaration
|
Class cyclicPolyPatch Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -26,11 +26,6 @@ License
|
|||||||
|
|
||||||
#include "Map.H"
|
#include "Map.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Construct from components
|
// Construct from components
|
||||||
@ -41,7 +36,9 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::PrimitivePatch
|
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
PrimitivePatch
|
||||||
(
|
(
|
||||||
const FaceList<Face>& faces,
|
const FaceList<Face>& faces,
|
||||||
const Field<PointType>& points
|
const Field<PointType>& points
|
||||||
@ -76,7 +73,9 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::PrimitivePatch
|
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
PrimitivePatch
|
||||||
(
|
(
|
||||||
FaceList<Face>& faces,
|
FaceList<Face>& faces,
|
||||||
Field<PointType>& points,
|
Field<PointType>& points,
|
||||||
@ -112,7 +111,9 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::PrimitivePatch
|
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
PrimitivePatch
|
||||||
(
|
(
|
||||||
const PrimitivePatch<Face, FaceList, PointField, PointType>& pp
|
const PrimitivePatch<Face, FaceList, PointField, PointType>& pp
|
||||||
)
|
)
|
||||||
@ -148,7 +149,8 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::~PrimitivePatch()
|
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::~PrimitivePatch()
|
||||||
{
|
{
|
||||||
clearOut();
|
clearOut();
|
||||||
}
|
}
|
||||||
@ -164,7 +166,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::movePoints
|
|
||||||
|
void
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
movePoints
|
||||||
(
|
(
|
||||||
const Field<PointType>&
|
const Field<PointType>&
|
||||||
)
|
)
|
||||||
@ -188,8 +193,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const edgeList&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::edges() const
|
const Foam::edgeList&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
edges() const
|
||||||
{
|
{
|
||||||
if (!edgesPtr_)
|
if (!edgesPtr_)
|
||||||
{
|
{
|
||||||
@ -207,8 +214,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
label PrimitivePatch<Face, FaceList, PointField, PointType>::nInternalEdges()
|
|
||||||
const
|
Foam::label
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
nInternalEdges() const
|
||||||
{
|
{
|
||||||
if (!edgesPtr_)
|
if (!edgesPtr_)
|
||||||
{
|
{
|
||||||
@ -226,8 +235,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const labelList&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::boundaryPoints() const
|
const Foam::labelList&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
boundaryPoints() const
|
||||||
{
|
{
|
||||||
if (!boundaryPointsPtr_)
|
if (!boundaryPointsPtr_)
|
||||||
{
|
{
|
||||||
@ -245,8 +256,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const labelListList&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::faceFaces() const
|
const Foam::labelListList&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
faceFaces() const
|
||||||
{
|
{
|
||||||
if (!faceFacesPtr_)
|
if (!faceFacesPtr_)
|
||||||
{
|
{
|
||||||
@ -264,8 +277,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const labelListList&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::edgeFaces() const
|
const Foam::labelListList&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
edgeFaces() const
|
||||||
{
|
{
|
||||||
if (!edgeFacesPtr_)
|
if (!edgeFacesPtr_)
|
||||||
{
|
{
|
||||||
@ -283,8 +298,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const labelListList&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::faceEdges() const
|
const Foam::labelListList&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
faceEdges() const
|
||||||
{
|
{
|
||||||
if (!faceEdgesPtr_)
|
if (!faceEdgesPtr_)
|
||||||
{
|
{
|
||||||
@ -302,8 +319,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const labelListList&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::pointEdges() const
|
const Foam::labelListList&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
pointEdges() const
|
||||||
{
|
{
|
||||||
if (!pointEdgesPtr_)
|
if (!pointEdgesPtr_)
|
||||||
{
|
{
|
||||||
@ -321,8 +340,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const labelListList&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::pointFaces() const
|
const Foam::labelListList&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
pointFaces() const
|
||||||
{
|
{
|
||||||
if (!pointFacesPtr_)
|
if (!pointFacesPtr_)
|
||||||
{
|
{
|
||||||
@ -340,8 +361,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const List<Face>&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::localFaces() const
|
const Foam::List<Face>&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
localFaces() const
|
||||||
{
|
{
|
||||||
if (!localFacesPtr_)
|
if (!localFacesPtr_)
|
||||||
{
|
{
|
||||||
@ -359,8 +382,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const labelList&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::meshPoints() const
|
const Foam::labelList&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
meshPoints() const
|
||||||
{
|
{
|
||||||
if (!meshPointsPtr_)
|
if (!meshPointsPtr_)
|
||||||
{
|
{
|
||||||
@ -378,8 +403,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const Map<label>&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::meshPointMap() const
|
const Foam::Map<Foam::label>&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
meshPointMap() const
|
||||||
{
|
{
|
||||||
if (!meshPointMapPtr_)
|
if (!meshPointMapPtr_)
|
||||||
{
|
{
|
||||||
@ -397,8 +424,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const Field<PointType>&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::localPoints() const
|
const Foam::Field<PointType>&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
localPoints() const
|
||||||
{
|
{
|
||||||
if (!localPointsPtr_)
|
if (!localPointsPtr_)
|
||||||
{
|
{
|
||||||
@ -416,8 +445,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const labelList&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::localPointOrder() const
|
const Foam::labelList&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
localPointOrder() const
|
||||||
{
|
{
|
||||||
if (!localPointOrderPtr_)
|
if (!localPointOrderPtr_)
|
||||||
{
|
{
|
||||||
@ -435,16 +466,19 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
label PrimitivePatch<Face, FaceList, PointField, PointType>::whichPoint
|
|
||||||
|
Foam::label
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
whichPoint
|
||||||
(
|
(
|
||||||
const label gp
|
const label gp
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
Map<label>::const_iterator gpIter = meshPointMap().find(gp);
|
Map<label>::const_iterator fnd = meshPointMap().find(gp);
|
||||||
|
|
||||||
if (gpIter != meshPointMap().end())
|
if (fnd != meshPointMap().end())
|
||||||
{
|
{
|
||||||
return gpIter();
|
return fnd();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -461,8 +495,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const Field<PointType>&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::faceNormals() const
|
const Foam::Field<PointType>&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
faceNormals() const
|
||||||
{
|
{
|
||||||
if (!faceNormalsPtr_)
|
if (!faceNormalsPtr_)
|
||||||
{
|
{
|
||||||
@ -480,8 +516,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const Field<PointType>&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::pointNormals() const
|
const Foam::Field<PointType>&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
pointNormals() const
|
||||||
{
|
{
|
||||||
if (!pointNormalsPtr_)
|
if (!pointNormalsPtr_)
|
||||||
{
|
{
|
||||||
@ -501,7 +539,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::operator=
|
|
||||||
|
void
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
operator=
|
||||||
(
|
(
|
||||||
const PrimitivePatch<Face, FaceList, PointField, PointType>& pp
|
const PrimitivePatch<Face, FaceList, PointField, PointType>& pp
|
||||||
)
|
)
|
||||||
@ -511,11 +552,6 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::operator=
|
|||||||
FaceList<Face>::operator=(pp);
|
FaceList<Face>::operator=(pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "PrimitivePatchAddressing.C"
|
#include "PrimitivePatchAddressing.C"
|
||||||
|
|||||||
@ -28,10 +28,10 @@ Class
|
|||||||
Description
|
Description
|
||||||
A list of faces which address into the list of points.
|
A list of faces which address into the list of points.
|
||||||
|
|
||||||
The class is templated on the form of the face (e.g. triangle, polygon
|
The class is templated on the face type (e.g. triangle, polygon etc.)
|
||||||
etc.) and on the form of list for faces and points so that it can
|
and on the list type of faces and points so that it can refer to
|
||||||
refer to existing lists using UList and const pointField& or hold the
|
existing lists using UList and const pointField& or hold the storage
|
||||||
storage using List and pointField.
|
using List and pointField.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
PrimitivePatchAddressing.C
|
PrimitivePatchAddressing.C
|
||||||
@ -211,6 +211,9 @@ private:
|
|||||||
//- Calculate unit point normals
|
//- Calculate unit point normals
|
||||||
void calcPointNormals() const;
|
void calcPointNormals() const;
|
||||||
|
|
||||||
|
//- Calculate edge owner
|
||||||
|
void calcEdgeOwner() const;
|
||||||
|
|
||||||
|
|
||||||
//- Face-edge-face walk while remaining on a patch point.
|
//- Face-edge-face walk while remaining on a patch point.
|
||||||
// Used to determine if surface multiply connected through point.
|
// Used to determine if surface multiply connected through point.
|
||||||
@ -340,13 +343,13 @@ public:
|
|||||||
//- Return orders the local points for most efficient search
|
//- Return orders the local points for most efficient search
|
||||||
const labelList& localPointOrder() const;
|
const labelList& localPointOrder() const;
|
||||||
|
|
||||||
//- Given a global point index, return the local point
|
//- Given a global point index, return the local point index.
|
||||||
//index. If the point is not found, return -1
|
// If the point is not found, return -1
|
||||||
label whichPoint(const label gp) const;
|
label whichPoint(const label gp) const;
|
||||||
|
|
||||||
//- Given an edge in local point labels, return its
|
//- Given an edge in local point labels, return its
|
||||||
// index in the edge list. If the edge is not found, return -1
|
// index in the edge list. If the edge is not found, return -1
|
||||||
label whichEdge(const edge& e) const;
|
label whichEdge(const edge&) const;
|
||||||
|
|
||||||
//- Return labels of patch edges in the global edge list using
|
//- Return labels of patch edges in the global edge list using
|
||||||
// cell addressing
|
// cell addressing
|
||||||
@ -380,8 +383,8 @@ public:
|
|||||||
(
|
(
|
||||||
const ToPatch& targetPatch,
|
const ToPatch& targetPatch,
|
||||||
const Field<PointType>& projectionDirection,
|
const Field<PointType>& projectionDirection,
|
||||||
const intersection::algorithm alg = intersection::FULL_RAY,
|
const intersection::algorithm = intersection::FULL_RAY,
|
||||||
const intersection::direction dir = intersection::VECTOR
|
const intersection::direction = intersection::VECTOR
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Project vertices of patch onto another patch
|
//- Project vertices of patch onto another patch
|
||||||
@ -390,8 +393,8 @@ public:
|
|||||||
(
|
(
|
||||||
const ToPatch& targetPatch,
|
const ToPatch& targetPatch,
|
||||||
const Field<PointType>& projectionDirection,
|
const Field<PointType>& projectionDirection,
|
||||||
const intersection::algorithm alg = intersection::FULL_RAY,
|
const intersection::algorithm = intersection::FULL_RAY,
|
||||||
const intersection::direction dir = intersection::VECTOR
|
const intersection::direction = intersection::VECTOR
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return list of closed loops of boundary vertices.
|
//- Return list of closed loops of boundary vertices.
|
||||||
@ -409,8 +412,8 @@ public:
|
|||||||
surfaceTopo surfaceType() const;
|
surfaceTopo surfaceType() const;
|
||||||
|
|
||||||
//- Check surface formed by patch for manifoldness (see above).
|
//- Check surface formed by patch for manifoldness (see above).
|
||||||
// Insert vertices of incorrect
|
// Return true if any incorrect edges are found.
|
||||||
// edges set. Return true if any incorrect edge found.
|
// Insert vertices of incorrect edges into set.
|
||||||
bool checkTopology
|
bool checkTopology
|
||||||
(
|
(
|
||||||
const bool report = false,
|
const bool report = false,
|
||||||
|
|||||||
@ -39,11 +39,6 @@ Description
|
|||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template
|
template
|
||||||
@ -53,8 +48,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::calcAddressing()
|
|
||||||
const
|
void
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
calcAddressing() const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -311,8 +308,4 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::calcAddressing()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -29,10 +29,6 @@ Description
|
|||||||
#include "PrimitivePatch.H"
|
#include "PrimitivePatch.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -43,8 +39,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::calcBdryPoints()
|
|
||||||
const
|
void
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
calcBdryPoints() const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -91,8 +89,4 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::calcBdryPoints()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -31,10 +31,6 @@ Description
|
|||||||
#include "Map.H"
|
#include "Map.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -45,7 +41,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::visitPointRegion
|
|
||||||
|
void
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
visitPointRegion
|
||||||
(
|
(
|
||||||
const label pointI,
|
const label pointI,
|
||||||
const labelList& pFaces,
|
const labelList& pFaces,
|
||||||
@ -121,8 +120,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
typename PrimitivePatch<Face, FaceList, PointField, PointType>::surfaceTopo
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::surfaceType() const
|
typename Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::surfaceTopo
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
surfaceType() const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -173,7 +174,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
bool PrimitivePatch<Face, FaceList, PointField, PointType>::checkTopology
|
|
||||||
|
bool
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
checkTopology
|
||||||
(
|
(
|
||||||
const bool report,
|
const bool report,
|
||||||
labelHashSet* setPtr
|
labelHashSet* setPtr
|
||||||
@ -241,8 +245,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::checkPointManifold
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
checkPointManifold
|
||||||
(
|
(
|
||||||
const bool report,
|
const bool report,
|
||||||
labelHashSet* setPtr
|
labelHashSet* setPtr
|
||||||
@ -331,8 +337,4 @@ PrimitivePatch<Face, FaceList, PointField, PointType>::checkPointManifold
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -29,10 +29,6 @@ Description
|
|||||||
#include "PrimitivePatch.H"
|
#include "PrimitivePatch.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -43,7 +39,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::clearGeom()
|
|
||||||
|
void
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
clearGeom()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -65,7 +64,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::clearTopology()
|
|
||||||
|
void
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
clearTopology()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -91,10 +93,8 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::clearTopology()
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteDemandDrivenData(boundaryPointsPtr_);
|
deleteDemandDrivenData(boundaryPointsPtr_);
|
||||||
|
|
||||||
deleteDemandDrivenData(pointEdgesPtr_);
|
deleteDemandDrivenData(pointEdgesPtr_);
|
||||||
deleteDemandDrivenData(pointFacesPtr_);
|
deleteDemandDrivenData(pointFacesPtr_);
|
||||||
|
|
||||||
deleteDemandDrivenData(edgeLoopsPtr_);
|
deleteDemandDrivenData(edgeLoopsPtr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::clearPatchMeshAddr()
|
|
||||||
|
void
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
clearPatchMeshAddr()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -129,7 +132,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::clearOut()
|
|
||||||
|
void
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
clearOut()
|
||||||
{
|
{
|
||||||
clearGeom();
|
clearGeom();
|
||||||
clearTopology();
|
clearTopology();
|
||||||
@ -137,8 +143,4 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::clearOut()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -30,10 +30,7 @@ Description
|
|||||||
|
|
||||||
#include "PrimitivePatch.H"
|
#include "PrimitivePatch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -44,8 +41,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::calcEdgeLoops()
|
|
||||||
const
|
void
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
calcEdgeLoops() const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -95,7 +94,7 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::calcEdgeLoops()
|
|||||||
// Current loop number.
|
// Current loop number.
|
||||||
label loopI = 0;
|
label loopI = 0;
|
||||||
|
|
||||||
for (;;)
|
while (true)
|
||||||
{
|
{
|
||||||
// Find edge not yet given a loop number.
|
// Find edge not yet given a loop number.
|
||||||
label currentEdgeI = -1;
|
label currentEdgeI = -1;
|
||||||
@ -175,8 +174,10 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
const labelListList&
|
|
||||||
PrimitivePatch<Face, FaceList, PointField, PointType>::edgeLoops() const
|
const Foam::labelListList&
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
edgeLoops() const
|
||||||
{
|
{
|
||||||
if (!edgeLoopsPtr_)
|
if (!edgeLoopsPtr_)
|
||||||
{
|
{
|
||||||
@ -186,8 +187,5 @@ PrimitivePatch<Face, FaceList, PointField, PointType>::edgeLoops() const
|
|||||||
return *edgeLoopsPtr_;
|
return *edgeLoopsPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -30,11 +30,6 @@ Description
|
|||||||
#include "SLList.H"
|
#include "SLList.H"
|
||||||
#include "boolList.H"
|
#include "boolList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template
|
template
|
||||||
@ -44,7 +39,9 @@ template
|
|||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::
|
|
||||||
|
void
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
calcLocalPointOrder() const
|
calcLocalPointOrder() const
|
||||||
{
|
{
|
||||||
// Note: Cannot use bandCompressing as point-point addressing does
|
// Note: Cannot use bandCompressing as point-point addressing does
|
||||||
@ -140,9 +137,4 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -27,10 +27,7 @@ License
|
|||||||
#include "PrimitivePatch.H"
|
#include "PrimitivePatch.H"
|
||||||
#include "Map.H"
|
#include "Map.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -42,7 +39,9 @@ template
|
|||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
|
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::calcMeshData() const
|
void
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
calcMeshData() const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -128,8 +127,9 @@ template
|
|||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
|
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::calcMeshPointMap()
|
void
|
||||||
const
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
calcMeshPointMap() const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -179,8 +179,9 @@ template
|
|||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
|
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::calcLocalPoints()
|
void
|
||||||
const
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
calcLocalPoints() const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -231,8 +232,9 @@ template
|
|||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
|
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::calcPointNormals()
|
void
|
||||||
const
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
calcPointNormals() const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -298,8 +300,9 @@ template
|
|||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
|
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::calcFaceNormals()
|
void
|
||||||
const
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
calcFaceNormals() const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -341,8 +344,4 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::calcFaceNormals()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -28,10 +28,6 @@ Description
|
|||||||
|
|
||||||
#include "PrimitivePatch.H"
|
#include "PrimitivePatch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -43,7 +39,9 @@ template
|
|||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
|
|
||||||
labelList PrimitivePatch<Face, FaceList, PointField, PointType>::meshEdges
|
Foam::labelList
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
meshEdges
|
||||||
(
|
(
|
||||||
const edgeList& allEdges,
|
const edgeList& allEdges,
|
||||||
const labelListList& cellEdges,
|
const labelListList& cellEdges,
|
||||||
@ -119,7 +117,9 @@ template
|
|||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
|
|
||||||
labelList PrimitivePatch<Face, FaceList, PointField, PointType>::meshEdges
|
Foam::labelList
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
meshEdges
|
||||||
(
|
(
|
||||||
const edgeList& allEdges,
|
const edgeList& allEdges,
|
||||||
const labelListList& pointEdges
|
const labelListList& pointEdges
|
||||||
@ -175,7 +175,9 @@ template
|
|||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
|
|
||||||
label PrimitivePatch<Face, FaceList, PointField, PointType>::whichEdge
|
Foam::label
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
whichEdge
|
||||||
(
|
(
|
||||||
const edge& e
|
const edge& e
|
||||||
) const
|
) const
|
||||||
@ -201,8 +203,4 @@ label PrimitivePatch<Face, FaceList, PointField, PointType>::whichEdge
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -30,10 +30,6 @@ Description
|
|||||||
#include "PrimitivePatch.H"
|
#include "PrimitivePatch.H"
|
||||||
#include "SLList.H"
|
#include "SLList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -45,8 +41,9 @@ template
|
|||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
|
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::calcPointEdges()
|
void
|
||||||
const
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
calcPointEdges() const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -116,8 +113,9 @@ template
|
|||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
|
|
||||||
void PrimitivePatch<Face, FaceList, PointField, PointType>::calcPointFaces()
|
void
|
||||||
const
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
|
calcPointFaces() const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -183,8 +181,4 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::calcPointFaces()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -33,11 +33,6 @@ Description
|
|||||||
#include "objectHit.H"
|
#include "objectHit.H"
|
||||||
#include "bandCompression.H"
|
#include "bandCompression.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template
|
template
|
||||||
@ -49,7 +44,8 @@ template
|
|||||||
>
|
>
|
||||||
|
|
||||||
template <class ToPatch>
|
template <class ToPatch>
|
||||||
List<objectHit> PrimitivePatch<Face, FaceList, PointField, PointType>::
|
Foam::List<Foam::objectHit>
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
projectPoints
|
projectPoints
|
||||||
(
|
(
|
||||||
const ToPatch& targetPatch,
|
const ToPatch& targetPatch,
|
||||||
@ -59,7 +55,6 @@ projectPoints
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// The current patch is slave, i.e. it is being projected onto the target
|
// The current patch is slave, i.e. it is being projected onto the target
|
||||||
//
|
|
||||||
|
|
||||||
if (projectionDirection.size() != nPoints())
|
if (projectionDirection.size() != nPoints())
|
||||||
{
|
{
|
||||||
@ -297,7 +292,8 @@ template
|
|||||||
>
|
>
|
||||||
|
|
||||||
template <class ToPatch>
|
template <class ToPatch>
|
||||||
List<objectHit> PrimitivePatch<Face, FaceList, PointField, PointType>::
|
Foam::List<Foam::objectHit>
|
||||||
|
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||||
projectFaceCentres
|
projectFaceCentres
|
||||||
(
|
(
|
||||||
const ToPatch& targetPatch,
|
const ToPatch& targetPatch,
|
||||||
@ -307,7 +303,6 @@ projectFaceCentres
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// The current patch is slave, i.e. it is being projected onto the target
|
// The current patch is slave, i.e. it is being projected onto the target
|
||||||
//
|
|
||||||
|
|
||||||
if (projectionDirection.size() != this->size())
|
if (projectionDirection.size() != this->size())
|
||||||
{
|
{
|
||||||
@ -532,8 +527,4 @@ projectFaceCentres
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,173 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by the
|
|
||||||
Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "PrimitivePatchExtra.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// Construct from components
|
|
||||||
template
|
|
||||||
<
|
|
||||||
class Face,
|
|
||||||
template<class> class FaceList,
|
|
||||||
class PointField,
|
|
||||||
class PointType
|
|
||||||
>
|
|
||||||
Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
|
|
||||||
PrimitivePatchExtra
|
|
||||||
(
|
|
||||||
const FaceList<Face>& faces,
|
|
||||||
const Field<PointType>& points
|
|
||||||
)
|
|
||||||
:
|
|
||||||
ParentType(faces, points),
|
|
||||||
sortedEdgeFacesPtr_(NULL),
|
|
||||||
edgeOwnerPtr_(NULL)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// Construct as copy
|
|
||||||
template
|
|
||||||
<
|
|
||||||
class Face,
|
|
||||||
template<class> class FaceList,
|
|
||||||
class PointField,
|
|
||||||
class PointType
|
|
||||||
>
|
|
||||||
Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
|
|
||||||
PrimitivePatchExtra
|
|
||||||
(
|
|
||||||
const PrimitivePatchExtra<Face, FaceList, PointField, PointType>& pp
|
|
||||||
)
|
|
||||||
:
|
|
||||||
ParentType(pp),
|
|
||||||
sortedEdgeFacesPtr_(NULL),
|
|
||||||
edgeOwnerPtr_(NULL)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template
|
|
||||||
<
|
|
||||||
class Face,
|
|
||||||
template<class> class FaceList,
|
|
||||||
class PointField,
|
|
||||||
class PointType
|
|
||||||
>
|
|
||||||
Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
|
|
||||||
~PrimitivePatchExtra()
|
|
||||||
{
|
|
||||||
clearOut();
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template
|
|
||||||
<
|
|
||||||
class Face,
|
|
||||||
template<class> class FaceList,
|
|
||||||
class PointField,
|
|
||||||
class PointType
|
|
||||||
>
|
|
||||||
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
|
|
||||||
clearOut()
|
|
||||||
{
|
|
||||||
ParentType::clearOut();
|
|
||||||
clearTopology();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template
|
|
||||||
<
|
|
||||||
class Face,
|
|
||||||
template<class> class FaceList,
|
|
||||||
class PointField,
|
|
||||||
class PointType
|
|
||||||
>
|
|
||||||
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
|
|
||||||
clearTopology()
|
|
||||||
{
|
|
||||||
ParentType::clearTopology();
|
|
||||||
deleteDemandDrivenData(sortedEdgeFacesPtr_);
|
|
||||||
deleteDemandDrivenData(edgeOwnerPtr_);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template
|
|
||||||
<
|
|
||||||
class Face,
|
|
||||||
template<class> class FaceList,
|
|
||||||
class PointField,
|
|
||||||
class PointType
|
|
||||||
>
|
|
||||||
const Foam::labelListList&
|
|
||||||
Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
|
|
||||||
sortedEdgeFaces() const
|
|
||||||
{
|
|
||||||
if (!sortedEdgeFacesPtr_)
|
|
||||||
{
|
|
||||||
calcSortedEdgeFaces();
|
|
||||||
}
|
|
||||||
|
|
||||||
return *sortedEdgeFacesPtr_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template
|
|
||||||
<
|
|
||||||
class Face,
|
|
||||||
template<class> class FaceList,
|
|
||||||
class PointField,
|
|
||||||
class PointType
|
|
||||||
>
|
|
||||||
const Foam::labelList&
|
|
||||||
Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
|
|
||||||
edgeOwner() const
|
|
||||||
{
|
|
||||||
if (!edgeOwnerPtr_)
|
|
||||||
{
|
|
||||||
calcEdgeOwner();
|
|
||||||
}
|
|
||||||
|
|
||||||
return *edgeOwnerPtr_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#include "PrimitivePatchExtraAddressing.C"
|
|
||||||
#include "PrimitivePatchExtraCleanup.C"
|
|
||||||
#include "PrimitivePatchExtraSearch.C"
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,205 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by the
|
|
||||||
Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::PrimitivePatchExtra
|
|
||||||
|
|
||||||
Description
|
|
||||||
PrimitivePatch with some extra functionality.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
PrimitivePatchExtra.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef PrimitivePatchExtra_H
|
|
||||||
#define PrimitivePatchExtra_H
|
|
||||||
|
|
||||||
#include "PrimitivePatch.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class PrimitivePatchExtra Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
template
|
|
||||||
<
|
|
||||||
class Face,
|
|
||||||
template<class> class FaceList,
|
|
||||||
class PointField,
|
|
||||||
class PointType=point
|
|
||||||
>
|
|
||||||
class PrimitivePatchExtra
|
|
||||||
:
|
|
||||||
public PrimitivePatch<Face, FaceList, PointField, PointType>
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Public typedefs
|
|
||||||
|
|
||||||
typedef Face FaceType;
|
|
||||||
typedef FaceList<Face> FaceListType;
|
|
||||||
typedef PointField PointFieldType;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private typedefs
|
|
||||||
typedef PrimitivePatch<Face, FaceList, PointField, PointType> ParentType;
|
|
||||||
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
// Demand driven private data
|
|
||||||
|
|
||||||
//- Edge-face addressing (sorted)
|
|
||||||
mutable labelListList* sortedEdgeFacesPtr_;
|
|
||||||
|
|
||||||
//- Label of face that 'owns' edge
|
|
||||||
// i.e. e.vec() is righthanded walk along face
|
|
||||||
mutable labelList* edgeOwnerPtr_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Calculate sorted edgeFaces
|
|
||||||
void calcSortedEdgeFaces() const;
|
|
||||||
|
|
||||||
//- Calculate owner
|
|
||||||
void calcEdgeOwner() const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
PrimitivePatchExtra
|
|
||||||
(
|
|
||||||
const FaceList<Face>& faces,
|
|
||||||
const Field<PointType>& points
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct as copy
|
|
||||||
PrimitivePatchExtra
|
|
||||||
(
|
|
||||||
const PrimitivePatchExtra<Face, FaceList, PointField, PointType>&
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
|
||||||
|
|
||||||
virtual ~PrimitivePatchExtra();
|
|
||||||
|
|
||||||
void clearOut();
|
|
||||||
|
|
||||||
void clearTopology();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
// Access functions for demand driven data
|
|
||||||
|
|
||||||
// Topological data; no mesh required.
|
|
||||||
|
|
||||||
//- Return edge-face addressing sorted by angle around the edge.
|
|
||||||
// Orientation is anticlockwise looking from edge.vec(localPoints())
|
|
||||||
const labelListList& sortedEdgeFaces() const;
|
|
||||||
|
|
||||||
//- If 2 face neighbours: label of face where ordering of edge
|
|
||||||
// is consistent with righthand walk.
|
|
||||||
// If 1 neighbour: label of only face.
|
|
||||||
// If >2 neighbours: undetermined.
|
|
||||||
const labelList& edgeOwner() const;
|
|
||||||
|
|
||||||
|
|
||||||
// Addressing into mesh
|
|
||||||
|
|
||||||
|
|
||||||
// Other patch operations
|
|
||||||
|
|
||||||
|
|
||||||
// Check
|
|
||||||
|
|
||||||
//- Check multiply-connected edges.
|
|
||||||
void checkEdges(const bool verbose) const;
|
|
||||||
|
|
||||||
//- Check orientation (normals) and normals of neighbouring faces
|
|
||||||
boolList checkOrientation(const bool verbose) const;
|
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
|
||||||
|
|
||||||
//- Fill faceZone with currentZone for every face reachable
|
|
||||||
// from faceI without crossing edge marked in borderEdge.
|
|
||||||
// Note: faceZone has to be sized nFaces before calling.
|
|
||||||
void markZone
|
|
||||||
(
|
|
||||||
const UList<bool>& borderEdge,
|
|
||||||
const label faceI,
|
|
||||||
const label currentZone,
|
|
||||||
labelList& faceZone
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- (size and) fills faceZone with zone of face.
|
|
||||||
// Zone is area reachable by edge crossing without crossing borderEdge
|
|
||||||
// (bool for every edge in surface). Returns number of zones.
|
|
||||||
label markZones
|
|
||||||
(
|
|
||||||
const UList<bool>& borderEdge,
|
|
||||||
labelList& faceZone
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Determine the mapping for a sub-mesh.
|
|
||||||
// Only include faces for which bool List entry is true
|
|
||||||
// @param[out] pointMap mapping new to old localPoints
|
|
||||||
// @param[out] faceMap mapping new to old faces
|
|
||||||
void subsetMap
|
|
||||||
(
|
|
||||||
const UList<bool>& include,
|
|
||||||
labelList& pointMap,
|
|
||||||
labelList& faceMap
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
# include "PrimitivePatchExtra.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,218 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by the
|
|
||||||
Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Description
|
|
||||||
Contains fix for PrimitivePatch addressing (which doesn't work if surface
|
|
||||||
is non-manifold). Should be moved into PrimitivePatch.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "PrimitivePatchExtra.H"
|
|
||||||
#include "HashTable.H"
|
|
||||||
#include "SortableList.H"
|
|
||||||
#include "transform.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template
|
|
||||||
<
|
|
||||||
class Face,
|
|
||||||
template<class> class FaceList,
|
|
||||||
class PointField,
|
|
||||||
class PointType
|
|
||||||
>
|
|
||||||
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
|
|
||||||
calcSortedEdgeFaces() const
|
|
||||||
{
|
|
||||||
if (sortedEdgeFacesPtr_)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"PrimitivePatchExtra<Face, FaceList, PointField>::"
|
|
||||||
"calcSortedEdgeFaces()"
|
|
||||||
)
|
|
||||||
<< "sortedEdgeFacesPtr_ already set"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
const labelListList& eFaces = this->edgeFaces();
|
|
||||||
const edgeList& edgeLst = this->edges();
|
|
||||||
const Field<PointType>& locPointLst = this->localPoints();
|
|
||||||
const List<Face>& locFaceLst = this->localFaces();
|
|
||||||
|
|
||||||
// create the lists for the various results. (resized on completion)
|
|
||||||
sortedEdgeFacesPtr_ = new labelListList(eFaces.size());
|
|
||||||
labelListList& sortedEdgeFaces = *sortedEdgeFacesPtr_;
|
|
||||||
|
|
||||||
forAll(eFaces, edgeI)
|
|
||||||
{
|
|
||||||
const labelList& myFaceNbs = eFaces[edgeI];
|
|
||||||
|
|
||||||
if (myFaceNbs.size() > 2)
|
|
||||||
{
|
|
||||||
// Get point on edge and normalized direction of edge (= e2 base
|
|
||||||
// of our coordinate system)
|
|
||||||
const edge& e = edgeLst[edgeI];
|
|
||||||
|
|
||||||
const point& edgePt = locPointLst[e.start()];
|
|
||||||
|
|
||||||
vector e2 = e.vec(locPointLst);
|
|
||||||
e2 /= mag(e2) + VSMALL;
|
|
||||||
|
|
||||||
// Get opposite vertex for 0th face
|
|
||||||
const Face& f = locFaceLst[myFaceNbs[0]];
|
|
||||||
|
|
||||||
label fp0 = findIndex(f, e[0]);
|
|
||||||
label fp1 = f.fcIndex(fp0);
|
|
||||||
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
|
|
||||||
|
|
||||||
// Get vector normal both to e2 and to edge from opposite vertex
|
|
||||||
// to edge (will be x-axis of our coordinate system)
|
|
||||||
vector e0 = e2 ^ (locPointLst[vertI] - edgePt);
|
|
||||||
e0 /= mag(e0) + VSMALL;
|
|
||||||
|
|
||||||
// Get y-axis of coordinate system
|
|
||||||
vector e1 = e2 ^ e0;
|
|
||||||
|
|
||||||
SortableList<scalar> faceAngles(myFaceNbs.size());
|
|
||||||
|
|
||||||
// e0 is reference so angle is 0
|
|
||||||
faceAngles[0] = 0;
|
|
||||||
|
|
||||||
for (label nbI = 1; nbI < myFaceNbs.size(); nbI++)
|
|
||||||
{
|
|
||||||
// Get opposite vertex
|
|
||||||
const Face& f = locFaceLst[myFaceNbs[nbI]];
|
|
||||||
label fp0 = findIndex(f, e[0]);
|
|
||||||
label fp1 = f.fcIndex(fp0);
|
|
||||||
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
|
|
||||||
|
|
||||||
vector vec = e2 ^ (locPointLst[vertI] - edgePt);
|
|
||||||
vec /= mag(vec) + VSMALL;
|
|
||||||
|
|
||||||
faceAngles[nbI] = pseudoAngle
|
|
||||||
(
|
|
||||||
e0,
|
|
||||||
e1,
|
|
||||||
vec
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
faceAngles.sort();
|
|
||||||
|
|
||||||
sortedEdgeFaces[edgeI] = IndirectList<label>
|
|
||||||
(
|
|
||||||
myFaceNbs,
|
|
||||||
faceAngles.indices()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// No need to sort. Just copy.
|
|
||||||
sortedEdgeFaces[edgeI] = myFaceNbs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template
|
|
||||||
<
|
|
||||||
class Face,
|
|
||||||
template<class> class FaceList,
|
|
||||||
class PointField,
|
|
||||||
class PointType
|
|
||||||
>
|
|
||||||
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
|
|
||||||
calcEdgeOwner() const
|
|
||||||
{
|
|
||||||
if (edgeOwnerPtr_)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"PrimitivePatchExtra<Face, FaceList, PointField>::"
|
|
||||||
"calcEdgeOwner()"
|
|
||||||
)
|
|
||||||
<< "edgeOwnerPtr_ already set"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
// create the owner list
|
|
||||||
edgeOwnerPtr_ = new labelList(this->nEdges());
|
|
||||||
labelList& edgeOwner = *edgeOwnerPtr_;
|
|
||||||
|
|
||||||
const edgeList& edgeLst = this->edges();
|
|
||||||
const labelListList& eFaces = this->edgeFaces();
|
|
||||||
const List<Face>& locFaceLst = this->localFaces();
|
|
||||||
|
|
||||||
|
|
||||||
forAll(edgeLst, edgeI)
|
|
||||||
{
|
|
||||||
const edge& e = edgeLst[edgeI];
|
|
||||||
const labelList& neighbouringFaces = eFaces[edgeI];
|
|
||||||
|
|
||||||
if (neighbouringFaces.size() == 1)
|
|
||||||
{
|
|
||||||
edgeOwner[edgeI] = neighbouringFaces[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Find the first face whose vertices are aligned with the edge.
|
|
||||||
// with multiply connected edges, this is the best we can do
|
|
||||||
edgeOwner[edgeI] = -1;
|
|
||||||
|
|
||||||
forAll(neighbouringFaces, i)
|
|
||||||
{
|
|
||||||
const Face& f = locFaceLst[neighbouringFaces[i]];
|
|
||||||
|
|
||||||
if (f.edgeDirection(e) > 0)
|
|
||||||
{
|
|
||||||
edgeOwner[edgeI] = neighbouringFaces[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (edgeOwner[edgeI] == -1)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"PrimitivePatchExtra<Face, FaceList, PointField>::"
|
|
||||||
"calcEdgeOwner()"
|
|
||||||
)
|
|
||||||
<< "Edge " << edgeI << " vertices:" << e
|
|
||||||
<< " is used by faces " << neighbouringFaces
|
|
||||||
<< " vertices:"
|
|
||||||
<< IndirectList<Face>(locFaceLst, neighbouringFaces)()
|
|
||||||
<< " none of which use the edge vertices in the same order"
|
|
||||||
<< nl << "I give up" << abort(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,239 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by the
|
|
||||||
Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "PrimitivePatchExtra.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// Check/fix edges with more than two faces
|
|
||||||
template
|
|
||||||
<
|
|
||||||
class Face,
|
|
||||||
template<class> class FaceList,
|
|
||||||
class PointField,
|
|
||||||
class PointType
|
|
||||||
>
|
|
||||||
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
|
|
||||||
checkEdges
|
|
||||||
(
|
|
||||||
const bool verbose
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
const labelListList& eFaces = this->edgeFaces();
|
|
||||||
const edgeList& edgeLst = this->edges();
|
|
||||||
|
|
||||||
forAll(eFaces, edgeI)
|
|
||||||
{
|
|
||||||
const labelList& myFaces = eFaces[edgeI];
|
|
||||||
|
|
||||||
// boundary edges have one face
|
|
||||||
// interior edges have two faces
|
|
||||||
if (myFaces.empty())
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"PrimitivePatchExtra::checkEdges(bool verbose)"
|
|
||||||
)
|
|
||||||
<< "Edge " << edgeI << " with vertices " << edgeLst[edgeI]
|
|
||||||
<< " has no edgeFaces"
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
else if (myFaces.size() > 2)
|
|
||||||
{
|
|
||||||
WarningIn
|
|
||||||
(
|
|
||||||
"PrimitivePatchExtra::checkEdges(bool verbose)"
|
|
||||||
)
|
|
||||||
<< "Edge " << edgeI << " with vertices " << edgeLst[edgeI]
|
|
||||||
<< " has more than 2 faces connected to it : " << myFaces
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Check normals and orientation
|
|
||||||
template
|
|
||||||
<
|
|
||||||
class Face,
|
|
||||||
template<class> class FaceList,
|
|
||||||
class PointField,
|
|
||||||
class PointType
|
|
||||||
>
|
|
||||||
Foam::boolList
|
|
||||||
Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
|
|
||||||
checkOrientation
|
|
||||||
(
|
|
||||||
const bool verbose
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
const FaceList<Face>& faceLst = *this;
|
|
||||||
const edgeList& edgeLst = this->edges();
|
|
||||||
const labelListList& faceEs = this->faceEdges();
|
|
||||||
const label numEdges = this->nEdges();
|
|
||||||
const Field<PointType>& pointLst = this->points();
|
|
||||||
const vectorField& normLst = this->faceNormals();
|
|
||||||
|
|
||||||
if (ParentType::debug)
|
|
||||||
{
|
|
||||||
Info<<"checkOrientation:::checkOrientation(bool)" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check edge normals, face normals, point normals.
|
|
||||||
forAll(faceEs, faceI)
|
|
||||||
{
|
|
||||||
const labelList& edgeLabels = faceEs[faceI];
|
|
||||||
|
|
||||||
if (edgeLabels.size() < 3)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"PrimitivePatchExtra::checkOrientation(bool)"
|
|
||||||
)
|
|
||||||
<< "face " << faceLst[faceI]
|
|
||||||
<< " has fewer than 3 edges. Edges:" << edgeLabels
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool valid = true;
|
|
||||||
forAll(edgeLabels, i)
|
|
||||||
{
|
|
||||||
if (edgeLabels[i] < 0 || edgeLabels[i] >= numEdges)
|
|
||||||
{
|
|
||||||
WarningIn
|
|
||||||
(
|
|
||||||
"PrimitivePatchExtra::checkOrientation(bool)"
|
|
||||||
)
|
|
||||||
<< "edge number " << edgeLabels[i] << " on face " << faceI
|
|
||||||
<< " out-of-range\n"
|
|
||||||
<< "This usually means the input surface has "
|
|
||||||
<< "edges with more than 2 faces connected.\n"
|
|
||||||
<< endl;
|
|
||||||
valid = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!valid)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
//- Compute normal from 3 points, use the first as the origin
|
|
||||||
// minor warpage should not be a problem
|
|
||||||
const Face& f = faceLst[faceI];
|
|
||||||
const point p0(pointLst[f[0]]);
|
|
||||||
const point p1(pointLst[f[1]]);
|
|
||||||
const point p2(pointLst[f[f.size()-1]]);
|
|
||||||
|
|
||||||
const vector pointNormal((p1 - p0) ^ (p2 - p0));
|
|
||||||
if ((pointNormal & normLst[faceI]) < 0)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"PrimitivePatchExtra::checkOrientation(bool)"
|
|
||||||
)
|
|
||||||
<< "Normal calculated from points inconsistent with faceNormal"
|
|
||||||
<< nl
|
|
||||||
<< "face: " << f << nl
|
|
||||||
<< "points: " << p0 << ' ' << p1 << ' ' << p2 << nl
|
|
||||||
<< "pointNormal:" << pointNormal << nl
|
|
||||||
<< "faceNormal:" << normLst[faceI]
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const labelListList& eFaces = this->edgeFaces();
|
|
||||||
const pointField& locPointsLst = this->localPoints();
|
|
||||||
|
|
||||||
// Storage for holding status of edge.
|
|
||||||
// True if normal flips across this edge
|
|
||||||
boolList borderEdge(numEdges, false);
|
|
||||||
|
|
||||||
forAll(edgeLst, edgeI)
|
|
||||||
{
|
|
||||||
const edge& e = edgeLst[edgeI];
|
|
||||||
const labelList& neighbouringFaces = eFaces[edgeI];
|
|
||||||
|
|
||||||
if (neighbouringFaces.size() == 2)
|
|
||||||
{
|
|
||||||
// we use localFaces() since edges() are LOCAL
|
|
||||||
// these are both already available
|
|
||||||
const Face& faceA = this->localFaces()[neighbouringFaces[0]];
|
|
||||||
const Face& faceB = this->localFaces()[neighbouringFaces[1]];
|
|
||||||
|
|
||||||
// If the faces are correctly oriented, the edges must go in
|
|
||||||
// different directions on connected faces.
|
|
||||||
if (faceA.edgeDirection(e) == faceB.edgeDirection(e))
|
|
||||||
{
|
|
||||||
borderEdge[edgeI] = true;
|
|
||||||
if (verbose)
|
|
||||||
{
|
|
||||||
WarningIn
|
|
||||||
(
|
|
||||||
"PrimitivePatchExtra::checkOrientation(bool)"
|
|
||||||
)
|
|
||||||
<< "face orientation incorrect." << nl
|
|
||||||
<< "localEdge[" << edgeI << "] " << e
|
|
||||||
<< " between faces:" << nl
|
|
||||||
<< " face[" << neighbouringFaces[0] << "] "
|
|
||||||
<< faceLst[neighbouringFaces[0]]
|
|
||||||
<< " localFace: " << faceA
|
|
||||||
<< nl
|
|
||||||
<< " face[" << neighbouringFaces[1] << "] "
|
|
||||||
<< faceLst[neighbouringFaces[1]]
|
|
||||||
<< " localFace: " << faceB
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (neighbouringFaces.size() != 1)
|
|
||||||
{
|
|
||||||
if (verbose)
|
|
||||||
{
|
|
||||||
WarningIn
|
|
||||||
(
|
|
||||||
"PrimitivePatchExtra::checkOrientation(bool)"
|
|
||||||
)
|
|
||||||
<< "Wrong number of edge neighbours." << nl
|
|
||||||
<< "edge[" << edgeI << "] " << e
|
|
||||||
<< " with points:" << locPointsLst[e.start()]
|
|
||||||
<< ' ' << locPointsLst[e.end()]
|
|
||||||
<< " has neighbouringFaces:" << neighbouringFaces << endl;
|
|
||||||
}
|
|
||||||
borderEdge[edgeI] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return borderEdge;
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "PrimitivePatchTools.H"
|
||||||
|
|
||||||
|
#include "PrimitivePatchToolsCheck.C"
|
||||||
|
#include "PrimitivePatchToolsEdgeOwner.C"
|
||||||
|
#include "PrimitivePatchToolsSearch.C"
|
||||||
|
#include "PrimitivePatchToolsSortEdges.C"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,181 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::PrimitivePatchTools
|
||||||
|
|
||||||
|
Description
|
||||||
|
A collect of tools for searching, sort PrimitivePatch information.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
PrimitivePatchTools.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef PrimitivePatchTools_H
|
||||||
|
#define PrimitivePatchTools_H
|
||||||
|
|
||||||
|
#include "PrimitivePatch.H"
|
||||||
|
#include "HashSet.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class PatchTools Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class PatchTools
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Check for orientation issues.
|
||||||
|
// Returns true if problems were found.
|
||||||
|
// If a normal flips across an edge, places it in the HashSet
|
||||||
|
template
|
||||||
|
<
|
||||||
|
class Face,
|
||||||
|
template<class> class FaceList,
|
||||||
|
class PointField,
|
||||||
|
class PointType
|
||||||
|
>
|
||||||
|
static bool checkOrientation
|
||||||
|
(
|
||||||
|
const PrimitivePatch<Face, FaceList, PointField, PointType>&,
|
||||||
|
const bool report = false,
|
||||||
|
labelHashSet* marked = 0
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Fill faceZone with currentZone for every face reachable
|
||||||
|
// from faceI without crossing edge marked in borderEdge.
|
||||||
|
// Note: faceZone has to be sized nFaces before calling.
|
||||||
|
template
|
||||||
|
<
|
||||||
|
class BoolListType,
|
||||||
|
class Face,
|
||||||
|
template<class> class FaceList,
|
||||||
|
class PointField,
|
||||||
|
class PointType
|
||||||
|
>
|
||||||
|
static void markZone
|
||||||
|
(
|
||||||
|
const PrimitivePatch<Face, FaceList, PointField, PointType>&,
|
||||||
|
const BoolListType& borderEdge,
|
||||||
|
const label faceI,
|
||||||
|
const label currentZone,
|
||||||
|
labelList& faceZone
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Size and fills faceZone with zone of face.
|
||||||
|
// Zone is area reachable by edge crossing without crossing borderEdge.
|
||||||
|
// Returns number of zones.
|
||||||
|
template
|
||||||
|
<
|
||||||
|
class BoolListType,
|
||||||
|
class Face,
|
||||||
|
template<class> class FaceList,
|
||||||
|
class PointField,
|
||||||
|
class PointType
|
||||||
|
>
|
||||||
|
static label markZones
|
||||||
|
(
|
||||||
|
const PrimitivePatch<Face, FaceList, PointField, PointType>&,
|
||||||
|
const BoolListType& borderEdge,
|
||||||
|
labelList& faceZone
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Determine the mapping for a sub-patch.
|
||||||
|
// Only include faces for which bool-list entry is true.
|
||||||
|
// @param[in] includeFaces faces to include
|
||||||
|
// @param[out] pointMap mapping new to old localPoints
|
||||||
|
// @param[out] faceMap mapping new to old faces
|
||||||
|
template
|
||||||
|
<
|
||||||
|
class BoolListType,
|
||||||
|
class Face,
|
||||||
|
template<class> class FaceList,
|
||||||
|
class PointField,
|
||||||
|
class PointType
|
||||||
|
>
|
||||||
|
static void subsetMap
|
||||||
|
(
|
||||||
|
const PrimitivePatch<Face, FaceList, PointField, PointType>&,
|
||||||
|
const BoolListType& includeFaces,
|
||||||
|
labelList& pointMap,
|
||||||
|
labelList& faceMap
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return edge-face addressing sorted by angle around the edge.
|
||||||
|
// Orientation is anticlockwise looking from edge.vec(localPoints())
|
||||||
|
template
|
||||||
|
<
|
||||||
|
class Face,
|
||||||
|
template<class> class FaceList,
|
||||||
|
class PointField,
|
||||||
|
class PointType
|
||||||
|
>
|
||||||
|
static labelListList sortedEdgeFaces
|
||||||
|
(
|
||||||
|
const PrimitivePatch<Face, FaceList, PointField, PointType>&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- If 2 face neighbours: label of face where ordering of edge
|
||||||
|
// is consistent with righthand walk.
|
||||||
|
// If 1 neighbour: label of only face.
|
||||||
|
// If >2 neighbours: undetermined.
|
||||||
|
template
|
||||||
|
<
|
||||||
|
class Face,
|
||||||
|
template<class> class FaceList,
|
||||||
|
class PointField,
|
||||||
|
class PointType
|
||||||
|
>
|
||||||
|
static labelList edgeOwner
|
||||||
|
(
|
||||||
|
const PrimitivePatch<Face, FaceList, PointField, PointType>&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "PrimitivePatchTools.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,180 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "PrimitivePatchTools.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template
|
||||||
|
<
|
||||||
|
class Face,
|
||||||
|
template<class> class FaceList,
|
||||||
|
class PointField,
|
||||||
|
class PointType
|
||||||
|
>
|
||||||
|
|
||||||
|
bool
|
||||||
|
Foam::PatchTools::checkOrientation
|
||||||
|
(
|
||||||
|
const PrimitivePatch<Face, FaceList, PointField, PointType>& p,
|
||||||
|
const bool report,
|
||||||
|
labelHashSet* setPtr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
bool foundError = false;
|
||||||
|
|
||||||
|
// Check edge normals, face normals, point normals.
|
||||||
|
forAll(p.faceEdges(), faceI)
|
||||||
|
{
|
||||||
|
const labelList& edgeLabels = p.faceEdges()[faceI];
|
||||||
|
bool valid = true;
|
||||||
|
|
||||||
|
if (edgeLabels.size() < 3)
|
||||||
|
{
|
||||||
|
if (report)
|
||||||
|
{
|
||||||
|
Info<< "Face[" << faceI << "] " << p[faceI]
|
||||||
|
<< " has fewer than 3 edges. Edges: " << edgeLabels
|
||||||
|
<< nl;
|
||||||
|
}
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
forAll(edgeLabels, i)
|
||||||
|
{
|
||||||
|
if (edgeLabels[i] < 0 || edgeLabels[i] >= p.nEdges())
|
||||||
|
{
|
||||||
|
if (report)
|
||||||
|
{
|
||||||
|
Info<< "edge number " << edgeLabels[i] << " on face " << faceI
|
||||||
|
<< " out-of-range\n"
|
||||||
|
<< "This usually means the input surface has "
|
||||||
|
<< "edges with more than 2 faces connected." << nl;
|
||||||
|
}
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!valid)
|
||||||
|
{
|
||||||
|
foundError = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
//- Compute normal from 3 points, use the first as the origin
|
||||||
|
// minor warpage should not be a problem
|
||||||
|
const Face& f = p[faceI];
|
||||||
|
const point p0(p.points()[f[0]]);
|
||||||
|
const point p1(p.points()[f[1]]);
|
||||||
|
const point p2(p.points()[f[f.size()-1]]);
|
||||||
|
|
||||||
|
const vector pointNormal((p1 - p0) ^ (p2 - p0));
|
||||||
|
if ((pointNormal & p.faceNormals()[faceI]) < 0)
|
||||||
|
{
|
||||||
|
foundError = false;
|
||||||
|
|
||||||
|
if (report)
|
||||||
|
{
|
||||||
|
Info
|
||||||
|
<< "Normal calculated from points inconsistent with faceNormal"
|
||||||
|
<< nl
|
||||||
|
<< "face: " << f << nl
|
||||||
|
<< "points: " << p0 << ' ' << p1 << ' ' << p2 << nl
|
||||||
|
<< "pointNormal:" << pointNormal << nl
|
||||||
|
<< "faceNormal:" << p.faceNormals()[faceI] << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
forAll(p.edges(), edgeI)
|
||||||
|
{
|
||||||
|
const edge& e = p.edges()[edgeI];
|
||||||
|
const labelList& neighbouringFaces = p.edgeFaces()[edgeI];
|
||||||
|
|
||||||
|
if (neighbouringFaces.size() == 2)
|
||||||
|
{
|
||||||
|
// we use localFaces() since edges() are LOCAL
|
||||||
|
// these are both already available
|
||||||
|
const Face& faceA = p.localFaces()[neighbouringFaces[0]];
|
||||||
|
const Face& faceB = p.localFaces()[neighbouringFaces[1]];
|
||||||
|
|
||||||
|
// If the faces are correctly oriented, the edges must go in
|
||||||
|
// different directions on connected faces.
|
||||||
|
if (faceA.edgeDirection(e) == faceB.edgeDirection(e))
|
||||||
|
{
|
||||||
|
if (report)
|
||||||
|
{
|
||||||
|
Info<< "face orientation incorrect." << nl
|
||||||
|
<< "localEdge[" << edgeI << "] " << e
|
||||||
|
<< " between faces:" << nl
|
||||||
|
<< " face[" << neighbouringFaces[0] << "] "
|
||||||
|
<< p[neighbouringFaces[0]]
|
||||||
|
<< " localFace: " << faceA
|
||||||
|
<< nl
|
||||||
|
<< " face[" << neighbouringFaces[1] << "] "
|
||||||
|
<< p[neighbouringFaces[1]]
|
||||||
|
<< " localFace: " << faceB
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
if (setPtr)
|
||||||
|
{
|
||||||
|
setPtr->insert(edgeI);
|
||||||
|
}
|
||||||
|
|
||||||
|
foundError = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (neighbouringFaces.size() != 1)
|
||||||
|
{
|
||||||
|
if (report)
|
||||||
|
{
|
||||||
|
Info
|
||||||
|
<< "Wrong number of edge neighbours." << nl
|
||||||
|
<< "edge[" << edgeI << "] " << e
|
||||||
|
<< " with points:" << p.localPoints()[e.start()]
|
||||||
|
<< ' ' << p.localPoints()[e.end()]
|
||||||
|
<< " has neighbouringFaces:" << neighbouringFaces << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setPtr)
|
||||||
|
{
|
||||||
|
setPtr->insert(edgeI);
|
||||||
|
}
|
||||||
|
|
||||||
|
foundError = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return foundError;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "PrimitivePatchTools.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template
|
||||||
|
<
|
||||||
|
class Face,
|
||||||
|
template<class> class FaceList,
|
||||||
|
class PointField,
|
||||||
|
class PointType
|
||||||
|
>
|
||||||
|
|
||||||
|
Foam::labelList
|
||||||
|
Foam::PatchTools::edgeOwner
|
||||||
|
(
|
||||||
|
const PrimitivePatch<Face, FaceList, PointField, PointType>& p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const edgeList& edges = p.edges();
|
||||||
|
const labelListList& edgeFaces = p.edgeFaces();
|
||||||
|
const List<Face>& localFaces = p.localFaces();
|
||||||
|
|
||||||
|
// create the owner list
|
||||||
|
labelList edgeOwner(edges.size(), -1);
|
||||||
|
|
||||||
|
forAll(edges, edgeI)
|
||||||
|
{
|
||||||
|
const labelList& nbrFaces = edgeFaces[edgeI];
|
||||||
|
|
||||||
|
if (nbrFaces.size() == 1)
|
||||||
|
{
|
||||||
|
edgeOwner[edgeI] = nbrFaces[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Find the first face whose vertices are aligned with the edge.
|
||||||
|
// with multiply connected edges, this is the best we can do
|
||||||
|
forAll(nbrFaces, i)
|
||||||
|
{
|
||||||
|
const Face& f = localFaces[nbrFaces[i]];
|
||||||
|
|
||||||
|
if (f.edgeDirection(edges[edgeI]) > 0)
|
||||||
|
{
|
||||||
|
edgeOwner[edgeI] = nbrFaces[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (edgeOwner[edgeI] == -1)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"PatchTools::edgeOwner()"
|
||||||
|
)
|
||||||
|
<< "Edge " << edgeI << " vertices:" << edges[edgeI]
|
||||||
|
<< " is used by faces " << nbrFaces
|
||||||
|
<< " vertices:"
|
||||||
|
<< IndirectList<Face>(localFaces, nbrFaces)()
|
||||||
|
<< " none of which use the edge vertices in the same order"
|
||||||
|
<< nl << "I give up" << abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return edgeOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -22,35 +22,42 @@ License
|
|||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Description
|
||||||
|
Searching and marking zones of the patch.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "PrimitivePatchExtra.H"
|
#include "PrimitivePatchTools.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Finds area, starting at faceI, delimited by borderEdge. Marks all visited
|
// Finds area, starting at faceI, delimited by borderEdge.
|
||||||
// faces (from face-edge-face walk) with currentZone.
|
// Marks all visited faces (from face-edge-face walk) with currentZone.
|
||||||
template
|
template
|
||||||
<
|
<
|
||||||
|
class BoolListType,
|
||||||
class Face,
|
class Face,
|
||||||
template<class> class FaceList,
|
template<class> class FaceList,
|
||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::markZone
|
|
||||||
|
void
|
||||||
|
Foam::PatchTools::markZone
|
||||||
(
|
(
|
||||||
const UList<bool>& borderEdge,
|
const PrimitivePatch<Face, FaceList, PointField, PointType>& p,
|
||||||
|
const BoolListType& borderEdge,
|
||||||
const label faceI,
|
const label faceI,
|
||||||
const label currentZone,
|
const label currentZone,
|
||||||
labelList& faceZone
|
labelList& faceZone
|
||||||
) const
|
)
|
||||||
{
|
{
|
||||||
|
const labelListList& faceEdges = p.faceEdges();
|
||||||
|
const labelListList& edgeFaces = p.edgeFaces();
|
||||||
|
|
||||||
// List of faces whose faceZone has been set.
|
// List of faces whose faceZone has been set.
|
||||||
labelList changedFaces(1, faceI);
|
labelList changedFaces(1, faceI);
|
||||||
|
|
||||||
const labelListList& faceEs = this->faceEdges();
|
|
||||||
const labelListList& eFaces = this->edgeFaces();
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// Pick up neighbours of changedFaces
|
// Pick up neighbours of changedFaces
|
||||||
@ -60,7 +67,7 @@ void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::markZone
|
|||||||
{
|
{
|
||||||
label faceI = changedFaces[i];
|
label faceI = changedFaces[i];
|
||||||
|
|
||||||
const labelList& fEdges = faceEs[faceI];
|
const labelList& fEdges = faceEdges[faceI];
|
||||||
|
|
||||||
forAll(fEdges, fEdgeI)
|
forAll(fEdges, fEdgeI)
|
||||||
{
|
{
|
||||||
@ -68,7 +75,7 @@ void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::markZone
|
|||||||
|
|
||||||
if (!borderEdge[edgeI])
|
if (!borderEdge[edgeI])
|
||||||
{
|
{
|
||||||
const labelList& eFaceLst = eFaces[edgeI];
|
const labelList& eFaceLst = edgeFaces[edgeI];
|
||||||
|
|
||||||
forAll(eFaceLst, j)
|
forAll(eFaceLst, j)
|
||||||
{
|
{
|
||||||
@ -83,8 +90,8 @@ void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::markZone
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"PrimitivePatchExtra<Face, FaceList, PointField>::markZone"
|
"PatchTools::markZone"
|
||||||
"(const boolList&, const label, const label, labelList&) const"
|
"(const boolList&, const label, const label, labelList&)"
|
||||||
)
|
)
|
||||||
<< "Zones " << faceZone[nbrFaceI]
|
<< "Zones " << faceZone[nbrFaceI]
|
||||||
<< " at face " << nbrFaceI
|
<< " at face " << nbrFaceI
|
||||||
@ -112,60 +119,38 @@ void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::markZone
|
|||||||
// Fills faceZone accordingly
|
// Fills faceZone accordingly
|
||||||
template
|
template
|
||||||
<
|
<
|
||||||
|
class BoolListType,
|
||||||
class Face,
|
class Face,
|
||||||
template<class> class FaceList,
|
template<class> class FaceList,
|
||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
Foam::label Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
|
|
||||||
markZones
|
Foam::label
|
||||||
|
Foam::PatchTools::markZones
|
||||||
(
|
(
|
||||||
const UList<bool>& borderEdge,
|
const PrimitivePatch<Face, FaceList, PointField, PointType>& p,
|
||||||
|
const BoolListType& borderEdge,
|
||||||
labelList& faceZone
|
labelList& faceZone
|
||||||
) const
|
|
||||||
{
|
|
||||||
const label numEdges = this->nEdges();
|
|
||||||
const label numFaces = this->size();
|
|
||||||
|
|
||||||
if (borderEdge.size() != numEdges)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"PrimitivePatchExtra<Face, FaceList, PointField>::markZones"
|
|
||||||
"(const boolList&, labelList&)"
|
|
||||||
)
|
)
|
||||||
<< "borderEdge boolList not same size as number of edges" << endl
|
{
|
||||||
<< "borderEdge:" << borderEdge.size() << endl
|
faceZone.setSize(p.size());
|
||||||
<< "nEdges :" << numEdges
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
faceZone.setSize(numFaces);
|
|
||||||
faceZone = -1;
|
faceZone = -1;
|
||||||
|
|
||||||
label zoneI = 0;
|
label zoneI = 0;
|
||||||
label startFaceI = 0;
|
for (label startFaceI = 0; startFaceI < faceZone.size();)
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
{
|
||||||
// Find first non-visited face
|
// Find next non-visited face
|
||||||
for (; startFaceI < numFaces; startFaceI++)
|
for (; startFaceI < faceZone.size(); ++startFaceI)
|
||||||
{
|
{
|
||||||
if (faceZone[startFaceI] == -1)
|
if (faceZone[startFaceI] == -1)
|
||||||
{
|
{
|
||||||
faceZone[startFaceI] = zoneI;
|
faceZone[startFaceI] = zoneI;
|
||||||
markZone(borderEdge, startFaceI, zoneI, faceZone);
|
markZone(p, borderEdge, startFaceI, zoneI, faceZone);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (startFaceI >= numFaces)
|
|
||||||
{
|
|
||||||
// Finished
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
zoneI++;
|
zoneI++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return zoneI;
|
return zoneI;
|
||||||
@ -177,39 +162,41 @@ markZones
|
|||||||
// Fills faceZone accordingly
|
// Fills faceZone accordingly
|
||||||
template
|
template
|
||||||
<
|
<
|
||||||
|
class BoolListType,
|
||||||
class Face,
|
class Face,
|
||||||
template<class> class FaceList,
|
template<class> class FaceList,
|
||||||
class PointField,
|
class PointField,
|
||||||
class PointType
|
class PointType
|
||||||
>
|
>
|
||||||
void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::
|
|
||||||
subsetMap
|
void
|
||||||
|
Foam::PatchTools::subsetMap
|
||||||
(
|
(
|
||||||
const UList<bool>& include,
|
const PrimitivePatch<Face, FaceList, PointField, PointType>& p,
|
||||||
|
const BoolListType& includeFaces,
|
||||||
labelList& pointMap,
|
labelList& pointMap,
|
||||||
labelList& faceMap
|
labelList& faceMap
|
||||||
) const
|
)
|
||||||
{
|
{
|
||||||
const List<Face>& locFaces = this->localFaces();
|
|
||||||
const label numPoints = this->nPoints();
|
|
||||||
|
|
||||||
label faceI = 0;
|
label faceI = 0;
|
||||||
label pointI = 0;
|
label pointI = 0;
|
||||||
|
|
||||||
faceMap.setSize(locFaces.size());
|
const List<Face>& localFaces = p.localFaces();
|
||||||
pointMap.setSize(numPoints);
|
|
||||||
|
|
||||||
boolList pointHad(numPoints, false);
|
faceMap.setSize(localFaces.size());
|
||||||
|
pointMap.setSize(p.nPoints());
|
||||||
|
|
||||||
forAll(include, oldFaceI)
|
boolList pointHad(pointMap.size(), false);
|
||||||
|
|
||||||
|
forAll(p, oldFaceI)
|
||||||
{
|
{
|
||||||
if (include[oldFaceI])
|
if (includeFaces[oldFaceI])
|
||||||
{
|
{
|
||||||
// Store new faces compact
|
// Store new faces compact
|
||||||
faceMap[faceI++] = oldFaceI;
|
faceMap[faceI++] = oldFaceI;
|
||||||
|
|
||||||
// Renumber labels for face
|
// Renumber labels for face
|
||||||
const Face& f = locFaces[oldFaceI];
|
const Face& f = localFaces[oldFaceI];
|
||||||
|
|
||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
@ -229,6 +216,4 @@ subsetMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,128 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "PrimitivePatchTools.H"
|
||||||
|
#include "SortableList.H"
|
||||||
|
#include "transform.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template
|
||||||
|
<
|
||||||
|
class Face,
|
||||||
|
template<class> class FaceList,
|
||||||
|
class PointField,
|
||||||
|
class PointType
|
||||||
|
>
|
||||||
|
|
||||||
|
Foam::labelListList
|
||||||
|
Foam::PatchTools::sortedEdgeFaces
|
||||||
|
(
|
||||||
|
const PrimitivePatch<Face, FaceList, PointField, PointType>& p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const edgeList& edges = p.edges();
|
||||||
|
const labelListList& edgeFaces = p.edgeFaces();
|
||||||
|
const List<Face>& localFaces = p.localFaces();
|
||||||
|
const Field<PointType>& localPoints = p.localPoints();
|
||||||
|
|
||||||
|
// create the lists for the various results. (resized on completion)
|
||||||
|
labelListList& sortedEdgeFaces = labelListList(edgeFaces.size());
|
||||||
|
|
||||||
|
forAll(edgeFaces, edgeI)
|
||||||
|
{
|
||||||
|
const labelList& faceNbs = edgeFaces[edgeI];
|
||||||
|
|
||||||
|
if (faceNbs.size() > 2)
|
||||||
|
{
|
||||||
|
// Get point on edge and normalized direction of edge (= e2 base
|
||||||
|
// of our coordinate system)
|
||||||
|
const edge& e = edges[edgeI];
|
||||||
|
|
||||||
|
const point& edgePt = localPoints[e.start()];
|
||||||
|
|
||||||
|
vector e2 = e.vec(localPoints);
|
||||||
|
e2 /= mag(e2) + VSMALL;
|
||||||
|
|
||||||
|
// Get opposite vertex for 0th face
|
||||||
|
const Face& f = localFaces[faceNbs[0]];
|
||||||
|
|
||||||
|
label fp0 = findIndex(f, e[0]);
|
||||||
|
label fp1 = f.fcIndex(fp0);
|
||||||
|
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
|
||||||
|
|
||||||
|
// Get vector normal both to e2 and to edge from opposite vertex
|
||||||
|
// to edge (will be x-axis of our coordinate system)
|
||||||
|
vector e0 = e2 ^ (localPoints[vertI] - edgePt);
|
||||||
|
e0 /= mag(e0) + VSMALL;
|
||||||
|
|
||||||
|
// Get y-axis of coordinate system
|
||||||
|
vector e1 = e2 ^ e0;
|
||||||
|
|
||||||
|
SortableList<scalar> faceAngles(faceNbs.size());
|
||||||
|
|
||||||
|
// e0 is reference so angle is 0
|
||||||
|
faceAngles[0] = 0;
|
||||||
|
|
||||||
|
for (label nbI = 1; nbI < faceNbs.size(); nbI++)
|
||||||
|
{
|
||||||
|
// Get opposite vertex
|
||||||
|
const Face& f = localFaces[faceNbs[nbI]];
|
||||||
|
label fp0 = findIndex(f, e[0]);
|
||||||
|
label fp1 = f.fcIndex(fp0);
|
||||||
|
label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1));
|
||||||
|
|
||||||
|
vector vec = e2 ^ (localPoints[vertI] - edgePt);
|
||||||
|
vec /= mag(vec) + VSMALL;
|
||||||
|
|
||||||
|
faceAngles[nbI] = pseudoAngle
|
||||||
|
(
|
||||||
|
e0,
|
||||||
|
e1,
|
||||||
|
vec
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
faceAngles.sort();
|
||||||
|
|
||||||
|
sortedEdgeFaces[edgeI] = IndirectList<label>
|
||||||
|
(
|
||||||
|
faceNbs,
|
||||||
|
faceAngles.indices()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No need to sort. Just copy.
|
||||||
|
sortedEdgeFaces[edgeI] = faceNbs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sortedEdgeFaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -27,6 +27,7 @@ License
|
|||||||
#include "BasicMeshedSurface.H"
|
#include "BasicMeshedSurface.H"
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
#include "mergePoints.H"
|
#include "mergePoints.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
@ -162,7 +163,7 @@ void Foam::BasicMeshedSurface<Face>::cleanup(const bool verbose)
|
|||||||
stitchFaces(SMALL, verbose);
|
stitchFaces(SMALL, verbose);
|
||||||
|
|
||||||
checkFaces(verbose);
|
checkFaces(verbose);
|
||||||
this->checkEdges(verbose);
|
this->checkTopology(verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,8 @@ SourceFiles
|
|||||||
#ifndef BasicMeshedSurface_H
|
#ifndef BasicMeshedSurface_H
|
||||||
#define BasicMeshedSurface_H
|
#define BasicMeshedSurface_H
|
||||||
|
|
||||||
#include "PrimitivePatchExtra.H"
|
#include "PrimitivePatch.H"
|
||||||
|
#include "PrimitivePatchTools.H"
|
||||||
#include "pointField.H"
|
#include "pointField.H"
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
#include "triFace.H"
|
#include "triFace.H"
|
||||||
@ -55,11 +56,11 @@ namespace Foam
|
|||||||
template<class Face>
|
template<class Face>
|
||||||
class BasicMeshedSurface
|
class BasicMeshedSurface
|
||||||
:
|
:
|
||||||
public PrimitivePatchExtra<Face, ::Foam::List, pointField, point>
|
public PrimitivePatch<Face, ::Foam::List, pointField, point>
|
||||||
{
|
{
|
||||||
|
|
||||||
//- Typedefs for convenience
|
//- Typedefs for convenience
|
||||||
typedef PrimitivePatchExtra
|
typedef PrimitivePatch
|
||||||
<
|
<
|
||||||
Face,
|
Face,
|
||||||
::Foam::List,
|
::Foam::List,
|
||||||
@ -83,7 +84,7 @@ protected:
|
|||||||
return static_cast<List<Face> &>(*this);
|
return static_cast<List<Face> &>(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Set new regions/patches from faceMap
|
//- Set new regions from faceMap
|
||||||
virtual void remapFaces(const UList<label>& faceMap);
|
virtual void remapFaces(const UList<label>& faceMap);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
surfGroup/surfGroup.C
|
surfRegion/surfRegion/surfRegion.C
|
||||||
surfGroup/surfGroupIOList.C
|
surfRegion/surfRegion/surfRegionIOList.C
|
||||||
surfPatchIdentifier/surfPatchIdentifier.C
|
surfRegion/surfRegionIdentifier/surfRegionIdentifier.C
|
||||||
|
|
||||||
MeshedSurface/MeshedSurfaces.C
|
MeshedSurface/MeshedSurfaces.C
|
||||||
UnsortedMeshedSurface/UnsortedMeshedSurfaces.C
|
UnsortedMeshedSurface/UnsortedMeshedSurfaces.C
|
||||||
|
|||||||
@ -26,6 +26,7 @@ License
|
|||||||
|
|
||||||
#include "MeshedSurface.H"
|
#include "MeshedSurface.H"
|
||||||
#include "UnsortedMeshedSurface.H"
|
#include "UnsortedMeshedSurface.H"
|
||||||
|
#include "PrimitivePatchTools.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
@ -166,11 +167,11 @@ Foam::MeshedSurface<Face>::MeshedSurface
|
|||||||
(
|
(
|
||||||
const Xfer<pointField>& pointLst,
|
const Xfer<pointField>& pointLst,
|
||||||
const Xfer<List<Face> >& faceLst,
|
const Xfer<List<Face> >& faceLst,
|
||||||
const Xfer<surfGroupList>& patchLst
|
const Xfer<surfRegionList>& regionLst
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ParentType(pointLst, faceLst),
|
ParentType(pointLst, faceLst),
|
||||||
patches_(patchLst)
|
regions_(regionLst)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -179,26 +180,26 @@ Foam::MeshedSurface<Face>::MeshedSurface
|
|||||||
(
|
(
|
||||||
const Xfer<pointField>& pointLst,
|
const Xfer<pointField>& pointLst,
|
||||||
const Xfer<List<Face> >& faceLst,
|
const Xfer<List<Face> >& faceLst,
|
||||||
const UList<label>& patchSizes,
|
const UList<label>& regionSizes,
|
||||||
const UList<word>& patchNames
|
const UList<word>& regionNames
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ParentType(pointLst, faceLst)
|
ParentType(pointLst, faceLst)
|
||||||
{
|
{
|
||||||
if (&patchSizes)
|
if (®ionSizes)
|
||||||
{
|
{
|
||||||
if (&patchNames)
|
if (®ionNames)
|
||||||
{
|
{
|
||||||
addPatches(patchSizes, patchNames);
|
addRegions(regionSizes, regionNames);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addPatches(patchSizes);
|
addRegions(regionSizes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
onePatch();
|
oneRegion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,15 +239,15 @@ Foam::MeshedSurface<Face>::MeshedSurface
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// create patch list
|
// create region list
|
||||||
surfGroupList newPatches(bPatches.size());
|
surfRegionList newRegions(bPatches.size());
|
||||||
|
|
||||||
label startFaceI = 0;
|
label startFaceI = 0;
|
||||||
forAll(bPatches, patchI)
|
forAll(bPatches, patchI)
|
||||||
{
|
{
|
||||||
const polyPatch& p = bPatches[patchI];
|
const polyPatch& p = bPatches[patchI];
|
||||||
|
|
||||||
newPatches[patchI] = surfGroup
|
newRegions[patchI] = surfRegion
|
||||||
(
|
(
|
||||||
p.name(),
|
p.name(),
|
||||||
p.size(),
|
p.size(),
|
||||||
@ -262,7 +263,7 @@ Foam::MeshedSurface<Face>::MeshedSurface
|
|||||||
(
|
(
|
||||||
xferCopy(bPoints),
|
xferCopy(bPoints),
|
||||||
xferCopy(bFaces),
|
xferCopy(bFaces),
|
||||||
xferMove(newPatches)
|
xferMove(newRegions)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -285,7 +286,7 @@ Foam::MeshedSurface<Face>::MeshedSurface
|
|||||||
origFaces.clear();
|
origFaces.clear();
|
||||||
|
|
||||||
this->storedFaces().transfer(newFaces);
|
this->storedFaces().transfer(newFaces);
|
||||||
patches_.transfer(surf.patches_);
|
regions_.transfer(surf.regions_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -305,15 +306,15 @@ Foam::MeshedSurface<Face>::MeshedSurface
|
|||||||
{
|
{
|
||||||
const surfPatchList& sPatches = sMesh.boundaryMesh();
|
const surfPatchList& sPatches = sMesh.boundaryMesh();
|
||||||
|
|
||||||
// create patch list
|
// create regions list
|
||||||
List<surfGroup> newPatches(sPatches.size());
|
List<surfRegion> newRegions(sPatches.size());
|
||||||
|
|
||||||
label startFaceI = 0;
|
label startFaceI = 0;
|
||||||
forAll(sPatches, patchI)
|
forAll(sPatches, patchI)
|
||||||
{
|
{
|
||||||
const surfPatch& p = sPatches[patchI];
|
const surfPatch& p = sPatches[patchI];
|
||||||
|
|
||||||
newPatches[patchI] = surfGroup
|
newRegions[patchI] = surfRegion
|
||||||
(
|
(
|
||||||
p.name(),
|
p.name(),
|
||||||
p.size(),
|
p.size(),
|
||||||
@ -324,7 +325,7 @@ Foam::MeshedSurface<Face>::MeshedSurface
|
|||||||
startFaceI += p.size();
|
startFaceI += p.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
patches_.transfer(newPatches);
|
regions_.transfer(newRegions);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -336,8 +337,8 @@ Foam::MeshedSurface<Face>::MeshedSurface
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
labelList faceMap;
|
labelList faceMap;
|
||||||
surfGroupList patchLst = surf.sortedRegions(faceMap);
|
surfRegionList regionLst = surf.sortedRegions(faceMap);
|
||||||
patches_.transfer(patchLst);
|
regions_.transfer(regionLst);
|
||||||
|
|
||||||
const List<Face>& origFaces = surf.faces();
|
const List<Face>& origFaces = surf.faces();
|
||||||
List<Face> newFaces(origFaces.size());
|
List<Face> newFaces(origFaces.size());
|
||||||
@ -388,7 +389,7 @@ template<class Face>
|
|||||||
Foam::MeshedSurface<Face>::MeshedSurface(const MeshedSurface& surf)
|
Foam::MeshedSurface<Face>::MeshedSurface(const MeshedSurface& surf)
|
||||||
:
|
:
|
||||||
ParentType(surf),
|
ParentType(surf),
|
||||||
patches_(surf.patches_)
|
regions_(surf.regions_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -420,70 +421,70 @@ Foam::MeshedSurface<Face>::~MeshedSurface()
|
|||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
void Foam::MeshedSurface<Face>::onePatch(const word& name)
|
void Foam::MeshedSurface<Face>::oneRegion(const word& name)
|
||||||
{
|
{
|
||||||
word patchName(name);
|
word regionName(name);
|
||||||
if (patchName.empty())
|
if (regionName.empty())
|
||||||
{
|
{
|
||||||
if (patches_.size())
|
if (regions_.size())
|
||||||
{
|
{
|
||||||
patchName = patches_[0].name();
|
regionName = regions_[0].name();
|
||||||
}
|
}
|
||||||
if (patchName.empty())
|
if (regionName.empty())
|
||||||
{
|
{
|
||||||
patchName = "patch0";
|
regionName = "region0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set single default patch
|
// set single default region
|
||||||
patches_.setSize(1);
|
regions_.setSize(1);
|
||||||
patches_[0] = surfGroup
|
regions_[0] = surfRegion
|
||||||
(
|
(
|
||||||
patchName,
|
regionName,
|
||||||
size(), // patch size
|
size(), // region size
|
||||||
0, // patch start
|
0, // region start
|
||||||
0 // patch index
|
0 // region index
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
void Foam::MeshedSurface<Face>::checkPatches()
|
void Foam::MeshedSurface<Face>::checkRegions()
|
||||||
{
|
{
|
||||||
// extra safety, ensure we have at some patches,
|
// extra safety, ensure we have at some regions
|
||||||
// and they cover all the faces - fix start silently
|
// and they cover all the faces - fix start silently
|
||||||
if (patches_.size() <= 1)
|
if (regions_.size() <= 1)
|
||||||
{
|
{
|
||||||
onePatch();
|
oneRegion();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
label count = 0;
|
label count = 0;
|
||||||
forAll(patches_, patchI)
|
forAll(regions_, regionI)
|
||||||
{
|
{
|
||||||
patches_[patchI].start() = count;
|
regions_[regionI].start() = count;
|
||||||
count += patches_[patchI].size();
|
count += regions_[regionI].size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count < size())
|
if (count < size())
|
||||||
{
|
{
|
||||||
WarningIn
|
WarningIn
|
||||||
(
|
(
|
||||||
"MeshedSurface::checkPatches()\n"
|
"MeshedSurface::checkRegions()\n"
|
||||||
)
|
)
|
||||||
<< "more face " << size() << " than patches " << count
|
<< "more face " << size() << " than regions " << count
|
||||||
<< " ... extending final patch"
|
<< " ... extending final region"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
patches_[patches_.size()-1].size() += count - size();
|
regions_[regions_.size()-1].size() += count - size();
|
||||||
}
|
}
|
||||||
else if (count > size())
|
else if (count > size())
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"MeshedSurface::checkPatches()\n"
|
"MeshedSurface::checkRegions()\n"
|
||||||
)
|
)
|
||||||
<< "more patches " << count << " than faces " << size()
|
<< "more regions " << count << " than faces " << size()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -534,33 +535,33 @@ void Foam::MeshedSurface<Face>::remapFaces
|
|||||||
const UList<label>& faceMap
|
const UList<label>& faceMap
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// recalculate the patch start/size
|
// recalculate the region start/size
|
||||||
if (&faceMap && faceMap.size())
|
if (&faceMap && faceMap.size())
|
||||||
{
|
{
|
||||||
if (patches_.empty())
|
if (regions_.empty())
|
||||||
{
|
{
|
||||||
onePatch();
|
oneRegion();
|
||||||
}
|
}
|
||||||
else if (patches_.size() == 1)
|
else if (regions_.size() == 1)
|
||||||
{
|
{
|
||||||
// optimized for one-patch case
|
// optimized for single region case
|
||||||
patches_[0].size() = faceMap.size();
|
regions_[0].size() = faceMap.size();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
label newFaceI = 0;
|
label newFaceI = 0;
|
||||||
label oldPatchEnd = 0;
|
label origEndI = 0;
|
||||||
forAll(patches_, patchI)
|
forAll(regions_, regionI)
|
||||||
{
|
{
|
||||||
surfGroup& p = patches_[patchI];
|
surfRegion& reg = regions_[regionI];
|
||||||
|
|
||||||
// adjust patch start
|
// adjust region start
|
||||||
p.start() = newFaceI;
|
reg.start() = newFaceI;
|
||||||
oldPatchEnd += p.size();
|
origEndI += reg.size();
|
||||||
|
|
||||||
for (label faceI = newFaceI; faceI < faceMap.size(); ++faceI)
|
for (label faceI = newFaceI; faceI < faceMap.size(); ++faceI)
|
||||||
{
|
{
|
||||||
if (faceMap[faceI] < oldPatchEnd)
|
if (faceMap[faceI] < origEndI)
|
||||||
{
|
{
|
||||||
++newFaceI;
|
++newFaceI;
|
||||||
}
|
}
|
||||||
@ -570,8 +571,8 @@ void Foam::MeshedSurface<Face>::remapFaces
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust patch size
|
// adjust region size
|
||||||
p.size() = newFaceI - p.start();
|
reg.size() = newFaceI - reg.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -586,14 +587,14 @@ template<class Face>
|
|||||||
void Foam::MeshedSurface<Face>::clear()
|
void Foam::MeshedSurface<Face>::clear()
|
||||||
{
|
{
|
||||||
ParentType::clear();
|
ParentType::clear();
|
||||||
patches_.clear();
|
regions_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::MeshedSurface<Face> Foam::MeshedSurface<Face>::subsetMesh
|
Foam::MeshedSurface<Face> Foam::MeshedSurface<Face>::subsetMesh
|
||||||
(
|
(
|
||||||
const UList<bool>& include,
|
const labelHashSet& include,
|
||||||
labelList& pointMap,
|
labelList& pointMap,
|
||||||
labelList& faceMap
|
labelList& faceMap
|
||||||
) const
|
) const
|
||||||
@ -603,7 +604,7 @@ Foam::MeshedSurface<Face> Foam::MeshedSurface<Face>::subsetMesh
|
|||||||
|
|
||||||
|
|
||||||
// Fill pointMap, faceMap
|
// Fill pointMap, faceMap
|
||||||
this->subsetMap(include, pointMap, faceMap);
|
PatchTools::subsetMap(*this, include, pointMap, faceMap);
|
||||||
|
|
||||||
// Create compact coordinate list and forward mapping array
|
// Create compact coordinate list and forward mapping array
|
||||||
pointField newPoints(pointMap.size());
|
pointField newPoints(pointMap.size());
|
||||||
@ -614,11 +615,11 @@ Foam::MeshedSurface<Face> Foam::MeshedSurface<Face>::subsetMesh
|
|||||||
oldToNew[pointMap[pointI]] = pointI;
|
oldToNew[pointMap[pointI]] = pointI;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create/copy a new patch list, each patch with zero size
|
// create/copy a new region list, each region with zero size
|
||||||
surfGroupList newPatches(patches_);
|
surfRegionList newRegions(regions_);
|
||||||
forAll(newPatches, patchI)
|
forAll(newRegions, regionI)
|
||||||
{
|
{
|
||||||
newPatches[patchI].size() = 0;
|
newRegions[regionI].size() = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Renumber face node labels
|
// Renumber face node labels
|
||||||
@ -637,22 +638,22 @@ Foam::MeshedSurface<Face> Foam::MeshedSurface<Face>::subsetMesh
|
|||||||
}
|
}
|
||||||
oldToNew.clear();
|
oldToNew.clear();
|
||||||
|
|
||||||
// recalculate the patch start/size
|
// recalculate the region start/size
|
||||||
label newFaceI = 0;
|
label newFaceI = 0;
|
||||||
label oldPatchEnd = 0;
|
label origEndI = 0;
|
||||||
|
|
||||||
// adjust patch sizes
|
// adjust region sizes
|
||||||
forAll(newPatches, patchI)
|
forAll(newRegions, regionI)
|
||||||
{
|
{
|
||||||
surfGroup& p = newPatches[patchI];
|
surfRegion& reg = newRegions[regionI];
|
||||||
|
|
||||||
// adjust patch start
|
// adjust region start
|
||||||
p.start() = newFaceI;
|
reg.start() = newFaceI;
|
||||||
oldPatchEnd += p.size();
|
origEndI += reg.size();
|
||||||
|
|
||||||
for (label faceI = newFaceI; faceI < faceMap.size(); ++faceI)
|
for (label faceI = newFaceI; faceI < faceMap.size(); ++faceI)
|
||||||
{
|
{
|
||||||
if (faceMap[faceI] < oldPatchEnd)
|
if (faceMap[faceI] < origEndI)
|
||||||
{
|
{
|
||||||
++newFaceI;
|
++newFaceI;
|
||||||
}
|
}
|
||||||
@ -662,8 +663,8 @@ Foam::MeshedSurface<Face> Foam::MeshedSurface<Face>::subsetMesh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust patch size
|
// adjust region size
|
||||||
p.size() = newFaceI - p.start();
|
reg.size() = newFaceI - reg.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -672,15 +673,16 @@ Foam::MeshedSurface<Face> Foam::MeshedSurface<Face>::subsetMesh
|
|||||||
(
|
(
|
||||||
xferMove(newPoints),
|
xferMove(newPoints),
|
||||||
xferMove(newFaces),
|
xferMove(newFaces),
|
||||||
xferMove(newPatches)
|
xferMove(newRegions)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::MeshedSurface<Face> Foam::MeshedSurface<Face>::subsetMesh
|
Foam::MeshedSurface<Face>
|
||||||
|
Foam::MeshedSurface<Face>::subsetMesh
|
||||||
(
|
(
|
||||||
const UList<bool>& include
|
const labelHashSet& include
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
labelList pointMap, faceMap;
|
labelList pointMap, faceMap;
|
||||||
@ -689,29 +691,29 @@ Foam::MeshedSurface<Face> Foam::MeshedSurface<Face>::subsetMesh
|
|||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
void Foam::MeshedSurface<Face>::addPatches
|
void Foam::MeshedSurface<Face>::addRegions
|
||||||
(
|
(
|
||||||
const UList<surfGroup>& patches,
|
const UList<surfRegion>& regions,
|
||||||
const bool cullEmpty
|
const bool cullEmpty
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
label nPatch = 0;
|
label nRegion = 0;
|
||||||
|
|
||||||
patches_.setSize(patches.size());
|
regions_.setSize(regions.size());
|
||||||
forAll(patches_, patchI)
|
forAll(regions_, regionI)
|
||||||
{
|
{
|
||||||
if (patches[patchI].size() || !cullEmpty)
|
if (regions[regionI].size() || !cullEmpty)
|
||||||
{
|
{
|
||||||
patches_[nPatch] = surfGroup(patches[patchI], nPatch);
|
regions_[nRegion] = surfRegion(regions[regionI], nRegion);
|
||||||
nPatch++;
|
nRegion++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
patches_.setSize(nPatch);
|
regions_.setSize(nRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
void Foam::MeshedSurface<Face>::addPatches
|
void Foam::MeshedSurface<Face>::addRegions
|
||||||
(
|
(
|
||||||
const UList<label>& sizes,
|
const UList<label>& sizes,
|
||||||
const UList<word>& names,
|
const UList<word>& names,
|
||||||
@ -719,55 +721,55 @@ void Foam::MeshedSurface<Face>::addPatches
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
label start = 0;
|
label start = 0;
|
||||||
label nPatch = 0;
|
label nRegion = 0;
|
||||||
|
|
||||||
patches_.setSize(sizes.size());
|
regions_.setSize(sizes.size());
|
||||||
forAll(patches_, patchI)
|
forAll(regions_, regionI)
|
||||||
{
|
{
|
||||||
if (sizes[patchI] || !cullEmpty)
|
if (sizes[regionI] || !cullEmpty)
|
||||||
{
|
{
|
||||||
patches_[nPatch] = surfGroup
|
regions_[nRegion] = surfRegion
|
||||||
(
|
(
|
||||||
names[patchI],
|
names[regionI],
|
||||||
sizes[patchI],
|
sizes[regionI],
|
||||||
start,
|
start,
|
||||||
nPatch
|
nRegion
|
||||||
);
|
);
|
||||||
start += sizes[patchI];
|
start += sizes[regionI];
|
||||||
nPatch++;
|
nRegion++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
patches_.setSize(nPatch);
|
regions_.setSize(nRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
void Foam::MeshedSurface<Face>::addPatches
|
void Foam::MeshedSurface<Face>::addRegions
|
||||||
(
|
(
|
||||||
const UList<label>& sizes,
|
const UList<label>& sizes,
|
||||||
const bool cullEmpty
|
const bool cullEmpty
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
label start = 0;
|
label start = 0;
|
||||||
label nPatch = 0;
|
label nRegion = 0;
|
||||||
|
|
||||||
patches_.setSize(sizes.size());
|
regions_.setSize(sizes.size());
|
||||||
forAll(patches_, patchI)
|
forAll(regions_, regionI)
|
||||||
{
|
{
|
||||||
if (sizes[patchI] || !cullEmpty)
|
if (sizes[regionI] || !cullEmpty)
|
||||||
{
|
{
|
||||||
patches_[nPatch] = surfGroup
|
regions_[nRegion] = surfRegion
|
||||||
(
|
(
|
||||||
word("patch") + ::Foam::name(nPatch),
|
word("region") + ::Foam::name(nRegion),
|
||||||
sizes[patchI],
|
sizes[regionI],
|
||||||
start,
|
start,
|
||||||
nPatch
|
nRegion
|
||||||
);
|
);
|
||||||
start += sizes[patchI];
|
start += sizes[regionI];
|
||||||
nPatch++;
|
nRegion++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
patches_.setSize(nPatch);
|
regions_.setSize(nRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -778,7 +780,7 @@ void Foam::MeshedSurface<Face>::transfer
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
reset(xferMove(surf.storedPoints()), xferMove(surf.storedFaces()));
|
reset(xferMove(surf.storedPoints()), xferMove(surf.storedFaces()));
|
||||||
patches_.transfer(surf.patches_);
|
regions_.transfer(surf.regions_);
|
||||||
|
|
||||||
surf.clear();
|
surf.clear();
|
||||||
}
|
}
|
||||||
@ -793,7 +795,7 @@ void Foam::MeshedSurface<Face>::transfer
|
|||||||
clear();
|
clear();
|
||||||
|
|
||||||
labelList faceMap;
|
labelList faceMap;
|
||||||
surfGroupList patchLst = surf.sortedRegions(faceMap);
|
surfRegionList regionLst = surf.sortedRegions(faceMap);
|
||||||
List<Face>& oldFaces = surf.storedFaces();
|
List<Face>& oldFaces = surf.storedFaces();
|
||||||
|
|
||||||
List<Face> newFaces(faceMap.size());
|
List<Face> newFaces(faceMap.size());
|
||||||
@ -804,7 +806,7 @@ void Foam::MeshedSurface<Face>::transfer
|
|||||||
faceMap.clear();
|
faceMap.clear();
|
||||||
|
|
||||||
reset(xferMove(surf.storedPoints()), xferMove(newFaces));
|
reset(xferMove(surf.storedPoints()), xferMove(newFaces));
|
||||||
patches_.transfer(patchLst);
|
regions_.transfer(regionLst);
|
||||||
|
|
||||||
surf.clear();
|
surf.clear();
|
||||||
}
|
}
|
||||||
@ -864,7 +866,7 @@ void Foam::MeshedSurface<Face>::operator=(const MeshedSurface& surf)
|
|||||||
|
|
||||||
this->storedPoints() = surf.points();
|
this->storedPoints() = surf.points();
|
||||||
this->storedFaces() = surf.faces();
|
this->storedFaces() = surf.faces();
|
||||||
patches_ = surf.patches_;
|
regions_ = surf.regions_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -26,13 +26,13 @@ Class
|
|||||||
Foam::MeshedSurface
|
Foam::MeshedSurface
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A surface geometry mesh with patch information, not to be confused
|
A surface geometry mesh with region information, not to be confused
|
||||||
with a similarily named surfaceMesh, which actually refers to
|
with a similarily named surfaceMesh, which actually refers to
|
||||||
the cell faces of a volume mesh.
|
the cell faces of a volume mesh.
|
||||||
|
|
||||||
The MeshedSurface is intended to surfaces from a variety of sources.
|
The MeshedSurface is intended to surfaces from a variety of sources.
|
||||||
- A set of points and faces without any patch information.
|
- A set of points and faces without any region information.
|
||||||
- A set of points and faces with randomly sorted patch information.
|
- A set of points and faces with randomly sorted region information.
|
||||||
This could arise, for example, from reading external file formats
|
This could arise, for example, from reading external file formats
|
||||||
such as STL, etc.
|
such as STL, etc.
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ SourceFiles
|
|||||||
#define MeshedSurface_H
|
#define MeshedSurface_H
|
||||||
|
|
||||||
#include "BasicMeshedSurface.H"
|
#include "BasicMeshedSurface.H"
|
||||||
#include "surfGroupList.H"
|
#include "surfRegionList.H"
|
||||||
#include "surfaceFormatsCore.H"
|
#include "surfaceFormatsCore.H"
|
||||||
#include "runTimeSelectionTables.H"
|
#include "runTimeSelectionTables.H"
|
||||||
#include "memberFunctionSelectionTables.H"
|
#include "memberFunctionSelectionTables.H"
|
||||||
@ -88,9 +88,9 @@ private:
|
|||||||
|
|
||||||
// Private Member Data
|
// Private Member Data
|
||||||
|
|
||||||
//- Patch information (face ordering nFaces/startFace only used
|
//- Region information
|
||||||
// during reading and writing)
|
// (face ordering nFaces/startFace only used during reading/writing)
|
||||||
List<surfGroup> patches_;
|
List<surfRegion> regions_;
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
|
|
||||||
@ -101,8 +101,8 @@ protected:
|
|||||||
|
|
||||||
// Protected Member functions
|
// Protected Member functions
|
||||||
|
|
||||||
//- basic sanity check on patches
|
//- basic sanity check on regions
|
||||||
void checkPatches();
|
void checkRegions();
|
||||||
|
|
||||||
//- sort faces by regions and store sorted faces
|
//- sort faces by regions and store sorted faces
|
||||||
void sortFacesAndStore
|
void sortFacesAndStore
|
||||||
@ -139,22 +139,22 @@ public:
|
|||||||
//- Construct null
|
//- Construct null
|
||||||
MeshedSurface();
|
MeshedSurface();
|
||||||
|
|
||||||
//- Construct by transferring components (points, faces, patches).
|
//- Construct by transferring components (points, faces, regions).
|
||||||
MeshedSurface
|
MeshedSurface
|
||||||
(
|
(
|
||||||
const Xfer<pointField>&,
|
const Xfer<pointField>&,
|
||||||
const Xfer<List<Face> >&,
|
const Xfer<List<Face> >&,
|
||||||
const Xfer<surfGroupList>&
|
const Xfer<surfRegionList>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct by transferring points, faces.
|
//- Construct by transferring points, faces.
|
||||||
// Use patch information, or set single default patch.
|
// Use region information, or set single default region.
|
||||||
MeshedSurface
|
MeshedSurface
|
||||||
(
|
(
|
||||||
const Xfer<pointField>&,
|
const Xfer<pointField>&,
|
||||||
const Xfer<List<Face> >&,
|
const Xfer<List<Face> >&,
|
||||||
const UList<label>& patchSizes = UList<label>::null(),
|
const UList<label>& regionSizes = UList<label>::null(),
|
||||||
const UList<word>& patchNames = UList<word>::null()
|
const UList<word>& regionNames = UList<word>::null()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from a boundary mesh with local points/faces
|
//- Construct from a boundary mesh with local points/faces
|
||||||
@ -250,31 +250,31 @@ public:
|
|||||||
return ParentType::size();
|
return ParentType::size();
|
||||||
}
|
}
|
||||||
|
|
||||||
const List<surfGroup>& patches() const
|
const List<surfRegion>& regions() const
|
||||||
{
|
{
|
||||||
return patches_;
|
return regions_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- set a single patch, optionally with a specific name
|
//- set a single region, optionally with a specific name
|
||||||
void onePatch(const word& name = word::null);
|
void oneRegion(const word& name = word::null);
|
||||||
|
|
||||||
//- add patches
|
//- Add regions
|
||||||
void addPatches
|
void addRegions
|
||||||
(
|
(
|
||||||
const UList<surfGroup>&,
|
const UList<surfRegion>&,
|
||||||
const bool cullEmpty=false
|
const bool cullEmpty=false
|
||||||
);
|
);
|
||||||
|
|
||||||
//- add patches
|
//- Add regions
|
||||||
void addPatches
|
void addRegions
|
||||||
(
|
(
|
||||||
const UList<label>& sizes,
|
const UList<label>& sizes,
|
||||||
const UList<word>& names,
|
const UList<word>& names,
|
||||||
const bool cullEmpty=false
|
const bool cullEmpty=false
|
||||||
);
|
);
|
||||||
|
|
||||||
//- add patches
|
//- Add regions
|
||||||
void addPatches
|
void addRegions
|
||||||
(
|
(
|
||||||
const UList<label>& sizes,
|
const UList<label>& sizes,
|
||||||
const bool cullEmpty=false
|
const bool cullEmpty=false
|
||||||
@ -289,7 +289,7 @@ public:
|
|||||||
// Returns return pointMap, faceMap from subsetMeshMap
|
// Returns return pointMap, faceMap from subsetMeshMap
|
||||||
MeshedSurface subsetMesh
|
MeshedSurface subsetMesh
|
||||||
(
|
(
|
||||||
const UList<bool>& include,
|
const labelHashSet& include,
|
||||||
labelList& pointMap,
|
labelList& pointMap,
|
||||||
labelList& faceMap
|
labelList& faceMap
|
||||||
) const;
|
) const;
|
||||||
@ -297,7 +297,7 @@ public:
|
|||||||
//- Return new surface.
|
//- Return new surface.
|
||||||
MeshedSurface subsetMesh
|
MeshedSurface subsetMesh
|
||||||
(
|
(
|
||||||
const UList<bool>& include
|
const labelHashSet& include
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Transfer the contents of the argument and annull the argument
|
//- Transfer the contents of the argument and annull the argument
|
||||||
|
|||||||
@ -37,16 +37,16 @@ bool Foam::MeshedSurface<Face>::read(Istream& is)
|
|||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
List<surfGroup> patchLst(is);
|
List<surfRegion> regionLst(is);
|
||||||
|
|
||||||
// copy and set the indices
|
// copy and set the indices
|
||||||
patches_.setSize(patchLst.size());
|
regions_.setSize(regionLst.size());
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
patches_[patchI] = surfGroup
|
regions_[regionI] = surfRegion
|
||||||
(
|
(
|
||||||
patchLst[patchI],
|
regionLst[regionI],
|
||||||
patchI
|
regionI
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,11 +64,11 @@ bool Foam::MeshedSurface<Face>::read(Istream& is)
|
|||||||
Xfer<pointField>::null(),
|
Xfer<pointField>::null(),
|
||||||
faceLst.xfer()
|
faceLst.xfer()
|
||||||
);
|
);
|
||||||
surf.addPatches(patches_);
|
surf.addRegions(regions_);
|
||||||
|
|
||||||
// this will break if the triangulation needed points
|
// this will break if the triangulation needed points
|
||||||
surf.triangulate();
|
surf.triangulate();
|
||||||
patches_ = surf.patches();
|
regions_ = surf.regions();
|
||||||
|
|
||||||
// transcribe from face -> triFace (Face)
|
// transcribe from face -> triFace (Face)
|
||||||
const List<face>& origFaces = surf.faces();
|
const List<face>& origFaces = surf.faces();
|
||||||
@ -102,11 +102,11 @@ void Foam::MeshedSurface<Face>::write(Ostream& os) const
|
|||||||
os << "// OpenFOAM Surface Format" << nl
|
os << "// OpenFOAM Surface Format" << nl
|
||||||
<< "// ~~~~~~~~~~~~~~~~~~~~~~~" << nl
|
<< "// ~~~~~~~~~~~~~~~~~~~~~~~" << nl
|
||||||
<< "// regions:" << nl
|
<< "// regions:" << nl
|
||||||
<< patches_.size() << nl << token::BEGIN_LIST << incrIndent << nl;
|
<< regions_.size() << nl << token::BEGIN_LIST << incrIndent << nl;
|
||||||
|
|
||||||
forAll(patches_, patchI)
|
forAll(regions_, regionI)
|
||||||
{
|
{
|
||||||
patches_[patchI].writeDict(os);
|
regions_[regionI].writeDict(os);
|
||||||
}
|
}
|
||||||
os << decrIndent << token::END_LIST << nl;
|
os << decrIndent << token::END_LIST << nl;
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ License
|
|||||||
|
|
||||||
#include "MeshedSurface.H"
|
#include "MeshedSurface.H"
|
||||||
#include "UnsortedMeshedSurface.H"
|
#include "UnsortedMeshedSurface.H"
|
||||||
|
#include "PrimitivePatchTools.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
@ -164,12 +165,12 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
|||||||
const Xfer<pointField>& pointLst,
|
const Xfer<pointField>& pointLst,
|
||||||
const Xfer<List<Face> >& faceLst,
|
const Xfer<List<Face> >& faceLst,
|
||||||
const Xfer<List<label> >& regionIds,
|
const Xfer<List<label> >& regionIds,
|
||||||
const Xfer<surfPatchIdentifierList>& patchLst
|
const Xfer<surfRegionIdentifierList>& regionTofc
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ParentType(pointLst, faceLst),
|
ParentType(pointLst, faceLst),
|
||||||
regions_(regionIds),
|
regionIds_(regionIds),
|
||||||
patches_(patchLst)
|
regionToc_(regionTofc)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -178,26 +179,26 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
|||||||
(
|
(
|
||||||
const Xfer<pointField>& pointLst,
|
const Xfer<pointField>& pointLst,
|
||||||
const Xfer<List<Face> >& faceLst,
|
const Xfer<List<Face> >& faceLst,
|
||||||
const UList<label>& patchSizes,
|
const UList<label>& regionSizes,
|
||||||
const UList<word>& patchNames
|
const UList<word>& regionNames
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ParentType(pointLst, faceLst)
|
ParentType(pointLst, faceLst)
|
||||||
{
|
{
|
||||||
if (&patchSizes)
|
if (®ionSizes)
|
||||||
{
|
{
|
||||||
if (&patchNames)
|
if (®ionNames)
|
||||||
{
|
{
|
||||||
setPatches(patchSizes, patchNames);
|
setRegions(regionSizes, regionNames);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setPatches(patchSizes);
|
setRegions(regionSizes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
onePatch();
|
oneRegion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +224,7 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
|||||||
:
|
:
|
||||||
ParentType(xferCopy(surf.points()), xferCopy(surf.faces()))
|
ParentType(xferCopy(surf.points()), xferCopy(surf.faces()))
|
||||||
{
|
{
|
||||||
setPatches(surf.patches());
|
setRegions(surf.regions());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -266,8 +267,8 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
ParentType(xferCopy(surf.points()), xferCopy(surf.faces())),
|
ParentType(xferCopy(surf.points()), xferCopy(surf.faces())),
|
||||||
regions_(surf.regions_),
|
regionIds_(surf.regionIds_),
|
||||||
patches_(surf.patches_)
|
regionToc_(surf.regionToc_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -296,101 +297,105 @@ template<class Face>
|
|||||||
Foam::UnsortedMeshedSurface<Face>::~UnsortedMeshedSurface()
|
Foam::UnsortedMeshedSurface<Face>::~UnsortedMeshedSurface()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
void Foam::UnsortedMeshedSurface<Face>::onePatch(const word& name)
|
void Foam::UnsortedMeshedSurface<Face>::oneRegion(const word& name)
|
||||||
{
|
{
|
||||||
regions_.setSize(size());
|
regionIds_.setSize(size());
|
||||||
regions_ = 0;
|
regionIds_ = 0;
|
||||||
|
|
||||||
word patchName(name);
|
word regionName(name);
|
||||||
if (patchName.empty())
|
if (regionName.empty())
|
||||||
{
|
{
|
||||||
if (patches_.size())
|
if (regionToc_.size())
|
||||||
{
|
{
|
||||||
patchName = patches_[0].name();
|
regionName = regionToc_[0].name();
|
||||||
}
|
}
|
||||||
if (patchName.empty())
|
if (regionName.empty())
|
||||||
{
|
{
|
||||||
patchName = "patch0";
|
regionName = "region0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set single default patch
|
// set single default region
|
||||||
patches_.setSize(1);
|
regionToc_.setSize(1);
|
||||||
patches_[0] = surfPatchIdentifier(patchName, 0);
|
regionToc_[0] = surfRegionIdentifier(regionName, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
void Foam::UnsortedMeshedSurface<Face>::setPatches
|
void Foam::UnsortedMeshedSurface<Face>::setRegions
|
||||||
(
|
(
|
||||||
const surfGroupList& patches
|
const surfRegionList& regionLst
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
regions_.setSize(size());
|
regionIds_.setSize(size());
|
||||||
patches_.setSize(patches.size());
|
regionToc_.setSize(regionLst.size());
|
||||||
|
|
||||||
forAll(patches, patchI)
|
forAll(regionToc_, regionI)
|
||||||
{
|
{
|
||||||
const surfGroup& p = patches[patchI];
|
const surfRegion& reg = regionLst[regionI];
|
||||||
|
|
||||||
patches_[patchI] = p;
|
regionToc_[regionI] = reg;
|
||||||
|
|
||||||
SubList<label> subRegion(regions_, p.size(), p.start());
|
// assign sub-region Ids
|
||||||
subRegion = patchI;
|
SubList<label> subRegion(regionIds_, reg.size(), reg.start());
|
||||||
|
subRegion = regionI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
void Foam::UnsortedMeshedSurface<Face>::setPatches
|
void Foam::UnsortedMeshedSurface<Face>::setRegions
|
||||||
(
|
(
|
||||||
const UList<label>& sizes,
|
const UList<label>& sizes,
|
||||||
const UList<word>& names
|
const UList<word>& names
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
regions_.setSize(size());
|
regionIds_.setSize(size());
|
||||||
patches_.setSize(sizes.size());
|
regionToc_.setSize(sizes.size());
|
||||||
|
|
||||||
label start = 0;
|
label start = 0;
|
||||||
forAll(patches_, patchI)
|
forAll(regionToc_, regionI)
|
||||||
{
|
{
|
||||||
patches_[patchI] = surfPatchIdentifier(names[patchI], patchI);
|
regionToc_[regionI] = surfRegionIdentifier(names[regionI], regionI);
|
||||||
|
|
||||||
SubList<label> subRegion(regions_, sizes[patchI], start);
|
// assign sub-region Ids
|
||||||
subRegion = patchI;
|
SubList<label> subRegion(regionIds_, sizes[regionI], start);
|
||||||
|
subRegion = regionI;
|
||||||
|
|
||||||
start += sizes[patchI];
|
start += sizes[regionI];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
void Foam::UnsortedMeshedSurface<Face>::setPatches
|
void Foam::UnsortedMeshedSurface<Face>::setRegions
|
||||||
(
|
(
|
||||||
const UList<label>& sizes
|
const UList<label>& sizes
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
regions_.setSize(size());
|
regionIds_.setSize(size());
|
||||||
patches_.setSize(sizes.size());
|
regionToc_.setSize(sizes.size());
|
||||||
|
|
||||||
label start = 0;
|
label start = 0;
|
||||||
forAll(patches_, patchI)
|
forAll(regionToc_, regionI)
|
||||||
{
|
{
|
||||||
patches_[patchI] = surfPatchIdentifier
|
regionToc_[regionI] = surfRegionIdentifier
|
||||||
(
|
(
|
||||||
word("patch") + ::Foam::name(patchI),
|
word("region") + ::Foam::name(regionI),
|
||||||
patchI
|
regionI
|
||||||
);
|
);
|
||||||
|
|
||||||
SubList<label> subRegion(regions_, sizes[patchI], start);
|
// assign sub-region Ids
|
||||||
subRegion = patchI;
|
SubList<label> subRegion(regionIds_, sizes[regionI], start);
|
||||||
|
subRegion = regionI;
|
||||||
|
|
||||||
start += sizes[patchI];
|
start += sizes[regionI];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,14 +409,14 @@ void Foam::UnsortedMeshedSurface<Face>::remapFaces
|
|||||||
// re-assign the region Ids
|
// re-assign the region Ids
|
||||||
if (&faceMap && faceMap.size())
|
if (&faceMap && faceMap.size())
|
||||||
{
|
{
|
||||||
if (patches_.empty())
|
if (regionToc_.empty())
|
||||||
{
|
{
|
||||||
onePatch();
|
oneRegion();
|
||||||
}
|
}
|
||||||
else if (patches_.size() == 1)
|
else if (regionToc_.size() == 1)
|
||||||
{
|
{
|
||||||
// optimized for one-patch case
|
// optimized for single-region case
|
||||||
regions_ = 0;
|
regionIds_ = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -419,9 +424,9 @@ void Foam::UnsortedMeshedSurface<Face>::remapFaces
|
|||||||
|
|
||||||
forAll(faceMap, faceI)
|
forAll(faceMap, faceI)
|
||||||
{
|
{
|
||||||
newRegions[faceI] = regions_[faceMap[faceI]];
|
newRegions[faceI] = regionIds_[faceMap[faceI]];
|
||||||
}
|
}
|
||||||
regions_.transfer(newRegions);
|
regionIds_.transfer(newRegions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -433,8 +438,8 @@ template<class Face>
|
|||||||
void Foam::UnsortedMeshedSurface<Face>::setSize(const label s)
|
void Foam::UnsortedMeshedSurface<Face>::setSize(const label s)
|
||||||
{
|
{
|
||||||
ParentType::setSize(s);
|
ParentType::setSize(s);
|
||||||
// if regions extend: set with last patchId
|
// if regions extend: set with last regionId
|
||||||
regions_.setSize(s, patches_.size() - 1);
|
regionIds_.setSize(s, regionToc_.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -442,32 +447,32 @@ template<class Face>
|
|||||||
void Foam::UnsortedMeshedSurface<Face>::clear()
|
void Foam::UnsortedMeshedSurface<Face>::clear()
|
||||||
{
|
{
|
||||||
ParentType::clear();
|
ParentType::clear();
|
||||||
regions_.clear();
|
regionIds_.clear();
|
||||||
patches_.clear();
|
regionToc_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::surfGroupList Foam::UnsortedMeshedSurface<Face>::sortedRegions
|
Foam::surfRegionList Foam::UnsortedMeshedSurface<Face>::sortedRegions
|
||||||
(
|
(
|
||||||
labelList& faceMap
|
labelList& faceMap
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// supply some patch names
|
// supply some region names
|
||||||
Map<word> patchNames;
|
Map<word> regionNames;
|
||||||
forAll(patches_, patchI)
|
forAll(regionToc_, regionI)
|
||||||
{
|
{
|
||||||
patchNames.insert(patchI, patches_[patchI].name());
|
regionNames.insert(regionI, regionToc_[regionI].name());
|
||||||
}
|
}
|
||||||
|
|
||||||
return sortedPatchRegions(regions_, patchNames, faceMap);
|
return sortedRegionsById(regionIds_, regionNames, faceMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::UnsortedMeshedSurface<Face> Foam::UnsortedMeshedSurface<Face>::subsetMesh
|
Foam::UnsortedMeshedSurface<Face> Foam::UnsortedMeshedSurface<Face>::subsetMesh
|
||||||
(
|
(
|
||||||
const UList<bool>& include,
|
const labelHashSet& include,
|
||||||
labelList& pointMap,
|
labelList& pointMap,
|
||||||
labelList& faceMap
|
labelList& faceMap
|
||||||
) const
|
) const
|
||||||
@ -476,7 +481,7 @@ Foam::UnsortedMeshedSurface<Face> Foam::UnsortedMeshedSurface<Face>::subsetMesh
|
|||||||
const List<Face>& locFaces = this->localFaces();
|
const List<Face>& locFaces = this->localFaces();
|
||||||
|
|
||||||
// Fill pointMap, faceMap
|
// Fill pointMap, faceMap
|
||||||
this->subsetMap(include, pointMap, faceMap);
|
PatchTools::subsetMap(*this, include, pointMap, faceMap);
|
||||||
|
|
||||||
// Create compact coordinate list and forward mapping array
|
// Create compact coordinate list and forward mapping array
|
||||||
pointField newPoints(pointMap.size());
|
pointField newPoints(pointMap.size());
|
||||||
@ -503,7 +508,7 @@ Foam::UnsortedMeshedSurface<Face> Foam::UnsortedMeshedSurface<Face>::subsetMesh
|
|||||||
f[fp] = oldToNew[f[fp]];
|
f[fp] = oldToNew[f[fp]];
|
||||||
}
|
}
|
||||||
|
|
||||||
newRegions[faceI] = regions_[origFaceI];
|
newRegions[faceI] = regionIds_[origFaceI];
|
||||||
}
|
}
|
||||||
oldToNew.clear();
|
oldToNew.clear();
|
||||||
|
|
||||||
@ -513,7 +518,7 @@ Foam::UnsortedMeshedSurface<Face> Foam::UnsortedMeshedSurface<Face>::subsetMesh
|
|||||||
xferMove(newPoints),
|
xferMove(newPoints),
|
||||||
xferMove(newFaces),
|
xferMove(newFaces),
|
||||||
xferMove(newRegions),
|
xferMove(newRegions),
|
||||||
xferCopy(patches_)
|
xferCopy(regionToc_)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,7 +526,7 @@ Foam::UnsortedMeshedSurface<Face> Foam::UnsortedMeshedSurface<Face>::subsetMesh
|
|||||||
template<class Face>
|
template<class Face>
|
||||||
Foam::UnsortedMeshedSurface<Face> Foam::UnsortedMeshedSurface<Face>::subsetMesh
|
Foam::UnsortedMeshedSurface<Face> Foam::UnsortedMeshedSurface<Face>::subsetMesh
|
||||||
(
|
(
|
||||||
const UList<bool>& include
|
const labelHashSet& include
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
labelList pointMap, faceMap;
|
labelList pointMap, faceMap;
|
||||||
@ -541,7 +546,7 @@ void Foam::UnsortedMeshedSurface<Face>::reset
|
|||||||
|
|
||||||
if (®ionIds)
|
if (®ionIds)
|
||||||
{
|
{
|
||||||
regions_.transfer(regionIds());
|
regionIds_.transfer(regionIds());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,9 +561,9 @@ void Foam::UnsortedMeshedSurface<Face>::transfer
|
|||||||
(
|
(
|
||||||
xferMove(surf.storedPoints()),
|
xferMove(surf.storedPoints()),
|
||||||
xferMove(surf.storedFaces()),
|
xferMove(surf.storedFaces()),
|
||||||
xferMove(surf.regions_)
|
xferMove(surf.regionIds_)
|
||||||
);
|
);
|
||||||
patches_.transfer(surf.patches_);
|
regionToc_.transfer(surf.regionToc_);
|
||||||
|
|
||||||
surf.clear();
|
surf.clear();
|
||||||
}
|
}
|
||||||
@ -571,7 +576,7 @@ void Foam::UnsortedMeshedSurface<Face>::transfer
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
reset(xferMove(surf.storedPoints()), xferMove(surf.storedFaces()));
|
reset(xferMove(surf.storedPoints()), xferMove(surf.storedFaces()));
|
||||||
setPatches(surf.patches());
|
setRegions(surf.regions());
|
||||||
surf.clear();
|
surf.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,8 +639,8 @@ void Foam::UnsortedMeshedSurface<Face>::operator=
|
|||||||
|
|
||||||
this->storedPoints() = surf.points();
|
this->storedPoints() = surf.points();
|
||||||
this->storedFaces() = surf.faces();
|
this->storedFaces() = surf.faces();
|
||||||
regions_ = surf.regions_;
|
regionIds_ = surf.regionIds_;
|
||||||
patches_ = surf.patches_;
|
regionToc_ = surf.regionToc_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,18 +26,18 @@ Class
|
|||||||
Foam::UnsortedMeshedSurface
|
Foam::UnsortedMeshedSurface
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A surface geometry mesh, in which the patch information is conveyed by
|
A surface geometry mesh, in which the region information is conveyed by
|
||||||
the 'region' associated with each face.
|
the 'regionId' associated with each face.
|
||||||
|
|
||||||
This form of surface description is particularly useful for reading in
|
This form of surface description is particularly useful for reading in
|
||||||
surface meshes from third-party formats (eg, obj, stl, gts, etc.). It
|
surface meshes from third-party formats (eg, obj, stl, gts, etc.). It
|
||||||
can also be particularly useful for situations in which the surface
|
can also be particularly useful for situations in which the surface
|
||||||
many be adjusted in an arbitrary manner without worrying about needed
|
many be adjusted in an arbitrary manner without worrying about needed
|
||||||
to adjust the patch information (eg, surface refinement).
|
to adjust the region information (eg, surface refinement).
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
The Foam::meshedSurface - which is organized as a surface mesh, but
|
The Foam::MeshedSurface - which is organized as a surface mesh, but
|
||||||
with independent patch information.
|
with independent region information.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
UnsortedMeshedSurface.C
|
UnsortedMeshedSurface.C
|
||||||
@ -48,8 +48,8 @@ SourceFiles
|
|||||||
#define UnsortedMeshedSurface_H
|
#define UnsortedMeshedSurface_H
|
||||||
|
|
||||||
#include "BasicMeshedSurface.H"
|
#include "BasicMeshedSurface.H"
|
||||||
#include "surfPatchIdentifierList.H"
|
#include "surfRegionIdentifierList.H"
|
||||||
#include "surfGroupList.H"
|
#include "surfRegionList.H"
|
||||||
#include "surfaceFormatsCore.H"
|
#include "surfaceFormatsCore.H"
|
||||||
#include "runTimeSelectionTables.H"
|
#include "runTimeSelectionTables.H"
|
||||||
#include "memberFunctionSelectionTables.H"
|
#include "memberFunctionSelectionTables.H"
|
||||||
@ -93,12 +93,12 @@ private:
|
|||||||
|
|
||||||
// Private Member Data
|
// Private Member Data
|
||||||
|
|
||||||
//- The regions associated with the faces
|
//- The region Ids associated with the faces
|
||||||
labelList regions_;
|
labelList regionIds_;
|
||||||
|
|
||||||
//- Patch information (face ordering nFaces/startFace only used
|
//- Region information (face ordering nFaces/startFace only used
|
||||||
// during reading and writing)
|
// during reading and writing)
|
||||||
List<surfPatchIdentifier> patches_;
|
List<surfRegionIdentifier> regionToc_;
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
|
|
||||||
@ -115,16 +115,16 @@ protected:
|
|||||||
|
|
||||||
// Protected Member functions
|
// Protected Member functions
|
||||||
|
|
||||||
//- Return non-const access to the faces
|
//- Return non-const access to the region Ids
|
||||||
List<label>& storedRegions()
|
List<label>& storedRegionIds()
|
||||||
{
|
{
|
||||||
return regions_;
|
return regionIds_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return non-const access to the patches
|
//- Return non-const access to the region table-of-contents
|
||||||
List<surfPatchIdentifier>& storedPatches()
|
List<surfRegionIdentifier>& storedRegionToc()
|
||||||
{
|
{
|
||||||
return patches_;
|
return regionToc_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Set new regions from faceMap
|
//- Set new regions from faceMap
|
||||||
@ -155,23 +155,23 @@ public:
|
|||||||
UnsortedMeshedSurface();
|
UnsortedMeshedSurface();
|
||||||
|
|
||||||
//- Construct by transferring components
|
//- Construct by transferring components
|
||||||
// (points, faces, region ids, patches).
|
// (points, faces, region ids, region info).
|
||||||
UnsortedMeshedSurface
|
UnsortedMeshedSurface
|
||||||
(
|
(
|
||||||
const Xfer<pointField>&,
|
const Xfer<pointField>&,
|
||||||
const Xfer<List<Face> >&,
|
const Xfer<List<Face> >&,
|
||||||
const Xfer<List<label> >& regionIds,
|
const Xfer<List<label> >& regionIds,
|
||||||
const Xfer<surfPatchIdentifierList>&
|
const Xfer<surfRegionIdentifierList>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct by transferring points, faces.
|
//- Construct by transferring points, faces.
|
||||||
// Use patch information, or set single default patch
|
// Use region information, or set single default region
|
||||||
UnsortedMeshedSurface
|
UnsortedMeshedSurface
|
||||||
(
|
(
|
||||||
const Xfer<pointField>&,
|
const Xfer<pointField>&,
|
||||||
const Xfer<List<Face> >&,
|
const Xfer<List<Face> >&,
|
||||||
const UList<label>& patchSizes = UList<label>::null(),
|
const UList<label>& regionSizes = UList<label>::null(),
|
||||||
const UList<word>& patchNames = UList<word>::null()
|
const UList<word>& regionNames = UList<word>::null()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from a boundary mesh with local points/faces
|
//- Construct from a boundary mesh with local points/faces
|
||||||
@ -267,34 +267,34 @@ public:
|
|||||||
//- Reset size of face and region list
|
//- Reset size of face and region list
|
||||||
void setSize(const label);
|
void setSize(const label);
|
||||||
|
|
||||||
//- Return const access to the regions
|
//- Return const access to the regions ids
|
||||||
const List<label>& regions() const
|
const List<label>& regionIds() const
|
||||||
{
|
{
|
||||||
return regions_;
|
return regionIds_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return const access to the patches
|
//- Return const access to the region table-of-contents
|
||||||
const List<surfPatchIdentifier>& patches() const
|
const List<surfRegionIdentifier>& regionToc() const
|
||||||
{
|
{
|
||||||
return patches_;
|
return regionToc_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Sort faces according to region.
|
//- Sort faces according to region.
|
||||||
// Returns patch list and sets faceMap to index within faces()
|
// Returns a surfRegionList and sets faceMap to index within faces()
|
||||||
List<surfGroup> sortedRegions(labelList& faceMap) const;
|
surfRegionList sortedRegions(labelList& faceMap) const;
|
||||||
|
|
||||||
//- Set regions to 0 and set a single patch
|
//- Set regions to 0 and set a single region
|
||||||
// Optionally with a specific name
|
// Optionally with a specific name
|
||||||
void onePatch(const word& name = word::null);
|
void oneRegion(const word& name = word::null);
|
||||||
|
|
||||||
//- Set regions and patches
|
//- Set region ids and regions
|
||||||
void setPatches(const surfGroupList&);
|
void setRegions(const surfRegionList&);
|
||||||
|
|
||||||
//- Set regions and patches
|
//- Set region ids and regions
|
||||||
void setPatches(const UList<label>& sizes, const UList<word>& names);
|
void setRegions(const UList<label>& sizes, const UList<word>& names);
|
||||||
|
|
||||||
//- Set regions and patches with default names
|
//- Set region ids and set regions with default names
|
||||||
void setPatches(const UList<label>& sizes);
|
void setRegions(const UList<label>& sizes);
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
@ -306,7 +306,7 @@ public:
|
|||||||
// Returns return pointMap, faceMap from subsetMeshMap
|
// Returns return pointMap, faceMap from subsetMeshMap
|
||||||
UnsortedMeshedSurface subsetMesh
|
UnsortedMeshedSurface subsetMesh
|
||||||
(
|
(
|
||||||
const UList<bool>& include,
|
const labelHashSet& include,
|
||||||
labelList& pointMap,
|
labelList& pointMap,
|
||||||
labelList& faceMap
|
labelList& faceMap
|
||||||
) const;
|
) const;
|
||||||
@ -314,7 +314,7 @@ public:
|
|||||||
//- Return new surface.
|
//- Return new surface.
|
||||||
UnsortedMeshedSurface subsetMesh
|
UnsortedMeshedSurface subsetMesh
|
||||||
(
|
(
|
||||||
const UList<bool>& include
|
const labelHashSet& include
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Transfer components (points, faces, region ids).
|
//- Transfer components (points, faces, region ids).
|
||||||
|
|||||||
@ -49,18 +49,18 @@ void Foam::UnsortedMeshedSurface<Face>::write(Ostream& os) const
|
|||||||
const List<Face>& faceLst = this->faces();
|
const List<Face>& faceLst = this->faces();
|
||||||
|
|
||||||
labelList faceMap;
|
labelList faceMap;
|
||||||
List<surfGroup> patchLst = sortedRegions(faceMap);
|
surfRegionList regionLst = sortedRegions(faceMap);
|
||||||
|
|
||||||
// just emit some information until we get a nice IOobject
|
// just emit some information until we get a nice IOobject
|
||||||
IOobject::writeBanner(os);
|
IOobject::writeBanner(os);
|
||||||
os << "// OpenFOAM Surface Format" << nl
|
os << "// OpenFOAM Surface Format" << nl
|
||||||
<< "// ~~~~~~~~~~~~~~~~~~~~~~~" << nl
|
<< "// ~~~~~~~~~~~~~~~~~~~~~~~" << nl
|
||||||
<< "// regions:" << nl
|
<< "// regions:" << nl
|
||||||
<< patchLst.size() << nl << token::BEGIN_LIST << incrIndent << nl;
|
<< regionLst.size() << nl << token::BEGIN_LIST << incrIndent << nl;
|
||||||
|
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
patchLst[patchI].writeDict(os);
|
regionLst[regionI].writeDict(os);
|
||||||
}
|
}
|
||||||
os << decrIndent << token::END_LIST << nl;
|
os << decrIndent << token::END_LIST << nl;
|
||||||
|
|
||||||
@ -74,12 +74,12 @@ void Foam::UnsortedMeshedSurface<Face>::write(Ostream& os) const
|
|||||||
os << faceLst.size() << nl << token::BEGIN_LIST << nl;
|
os << faceLst.size() << nl << token::BEGIN_LIST << nl;
|
||||||
|
|
||||||
label faceI = 0;
|
label faceI = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
// Print all faces belonging to this region
|
// Print all faces belonging to this region
|
||||||
const surfGroup& patch = patchLst[patchI];
|
const surfRegion& reg = regionLst[regionI];
|
||||||
|
|
||||||
forAll(patch, patchFaceI)
|
forAll(reg, localFaceI)
|
||||||
{
|
{
|
||||||
os << faceLst[faceMap[faceI++]] << nl;
|
os << faceLst[faceMap[faceI++]] << nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,28 +26,28 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "surfGroup.H"
|
#include "surfRegion.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "word.H"
|
#include "word.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
defineTypeNameAndDebug(Foam::surfGroup, 0);
|
defineTypeNameAndDebug(Foam::surfRegion, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::surfGroup::surfGroup()
|
Foam::surfRegion::surfRegion()
|
||||||
:
|
:
|
||||||
surfPatchIdentifier(),
|
surfRegionIdentifier(),
|
||||||
size_(0),
|
size_(0),
|
||||||
start_(0)
|
start_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Foam::surfGroup::surfGroup
|
Foam::surfRegion::surfRegion
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
const label size,
|
||||||
@ -56,68 +56,68 @@ Foam::surfGroup::surfGroup
|
|||||||
const word& geometricType
|
const word& geometricType
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
surfPatchIdentifier(name, index, geometricType),
|
surfRegionIdentifier(name, index, geometricType),
|
||||||
size_(size),
|
size_(size),
|
||||||
start_(start)
|
start_(start)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfGroup::surfGroup(Istream& is, const label index)
|
Foam::surfRegion::surfRegion(Istream& is, const label index)
|
||||||
:
|
:
|
||||||
surfPatchIdentifier(),
|
surfRegionIdentifier(),
|
||||||
size_(0),
|
size_(0),
|
||||||
start_(0)
|
start_(0)
|
||||||
{
|
{
|
||||||
word name(is);
|
word name(is);
|
||||||
dictionary dict(is);
|
dictionary dict(is);
|
||||||
|
|
||||||
operator=(surfGroup(name, dict, index));
|
operator=(surfRegion(name, dict, index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfGroup::surfGroup
|
Foam::surfRegion::surfRegion
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const label index
|
const label index
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
surfPatchIdentifier(name, dict, index),
|
surfRegionIdentifier(name, dict, index),
|
||||||
size_(readLabel(dict.lookup("nFaces"))),
|
size_(readLabel(dict.lookup("nFaces"))),
|
||||||
start_(readLabel(dict.lookup("startFace")))
|
start_(readLabel(dict.lookup("startFace")))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfGroup::surfGroup(const surfGroup& p)
|
Foam::surfRegion::surfRegion(const surfRegion& reg)
|
||||||
:
|
:
|
||||||
surfPatchIdentifier(p, p.index()),
|
surfRegionIdentifier(reg, reg.index()),
|
||||||
size_(p.size()),
|
size_(reg.size()),
|
||||||
start_(p.start())
|
start_(reg.start())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfGroup::surfGroup(const surfGroup& p, const label index)
|
Foam::surfRegion::surfRegion(const surfRegion& reg, const label index)
|
||||||
:
|
:
|
||||||
surfPatchIdentifier(p, index),
|
surfRegionIdentifier(reg, index),
|
||||||
size_(p.size()),
|
size_(reg.size()),
|
||||||
start_(p.start())
|
start_(reg.start())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::surfGroup::write(Ostream& os) const
|
void Foam::surfRegion::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
writeDict(os);
|
writeDict(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::surfGroup::writeDict(Ostream& os) const
|
void Foam::surfRegion::writeDict(Ostream& os) const
|
||||||
{
|
{
|
||||||
os << indent << name() << nl
|
os << indent << name() << nl
|
||||||
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||||
|
|
||||||
surfPatchIdentifier::write(os);
|
surfRegionIdentifier::write(os);
|
||||||
os.writeKeyword("nFaces") << size() << token::END_STATEMENT << nl;
|
os.writeKeyword("nFaces") << size() << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("startFace") << start() << token::END_STATEMENT << nl;
|
os.writeKeyword("startFace") << start() << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
@ -127,38 +127,38 @@ void Foam::surfGroup::writeDict(Ostream& os) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::surfGroup::operator!=(const surfGroup& p) const
|
bool Foam::surfRegion::operator!=(const surfRegion& reg) const
|
||||||
{
|
{
|
||||||
return !(*this == p);
|
return !(*this == reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::surfGroup::operator==(const surfGroup& p) const
|
bool Foam::surfRegion::operator==(const surfRegion& reg) const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
(geometricType() == p.geometricType())
|
(geometricType() == reg.geometricType())
|
||||||
&& (size() == p.size())
|
&& (size() == reg.size())
|
||||||
&& (start() == p.start())
|
&& (start() == reg.start())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Istream& Foam::operator>>(Istream& is, surfGroup& p)
|
Foam::Istream& Foam::operator>>(Istream& is, surfRegion& reg)
|
||||||
{
|
{
|
||||||
p = surfGroup(is, 0);
|
reg = surfRegion(is, 0);
|
||||||
|
|
||||||
is.check("Istream& operator>>(Istream&, surfGroup&)");
|
is.check("Istream& operator>>(Istream&, surfRegion&)");
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const surfGroup& p)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const surfRegion& reg)
|
||||||
{
|
{
|
||||||
p.write(os);
|
reg.write(os);
|
||||||
os.check("Ostream& operator<<(Ostream& f, const surfGroup& p");
|
os.check("Ostream& operator<<(Ostream&, const surfRegion&");
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,23 +23,24 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::surfGroup
|
Foam::surfRegion
|
||||||
|
|
||||||
Description
|
Description
|
||||||
'Patch' on surface as subset of triSurface.
|
A region on a meshed surface.
|
||||||
|
Similar in concept to a faceZone on the surface.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
surfGroup.C
|
surfRegion.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef surfGroup_H
|
#ifndef surfRegion_H
|
||||||
#define surfGroup_H
|
#define surfRegion_H
|
||||||
|
|
||||||
#include "word.H"
|
#include "word.H"
|
||||||
#include "label.H"
|
#include "label.H"
|
||||||
#include "className.H"
|
#include "className.H"
|
||||||
#include "surfPatchIdentifier.H"
|
#include "surfRegionIdentifier.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
|
|
||||||
@ -50,18 +51,18 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
// Forward declaration of friend functions and operators
|
||||||
|
|
||||||
class surfGroup;
|
class surfRegion;
|
||||||
|
|
||||||
Istream& operator>>(Istream&, surfGroup&);
|
Istream& operator>>(Istream&, surfRegion&);
|
||||||
Ostream& operator<<(Ostream&, const surfGroup&);
|
Ostream& operator<<(Ostream&, const surfRegion&);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class surfGroup Declaration
|
Class surfRegion Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class surfGroup
|
class surfRegion
|
||||||
:
|
:
|
||||||
public surfPatchIdentifier
|
public surfRegionIdentifier
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
@ -74,16 +75,16 @@ class surfGroup
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
ClassName("surfGroup");
|
ClassName("surfRegion");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
surfGroup();
|
surfRegion();
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
surfGroup
|
surfRegion
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
const label size,
|
||||||
@ -93,10 +94,10 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
surfGroup(Istream& is, const label index);
|
surfRegion(Istream& is, const label index);
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
surfGroup
|
surfRegion
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
@ -104,48 +105,48 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
surfGroup(const surfGroup&);
|
surfRegion(const surfRegion&);
|
||||||
|
|
||||||
//- Construct from another patch, resetting the index
|
//- Construct from another region, resetting the index
|
||||||
surfGroup(const surfGroup&, const label index);
|
surfRegion(const surfRegion&, const label index);
|
||||||
|
|
||||||
//- Return clone
|
//- Return clone
|
||||||
autoPtr<surfGroup> clone() const
|
autoPtr<surfRegion> clone() const
|
||||||
{
|
{
|
||||||
notImplemented("autoPtr<surfGroup> clone() const");
|
notImplemented("autoPtr<surfRegion> clone() const");
|
||||||
return autoPtr<surfGroup>(NULL);
|
return autoPtr<surfRegion>(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static autoPtr<surfGroup> New(Istream& is)
|
static autoPtr<surfRegion> New(Istream& is)
|
||||||
{
|
{
|
||||||
word name(is);
|
word name(is);
|
||||||
dictionary dict(is);
|
dictionary dict(is);
|
||||||
|
|
||||||
return autoPtr<surfGroup>(new surfGroup(name, dict, 0));
|
return autoPtr<surfRegion>(new surfRegion(name, dict, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return start label of this patch in the face list
|
//- Return start label of this region in the face list
|
||||||
label start() const
|
label start() const
|
||||||
{
|
{
|
||||||
return start_;
|
return start_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return start label of this patch in the face list
|
//- Return start label of this region in the face list
|
||||||
label& start()
|
label& start()
|
||||||
{
|
{
|
||||||
return start_;
|
return start_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return size of this patch in the face list
|
//- Return size of this region in the face list
|
||||||
label size() const
|
label size() const
|
||||||
{
|
{
|
||||||
return size_;
|
return size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return size of this patch in the face list
|
//- Return size of this region in the face list
|
||||||
label& size()
|
label& size()
|
||||||
{
|
{
|
||||||
return size_;
|
return size_;
|
||||||
@ -160,15 +161,15 @@ public:
|
|||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
bool operator!=(const surfGroup&) const;
|
bool operator!=(const surfRegion&) const;
|
||||||
|
|
||||||
//- compare.
|
//- compare.
|
||||||
bool operator==(const surfGroup&) const;
|
bool operator==(const surfRegion&) const;
|
||||||
|
|
||||||
// IOstream Operators
|
// IOstream Operators
|
||||||
|
|
||||||
friend Istream& operator>>(Istream&, surfGroup&);
|
friend Istream& operator>>(Istream&, surfRegion&);
|
||||||
friend Ostream& operator<<(Ostream&, const surfGroup&);
|
friend Ostream& operator<<(Ostream&, const surfRegion&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -24,71 +24,71 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "surfGroupIOList.H"
|
#include "surfRegionIOList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
defineTypeNameAndDebug(Foam::surfGroupIOList, 0);
|
defineTypeNameAndDebug(Foam::surfRegionIOList, 0);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::surfGroupIOList::surfGroupIOList
|
Foam::surfRegionIOList::surfRegionIOList
|
||||||
(
|
(
|
||||||
const IOobject& io
|
const IOobject& io
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
surfGroupList(),
|
surfRegionList(),
|
||||||
regIOobject(io)
|
regIOobject(io)
|
||||||
{
|
{
|
||||||
Foam::string functionName =
|
Foam::string functionName =
|
||||||
"surfGroupIOList::surfGroupIOList"
|
"surfRegionIOList::surfRegionIOList"
|
||||||
"(const IOobject& io)";
|
"(const IOobject& io)";
|
||||||
|
|
||||||
|
|
||||||
if (readOpt() == IOobject::MUST_READ)
|
if (readOpt() == IOobject::MUST_READ)
|
||||||
{
|
{
|
||||||
surfGroupList& patches = *this;
|
surfRegionList& regions = *this;
|
||||||
|
|
||||||
// read polyPatchList
|
// read polyPatchList
|
||||||
Istream& is = readStream(typeName);
|
Istream& is = readStream(typeName);
|
||||||
|
|
||||||
PtrList<entry> patchEntries(is);
|
PtrList<entry> dictEntries(is);
|
||||||
patches.setSize(patchEntries.size());
|
regions.setSize(dictEntries.size());
|
||||||
|
|
||||||
label faceI = 0;
|
label faceI = 0;
|
||||||
forAll(patches, patchI)
|
forAll(regions, regionI)
|
||||||
{
|
{
|
||||||
const dictionary& dict = patchEntries[patchI].dict();
|
const dictionary& dict = dictEntries[regionI].dict();
|
||||||
|
|
||||||
label patchSize = readLabel(dict.lookup("nFaces"));
|
label regionSize = readLabel(dict.lookup("nFaces"));
|
||||||
label startFaceI = readLabel(dict.lookup("startFace"));
|
label startFaceI = readLabel(dict.lookup("startFace"));
|
||||||
|
|
||||||
patches[patchI] = surfGroup
|
regions[regionI] = surfRegion
|
||||||
(
|
(
|
||||||
patchEntries[patchI].keyword(),
|
dictEntries[regionI].keyword(),
|
||||||
patchSize,
|
regionSize,
|
||||||
startFaceI,
|
startFaceI,
|
||||||
patchI
|
regionI
|
||||||
);
|
);
|
||||||
|
|
||||||
word geoType;
|
word geoType;
|
||||||
if (dict.readIfPresent("geometricType", geoType))
|
if (dict.readIfPresent("geometricType", geoType))
|
||||||
{
|
{
|
||||||
patches[patchI].geometricType() = geoType;
|
regions[regionI].geometricType() = geoType;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startFaceI != faceI)
|
if (startFaceI != faceI)
|
||||||
{
|
{
|
||||||
FatalErrorIn(functionName)
|
FatalErrorIn(functionName)
|
||||||
<< "Patches are not ordered. Start of patch " << patchI
|
<< "Regions are not ordered. Start of region " << regionI
|
||||||
<< " does not correspond to sum of preceding patches."
|
<< " does not correspond to sum of preceding regions."
|
||||||
<< endl
|
<< endl
|
||||||
<< "while reading " << io.objectPath()
|
<< "while reading " << io.objectPath()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
faceI += patchSize;
|
faceI += regionSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check state of IOstream
|
// Check state of IOstream
|
||||||
@ -99,20 +99,20 @@ Foam::surfGroupIOList::surfGroupIOList
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct from IOObject
|
// Construct from IOObject
|
||||||
Foam::surfGroupIOList::surfGroupIOList
|
Foam::surfRegionIOList::surfRegionIOList
|
||||||
(
|
(
|
||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
const surfGroupList& patches
|
const surfRegionList& regions
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
surfGroupList(patches),
|
surfRegionList(regions),
|
||||||
regIOobject(io)
|
regIOobject(io)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::surfGroupIOList::~surfGroupIOList()
|
Foam::surfRegionIOList::~surfRegionIOList()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ Foam::surfGroupIOList::~surfGroupIOList()
|
|||||||
|
|
||||||
|
|
||||||
// writeData member function required by regIOobject
|
// writeData member function required by regIOobject
|
||||||
bool Foam::surfGroupIOList::writeData(Ostream& os) const
|
bool Foam::surfRegionIOList::writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
os << *this;
|
os << *this;
|
||||||
return os.good();
|
return os.good();
|
||||||
@ -129,13 +129,13 @@ bool Foam::surfGroupIOList::writeData(Ostream& os) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const surfGroupIOList& patches)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const surfRegionIOList& L)
|
||||||
{
|
{
|
||||||
os << patches.size() << nl << token::BEGIN_LIST;
|
os << L.size() << nl << token::BEGIN_LIST;
|
||||||
|
|
||||||
forAll(patches, patchI)
|
forAll(L, i)
|
||||||
{
|
{
|
||||||
patches[patchI].writeDict(os);
|
L[i].writeDict(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
os << token::END_LIST;
|
os << token::END_LIST;
|
||||||
@ -23,20 +23,20 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::surfGroupIOList
|
Foam::surfRegionIOList
|
||||||
|
|
||||||
Description
|
Description
|
||||||
IOobject for a surfGroupList
|
IOobject for a surfRegionList
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
surfGroupIOList.C
|
surfRegionIOList.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef surfGroupIOList_H
|
#ifndef surfRegionIOList_H
|
||||||
#define surfGroupIOList_H
|
#define surfRegionIOList_H
|
||||||
|
|
||||||
#include "surfGroupList.H"
|
#include "surfRegionList.H"
|
||||||
#include "regIOobject.H"
|
#include "regIOobject.H"
|
||||||
#include "faceList.H"
|
#include "faceList.H"
|
||||||
#include "className.H"
|
#include "className.H"
|
||||||
@ -49,12 +49,12 @@ namespace Foam
|
|||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class surfGroupIOList Declaration
|
Class surfRegionIOList Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class surfGroupIOList
|
class surfRegionIOList
|
||||||
:
|
:
|
||||||
public surfGroupList,
|
public surfRegionList,
|
||||||
public regIOobject
|
public regIOobject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
@ -63,29 +63,29 @@ class surfGroupIOList
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
surfGroupIOList(const surfGroupIOList&);
|
surfRegionIOList(const surfRegionIOList&);
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const surfGroupIOList&);
|
void operator=(const surfRegionIOList&);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("surfGroupIOList");
|
TypeName("surfRegionIOList");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from IOobject
|
//- Construct from IOobject
|
||||||
explicit surfGroupIOList(const IOobject& io);
|
explicit surfRegionIOList(const IOobject&);
|
||||||
|
|
||||||
//- Construct from IOobject
|
//- Construct from IOobject
|
||||||
surfGroupIOList(const IOobject& io, const surfGroupList&);
|
surfRegionIOList(const IOobject&, const surfRegionList&);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
|
||||||
~surfGroupIOList();
|
~surfRegionIOList();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -102,7 +102,7 @@ public:
|
|||||||
|
|
||||||
// IOstream Operators
|
// IOstream Operators
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream&, const surfGroupIOList&);
|
friend Ostream& operator<<(Ostream&, const surfRegionIOList&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -23,17 +23,18 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Typedef
|
Typedef
|
||||||
Foam::surfGroupList
|
Foam::surfRegionList
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef surfGroupList_H
|
#ifndef surfRegionList_H
|
||||||
#define surfGroupList_H
|
#define surfRegionList_H
|
||||||
|
|
||||||
#include "surfGroup.H"
|
#include "surfRegion.H"
|
||||||
#include "List.H"
|
#include "List.H"
|
||||||
|
#include "surfRegionIdentifierList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
typedef List<surfGroup> surfGroupList;
|
typedef List<surfRegion> surfRegionList;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -24,14 +24,14 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "surfPatchIdentifier.H"
|
#include "surfRegionIdentifier.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::surfPatchIdentifier::surfPatchIdentifier()
|
Foam::surfRegionIdentifier::surfRegionIdentifier()
|
||||||
:
|
:
|
||||||
name_(word::null),
|
name_(word::null),
|
||||||
boundaryIndex_(0),
|
boundaryIndex_(0),
|
||||||
@ -39,7 +39,7 @@ Foam::surfPatchIdentifier::surfPatchIdentifier()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfPatchIdentifier::surfPatchIdentifier
|
Foam::surfRegionIdentifier::surfRegionIdentifier
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const label index,
|
const label index,
|
||||||
@ -52,7 +52,7 @@ Foam::surfPatchIdentifier::surfPatchIdentifier
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfPatchIdentifier::surfPatchIdentifier
|
Foam::surfRegionIdentifier::surfRegionIdentifier
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
@ -66,9 +66,9 @@ Foam::surfPatchIdentifier::surfPatchIdentifier
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfPatchIdentifier::surfPatchIdentifier
|
Foam::surfRegionIdentifier::surfRegionIdentifier
|
||||||
(
|
(
|
||||||
const surfPatchIdentifier& p,
|
const surfRegionIdentifier& p,
|
||||||
const label index
|
const label index
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -79,14 +79,14 @@ Foam::surfPatchIdentifier::surfPatchIdentifier
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::surfPatchIdentifier::~surfPatchIdentifier()
|
Foam::surfRegionIdentifier::~surfRegionIdentifier()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
void Foam::surfPatchIdentifier::write(Ostream& os) const
|
void Foam::surfRegionIdentifier::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
if (geometricType_.size())
|
if (geometricType_.size())
|
||||||
{
|
{
|
||||||
@ -98,18 +98,18 @@ void Foam::surfPatchIdentifier::write(Ostream& os) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// bool Foam::surfPatchIdentifier::operator!=
|
// bool Foam::surfRegionIdentifier::operator!=
|
||||||
// (
|
// (
|
||||||
// const surfPatchIdentifier& p
|
// const surfRegionIdentifier& p
|
||||||
// ) const
|
// ) const
|
||||||
// {
|
// {
|
||||||
// return !(*this == p);
|
// return !(*this == p);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// bool Foam::surfPatchIdentifier::operator==
|
// bool Foam::surfRegionIdentifier::operator==
|
||||||
// (
|
// (
|
||||||
// const surfPatchIdentifier& p
|
// const surfRegionIdentifier& p
|
||||||
// ) const
|
// ) const
|
||||||
// {
|
// {
|
||||||
// return geometricType() == p.geometricType() && name() == p.name();
|
// return geometricType() == p.geometricType() && name() == p.name();
|
||||||
@ -118,7 +118,7 @@ void Foam::surfPatchIdentifier::write(Ostream& os) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Foam::Istream& Foam::operator>>(Istream& is, surfPatchIdentifier& p)
|
// Foam::Istream& Foam::operator>>(Istream& is, surfRegionIdentifier& p)
|
||||||
// {
|
// {
|
||||||
// is >> p.name_ >> p.geometricType_;
|
// is >> p.name_ >> p.geometricType_;
|
||||||
//
|
//
|
||||||
@ -126,12 +126,12 @@ void Foam::surfPatchIdentifier::write(Ostream& os) const
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const surfPatchIdentifier& p)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const surfRegionIdentifier& p)
|
||||||
{
|
{
|
||||||
p.write(os);
|
p.write(os);
|
||||||
os.check
|
os.check
|
||||||
(
|
(
|
||||||
"Ostream& operator<<(Ostream&, const surfPatchIdentifier&)"
|
"Ostream& operator<<(Ostream&, const surfRegionIdentifier&)"
|
||||||
);
|
);
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
@ -23,19 +23,23 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::surfPatchIdentifier
|
Foam::surfRegionIdentifier
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Like patchIdentifier but for surfaces with "geometricType" rather
|
An identifier for a region on a meshed surface.
|
||||||
than "physicalType".
|
|
||||||
|
Similar in concept to a faceZone on the surface, but can also have a
|
||||||
|
"geometricType" rather. Despite the similarity to a 'patch' for
|
||||||
|
volume meshes (with a "physicalType"), the region does not have any
|
||||||
|
patch information per se.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
surfPatchIdentifier.C
|
surfRegionIdentifier.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef surfPatchIdentifier_H
|
#ifndef surfRegionIdentifier_H
|
||||||
#define surfPatchIdentifier_H
|
#define surfRegionIdentifier_H
|
||||||
|
|
||||||
#include "word.H"
|
#include "word.H"
|
||||||
#include "label.H"
|
#include "label.H"
|
||||||
@ -50,24 +54,24 @@ class dictionary;
|
|||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
// Forward declaration of friend functions and operators
|
||||||
|
|
||||||
class surfPatchIdentifier;
|
class surfRegionIdentifier;
|
||||||
Ostream& operator<<(Ostream&, const surfPatchIdentifier&);
|
Ostream& operator<<(Ostream&, const surfRegionIdentifier&);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class surfPatchIdentifier Declaration
|
Class surfRegionIdentifier Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class surfPatchIdentifier
|
class surfRegionIdentifier
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of patch
|
//- Name of region
|
||||||
word name_;
|
word name_;
|
||||||
|
|
||||||
//- Index of patch in boundary
|
//- Index of region in surface mesh
|
||||||
label boundaryIndex_;
|
label boundaryIndex_;
|
||||||
|
|
||||||
//- Type name of patch
|
//- Type name of region
|
||||||
mutable word geometricType_;
|
mutable word geometricType_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -75,10 +79,10 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
surfPatchIdentifier();
|
surfRegionIdentifier();
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
surfPatchIdentifier
|
surfRegionIdentifier
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const label index,
|
const label index,
|
||||||
@ -87,24 +91,24 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
surfPatchIdentifier
|
surfRegionIdentifier
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const dictionary&,
|
const dictionary&,
|
||||||
const label index
|
const label index
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from another patch, resetting the index
|
//- Construct from another region identifier, resetting the index
|
||||||
surfPatchIdentifier
|
surfRegionIdentifier
|
||||||
(
|
(
|
||||||
const surfPatchIdentifier&,
|
const surfRegionIdentifier&,
|
||||||
const label index
|
const label index
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
|
||||||
virtual ~surfPatchIdentifier();
|
virtual ~surfRegionIdentifier();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -121,42 +125,42 @@ public:
|
|||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the geometric type of the patch
|
//- Return the geometric type of the region
|
||||||
const word& geometricType() const
|
const word& geometricType() const
|
||||||
{
|
{
|
||||||
return geometricType_;
|
return geometricType_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the geometric type of the patch for modification
|
//- Return the geometric type of the region for modification
|
||||||
word& geometricType()
|
word& geometricType()
|
||||||
{
|
{
|
||||||
return geometricType_;
|
return geometricType_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the index of this patch in the boundaryMesh
|
//- Return the index of this region in the surface mesh
|
||||||
label index() const
|
label index() const
|
||||||
{
|
{
|
||||||
return boundaryIndex_;
|
return boundaryIndex_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Write surfPatchIdentifier as a dictionary
|
//- Write surfRegionIdentifier as a dictionary
|
||||||
void write(Ostream&) const;
|
void write(Ostream&) const;
|
||||||
|
|
||||||
//- Write surfPatchIdentifier as a dictionary
|
//- Write surfRegionIdentifier as a dictionary
|
||||||
// void writeDict(Ostream&) const;
|
// void writeDict(Ostream&) const;
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
// bool operator!=(const surfPatchIdentifier&) const;
|
// bool operator!=(const surfRegionIdentifier&) const;
|
||||||
//
|
//
|
||||||
// //- compare.
|
// //- compare.
|
||||||
// bool operator==(const surfPatchIdentifier&) const;
|
// bool operator==(const surfRegionIdentifier&) const;
|
||||||
|
|
||||||
// Ostream Operator
|
// Ostream Operator
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream&, const surfPatchIdentifier&);
|
friend Ostream& operator<<(Ostream&, const surfRegionIdentifier&);
|
||||||
// friend Istream& operator>>(Istream&, surfPatchIdentifier&);
|
// friend Istream& operator>>(Istream&, surfRegionIdentifier&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -23,16 +23,16 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Typedef
|
Typedef
|
||||||
Foam::surfPatchIdentifierList
|
Foam::surfRegionIdentifierList
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef surfPatchIdentifierList_H
|
#ifndef surfRegionIdentifierList_H
|
||||||
#define surfPatchIdentifierList_H
|
#define surfRegionIdentifierList_H
|
||||||
|
|
||||||
#include "surfPatchIdentifier.H"
|
#include "surfRegionIdentifier.H"
|
||||||
#include "List.H"
|
#include "List.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -42,7 +42,7 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
typedef List<surfPatchIdentifier> surfPatchIdentifierList;
|
typedef List<surfRegionIdentifier> surfRegionIdentifierList;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -99,42 +99,42 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// # of kids is the # of patches
|
// # of kids is the # of regions
|
||||||
args = cueToOrDie(is, "kids");
|
args = cueToOrDie(is, "kids");
|
||||||
label nPatches = parse<int>(args);
|
label nRegions = parse<int>(args);
|
||||||
|
|
||||||
// Start of vertices for object/patch
|
// Start of vertices for object/region
|
||||||
label patchVertOffset = 0;
|
label vertexOffset = 0;
|
||||||
|
|
||||||
DynamicList<point> dynPoints;
|
DynamicList<point> dynPoints;
|
||||||
DynamicList<Face> dynFaces;
|
DynamicList<Face> dynFaces;
|
||||||
List<word> names(nPatches);
|
List<word> names(nRegions);
|
||||||
List<label> sizes(nPatches, 0);
|
List<label> sizes(nRegions, 0);
|
||||||
|
|
||||||
for (label patchI = 0; patchI < nPatches; ++patchI)
|
for (label regionI = 0; regionI < nRegions; ++regionI)
|
||||||
{
|
{
|
||||||
names[patchI] = word("patch") + Foam::name(patchI);
|
names[regionI] = word("region") + Foam::name(regionI);
|
||||||
|
|
||||||
args = cueToOrDie(is, "OBJECT", "while reading " + names[patchI]);
|
args = cueToOrDie(is, "OBJECT", "while reading " + names[regionI]);
|
||||||
|
|
||||||
// number of vertices for this patch
|
// number of vertices for this region
|
||||||
label nPatchPoints = 0;
|
label nRegionPoints = 0;
|
||||||
vector location(pTraits<vector>::zero);
|
vector location(pTraits<vector>::zero);
|
||||||
// tensor rotation(I);
|
// tensor rotation(I);
|
||||||
|
|
||||||
// Read all info for current patch
|
// Read all info for current region
|
||||||
while (is.good())
|
while (is.good())
|
||||||
{
|
{
|
||||||
// Read line and get first word. If end of file break since
|
// Read line and get first word. If end of file break since
|
||||||
// patch should always end with 'kids' command ?not sure.
|
// region should always end with 'kids' command ?not sure.
|
||||||
if (!readCmd(is, cmd, args))
|
if (!readCmd(is, cmd, args))
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"fileFormats::AC3DsurfaceFormat::read(const fileName&)"
|
"fileFormats::AC3DsurfaceFormat::read(const fileName&)"
|
||||||
)
|
)
|
||||||
<< "Did not read up to \"kids 0\" while reading patch "
|
<< "Did not read up to \"kids 0\" while reading region "
|
||||||
<< patchI << " from file " << filename
|
<< regionI << " from file " << filename
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
|
|||||||
string str = parse<string>(args);
|
string str = parse<string>(args);
|
||||||
string::stripInvalid<word>(str);
|
string::stripInvalid<word>(str);
|
||||||
|
|
||||||
names[patchI] = str;
|
names[regionI] = str;
|
||||||
}
|
}
|
||||||
else if (cmd == "rot")
|
else if (cmd == "rot")
|
||||||
{
|
{
|
||||||
@ -164,7 +164,7 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
|
|||||||
)
|
)
|
||||||
<< "rot (rotation tensor) command not implemented"
|
<< "rot (rotation tensor) command not implemented"
|
||||||
<< "Line:" << cmd << ' ' << args << endl
|
<< "Line:" << cmd << ' ' << args << endl
|
||||||
<< "while reading patch " << patchI << endl;
|
<< "while reading region " << regionI << endl;
|
||||||
}
|
}
|
||||||
else if (cmd == "loc")
|
else if (cmd == "loc")
|
||||||
{
|
{
|
||||||
@ -179,9 +179,9 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
|
|||||||
else if (cmd == "numvert")
|
else if (cmd == "numvert")
|
||||||
{
|
{
|
||||||
// numvert %d
|
// numvert %d
|
||||||
nPatchPoints = parse<int>(args);
|
nRegionPoints = parse<int>(args);
|
||||||
|
|
||||||
for (label vertI = 0; vertI < nPatchPoints; ++vertI)
|
for (label vertI = 0; vertI < nRegionPoints; ++vertI)
|
||||||
{
|
{
|
||||||
is.getLine(line);
|
is.getLine(line);
|
||||||
IStringStream lineStream(line);
|
IStringStream lineStream(line);
|
||||||
@ -202,8 +202,8 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
|
|||||||
{
|
{
|
||||||
static string errorMsg =
|
static string errorMsg =
|
||||||
string(" while reading face ")
|
string(" while reading face ")
|
||||||
+ Foam::name(faceI) + " on patch "
|
+ Foam::name(faceI) + " on region "
|
||||||
+ Foam::name(patchI)
|
+ Foam::name(regionI)
|
||||||
+ " from file " + filename;
|
+ " from file " + filename;
|
||||||
|
|
||||||
cueToOrDie(is, "SURF", errorMsg);
|
cueToOrDie(is, "SURF", errorMsg);
|
||||||
@ -216,7 +216,7 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
|
|||||||
forAll(verts, vertI)
|
forAll(verts, vertI)
|
||||||
{
|
{
|
||||||
is.getLine(line);
|
is.getLine(line);
|
||||||
verts[vertI] = parse<int>(line) + patchVertOffset;
|
verts[vertI] = parse<int>(line) + vertexOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
UList<label>& f = static_cast<UList<label>&>(verts);
|
UList<label>& f = static_cast<UList<label>&>(verts);
|
||||||
@ -230,23 +230,23 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
|
|||||||
label fp2 = (fp1 + 1) % f.size();
|
label fp2 = (fp1 + 1) % f.size();
|
||||||
|
|
||||||
dynFaces.append(triFace(f[0], f[fp1], f[fp2]));
|
dynFaces.append(triFace(f[0], f[fp1], f[fp2]));
|
||||||
sizes[patchI]++;
|
sizes[regionI]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dynFaces.append(Face(f));
|
dynFaces.append(Face(f));
|
||||||
sizes[patchI]++;
|
sizes[regionI]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done the current patch.
|
// Done the current region.
|
||||||
// Increment the offset vertices are stored at
|
// Increment the offset vertices are stored at
|
||||||
patchVertOffset += nPatchPoints;
|
vertexOffset += nRegionPoints;
|
||||||
}
|
}
|
||||||
else if (cmd == "kids")
|
else if (cmd == "kids")
|
||||||
{
|
{
|
||||||
// 'kids' denotes the end of the current patch.
|
// 'kids' denotes the end of the current region.
|
||||||
label nKids = parse<int>(args);
|
label nKids = parse<int>(args);
|
||||||
|
|
||||||
if (nKids != 0)
|
if (nKids != 0)
|
||||||
@ -257,11 +257,11 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
|
|||||||
)
|
)
|
||||||
<< "Can only read objects without kids."
|
<< "Can only read objects without kids."
|
||||||
<< " Encountered " << nKids << " kids when"
|
<< " Encountered " << nKids << " kids when"
|
||||||
<< " reading patch " << patchI
|
<< " reading region " << regionI
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done reading current patch
|
// Done reading current region
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -271,8 +271,8 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
|
|||||||
this->storedPoints().transfer(dynPoints);
|
this->storedPoints().transfer(dynPoints);
|
||||||
this->storedFaces().transfer(dynFaces);
|
this->storedFaces().transfer(dynFaces);
|
||||||
|
|
||||||
// add patches, culling empty groups
|
// add regions, culling empty ones
|
||||||
this->addPatches(sizes, names, true);
|
this->addRegions(sizes, names, true);
|
||||||
this->stitchFaces(SMALL);
|
this->stitchFaces(SMALL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -287,16 +287,16 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write
|
|||||||
{
|
{
|
||||||
const pointField& pointLst = surf.points();
|
const pointField& pointLst = surf.points();
|
||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
const List<surfGroup>& patchLst = surf.patches();
|
const List<surfRegion>& regionLst = surf.regions();
|
||||||
|
|
||||||
writeHeader(os, patchLst);
|
writeHeader(os, regionLst);
|
||||||
|
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
const surfGroup& p = patchLst[patchI];
|
const surfRegion& reg = regionLst[regionI];
|
||||||
|
|
||||||
os << "OBJECT poly" << nl
|
os << "OBJECT poly" << nl
|
||||||
<< "name \"" << p.name() << '"' << endl;
|
<< "name \"" << reg.name() << '"' << endl;
|
||||||
|
|
||||||
// Temporary PrimitivePatch to calculate compact points & faces
|
// Temporary PrimitivePatch to calculate compact points & faces
|
||||||
// use 'UList' to avoid allocations!
|
// use 'UList' to avoid allocations!
|
||||||
@ -317,12 +317,12 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write
|
|||||||
|
|
||||||
os << "numsurf " << patch.localFaces().size() << endl;
|
os << "numsurf " << patch.localFaces().size() << endl;
|
||||||
|
|
||||||
forAll(patch.localFaces(), faceI)
|
forAll(patch.localFaces(), localFaceI)
|
||||||
{
|
{
|
||||||
const Face& f = patch.localFaces()[faceI];
|
const Face& f = patch.localFaces()[localFaceI];
|
||||||
|
|
||||||
os << "SURF 0x20" << nl // polygon
|
os << "SURF 0x20" << nl // polygon
|
||||||
<< "mat " << patchI << nl
|
<< "mat " << regionI << nl
|
||||||
<< "refs " << f.size() << nl;
|
<< "refs " << f.size() << nl;
|
||||||
|
|
||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
@ -344,25 +344,25 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
labelList faceMap;
|
labelList faceMap;
|
||||||
List<surfGroup> patchLst = surf.sortedRegions(faceMap);
|
List<surfRegion> regionLst = surf.sortedRegions(faceMap);
|
||||||
|
|
||||||
writeHeader(os, patchLst);
|
writeHeader(os, regionLst);
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
const surfGroup& p = patchLst[patchI];
|
const surfRegion& reg = regionLst[regionI];
|
||||||
|
|
||||||
os << "OBJECT poly" << nl
|
os << "OBJECT poly" << nl
|
||||||
<< "name \"" << p.name() << '"' << endl;
|
<< "name \"" << reg.name() << '"' << endl;
|
||||||
|
|
||||||
// Create patch with only patch faces included for ease of addressing
|
// Create region with only region faces included for ease of addressing
|
||||||
boolList include(surf.size(), false);
|
labelHashSet include(surf.size());
|
||||||
|
|
||||||
forAll(p, patchFaceI)
|
forAll(reg, localFaceI)
|
||||||
{
|
{
|
||||||
const label faceI = faceMap[faceIndex++];
|
const label faceI = faceMap[faceIndex++];
|
||||||
include[faceI] = true;
|
include.insert(faceI);
|
||||||
}
|
}
|
||||||
|
|
||||||
UnsortedMeshedSurface<Face> subm = surf.subsetMesh(include);
|
UnsortedMeshedSurface<Face> subm = surf.subsetMesh(include);
|
||||||
@ -379,12 +379,12 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write
|
|||||||
|
|
||||||
os << "numsurf " << subm.localFaces().size() << endl;
|
os << "numsurf " << subm.localFaces().size() << endl;
|
||||||
|
|
||||||
forAll(subm.localFaces(), faceI)
|
forAll(subm.localFaces(), localFaceI)
|
||||||
{
|
{
|
||||||
const Face& f = subm.localFaces()[faceI];
|
const Face& f = subm.localFaces()[localFaceI];
|
||||||
|
|
||||||
os << "SURF 0x20" << nl // polygon
|
os << "SURF 0x20" << nl // polygon
|
||||||
<< "mat " << patchI << nl
|
<< "mat " << regionI << nl
|
||||||
<< "refs " << f.size() << nl;
|
<< "refs " << f.size() << nl;
|
||||||
|
|
||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
|
|||||||
@ -31,7 +31,7 @@ Description
|
|||||||
http://www.inivis.com/ac3d/man/ac3dfileformat.html
|
http://www.inivis.com/ac3d/man/ac3dfileformat.html
|
||||||
|
|
||||||
Note
|
Note
|
||||||
The faces are already organized as patches.
|
The faces are already organized as regions.
|
||||||
The output is always sorted by regions.
|
The output is always sorted by regions.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
|
|||||||
@ -116,12 +116,12 @@ Foam::string Foam::fileFormats::AC3DsurfaceFormatCore::cueToOrDie
|
|||||||
void Foam::fileFormats::AC3DsurfaceFormatCore::writeHeader
|
void Foam::fileFormats::AC3DsurfaceFormatCore::writeHeader
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const List<surfGroup>& patchLst
|
const UList<surfRegion>& regionLst
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Write with patches as separate objects under "world" object.
|
// Write with regions as separate objects under "world" object.
|
||||||
// Header is taken over from sample file.
|
// Header is taken over from sample file.
|
||||||
// Defines separate materials for all patches. Recycle colours.
|
// Defines separate materials for all regions. Recycle colours.
|
||||||
|
|
||||||
// Define 8 standard colours as r,g,b components
|
// Define 8 standard colours as r,g,b components
|
||||||
static scalar colourMap[] =
|
static scalar colourMap[] =
|
||||||
@ -139,14 +139,12 @@ void Foam::fileFormats::AC3DsurfaceFormatCore::writeHeader
|
|||||||
// Write header. Define materials.
|
// Write header. Define materials.
|
||||||
os << "AC3Db" << nl;
|
os << "AC3Db" << nl;
|
||||||
|
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
const word& pName = patchLst[patchI].name();
|
label colourI = regionI % 8;
|
||||||
|
|
||||||
label colourI = patchI % 8;
|
|
||||||
label colourCompI = 3 * colourI;
|
label colourCompI = 3 * colourI;
|
||||||
|
|
||||||
os << "MATERIAL \"" << pName << "Mat\" rgb "
|
os << "MATERIAL \"" << regionLst[regionI].name() << "Mat\" rgb "
|
||||||
<< colourMap[colourCompI] << ' ' << colourMap[colourCompI+1]
|
<< colourMap[colourCompI] << ' ' << colourMap[colourCompI+1]
|
||||||
<< ' ' << colourMap[colourCompI+2]
|
<< ' ' << colourMap[colourCompI+2]
|
||||||
<< " amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10"
|
<< " amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10"
|
||||||
@ -155,7 +153,7 @@ void Foam::fileFormats::AC3DsurfaceFormatCore::writeHeader
|
|||||||
}
|
}
|
||||||
|
|
||||||
os << "OBJECT world" << nl
|
os << "OBJECT world" << nl
|
||||||
<< "kids " << patchLst.size() << endl;
|
<< "kids " << regionLst.size() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -77,7 +77,7 @@ protected:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Write header with materials
|
//- Write header with materials
|
||||||
static void writeHeader(Ostream&, const List<surfGroup>&);
|
static void writeHeader(Ostream&, const UList<surfRegion>&);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -63,40 +63,40 @@ bool Foam::fileFormats::FTRsurfaceFormat<Face>::read
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ftrPatch> readPatches(is);
|
List<ftrPatch> ftrPatches(is);
|
||||||
|
|
||||||
// read points directly
|
// read points directly
|
||||||
is >> this->storedPoints();
|
is >> this->storedPoints();
|
||||||
|
|
||||||
// read faces with keys
|
// faces read with keys
|
||||||
List<Keyed<triFace> > readFaces(is);
|
List<Keyed<triFace> > facesRead(is);
|
||||||
|
|
||||||
List<Face> faceLst(readFaces.size());
|
List<Face> faceLst(facesRead.size());
|
||||||
List<label> regionLst(readFaces.size());
|
List<label> regionIds(facesRead.size());
|
||||||
|
|
||||||
// disentangle faces/keys - already triangulated
|
// disentangle faces/keys - already triangulated
|
||||||
forAll(readFaces, faceI)
|
forAll(facesRead, faceI)
|
||||||
{
|
{
|
||||||
// unfortunately cannot transfer to save memory
|
// unfortunately cannot transfer to save memory
|
||||||
faceLst[faceI] = readFaces[faceI];
|
faceLst[faceI] = facesRead[faceI];
|
||||||
regionLst[faceI] = readFaces[faceI].key();
|
regionIds[faceI] = facesRead[faceI].key();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->storedFaces().transfer(faceLst);
|
this->storedFaces().transfer(faceLst);
|
||||||
this->storedRegions().transfer(regionLst);
|
this->storedRegionIds().transfer(regionIds);
|
||||||
|
|
||||||
// cast ftrPatch into new form
|
// change ftrPatch into surfRegionIdentifier
|
||||||
List<surfPatchIdentifier> newPatches(readPatches.size());
|
List<surfRegionIdentifier> newRegions(ftrPatches.size());
|
||||||
forAll(newPatches, patchI)
|
forAll(newRegions, regionI)
|
||||||
{
|
{
|
||||||
newPatches[patchI] = surfPatchIdentifier
|
newRegions[regionI] = surfRegionIdentifier
|
||||||
(
|
(
|
||||||
readPatches[patchI].name(),
|
ftrPatches[regionI].name(),
|
||||||
patchI
|
regionI
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->storedPatches().transfer(newPatches);
|
this->storedRegionToc().transfer(newRegions);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -82,11 +82,11 @@ bool Foam::fileFormats::GTSsurfaceFormat<Face>::read
|
|||||||
// write directly into the lists:
|
// write directly into the lists:
|
||||||
pointField& pointLst = this->storedPoints();
|
pointField& pointLst = this->storedPoints();
|
||||||
List<Face>& faceLst = this->storedFaces();
|
List<Face>& faceLst = this->storedFaces();
|
||||||
List<label>& regionLst = this->storedRegions();
|
List<label>& regionIds = this->storedRegionIds();
|
||||||
|
|
||||||
pointLst.setSize(nPoints);
|
pointLst.setSize(nPoints);
|
||||||
faceLst.setSize(nElems);
|
faceLst.setSize(nElems);
|
||||||
regionLst.setSize(nElems);
|
regionIds.setSize(nElems);
|
||||||
|
|
||||||
// Read points
|
// Read points
|
||||||
forAll(pointLst, pointI)
|
forAll(pointLst, pointI)
|
||||||
@ -118,7 +118,7 @@ bool Foam::fileFormats::GTSsurfaceFormat<Face>::read
|
|||||||
|
|
||||||
|
|
||||||
// Read triangles. Convert references to edges into pointlabels
|
// Read triangles. Convert references to edges into pointlabels
|
||||||
label maxPatch = 0;
|
label maxRegion = 0;
|
||||||
forAll(faceLst, faceI)
|
forAll(faceLst, faceI)
|
||||||
{
|
{
|
||||||
label e0Label, e1Label, e2Label;
|
label e0Label, e1Label, e2Label;
|
||||||
@ -138,9 +138,9 @@ bool Foam::fileFormats::GTSsurfaceFormat<Face>::read
|
|||||||
if (!lineStream.bad())
|
if (!lineStream.bad())
|
||||||
{
|
{
|
||||||
regionI = num;
|
regionI = num;
|
||||||
if (maxPatch < regionI)
|
if (maxRegion < regionI)
|
||||||
{
|
{
|
||||||
maxPatch = regionI;
|
maxRegion = regionI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,21 +202,21 @@ bool Foam::fileFormats::GTSsurfaceFormat<Face>::read
|
|||||||
}
|
}
|
||||||
|
|
||||||
faceLst[faceI] = triFace(e0Far, common01, e1Far);
|
faceLst[faceI] = triFace(e0Far, common01, e1Far);
|
||||||
regionLst[faceI] = regionI;
|
regionIds[faceI] = regionI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<surfPatchIdentifier> newPatches(maxPatch+1);
|
List<surfRegionIdentifier> newRegions(maxRegion+1);
|
||||||
forAll(newPatches, patchI)
|
forAll(newRegions, regionI)
|
||||||
{
|
{
|
||||||
newPatches[patchI] = surfPatchIdentifier
|
newRegions[regionI] = surfRegionIdentifier
|
||||||
(
|
(
|
||||||
"patch" + ::Foam::name(patchI),
|
"region" + ::Foam::name(regionI),
|
||||||
patchI
|
regionI
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->storedPatches().transfer(newPatches);
|
this->storedRegionToc().transfer(newRegions);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,13 +230,12 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
|||||||
{
|
{
|
||||||
const pointField& pointLst = surf.points();
|
const pointField& pointLst = surf.points();
|
||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
const List<surfGroup>& patchLst = surf.patches();
|
const List<surfRegion>& regionLst = surf.regions();
|
||||||
|
|
||||||
|
|
||||||
// check if output triangulation would be required
|
// check if output triangulation would be required
|
||||||
// It is too annoying to triangulate on-the-fly
|
// It is too annoying to triangulate on-the-fly
|
||||||
// just issue a warning and get out
|
// just issue a warning and get out
|
||||||
//
|
|
||||||
if (!surf.isTri())
|
if (!surf.isTri())
|
||||||
{
|
{
|
||||||
label nNonTris = 0;
|
label nNonTris = 0;
|
||||||
@ -261,14 +260,14 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write header, print patch names as comment
|
// Write header, print region names as comment
|
||||||
os << "# GTS file" << nl
|
os << "# GTS file" << nl
|
||||||
<< "# Regions:" << nl;
|
<< "# Regions:" << nl;
|
||||||
|
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
os << "# " << patchI << " "
|
os << "# " << regionI << " "
|
||||||
<< patchLst[patchI].name() << nl;
|
<< regionLst[regionI].name() << nl;
|
||||||
}
|
}
|
||||||
os << "#" << endl;
|
os << "#" << endl;
|
||||||
|
|
||||||
@ -301,18 +300,18 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
|||||||
const labelListList& faceEs = surf.faceEdges();
|
const labelListList& faceEs = surf.faceEdges();
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
const surfGroup& patch = patchLst[patchI];
|
const surfRegion& reg = regionLst[regionI];
|
||||||
|
|
||||||
forAll(patch, patchFaceI)
|
forAll(reg, localFaceI)
|
||||||
{
|
{
|
||||||
const labelList& fEdges = faceEs[faceIndex++];
|
const labelList& fEdges = faceEs[faceIndex++];
|
||||||
|
|
||||||
os << fEdges[0] + 1 << ' '
|
os << fEdges[0] + 1 << ' '
|
||||||
<< fEdges[1] + 1 << ' '
|
<< fEdges[1] + 1 << ' '
|
||||||
<< fEdges[2] + 1 << ' '
|
<< fEdges[2] + 1 << ' '
|
||||||
<< patchI << endl;
|
<< regionI << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,8 +326,8 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
|||||||
{
|
{
|
||||||
const pointField& pointLst = surf.points();
|
const pointField& pointLst = surf.points();
|
||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
const List<label>& regionLst = surf.regions();
|
const List<label>& regionIds = surf.regionIds();
|
||||||
const List<surfPatchIdentifier>& patchInfo = surf.patches();
|
const List<surfRegionIdentifier>& regionToc = surf.regionToc();
|
||||||
|
|
||||||
// check if output triangulation would be required
|
// check if output triangulation would be required
|
||||||
// It is too annoying to triangulate on-the-fly
|
// It is too annoying to triangulate on-the-fly
|
||||||
@ -357,18 +356,14 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
labelList faceMap;
|
// Write header, print region names as comment
|
||||||
List<surfGroup> patchLst = surf.sortedRegions(faceMap);
|
|
||||||
|
|
||||||
|
|
||||||
// Write header, print patch names as comment
|
|
||||||
os << "# GTS file" << nl
|
os << "# GTS file" << nl
|
||||||
<< "# Regions:" << nl;
|
<< "# Regions:" << nl;
|
||||||
|
|
||||||
forAll(patchInfo, patchI)
|
forAll(regionToc, regionI)
|
||||||
{
|
{
|
||||||
os << "# " << patchI << " "
|
os << "# " << regionI << " "
|
||||||
<< patchInfo[patchI].name() << nl;
|
<< regionToc[regionI].name() << nl;
|
||||||
}
|
}
|
||||||
os << "#" << endl;
|
os << "#" << endl;
|
||||||
|
|
||||||
@ -409,7 +404,7 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
|||||||
os << fEdges[0] + 1 << ' '
|
os << fEdges[0] + 1 << ' '
|
||||||
<< fEdges[1] + 1 << ' '
|
<< fEdges[1] + 1 << ' '
|
||||||
<< fEdges[2] + 1 << ' '
|
<< fEdges[2] + 1 << ' '
|
||||||
<< regionLst[faceI] << endl;
|
<< regionIds[faceI] << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Provide a means of reading/writing GTS format.
|
Provide a means of reading/writing GTS format.
|
||||||
The output is never sorted by patch.
|
The output is never sorted by region.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
GTSsurfaceFormat.C
|
GTSsurfaceFormat.C
|
||||||
|
|||||||
@ -85,7 +85,7 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
|||||||
// Ansa tags. Denoted by $ANSA_NAME.
|
// Ansa tags. Denoted by $ANSA_NAME.
|
||||||
// These will appear just before the first use of a type.
|
// These will appear just before the first use of a type.
|
||||||
// We read them and store the PSHELL types which are used to name
|
// We read them and store the PSHELL types which are used to name
|
||||||
// the patches.
|
// the regions.
|
||||||
label ansaId = -1;
|
label ansaId = -1;
|
||||||
word ansaType, ansaName;
|
word ansaType, ansaName;
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
|||||||
fTri[1] = readLabel(IStringStream(line.substr(32,8))());
|
fTri[1] = readLabel(IStringStream(line.substr(32,8))());
|
||||||
fTri[2] = readLabel(IStringStream(line.substr(40,8))());
|
fTri[2] = readLabel(IStringStream(line.substr(40,8))());
|
||||||
|
|
||||||
// Convert groupID into patchID
|
// Convert groupID into regionId
|
||||||
Map<label>::const_iterator fnd = lookup.find(groupId);
|
Map<label>::const_iterator fnd = lookup.find(groupId);
|
||||||
if (fnd != lookup.end())
|
if (fnd != lookup.end())
|
||||||
{
|
{
|
||||||
@ -227,7 +227,7 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
|||||||
regionI = dynSizes.size();
|
regionI = dynSizes.size();
|
||||||
lookup.insert(groupId, regionI);
|
lookup.insert(groupId, regionI);
|
||||||
dynSizes.append(0);
|
dynSizes.append(0);
|
||||||
// Info<< "patch" << regionI << " => group " << groupId <<endl;
|
// Info<< "region" << regionI << " => group " << groupId <<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynFaces.append(fTri);
|
dynFaces.append(fTri);
|
||||||
@ -245,7 +245,7 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
|||||||
fQuad[2] = readLabel(IStringStream(line.substr(40,8))());
|
fQuad[2] = readLabel(IStringStream(line.substr(40,8))());
|
||||||
fQuad[3] = readLabel(IStringStream(line.substr(48,8))());
|
fQuad[3] = readLabel(IStringStream(line.substr(48,8))());
|
||||||
|
|
||||||
// Convert groupID into patchID
|
// Convert groupID into regionId
|
||||||
Map<label>::const_iterator fnd = lookup.find(groupId);
|
Map<label>::const_iterator fnd = lookup.find(groupId);
|
||||||
if (fnd != lookup.end())
|
if (fnd != lookup.end())
|
||||||
{
|
{
|
||||||
@ -261,7 +261,7 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
|||||||
regionI = dynSizes.size();
|
regionI = dynSizes.size();
|
||||||
lookup.insert(groupId, regionI);
|
lookup.insert(groupId, regionI);
|
||||||
dynSizes.append(0);
|
dynSizes.append(0);
|
||||||
// Info<< "patch" << regionI << " => group " << groupId <<endl;
|
// Info<< "region" << regionI << " => group " << groupId <<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
|||||||
}
|
}
|
||||||
else if (cmd == "PSHELL")
|
else if (cmd == "PSHELL")
|
||||||
{
|
{
|
||||||
// pshell type for patch names with the Ansa extension
|
// pshell type for region names with the Ansa extension
|
||||||
label groupId = readLabel(IStringStream(line.substr(8,8))());
|
label groupId = readLabel(IStringStream(line.substr(8,8))());
|
||||||
|
|
||||||
if (groupId == ansaId && ansaType == "PSHELL")
|
if (groupId == ansaId && ansaType == "PSHELL")
|
||||||
@ -370,29 +370,29 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
|||||||
mapPointId.clear();
|
mapPointId.clear();
|
||||||
|
|
||||||
|
|
||||||
// create default patch names, or from ANSA/Hypermesh information
|
// create default region names, or from ANSA/Hypermesh information
|
||||||
List<word> names(dynSizes.size());
|
List<word> names(dynSizes.size());
|
||||||
forAllConstIter(Map<label>, lookup, iter)
|
forAllConstIter(Map<label>, lookup, iter)
|
||||||
{
|
{
|
||||||
const label patchI = iter();
|
const label regionI = iter();
|
||||||
const label groupI = iter.key();
|
const label groupI = iter.key();
|
||||||
|
|
||||||
Map<word>::const_iterator fnd = nameLookup.find(groupI);
|
Map<word>::const_iterator fnd = nameLookup.find(groupI);
|
||||||
if (fnd != nameLookup.end())
|
if (fnd != nameLookup.end())
|
||||||
{
|
{
|
||||||
names[patchI] = fnd();
|
names[regionI] = fnd();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
names[patchI] = word("patch") + ::Foam::name(patchI);
|
names[regionI] = word("region") + ::Foam::name(regionI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sortFacesAndStore(dynFaces.xfer(), dynRegions.xfer(), sorted);
|
sortFacesAndStore(dynFaces.xfer(), dynRegions.xfer(), sorted);
|
||||||
|
|
||||||
// add patches, culling empty groups
|
// add regions, culling empty ones
|
||||||
this->addPatches(dynSizes, names, true);
|
this->addRegions(dynSizes, names, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ Description
|
|||||||
Nastran surface reader.
|
Nastran surface reader.
|
||||||
|
|
||||||
- Uses the Ansa "$ANSA_NAME" or the Hypermesh "$HMNAME COMP" extensions
|
- Uses the Ansa "$ANSA_NAME" or the Hypermesh "$HMNAME COMP" extensions
|
||||||
to obtain patch names.
|
to obtain region names.
|
||||||
- Handles Nastran short and long formats, but not free format.
|
- Handles Nastran short and long formats, but not free format.
|
||||||
- Properly handles the Nastran compact floating point notation: \n
|
- Properly handles the Nastran compact floating point notation: \n
|
||||||
@verbatim
|
@verbatim
|
||||||
|
|||||||
@ -75,10 +75,10 @@ bool Foam::fileFormats::OBJsurfaceFormat<Face>::read
|
|||||||
DynamicList<label> dynSizes;
|
DynamicList<label> dynSizes;
|
||||||
HashTable<label> lookup;
|
HashTable<label> lookup;
|
||||||
|
|
||||||
// place faces without a group in patch0
|
// place faces without a group in region0
|
||||||
label regionI = 0;
|
label regionI = 0;
|
||||||
lookup.insert("patch0", regionI);
|
lookup.insert("region0", regionI);
|
||||||
dynNames.append("patch0");
|
dynNames.append("region0");
|
||||||
dynSizes.append(0);
|
dynSizes.append(0);
|
||||||
|
|
||||||
while (is.good())
|
while (is.good())
|
||||||
@ -204,8 +204,8 @@ bool Foam::fileFormats::OBJsurfaceFormat<Face>::read
|
|||||||
|
|
||||||
sortFacesAndStore(dynFaces.xfer(), dynRegions.xfer(), sorted);
|
sortFacesAndStore(dynFaces.xfer(), dynRegions.xfer(), sorted);
|
||||||
|
|
||||||
// add patches, culling empty groups
|
// add regions, culling empty ones
|
||||||
this->addPatches(dynSizes, dynNames, true);
|
this->addRegions(dynSizes, dynNames, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,18 +218,18 @@ void Foam::fileFormats::OBJsurfaceFormat<Face>::write
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
const List<surfGroup>& patchLst = surf.patches();
|
const List<surfRegion>& regionLst = surf.regions();
|
||||||
|
|
||||||
writeHeader(os, surf.points(), faceLst.size(), patchLst);
|
writeHeader(os, surf.points(), faceLst.size(), regionLst);
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
const surfGroup& patch = patchLst[patchI];
|
const surfRegion& reg = regionLst[regionI];
|
||||||
|
|
||||||
os << "g " << patch.name() << endl;
|
os << "g " << reg.name() << endl;
|
||||||
|
|
||||||
forAll(patch, patchFaceI)
|
forAll(reg, localFaceI)
|
||||||
{
|
{
|
||||||
const Face& f = faceLst[faceIndex++];
|
const Face& f = faceLst[faceIndex++];
|
||||||
|
|
||||||
@ -255,19 +255,19 @@ void Foam::fileFormats::OBJsurfaceFormat<Face>::write
|
|||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
|
|
||||||
labelList faceMap;
|
labelList faceMap;
|
||||||
List<surfGroup> patchLst = surf.sortedRegions(faceMap);
|
List<surfRegion> regionLst = surf.sortedRegions(faceMap);
|
||||||
|
|
||||||
writeHeader(os, surf.points(), faceLst.size(), patchLst);
|
writeHeader(os, surf.points(), faceLst.size(), regionLst);
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
// Print all faces belonging to this region
|
// Print all faces belonging to this region
|
||||||
const surfGroup& patch = patchLst[patchI];
|
const surfRegion& reg = regionLst[regionI];
|
||||||
|
|
||||||
os << "g " << patch.name() << endl;
|
os << "g " << reg.name() << endl;
|
||||||
|
|
||||||
forAll(patch, patchFaceI)
|
forAll(reg, localFaceI)
|
||||||
{
|
{
|
||||||
const Face& f = faceLst[faceMap[faceIndex++]];
|
const Face& f = faceLst[faceMap[faceIndex++]];
|
||||||
|
|
||||||
|
|||||||
@ -63,14 +63,6 @@ class OBJsurfaceFormat
|
|||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
static void writeHead
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const pointField&,
|
|
||||||
const List<Face>&,
|
|
||||||
const List<surfGroup>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
OBJsurfaceFormat(const OBJsurfaceFormat<Face>&);
|
OBJsurfaceFormat(const OBJsurfaceFormat<Face>&);
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ void Foam::fileFormats::OBJsurfaceFormatCore::writeHeader
|
|||||||
Ostream& os,
|
Ostream& os,
|
||||||
const pointField& pointLst,
|
const pointField& pointLst,
|
||||||
const label nFaces,
|
const label nFaces,
|
||||||
const List<surfGroup>& patchLst
|
const UList<surfRegion>& regionLst
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
os << "# Wavefront OBJ file written " << clock::dateTime().c_str() << nl
|
os << "# Wavefront OBJ file written " << clock::dateTime().c_str() << nl
|
||||||
@ -44,13 +44,13 @@ void Foam::fileFormats::OBJsurfaceFormatCore::writeHeader
|
|||||||
<< nl
|
<< nl
|
||||||
<< "# points : " << pointLst.size() << nl
|
<< "# points : " << pointLst.size() << nl
|
||||||
<< "# faces : " << nFaces << nl
|
<< "# faces : " << nFaces << nl
|
||||||
<< "# patches: " << patchLst.size() << nl;
|
<< "# region : " << regionLst.size() << nl;
|
||||||
|
|
||||||
// Print patch names as comment
|
// Print region names as comment
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
os << "# " << patchI << " " << patchLst[patchI].name()
|
os << "# " << regionI << " " << regionLst[regionI].name()
|
||||||
<< " (nFaces: " << patchLst[patchI].size() << ")" << nl;
|
<< " (nFaces: " << regionLst[regionI].size() << ")" << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
os << nl
|
os << nl
|
||||||
|
|||||||
@ -63,7 +63,7 @@ protected:
|
|||||||
Ostream&,
|
Ostream&,
|
||||||
const pointField&,
|
const pointField&,
|
||||||
const label nFaces,
|
const label nFaces,
|
||||||
const List<surfGroup>&
|
const UList<surfRegion>&
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -146,7 +146,7 @@ bool Foam::fileFormats::OFFsurfaceFormat<Face>::read
|
|||||||
reset(pointLst.xfer(), dynFaces.xfer());
|
reset(pointLst.xfer(), dynFaces.xfer());
|
||||||
|
|
||||||
// no region information
|
// no region information
|
||||||
this->onePatch();
|
this->oneRegion();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,16 +161,16 @@ void Foam::fileFormats::OFFsurfaceFormat<Face>::write
|
|||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
|
|
||||||
labelList faceMap;
|
labelList faceMap;
|
||||||
List<surfGroup> patchLst = surf.sortedRegions(faceMap);
|
List<surfRegion> regionLst = surf.sortedRegions(faceMap);
|
||||||
|
|
||||||
writeHeader(os, surf.points(), faceLst.size(), patchLst);
|
writeHeader(os, surf.points(), faceLst.size(), regionLst);
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
os << "# <patch name=\"" << patchLst[patchI].name() << "\">" << endl;
|
os << "# <region name=\"" << regionLst[regionI].name() << "\">" << endl;
|
||||||
|
|
||||||
forAll(patchLst[patchI], patchFaceI)
|
forAll(regionLst[regionI], localFaceI)
|
||||||
{
|
{
|
||||||
const Face& f = faceLst[faceMap[faceIndex++]];
|
const Face& f = faceLst[faceMap[faceIndex++]];
|
||||||
|
|
||||||
@ -181,9 +181,9 @@ void Foam::fileFormats::OFFsurfaceFormat<Face>::write
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add optional region information
|
// add optional region information
|
||||||
os << ' ' << patchI << endl;
|
os << ' ' << regionI << endl;
|
||||||
}
|
}
|
||||||
os << "# </patch>" << endl;
|
os << "# </region>" << endl;
|
||||||
}
|
}
|
||||||
os << "# </faces>" << endl;
|
os << "# </faces>" << endl;
|
||||||
}
|
}
|
||||||
@ -197,16 +197,16 @@ void Foam::fileFormats::OFFsurfaceFormat<Face>::write
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
const List<surfGroup>& patchLst = surf.patches();
|
const List<surfRegion>& regionLst = surf.regions();
|
||||||
|
|
||||||
writeHeader(os, surf.points(), faceLst.size(), patchLst);
|
writeHeader(os, surf.points(), faceLst.size(), regionLst);
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
os << "# <patch name=\"" << patchLst[patchI].name() << "\">" << endl;
|
os << "# <region name=\"" << regionLst[regionI].name() << "\">" << endl;
|
||||||
|
|
||||||
forAll(patchLst[patchI], patchFaceI)
|
forAll(regionLst[regionI], localFaceI)
|
||||||
{
|
{
|
||||||
const Face& f = faceLst[faceIndex++];
|
const Face& f = faceLst[faceIndex++];
|
||||||
|
|
||||||
@ -217,9 +217,9 @@ void Foam::fileFormats::OFFsurfaceFormat<Face>::write
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add optional region information
|
// add optional region information
|
||||||
os << ' ' << patchI << endl;
|
os << ' ' << regionI << endl;
|
||||||
}
|
}
|
||||||
os << "# </patch>" << endl;
|
os << "# </region>" << endl;
|
||||||
}
|
}
|
||||||
os << "# </faces>" << endl;
|
os << "# </faces>" << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,14 +71,6 @@ class OFFsurfaceFormat
|
|||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
static void writeHead
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const pointField&,
|
|
||||||
const List<Face>&,
|
|
||||||
const List<surfGroup>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
OFFsurfaceFormat(const OFFsurfaceFormat&);
|
OFFsurfaceFormat(const OFFsurfaceFormat&);
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ void Foam::fileFormats::OFFsurfaceFormatCore::writeHeader
|
|||||||
Ostream& os,
|
Ostream& os,
|
||||||
const pointField& pointLst,
|
const pointField& pointLst,
|
||||||
const label nFaces,
|
const label nFaces,
|
||||||
const List<surfGroup>& patchLst
|
const UList<surfRegion>& regionLst
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Write header
|
// Write header
|
||||||
@ -43,13 +43,13 @@ void Foam::fileFormats::OFFsurfaceFormatCore::writeHeader
|
|||||||
<< nl
|
<< nl
|
||||||
<< "# points : " << pointLst.size() << nl
|
<< "# points : " << pointLst.size() << nl
|
||||||
<< "# faces : " << nFaces << nl
|
<< "# faces : " << nFaces << nl
|
||||||
<< "# patches: " << patchLst.size() << nl;
|
<< "# regions: " << regionLst.size() << nl;
|
||||||
|
|
||||||
// Print patch names as comment
|
// Print region names as comment
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
os << "# " << patchI << " " << patchLst[patchI].name()
|
os << "# " << regionI << " " << regionLst[regionI].name()
|
||||||
<< " (nFaces: " << patchLst[patchI].size() << ")" << nl;
|
<< " (nFaces: " << regionLst[regionI].size() << ")" << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
os << nl
|
os << nl
|
||||||
|
|||||||
@ -63,7 +63,7 @@ protected:
|
|||||||
Ostream&,
|
Ostream&,
|
||||||
const pointField&,
|
const pointField&,
|
||||||
const label nFaces,
|
const label nFaces,
|
||||||
const List<surfGroup>&
|
const UList<surfRegion>&
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -46,14 +46,14 @@ void Foam::fileFormats::SMESHsurfaceFormat<Face>::write
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
const List<surfGroup>& patchLst = surf.patches();
|
const List<surfRegion>& regionLst = surf.regions();
|
||||||
|
|
||||||
writeHeader(os, surf.points(), faceLst.size());
|
writeHeader(os, surf.points(), faceLst.size());
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
forAll(patchLst[patchI], patchFaceI)
|
forAll(regionLst[regionI], localFaceI)
|
||||||
{
|
{
|
||||||
const Face& f = faceLst[faceIndex++];
|
const Face& f = faceLst[faceIndex++];
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ void Foam::fileFormats::SMESHsurfaceFormat<Face>::write
|
|||||||
{
|
{
|
||||||
os << ' ' << f[fp];
|
os << ' ' << f[fp];
|
||||||
}
|
}
|
||||||
os << ' ' << patchI << endl;
|
os << ' ' << regionI << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,12 +82,12 @@ void Foam::fileFormats::SMESHsurfaceFormat<Face>::write
|
|||||||
writeHeader(os, surf.points(), faceLst.size());
|
writeHeader(os, surf.points(), faceLst.size());
|
||||||
|
|
||||||
labelList faceMap;
|
labelList faceMap;
|
||||||
List<surfGroup> patchLst = surf.sortedRegions(faceMap);
|
List<surfRegion> regionLst = surf.sortedRegions(faceMap);
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
forAll(patchLst[patchI], patchFaceI)
|
forAll(regionLst[regionI], localFaceI)
|
||||||
{
|
{
|
||||||
const Face& f = faceLst[faceMap[faceIndex++]];
|
const Face& f = faceLst[faceMap[faceIndex++]];
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ void Foam::fileFormats::SMESHsurfaceFormat<Face>::write
|
|||||||
{
|
{
|
||||||
os << ' ' << f[fp];
|
os << ' ' << f[fp];
|
||||||
}
|
}
|
||||||
os << ' ' << patchI << endl;
|
os << ' ' << regionI << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,8 +40,7 @@ inline void Foam::fileFormats::STARCDsurfaceFormat<Face>::writeShell
|
|||||||
const label cellTableId
|
const label cellTableId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
os
|
os << cellId // includes 1 offset
|
||||||
<< cellId // includes 1 offset
|
|
||||||
<< " " << starcdShellShape_ // 3(shell) shape
|
<< " " << starcdShellShape_ // 3(shell) shape
|
||||||
<< " " << f.size()
|
<< " " << f.size()
|
||||||
<< " " << cellTableId
|
<< " " << cellTableId
|
||||||
@ -54,9 +53,7 @@ inline void Foam::fileFormats::STARCDsurfaceFormat<Face>::writeShell
|
|||||||
{
|
{
|
||||||
if ((count % 8) == 0)
|
if ((count % 8) == 0)
|
||||||
{
|
{
|
||||||
os
|
os << nl << " " << cellId;
|
||||||
<< nl
|
|
||||||
<< " " << cellId;
|
|
||||||
}
|
}
|
||||||
os << " " << f[fp] + 1;
|
os << " " << f[fp] + 1;
|
||||||
count++;
|
count++;
|
||||||
@ -160,7 +157,7 @@ bool Foam::fileFormats::STARCDsurfaceFormat<Face>::read
|
|||||||
|
|
||||||
if (typeId == starcdShellType_)
|
if (typeId == starcdShellType_)
|
||||||
{
|
{
|
||||||
// Convert groupID into patchID
|
// Convert groupID into regionID
|
||||||
Map<label>::const_iterator fnd = lookup.find(cellTableId);
|
Map<label>::const_iterator fnd = lookup.find(cellTableId);
|
||||||
if (fnd != lookup.end())
|
if (fnd != lookup.end())
|
||||||
{
|
{
|
||||||
@ -214,8 +211,8 @@ bool Foam::fileFormats::STARCDsurfaceFormat<Face>::read
|
|||||||
|
|
||||||
sortFacesAndStore(dynFaces.xfer(), dynRegions.xfer(), sorted);
|
sortFacesAndStore(dynFaces.xfer(), dynRegions.xfer(), sorted);
|
||||||
|
|
||||||
// add patches, culling empty groups
|
// add regions, culling empty ones
|
||||||
this->addPatches(dynSizes, dynNames, true);
|
this->addRegions(dynSizes, dynNames, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,17 +231,17 @@ void Foam::fileFormats::STARCDsurfaceFormat<Face>::write
|
|||||||
writeHeader(os, "CELL");
|
writeHeader(os, "CELL");
|
||||||
|
|
||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
const List<surfGroup>& patchLst = surf.patches();
|
const List<surfRegion>& regionLst = surf.regions();
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
const surfGroup& patch = patchLst[patchI];
|
const surfRegion& reg = regionLst[regionI];
|
||||||
|
|
||||||
forAll(patch, patchFaceI)
|
forAll(reg, localFaceI)
|
||||||
{
|
{
|
||||||
const Face& f = faceLst[faceIndex++];
|
const Face& f = faceLst[faceIndex++];
|
||||||
writeShell(os, f, faceIndex, patchI + 1);
|
writeShell(os, f, faceIndex, regionI + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +251,7 @@ void Foam::fileFormats::STARCDsurfaceFormat<Face>::write
|
|||||||
OFstream(baseName + ".inp")(),
|
OFstream(baseName + ".inp")(),
|
||||||
surf.points(),
|
surf.points(),
|
||||||
surf.size(),
|
surf.size(),
|
||||||
patchLst
|
regionLst
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,17 +272,17 @@ void Foam::fileFormats::STARCDsurfaceFormat<Face>::write
|
|||||||
|
|
||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
labelList faceMap;
|
labelList faceMap;
|
||||||
List<surfGroup> patchLst = surf.sortedRegions(faceMap);
|
List<surfRegion> regionLst = surf.sortedRegions(faceMap);
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
const surfGroup& patch = patchLst[patchI];
|
const surfRegion& reg = regionLst[regionI];
|
||||||
|
|
||||||
forAll(patch, patchFaceI)
|
forAll(reg, localFaceI)
|
||||||
{
|
{
|
||||||
const Face& f = faceLst[faceMap[faceIndex++]];
|
const Face& f = faceLst[faceMap[faceIndex++]];
|
||||||
writeShell(os, f, faceIndex, patchI + 1);
|
writeShell(os, f, faceIndex, regionI + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +292,7 @@ void Foam::fileFormats::STARCDsurfaceFormat<Face>::write
|
|||||||
OFstream(baseName + ".inp")(),
|
OFstream(baseName + ".inp")(),
|
||||||
surf.points(),
|
surf.points(),
|
||||||
surf.size(),
|
surf.size(),
|
||||||
patchLst
|
regionLst
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -166,7 +166,7 @@ void Foam::fileFormats::STARCDsurfaceFormatCore::writeCase
|
|||||||
Ostream& os,
|
Ostream& os,
|
||||||
const pointField& pointLst,
|
const pointField& pointLst,
|
||||||
const label nFaces,
|
const label nFaces,
|
||||||
const List<surfGroup>& patchLst
|
const UList<surfRegion>& regionLst
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
word caseName = os.name().lessExt().name();
|
word caseName = os.name().lessExt().name();
|
||||||
@ -176,10 +176,11 @@ void Foam::fileFormats::STARCDsurfaceFormatCore::writeCase
|
|||||||
<< "! case " << caseName << nl
|
<< "! case " << caseName << nl
|
||||||
<< "! ------------------------------" << nl;
|
<< "! ------------------------------" << nl;
|
||||||
|
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
os << "ctable " << patchI + 1 << " shell" << nl
|
os << "ctable " << regionI + 1 << " shell" << nl
|
||||||
<< "ctname " << patchI + 1 << " " << patchLst[patchI].name() << nl;
|
<< "ctname " << regionI + 1 << " "
|
||||||
|
<< regionLst[regionI].name() << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "! ------------------------------" << nl
|
os << "! ------------------------------" << nl
|
||||||
|
|||||||
@ -70,7 +70,7 @@ protected:
|
|||||||
Ostream&,
|
Ostream&,
|
||||||
const pointField&,
|
const pointField&,
|
||||||
const label nFaces,
|
const label nFaces,
|
||||||
const List<surfGroup>&
|
const UList<surfRegion>&
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -70,7 +70,7 @@ inline void Foam::fileFormats::STLsurfaceFormat<Face>::writeShell
|
|||||||
const pointField& pointLst,
|
const pointField& pointLst,
|
||||||
const Face& f,
|
const Face& f,
|
||||||
const vector& norm,
|
const vector& norm,
|
||||||
const label patchI
|
const label regionI
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// simple triangulation about f[0].
|
// simple triangulation about f[0].
|
||||||
@ -86,7 +86,7 @@ inline void Foam::fileFormats::STLsurfaceFormat<Face>::writeShell
|
|||||||
p0,
|
p0,
|
||||||
pointLst[f[fp1]],
|
pointLst[f[fp1]],
|
||||||
pointLst[f[fp2]],
|
pointLst[f[fp2]],
|
||||||
patchI
|
regionI
|
||||||
);
|
);
|
||||||
|
|
||||||
stlTri.write(os);
|
stlTri.write(os);
|
||||||
@ -104,22 +104,22 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeASCII
|
|||||||
{
|
{
|
||||||
const pointField& pointLst = surf.points();
|
const pointField& pointLst = surf.points();
|
||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
const List<surfGroup>& patchLst = surf.patches();
|
const List<surfRegion>& regionLst = surf.regions();
|
||||||
const vectorField& normLst = surf.faceNormals();
|
const vectorField& normLst = surf.faceNormals();
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
// Print all faces belonging to this region
|
// Print all faces belonging to this region
|
||||||
const surfGroup& patch = patchLst[patchI];
|
const surfRegion& reg = regionLst[regionI];
|
||||||
|
|
||||||
os << "solid " << patch.name() << endl;
|
os << "solid " << reg.name() << endl;
|
||||||
forAll(patch, patchFaceI)
|
forAll(reg, localFaceI)
|
||||||
{
|
{
|
||||||
const label faceI = faceIndex++;
|
const label faceI = faceIndex++;
|
||||||
writeShell(os, pointLst, faceLst[faceI], normLst[faceI]);
|
writeShell(os, pointLst, faceLst[faceI], normLst[faceI]);
|
||||||
}
|
}
|
||||||
os << "endsolid " << patch.name() << endl;
|
os << "endsolid " << reg.name() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,34 +136,34 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeASCII
|
|||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
const vectorField& normLst = surf.faceNormals();
|
const vectorField& normLst = surf.faceNormals();
|
||||||
|
|
||||||
if (surf.patches().size() == 1)
|
if (surf.regionToc().size() == 1)
|
||||||
{
|
{
|
||||||
// a single region - we can skip sorting
|
// a single region - we can skip sorting
|
||||||
os << "solid " << surf.patches()[0].name() << endl;
|
os << "solid " << surf.regionToc()[0].name() << endl;
|
||||||
forAll(faceLst, faceI)
|
forAll(faceLst, faceI)
|
||||||
{
|
{
|
||||||
writeShell(os, pointLst, faceLst[faceI], normLst[faceI]);
|
writeShell(os, pointLst, faceLst[faceI], normLst[faceI]);
|
||||||
}
|
}
|
||||||
os << "endsolid " << surf.patches()[0].name() << endl;
|
os << "endsolid " << surf.regionToc()[0].name() << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
labelList faceMap;
|
labelList faceMap;
|
||||||
List<surfGroup> patchLst = surf.sortedRegions(faceMap);
|
List<surfRegion> regionLst = surf.sortedRegions(faceMap);
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
// Print all faces belonging to this region
|
// Print all faces belonging to this region
|
||||||
const surfGroup& patch = patchLst[patchI];
|
const surfRegion& reg = regionLst[regionI];
|
||||||
|
|
||||||
os << "solid " << patch.name() << endl;
|
os << "solid " << reg.name() << endl;
|
||||||
forAll(patch, patchFaceI)
|
forAll(reg, localFaceI)
|
||||||
{
|
{
|
||||||
const label faceI = faceMap[faceIndex++];
|
const label faceI = faceMap[faceIndex++];
|
||||||
writeShell(os, pointLst, faceLst[faceI], normLst[faceI]);
|
writeShell(os, pointLst, faceLst[faceI], normLst[faceI]);
|
||||||
}
|
}
|
||||||
os << "endsolid " << patch.name() << endl;
|
os << "endsolid " << reg.name() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeBINARY
|
|||||||
const pointField& pointLst = surf.points();
|
const pointField& pointLst = surf.points();
|
||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
const vectorField& normLst = surf.faceNormals();
|
const vectorField& normLst = surf.faceNormals();
|
||||||
const List<surfGroup>& patchLst = surf.patches();
|
const List<surfRegion>& regionLst = surf.regions();
|
||||||
|
|
||||||
unsigned int nTris = 0;
|
unsigned int nTris = 0;
|
||||||
if (surf.isTri())
|
if (surf.isTri())
|
||||||
@ -200,9 +200,9 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeBINARY
|
|||||||
STLsurfaceFormatCore::writeHeaderBINARY(os, nTris);
|
STLsurfaceFormatCore::writeHeaderBINARY(os, nTris);
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
forAll(patchLst[patchI], patchFaceI)
|
forAll(regionLst[regionI], regionFaceI)
|
||||||
{
|
{
|
||||||
writeShell
|
writeShell
|
||||||
(
|
(
|
||||||
@ -210,7 +210,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeBINARY
|
|||||||
pointLst,
|
pointLst,
|
||||||
faceLst[faceIndex],
|
faceLst[faceIndex],
|
||||||
normLst[faceIndex],
|
normLst[faceIndex],
|
||||||
patchI
|
regionI
|
||||||
);
|
);
|
||||||
|
|
||||||
++faceIndex;
|
++faceIndex;
|
||||||
@ -229,7 +229,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeBINARY
|
|||||||
{
|
{
|
||||||
const pointField& pointLst = surf.points();
|
const pointField& pointLst = surf.points();
|
||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
const List<label>& regionLst = surf.regions();
|
const List<label>& regionIds = surf.regionIds();
|
||||||
const vectorField& normLst = surf.faceNormals();
|
const vectorField& normLst = surf.faceNormals();
|
||||||
|
|
||||||
unsigned int nTris = 0;
|
unsigned int nTris = 0;
|
||||||
@ -258,7 +258,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeBINARY
|
|||||||
pointLst,
|
pointLst,
|
||||||
faceLst[faceI],
|
faceLst[faceI],
|
||||||
normLst[faceI],
|
normLst[faceI],
|
||||||
regionLst[faceI]
|
regionIds[faceI]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -295,10 +295,10 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
|
|||||||
// retrieve the original region information
|
// retrieve the original region information
|
||||||
List<word> names(reader.names().xfer());
|
List<word> names(reader.names().xfer());
|
||||||
List<label> sizes(reader.sizes().xfer());
|
List<label> sizes(reader.sizes().xfer());
|
||||||
List<label> regions(reader.regions().xfer());
|
List<label> regionIds(reader.regionIds().xfer());
|
||||||
|
|
||||||
// generate the (sorted) faces
|
// generate the (sorted) faces
|
||||||
List<Face> faceLst(regions.size());
|
List<Face> faceLst(regionIds.size());
|
||||||
|
|
||||||
if (reader.sorted())
|
if (reader.sorted())
|
||||||
{
|
{
|
||||||
@ -314,7 +314,7 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
|
|||||||
// unsorted - determine the sorted order:
|
// unsorted - determine the sorted order:
|
||||||
// avoid SortableList since we discard the main list anyhow
|
// avoid SortableList since we discard the main list anyhow
|
||||||
List<label> faceMap;
|
List<label> faceMap;
|
||||||
sortedOrder(regions, faceMap);
|
sortedOrder(regionIds, faceMap);
|
||||||
|
|
||||||
// generate sorted faces
|
// generate sorted faces
|
||||||
forAll(faceMap, faceI)
|
forAll(faceMap, faceI)
|
||||||
@ -323,18 +323,18 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
|
|||||||
faceLst[faceI] = triFace(startPt, startPt+1, startPt+2);
|
faceLst[faceI] = triFace(startPt, startPt+1, startPt+2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
regions.clear();
|
regionIds.clear();
|
||||||
|
|
||||||
// transfer:
|
// transfer:
|
||||||
this->storedFaces().transfer(faceLst);
|
this->storedFaces().transfer(faceLst);
|
||||||
|
|
||||||
if (names.size())
|
if (names.size())
|
||||||
{
|
{
|
||||||
this->addPatches(sizes, names);
|
this->addRegions(sizes, names);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->addPatches(sizes);
|
this->addRegions(sizes);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->stitchFaces(SMALL);
|
this->stitchFaces(SMALL);
|
||||||
|
|||||||
@ -79,7 +79,7 @@ class STLsurfaceFormat
|
|||||||
const pointField&,
|
const pointField&,
|
||||||
const Face&,
|
const Face&,
|
||||||
const vector&,
|
const vector&,
|
||||||
const label patchI
|
const label regionI
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -417,7 +417,7 @@ bool Foam::fileFormats::STLsurfaceFormatCore::readASCII
|
|||||||
|
|
||||||
// transfer to normal lists
|
// transfer to normal lists
|
||||||
points_.transfer(lexer.points());
|
points_.transfer(lexer.points());
|
||||||
regions_.transfer(lexer.facets());
|
regionIds_.transfer(lexer.facets());
|
||||||
names_.transfer(lexer.names());
|
names_.transfer(lexer.names());
|
||||||
sizes_.transfer(lexer.sizes());
|
sizes_.transfer(lexer.sizes());
|
||||||
|
|
||||||
|
|||||||
@ -142,14 +142,14 @@ bool Foam::fileFormats::STLsurfaceFormatCore::readBINARY
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
points_.setSize(3*nTris);
|
points_.setSize(3*nTris);
|
||||||
regions_.setSize(nTris);
|
regionIds_.setSize(nTris);
|
||||||
|
|
||||||
Map<label> lookup;
|
Map<label> lookup;
|
||||||
DynamicList<label> dynSizes;
|
DynamicList<label> dynSizes;
|
||||||
|
|
||||||
label ptI = 0;
|
label ptI = 0;
|
||||||
label regionI = -1;
|
label regionI = -1;
|
||||||
forAll(regions_, faceI)
|
forAll(regionIds_, faceI)
|
||||||
{
|
{
|
||||||
// Read an STL triangle
|
// Read an STL triangle
|
||||||
STLtriangle stlTri(is);
|
STLtriangle stlTri(is);
|
||||||
@ -179,7 +179,7 @@ bool Foam::fileFormats::STLsurfaceFormatCore::readBINARY
|
|||||||
dynSizes.append(0);
|
dynSizes.append(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
regions_[faceI] = regionI;
|
regionIds_[faceI] = regionI;
|
||||||
dynSizes[regionI]++;
|
dynSizes[regionI]++;
|
||||||
|
|
||||||
#ifdef DEBUG_STLBINARY
|
#ifdef DEBUG_STLBINARY
|
||||||
@ -220,7 +220,7 @@ Foam::fileFormats::STLsurfaceFormatCore::STLsurfaceFormatCore
|
|||||||
:
|
:
|
||||||
sorted_(true),
|
sorted_(true),
|
||||||
points_(0),
|
points_(0),
|
||||||
regions_(0),
|
regionIds_(0),
|
||||||
names_(0),
|
names_(0),
|
||||||
sizes_(0)
|
sizes_(0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -65,7 +65,7 @@ class STLsurfaceFormatCore
|
|||||||
pointField points_;
|
pointField points_;
|
||||||
|
|
||||||
//- The regions associated with the faces
|
//- The regions associated with the faces
|
||||||
List<label> regions_;
|
List<label> regionIds_;
|
||||||
|
|
||||||
//- The solid names, in the order of their first appearance
|
//- The solid names, in the order of their first appearance
|
||||||
List<word> names_;
|
List<word> names_;
|
||||||
@ -124,7 +124,7 @@ public:
|
|||||||
{
|
{
|
||||||
sorted_ = true;
|
sorted_ = true;
|
||||||
points_.clear();
|
points_.clear();
|
||||||
regions_.clear();
|
regionIds_.clear();
|
||||||
names_.clear();
|
names_.clear();
|
||||||
sizes_.clear();
|
sizes_.clear();
|
||||||
}
|
}
|
||||||
@ -135,10 +135,10 @@ public:
|
|||||||
return points_;
|
return points_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return full access to the regions
|
//- Return full access to the regionIds
|
||||||
List<label>& regions()
|
List<label>& regionIds()
|
||||||
{
|
{
|
||||||
return regions_;
|
return regionIds_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- The list of solid names in the order of their first appearance
|
//- The list of solid names in the order of their first appearance
|
||||||
|
|||||||
@ -37,7 +37,6 @@ Foam::word Foam::fileFormats::surfaceFormatsCore::nativeExt("ofs");
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Check if file extension corresponds to 'native' surface format
|
|
||||||
bool
|
bool
|
||||||
Foam::fileFormats::surfaceFormatsCore::isNative(const word& ext)
|
Foam::fileFormats::surfaceFormatsCore::isNative(const word& ext)
|
||||||
{
|
{
|
||||||
@ -75,11 +74,11 @@ Foam::fileFormats::surfaceFormatsCore::findMeshInstance
|
|||||||
// closest to and lower than current time
|
// closest to and lower than current time
|
||||||
|
|
||||||
instantList ts = d.times();
|
instantList ts = d.times();
|
||||||
label i;
|
label instanceI;
|
||||||
|
|
||||||
for (i=ts.size()-1; i>=0; i--)
|
for (instanceI = ts.size()-1; instanceI >= 0; --instanceI)
|
||||||
{
|
{
|
||||||
if (ts[i].value() <= d.timeOutputValue())
|
if (ts[instanceI].value() <= d.timeOutputValue())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -88,13 +87,13 @@ Foam::fileFormats::surfaceFormatsCore::findMeshInstance
|
|||||||
// Noting that the current directory has already been searched
|
// Noting that the current directory has already been searched
|
||||||
// for mesh data, start searching from the previously stored time directory
|
// for mesh data, start searching from the previously stored time directory
|
||||||
|
|
||||||
if (i>=0)
|
if (instanceI >= 0)
|
||||||
{
|
{
|
||||||
for (label j=i; j>=0; j--)
|
for (label i = instanceI; i >= 0; --i)
|
||||||
{
|
{
|
||||||
if (file(d.path()/ts[j].name()/subdirName/foamName))
|
if (file(d.path()/ts[i].name()/subdirName/foamName))
|
||||||
{
|
{
|
||||||
return ts[j].name();
|
return ts[i].name();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,11 +115,11 @@ Foam::fileFormats::surfaceFormatsCore::findMeshName
|
|||||||
// closest to and lower than current time
|
// closest to and lower than current time
|
||||||
|
|
||||||
instantList ts = d.times();
|
instantList ts = d.times();
|
||||||
label i;
|
label instanceI;
|
||||||
|
|
||||||
for (i=ts.size()-1; i>=0; i--)
|
for (instanceI = ts.size()-1; instanceI >= 0; --instanceI)
|
||||||
{
|
{
|
||||||
if (ts[i].value() <= d.timeOutputValue())
|
if (ts[instanceI].value() <= d.timeOutputValue())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -129,11 +128,11 @@ Foam::fileFormats::surfaceFormatsCore::findMeshName
|
|||||||
// Noting that the current directory has already been searched
|
// Noting that the current directory has already been searched
|
||||||
// for mesh data, start searching from the previously stored time directory
|
// for mesh data, start searching from the previously stored time directory
|
||||||
|
|
||||||
if (i>=0)
|
if (instanceI >= 0)
|
||||||
{
|
{
|
||||||
for (label j=i; j>=0; j--)
|
for (label i = instanceI; i >= 0; --i)
|
||||||
{
|
{
|
||||||
fileName testName(d.path()/ts[j].name()/subdirName/foamName);
|
fileName testName(d.path()/ts[i].name()/subdirName/foamName);
|
||||||
|
|
||||||
if (file(testName))
|
if (file(testName))
|
||||||
{
|
{
|
||||||
@ -166,14 +165,14 @@ Foam::fileFormats::surfaceFormatsCore::findMeshName
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Returns patch info.
|
// Returns region info.
|
||||||
// Sets faceMap to the indexing according to patch numbers.
|
// Sets faceMap to the indexing according to region numbers.
|
||||||
// Patch numbers start at 0.
|
// Region numbers start at 0.
|
||||||
Foam::surfGroupList
|
Foam::surfRegionList
|
||||||
Foam::fileFormats::surfaceFormatsCore::sortedPatchRegions
|
Foam::fileFormats::surfaceFormatsCore::sortedRegionsById
|
||||||
(
|
(
|
||||||
const UList<label>& regionLst,
|
const UList<label>& regionIds,
|
||||||
const Map<word>& patchNames,
|
const Map<word>& regionNames,
|
||||||
labelList& faceMap
|
labelList& faceMap
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -185,11 +184,11 @@ Foam::fileFormats::surfaceFormatsCore::sortedPatchRegions
|
|||||||
// Assuming that we have relatively fewer regions compared to the
|
// Assuming that we have relatively fewer regions compared to the
|
||||||
// number of items, just do it ourselves
|
// number of items, just do it ourselves
|
||||||
|
|
||||||
// step 1: get region sizes and store (regionId => patchI)
|
// step 1: get region sizes and store (regionId => regionI)
|
||||||
Map<label> lookup;
|
Map<label> lookup;
|
||||||
forAll(regionLst, faceI)
|
forAll(regionIds, faceI)
|
||||||
{
|
{
|
||||||
const label regId = regionLst[faceI];
|
const label regId = regionIds[faceI];
|
||||||
|
|
||||||
Map<label>::iterator fnd = lookup.find(regId);
|
Map<label>::iterator fnd = lookup.find(regId);
|
||||||
if (fnd != lookup.end())
|
if (fnd != lookup.end())
|
||||||
@ -202,52 +201,53 @@ Foam::fileFormats::surfaceFormatsCore::sortedPatchRegions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// step 2: assign start/size (and name) to the newPatches
|
// step 2: assign start/size (and name) to the newRegions
|
||||||
// re-use the lookup to map (regionId => patchI)
|
// re-use the lookup to map (regionId => regionI)
|
||||||
surfGroupList patchLst(lookup.size());
|
surfRegionList regionLst(lookup.size());
|
||||||
label start = 0;
|
label start = 0;
|
||||||
label patchI = 0;
|
label regionI = 0;
|
||||||
forAllIter(Map<label>, lookup, iter)
|
forAllIter(Map<label>, lookup, iter)
|
||||||
{
|
{
|
||||||
label regId = iter.key();
|
label regId = iter.key();
|
||||||
|
|
||||||
word name;
|
word name;
|
||||||
Map<word>::const_iterator fnd = patchNames.find(regId);
|
Map<word>::const_iterator fnd = regionNames.find(regId);
|
||||||
if (fnd != patchNames.end())
|
if (fnd != regionNames.end())
|
||||||
{
|
{
|
||||||
name = fnd();
|
name = fnd();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
name = word("patch") + ::Foam::name(patchI);
|
name = word("region") + ::Foam::name(regionI);
|
||||||
}
|
}
|
||||||
|
|
||||||
patchLst[patchI] = surfGroup
|
regionLst[regionI] = surfRegion
|
||||||
(
|
(
|
||||||
name,
|
name,
|
||||||
0, // initialize with zero size
|
0, // initialize with zero size
|
||||||
start,
|
start,
|
||||||
patchI
|
regionI
|
||||||
);
|
);
|
||||||
|
|
||||||
// increment the start for the next patch
|
// increment the start for the next region
|
||||||
// and save the (regionId => patchI) mapping
|
// and save the (regionId => regionI) mapping
|
||||||
start += iter();
|
start += iter();
|
||||||
iter() = patchI++;
|
iter() = regionI++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// step 3: build the re-ordering
|
// step 3: build the re-ordering
|
||||||
faceMap.setSize(regionLst.size());
|
faceMap.setSize(regionIds.size());
|
||||||
|
|
||||||
forAll(regionLst, faceI)
|
forAll(regionIds, faceI)
|
||||||
{
|
{
|
||||||
label patchI = lookup[regionLst[faceI]];
|
label regionI = lookup[regionIds[faceI]];
|
||||||
faceMap[faceI] = patchLst[patchI].start() + patchLst[patchI].size()++;
|
faceMap[faceI] =
|
||||||
|
regionLst[regionI].start() + regionLst[regionI].size()++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// with reordered faces registered in faceMap
|
// with reordered faces registered in faceMap
|
||||||
return patchLst;
|
return regionLst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -36,11 +36,11 @@ SourceFiles
|
|||||||
#ifndef surfaceFormatsCore_H
|
#ifndef surfaceFormatsCore_H
|
||||||
#define surfaceFormatsCore_H
|
#define surfaceFormatsCore_H
|
||||||
|
|
||||||
#include "surfPatchIdentifierList.H"
|
|
||||||
#include "surfGroupList.H"
|
|
||||||
#include "labelList.H"
|
|
||||||
#include "Map.H"
|
#include "Map.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
|
#include "labelList.H"
|
||||||
|
#include "surfRegionList.H"
|
||||||
|
#include "surfRegionIdentifierList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -69,6 +69,7 @@ public:
|
|||||||
static word meshSubDir;
|
static word meshSubDir;
|
||||||
|
|
||||||
//- The file extension corresponding to 'native' surface format
|
//- The file extension corresponding to 'native' surface format
|
||||||
|
// Normally "ofs" (mnemonic: OF = OpenFOAM, S = Surface)
|
||||||
static word nativeExt;
|
static word nativeExt;
|
||||||
|
|
||||||
// Static Member Functions
|
// Static Member Functions
|
||||||
@ -91,12 +92,12 @@ public:
|
|||||||
//- Name of UnsortedMeshedSurface directory to use.
|
//- Name of UnsortedMeshedSurface directory to use.
|
||||||
static fileName findMeshName(const Time&);
|
static fileName findMeshName(const Time&);
|
||||||
|
|
||||||
//- Determine the sort order from the region list.
|
//- Determine the sort order from the region ids.
|
||||||
// Returns patch list and sets faceMap to indices within faceLst
|
// Returns region list and sets faceMap to indices within faceLst
|
||||||
static surfGroupList sortedPatchRegions
|
static surfRegionList sortedRegionsById
|
||||||
(
|
(
|
||||||
const UList<label>& regionLst,
|
const UList<label>& regionIds,
|
||||||
const Map<word>& patchNames,
|
const Map<word>& regionNames,
|
||||||
labelList& faceMap
|
labelList& faceMap
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ inline void Foam::fileFormats::TRIsurfaceFormat<Face>::writeShell
|
|||||||
Ostream& os,
|
Ostream& os,
|
||||||
const pointField& pointLst,
|
const pointField& pointLst,
|
||||||
const Face& f,
|
const Face& f,
|
||||||
const label patchI
|
const label regionI
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// simple triangulation about f[0].
|
// simple triangulation about f[0].
|
||||||
@ -54,7 +54,7 @@ inline void Foam::fileFormats::TRIsurfaceFormat<Face>::writeShell
|
|||||||
<< p1.x() << ' ' << p1.y() << ' ' << p1.z() << ' '
|
<< p1.x() << ' ' << p1.y() << ' ' << p1.z() << ' '
|
||||||
<< p2.x() << ' ' << p2.y() << ' ' << p2.z() << ' '
|
<< p2.x() << ' ' << p2.y() << ' ' << p2.z() << ' '
|
||||||
// region as colour
|
// region as colour
|
||||||
<< "0x" << hex << patchI << dec << endl;
|
<< "0x" << hex << regionI << dec << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,10 +89,10 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
|
|||||||
|
|
||||||
// retrieve the original region information
|
// retrieve the original region information
|
||||||
List<label> sizes(reader.sizes().xfer());
|
List<label> sizes(reader.sizes().xfer());
|
||||||
List<label> regions(reader.regions().xfer());
|
List<label> regionIds(reader.regionIds().xfer());
|
||||||
|
|
||||||
// generate the (sorted) faces
|
// generate the (sorted) faces
|
||||||
List<Face> faceLst(regions.size());
|
List<Face> faceLst(regionIds.size());
|
||||||
|
|
||||||
if (reader.sorted())
|
if (reader.sorted())
|
||||||
{
|
{
|
||||||
@ -108,7 +108,7 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
|
|||||||
// unsorted - determine the sorted order:
|
// unsorted - determine the sorted order:
|
||||||
// avoid SortableList since we discard the main list anyhow
|
// avoid SortableList since we discard the main list anyhow
|
||||||
List<label> faceMap;
|
List<label> faceMap;
|
||||||
sortedOrder(regions, faceMap);
|
sortedOrder(regionIds, faceMap);
|
||||||
|
|
||||||
// generate sorted faces
|
// generate sorted faces
|
||||||
forAll(faceMap, faceI)
|
forAll(faceMap, faceI)
|
||||||
@ -117,12 +117,12 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
|
|||||||
faceLst[faceI] = triFace(startPt, startPt+1, startPt+2);
|
faceLst[faceI] = triFace(startPt, startPt+1, startPt+2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
regions.clear();
|
regionIds.clear();
|
||||||
|
|
||||||
// transfer:
|
// transfer:
|
||||||
this->storedFaces().transfer(faceLst);
|
this->storedFaces().transfer(faceLst);
|
||||||
|
|
||||||
this->addPatches(sizes);
|
this->addRegions(sizes);
|
||||||
this->stitchFaces(SMALL);
|
this->stitchFaces(SMALL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -137,15 +137,15 @@ void Foam::fileFormats::TRIsurfaceFormat<Face>::write
|
|||||||
{
|
{
|
||||||
const pointField& pointLst = surf.points();
|
const pointField& pointLst = surf.points();
|
||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
const List<surfGroup>& patchLst = surf.patches();
|
const List<surfRegion>& regionLst = surf.regions();
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
forAll(patchLst[patchI], patchFaceI)
|
forAll(regionLst[regionI], localFaceI)
|
||||||
{
|
{
|
||||||
const Face& f = faceLst[faceIndex++];
|
const Face& f = faceLst[faceIndex++];
|
||||||
writeShell(os, pointLst, f, patchI);
|
writeShell(os, pointLst, f, regionI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ void Foam::fileFormats::TRIsurfaceFormat<Face>::write
|
|||||||
|
|
||||||
bool doSort = false;
|
bool doSort = false;
|
||||||
// a single region needs no sorting
|
// a single region needs no sorting
|
||||||
if (surf.patches().size() == 1)
|
if (surf.regionToc().size() == 1)
|
||||||
{
|
{
|
||||||
doSort = false;
|
doSort = false;
|
||||||
}
|
}
|
||||||
@ -171,25 +171,25 @@ void Foam::fileFormats::TRIsurfaceFormat<Face>::write
|
|||||||
if (doSort)
|
if (doSort)
|
||||||
{
|
{
|
||||||
labelList faceMap;
|
labelList faceMap;
|
||||||
List<surfGroup> patchLst = surf.sortedRegions(faceMap);
|
List<surfRegion> regionLst = surf.sortedRegions(faceMap);
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
forAll(patchLst[patchI], patchFaceI)
|
forAll(regionLst[regionI], localFaceI)
|
||||||
{
|
{
|
||||||
const Face& f = faceLst[faceMap[faceIndex++]];
|
const Face& f = faceLst[faceMap[faceIndex++]];
|
||||||
writeShell(os, pointLst, f, patchI);
|
writeShell(os, pointLst, f, regionI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const List<label>& regionLst = surf.regions();
|
const List<label>& regionIds = surf.regionIds();
|
||||||
|
|
||||||
forAll(faceLst, faceI)
|
forAll(faceLst, faceI)
|
||||||
{
|
{
|
||||||
writeShell(os, pointLst, faceLst[faceI], regionLst[faceI]);
|
writeShell(os, pointLst, faceLst[faceI], regionIds[faceI]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class TRIsurfaceFormat
|
|||||||
Ostream&,
|
Ostream&,
|
||||||
const pointField&,
|
const pointField&,
|
||||||
const Face&,
|
const Face&,
|
||||||
const label patchI
|
const label regionI
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
|
|||||||
@ -43,7 +43,7 @@ Foam::fileFormats::TRIsurfaceFormatCore::TRIsurfaceFormatCore
|
|||||||
:
|
:
|
||||||
sorted_(true),
|
sorted_(true),
|
||||||
points_(0),
|
points_(0),
|
||||||
regions_(0),
|
regionIds_(0),
|
||||||
sizes_(0)
|
sizes_(0)
|
||||||
{
|
{
|
||||||
read(filename);
|
read(filename);
|
||||||
@ -83,10 +83,10 @@ bool Foam::fileFormats::TRIsurfaceFormatCore::read
|
|||||||
DynamicList<label> dynSizes;
|
DynamicList<label> dynSizes;
|
||||||
HashTable<label> lookup;
|
HashTable<label> lookup;
|
||||||
|
|
||||||
// place faces without a group in patch0
|
// place faces without a group in region0
|
||||||
label regionI = 0;
|
label regionI = 0;
|
||||||
dynSizes.append(regionI);
|
dynSizes.append(regionI);
|
||||||
lookup.insert("patch0", regionI);
|
lookup.insert("regionI", regionI);
|
||||||
|
|
||||||
while (is.good())
|
while (is.good())
|
||||||
{
|
{
|
||||||
@ -132,13 +132,13 @@ bool Foam::fileFormats::TRIsurfaceFormatCore::read
|
|||||||
|
|
||||||
// Region/colour in .tri file starts with 0x. Skip.
|
// Region/colour in .tri file starts with 0x. Skip.
|
||||||
// ie, instead of having 0xFF, skip 0 and leave xFF to
|
// ie, instead of having 0xFF, skip 0 and leave xFF to
|
||||||
// get read as a word and name it "patchFF"
|
// get read as a word and name it "regionFF"
|
||||||
|
|
||||||
char zero;
|
char zero;
|
||||||
lineStream >> zero;
|
lineStream >> zero;
|
||||||
|
|
||||||
word rawName(lineStream);
|
word rawName(lineStream);
|
||||||
word name("patch" + rawName(1, rawName.size()-1));
|
word name("region" + rawName(1, rawName.size()-1));
|
||||||
|
|
||||||
HashTable<label>::const_iterator fnd = lookup.find(name);
|
HashTable<label>::const_iterator fnd = lookup.find(name);
|
||||||
if (fnd != lookup.end())
|
if (fnd != lookup.end())
|
||||||
@ -162,24 +162,24 @@ bool Foam::fileFormats::TRIsurfaceFormatCore::read
|
|||||||
}
|
}
|
||||||
|
|
||||||
// skip empty groups
|
// skip empty groups
|
||||||
label nPatch = 0;
|
label nRegion = 0;
|
||||||
forAll(dynSizes, patchI)
|
forAll(dynSizes, regionI)
|
||||||
{
|
{
|
||||||
if (dynSizes[patchI])
|
if (dynSizes[regionI])
|
||||||
{
|
{
|
||||||
if (nPatch != patchI)
|
if (nRegion != regionI)
|
||||||
{
|
{
|
||||||
dynSizes[nPatch] = dynSizes[patchI];
|
dynSizes[nRegion] = dynSizes[regionI];
|
||||||
}
|
}
|
||||||
nPatch++;
|
nRegion++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// truncate addressed size
|
// truncate addressed size
|
||||||
dynSizes.setCapacity(nPatch);
|
dynSizes.setCapacity(nRegion);
|
||||||
|
|
||||||
// transfer to normal lists
|
// transfer to normal lists
|
||||||
points_.transfer(dynPoints);
|
points_.transfer(dynPoints);
|
||||||
regions_.transfer(dynRegions);
|
regionIds_.transfer(dynRegions);
|
||||||
sizes_.transfer(dynSizes);
|
sizes_.transfer(dynSizes);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -65,7 +65,7 @@ class TRIsurfaceFormatCore
|
|||||||
pointField points_;
|
pointField points_;
|
||||||
|
|
||||||
//- The regions associated with the faces
|
//- The regions associated with the faces
|
||||||
List<label> regions_;
|
List<label> regionIds_;
|
||||||
|
|
||||||
//- The solid count, in the order of their first appearance
|
//- The solid count, in the order of their first appearance
|
||||||
List<label> sizes_;
|
List<label> sizes_;
|
||||||
@ -104,7 +104,7 @@ public:
|
|||||||
{
|
{
|
||||||
sorted_ = true;
|
sorted_ = true;
|
||||||
points_.clear();
|
points_.clear();
|
||||||
regions_.clear();
|
regionIds_.clear();
|
||||||
sizes_.clear();
|
sizes_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,9 +115,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return full access to the regions
|
//- Return full access to the regions
|
||||||
List<label>& regions()
|
List<label>& regionIds()
|
||||||
{
|
{
|
||||||
return regions_;
|
return regionIds_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- The list of region sizes in the order of their first appearance
|
//- The list of region sizes in the order of their first appearance
|
||||||
|
|||||||
@ -33,7 +33,7 @@ template<class Face>
|
|||||||
void Foam::fileFormats::VTKsurfaceFormat<Face>::writeHeaderPolygons
|
void Foam::fileFormats::VTKsurfaceFormat<Face>::writeHeaderPolygons
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const List<Face>& faceLst
|
const UList<Face>& faceLst
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
label nNodes = 0;
|
label nNodes = 0;
|
||||||
@ -66,15 +66,15 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
const List<Face>& faceLst = surf.faces();
|
const List<Face>& faceLst = surf.faces();
|
||||||
const List<surfGroup>& patchLst = surf.patches();
|
const List<surfRegion>& regionLst = surf.regions();
|
||||||
|
|
||||||
writeHeader(os, surf.points());
|
writeHeader(os, surf.points());
|
||||||
writeHeaderPolygons(os, faceLst);
|
writeHeaderPolygons(os, faceLst);
|
||||||
|
|
||||||
label faceIndex = 0;
|
label faceIndex = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
forAll(patchLst[patchI], patchFaceI)
|
forAll(regionLst[regionI], localFaceI)
|
||||||
{
|
{
|
||||||
const Face& f = faceLst[faceIndex++];
|
const Face& f = faceLst[faceIndex++];
|
||||||
|
|
||||||
@ -87,8 +87,7 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print region numbers
|
writeTail(os, regionLst);
|
||||||
writeTail(os, patchLst);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -116,8 +115,7 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write
|
|||||||
os << ' ' << nl;
|
os << ' ' << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print region numbers
|
writeTail(os, surf.regionIds());
|
||||||
writeTail(os, surf.regions());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Provide a means of writing VTK legacy format.
|
Provide a means of writing VTK legacy format.
|
||||||
The output is never sorted by patch.
|
The output is never sorted by region.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
VTKsurfaceFormat.C
|
VTKsurfaceFormat.C
|
||||||
@ -63,7 +63,7 @@ class VTKsurfaceFormat
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Write header information about number of polygon points
|
//- Write header information about number of polygon points
|
||||||
static void writeHeaderPolygons(Ostream&, const List<Face>&);
|
static void writeHeaderPolygons(Ostream&, const UList<Face>&);
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
VTKsurfaceFormat(const VTKsurfaceFormat<Face>&);
|
VTKsurfaceFormat(const VTKsurfaceFormat<Face>&);
|
||||||
|
|||||||
@ -58,13 +58,13 @@ void Foam::fileFormats::VTKsurfaceFormatCore::writeHeader
|
|||||||
void Foam::fileFormats::VTKsurfaceFormatCore::writeTail
|
void Foam::fileFormats::VTKsurfaceFormatCore::writeTail
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const List<surfGroup>& patchLst
|
const UList<surfRegion>& regionLst
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
label nFaces = 0;
|
label nFaces = 0;
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
nFaces += patchLst[patchI].size();
|
nFaces += regionLst[regionI].size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print region numbers
|
// Print region numbers
|
||||||
@ -74,22 +74,22 @@ void Foam::fileFormats::VTKsurfaceFormatCore::writeTail
|
|||||||
<< "region 1 " << nFaces << " float" << nl;
|
<< "region 1 " << nFaces << " float" << nl;
|
||||||
|
|
||||||
|
|
||||||
forAll(patchLst, patchI)
|
forAll(regionLst, regionI)
|
||||||
{
|
{
|
||||||
forAll(patchLst[patchI], patchFaceI)
|
forAll(regionLst[regionI], localFaceI)
|
||||||
{
|
{
|
||||||
if (patchFaceI)
|
if (localFaceI)
|
||||||
{
|
{
|
||||||
if ((patchFaceI % 20) == 0)
|
if (localFaceI % 20)
|
||||||
{
|
|
||||||
os << nl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
os << ' ';
|
os << ' ';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os << nl;
|
||||||
}
|
}
|
||||||
os << patchI + 1;
|
}
|
||||||
|
os << regionI + 1;
|
||||||
}
|
}
|
||||||
os << nl;
|
os << nl;
|
||||||
}
|
}
|
||||||
@ -99,30 +99,30 @@ void Foam::fileFormats::VTKsurfaceFormatCore::writeTail
|
|||||||
void Foam::fileFormats::VTKsurfaceFormatCore::writeTail
|
void Foam::fileFormats::VTKsurfaceFormatCore::writeTail
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const List<label>& regionLst
|
const UList<label>& regionIds
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Print region numbers
|
// Print region numbers
|
||||||
os << nl
|
os << nl
|
||||||
<< "CELL_DATA " << regionLst.size() << nl
|
<< "CELL_DATA " << regionIds.size() << nl
|
||||||
<< "FIELD attributes 1" << nl
|
<< "FIELD attributes 1" << nl
|
||||||
<< "region 1 " << regionLst.size() << " float" << nl;
|
<< "region 1 " << regionIds.size() << " float" << nl;
|
||||||
|
|
||||||
|
|
||||||
forAll(regionLst, faceI)
|
forAll(regionIds, faceI)
|
||||||
{
|
{
|
||||||
if (faceI)
|
if (faceI)
|
||||||
{
|
{
|
||||||
if ((faceI % 20) == 0)
|
if (faceI % 20)
|
||||||
{
|
|
||||||
os << nl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
os << ' ';
|
os << ' ';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os << nl;
|
||||||
}
|
}
|
||||||
os << regionLst[faceI] + 1;
|
}
|
||||||
|
os << regionIds[faceI] + 1;
|
||||||
}
|
}
|
||||||
os << nl;
|
os << nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,11 +64,11 @@ protected:
|
|||||||
const pointField&
|
const pointField&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Write trailing information with patch information
|
|
||||||
static void writeTail(Ostream&, const List<surfGroup>&);
|
|
||||||
|
|
||||||
//- Write trailing information with region information
|
//- Write trailing information with region information
|
||||||
static void writeTail(Ostream&, const List<label>& regionLst);
|
static void writeTail(Ostream&, const UList<surfRegion>&);
|
||||||
|
|
||||||
|
//- Write trailing information with region Ids
|
||||||
|
static void writeTail(Ostream&, const UList<label>& regionIds);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user