ENH: autoHexMesh: parallel consistency

This commit is contained in:
mattijs
2014-09-24 17:37:29 +01:00
committed by Andrew Heather
parent f5adbc85cf
commit a5e73019e9
10 changed files with 266 additions and 190 deletions

View File

@ -2,7 +2,7 @@ autoHexMesh = autoHexMesh
autoHexMeshDriver = $(autoHexMesh)/autoHexMeshDriver
$(autoHexMeshDriver)/autoLayerDriver.C
$(autoHexMeshDriver)/autoLayerDriverShrink.C
/* $(autoHexMeshDriver)/autoLayerDriverShrink.C */
$(autoHexMeshDriver)/autoSnapDriver.C
$(autoHexMeshDriver)/autoSnapDriverFeature.C
$(autoHexMeshDriver)/autoRefineDriver.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,7 +29,6 @@ Description
SourceFiles
autoLayerDriver.C
autoLayerDriverShrink.C
\*---------------------------------------------------------------------------*/

View File

@ -1292,7 +1292,15 @@ void Foam::autoSnapDriver::detectNearSurfaces
}
const PackedBoolList isMasterPoint(syncTools::getMasterPoints(mesh));
const PackedBoolList isPatchMasterPoint
(
meshRefinement::getMasterPoints
(
mesh,
meshPoints
)
);
label nOverride = 0;
// 1. All points to non-interface surfaces
@ -1405,7 +1413,7 @@ void Foam::autoSnapDriver::detectNearSurfaces
}
}
if (override && isMasterPoint[meshPoints[pointI]])
if (override && isPatchMasterPoint[pointI])
{
nOverride++;
}
@ -1543,7 +1551,7 @@ void Foam::autoSnapDriver::detectNearSurfaces
}
}
if (override && isMasterPoint[meshPoints[pointI]])
if (override && isPatchMasterPoint[pointI])
{
nOverride++;
}
@ -1758,16 +1766,19 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
}
{
const PackedBoolList isPatchMasterPoint
(
meshRefinement::getMasterPoints
(
mesh,
pp.meshPoints()
)
);
scalarField magDisp(mag(patchDisp));
Info<< "Wanted displacement : average:"
<< meshRefinement::gAverage
(
mesh,
syncTools::getMasterPoints(mesh),
pp.meshPoints(),
magDisp
)
<< meshRefinement::gAverage(isPatchMasterPoint, magDisp)
<< " min:" << gMin(magDisp)
<< " max:" << gMax(magDisp) << endl;
}

View File

