Commit 32a854d2 authored by mattijs's avatar mattijs
Browse files

ENH: meshStructure: make sense in parallel. Fixes #732.

parent 8033592e
......@@ -28,6 +28,7 @@ License
#include "topoDistanceData.H"
#include "pointTopoDistanceData.H"
#include "PointEdgeWave.H"
#include "globalIndex.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -99,7 +100,10 @@ bool Foam::meshStructure::isStructuredCell
void Foam::meshStructure::correct
(
const polyMesh& mesh,
const uindirectPrimitivePatch& pp
const uindirectPrimitivePatch& pp,
const globalIndex& globalFaces,
const globalIndex& globalEdges,
const globalIndex& globalPoints
)
{
// Field on cells and faces.
......@@ -121,7 +125,11 @@ void Foam::meshStructure::correct
forAll(pp, patchFacei)
{
patchFaces[patchFacei] = pp.addressing()[patchFacei];
patchData[patchFacei] = topoDistanceData(patchFacei, 0);
patchData[patchFacei] = topoDistanceData
(
globalFaces.toGlobal(patchFacei),
0
);
}
......@@ -230,7 +238,11 @@ void Foam::meshStructure::correct
forAll(pp.meshPoints(), patchPointi)
{
patchPoints[patchPointi] = pp.meshPoints()[patchPointi];
patchData[patchPointi] = pointTopoDistanceData(patchPointi, 0);
patchData[patchPointi] = pointTopoDistanceData
(
globalPoints.toGlobal(patchPointi),
0
);
}
......@@ -257,7 +269,13 @@ void Foam::meshStructure::correct
EdgeMap<label> pointsToEdge(pp.nEdges());
forAll(pp.edges(), edgeI)
{
pointsToEdge.insert(pp.edges()[edgeI], edgeI);
const edge& e = pp.edges()[edgeI];
edge globalEdge
(
globalPoints.toGlobal(e[0]),
globalPoints.toGlobal(e[1])
);
pointsToEdge.insert(globalEdge, globalEdges.toGlobal(edgeI));
}
// Look up on faces
......@@ -380,7 +398,34 @@ Foam::meshStructure::meshStructure
const uindirectPrimitivePatch& pp
)
{
correct(mesh, pp);
correct
(
mesh,
pp,
globalIndex(pp.size()),
globalIndex(pp.nEdges()),
globalIndex(pp.nPoints())
);
}
Foam::meshStructure::meshStructure
(
const polyMesh& mesh,
const uindirectPrimitivePatch& pp,
const globalIndex& globalFaces,
const globalIndex& globalEdges,
const globalIndex& globalPoints
)
{
correct
(
mesh,
pp,
globalFaces,
globalEdges,
globalPoints
);
}
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -25,7 +25,11 @@ Class
Foam::meshStructure
Description
Detect extruded mesh structure given a set of patch faces.
Detect extruded mesh structure given a set of faces
(uindirectPrimitivePatch).
All indices to originating set are in terms of global faces,
global edges, global points.
SourceFiles
meshStructure.C
......@@ -46,7 +50,7 @@ namespace Foam
// Forward declaration of classes
class polyMesh;
class globalIndex;
/*---------------------------------------------------------------------------*\
Class meshStructure Declaration
......@@ -95,7 +99,10 @@ class meshStructure
void correct
(
const polyMesh& mesh,
const uindirectPrimitivePatch& pp
const uindirectPrimitivePatch& pp,
const globalIndex& globalFaces,
const globalIndex& globalEdges,
const globalIndex& globalPoints
);
......@@ -106,19 +113,30 @@ public:
// Constructors
//- Construct null
//- Construct from mesh and faces in mesh. Any addressing to
// faces/edges/points on patch are global indices
meshStructure(const polyMesh& mesh, const uindirectPrimitivePatch&);
//- Construct from mesh and faces in mesh and global indexing
meshStructure
(
const polyMesh& mesh,
const uindirectPrimitivePatch&,
const globalIndex& globalFaces,
const globalIndex& globalEdges,
const globalIndex& globalPoints
);
// Member Functions
//- Is mesh structured?
inline bool structured() const;
//- Cell to patch face
//- Cell to (global) patch face
inline const labelList& cellToPatchFaceAddressing() const;
//- Cell to patch face
//- Cell to (global) patch face
inline labelList& cellToPatchFaceAddressing();
//- Cell to layer
......@@ -127,16 +145,16 @@ public:
//- Cell to layer
inline labelList& cellLayer();
//- Face to patch face
//- Face to (global) patch face
inline const labelList& faceToPatchFaceAddressing() const;
//- Face to patch face
//- Face to (global) patch face
inline labelList& faceToPatchFaceAddressing();
//- Face to patch edge
//- Face to (global) patch edge
inline const labelList& faceToPatchEdgeAddressing() const;
//- Face to patch edge
//- Face to (global) patch edge
inline labelList& faceToPatchEdgeAddressing();
//- Face to layer
......@@ -145,10 +163,10 @@ public:
//- Face to layer
inline labelList& faceLayer();
//- Point to patch point
//- Point to (global) patch point
inline const labelList& pointToPatchPointAddressing() const;
//- Point to patch point
//- Point to (global) patch point
inline labelList& pointToPatchPointAddressing();
//- Point to layer
......@@ -156,7 +174,6 @@ public:
//- Point to layer
inline labelList& pointLayer();
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment