dynamicMesh: Renamed boundaryMesh to repatchMesh and removed unused code

This commit is contained in:
Will Bainbridge
2021-06-22 09:20:45 +01:00
parent 9283955b99
commit 3baba56734
9 changed files with 142 additions and 970 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,7 +33,7 @@ Description
#include "argList.H"
#include "polyMesh.H"
#include "Time.H"
#include "boundaryMesh.H"
#include "repatchMesh.H"
#include "repatchPolyTopoChanger.H"
#include "unitConversion.H"
#include "OFstream.H"
@ -44,21 +44,21 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Get all feature edges.
void collectFeatureEdges(const boundaryMesh& bMesh, labelList& markedEdges)
void collectFeatureEdges(const repatchMesh& rMesh, labelList& markedEdges)
{
markedEdges.setSize(bMesh.mesh().nEdges());
markedEdges.setSize(rMesh.mesh().nEdges());
label markedI = 0;
forAll(bMesh.featureSegments(), i)
forAll(rMesh.featureSegments(), i)
{
const labelList& segment = bMesh.featureSegments()[i];
const labelList& segment = rMesh.featureSegments()[i];
forAll(segment, j)
{
label featEdgeI = segment[j];
label meshEdgeI = bMesh.featureToEdge()[featEdgeI];
label meshEdgeI = rMesh.featureToEdge()[featEdgeI];
markedEdges[markedI++] = meshEdgeI;
}
@ -95,24 +95,24 @@ int main(int argc, char *argv[])
<< endl;
//
// Use boundaryMesh to reuse all the featureEdge stuff in there.
// Use repatchMesh to reuse all the featureEdge stuff in there.
//
boundaryMesh bMesh;
bMesh.read(mesh);
repatchMesh rMesh;
rMesh.read(mesh);
// Set feature angle (calculate feature edges)
bMesh.setFeatureEdges(minCos);
rMesh.setFeatureEdges(minCos);
// Collect all feature edges as edge labels
labelList markedEdges;
collectFeatureEdges(bMesh, markedEdges);
collectFeatureEdges(rMesh, markedEdges);
// (new) patch ID for every face in mesh.
labelList patchIDs(bMesh.mesh().size(), -1);
labelList patchIDs(rMesh.mesh().size(), -1);
//
// Fill patchIDs with values for every face by floodfilling without
@ -120,7 +120,7 @@ int main(int argc, char *argv[])
//
// Current patch number.
label newPatchi = bMesh.patches().size();
label newPatchi = rMesh.patches().size();
label suffix = 0;
@ -141,17 +141,17 @@ int main(int argc, char *argv[])
{
patchName = "auto" + name(suffix++);
}
while (bMesh.findPatchID(patchName) != -1);
while (rMesh.findPatchID(patchName) != -1);
bMesh.addPatch(patchName);
rMesh.addPatch(patchName);
bMesh.changePatchType(patchName, "patch");
rMesh.changePatchType(patchName, "patch");
// Fill visited with all faces reachable from unsetFacei.
boolList visited(bMesh.mesh().size());
boolList visited(rMesh.mesh().size());
bMesh.markFaces(markedEdges, unsetFacei, visited);
rMesh.markFaces(markedEdges, unsetFacei, visited);
// Assign all visited faces to current patch
@ -175,7 +175,7 @@ int main(int argc, char *argv[])
const PtrList<boundaryPatch>& patches = bMesh.patches();
const PtrList<repatchPatch>& patches = rMesh.patches();
// Create new list of patches with old ones first
List<polyPatch*> newPatchPtrList(patches.size());
@ -202,7 +202,7 @@ int main(int argc, char *argv[])
// Add new ones with empty size.
for (label patchi = newPatchi; patchi < patches.size(); patchi++)
{
const boundaryPatch& bp = patches[patchi];
const repatchPatch& bp = patches[patchi];
newPatchPtrList[newPatchi] = polyPatch::New
(
@ -230,9 +230,9 @@ int main(int argc, char *argv[])
// Change face ordering
// Since bMesh read from mesh there is one to one mapping so we don't
// Since rMesh read from mesh there is one to one mapping so we don't
// have to do the geometric stuff.
const labelList& meshFace = bMesh.meshFace();
const labelList& meshFace = rMesh.meshFace();
forAll(patchIDs, facei)
{

View File

@ -3,7 +3,6 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-ltriSurface \
-lmeshTools \

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,14 +25,14 @@ Application
surfaceToPatch
Description
Reads surface and applies surface regioning to a mesh. Uses boundaryMesh
Reads surface and applies surface regioning to a mesh. Uses repatchMesh
to do the hard work.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "boundaryMesh.H"
#include "repatchMesh.H"
#include "polyMesh.H"
#include "faceSet.H"
#include "polyTopoChange.H"
@ -103,7 +103,7 @@ label addPatch(polyMesh& mesh, const word& patchName)
bool repatchFace
(
const polyMesh& mesh,
const boundaryMesh& bMesh,
const repatchMesh& rMesh,
const labelList& nearest,
const labelList& surfToMeshPatch,
const label facei,
@ -117,9 +117,9 @@ bool repatchFace
if (nearest[bFacei] != -1)
{
// Use boundary mesh one.
label bMeshPatchID = bMesh.whichPatch(nearest[bFacei]);
label rMeshPatchID = rMesh.whichPatch(nearest[bFacei]);
label patchID = surfToMeshPatch[bMeshPatchID];
label patchID = surfToMeshPatch[rMeshPatchID];
if (patchID != mesh.boundaryMesh().whichPatch(facei))
{
@ -230,13 +230,13 @@ int main(int argc, char *argv[])
Info<< endl;
boundaryMesh bMesh;
repatchMesh rMesh;
// Load in the surface.
bMesh.readTriSurface(surfName);
rMesh.readTriSurface(surfName);
// Add all the boundaryMesh patches to the mesh.
const PtrList<boundaryPatch>& bPatches = bMesh.patches();
const PtrList<repatchPatch>& bPatches = rMesh.patches();
// Map from surface patch ( = boundaryMesh patch) to polyMesh patch
labelList patchMap(bPatches.size());
@ -246,10 +246,10 @@ int main(int argc, char *argv[])
patchMap[i] = addPatch(mesh, bPatches[i].name());
}
// Obtain nearest face in bMesh for each boundary face in mesh that
// Obtain nearest face in rMesh for each boundary face in mesh that
// is within search span.
// Note: should only determine for faceSet if working with that.
labelList nearest(bMesh.getNearest(mesh, searchSpan));
labelList nearest(rMesh.getNearest(mesh, searchSpan));
{
// Dump unmatched faces to faceSet for debugging.
@ -285,7 +285,7 @@ int main(int argc, char *argv[])
{
label facei = iter.key();
if (repatchFace(mesh, bMesh, nearest, patchMap, facei, meshMod))
if (repatchFace(mesh, rMesh, nearest, patchMap, facei, meshMod))
{
nChanged++;
}
@ -297,7 +297,7 @@ int main(int argc, char *argv[])
{
label facei = mesh.nInternalFaces() + bFacei;
if (repatchFace(mesh, bMesh, nearest, patchMap, facei, meshMod))
if (repatchFace(mesh, rMesh, nearest, patchMap, facei, meshMod))
{
nChanged++;
}

View File

@ -53,8 +53,9 @@ slidingInterface/decoupleSlidingInterface.C
perfectInterface/perfectInterface.C
boundaryMesh/boundaryMesh.C
boundaryPatch/boundaryPatch.C
repatchMesh/repatchMesh.C
repatchMesh/repatchPatch.C
setUpdater/setUpdater.C
meshModifiers = meshCut/meshModifiers

View File

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::bMesh
Description
Holder of faceList and points. (v.s. e.g. primitivePatch which references
points)
\*---------------------------------------------------------------------------*/
#ifndef bMesh_H
#define bMesh_H
#include "PrimitivePatch.H"
#include "faceList.H"
#include "pointField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef PrimitivePatch<faceList, const pointField> bMesh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,22 +22,21 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::boundaryMesh
Foam::repatchMesh
Description
Addressing for all faces on surface of mesh. Can either be read
from polyMesh or from triSurface. Used for repatching existing meshes.
SourceFiles
boundaryMesh.C
repatchMesh.C
\*---------------------------------------------------------------------------*/
#ifndef boundaryMesh_H
#define boundaryMesh_H
#ifndef repatchMesh_H
#define repatchMesh_H
#include "bMesh.H"
#include "boundaryPatch.H"
#include "repatchPatch.H"
#include "PrimitivePatch.H"
#include "PtrList.H"
#include "polyPatchList.H"
@ -49,16 +48,25 @@ namespace Foam
{
// Forward declaration of classes
class Time;
class polyMesh;
class primitiveMesh;
/*---------------------------------------------------------------------------*\
Class boundaryMesh Declaration
Class repatchMesh Declaration
\*---------------------------------------------------------------------------*/
class boundaryMesh
class repatchMesh
{
public:
// Public Typedefs
//- Type of the mesh
typedef PrimitivePatch<faceList, const pointField> rMesh;
private:
// Static data
//- Normal along which to divide faces into categories
@ -74,20 +82,15 @@ class boundaryMesh
// Private Data
//- All boundary mesh data. Reconstructed every time faces are repatched
bMesh* meshPtr_;
autoPtr<rMesh> meshPtr_;
//- Patches. Reconstructed every time faces are repatched.
PtrList<boundaryPatch> patches_;
PtrList<repatchPatch> patches_;
//- For every face in mesh() gives corresponding polyMesh face
// (not sensible if mesh read from triSurface)
labelList meshFace_;
//
// Edge handling
//
//- Points referenced by feature edges.
pointField featurePoints_;
@ -104,9 +107,6 @@ class boundaryMesh
// Indices into featureEdges_.
labelListList featureSegments_;
//- Additional edges (indices of mesh edges)
labelList extraEdges_;
// Private Member Functions
@ -124,24 +124,6 @@ class boundaryMesh
boolList& featVisited
) const;
//- Do point-edge walk to determine nearest (to edgeI). Stops if
// distance >= maxDistance. Used to determine edges close to seed
// point.
void markEdges
(
const label maxDistance,
const label edgeI,
const label distance,
labelList& minDistance,
DynamicList<label>& visited
) const;
//- Get index of polypatch by name
label findPatchID(const polyPatchList&, const word&) const;
//- Get index of patch for face
label whichPatch(const polyPatchList&, const label) const;
//- Gets labels of changed faces and propagates them to the edges.
// Returns labels of edges changed. Fills edgeRegion of visited edges
// with current region.
@ -175,31 +157,30 @@ class boundaryMesh
public:
//- Runtime type information
ClassName("boundaryMesh");
ClassName("repatchMesh");
// Constructors
//- Construct null
boundaryMesh();
repatchMesh();
//- Disallow default bitwise copy construction
boundaryMesh(const boundaryMesh&) = delete;
repatchMesh(const repatchMesh&) = delete;
//- Destructor
~boundaryMesh();
void clearOut();
~repatchMesh();
// Member Functions
// Access
const bMesh& mesh() const
//- Access the boundary mesh
const rMesh& mesh() const
{
if (!meshPtr_)
if (!meshPtr_.valid())
{
FatalErrorInFunction
<< "No mesh available. Probably mesh not yet"
@ -208,12 +189,12 @@ public:
return *meshPtr_;
}
const PtrList<boundaryPatch>& patches() const
//- Access the patches
const PtrList<repatchPatch>& patches() const
{
return patches_;
}
//- Label of original face in polyMesh (before patchify(...))
const labelList& meshFace() const
{
@ -250,25 +231,16 @@ public:
return featureSegments_;
}
//- Indices into edges of additional edges.
const labelList& extraEdges() const
{
return extraEdges_;
}
// Edit
//- Read from boundaryMesh of polyMesh.
//- Read from repatchMesh of polyMesh.
void read(const polyMesh&);
//- Read from triSurface
void readTriSurface(const fileName&);
//- Write to file.
void writeTriSurface(const fileName&) const;
//- Get bMesh index of nearest face for every boundary face in
//- Get rMesh index of nearest face for every boundary face in
// pMesh. Gets passed initial search box. If not found
// returns -1 for the face.
labelList getNearest
@ -277,20 +249,6 @@ public:
const vector& searchSpan
) const;
//- Take over patches onto polyMesh from nearest face in *this
// (from call to getNearest). Insert as
// -new set of patches (newMesh.addPatches)
// -topoChanges to change faces.
// nearest is list of nearest face in *this for every boundary
// face. oldPatches is list of existing patches in mesh.
// newMesh is the mesh to which the new patches are added.
// (so has to be constructed without patches).
void patchify
(
const labelList& nearest,
const polyBoundaryMesh& oldPatches,
polyMesh& newMesh
) const;
// Patches
@ -300,9 +258,6 @@ public:
//- Get index of patch by name
label findPatchID(const word& patchName) const;
//- Get names of patches
wordList patchNames() const;
//- Add to back of patch list.
void addPatch(const word& patchName);
@ -312,10 +267,6 @@ public:
//- Change patch.
void changePatchType(const word& patchName, const word& type);
//- Recalculate face ordering and patches. Return old to new
// mapping.
void changeFaces(const labelList& patchIDs, labelList& oldToNew);
// Edges
@ -323,50 +274,6 @@ public:
// to angle of faces across edge
void setFeatureEdges(const scalar minCos);
//- Set extraEdges to edges 'near' to edgeI. Uses point-edge walk
// to determine 'near'.
void setExtraEdges(const label edgeI);
// Faces
//- Simple triangulation of face subset. Returns number of triangles
// needed.
label getNTris(const label facei) const;
//- Simple triangulation of face subset. TotalNTris is total number
// of triangles, nTris is per face number of triangles.
label getNTris
(
const label startFacei,
const label nFaces,
labelList& nTris
) const;
//- Simple triangulation of face subset. TotalNTris is total number
// of triangles (from call to getNTris)
// triVerts is triangle vertices, three per triangle.
void triangulate
(
const label startFacei,
const label nFaces,
const label totalNTris,
labelList& triVerts
) const;
//- Number of points used in face subset.
label getNPoints(const label startFacei, const label nFaces) const;
//- Same as triangulate but in local vertex numbering.
// (Map returned).
void triangulateLocal
(
const label startFacei,
const label nFaces,
const label totalNTris,
labelList& triVerts,
labelList& localToGlobal
) const;
// Other
@ -382,7 +289,7 @@ public:
// Member Operators
//- Disallow default bitwise assignment
void operator=(const boundaryMesh&) = delete;
void operator=(const repatchMesh&) = delete;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,13 +23,13 @@ License
\*---------------------------------------------------------------------------*/
#include "boundaryPatch.H"
#include "repatchPatch.H"
#include "dictionary.H"
#include "Ostream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::boundaryPatch::boundaryPatch
Foam::repatchPatch::repatchPatch
(
const word& name,
const label index,
@ -44,7 +44,7 @@ Foam::boundaryPatch::boundaryPatch
{}
Foam::boundaryPatch::boundaryPatch
Foam::repatchPatch::repatchPatch
(
const word& name,
const dictionary& dict,
@ -57,7 +57,7 @@ Foam::boundaryPatch::boundaryPatch
{}
Foam::boundaryPatch::boundaryPatch(const boundaryPatch& p, const label index)
Foam::repatchPatch::repatchPatch(const repatchPatch& p, const label index)
:
patchIdentifier(p.name(), index, p.physicalType()),
size_(p.size()),
@ -65,21 +65,21 @@ Foam::boundaryPatch::boundaryPatch(const boundaryPatch& p, const label index)
{}
Foam::autoPtr<Foam::boundaryPatch> Foam::boundaryPatch::clone() const
Foam::autoPtr<Foam::repatchPatch> Foam::repatchPatch::clone() const
{
return autoPtr<boundaryPatch>(new boundaryPatch(*this));
return autoPtr<repatchPatch>(new repatchPatch(*this));
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::boundaryPatch::~boundaryPatch()
Foam::repatchPatch::~repatchPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::boundaryPatch::write(Ostream& os) const
void Foam::repatchPatch::write(Ostream& os) const
{
patchIdentifier::write(os);
writeEntry(os, "nFaces", size_);
@ -89,10 +89,10 @@ void Foam::boundaryPatch::write(Ostream& os) const
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const boundaryPatch& p)
Foam::Ostream& Foam::operator<<(Ostream& os, const repatchPatch& p)
{
p.write(os);
os.check("Ostream& operator<<(Ostream& f, const boundaryPatch&)");
os.check("Ostream& operator<<(Ostream& f, const repatchPatch&)");
return os;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,19 +22,19 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::boundaryPatch
Foam::repatchPatch
Description
Like polyPatch but without reference to mesh. patchIdentifier::index
is not used. Used in boundaryMesh to hold data on patches.
is not used. Used in repatchMesh to hold data on patches.
SourceFiles
boundaryPatch.C
repatchPatch.C
\*---------------------------------------------------------------------------*/
#ifndef boundaryPatch_H
#define boundaryPatch_H
#ifndef repatchPatch_H
#define repatchPatch_H
#include "patchIdentifier.H"
#include "autoPtr.H"
@ -46,16 +46,16 @@ namespace Foam
// Forward declaration of friend functions and operators
class boundaryPatch;
class repatchPatch;
Ostream& operator<<(Ostream&, const boundaryPatch&);
Ostream& operator<<(Ostream&, const repatchPatch&);
/*---------------------------------------------------------------------------*\
Class boundaryPatch Declaration
Class repatchPatch Declaration
\*---------------------------------------------------------------------------*/
class boundaryPatch
class repatchPatch
:
public patchIdentifier
{
@ -69,7 +69,7 @@ public:
// Constructors
//- Construct from components
boundaryPatch
repatchPatch
(
const word& name,
const label index,
@ -79,7 +79,7 @@ public:
);
//- Construct from dictionary
boundaryPatch
repatchPatch
(
const word& name,
const dictionary& dict,
@ -87,14 +87,14 @@ public:
);
//- Copy constructor, resetting the index
boundaryPatch(const boundaryPatch&, const label index);
repatchPatch(const repatchPatch&, const label index);
//- Clone
autoPtr<boundaryPatch> clone() const;
autoPtr<repatchPatch> clone() const;
//- Destructor
~boundaryPatch();
~repatchPatch();
// Member Functions
@ -126,7 +126,7 @@ public:
// Ostream Operator
friend Ostream& operator<<(Ostream&, const boundaryPatch&);
friend Ostream& operator<<(Ostream&, const repatchPatch&);
};