@ -126,7 +126,7 @@ bool Foam::autoSnapDriver::isFeaturePoint
void Foam::autoSnapDriver::smoothAndConstrain
(
const PackedBoolList& isMasterEdge,
const PackedBoolList& isPatchMasterEdge,
const indirectPrimitivePatch& pp,
const labelList& meshEdges,
const List<pointConstraint>& constraints,
@ -168,7 +168,7 @@ void Foam::autoSnapDriver::smoothAndConstrain
{
label edgeI = pEdges[i];
if (isMasterEdge[meshEdges[edgeI]])
if (isPatchMasterEdge[edgeI])
{
label nbrPointI = edges[edgeI].otherVertex(pointI);
if (constraints[nbrPointI].first() >= nConstraints)
@ -3231,20 +3231,24 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
patchConstraints
);
const PackedBoolList isMasterPoint(syncTools::getMasterPoints(mesh));
//const PackedBoolList isMasterPoint(syncTools::getMasterPoints(mesh));
const PackedBoolList isPatchMasterPoint
(
meshRefinement::getMasterPoints
(
mesh,
pp.meshPoints()
)
);
{
vector avgPatchDisp = meshRefinement::gAverage
(
mesh,
isMasterPoint,
pp.meshPoints(),
isPatchMasterPoint,
patchDisp
);
vector avgPatchAttr = meshRefinement::gAverage
(
mesh,
isMasterPoint,
pp.meshPoints(),
isPatchMasterPoint,
patchAttraction
);
@ -3280,8 +3284,6 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
// Count
{
const labelList& meshPoints = pp.meshPoints();
label nMasterPoints = 0;
label nPlanar = 0;
label nEdge = 0;
@ -3289,7 +3291,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
forAll(patchConstraints, pointI)
{
if (isMasterPoint[meshPoints[pointI]])
if (isPatchMasterPoint[pointI])
{
nMasterPoints++;
@ -3337,7 +3339,19 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
if (featureAttract < 1-0.001)
{
const PackedBoolList isMasterEdge(syncTools::getMasterEdges(mesh));
//const PackedBoolList isMasterEdge(syncTools::getMasterEdges(mesh));
const labelList meshEdges
(
pp.meshEdges(mesh.edges(), mesh.pointEdges())
);
const PackedBoolList isPatchMasterEdge
(
meshRefinement::getMasterEdges
(
mesh,
meshEdges
)
);
const vectorField pointNormals
(
@ -3347,17 +3361,13 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
pp
)
);
const labelList meshEdges
(
pp.meshEdges(mesh.edges(), mesh.pointEdges())
);
// 1. Smoothed all displacement
vectorField smoothedPatchDisp = patchDisp;
smoothAndConstrain
(
isMasterEdge,
isPatchMasterEdge,
pp,
meshEdges,
patchConstraints,
@ -3370,7 +3380,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
tangPatchDisp -= (pointNormals & patchDisp) * pointNormals;
smoothAndConstrain
(
isMasterEdge,
isPatchMasterEdge,
pp,
meshEdges,
patchConstraints,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -49,7 +49,6 @@ Foam::externalDisplacementMeshMover::externalDisplacementMeshMover
{}
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::externalDisplacementMeshMover>

View File

@ -129,9 +129,8 @@ Foam::medialAxisMeshMover::getPatch
void Foam::medialAxisMeshMover::smoothPatchNormals
(
const label nSmoothDisp,
const PackedBoolList& isMasterPoint,
const PackedBoolList& isMasterEdge,
const labelList& meshEdges,
const PackedBoolList& isPatchMasterPoint,
const PackedBoolList& isPatchMasterEdge,
pointField& normals
) const
{
@ -142,13 +141,12 @@ void Foam::medialAxisMeshMover::smoothPatchNormals
// Get smoothly varying internal normals field.
Info<< typeName << " : Smoothing normals ..." << endl;
scalarField edgeWeights(meshEdges.size());
scalarField edgeWeights(edges.size());
scalarField invSumWeight(meshPoints.size());
meshRefinement::calculateEdgeWeights
(
mesh(),
isMasterEdge,
meshEdges,
isPatchMasterEdge,
meshPoints,
edges,
edgeWeights,
@ -162,8 +160,7 @@ void Foam::medialAxisMeshMover::smoothPatchNormals
meshRefinement::weightedSum
(
mesh(),
isMasterEdge,
meshEdges,
isPatchMasterEdge,
meshPoints,
edges,
edgeWeights,
@ -177,9 +174,7 @@ void Foam::medialAxisMeshMover::smoothPatchNormals
{
scalar resid = meshRefinement::gAverage
(
mesh(),
isMasterPoint,
meshPoints,
isPatchMasterPoint,
mag(normals-average)()
);
Info<< " Iteration " << iter << " residual " << resid << endl;
@ -201,8 +196,8 @@ void Foam::medialAxisMeshMover::smoothPatchNormals
void Foam::medialAxisMeshMover::smoothNormals
(
const label nSmoothDisp,
const PackedBoolList& isMasterPoint,
const PackedBoolList& isMasterEdge,
const PackedBoolList& isMeshMasterPoint,
const PackedBoolList& isMeshMasterEdge,
const labelList& fixedPoints,
pointVectorField& normals
) const
@ -229,18 +224,16 @@ void Foam::medialAxisMeshMover::smoothNormals
// Correspondence between local edges/points and mesh edges/points
const labelList meshEdges(identity(mesh().nEdges()));
const labelList meshPoints(identity(mesh().nPoints()));
// Calculate inverse sum of weights
scalarField edgeWeights(meshEdges.size());
scalarField edgeWeights(mesh().nEdges());
scalarField invSumWeight(meshPoints.size());
meshRefinement::calculateEdgeWeights
(
mesh(),
isMasterEdge,
meshEdges,
isMeshMasterEdge,
meshPoints,
edges,
edgeWeights,
@ -253,8 +246,7 @@ void Foam::medialAxisMeshMover::smoothNormals
meshRefinement::weightedSum
(
mesh(),
isMasterEdge,
meshEdges,
isMeshMasterEdge,
meshPoints,
edges,
edgeWeights,
@ -268,8 +260,7 @@ void Foam::medialAxisMeshMover::smoothNormals
{
scalar resid = meshRefinement::gAverage
(
mesh(),
isMasterPoint,
isMeshMasterPoint,
mag(normals-average)()
);
Info<< " Iteration " << iter << " residual " << resid << endl;
@ -411,9 +402,9 @@ void Foam::medialAxisMeshMover::update(const dictionary& coeffDict)
// Predetermine mesh edges
// ~~~~~~~~~~~~~~~~~~~~~~~
// Precalulate master point/edge (only relevant for shared points/edges)
const PackedBoolList isMasterPoint(syncTools::getMasterPoints(mesh()));
const PackedBoolList isMasterEdge(syncTools::getMasterEdges(mesh()));
// Precalulate (mesh) master point/edge (only relevant for shared pts/edges)
const PackedBoolList isMeshMasterPoint(syncTools::getMasterPoints(mesh()));
const PackedBoolList isMeshMasterEdge(syncTools::getMasterEdges(mesh()));
// Precalculate meshEdge per pp edge
const labelList meshEdges
(
@ -424,6 +415,23 @@ void Foam::medialAxisMeshMover::update(const dictionary& coeffDict)
)
);
// Precalulate (patch) master point/edge
const PackedBoolList isPatchMasterPoint
(
meshRefinement::getMasterPoints
(
mesh(),
meshPoints
)
);
const PackedBoolList isPatchMasterEdge
(
meshRefinement::getMasterEdges
(
mesh(),
meshEdges
)
);
// Determine pointNormal
// ~~~~~~~~~~~~~~~~~~~~~
@ -434,9 +442,8 @@ void Foam::medialAxisMeshMover::update(const dictionary& coeffDict)
smoothPatchNormals
(
nSmoothSurfaceNormals,
isMasterPoint,
isMasterEdge,
meshEdges,
isPatchMasterPoint,
isPatchMasterEdge,
pointNormals
);
@ -795,8 +802,8 @@ void Foam::medialAxisMeshMover::update(const dictionary& coeffDict)
smoothNormals
(
nSmoothNormals,
isMasterPoint,
isMasterEdge,
isMeshMasterPoint,
isMeshMasterEdge,
meshPoints,
dispVec_
);
@ -999,9 +1006,8 @@ void Foam::medialAxisMeshMover::syncPatchDisplacement
void Foam::medialAxisMeshMover::minSmoothField
(
const label nSmoothDisp,
const PackedBoolList& isMasterPoint,
const PackedBoolList& isMasterEdge,
const labelList& meshEdges,
const PackedBoolList& isPatchMasterPoint,
const PackedBoolList& isPatchMasterEdge,
const scalarField& fieldMin,
scalarField& field
) const
@ -1010,13 +1016,12 @@ void Foam::medialAxisMeshMover::minSmoothField
const edgeList& edges = pp.edges();
const labelList& meshPoints = pp.meshPoints();
scalarField edgeWeights(meshEdges.size());
scalarField edgeWeights(edges.size());
scalarField invSumWeight(meshPoints.size());
meshRefinement::calculateEdgeWeights
(
mesh(),
isMasterEdge,
meshEdges,
isPatchMasterEdge,
meshPoints,
edges,
edgeWeights,
@ -1032,8 +1037,7 @@ void Foam::medialAxisMeshMover::minSmoothField
meshRefinement::weightedSum
(
mesh(),
isMasterEdge,
meshEdges,
isPatchMasterEdge,
meshPoints,
edges,
edgeWeights,
@ -1064,9 +1068,7 @@ void Foam::medialAxisMeshMover::minSmoothField
{
scalar resid = meshRefinement::gAverage
(
mesh(),
isMasterPoint,
meshPoints,
isPatchMasterPoint,
mag(field-average)()
);
Info<< " Iteration " << iter << " residual " << resid << endl;
@ -1080,7 +1082,7 @@ void Foam::medialAxisMeshMover::
handleFeatureAngleLayerTerminations
(
const scalar minCos,
const PackedBoolList& isMasterPoint,
const PackedBoolList& isPatchMasterPoint,
const labelList& meshEdges,
List<autoLayerDriver::extrudeMode>& extrudeStatus,
pointField& patchDisp,
@ -1122,7 +1124,6 @@ handleFeatureAngleLayerTerminations
const labelListList& edgeFaces = pp.edgeFaces();
const vectorField& faceNormals = pp.faceNormals();
const labelList& meshPoints = pp.meshPoints();
forAll(edgeFaces, edgeI)
{
@ -1183,14 +1184,14 @@ handleFeatureAngleLayerTerminations
{
if (unmarkExtrusion(v0, patchDisp, extrudeStatus))
{
if (isMasterPoint[meshPoints[v0]])
if (isPatchMasterPoint[v0])
{
nPointCounter++;
}
}
if (unmarkExtrusion(v1, patchDisp, extrudeStatus))
{
if (isMasterPoint[meshPoints[v1]])
if (isPatchMasterPoint[v1])
{
nPointCounter++;
}
@ -1213,8 +1214,8 @@ void Foam::medialAxisMeshMover::findIsolatedRegions
(
const scalar minCosLayerTermination,
const bool detectExtrusionIsland,
const PackedBoolList& isMasterPoint,
const PackedBoolList& isMasterEdge,
const PackedBoolList& isPatchMasterPoint,
const PackedBoolList& isPatchMasterEdge,
const labelList& meshEdges,
const scalarField& minThickness,
List<autoLayerDriver::extrudeMode>& extrudeStatus,
@ -1223,13 +1224,32 @@ void Foam::medialAxisMeshMover::findIsolatedRegions
{
const indirectPrimitivePatch& pp = adaptPatchPtr_();
const labelListList& pointFaces = pp.pointFaces();
const labelList& meshPoints = pp.meshPoints();
Info<< typeName << " : Removing isolated regions ..." << endl;
// Keep count of number of points unextruded
label nPointCounter = 0;
autoPtr<OBJstream> str;
if (debug)
{
str.reset
(
new OBJstream
(
mesh().time().path()
/ "islandExcludePoints_"
+ mesh().time().timeName()
+ ".obj"
)
);
Info<< typeName
<< " : Writing points surrounded by non-extruded points to "
<< str().name() << endl;
}
while (true)
{
// Stop layer growth where mesh wraps around edge with a
@ -1237,7 +1257,7 @@ void Foam::medialAxisMeshMover::findIsolatedRegions
handleFeatureAngleLayerTerminations
(
minCosLayerTermination,
isMasterPoint,
isPatchMasterPoint,
meshEdges,
extrudeStatus,
@ -1353,7 +1373,7 @@ void Foam::medialAxisMeshMover::findIsolatedRegions
syncTools::syncPointList
(
mesh(),
pp.meshPoints(),
meshPoints,
keptPoints,
orEqOp<bool>(),
false // null value
@ -1369,6 +1389,11 @@ void Foam::medialAxisMeshMover::findIsolatedRegions
{
nPointCounter++;
nChanged++;
if (str.valid())
{
str().write(pp.points()[meshPoints[patchPointI]]);
}
}
}
}
@ -1390,7 +1415,7 @@ void Foam::medialAxisMeshMover::findIsolatedRegions
forAll(edges, edgeI)
{
if (isMasterEdge.get(meshEdges[edgeI]) == 1)
if (isPatchMasterEdge[edgeI])
{
const edge& e = edges[edgeI];
@ -1411,7 +1436,7 @@ void Foam::medialAxisMeshMover::findIsolatedRegions
syncTools::syncPointList
(
mesh(),
pp.meshPoints(),
meshPoints,
isolatedPoint,
plusEqOp<label>(),
label(0) // null value
@ -1458,6 +1483,11 @@ void Foam::medialAxisMeshMover::findIsolatedRegions
)
{
nPointCounter++;
if (str.valid())
{
str().write(pp.points()[meshPoints[f[fp]]]);
}
}
}
}
@ -1474,25 +1504,23 @@ void Foam::medialAxisMeshMover::findIsolatedRegions
void Foam::medialAxisMeshMover::smoothLambdaMuDisplacement
(
const label nSmoothDisp,
const PackedBoolList& isMasterPoint,
const PackedBoolList& isMasterEdge,
const PackedBoolList& isMeshMasterPoint,
const PackedBoolList& isMeshMasterEdge,
vectorField& displacement
) const
{
const edgeList& edges = mesh().edges();
// Correspondence between local edges/points and mesh edges/points
const labelList meshEdges(identity(mesh().nEdges()));
const labelList meshPoints(identity(mesh().nPoints()));
// Calculate inverse sum of weights
scalarField edgeWeights(meshEdges.size());
scalarField edgeWeights(mesh().nEdges());
scalarField invSumWeight(meshPoints.size());
meshRefinement::calculateEdgeWeights
(
mesh(),
isMasterEdge,
meshEdges,
isMeshMasterEdge,
meshPoints,
edges,
edgeWeights,
@ -1512,8 +1540,7 @@ void Foam::medialAxisMeshMover::smoothLambdaMuDisplacement
meshRefinement::weightedSum
(
mesh(),
isMasterEdge,
meshEdges,
isMeshMasterEdge,
meshPoints,
edges,
edgeWeights,
@ -1533,8 +1560,7 @@ void Foam::medialAxisMeshMover::smoothLambdaMuDisplacement
meshRefinement::weightedSum
(
mesh(),
isMasterEdge,
meshEdges,
isMeshMasterEdge,
meshPoints,
edges,
edgeWeights,
@ -1558,8 +1584,7 @@ void Foam::medialAxisMeshMover::smoothLambdaMuDisplacement
{
scalar resid = meshRefinement::gAverage
(
mesh(),
isMasterPoint,
isMeshMasterPoint,
mag(displacement-average)()
);
Info<< " Iteration " << iter << " residual " << resid << endl;
@ -1735,8 +1760,8 @@ void Foam::medialAxisMeshMover::calculateDisplacement
// Precalulate master points/edge (only relevant for shared points/edges)
const PackedBoolList isMasterPoint(syncTools::getMasterPoints(mesh()));
const PackedBoolList isMasterEdge(syncTools::getMasterEdges(mesh()));
const PackedBoolList isMeshMasterPoint(syncTools::getMasterPoints(mesh()));
const PackedBoolList isMeshMasterEdge(syncTools::getMasterEdges(mesh()));
// Precalculate meshEdge per pp edge
const labelList meshEdges
(
@ -1747,6 +1772,24 @@ void Foam::medialAxisMeshMover::calculateDisplacement
)
);
// Precalulate (patch) master point/edge
const PackedBoolList isPatchMasterPoint
(
meshRefinement::getMasterPoints
(
mesh(),
meshPoints
)
);
const PackedBoolList isPatchMasterEdge
(
meshRefinement::getMasterEdges
(
mesh(),
meshEdges
)
);
scalarField thickness(patchDisp.size());
@ -1846,7 +1889,7 @@ void Foam::medialAxisMeshMover::calculateDisplacement
patchDisp[patchPointI] = thickness[patchPointI]*n;
if (isMasterPoint[pointI])
if (isPatchMasterPoint[patchPointI])
{
numThicknessRatioExclude++;
}
@ -1885,8 +1928,8 @@ void Foam::medialAxisMeshMover::calculateDisplacement
minCosLayerTermination,
detectExtrusionIsland,
isMasterPoint,
isMasterEdge,
isPatchMasterPoint,
isPatchMasterEdge,
meshEdges,
minThickness,
@ -1908,9 +1951,8 @@ void Foam::medialAxisMeshMover::calculateDisplacement
minSmoothField
(
nSmoothPatchThickness,
isMasterPoint,
isMasterEdge,
meshEdges,
isPatchMasterPoint,
isPatchMasterEdge,
minThickness,
thickness
@ -1991,8 +2033,8 @@ void Foam::medialAxisMeshMover::calculateDisplacement
smoothLambdaMuDisplacement
(
nSmoothDisplacement,
isMasterPoint,
isMasterEdge,
isMeshMasterPoint,
isMeshMasterEdge,
displacement
);
}

View File

@ -117,7 +117,6 @@ class medialAxisMeshMover
const label nSmoothDisp,
const PackedBoolList& isMasterPoint,
const PackedBoolList& isMasterEdge,
const labelList& meshEdges,
pointField& normals
) const;
@ -175,7 +174,6 @@ class medialAxisMeshMover
const label nSmoothDisp,
const PackedBoolList& isMasterPoint,
const PackedBoolList& isMasterEdge,
const labelList& meshEdges,
const scalarField& fieldMin,
scalarField& field
) const;

View File

@ -1954,7 +1954,6 @@ void Foam::meshRefinement::calculateEdgeWeights
(
const polyMesh& mesh,
const PackedBoolList& isMasterEdge,
const labelList& meshEdges,
const labelList& meshPoints,
const edgeList& edges,
scalarField& edgeWeights,
@ -1964,7 +1963,7 @@ void Foam::meshRefinement::calculateEdgeWeights
const pointField& pts = mesh.points();
// Calculate edgeWeights and inverse sum of edge weights
edgeWeights.setSize(meshEdges.size());
edgeWeights.setSize(isMasterEdge.size());
invSumWeight.setSize(meshPoints.size());
forAll(edges, edgeI)
@ -1987,7 +1986,6 @@ void Foam::meshRefinement::calculateEdgeWeights
(
mesh,
isMasterEdge,
meshEdges,
meshPoints,
edges,
edgeWeights,
@ -2639,8 +2637,82 @@ bool Foam::meshRefinement::write() const
}
Foam::PackedBoolList Foam::meshRefinement::getMasterPoints
(
const polyMesh& mesh,
const labelList& meshPoints
)
{
const globalIndex globalPoints(meshPoints.size());
labelList myPoints(meshPoints.size());
forAll(meshPoints, pointI)
{
myPoints[pointI] = globalPoints.toGlobal(pointI);
}
syncTools::syncPointList
(
mesh,
meshPoints,
myPoints,
minEqOp<label>(),
labelMax
);
PackedBoolList isPatchMasterPoint(meshPoints.size());
forAll(meshPoints, pointI)
{
if (myPoints[pointI] == globalPoints.toGlobal(pointI))
{
isPatchMasterPoint[pointI] = true;
}
}
return isPatchMasterPoint;
}
Foam::PackedBoolList Foam::meshRefinement::getMasterEdges
(
const polyMesh& mesh,
const labelList& meshEdges
)
{
const globalIndex globalEdges(meshEdges.size());
labelList myEdges(meshEdges.size());
forAll(meshEdges, edgeI)
{
myEdges[edgeI] = globalEdges.toGlobal(edgeI);
}
syncTools::syncEdgeList
(
mesh,
meshEdges,
myEdges,
minEqOp<label>(),
labelMax
);
PackedBoolList isMasterEdge(meshEdges.size());
forAll(meshEdges, edgeI)
{
if (myEdges[edgeI] == globalEdges.toGlobal(edgeI))
{
isMasterEdge[edgeI] = true;
}
}
return isMasterEdge;
}
void Foam::meshRefinement::printMeshInfo(const bool debug, const string& msg)
const
const
{
const globalMeshData& pData = mesh_.globalData();
@ -2664,11 +2736,11 @@ void Foam::meshRefinement::printMeshInfo(const bool debug, const string& msg)
}
}
PackedBoolList isMasterPoint(syncTools::getMasterPoints(mesh_));
PackedBoolList isMeshMasterPoint(syncTools::getMasterPoints(mesh_));
label nMasterPoints = 0;
forAll(isMasterPoint, i)
forAll(isMeshMasterPoint, i)
{
if (isMasterPoint[i])
if (isMeshMasterPoint[i])
{
nMasterPoints++;
}

View File

@ -733,7 +733,6 @@ public:
(
const polyMesh& mesh,
const PackedBoolList& isMasterEdge,
const labelList& meshEdges,
const labelList& meshPoints,
const edgeList& edges,
scalarField& edgeWeights,
@ -747,7 +746,6 @@ public:
(
const polyMesh& mesh,
const PackedBoolList& isMasterEdge,
const labelList& meshEdges,
const labelList& meshPoints,
const edgeList& edges,
const scalarField& edgeWeights,
@ -1069,6 +1067,22 @@ public:
const UList<T>& data
);
//- Determine master point for subset of points. If coupled
// chooses only one
static PackedBoolList getMasterPoints
(
const polyMesh& mesh,
const labelList& meshPoints
);
//- Determine master edge for subset of edges. If coupled
// chooses only one
static PackedBoolList getMasterEdges
(
const polyMesh& mesh,
const labelList& meshEdges
);
//- Print some mesh stats.
void printMeshInfo(const bool, const string&) const;
@ -1100,22 +1114,10 @@ public:
template<class T>
static T gAverage
(
const polyMesh& mesh,
const PackedBoolList& isMasterElem,
const UList<T>& values
);
//- Helper: calculate average over selected elements
template<class T>
static T gAverage
(
const polyMesh& mesh,
const PackedBoolList& isMasterElem,
const labelList& meshPoints,
const UList<T>& values
);
//- Get/set write level
static writeType writeLevel();
static void writeLevel(const writeType);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -57,7 +57,6 @@ template<class T> void Foam::meshRefinement::updateList
template<class T>
T Foam::meshRefinement::gAverage
(
const polyMesh& mesh,
const PackedBoolList& isMasterElem,
const UList<T>& values
)
@ -68,7 +67,6 @@ T Foam::meshRefinement::gAverage
(
"meshRefinement::gAverage\n"
"(\n"
" const polyMesh&,\n"
" const PackedBoolList& isMasterElem,\n"
" const UList<T>& values\n"
")\n"
@ -104,58 +102,6 @@ T Foam::meshRefinement::gAverage
}
template<class T>
T Foam::meshRefinement::gAverage
(
const polyMesh& mesh,
const PackedBoolList& isMasterElem,
const labelList& meshElems,
const UList<T>& values
)
{
if (values.size() != meshElems.size())
{
FatalErrorIn
(
"meshRefinement::gAverage\n"
"(\n"
" const polyMesh&,\n"
" const labelList&,\n"
" const PackedBoolList& isMasterElem,\n"
" const UList<T>& values\n"
")\n"
) << "Number of elements in list " << values.size()
<< " does not correspond to number of elements in meshElems "
<< meshElems.size()
<< exit(FatalError);
}
T sum = pTraits<T>::zero;
label n = 0;
forAll(values, i)
{
if (isMasterElem[meshElems[i]])
{
sum += values[i];
n++;
}
}
reduce(sum, sumOp<T>());
reduce(n, sumOp<label>());
if (n > 0)
{
return sum/n;
}
else
{
return pTraits<T>::max;
}
}
// Compare two lists over all boundary faces
template<class T>
void Foam::meshRefinement::testSyncBoundaryFaceList
@ -343,7 +289,6 @@ void Foam::meshRefinement::weightedSum
(
const polyMesh& mesh,
const PackedBoolList& isMasterEdge,
const labelList& meshEdges,
const labelList& meshPoints,
const edgeList& edges,
const scalarField& edgeWeights,
@ -353,15 +298,13 @@ void Foam::meshRefinement::weightedSum
{
if
(
mesh.nEdges() != isMasterEdge.size()
|| edges.size() != meshEdges.size()
edges.size() != isMasterEdge.size()
|| edges.size() != edgeWeights.size()
|| meshPoints.size() != pointData.size()
)
{
FatalErrorIn("medialAxisMeshMover::weightedSum(..)")
<< "Inconsistent sizes for edge or point data:"
<< " meshEdges:" << meshEdges.size()
<< " isMasterEdge:" << isMasterEdge.size()
<< " edgeWeights:" << edgeWeights.size()
<< " edges:" << edges.size()
@ -375,7 +318,7 @@ void Foam::meshRefinement::weightedSum
forAll(edges, edgeI)
{
if (isMasterEdge.get(meshEdges[edgeI]) == 1)
if (isMasterEdge[edgeI])
{
const edge& e = edges[edgeI];