Commit ffdb280a authored by Mark Olesen's avatar Mark Olesen
Browse files

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.
parent c6e9b323
......@@ -56,6 +56,7 @@ Note
#include "Time.H"
#include "polyMesh.H"
#include "triSurface.H"
#include "PackedBoolList.H"
#include "MeshedSurfaces.H"
#include "UnsortedMeshedSurfaces.H"
......@@ -115,7 +116,7 @@ int main(int argc, char *argv[])
if (args.options().found("orient"))
{
Info<< "Checking surface orientation" << endl;
surf.checkOrientation(true);
PatchTools::checkOrientation(surf, true);
Info<< endl;
}
......@@ -154,7 +155,7 @@ int main(int argc, char *argv[])
if (args.options().found("orient"))
{
Info<< "Checking surface orientation" << endl;
surf.checkOrientation(true);
PatchTools::checkOrientation(surf, true);
Info<< endl;
}
......@@ -192,7 +193,7 @@ int main(int argc, char *argv[])
if (args.options().found("orient"))
{
Info<< "Checking surface orientation" << endl;
surf.checkOrientation(true);
PatchTools::checkOrientation(surf, true);
Info<< endl;
}
......@@ -230,7 +231,7 @@ int main(int argc, char *argv[])
if (args.options().found("orient"))
{
Info<< "Checking surface orientation" << endl;
surf.checkOrientation(true);
PatchTools::checkOrientation(surf, true);
Info<< endl;
}
......
......@@ -60,8 +60,6 @@ SourceFiles
namespace Foam
{
class patchZones;
/*---------------------------------------------------------------------------*\
Class cyclicPolyPatch Declaration
\*---------------------------------------------------------------------------*/
......
......@@ -26,11 +26,6 @@ License
#include "Map.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
......@@ -41,7 +36,9 @@ template
class PointField,
class PointType
>
PrimitivePatch<Face, FaceList, PointField, PointType>::PrimitivePatch
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
PrimitivePatch
(
const FaceList<Face>& faces,
const Field<PointType>& points
......@@ -76,7 +73,9 @@ template
class PointField,
class PointType
>
PrimitivePatch<Face, FaceList, PointField, PointType>::PrimitivePatch
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
PrimitivePatch
(
FaceList<Face>& faces,
Field<PointType>& points,
......@@ -112,7 +111,9 @@ template
class PointField,
class PointType
>
PrimitivePatch<Face, FaceList, PointField, PointType>::PrimitivePatch
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
PrimitivePatch
(
const PrimitivePatch<Face, FaceList, PointField, PointType>& pp
)
......@@ -148,7 +149,8 @@ template
class PointField,
class PointType
>
PrimitivePatch<Face, FaceList, PointField, PointType>::~PrimitivePatch()
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::~PrimitivePatch()
{
clearOut();
}
......@@ -164,7 +166,10 @@ template
class PointField,
class PointType
>
void PrimitivePatch<Face, FaceList, PointField, PointType>::movePoints
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
movePoints
(
const Field<PointType>&
)
......@@ -188,8 +193,10 @@ template
class PointField,
class PointType
>
const edgeList&
PrimitivePatch<Face, FaceList, PointField, PointType>::edges() const
const Foam::edgeList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
edges() const
{
if (!edgesPtr_)
{
......@@ -207,8 +214,10 @@ template
class PointField,
class PointType
>
label PrimitivePatch<Face, FaceList, PointField, PointType>::nInternalEdges()
const
Foam::label
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
nInternalEdges() const
{
if (!edgesPtr_)
{
......@@ -226,8 +235,10 @@ template
class PointField,
class PointType
>
const labelList&
PrimitivePatch<Face, FaceList, PointField, PointType>::boundaryPoints() const
const Foam::labelList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
boundaryPoints() const
{
if (!boundaryPointsPtr_)
{
......@@ -245,8 +256,10 @@ template
class PointField,
class PointType
>
const labelListList&
PrimitivePatch<Face, FaceList, PointField, PointType>::faceFaces() const
const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
faceFaces() const
{
if (!faceFacesPtr_)
{
......@@ -264,8 +277,10 @@ template
class PointField,
class PointType
>
const labelListList&
PrimitivePatch<Face, FaceList, PointField, PointType>::edgeFaces() const
const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
edgeFaces() const
{
if (!edgeFacesPtr_)
{
......@@ -283,8 +298,10 @@ template
class PointField,
class PointType
>
const labelListList&
PrimitivePatch<Face, FaceList, PointField, PointType>::faceEdges() const
const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
faceEdges() const
{
if (!faceEdgesPtr_)
{
......@@ -302,8 +319,10 @@ template
class PointField,
class PointType
>
const labelListList&
PrimitivePatch<Face, FaceList, PointField, PointType>::pointEdges() const
const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
pointEdges() const
{
if (!pointEdgesPtr_)
{
......@@ -321,8 +340,10 @@ template
class PointField,
class PointType
>
const labelListList&
PrimitivePatch<Face, FaceList, PointField, PointType>::pointFaces() const
const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
pointFaces() const
{
if (!pointFacesPtr_)
{
......@@ -340,8 +361,10 @@ template
class PointField,
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_)
{
......@@ -359,8 +382,10 @@ template
class PointField,
class PointType
>
const labelList&
PrimitivePatch<Face, FaceList, PointField, PointType>::meshPoints() const
const Foam::labelList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
meshPoints() const
{
if (!meshPointsPtr_)
{
......@@ -378,8 +403,10 @@ template
class PointField,
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_)
{
......@@ -397,8 +424,10 @@ template
class PointField,
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_)
{
......@@ -416,8 +445,10 @@ template
class PointField,
class PointType
>
const labelList&
PrimitivePatch<Face, FaceList, PointField, PointType>::localPointOrder() const
const Foam::labelList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
localPointOrder() const
{
if (!localPointOrderPtr_)
{
......@@ -435,16 +466,19 @@ template
class PointField,
class PointType
>
label PrimitivePatch<Face, FaceList, PointField, PointType>::whichPoint
Foam::label
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
whichPoint
(
const label gp
) 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
{
......@@ -461,8 +495,10 @@ template
class PointField,
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_)
{
......@@ -480,8 +516,10 @@ template
class PointField,
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_)
{
......@@ -501,7 +539,10 @@ template
class PointField,
class PointType
>
void PrimitivePatch<Face, FaceList, PointField, PointType>::operator=
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
operator=
(
const PrimitivePatch<Face, FaceList, PointField, PointType>& pp
)
......@@ -511,11 +552,6 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::operator=
FaceList<Face>::operator=(pp);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "PrimitivePatchAddressing.C"
......
......@@ -28,10 +28,10 @@ Class
Description
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
etc.) and on the form of list for faces and points so that it can
refer to existing lists using UList and const pointField& or hold the
storage using List and pointField.
The class is templated on the face type (e.g. triangle, polygon etc.)
and on the list type of faces and points so that it can refer to
existing lists using UList and const pointField& or hold the storage
using List and pointField.
SourceFiles
PrimitivePatchAddressing.C
......@@ -211,9 +211,12 @@ private:
//- Calculate unit point normals
void calcPointNormals() const;
//- Calculate edge owner
void calcEdgeOwner() const;
//- 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.
void visitPointRegion
(
const label pointI,
......@@ -265,175 +268,175 @@ public:
// Member Functions
// Access
// Access
//- Return reference to global points
const Field<PointType>& points() const
{
return points_;
}
//- Return reference to global points
const Field<PointType>& points() const
{
return points_;
}
// Access functions for demand driven data
// Access functions for demand driven data
// Topological data; no mesh required.
// Topological data; no mesh required.
//- Return number of points supporting patch faces
label nPoints() const
{
return meshPoints().size();
}
//- Return number of points supporting patch faces
label nPoints() const
{
return meshPoints().size();
}
//- Return number of edges in patch
label nEdges() const
{
return edges().size();
}
//- Return number of edges in patch
label nEdges() const
{
return edges().size();
}
//- Return list of edges, address into LOCAL point list
const edgeList& edges() const;
//- Return list of edges, address into LOCAL point list
const edgeList& edges() const;
//- Number of internal edges
label nInternalEdges() const;
//- Number of internal edges
label nInternalEdges() const;
//- Is internal edge?
bool isInternalEdge(const label edgeI) const
{
return edgeI < nInternalEdges();
}
//- Is internal edge?
bool isInternalEdge(const label edgeI) const
{
return edgeI < nInternalEdges();
}
//- Return list of boundary points,
// address into LOCAL point list
const labelList& boundaryPoints() const;
//- Return list of boundary points,
// address into LOCAL point list
const labelList& boundaryPoints() const;
//- Return face-face addressing
const labelListList& faceFaces() const;
//- Return face-face addressing
const labelListList& faceFaces() const;
//- Return edge-face addressing
const labelListList& edgeFaces() const;
//- Return edge-face addressing
const labelListList& edgeFaces() const;
//- Return face-edge addressing
const labelListList& faceEdges() const;
//- Return face-edge addressing
const labelListList& faceEdges() const;
//- Return point-edge addressing
const labelListList& pointEdges() const;
//- Return point-edge addressing
const labelListList& pointEdges() const;
//- Return point-face addressing
const labelListList& pointFaces() const;
//- Return point-face addressing
const labelListList& pointFaces() const;
//- Return patch faces addressing into local point list
const List<Face>& localFaces() const;
//- Return patch faces addressing into local point list
const List<Face>& localFaces() const;
// Addressing into mesh
// Addressing into mesh
//- Return labelList of mesh points in patch
const labelList& meshPoints() const;
//- Return labelList of mesh points in patch
const labelList& meshPoints() const;
//- Mesh point map. Given the global point index find its
// location in the patch
const Map<label>& meshPointMap() const;
//- Mesh point map. Given the global point index find its
// location in the patch
const Map<label>& meshPointMap() const;
//- Return pointField of points in patch
const Field<PointType>& localPoints() const;
//- Return pointField of points in patch
const Field<PointType>& localPoints() const;
//- Return orders the local points for most efficient search
const labelList& localPointOrder() const;
//- Return orders the local points for most efficient search
const labelList& localPointOrder() const;
//- Given a global point index, return the local point
//index. If the point is not found, return -1
label whichPoint(const label gp) const;
//- Given a global point index, return the local point index.
// If the point is not found, return -1
label whichPoint(const label gp) const;
//- Given an edge in local point labels, return its
// index in the edge list. If the edge is not found, return -1
label whichEdge(const edge& e) const;
//- Given an edge in local point labels, return its
// index in the edge list. If the edge is not found, return -1
label whichEdge(const edge&) const;
//- Return labels of patch edges in the global edge list using
// cell addressing
labelList meshEdges
(
const edgeList& allEdges,
const labelListList& cellEdges,
const labelList& faceCells
) const;
//- Return labels of patch edges in the global edge list using
// cell addressing
labelList meshEdges
(
const edgeList& allEdges,
const labelListList& cellEdges,
const labelList& faceCells
) const;
//- Return labels of patch edges in the global edge list using
// basic edge addressing.
labelList meshEdges
(
const edgeList& allEdges,
const labelListList& pointEdges
) const;
//- Return labels of patch edges in the global edge list using
// basic edge addressing.
labelList meshEdges
(
const edgeList& allEdges,
const labelListList& pointEdges
) const;
//- Return face normals for patch
const Field<PointType>& faceNormals() const;
//- Return face normals for patch
const Field<PointType>& faceNormals() const;
//- Return point normals for patch
const Field<PointType>& pointNormals() const;
//- Return point normals for patch
const Field<PointType>& pointNormals() const;
// Other patch operations
// Other patch operations
//- Project vertices of patch onto another patch
template <class ToPatch>
List<objectHit> projectPoints
(
const ToPatch& targetPatch,
const Field<PointType>& projectionDirection,
const intersection::algorithm alg = intersection::FULL_RAY,
const intersection::direction dir = intersection::VECTOR
) const;
//- Project vertices of patch onto another patch
template <class ToPatch>
List<objectHit> projectPoints
(
const ToPatch& targetPatch,
const Field<PointType>& projectionDirection,
const intersection::algorithm = intersection::FULL_RAY,
const intersection::direction = intersection::VECTOR
) const;
//- Project vertices of patch onto another patch
template <class ToPatch>
List<objectHit> projectFaceCentres
(
const ToPatch& targetPatch,
const Field<PointType>& projectionDirection,
const intersection::algorithm alg = intersection::FULL_RAY,
const intersection::direction dir = intersection::VECTOR
<