Merge branch 'style-primitive-patch' into 'develop'

Update primitive patch templating and storage

See merge request Development/openfoam!357
This commit is contained in:
Andrew Heather
2020-05-01 07:10:04 +01:00
68 changed files with 596 additions and 1161 deletions

View File

@ -249,7 +249,7 @@ int main(int argc, char *argv[])
faceList patchFaces(patch); faceList patchFaces(patch);
pointField allPoints(patch.points()); pointField allPoints(patch.points());
PrimitivePatch<face, List, pointField, point> storedPatch PrimitivePatch<List<face>, pointField> storedPatch
( (
patchFaces, patchFaces,
allPoints, allPoints,

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -53,7 +54,7 @@ class extrudedMesh
: :
public polyMesh public polyMesh
{ {
// Private data // Private Data
const extrudeModel& model_; const extrudeModel& model_;
@ -64,26 +65,26 @@ class extrudedMesh
static bool sameOrder(const face&, const edge&); static bool sameOrder(const face&, const edge&);
//- Construct and return the extruded mesh points //- Construct and return the extruded mesh points
template<class Face, template<class> class FaceList, class PointField> template<class FaceList, class PointField>
pointField extrudedPoints pointField extrudedPoints
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& const extrudeModel&
); );
//- Construct and return the extruded mesh faces //- Construct and return the extruded mesh faces
template<class Face, template<class> class FaceList, class PointField> template<class FaceList, class PointField>
faceList extrudedFaces faceList extrudedFaces
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& const extrudeModel&
); );
//- Construct and return the extruded mesh cells //- Construct and return the extruded mesh cells
template<class Face, template<class> class FaceList, class PointField> template<class FaceList, class PointField>
cellList extrudedCells cellList extrudedCells
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& const extrudeModel&
); );
@ -100,11 +101,11 @@ public:
// Constructors // Constructors
//- Construct from the primitivePatch to extrude //- Construct from the primitivePatch to extrude
template<class Face, template<class> class FaceList, class PointField> template<class FaceList, class PointField>
extrudedMesh extrudedMesh
( (
const IOobject&, const IOobject&,
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& const extrudeModel&
); );
}; };

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2012 OpenFOAM Foundation Copyright (C) 2011-2012 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,15 +31,10 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField
>
Foam::pointField Foam::extrudedMesh::extrudedPoints Foam::pointField Foam::extrudedMesh::extrudedPoints
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& model const extrudeModel& model
) )
{ {
@ -68,10 +64,10 @@ Foam::pointField Foam::extrudedMesh::extrudedPoints
} }
template<class Face, template<class> class FaceList, class PointField> template<class FaceList, class PointField>
Foam::faceList Foam::extrudedMesh::extrudedFaces Foam::faceList Foam::extrudedMesh::extrudedFaces
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& model const extrudeModel& model
) )
{ {
@ -194,10 +190,10 @@ Foam::faceList Foam::extrudedMesh::extrudedFaces
} }
template<class Face, template<class> class FaceList, class PointField> template<class FaceList, class PointField>
Foam::cellList Foam::extrudedMesh::extrudedCells Foam::cellList Foam::extrudedMesh::extrudedCells
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& model const extrudeModel& model
) )
{ {
@ -302,16 +298,11 @@ Foam::cellList Foam::extrudedMesh::extrudedCells
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField
>
Foam::extrudedMesh::extrudedMesh Foam::extrudedMesh::extrudedMesh
( (
const IOobject& io, const IOobject& io,
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<FaceList, PointField>& extrudePatch,
const extrudeModel& model const extrudeModel& model
) )
: :

View File

@ -81,7 +81,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
typedef PrimitivePatch<face, List, const pointField, point> bPatch; typedef PrimitivePatch<::Foam::List<face>, const pointField> bPatch;
typedef treeDataPrimitivePatch<bPatch> treeDataBPatch; typedef treeDataPrimitivePatch<bPatch> treeDataBPatch;
class Time; class Time;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2016 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -199,7 +199,7 @@ Foam::tmp<Foam::triSurfacePointScalarField> Foam::automatic::load()
PrimitivePatchInterpolation PrimitivePatchInterpolation
< <
PrimitivePatch<labelledTri, ::Foam::List, pointField, point> PrimitivePatch<::Foam::List<labelledTri>, pointField>
> patchInterpolate(surface_); > patchInterpolate(surface_);
const Map<label>& meshPointMap = surface_.meshPointMap(); const Map<label>& meshPointMap = surface_.meshPointMap();

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2015 OpenFOAM Foundation Copyright (C) 2012-2015 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -61,11 +61,11 @@ class nonUniformField
protected: protected:
// Private typedef // Typedefs
typedef PrimitivePatchInterpolation typedef PrimitivePatchInterpolation
< <
PrimitivePatch<labelledTri, List, pointField, point> PrimitivePatch<::Foam::List<labelledTri>, pointField>
> primitivePatchInterpolation; > primitivePatchInterpolation;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -35,6 +35,7 @@ License
#include "entry.H" #include "entry.H"
#include "dictionary.H" #include "dictionary.H"
#include "pointPatchField.H" #include "pointPatchField.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -57,7 +58,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward Declarations
class polyMesh; class polyMesh;
class bitSet; class bitSet;
class boundBox; class boundBox;
@ -73,16 +74,10 @@ public:
//- Check for orientation issues. //- Check for orientation issues.
// Returns true if problems were found. // Returns true if problems were found.
// If a normal flips across an edge, places it in the HashSet // If a normal flips across an edge, places it in the HashSet
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
static bool checkOrientation static bool checkOrientation
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>&, const PrimitivePatch<FaceList, PointField>&,
const bool report = false, const bool report = false,
labelHashSet* marked = 0 labelHashSet* marked = 0
); );
@ -91,17 +86,10 @@ public:
//- Fill faceZone with currentZone for every face reachable //- Fill faceZone with currentZone for every face reachable
// from facei without crossing edge marked in borderEdge. // from facei without crossing edge marked in borderEdge.
// Note: faceZone has to be sized nFaces before calling. // Note: faceZone has to be sized nFaces before calling.
template template<class BoolListType, class FaceList, class PointField>
<
class BoolListType,
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
static void markZone static void markZone
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>&, const PrimitivePatch<FaceList, PointField>&,
const BoolListType& borderEdge, const BoolListType& borderEdge,
const label facei, const label facei,
const label currentZone, const label currentZone,
@ -111,17 +99,10 @@ public:
//- Size and fills faceZone with zone of face. //- Size and fills faceZone with zone of face.
// Zone is area reachable by edge crossing without crossing borderEdge. // Zone is area reachable by edge crossing without crossing borderEdge.
// Returns number of zones. // Returns number of zones.
template template<class BoolListType, class FaceList, class PointField>
<
class BoolListType,
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
static label markZones static label markZones
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>&, const PrimitivePatch<FaceList, PointField>&,
const BoolListType& borderEdge, const BoolListType& borderEdge,
labelList& faceZone labelList& faceZone
); );
@ -132,78 +113,47 @@ public:
// \param[in] includeFaces faces to include // \param[in] includeFaces faces to include
// \param[out] pointMap mapping new to old localPoints // \param[out] pointMap mapping new to old localPoints
// \param[out] faceMap mapping new to old faces // \param[out] faceMap mapping new to old faces
template template<class BoolListType, class FaceList, class PointField>
<
class BoolListType,
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
static void subsetMap static void subsetMap
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& p, const PrimitivePatch<FaceList, PointField>& p,
const BoolListType& includeFaces, const BoolListType& includeFaces,
labelList& pointMap, labelList& pointMap,
labelList& faceMap labelList& faceMap
); );
//- //-
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
static void calcBounds static void calcBounds
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& p, const PrimitivePatch<FaceList, PointField>& p,
boundBox& bb, boundBox& bb,
label& nPoints label& nPoints
); );
//- Return edge-face addressing sorted by angle around the edge. //- Return edge-face addressing sorted by angle around the edge.
// Orientation is anticlockwise looking from edge.vec(localPoints()) // Orientation is anticlockwise looking from edge.vec(localPoints())
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
static labelListList sortedEdgeFaces static labelListList sortedEdgeFaces
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& const PrimitivePatch<FaceList, PointField>&
); );
//- Return point-edge addressing sorted by order around the point. //- Return point-edge addressing sorted by order around the point.
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
static labelListList sortedPointEdges static labelListList sortedPointEdges
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& const PrimitivePatch<FaceList, PointField>&
); );
//- If 2 face neighbours: label of face where ordering of edge //- If 2 face neighbours: label of face where ordering of edge
// is consistent with righthand walk. // is consistent with righthand walk.
// If 1 neighbour: label of only face. // If 1 neighbour: label of only face.
// If >2 neighbours: undetermined. // If >2 neighbours: undetermined.
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
static labelList edgeOwner static labelList edgeOwner
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& const PrimitivePatch<FaceList, PointField>&
); );
@ -212,19 +162,13 @@ public:
// p2PointLabels : corresponding points on p2 // p2PointLabels : corresponding points on p2
template template
< <
class Face1, class FaceList1, class PointField1,
template<class> class FaceList1, class FaceList2, class PointField2
class PointField1,
class PointType1,
class Face2,
template<class> class FaceList2,
class PointField2,
class PointType2
> >
static void matchPoints static void matchPoints
( (
const PrimitivePatch<Face1, FaceList1, PointField1, PointType1>& p1, const PrimitivePatch<FaceList1, PointField1>& p1,
const PrimitivePatch<Face2, FaceList2, PointField2, PointType2>& p2, const PrimitivePatch<FaceList2, PointField2>& p2,
labelList& p1PointLabels, labelList& p1PointLabels,
labelList& p2PointLabels labelList& p2PointLabels
@ -236,19 +180,13 @@ public:
// sameOrientation : same orientation? // sameOrientation : same orientation?
template template
< <
class Face1, class FaceList1, class PointField1,
template<class> class FaceList1, class FaceList2, class PointField2
class PointField1,
class PointType1,
class Face2,
template<class> class FaceList2,
class PointField2,
class PointType2
> >
static void matchEdges static void matchEdges
( (
const PrimitivePatch<Face1, FaceList1, PointField1, PointType1>& p1, const PrimitivePatch<FaceList1, PointField1>& p1,
const PrimitivePatch<Face2, FaceList2, PointField2, PointType2>& p2, const PrimitivePatch<FaceList2, PointField2>& p2,
labelList& p1EdgeLabels, labelList& p1EdgeLabels,
labelList& p2EdgeLabels, labelList& p2EdgeLabels,
@ -257,33 +195,21 @@ public:
//- Return parallel consistent point normals for patches using mesh points. //- Return parallel consistent point normals for patches using mesh points.
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
static tmp<pointField> pointNormals static tmp<pointField> pointNormals
( (
const polyMesh&, const polyMesh&,
const PrimitivePatch<Face, FaceList, PointField, PointType>& const PrimitivePatch<FaceList, PointField>&
); );
//- Return parallel consistent edge normals for patches using mesh points. //- Return parallel consistent edge normals for patches using mesh points.
// Supply with patch matching info from matchEdges. // Supply with patch matching info from matchEdges.
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
static tmp<pointField> edgeNormals static tmp<pointField> edgeNormals
( (
const polyMesh&, const polyMesh&,
const PrimitivePatch<Face, FaceList, PointField, PointType>&, const PrimitivePatch<FaceList, PointField>&,
const labelList& patchEdges, const labelList& patchEdges,
const labelList& coupledEdges const labelList& coupledEdges
); );
@ -291,19 +217,19 @@ public:
//- Gather points and faces onto master and merge into single patch. //- Gather points and faces onto master and merge into single patch.
// Note: uses faces/points, not localFaces/localPoints. // Note: uses faces/points, not localFaces/localPoints.
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
static void gatherAndMerge static void gatherAndMerge
( (
const scalar mergeDist, const scalar mergeDist,
const PrimitivePatch<Face, FaceList, PointField, PointType>& p, const PrimitivePatch<FaceList, PointField>& p,
Field<PointType>& mergedPoints, Field
List<Face>& mergedFaces, <
typename PrimitivePatch<FaceList, PointField>::point_type
>& mergedPoints,
List
<
typename PrimitivePatch<FaceList, PointField>::face_type
>& mergedFaces,
labelList& pointMergeMap labelList& pointMergeMap
); );

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,22 +30,17 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
bool bool
Foam::PatchTools::checkOrientation Foam::PatchTools::checkOrientation
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& p, const PrimitivePatch<FaceList, PointField>& p,
const bool report, const bool report,
labelHashSet* setPtr labelHashSet* setPtr
) )
{ {
typedef typename PrimitivePatch<FaceList, PointField>::face_type FaceType;
bool foundError = false; bool foundError = false;
// Check edge normals, face normals, point normals. // Check edge normals, face normals, point normals.
@ -93,7 +89,7 @@ Foam::PatchTools::checkOrientation
// //
//- Compute normal from 3 points, use the first as the origin //- Compute normal from 3 points, use the first as the origin
// minor warpage should not be a problem // minor warpage should not be a problem
const Face& f = p[facei]; const FaceType& f = p[facei];
const point& p0 = p.points()[f[0]]; const point& p0 = p.points()[f[0]];
const point& p1 = p.points()[f[1]]; const point& p1 = p.points()[f[1]];
const point& p2 = p.points()[f.last()]; const point& p2 = p.points()[f.last()];
@ -126,8 +122,8 @@ Foam::PatchTools::checkOrientation
{ {
// we use localFaces() since edges() are LOCAL // we use localFaces() since edges() are LOCAL
// these are both already available // these are both already available
const Face& faceA = p.localFaces()[neighbouringFaces[0]]; const FaceType& faceA = p.localFaces()[neighbouringFaces[0]];
const Face& faceB = p.localFaces()[neighbouringFaces[1]]; const FaceType& faceB = p.localFaces()[neighbouringFaces[1]];
// If the faces are correctly oriented, the edges must go in // If the faces are correctly oriented, the edges must go in
// different directions on connected faces. // different directions on connected faces.

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,23 +30,18 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::labelList Foam::labelList
Foam::PatchTools::edgeOwner Foam::PatchTools::edgeOwner
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& p const PrimitivePatch<FaceList, PointField>& p
) )
{ {
typedef typename PrimitivePatch<FaceList, PointField>::face_type FaceType;
const edgeList& edges = p.edges(); const edgeList& edges = p.edges();
const labelListList& edgeFaces = p.edgeFaces(); const labelListList& edgeFaces = p.edgeFaces();
const List<Face>& localFaces = p.localFaces(); const List<FaceType>& localFaces = p.localFaces();
// create the owner list // create the owner list
labelList edgeOwner(edges.size(), -1); labelList edgeOwner(edges.size(), -1);
@ -62,13 +58,13 @@ Foam::PatchTools::edgeOwner
{ {
// Find the first face whose vertices are aligned with the edge. // Find the first face whose vertices are aligned with the edge.
// with multiply connected edges, this is the best we can do // with multiply connected edges, this is the best we can do
forAll(nbrFaces, i) for (const label nbrFacei : nbrFaces)
{ {
const Face& f = localFaces[nbrFaces[i]]; const FaceType& f = localFaces[nbrFacei];
if (f.edgeDirection(edges[edgeI]) > 0) if (f.edgeDirection(edges[edgeI]) > 0)
{ {
edgeOwner[edgeI] = nbrFaces[i]; edgeOwner[edgeI] = nbrFacei;
break; break;
} }
} }
@ -79,7 +75,7 @@ Foam::PatchTools::edgeOwner
<< "Edge " << edgeI << " vertices:" << edges[edgeI] << "Edge " << edgeI << " vertices:" << edges[edgeI]
<< " is used by faces " << nbrFaces << " is used by faces " << nbrFaces
<< " vertices:" << " vertices:"
<< UIndirectList<Face>(localFaces, nbrFaces) << UIndirectList<FaceType>(localFaces, nbrFaces)
<< " none of which use the edge vertices in the same order" << " none of which use the edge vertices in the same order"
<< nl << "I give up" << abort(FatalError); << nl << "I give up" << abort(FatalError);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -33,22 +33,25 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void Foam::PatchTools::gatherAndMerge void Foam::PatchTools::gatherAndMerge
( (
const scalar mergeDist, const scalar mergeDist,
const PrimitivePatch<Face, FaceList, PointField, PointType>& p, const PrimitivePatch<FaceList, PointField>& p,
Field<PointType>& mergedPoints, Field
List<Face>& mergedFaces, <
typename PrimitivePatch<FaceList, PointField>::point_type
>& mergedPoints,
List
<
typename PrimitivePatch<FaceList, PointField>::face_type
>& mergedFaces,
labelList& pointMergeMap labelList& pointMergeMap
) )
{ {
typedef typename PrimitivePatch<FaceList,PointField>::face_type FaceType;
typedef typename PrimitivePatch<FaceList,PointField>::point_type PointType;
// Collect points from all processors // Collect points from all processors
labelList pointSizes; labelList pointSizes;
{ {
@ -62,20 +65,20 @@ void Foam::PatchTools::gatherAndMerge
// Collect faces from all processors and renumber using sizes of // Collect faces from all processors and renumber using sizes of
// gathered points // gathered points
{ {
List<List<Face>> gatheredFaces(Pstream::nProcs()); List<List<FaceType>> gatheredFaces(Pstream::nProcs());
gatheredFaces[Pstream::myProcNo()] = p; gatheredFaces[Pstream::myProcNo()] = p;
Pstream::gatherList(gatheredFaces); Pstream::gatherList(gatheredFaces);
if (Pstream::master()) if (Pstream::master())
{ {
mergedFaces = static_cast<const List<Face>&> mergedFaces = static_cast<const List<FaceType>&>
( (
ListListOps::combineOffset<List<Face>> ListListOps::combineOffset<List<FaceType>>
( (
gatheredFaces, gatheredFaces,
pointSizes, pointSizes,
accessOp<List<Face>>(), accessOp<List<FaceType>>(),
offsetOp<Face>() offsetOp<FaceType>()
) )
); );
} }
@ -104,11 +107,9 @@ void Foam::PatchTools::gatherAndMerge
mergedPoints.transfer(newPoints); mergedPoints.transfer(newPoints);
// Relabel faces // Relabel faces
List<Face>& faces = mergedFaces; for (auto& f : mergedFaces)
forAll(faces, facei)
{ {
inplaceRenumber(pointMergeMap, faces[facei]); inplaceRenumber(pointMergeMap, f);
} }
} }
} }
@ -151,9 +152,9 @@ void Foam::PatchTools::gatherAndMerge
// Get renumbered local data // Get renumbered local data
pointField myPoints(mesh.points(), uniqueMeshPointLabels); pointField myPoints(mesh.points(), uniqueMeshPointLabels);
List<FaceType> myFaces(localFaces); List<FaceType> myFaces(localFaces);
forAll(myFaces, i) for (auto& f : myFaces)
{ {
inplaceRenumber(pointToGlobal, myFaces[i]); inplaceRenumber(pointToGlobal, f);
} }
@ -190,9 +191,9 @@ void Foam::PatchTools::gatherAndMerge
// Get renumbered local data // Get renumbered local data
pointField myPoints(mesh.points(), uniqueMeshPointLabels); pointField myPoints(mesh.points(), uniqueMeshPointLabels);
List<FaceType> myFaces(localFaces); List<FaceType> myFaces(localFaces);
forAll(myFaces, i) for (auto& f : myFaces)
{ {
inplaceRenumber(pointToGlobal, myFaces[i]); inplaceRenumber(pointToGlobal, f);
} }
// Construct processor stream with estimate of size. Could // Construct processor stream with estimate of size. Could

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -32,19 +32,13 @@ License
template template
< <
class Face1, class FaceList1, class PointField1,
template<class> class FaceList1, class FaceList2, class PointField2
class PointField1,
class PointType1,
class Face2,
template<class> class FaceList2,
class PointField2,
class PointType2
> >
void Foam::PatchTools::matchPoints void Foam::PatchTools::matchPoints
( (
const PrimitivePatch<Face1, FaceList1, PointField1, PointType1>& p1, const PrimitivePatch<FaceList1, PointField1>& p1,
const PrimitivePatch<Face2, FaceList2, PointField2, PointType2>& p2, const PrimitivePatch<FaceList2, PointField2>& p2,
labelList& p1PointLabels, labelList& p1PointLabels,
labelList& p2PointLabels labelList& p2PointLabels
@ -75,19 +69,13 @@ void Foam::PatchTools::matchPoints
template template
< <
class Face1, class FaceList1, class PointField1,
template<class> class FaceList1, class FaceList2, class PointField2
class PointField1,
class PointType1,
class Face2,
template<class> class FaceList2,
class PointField2,
class PointType2
> >
void Foam::PatchTools::matchEdges void Foam::PatchTools::matchEdges
( (
const PrimitivePatch<Face1, FaceList1, PointField1, PointType1>& p1, const PrimitivePatch<FaceList1, PointField1>& p1,
const PrimitivePatch<Face2, FaceList2, PointField2, PointType2>& p2, const PrimitivePatch<FaceList2, PointField2>& p2,
labelList& p1EdgeLabels, labelList& p1EdgeLabels,
labelList& p2EdgeLabels, labelList& p2EdgeLabels,

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -33,19 +33,12 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::tmp<Foam::pointField> Foam::tmp<Foam::pointField>
Foam::PatchTools::pointNormals Foam::PatchTools::pointNormals
( (
const polyMesh& mesh, const polyMesh& mesh,
const PrimitivePatch<Face, FaceList, PointField, PointType>& p const PrimitivePatch<FaceList, PointField>& p
) )
{ {
const globalMeshData& globalData = mesh.globalData(); const globalMeshData& globalData = mesh.globalData();
@ -196,27 +189,21 @@ Foam::PatchTools::pointNormals
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::tmp<Foam::pointField> Foam::tmp<Foam::pointField>
Foam::PatchTools::edgeNormals Foam::PatchTools::edgeNormals
( (
const polyMesh& mesh, const polyMesh& mesh,
const PrimitivePatch<Face, FaceList, PointField, PointType>& p, const PrimitivePatch<FaceList, PointField>& p,
const labelList& patchEdges, const labelList& patchEdges,
const labelList& coupledEdges const labelList& coupledEdges
) )
{ {
// 1. Start off with local normals // 1. Start off with local normals
tmp<pointField> tedgeNormals(new pointField(p.nEdges(), Zero)); auto tedgeNormals = tmp<pointField>::New(p.nEdges(), Zero);
pointField& edgeNormals = tedgeNormals.ref(); auto& edgeNormals = tedgeNormals.ref();
{ {
const labelListList& edgeFaces = p.edgeFaces(); const labelListList& edgeFaces = p.edgeFaces();
const vectorField& faceNormals = p.faceNormals(); const vectorField& faceNormals = p.faceNormals();

View File

@ -35,17 +35,10 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template template<class BoolListType, class FaceList, class PointField>
<
class BoolListType,
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void Foam::PatchTools::markZone void Foam::PatchTools::markZone
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& p, const PrimitivePatch<FaceList, PointField>& p,
const BoolListType& borderEdge, const BoolListType& borderEdge,
const label facei, const label facei,
const label currentZone, const label currentZone,
@ -111,19 +104,11 @@ void Foam::PatchTools::markZone
} }
template template<class BoolListType, class FaceList, class PointField>
<
class BoolListType,
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::label Foam::label
Foam::PatchTools::markZones Foam::PatchTools::markZones
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& p, const PrimitivePatch<FaceList, PointField>& p,
const BoolListType& borderEdge, const BoolListType& borderEdge,
labelList& faceZone labelList& faceZone
) )
@ -151,25 +136,17 @@ Foam::PatchTools::markZones
} }
template template<class BoolListType, class FaceList, class PointField>
<
class BoolListType,
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PatchTools::subsetMap Foam::PatchTools::subsetMap
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& p, const PrimitivePatch<FaceList, PointField>& p,
const BoolListType& includeFaces, const BoolListType& includeFaces,
labelList& pointMap, labelList& pointMap,
labelList& faceMap labelList& faceMap
) )
{ {
const List<Face>& localFaces = p.localFaces(); const auto& localFaces = p.localFaces();
faceMap.resize(localFaces.size()); faceMap.resize(localFaces.size());
pointMap.clear(); pointMap.clear();
@ -196,16 +173,10 @@ Foam::PatchTools::subsetMap
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void Foam::PatchTools::calcBounds void Foam::PatchTools::calcBounds
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& p, const PrimitivePatch<FaceList, PointField>& p,
boundBox& bb, boundBox& bb,
label& nPoints label& nPoints
) )

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,24 +32,17 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::labelListList Foam::labelListList
Foam::PatchTools::sortedEdgeFaces Foam::PatchTools::sortedEdgeFaces
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& p const PrimitivePatch<FaceList, PointField>& p
) )
{ {
const edgeList& edges = p.edges(); const edgeList& edges = p.edges();
const labelListList& edgeFaces = p.edgeFaces(); const labelListList& edgeFaces = p.edgeFaces();
const List<Face>& localFaces = p.localFaces(); const auto& localFaces = p.localFaces();
const Field<PointType>& localPoints = p.localPoints(); const auto& localPoints = p.localPoints();
// create the lists for the various results. (resized on completion) // create the lists for the various results. (resized on completion)
labelListList sortedEdgeFaces(edgeFaces.size()); labelListList sortedEdgeFaces(edgeFaces.size());
@ -69,7 +63,7 @@ Foam::PatchTools::sortedEdgeFaces
// Get the vertex on 0th face that forms a vector with the first // Get the vertex on 0th face that forms a vector with the first
// edge point that has the largest angle with the edge // edge point that has the largest angle with the edge
const Face& f0 = localFaces[faceNbs[0]]; const auto& f0 = localFaces[faceNbs[0]];
scalar maxAngle = GREAT; scalar maxAngle = GREAT;
vector maxAngleEdgeDir(vector::max); vector maxAngleEdgeDir(vector::max);
@ -110,7 +104,7 @@ Foam::PatchTools::sortedEdgeFaces
{ {
// Get the vertex on face that forms a vector with the first // Get the vertex on face that forms a vector with the first
// edge point that has the largest angle with the edge // edge point that has the largest angle with the edge
const Face& f = localFaces[faceNbs[nbI]]; const auto& f = localFaces[faceNbs[nbI]];
maxAngle = GREAT; maxAngle = GREAT;
maxAngleEdgeDir = vector::max; maxAngleEdgeDir = vector::max;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,18 +30,11 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::labelListList Foam::labelListList
Foam::PatchTools::sortedPointEdges Foam::PatchTools::sortedPointEdges
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& p const PrimitivePatch<FaceList, PointField>& p
) )
{ {
// Now order the edges of each point according to whether they share a // Now order the edges of each point according to whether they share a

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,21 +30,14 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
< Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
PrimitivePatch
( (
const FaceList<Face>& faces, const FaceList& faces,
const Field<PointType>& points const PointField& points
) )
: :
FaceList<Face>(faces), FaceList(faces),
points_(points), points_(points),
edgesPtr_(nullptr), edgesPtr_(nullptr),
nInternalEdges_(-1), nInternalEdges_(-1),
@ -67,21 +61,14 @@ PrimitivePatch
{} {}
template template<class FaceList, class PointField>
< Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
PrimitivePatch
( (
FaceList<Face>&& faces, FaceList&& faces,
const Field<PointType>& points const PointField& points
) )
: :
FaceList<Face>(std::move(faces)), FaceList(std::move(faces)),
points_(points), points_(points),
edgesPtr_(nullptr), edgesPtr_(nullptr),
nInternalEdges_(-1), nInternalEdges_(-1),
@ -105,22 +92,15 @@ PrimitivePatch
{} {}
template template<class FaceList, class PointField>
< Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
PrimitivePatch
( (
FaceList<Face>& faces, FaceList& faces,
Field<PointType>& points, PointField& points,
const bool reuse const bool reuse
) )
: :
FaceList<Face>(faces, reuse), FaceList(faces, reuse),
points_(points, reuse), points_(points, reuse),
edgesPtr_(nullptr), edgesPtr_(nullptr),
nInternalEdges_(-1), nInternalEdges_(-1),
@ -144,21 +124,14 @@ PrimitivePatch
{} {}
template template<class FaceList, class PointField>
< Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
PrimitivePatch
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& pp const PrimitivePatch<FaceList, PointField>& pp
) )
: :
PrimitivePatchName(), PrimitivePatchName(),
FaceList<Face>(pp), FaceList(pp),
points_(pp.points_), points_(pp.points_),
edgesPtr_(nullptr), edgesPtr_(nullptr),
nInternalEdges_(-1), nInternalEdges_(-1),
@ -184,15 +157,8 @@ PrimitivePatch
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
< Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch::~PrimitivePatch()
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
~PrimitivePatch()
{ {
clearOut(); clearOut();
} }
@ -200,23 +166,16 @@ Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::movePoints
movePoints
( (
const Field<PointType>& const Field<point_type>&
) )
{ {
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
<< "movePoints() : " << "movePoints() : "
<< "recalculating PrimitivePatch geometry following mesh motion" << "recalculating PrimitivePatch geometry following mesh motion"
<< endl; << endl;
@ -226,16 +185,9 @@ movePoints
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::edgeList& const Foam::edgeList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::edges() const
edges() const
{ {
if (!edgesPtr_) if (!edgesPtr_)
{ {
@ -246,16 +198,9 @@ edges() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::label Foam::label
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::nInternalEdges() const
nInternalEdges() const
{ {
if (!edgesPtr_) if (!edgesPtr_)
{ {
@ -266,16 +211,9 @@ nInternalEdges() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::labelList& const Foam::labelList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::boundaryPoints() const
boundaryPoints() const
{ {
if (!boundaryPointsPtr_) if (!boundaryPointsPtr_)
{ {
@ -286,16 +224,9 @@ boundaryPoints() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::labelListList& const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::faceFaces() const
faceFaces() const
{ {
if (!faceFacesPtr_) if (!faceFacesPtr_)
{ {
@ -306,16 +237,9 @@ faceFaces() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::labelListList& const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::edgeFaces() const
edgeFaces() const
{ {
if (!edgeFacesPtr_) if (!edgeFacesPtr_)
{ {
@ -326,16 +250,9 @@ edgeFaces() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::labelListList& const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::faceEdges() const
faceEdges() const
{ {
if (!faceEdgesPtr_) if (!faceEdgesPtr_)
{ {
@ -346,16 +263,9 @@ faceEdges() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::labelListList& const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::pointEdges() const
pointEdges() const
{ {
if (!pointEdgesPtr_) if (!pointEdgesPtr_)
{ {
@ -366,16 +276,9 @@ pointEdges() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::labelListList& const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::pointFaces() const
pointFaces() const
{ {
if (!pointFacesPtr_) if (!pointFacesPtr_)
{ {
@ -386,16 +289,12 @@ pointFaces() const
} }
template template<class FaceList, class PointField>
const Foam::List
< <
class Face, typename Foam::PrimitivePatch<FaceList, PointField>::face_type
template<class> class FaceList, >&
class PointField, Foam::PrimitivePatch<FaceList, PointField>::localFaces() const
class PointType
>
const Foam::List<Face>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
localFaces() const
{ {
if (!localFacesPtr_) if (!localFacesPtr_)
{ {
@ -406,16 +305,9 @@ localFaces() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::labelList& const Foam::labelList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::meshPoints() const
meshPoints() const
{ {
if (!meshPointsPtr_) if (!meshPointsPtr_)
{ {
@ -426,16 +318,9 @@ meshPoints() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::Map<Foam::label>& const Foam::Map<Foam::label>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::meshPointMap() const
meshPointMap() const
{ {
if (!meshPointMapPtr_) if (!meshPointMapPtr_)
{ {
@ -446,16 +331,12 @@ meshPointMap() const
} }
template template<class FaceList, class PointField>
const Foam::Field
< <
class Face, typename Foam::PrimitivePatch<FaceList, PointField>::point_type
template<class> class FaceList, >&
class PointField, Foam::PrimitivePatch<FaceList, PointField>::localPoints() const
class PointType
>
const Foam::Field<PointType>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
localPoints() const
{ {
if (!localPointsPtr_) if (!localPointsPtr_)
{ {
@ -466,16 +347,9 @@ localPoints() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::labelList& const Foam::labelList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::localPointOrder() const
localPointOrder() const
{ {
if (!localPointOrderPtr_) if (!localPointOrderPtr_)
{ {
@ -486,16 +360,9 @@ localPointOrder() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::label Foam::label
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::whichPoint
whichPoint
( (
const label gp const label gp
) const ) const
@ -505,16 +372,12 @@ whichPoint
} }
template template<class FaceList, class PointField>
const Foam::Field
< <
class Face, typename Foam::PrimitivePatch<FaceList, PointField>::point_type
template<class> class FaceList, >&
class PointField, Foam::PrimitivePatch<FaceList, PointField>::faceCentres() const
class PointType
>
const Foam::Field<PointType>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
faceCentres() const
{ {
if (!faceCentresPtr_) if (!faceCentresPtr_)
{ {
@ -525,16 +388,12 @@ faceCentres() const
} }
template template<class FaceList, class PointField>
const Foam::Field
< <
class Face, typename Foam::PrimitivePatch<FaceList, PointField>::point_type
template<class> class FaceList, >&
class PointField, Foam::PrimitivePatch<FaceList, PointField>::faceAreas() const
class PointType
>
const Foam::Field<PointType>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
faceAreas() const
{ {
if (!faceAreasPtr_) if (!faceAreasPtr_)
{ {
@ -545,16 +404,9 @@ faceAreas() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::Field<Foam::scalar>& const Foam::Field<Foam::scalar>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::magFaceAreas() const
magFaceAreas() const
{ {
if (!magFaceAreasPtr_) if (!magFaceAreasPtr_)
{ {
@ -565,16 +417,12 @@ magFaceAreas() const
} }
template template<class FaceList, class PointField>
const Foam::Field
< <
class Face, typename Foam::PrimitivePatch<FaceList, PointField>::point_type
template<class> class FaceList, >&
class PointField, Foam::PrimitivePatch<FaceList, PointField>::faceNormals() const
class PointType
>
const Foam::Field<PointType>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
faceNormals() const
{ {
if (!faceNormalsPtr_) if (!faceNormalsPtr_)
{ {
@ -585,16 +433,12 @@ faceNormals() const
} }
template template<class FaceList, class PointField>
const Foam::Field
< <
class Face, typename Foam::PrimitivePatch<FaceList, PointField>::point_type
template<class> class FaceList, >&
class PointField, Foam::PrimitivePatch<FaceList, PointField>::pointNormals() const
class PointType
>
const Foam::Field<PointType>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
pointNormals() const
{ {
if (!pointNormalsPtr_) if (!pointNormalsPtr_)
{ {
@ -607,23 +451,43 @@ pointNormals() const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::operator=
operator=
( (
const PrimitivePatch<Face, FaceList, PointField, PointType>& pp const PrimitivePatch<FaceList, PointField>& rhs
) )
{ {
if (&rhs == this)
{
return;
}
clearOut(); clearOut();
FaceList<Face>::shallowCopy(pp); FaceList::shallowCopy(rhs);
// Cannot copy assign points (could be const reference)
}
template<class FaceList, class PointField>
void
Foam::PrimitivePatch<FaceList, PointField>::operator=
(
PrimitivePatch<FaceList, PointField>&& rhs
)
{
if (&rhs == this)
{
return;
}
clearOut();
FaceList::operator=(std::move(rhs));
// Cannot move assign points (could be const reference)
} }

View File

@ -67,6 +67,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class face; class face;
template<class T> class Map; template<class T> class Map;
@ -81,38 +82,33 @@ TemplateName(PrimitivePatch);
Class PrimitivePatch Declaration Class PrimitivePatch Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType=point
>
class PrimitivePatch class PrimitivePatch
: :
public PrimitivePatchName, public PrimitivePatchName,
public FaceList<Face> public FaceList
{ {
public: public:
// Public Typedefs // Public Typedefs
//- The face type //- The face type
typedef Face face_type; typedef typename
std::remove_reference<FaceList>::type::value_type face_type;
//- The point type //- The point type
typedef PointType point_type; typedef typename
std::remove_reference<PointField>::type::value_type point_type;
//- The face list type //- The face list type
typedef FaceList<Face> FaceListType; typedef FaceList FaceListType;
//- The point field type //- The point field type
typedef PointField PointFieldType; typedef PointField PointFieldType;
//- Deprecated(2020-03) prefer face_type typedef //- Deprecated(2020-03) prefer face_type typedef
// \deprecated(2020-03) prefer face_type typedef // \deprecated(2020-03) prefer face_type typedef
typedef Face FaceType; typedef face_type FaceType;
// Public Data Types // Public Data Types
@ -138,62 +134,62 @@ private:
//- Edges of the patch; address into local point list; //- Edges of the patch; address into local point list;
// sorted with internal edges first in upper-triangular order // sorted with internal edges first in upper-triangular order
// and external edges last. // and external edges last.
mutable edgeList* edgesPtr_; mutable unique_ptr<edgeList> edgesPtr_;
//- Which part of edgesPtr_ is internal edges. //- Which part of edgesPtr_ is internal edges.
mutable label nInternalEdges_; mutable label nInternalEdges_;
//- Boundary point labels, addressing into local point list //- Boundary point labels, addressing into local point list
mutable labelList* boundaryPointsPtr_; mutable unique_ptr<labelList> boundaryPointsPtr_;
//- Face-face addressing //- Face-face addressing
mutable labelListList* faceFacesPtr_; mutable unique_ptr<labelListList> faceFacesPtr_;
//- Edge-face addressing //- Edge-face addressing
mutable labelListList* edgeFacesPtr_; mutable unique_ptr<labelListList> edgeFacesPtr_;
//- Face-edge addressing //- Face-edge addressing
mutable labelListList* faceEdgesPtr_; mutable unique_ptr<labelListList> faceEdgesPtr_;
//- Point-edge addressing //- Point-edge addressing
mutable labelListList* pointEdgesPtr_; mutable unique_ptr<labelListList> pointEdgesPtr_;
//- Point-face addressing //- Point-face addressing
mutable labelListList* pointFacesPtr_; mutable unique_ptr<labelListList> pointFacesPtr_;
//- Faces addressing into local point list //- Faces addressing into local point list
mutable List<Face>* localFacesPtr_; mutable unique_ptr<List<face_type>> localFacesPtr_;
//- Labels of mesh points //- Labels of mesh points
mutable labelList* meshPointsPtr_; mutable unique_ptr<labelList> meshPointsPtr_;
//- Mesh point map. Given the global point index find its //- Mesh point map. Given the global point index find its
//- location in the patch //- location in the patch
mutable Map<label>* meshPointMapPtr_; mutable unique_ptr<Map<label>> meshPointMapPtr_;
//- Outside edge loops //- Outside edge loops
mutable labelListList* edgeLoopsPtr_; mutable unique_ptr<labelListList> edgeLoopsPtr_;
//- Points local to patch //- Points local to patch
mutable Field<PointType>* localPointsPtr_; mutable unique_ptr<Field<point_type>> localPointsPtr_;
//- Local point order for most efficient search //- Local point order for most efficient search
mutable labelList* localPointOrderPtr_; mutable unique_ptr<labelList> localPointOrderPtr_;
//- Face centres //- Face centres
mutable Field<PointType>* faceCentresPtr_; mutable unique_ptr<Field<point_type>> faceCentresPtr_;
//- Face area vectors //- Face area vectors
mutable Field<PointType>* faceAreasPtr_; mutable unique_ptr<Field<point_type>> faceAreasPtr_;
//- Mag face area //- Mag face area
mutable Field<scalar>* magFaceAreasPtr_; mutable unique_ptr<Field<scalar>> magFaceAreasPtr_;
//- Face unit normals //- Face unit normals
mutable Field<PointType>* faceNormalsPtr_; mutable unique_ptr<Field<point_type>> faceNormalsPtr_;
//- Point unit normals //- Point unit normals
mutable Field<PointType>* pointNormalsPtr_; mutable unique_ptr<Field<point_type>> pointNormalsPtr_;
// Private Member Functions // Private Member Functions
@ -263,30 +259,27 @@ public:
//- Construct from components //- Construct from components
PrimitivePatch PrimitivePatch
( (
const FaceList<Face>& faces, const FaceList& faces,
const Field<PointType>& points const PointField& points
); );
//- Construct from components, transferring faces //- Construct from components, transferring faces
PrimitivePatch PrimitivePatch
( (
FaceList<Face>&& faces, FaceList&& faces,
const Field<PointType>& points const PointField& points
); );
//- Construct from components, reuse storage //- Construct from components, reuse storage
PrimitivePatch PrimitivePatch
( (
FaceList<Face>& faces, FaceList& faces,
Field<PointType>& points, PointField& points,
const bool reuse const bool reuse
); );
//- Construct as copy //- Copy construct
PrimitivePatch PrimitivePatch(const PrimitivePatch<FaceList, PointField>& pp);
(
const PrimitivePatch<Face, FaceList, PointField, PointType>&
);
//- Destructor //- Destructor
@ -310,7 +303,7 @@ public:
// Access // Access
//- Return reference to global points //- Return reference to global points
const Field<PointType>& points() const const Field<point_type>& points() const
{ {
return points_; return points_;
} }
@ -363,7 +356,7 @@ public:
const labelListList& pointFaces() const; const labelListList& pointFaces() const;
//- Return patch faces addressing into local point list //- Return patch faces addressing into local point list
const List<Face>& localFaces() const; const List<face_type>& localFaces() const;
// Addressing into mesh // Addressing into mesh
@ -378,7 +371,7 @@ public:
const Map<label>& meshPointMap() const; const Map<label>& meshPointMap() const;
//- Return pointField of points in patch //- Return pointField of points in patch
const Field<PointType>& localPoints() const; const Field<point_type>& localPoints() const;
//- 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;
@ -409,27 +402,27 @@ public:
) const; ) const;
//- Return face centres for patch //- Return face centres for patch
const Field<PointType>& faceCentres() const; const Field<point_type>& faceCentres() const;
//- Return face area vectors for patch //- Return face area vectors for patch
const Field<PointType>& faceAreas() const; const Field<point_type>& faceAreas() const;
//- Return face area magnitudes for patch //- Return face area magnitudes for patch
const Field<scalar>& magFaceAreas() const; const Field<scalar>& magFaceAreas() const;
//- Return face unit normals for patch //- Return face unit normals for patch
const Field<PointType>& faceNormals() const; const Field<point_type>& faceNormals() const;
//- Return point normals for patch //- Return point normals for patch
const Field<PointType>& pointNormals() const; const Field<point_type>& pointNormals() const;
// Storage Management // Storage Management
inline bool hasFaceAreas() const { return faceAreasPtr_; } bool hasFaceAreas() const { return bool(faceAreasPtr_); }
inline bool hasFaceCentres() const { return faceCentresPtr_; } bool hasFaceCentres() const { return bool(faceCentresPtr_); }
inline bool hasFaceNormals() const { return faceNormalsPtr_; } bool hasFaceNormals() const { return bool(faceNormalsPtr_); }
inline bool hasPointNormals() const { return pointNormalsPtr_; } bool hasPointNormals() const { return bool(pointNormalsPtr_); }
// Other patch operations // Other patch operations
@ -439,7 +432,7 @@ public:
List<objectHit> projectPoints List<objectHit> projectPoints
( (
const ToPatch& targetPatch, const ToPatch& targetPatch,
const Field<PointType>& projectionDirection, const Field<point_type>& projectionDirection,
const intersection::algorithm = intersection::FULL_RAY, const intersection::algorithm = intersection::FULL_RAY,
const intersection::direction = intersection::VECTOR const intersection::direction = intersection::VECTOR
) const; ) const;
@ -449,7 +442,7 @@ public:
List<objectHit> projectFaceCentres List<objectHit> projectFaceCentres
( (
const ToPatch& targetPatch, const ToPatch& targetPatch,
const Field<PointType>& projectionDirection, const Field<point_type>& projectionDirection,
const intersection::algorithm = intersection::FULL_RAY, const intersection::algorithm = intersection::FULL_RAY,
const intersection::direction = intersection::VECTOR const intersection::direction = intersection::VECTOR
) const; ) const;
@ -494,16 +487,16 @@ public:
// Edit // Edit
//- Correct patch after moving points //- Correct patch after moving points
virtual void movePoints(const Field<PointType>&); virtual void movePoints(const Field<point_type>&);
// Member Operators // Member Operators
//- Assignment //- Copy assign faces. Leave points alone (could be a reference).
void operator= void operator=(const PrimitivePatch<FaceList, PointField>& rhs);
(
const PrimitivePatch<Face, FaceList, PointField, PointType>& //- Move assign faces. Leave points alone (could be a reference).
); void operator=(PrimitivePatch<FaceList, PointField>&& rhs);
}; };

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -39,26 +40,13 @@ Description
#include "PrimitivePatch.H" #include "PrimitivePatch.H"
#include "DynamicList.H" #include "DynamicList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcAddressing() const
calcAddressing() const
{ {
if (debug) DebugInFunction << "Calculating patch addressing" << nl;
{
Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
<< "calcAddressing() : calculating patch addressing"
<< endl;
}
if (edgesPtr_ || faceFacesPtr_ || edgeFacesPtr_ || faceEdgesPtr_) if (edgesPtr_ || faceFacesPtr_ || edgeFacesPtr_ || faceEdgesPtr_)
{ {
@ -69,31 +57,31 @@ calcAddressing() const
} }
// get reference to localFaces // get reference to localFaces
const List<Face>& locFcs = localFaces(); const List<face_type>& locFcs = localFaces();
// get reference to pointFaces // get reference to pointFaces
const labelListList& pf = pointFaces(); const labelListList& pf = pointFaces();
// Guess the max number of edges and neighbours for a face // Guess the max number of edges and neighbours for a face
label maxEdges = 0; label maxEdges = 0;
forAll(locFcs, facei) for (const auto& f : locFcs)
{ {
maxEdges += locFcs[facei].size(); maxEdges += f.size();
} }
// create the lists for the various results. (resized on completion) // create the lists for the various results. (resized on completion)
edgesPtr_ = new edgeList(maxEdges); edgesPtr_.reset(new edgeList(maxEdges));
edgeList& edges = *edgesPtr_; auto& edges = *edgesPtr_;
edgeFacesPtr_ = new labelListList(maxEdges); edgeFacesPtr_.reset(new labelListList(maxEdges));
labelListList& edgeFaces = *edgeFacesPtr_; auto& edgeFaces = *edgeFacesPtr_;
// faceFaces created using a dynamic list. Cannot guess size because // faceFaces created using a dynamic list. Cannot guess size because
// of multiple connections // of multiple connections
List<DynamicList<label>> ff(locFcs.size()); List<DynamicList<label>> ff(locFcs.size());
faceEdgesPtr_ = new labelListList(locFcs.size()); faceEdgesPtr_.reset(new labelListList(locFcs.size()));
labelListList& faceEdges = *faceEdgesPtr_; auto& faceEdges = *faceEdgesPtr_;
// count the number of face neighbours // count the number of face neighbours
labelList noFaceFaces(locFcs.size()); labelList noFaceFaces(locFcs.size());
@ -129,7 +117,7 @@ calcAddressing() const
forAll(locFcs, facei) forAll(locFcs, facei)
{ {
// Get reference to vertices of current face and corresponding edges. // Get reference to vertices of current face and corresponding edges.
const Face& curF = locFcs[facei]; const face_type& curF = locFcs[facei];
const edgeList& curEdges = faceIntoEdges[facei]; const edgeList& curEdges = faceIntoEdges[facei];
// Record the neighbour face. Multiple connectivity allowed // Record the neighbour face. Multiple connectivity allowed
@ -283,8 +271,8 @@ calcAddressing() const
edgeFaces.setSize(nEdges); edgeFaces.setSize(nEdges);
// faceFaces list // faceFaces list
faceFacesPtr_ = new labelListList(locFcs.size()); faceFacesPtr_.reset(new labelListList(locFcs.size()));
labelListList& faceFaces = *faceFacesPtr_; auto& faceFaces = *faceFacesPtr_;
forAll(faceFaces, facei) forAll(faceFaces, facei)
{ {
@ -292,12 +280,7 @@ calcAddressing() const
} }
if (debug) DebugInFunction << "Calculated patch addressing" << nl;
{
Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
<< "calcAddressing() : finished calculating patch addressing"
<< endl;
}
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,21 +31,11 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcBdryPoints() const
calcBdryPoints() const
{ {
if (debug) DebugInFunction << "Calculating boundary points" << nl;
{
InfoInFunction << "Calculating boundary points" << endl;
}
if (boundaryPointsPtr_) if (boundaryPointsPtr_)
{ {
@ -66,12 +57,9 @@ calcBdryPoints() const
bp.insert(curEdge.end()); bp.insert(curEdge.end());
} }
boundaryPointsPtr_ = new labelList(bp.sortedToc()); boundaryPointsPtr_.reset(new labelList(bp.sortedToc()));
if (debug) DebugInfo << " Finished." << nl;
{
Info<< " Finished." << endl;
}
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,16 +35,9 @@ Description
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::visitPointRegion
visitPointRegion
( (
const label pointi, const label pointi,
const labelList& pFaces, const labelList& pFaces,
@ -109,22 +103,11 @@ visitPointRegion
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
< typename Foam::PrimitivePatch<FaceList, PointField>::surfaceTopo
class Face, Foam::PrimitivePatch<FaceList, PointField>::surfaceType() const
template<class> class FaceList,
class PointField,
class PointType
>
typename
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::surfaceTopo
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
surfaceType() const
{ {
if (debug) DebugInFunction << "Calculating patch topology" << nl;
{
InfoInFunction << "Calculating patch topology" << endl;
}
const labelListList& edgeFcs = edgeFaces(); const labelListList& edgeFcs = edgeFaces();
@ -148,34 +131,21 @@ surfaceType() const
} }
} }
if (debug) DebugInFunction << "Calculated patch topology" << nl;
{
Info<< " Finished." << endl;
}
return pType; return pType;
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
bool bool
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::checkTopology
checkTopology
( (
const bool report, const bool report,
labelHashSet* setPtr labelHashSet* setPtr
) const ) const
{ {
if (debug) DebugInFunction << "Checking patch topology" << nl;
{
InfoInFunction << "Checking patch topology" << endl;
}
// Check edgeFaces // Check edgeFaces
@ -208,25 +178,15 @@ checkTopology
} }
} }
if (debug) DebugInFunction << "Checked patch topology" << nl;
{
Info<< " Finished." << endl;
}
return illegalTopo; return illegalTopo;
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
bool bool
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::checkPointManifold
checkPointManifold
( (
const bool report, const bool report,
labelHashSet* setPtr labelHashSet* setPtr

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -26,108 +27,62 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "PrimitivePatch.H" #include "PrimitivePatch.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::clearGeom()
clearGeom()
{ {
if (debug) DebugInFunction << "Clearing geometric data" << nl;
{
InfoInFunction << "Clearing geometric data" << endl;
}
deleteDemandDrivenData(localPointsPtr_); localPointsPtr_.reset(nullptr);
deleteDemandDrivenData(faceCentresPtr_); faceCentresPtr_.reset(nullptr);
deleteDemandDrivenData(faceAreasPtr_); faceAreasPtr_.reset(nullptr);
deleteDemandDrivenData(magFaceAreasPtr_); magFaceAreasPtr_.reset(nullptr);
deleteDemandDrivenData(faceNormalsPtr_); faceNormalsPtr_.reset(nullptr);
deleteDemandDrivenData(pointNormalsPtr_); pointNormalsPtr_.reset(nullptr);
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::clearTopology()
clearTopology()
{ {
if (debug) DebugInFunction << "Clearing patch addressing" << nl;
{
InfoInFunction << "Clearing patch addressing" << endl;
}
// group created and destroyed together // group created and destroyed together
if (edgesPtr_ && faceFacesPtr_ && edgeFacesPtr_ && faceEdgesPtr_) if (edgesPtr_ && faceFacesPtr_ && edgeFacesPtr_ && faceEdgesPtr_)
{ {
delete edgesPtr_; edgesPtr_.reset(nullptr);
edgesPtr_ = nullptr; faceFacesPtr_.reset(nullptr);
edgeFacesPtr_.reset(nullptr);
delete faceFacesPtr_; faceEdgesPtr_.reset(nullptr);
faceFacesPtr_ = nullptr;
delete edgeFacesPtr_;
edgeFacesPtr_ = nullptr;
delete faceEdgesPtr_;
faceEdgesPtr_ = nullptr;
} }
deleteDemandDrivenData(boundaryPointsPtr_); boundaryPointsPtr_.reset(nullptr);
deleteDemandDrivenData(pointEdgesPtr_); pointEdgesPtr_.reset(nullptr);
deleteDemandDrivenData(pointFacesPtr_); pointFacesPtr_.reset(nullptr);
deleteDemandDrivenData(edgeLoopsPtr_); edgeLoopsPtr_.reset(nullptr);
deleteDemandDrivenData(localPointOrderPtr_); localPointOrderPtr_.reset(nullptr);
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::clearPatchMeshAddr()
clearPatchMeshAddr()
{ {
if (debug) DebugInFunction << "Clearing patch-mesh addressing" << nl;
{
InfoInFunction << "Clearing patch-mesh addressing" << endl;
}
deleteDemandDrivenData(meshPointsPtr_); meshPointsPtr_.reset(nullptr);
deleteDemandDrivenData(meshPointMapPtr_); meshPointMapPtr_.reset(nullptr);
deleteDemandDrivenData(localFacesPtr_); localFacesPtr_.reset(nullptr);
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::clearOut()
clearOut()
{ {
clearGeom(); clearGeom();
clearTopology(); clearTopology();

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,24 +32,13 @@ Description
#include "PrimitivePatch.H" #include "PrimitivePatch.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcEdgeLoops() const
calcEdgeLoops() const
{ {
if (debug) DebugInFunction << "Calculating boundary edge loops" << endl;
{
InfoInFunction << "Calculating boundary edge loops" << endl;
}
if (edgeLoopsPtr_) if (edgeLoopsPtr_)
{ {
@ -64,7 +54,7 @@ calcEdgeLoops() const
if (nBdryEdges == 0) if (nBdryEdges == 0)
{ {
edgeLoopsPtr_ = new labelListList(0); edgeLoopsPtr_.reset(new labelListList(0));
return; return;
} }
@ -79,8 +69,8 @@ calcEdgeLoops() const
labelList loopNumber(nBdryEdges, -1); labelList loopNumber(nBdryEdges, -1);
// Size return list plenty big // Size return list plenty big
edgeLoopsPtr_ = new labelListList(nBdryEdges); edgeLoopsPtr_.reset(new labelListList(nBdryEdges));
labelListList& edgeLoops = *edgeLoopsPtr_; auto& edgeLoops = *edgeLoopsPtr_;
// Current loop number. // Current loop number.
@ -149,23 +139,13 @@ calcEdgeLoops() const
edgeLoops.setSize(loopI); edgeLoops.setSize(loopI);
if (debug) DebugInFunction << "Calculated boundary edge loops" << nl;
{
Info<< " Finished." << endl;
}
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::labelListList& const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::edgeLoops() const
edgeLoops() const
{ {
if (!edgeLoopsPtr_) if (!edgeLoopsPtr_)
{ {

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -33,24 +34,16 @@ Description
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcLocalPointOrder() const
calcLocalPointOrder() const
{ {
// Note: Cannot use bandCompressing as point-point addressing does // Note: Cannot use bandCompressing as point-point addressing does
// not exist and is not considered generally useful. // not exist and is not considered generally useful.
//
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
<< "calcLocalPointOrder() : " << "calcLocalPointOrder() : "
<< "calculating local point order" << "calculating local point order"
<< endl; << endl;
@ -64,15 +57,14 @@ calcLocalPointOrder() const
<< abort(FatalError); << abort(FatalError);
} }
const List<Face>& lf = localFaces(); const List<face_type>& lf = localFaces();
const labelListList& ff = faceFaces(); const labelListList& ff = faceFaces();
boolList visitedFace(lf.size(), false); boolList visitedFace(lf.size(), false);
localPointOrderPtr_ = new labelList(meshPoints().size(), -1); localPointOrderPtr_.reset(new labelList(meshPoints().size(), -1));
auto& pointOrder = *localPointOrderPtr_;
labelList& pointOrder = *localPointOrderPtr_;
boolList visitedPoint(pointOrder.size(), false); boolList visitedPoint(pointOrder.size(), false);
@ -126,7 +118,7 @@ calcLocalPointOrder() const
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
<< "calcLocalPointOrder() " << "calcLocalPointOrder() "
<< "finished calculating local point order" << "finished calculating local point order"
<< endl; << endl;

View File

@ -31,20 +31,13 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcMeshData() const
calcMeshData() const
{ {
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcMeshData() : " "calcMeshData() : "
"calculating mesh data in PrimitivePatch" "calculating mesh data in PrimitivePatch"
<< endl; << endl;
@ -73,7 +66,7 @@ calcMeshData() const
//// if the point is used, set the mark to 1 //// if the point is used, set the mark to 1
//forAll(*this, facei) //forAll(*this, facei)
//{ //{
// const Face& curPoints = this->operator[](facei); // const face_type& curPoints = this->operator[](facei);
// //
// forAll(curPoints, pointi) // forAll(curPoints, pointi)
// { // {
@ -83,8 +76,8 @@ calcMeshData() const
// //
//// Create the storage and store the meshPoints. Mesh points are //// Create the storage and store the meshPoints. Mesh points are
//// the ones marked by the usage loop above //// the ones marked by the usage loop above
//meshPointsPtr_ = new labelList(markedPoints.toc()); //meshPointsPtr_.reset(new labelList(markedPoints.toc()));
//labelList& pointPatch = *meshPointsPtr_; //auto& pointPatch = *meshPointsPtr_;
// //
//// Sort the list to preserve compatibility with the old ordering //// Sort the list to preserve compatibility with the old ordering
//sort(pointPatch); //sort(pointPatch);
@ -97,42 +90,36 @@ calcMeshData() const
//- Unsorted version: //- Unsorted version:
DynamicList<label> meshPoints(2*this->size()); DynamicList<label> meshPoints(2*this->size());
forAll(*this, facei) for (const face_type& f : *this)
{ {
const Face& curPoints = this->operator[](facei); for (const label pointi : f)
forAll(curPoints, pointi)
{ {
if (markedPoints.insert(curPoints[pointi], meshPoints.size())) if (markedPoints.insert(pointi, meshPoints.size()))
{ {
meshPoints.append(curPoints[pointi]); meshPoints.append(pointi);
} }
} }
} }
// Transfer to straight list (reuses storage) // Transfer to straight list (reuses storage)
meshPointsPtr_ = new labelList(meshPoints, true); meshPointsPtr_.reset(new labelList(meshPoints, true));
// Create local faces. Deep-copy original faces to retain additional
// data (e.g. region number of labelledTri)
// The vertices will be overwritten later
localFacesPtr_.reset(new List<face_type>(*this));
auto& locFaces = *localFacesPtr_;
// Create local faces. Note that we start off from copy of original face for (face_type& f : locFaces)
// list (even though vertices are overwritten below). This is done so
// additional data gets copied (e.g. region number of labelledTri)
localFacesPtr_ = new List<Face>(*this);
List<Face>& lf = *localFacesPtr_;
forAll(*this, facei)
{ {
const Face& curFace = this->operator[](facei); for (label& pointi : f)
lf[facei].setSize(curFace.size());
forAll(curFace, labelI)
{ {
lf[facei][labelI] = markedPoints.find(curFace[labelI])(); pointi = *(markedPoints.cfind(pointi));
} }
} }
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcMeshData() : " "calcMeshData() : "
"finished calculating mesh data in PrimitivePatch" "finished calculating mesh data in PrimitivePatch"
<< endl; << endl;
@ -140,20 +127,13 @@ calcMeshData() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcMeshPointMap() const
calcMeshPointMap() const
{ {
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcMeshPointMap() : " "calcMeshPointMap() : "
"calculating mesh point map in PrimitivePatch" "calculating mesh point map in PrimitivePatch"
<< endl; << endl;
@ -169,8 +149,8 @@ calcMeshPointMap() const
const labelList& mp = meshPoints(); const labelList& mp = meshPoints();
meshPointMapPtr_ = new Map<label>(2*mp.size()); meshPointMapPtr_.reset(new Map<label>(2*mp.size()));
Map<label>& mpMap = *meshPointMapPtr_; auto& mpMap = *meshPointMapPtr_;
forAll(mp, i) forAll(mp, i)
{ {
@ -179,7 +159,7 @@ calcMeshPointMap() const
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcMeshPointMap() : " "calcMeshPointMap() : "
"finished calculating mesh point map in PrimitivePatch" "finished calculating mesh point map in PrimitivePatch"
<< endl; << endl;
@ -187,20 +167,13 @@ calcMeshPointMap() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcLocalPoints() const
calcLocalPoints() const
{ {
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcLocalPoints() : " "calcLocalPoints() : "
"calculating localPoints in PrimitivePatch" "calculating localPoints in PrimitivePatch"
<< endl; << endl;
@ -216,9 +189,8 @@ calcLocalPoints() const
const labelList& meshPts = meshPoints(); const labelList& meshPts = meshPoints();
localPointsPtr_ = new Field<PointType>(meshPts.size()); localPointsPtr_.reset(new Field<point_type>(meshPts.size()));
auto& locPts = *localPointsPtr_;
Field<PointType>& locPts = *localPointsPtr_;
forAll(meshPts, pointi) forAll(meshPts, pointi)
{ {
@ -227,7 +199,7 @@ calcLocalPoints() const
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
<< "calcLocalPoints() : " << "calcLocalPoints() : "
<< "finished calculating localPoints in PrimitivePatch" << "finished calculating localPoints in PrimitivePatch"
<< endl; << endl;
@ -235,20 +207,13 @@ calcLocalPoints() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcPointNormals() const
calcPointNormals() const
{ {
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcPointNormals() : " "calcPointNormals() : "
"calculating pointNormals in PrimitivePatch" "calculating pointNormals in PrimitivePatch"
<< endl; << endl;
@ -262,21 +227,16 @@ calcPointNormals() const
<< abort(FatalError); << abort(FatalError);
} }
const Field<PointType>& faceUnitNormals = faceNormals(); const auto& faceUnitNormals = faceNormals();
const labelListList& pf = pointFaces(); const labelListList& pf = pointFaces();
pointNormalsPtr_ = new Field<PointType> pointNormalsPtr_.reset(new Field<point_type>(meshPoints().size(), Zero));
( auto& n = *pointNormalsPtr_;
meshPoints().size(),
PointType::zero
);
Field<PointType>& n = *pointNormalsPtr_;
forAll(pf, pointi) forAll(pf, pointi)
{ {
PointType& curNormal = n[pointi]; point_type& curNormal = n[pointi];
const labelList& curFaces = pf[pointi]; const labelList& curFaces = pf[pointi];
@ -290,7 +250,7 @@ calcPointNormals() const
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcPointNormals() : " "calcPointNormals() : "
"finished calculating pointNormals in PrimitivePatch" "finished calculating pointNormals in PrimitivePatch"
<< endl; << endl;
@ -298,20 +258,13 @@ calcPointNormals() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcFaceCentres() const
calcFaceCentres() const
{ {
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcFaceCentres() : " "calcFaceCentres() : "
"calculating faceCentres in PrimitivePatch" "calculating faceCentres in PrimitivePatch"
<< endl; << endl;
@ -325,9 +278,8 @@ calcFaceCentres() const
<< abort(FatalError); << abort(FatalError);
} }
faceCentresPtr_ = new Field<PointType>(this->size()); faceCentresPtr_.reset(new Field<point_type>(this->size()));
auto& c = *faceCentresPtr_;
Field<PointType>& c = *faceCentresPtr_;
forAll(c, facei) forAll(c, facei)
{ {
@ -336,7 +288,7 @@ calcFaceCentres() const
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcFaceCentres() : " "calcFaceCentres() : "
"finished calculating faceCentres in PrimitivePatch" "finished calculating faceCentres in PrimitivePatch"
<< endl; << endl;
@ -344,20 +296,13 @@ calcFaceCentres() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcMagFaceAreas() const
calcMagFaceAreas() const
{ {
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcMagFaceAreas() : " "calcMagFaceAreas() : "
"calculating magFaceAreas in PrimitivePatch" "calculating magFaceAreas in PrimitivePatch"
<< endl; << endl;
@ -371,8 +316,8 @@ calcMagFaceAreas() const
<< abort(FatalError); << abort(FatalError);
} }
magFaceAreasPtr_ = new Field<scalar>(this->size()); magFaceAreasPtr_.reset(new Field<scalar>(this->size()));
Field<scalar>& a = *magFaceAreasPtr_; auto& a = *magFaceAreasPtr_;
forAll(a, facei) forAll(a, facei)
{ {
@ -381,7 +326,7 @@ calcMagFaceAreas() const
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcMagFaceAreas() : " "calcMagFaceAreas() : "
"finished calculating magFaceAreas in PrimitivePatch" "finished calculating magFaceAreas in PrimitivePatch"
<< endl; << endl;
@ -389,20 +334,13 @@ calcMagFaceAreas() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcFaceAreas() const
calcFaceAreas() const
{ {
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcFaceAreas() : " "calcFaceAreas() : "
"calculating faceAreas in PrimitivePatch" "calculating faceAreas in PrimitivePatch"
<< endl; << endl;
@ -416,9 +354,8 @@ calcFaceAreas() const
<< abort(FatalError); << abort(FatalError);
} }
faceAreasPtr_ = new Field<PointType>(this->size()); faceAreasPtr_.reset(new Field<point_type>(this->size()));
auto& n = *faceAreasPtr_;
Field<PointType>& n = *faceAreasPtr_;
forAll(n, facei) forAll(n, facei)
{ {
@ -427,7 +364,7 @@ calcFaceAreas() const
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcFaceAreas() : " "calcFaceAreas() : "
"finished calculating faceAreas in PrimitivePatch" "finished calculating faceAreas in PrimitivePatch"
<< endl; << endl;
@ -435,20 +372,13 @@ calcFaceAreas() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcFaceNormals() const
calcFaceNormals() const
{ {
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcFaceNormals() : " "calcFaceNormals() : "
"calculating faceNormals in PrimitivePatch" "calculating faceNormals in PrimitivePatch"
<< endl; << endl;
@ -462,9 +392,8 @@ calcFaceNormals() const
<< abort(FatalError); << abort(FatalError);
} }
faceNormalsPtr_ = new Field<PointType>(this->size()); faceNormalsPtr_.reset(new Field<point_type>(this->size()));
auto& n = *faceNormalsPtr_;
Field<PointType>& n = *faceNormalsPtr_;
forAll(n, facei) forAll(n, facei)
{ {
@ -473,7 +402,7 @@ calcFaceNormals() const
if (debug) if (debug)
{ {
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" Pout<< "PrimitivePatch<FaceList, PointField>::"
"calcFaceNormals() : " "calcFaceNormals() : "
"finished calculating faceNormals in PrimitivePatch" "finished calculating faceNormals in PrimitivePatch"
<< endl; << endl;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,18 +28,11 @@ License
#include "PrimitivePatch.H" #include "PrimitivePatch.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::labelList Foam::labelList
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::
meshEdges meshEdges
( (
const edgeList& allEdges, const edgeList& allEdges,
@ -46,13 +40,8 @@ meshEdges
const labelList& faceCells const labelList& faceCells
) const ) const
{ {
if (debug) DebugInFunction
{ << "Calculating labels of patch edges in mesh edge list" << nl;
Info<< "labelList PrimitivePatch<Face, FaceList, PointField, PointType>"
<< "::meshEdges() : "
<< "calculating labels of patch edges in mesh edge list"
<< endl;
}
// get reference to the list of edges on the patch // get reference to the list of edges on the patch
const edgeList& PatchEdges = edges(); const edgeList& PatchEdges = edges();
@ -107,28 +96,16 @@ meshEdges
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::labelList Foam::labelList
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::meshEdges
meshEdges
( (
const edgeList& allEdges, const edgeList& allEdges,
const labelListList& pointEdges const labelListList& pointEdges
) const ) const
{ {
if (debug) DebugInFunction
{ << "Calculating labels of patch edges in mesh edge list" << nl;
Info<< "labelList PrimitivePatch<Face, FaceList, PointField, PointType>"
<< "::meshEdges() : "
<< "calculating labels of patch edges in mesh edge list"
<< endl;
}
// get reference to the list of edges on the patch // get reference to the list of edges on the patch
const edgeList& PatchEdges = edges(); const edgeList& PatchEdges = edges();
@ -164,16 +141,9 @@ meshEdges
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::label Foam::label
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::whichEdge
whichEdge
( (
const edge& e const edge& e
) const ) const

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -35,19 +35,11 @@ Description
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcPointEdges() const
calcPointEdges() const
{ {
DebugInFunction DebugInFunction << "Calculating pointEdges" << endl;
<< "Calculating pointEdges" << endl;
if (pointEdgesPtr_) if (pointEdgesPtr_)
{ {
@ -57,9 +49,8 @@ calcPointEdges() const
<< abort(FatalError); << abort(FatalError);
} }
pointEdgesPtr_ = new labelListList(meshPoints().size()); pointEdgesPtr_.reset(new labelListList(meshPoints().size()));
auto& pe = *pointEdgesPtr_;
labelListList& pe = *pointEdgesPtr_;
invertManyToMany(pe.size(), edges(), pe); invertManyToMany(pe.size(), edges(), pe);
@ -68,16 +59,9 @@ calcPointEdges() const
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::calcPointFaces() const
calcPointFaces() const
{ {
DebugInFunction DebugInFunction
<< "Calculating pointFaces" << endl; << "Calculating pointFaces" << endl;
@ -90,14 +74,14 @@ calcPointFaces() const
<< abort(FatalError); << abort(FatalError);
} }
const List<Face>& f = localFaces(); const List<face_type>& locFcs = localFaces();
// set up storage for pointFaces // set up storage for pointFaces
List<SLList<label>> pointFcs(meshPoints().size()); List<SLList<label>> pointFcs(meshPoints().size());
forAll(f, facei) forAll(locFcs, facei)
{ {
const Face& curPoints = f[facei]; const face_type& curPoints = locFcs[facei];
for (const label pointi : curPoints) for (const label pointi : curPoints)
{ {
@ -105,20 +89,13 @@ calcPointFaces() const
} }
} }
// sort out the list // Copy the list
pointFacesPtr_ = new labelListList(pointFcs.size()); pointFacesPtr_.reset(new labelListList(pointFcs.size()));
auto& pf = *pointFacesPtr_;
labelListList& pf = *pointFacesPtr_;
forAll(pointFcs, pointi) forAll(pointFcs, pointi)
{ {
pf[pointi].setSize(pointFcs[pointi].size()); pf[pointi] = pointFcs[pointi];
label i = 0;
for (const label facei : pointFcs[pointi])
{
pf[pointi][i++] = facei;
}
} }
DebugInfo DebugInfo

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,20 +37,16 @@ Description
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
template<class ToPatch> template<class ToPatch>
Foam::List<Foam::objectHit> Foam::List<Foam::objectHit>
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::projectPoints
projectPoints
( (
const ToPatch& targetPatch, const ToPatch& targetPatch,
const Field<PointType>& projectionDirection, const Field
<
typename Foam::PrimitivePatch<FaceList, PointField>::point_type
>& projectionDirection,
const intersection::algorithm alg, const intersection::algorithm alg,
const intersection::direction dir const intersection::direction dir
) const ) const
@ -77,10 +74,10 @@ projectPoints
const ToPatch& masterFaces = targetPatch; const ToPatch& masterFaces = targetPatch;
const Field<PointType>& masterPoints = targetPatch.points(); const Field<point_type>& masterPoints = targetPatch.points();
// Estimate face centre of target side // Estimate face centre of target side
Field<PointType> masterFaceCentres(targetPatch.size()); Field<point_type> masterFaceCentres(targetPatch.size());
forAll(masterFaceCentres, facei) forAll(masterFaceCentres, facei)
{ {
@ -104,10 +101,10 @@ projectPoints
// Pick up slave point and direction // Pick up slave point and direction
const label curLocalPointLabel = slavePointOrder[pointi]; const label curLocalPointLabel = slavePointOrder[pointi];
const PointType& curPoint = const point_type& curPoint =
points_[slaveMeshPoints[curLocalPointLabel]]; points_[slaveMeshPoints[curLocalPointLabel]];
const PointType& curProjectionDir = const point_type& curProjectionDir =
projectionDirection[curLocalPointLabel]; projectionDirection[curLocalPointLabel];
bool closer; bool closer;
@ -133,7 +130,7 @@ projectPoints
doNSquaredSearch = false; doNSquaredSearch = false;
// Calculate intersection with curFace // Calculate intersection with curFace
PointHit<PointType> curHit = PointHit<point_type> curHit =
masterFaces[curFace].ray masterFaces[curFace].ray
( (
curPoint, curPoint,
@ -169,7 +166,7 @@ projectPoints
// face. This is cooked (illogical!) for fastest // face. This is cooked (illogical!) for fastest
// surface walk. // surface walk.
// //
PointType missPlanePoint = point_type missPlanePoint =
curPoint + curProjectionDir*curHit.distance(); curPoint + curProjectionDir*curHit.distance();
const labelList& masterNbrs = masterFaceFaces[curFace]; const labelList& masterNbrs = masterFaceFaces[curFace];
@ -224,7 +221,7 @@ projectPoints
forAll(masterFaces, facei) forAll(masterFaces, facei)
{ {
PointHit<PointType> curHit = PointHit<point_type> curHit =
masterFaces[facei].ray masterFaces[facei].ray
( (
curPoint, curPoint,
@ -279,20 +276,16 @@ projectPoints
} }
template template<class FaceList, class PointField>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
template<class ToPatch> template<class ToPatch>
Foam::List<Foam::objectHit> Foam::List<Foam::objectHit>
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: Foam::PrimitivePatch<FaceList, PointField>::projectFaceCentres
projectFaceCentres
( (
const ToPatch& targetPatch, const ToPatch& targetPatch,
const Field<PointType>& projectionDirection, const Field
<
typename Foam::PrimitivePatch<FaceList, PointField>::point_type
>& projectionDirection,
const intersection::algorithm alg, const intersection::algorithm alg,
const intersection::direction dir const intersection::direction dir
) const ) const
@ -311,7 +304,7 @@ projectFaceCentres
labelList slaveFaceOrder = bandCompression(faceFaces()); labelList slaveFaceOrder = bandCompression(faceFaces());
// calculate master face centres // calculate master face centres
Field<PointType> masterFaceCentres(targetPatch.size()); Field<point_type> masterFaceCentres(targetPatch.size());
const labelListList& masterFaceFaces = targetPatch.faceFaces(); const labelListList& masterFaceFaces = targetPatch.faceFaces();
@ -328,8 +321,7 @@ projectFaceCentres
// Result // Result
List<objectHit> result(this->size()); List<objectHit> result(this->size());
const PrimitivePatch<Face, FaceList, PointField, PointType>& slaveFaces = const PrimitivePatch<FaceList, PointField>& slaveFaces = *this;
*this;
const PointField& slaveGlobalPoints = points(); const PointField& slaveGlobalPoints = points();
@ -378,7 +370,7 @@ projectFaceCentres
doNSquaredSearch = false; doNSquaredSearch = false;
// Calculate intersection with curFace // Calculate intersection with curFace
PointHit<PointType> curHit = PointHit<point_type> curHit =
masterFaces[curFace].ray masterFaces[curFace].ray
( (
curFaceCentre, curFaceCentre,
@ -413,7 +405,7 @@ projectFaceCentres
// Calculate the miss point. This is // Calculate the miss point. This is
// cooked (illogical!) for fastest surface walk. // cooked (illogical!) for fastest surface walk.
// //
PointType missPlanePoint = point_type missPlanePoint =
curFaceCentre + curProjectionDir*curHit.distance(); curFaceCentre + curProjectionDir*curHit.distance();
sqrDistance = sqrDistance =
@ -465,7 +457,7 @@ projectFaceCentres
forAll(masterFaces, facei) forAll(masterFaces, facei)
{ {
PointHit<PointType> curHit = PointHit<point_type> curHit =
masterFaces[facei].ray masterFaces[facei].ray
( (
curFaceCentre, curFaceCentre,

View File

@ -45,7 +45,7 @@ Description
namespace Foam namespace Foam
{ {
typedef PrimitivePatch<face, IndirectList, const pointField&> typedef PrimitivePatch<IndirectList<face>, const pointField&>
indirectPrimitivePatch; indirectPrimitivePatch;
} }

View File

@ -47,7 +47,7 @@ Description
namespace Foam namespace Foam
{ {
typedef PrimitivePatch<face, List, const pointField&> typedef PrimitivePatch<List<face>, const pointField&>
primitiveFacePatch; primitiveFacePatch;
} }

View File

@ -47,7 +47,7 @@ Description
namespace Foam namespace Foam
{ {
typedef PrimitivePatch<face, SubList, const pointField&> typedef PrimitivePatch<SubList<face>, const pointField&>
primitivePatch; primitivePatch;
} }

View File

@ -45,7 +45,7 @@ Description
namespace Foam namespace Foam
{ {
typedef PrimitivePatch<face, UIndirectList, const pointField&> typedef PrimitivePatch<UIndirectList<face>, const pointField&>
uindirectPrimitivePatch; uindirectPrimitivePatch;
} }

View File

@ -45,6 +45,7 @@ License
#include "twoDPointCorrector.H" #include "twoDPointCorrector.H"
#include "gravityMeshObject.H" #include "gravityMeshObject.H"
#include "turbulentTransportModel.H" #include "turbulentTransportModel.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -44,6 +44,7 @@ SourceFiles
#include "surfaceFields.H" #include "surfaceFields.H"
#include "surfactantProperties.H" #include "surfactantProperties.H"
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,11 +24,6 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Attach/detach boundary mesh modifier. This modifier takes a set of
internal faces and converts them into boundary faces and vice versa
based on the given activation switch.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "attachDetach.H" #include "attachDetach.H"
@ -38,6 +33,7 @@ Description
#include "primitiveMesh.H" #include "primitiveMesh.H"
#include "polyTopoChange.H" #include "polyTopoChange.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -44,7 +45,7 @@ Description
namespace Foam namespace Foam
{ {
typedef PrimitivePatch<face, List, const pointField> bMesh; typedef PrimitivePatch<List<face>, const pointField> bMesh;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -23,9 +24,6 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Cell layer addition/removal mesh modifier
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "layerAdditionRemoval.H" #include "layerAdditionRemoval.H"
@ -35,6 +33,7 @@ Description
#include "primitiveMesh.H" #include "primitiveMesh.H"
#include "polyTopoChange.H" #include "polyTopoChange.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -42,6 +42,7 @@ License
#include "polyModifyPoint.H" #include "polyModifyPoint.H"
#include "polyModifyFace.H" #include "polyModifyFace.H"
#include "polyRemoveFace.H" #include "polyRemoveFace.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,6 +36,7 @@ Description
#include "labelPair.H" #include "labelPair.H"
#include "primitiveMesh.H" #include "primitiveMesh.H"
#include "edgeHashes.H" #include "edgeHashes.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -32,6 +32,7 @@ License
#include "polyTopoChange.H" #include "polyTopoChange.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "plane.H" #include "plane.H"
#include "demandDrivenData.H"
// Index of debug signs: // Index of debug signs:
// p - adjusting a projection point // p - adjusting a projection point

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,6 +30,7 @@ License
#include "polyMesh.H" #include "polyMesh.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "polyTopoChanger.H" #include "polyTopoChanger.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,6 +30,7 @@ License
#include "polyMesh.H" #include "polyMesh.H"
#include "line.H" #include "line.H"
#include "polyTopoChanger.H" #include "polyTopoChanger.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -23,13 +23,11 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
FV surface mapper.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faAreaMapper.H" #include "faAreaMapper.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -23,13 +23,11 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
FA edge mapper.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faEdgeMapper.H" #include "faEdgeMapper.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -31,6 +31,7 @@ License
#include "faMesh.H" #include "faMesh.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "faceMapper.H" #include "faceMapper.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -33,6 +33,7 @@ License
#include "faBoundaryMesh.H" #include "faBoundaryMesh.H"
#include "faMesh.H" #include "faMesh.H"
#include "globalMeshData.H" #include "globalMeshData.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -33,6 +33,7 @@ License
#include "areaFields.H" #include "areaFields.H"
#include "edgeFields.H" #include "edgeFields.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,6 +30,7 @@ License
#include "edgeFields.H" #include "edgeFields.H"
#include "areaFields.H" #include "areaFields.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -61,12 +63,8 @@ Foam::leastSquaresFaVectors::~leastSquaresFaVectors()
void Foam::leastSquaresFaVectors::makeLeastSquaresVectors() const void Foam::leastSquaresFaVectors::makeLeastSquaresVectors() const
{ {
if (debug) DebugInFunction
{ << "Constructing finite area least square gradient vectors" << nl;
Info<< "leastSquaresFaVectors::makeLeastSquaresVectors() :"
<< "Constructing finite area least square gradient vectors"
<< endl;
}
pVectorsPtr_ = new edgeVectorField pVectorsPtr_ = new edgeVectorField
( (
@ -213,12 +211,8 @@ void Foam::leastSquaresFaVectors::makeLeastSquaresVectors() const
} }
} }
if (debug) DebugInFunction
{ << "Done constructing finite area least square gradient vectors" << nl;
Info<< "leastSquaresFaVectors::makeLeastSquaresVectors() :"
<< "Finished constructing finite area least square gradient vectors"
<< endl;
}
} }
@ -246,11 +240,8 @@ const Foam::edgeVectorField& Foam::leastSquaresFaVectors::nVectors() const
bool Foam::leastSquaresFaVectors::movePoints() bool Foam::leastSquaresFaVectors::movePoints()
{ {
if (debug) DebugInFunction
{ << "Clearing least square data" << nl;
InfoIn("bool leastSquaresFaVectors::movePoints()")
<< "Clearing least square data" << endl;
}
deleteDemandDrivenData(pVectorsPtr_); deleteDemandDrivenData(pVectorsPtr_);
deleteDemandDrivenData(nVectorsPtr_); deleteDemandDrivenData(nVectorsPtr_);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -32,6 +32,7 @@ License
#include "extrapolatedCalculatedFvPatchFields.H" #include "extrapolatedCalculatedFvPatchFields.H"
#include "coupledFvPatchFields.H" #include "coupledFvPatchFields.H"
#include "UIndirectList.H" #include "UIndirectList.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,6 +32,7 @@ License
#include "fvMesh.H" #include "fvMesh.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "faceMapper.H" #include "faceMapper.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -23,15 +24,13 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
FV surface mapper.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvSurfaceMapper.H" #include "fvSurfaceMapper.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "faceMapper.H" #include "faceMapper.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -26,6 +26,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "weightedFlux.H" #include "weightedFlux.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -56,7 +56,7 @@ class pairPatchAgglomeration
{ {
protected: protected:
typedef PrimitivePatch<face, List, const pointField> bPatch; typedef PrimitivePatch<List<face>, const pointField> bPatch;
// Protected data // Protected data

View File

@ -541,7 +541,7 @@ Foam::extendedEdgeMesh::extendedEdgeMesh
Foam::extendedEdgeMesh::extendedEdgeMesh Foam::extendedEdgeMesh::extendedEdgeMesh
( (
const PrimitivePatch<face, List, pointField, point>& surf, const PrimitivePatch<faceList, pointField>& surf,
const labelUList& featureEdges, const labelUList& featureEdges,
const labelUList& regionFeatureEdges, const labelUList& regionFeatureEdges,
const labelUList& featurePoints const labelUList& featurePoints

View File

@ -308,7 +308,7 @@ public:
//- Construct from PrimitivePatch //- Construct from PrimitivePatch
extendedEdgeMesh extendedEdgeMesh
( (
const PrimitivePatch<face, List, pointField, point>& surf, const PrimitivePatch<faceList, pointField>& surf,
const labelUList& featureEdges, const labelUList& featureEdges,
const labelUList& regionFeatureEdges, const labelUList& regionFeatureEdges,
const labelUList& featurePoints const labelUList& featurePoints

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -122,7 +123,7 @@ Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh
Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh
( (
const IOobject& io, const IOobject& io,
const PrimitivePatch<face, List, pointField, point>& surf, const PrimitivePatch<faceList, pointField>& surf,
const labelUList& featureEdges, const labelUList& featureEdges,
const labelUList& regionFeatureEdges, const labelUList& regionFeatureEdges,
const labelUList& featurePoints const labelUList& featurePoints

View File

@ -94,7 +94,7 @@ public:
extendedFeatureEdgeMesh extendedFeatureEdgeMesh
( (
const IOobject& io, const IOobject& io,
const PrimitivePatch<face, List, pointField, point>& surf, const PrimitivePatch<faceList, pointField>& surf,
const labelUList& featureEdges, const labelUList& featureEdges,
const labelUList& regionFeatureEdges, const labelUList& regionFeatureEdges,
const labelUList& featurePoints const labelUList& featurePoints

View File

@ -554,7 +554,7 @@ Foam::tmp<Foam::pointField> Foam::triSurfaceMesh::coordinates() const
// Calculate face centres from a copy to avoid incurring // Calculate face centres from a copy to avoid incurring
// additional storage // additional storage
pts = PrimitivePatch<labelledTri, SubList, const pointField&> pts = PrimitivePatch<FaceListType, const pointField&>
( (
FaceListType(*this, triSurface::size()), FaceListType(*this, triSurface::size()),
triSurface::points() triSurface::points()

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -59,14 +60,10 @@ class triSurfaceRegionSearch
: :
public triSurfaceSearch public triSurfaceSearch
{ {
// Private typedefs // Private Typedefs
typedef PrimitivePatch typedef PrimitivePatch<IndirectList<labelledTri>, const pointField&>
< indirectTriSurface;
labelledTri,
IndirectList,
const pointField&
> indirectTriSurface;
typedef treeDataPrimitivePatch<indirectTriSurface> typedef treeDataPrimitivePatch<indirectTriSurface>
treeDataIndirectTriSurface; treeDataIndirectTriSurface;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -32,6 +32,7 @@ License
#include "emptyPolyPatch.H" #include "emptyPolyPatch.H"
#include "SubField.H" #include "SubField.H"
#include "meshTools.H" #include "meshTools.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -95,7 +95,7 @@ Ostream& operator<<(Ostream&, const MeshedSurface<Face>&);
template<class Face> template<class Face>
class MeshedSurface class MeshedSurface
: :
public PrimitivePatch<Face, ::Foam::List, pointField, point>, public PrimitivePatch<::Foam::List<Face>, pointField>,
public fileFormats::surfaceFormatsCore public fileFormats::surfaceFormatsCore
{ {
// Friends, regardless of face representations // Friends, regardless of face representations
@ -111,7 +111,7 @@ private:
// Private Typedefs (convenience) // Private Typedefs (convenience)
//- Internal mesh storage type //- Internal mesh storage type
typedef PrimitivePatch<Face, ::Foam::List, pointField, point> typedef PrimitivePatch<::Foam::List<Face>, pointField>
MeshReference; MeshReference;
typedef UnsortedMeshedSurface<Face> FriendType; typedef UnsortedMeshedSurface<Face> FriendType;

View File

@ -68,7 +68,7 @@ template<class Face> class MeshedSurface;
class polySurface class polySurface
: :
public objectRegistry, public objectRegistry,
public PrimitivePatch<face, ::Foam::List, pointField, point>, public PrimitivePatch<::Foam::List<face>, pointField>,
public meshedSurf public meshedSurf
{ {
public: public:
@ -88,7 +88,7 @@ private:
// Private Typedefs // Private Typedefs
//- Internal mesh storage type //- Internal mesh storage type
typedef PrimitivePatch<face, ::Foam::List, pointField, point> typedef PrimitivePatch<::Foam::List<face>, pointField>
MeshReference; MeshReference;

View File

@ -65,7 +65,7 @@ class surfMesh
: :
public surfaceRegistry, public surfaceRegistry,
private Detail::MeshedSurfaceIOAllocator, private Detail::MeshedSurfaceIOAllocator,
public PrimitivePatch<face, UList, const pointField&, point> public PrimitivePatch<::Foam::UList<face>, const pointField&>
{ {
public: public:
@ -91,7 +91,7 @@ private:
typedef Detail::MeshedSurfaceIOAllocator Allocator; typedef Detail::MeshedSurfaceIOAllocator Allocator;
//- Internal mesh storage type //- Internal mesh storage type
typedef PrimitivePatch<face, UList, const pointField&, point> typedef PrimitivePatch<::Foam::UList<face>, const pointField&>
MeshReference; MeshReference;

View File

@ -335,7 +335,7 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write
if (zones.size() == 1) if (zones.size() == 1)
{ {
PrimitivePatch<Face, UList, const pointField&> patch PrimitivePatch<UList<Face>, const pointField&> patch
( (
faceLst, pointLst faceLst, pointLst
); );
@ -349,10 +349,13 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write
{ {
if (useFaceMap) if (useFaceMap)
{ {
typedef UIndirectList<Face> FaceListType;
SubList<label> zoneMap(surf.faceMap(), zone.range()); SubList<label> zoneMap(surf.faceMap(), zone.range());
PrimitivePatch<Face, UIndirectList, const pointField&> patch
PrimitivePatch<FaceListType, const pointField&> patch
( (
UIndirectList<Face>(faceLst, zoneMap), FaceListType(faceLst, zoneMap),
pointLst pointLst
); );
@ -360,9 +363,11 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write
} }
else else
{ {
PrimitivePatch<Face, UList, const pointField&> patch typedef SubList<Face> FaceListType;
PrimitivePatch<FaceListType, const pointField&> patch
( (
SubList<Face>(faceLst, zone.range()), FaceListType(faceLst, zone.range()),
pointLst pointLst
); );
@ -416,10 +421,13 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write
label zoneIndex = 0; label zoneIndex = 0;
for (const surfZone& zone : zoneLst) for (const surfZone& zone : zoneLst)
{ {
typedef UIndirectList<Face> FaceListType;
SubList<label> zoneMap(faceMap, zone.range()); SubList<label> zoneMap(faceMap, zone.range());
PrimitivePatch<Face, UIndirectList, const pointField&> patch
PrimitivePatch<FaceListType, const pointField&> patch
( (
UIndirectList<Face>(surf.surfFaces(), zoneMap), FaceListType(surf.surfFaces(), zoneMap),
surf.points() surf.points()
); );

View File

@ -76,12 +76,12 @@ Ostream& operator<<(Ostream&, const triSurface&);
class triSurface class triSurface
: :
public PrimitivePatch<labelledTri, ::Foam::List, pointField, point> public PrimitivePatch<::Foam::List<labelledTri>, pointField>
{ {
// Private Typedefs // Private Typedefs
//- Internal mesh storage type //- Internal mesh storage type
typedef PrimitivePatch<labelledTri, ::Foam::List, pointField, point> typedef PrimitivePatch<::Foam::List<labelledTri>, pointField>
MeshReference; MeshReference;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 OpenFOAM Foundation Copyright (C) 2016-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -28,6 +28,7 @@ License
#include "ISAT.H" #include "ISAT.H"
#include "LUscalarMatrix.H" #include "LUscalarMatrix.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 OpenFOAM Foundation Copyright (C) 2016-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -28,6 +28,7 @@ License
#include "binaryTree.H" #include "binaryTree.H"
#include "SortableList.H" #include "SortableList.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //

View File

@ -33,6 +33,7 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "unitConversion.H" #include "unitConversion.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //