mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge remote branch 'OpenCFD/master' into olesenm
This commit is contained in:
@ -43,75 +43,6 @@ defineTypeNameAndDebug(Foam::addPatchCellLayer, 0);
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Calculate global faces per pp edge.
|
||||
Foam::labelListList Foam::addPatchCellLayer::calcGlobalEdgeFaces
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const globalIndex& globalFaces,
|
||||
const indirectPrimitivePatch& pp,
|
||||
const labelList& meshEdges
|
||||
)
|
||||
{
|
||||
//// Determine coupled edges just so we don't have to have storage
|
||||
//// for all non-coupled edges.
|
||||
//
|
||||
//PackedBoolList isCoupledEdge(mesh.nEdges());
|
||||
//
|
||||
//const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
//
|
||||
//forAll(patches, patchI)
|
||||
//{
|
||||
// const polyPatch& pp = patches[patchI];
|
||||
//
|
||||
// if (pp.coupled())
|
||||
// {
|
||||
// const labelList& meshEdges = pp.meshEdges();
|
||||
//
|
||||
// forAll(meshEdges, i)
|
||||
// {
|
||||
// isCoupledEdge.set(meshEdges[i], 1);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
// From mesh edge to global face labels. Sized only for pp edges.
|
||||
labelListList globalEdgeFaces(mesh.nEdges());
|
||||
|
||||
const labelListList& edgeFaces = pp.edgeFaces();
|
||||
|
||||
forAll(edgeFaces, edgeI)
|
||||
{
|
||||
label meshEdgeI = meshEdges[edgeI];
|
||||
|
||||
//if (isCoupledEdge.get(meshEdgeI) == 1)
|
||||
{
|
||||
const labelList& eFaces = edgeFaces[edgeI];
|
||||
|
||||
// Store face and processor as unique tag.
|
||||
labelList& globalEFaces = globalEdgeFaces[meshEdgeI];
|
||||
globalEFaces.setSize(eFaces.size());
|
||||
forAll(eFaces, i)
|
||||
{
|
||||
globalEFaces[i] =
|
||||
globalFaces.toGlobal(pp.addressing()[eFaces[i]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronise across coupled edges.
|
||||
syncTools::syncEdgeList
|
||||
(
|
||||
mesh,
|
||||
globalEdgeFaces,
|
||||
uniqueEqOp(),
|
||||
labelList() // null value
|
||||
);
|
||||
|
||||
// Extract pp part
|
||||
return labelListList(UIndirectList<labelList>(globalEdgeFaces, meshEdges));
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::addPatchCellLayer::nbrFace
|
||||
(
|
||||
const labelListList& edgeFaces,
|
||||
@ -316,12 +247,12 @@ Foam::labelPair Foam::addPatchCellLayer::getEdgeString
|
||||
Foam::label Foam::addPatchCellLayer::addSideFace
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const labelList& patchID, // prestored patch per pp face
|
||||
const labelListList& addedCells, // per pp face the new extruded cell
|
||||
const face& newFace,
|
||||
const label newPatchID,
|
||||
|
||||
const label ownFaceI, // pp face that provides owner
|
||||
const label nbrFaceI,
|
||||
const label patchEdgeI, // edge to add to
|
||||
const label meshEdgeI, // corresponding mesh edge
|
||||
const label layerI, // layer
|
||||
const label numEdgeFaces, // number of layers for edge
|
||||
@ -329,8 +260,9 @@ Foam::label Foam::addPatchCellLayer::addSideFace
|
||||
polyTopoChange& meshMod
|
||||
) const
|
||||
{
|
||||
// Edge to 'inflate' from
|
||||
// Face or edge to 'inflate' from
|
||||
label inflateEdgeI = -1;
|
||||
label inflateFaceI = -1;
|
||||
|
||||
// Check mesh faces using edge
|
||||
if (addToMesh_)
|
||||
@ -346,8 +278,6 @@ Foam::label Foam::addPatchCellLayer::addSideFace
|
||||
}
|
||||
}
|
||||
|
||||
// Get my mesh face and its zone.
|
||||
label meshFaceI = pp.addressing()[ownFaceI];
|
||||
// Zone info comes from any side patch face. Otherwise -1 since we
|
||||
// don't know what to put it in - inherit from the extruded faces?
|
||||
label zoneI = -1; //mesh_.faceZones().whichZone(meshFaceI);
|
||||
@ -358,14 +288,15 @@ Foam::label Foam::addPatchCellLayer::addSideFace
|
||||
// Is patch edge external edge of indirectPrimitivePatch?
|
||||
if (nbrFaceI == -1)
|
||||
{
|
||||
// External edge so external face. Patch id is obtained from
|
||||
// any other patch connected to edge.
|
||||
// External edge so external face.
|
||||
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
// Loop over all faces connected to edge to inflate and
|
||||
// see if any boundary face (but not meshFaceI)
|
||||
label otherPatchID = patchID[ownFaceI];
|
||||
// see if we can find a face that is otherPatchID
|
||||
|
||||
// Get my mesh face and its zone.
|
||||
label meshFaceI = pp.addressing()[ownFaceI];
|
||||
|
||||
forAll(meshFaces, k)
|
||||
{
|
||||
@ -373,11 +304,14 @@ Foam::label Foam::addPatchCellLayer::addSideFace
|
||||
|
||||
if
|
||||
(
|
||||
faceI != meshFaceI
|
||||
&& !mesh_.isInternalFace(faceI)
|
||||
(faceI != meshFaceI)
|
||||
&& (patches.whichPatch(faceI) == newPatchID)
|
||||
)
|
||||
{
|
||||
otherPatchID = patches.whichPatch(faceI);
|
||||
// Found the patch face. Use it to inflate from
|
||||
inflateEdgeI = -1;
|
||||
inflateFaceI = faceI;
|
||||
|
||||
zoneI = mesh_.faceZones().whichZone(faceI);
|
||||
if (zoneI != -1)
|
||||
{
|
||||
@ -414,7 +348,7 @@ Foam::label Foam::addPatchCellLayer::addSideFace
|
||||
|
||||
//Pout<< "Added boundary face:" << newFace
|
||||
// << " own:" << addedCells[ownFaceI][layerOwn]
|
||||
// << " patch:" << otherPatchID
|
||||
// << " patch:" << newPatchID
|
||||
// << endl;
|
||||
|
||||
addedFaceI = meshMod.setAction
|
||||
@ -426,9 +360,9 @@ Foam::label Foam::addPatchCellLayer::addSideFace
|
||||
-1, // neighbour
|
||||
-1, // master point
|
||||
inflateEdgeI, // master edge
|
||||
-1, // master face
|
||||
inflateFaceI, // master face
|
||||
false, // flux flip
|
||||
otherPatchID, // patch for face
|
||||
newPatchID, // patch for face
|
||||
zoneI, // zone for face
|
||||
flip // face zone flip
|
||||
)
|
||||
@ -510,6 +444,51 @@ Foam::label Foam::addPatchCellLayer::addSideFace
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::addPatchCellLayer::findProcPatch
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label nbrProcID
|
||||
)
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
forAll(mesh.globalData().processorPatches(), i)
|
||||
{
|
||||
label patchI = mesh.globalData().processorPatches()[i];
|
||||
|
||||
if
|
||||
(
|
||||
refCast<const processorPolyPatch>(patches[patchI]).neighbProcNo()
|
||||
== nbrProcID
|
||||
)
|
||||
{
|
||||
return patchI;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void Foam::addPatchCellLayer::setFaceProps
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label faceI,
|
||||
|
||||
label& patchI,
|
||||
label& zoneI,
|
||||
bool& zoneFlip
|
||||
)
|
||||
{
|
||||
patchI = mesh.boundaryMesh().whichPatch(faceI);
|
||||
zoneI = mesh.faceZones().whichZone(faceI);
|
||||
if (zoneI != -1)
|
||||
{
|
||||
label index = mesh.faceZones()[zoneI].whichFace(faceI);
|
||||
zoneFlip = mesh.faceZones()[zoneI].flipMap()[index];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from mesh
|
||||
@ -561,10 +540,251 @@ Foam::labelListList Foam::addPatchCellLayer::addedCells() const
|
||||
}
|
||||
|
||||
|
||||
// Calculate global faces per pp edge.
|
||||
Foam::labelListList Foam::addPatchCellLayer::globalEdgeFaces
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const globalIndex& globalFaces,
|
||||
const indirectPrimitivePatch& pp
|
||||
)
|
||||
{
|
||||
// Precalculate mesh edges for pp.edges.
|
||||
const labelList meshEdges(pp.meshEdges(mesh.edges(), mesh.pointEdges()));
|
||||
|
||||
// From mesh edge to global face labels. Non-empty sublists only for
|
||||
// pp edges.
|
||||
labelListList globalEdgeFaces(mesh.nEdges());
|
||||
|
||||
const labelListList& edgeFaces = pp.edgeFaces();
|
||||
|
||||
forAll(edgeFaces, edgeI)
|
||||
{
|
||||
label meshEdgeI = meshEdges[edgeI];
|
||||
|
||||
const labelList& eFaces = edgeFaces[edgeI];
|
||||
|
||||
// Store face and processor as unique tag.
|
||||
labelList& globalEFaces = globalEdgeFaces[meshEdgeI];
|
||||
globalEFaces.setSize(eFaces.size());
|
||||
forAll(eFaces, i)
|
||||
{
|
||||
globalEFaces[i] = globalFaces.toGlobal(pp.addressing()[eFaces[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronise across coupled edges.
|
||||
syncTools::syncEdgeList
|
||||
(
|
||||
mesh,
|
||||
globalEdgeFaces,
|
||||
uniqueEqOp(),
|
||||
labelList() // null value
|
||||
);
|
||||
|
||||
// Extract pp part
|
||||
return labelListList(UIndirectList<labelList>(globalEdgeFaces, meshEdges));
|
||||
}
|
||||
|
||||
|
||||
void Foam::addPatchCellLayer::calcSidePatch
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const globalIndex& globalFaces,
|
||||
const labelListList& globalEdgeFaces,
|
||||
const indirectPrimitivePatch& pp,
|
||||
|
||||
labelList& sidePatchID,
|
||||
label& nPatches,
|
||||
Map<label>& nbrProcToPatch,
|
||||
Map<label>& patchToNbrProc
|
||||
)
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
// Precalculate mesh edges for pp.edges.
|
||||
const labelList meshEdges(pp.meshEdges(mesh.edges(), mesh.pointEdges()));
|
||||
|
||||
sidePatchID.setSize(pp.nEdges());
|
||||
sidePatchID = -1;
|
||||
|
||||
// These also get determined but not (yet) exported:
|
||||
// - whether face is created from other face or edge
|
||||
// - what zone&orientation face should have
|
||||
|
||||
labelList inflateEdgeI(pp.nEdges(), -1);
|
||||
labelList inflateFaceI(pp.nEdges(), -1);
|
||||
labelList sideZoneID(pp.nEdges(), -1);
|
||||
boolList sideFlip(pp.nEdges(), false);
|
||||
|
||||
nPatches = patches.size();
|
||||
|
||||
forAll(globalEdgeFaces, edgeI)
|
||||
{
|
||||
const labelList& eGlobalFaces = globalEdgeFaces[edgeI];
|
||||
if
|
||||
(
|
||||
eGlobalFaces.size() == 2
|
||||
&& pp.edgeFaces()[edgeI].size() == 1
|
||||
)
|
||||
{
|
||||
// Locally but not globally a boundary edge. Hence a coupled
|
||||
// edge. Find the patch to use if on different
|
||||
// processors.
|
||||
|
||||
label f0 = eGlobalFaces[0];
|
||||
label f1 = eGlobalFaces[1];
|
||||
|
||||
label otherProcI = -1;
|
||||
if (globalFaces.isLocal(f0) && !globalFaces.isLocal(f1))
|
||||
{
|
||||
otherProcI = globalFaces.whichProcID(f1);
|
||||
}
|
||||
else if (!globalFaces.isLocal(f0) && globalFaces.isLocal(f1))
|
||||
{
|
||||
otherProcI = globalFaces.whichProcID(f0);
|
||||
}
|
||||
|
||||
|
||||
if (otherProcI != -1)
|
||||
{
|
||||
sidePatchID[edgeI] = findProcPatch(mesh, otherProcI);
|
||||
if (sidePatchID[edgeI] == -1)
|
||||
{
|
||||
// Cannot find a patch to processor. See if already
|
||||
// marked for addition
|
||||
if (nbrProcToPatch.found(otherProcI))
|
||||
{
|
||||
sidePatchID[edgeI] = nbrProcToPatch[otherProcI];
|
||||
}
|
||||
else
|
||||
{
|
||||
sidePatchID[edgeI] = nPatches;
|
||||
nbrProcToPatch.insert(otherProcI, nPatches);
|
||||
patchToNbrProc.insert(nPatches, otherProcI);
|
||||
nPatches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Determine face properties for all other boundary edges
|
||||
// ------------------------------------------------------
|
||||
|
||||
const labelListList& edgeFaces = pp.edgeFaces();
|
||||
forAll(edgeFaces, edgeI)
|
||||
{
|
||||
if (edgeFaces[edgeI].size() == 1 && sidePatchID[edgeI] == -1)
|
||||
{
|
||||
// Proper, uncoupled patch edge.
|
||||
|
||||
label myFaceI = pp.addressing()[edgeFaces[edgeI][0]];
|
||||
|
||||
// Pick up any boundary face on this edge and use its properties
|
||||
label meshEdgeI = meshEdges[edgeI];
|
||||
const labelList& meshFaces = mesh.edgeFaces()[meshEdgeI];
|
||||
|
||||
forAll(meshFaces, k)
|
||||
{
|
||||
label faceI = meshFaces[k];
|
||||
|
||||
if (faceI != myFaceI && !mesh.isInternalFace(faceI))
|
||||
{
|
||||
setFaceProps
|
||||
(
|
||||
mesh,
|
||||
faceI,
|
||||
|
||||
sidePatchID[edgeI],
|
||||
sideZoneID[edgeI],
|
||||
sideFlip[edgeI]
|
||||
);
|
||||
inflateFaceI[edgeI] = faceI;
|
||||
inflateEdgeI[edgeI] = -1;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Now hopefully every boundary edge has a side patch. Check
|
||||
forAll(edgeFaces, edgeI)
|
||||
{
|
||||
if (edgeFaces[edgeI].size() == 1 && sidePatchID[edgeI] == -1)
|
||||
{
|
||||
const edge& e = pp.edges()[edgeI];
|
||||
FatalErrorIn("addPatchCellLayer::calcSidePatch(..)")
|
||||
<< "Have no sidePatchID for edge " << edgeI << " points "
|
||||
<< pp.points()[pp.meshPoints()[e[0]]]
|
||||
<< pp.points()[pp.meshPoints()[e[1]]]
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Now we have sidepatch see if we have patchface or edge to inflate
|
||||
// from.
|
||||
forAll(edgeFaces, edgeI)
|
||||
{
|
||||
if (edgeFaces[edgeI].size() == 1 && inflateFaceI[edgeI] == -1)
|
||||
{
|
||||
// 1. Do we have a boundary face to inflate from
|
||||
|
||||
label myFaceI = pp.addressing()[edgeFaces[edgeI][0]];
|
||||
|
||||
// Pick up any boundary face on this edge and use its properties
|
||||
label meshEdgeI = meshEdges[edgeI];
|
||||
const labelList& meshFaces = mesh.edgeFaces()[meshEdgeI];
|
||||
|
||||
forAll(meshFaces, k)
|
||||
{
|
||||
label faceI = meshFaces[k];
|
||||
|
||||
if (faceI != myFaceI)
|
||||
{
|
||||
if (mesh.isInternalFace(faceI))
|
||||
{
|
||||
inflateEdgeI[edgeI] = meshEdgeI;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (patches.whichPatch(faceI) == sidePatchID[edgeI])
|
||||
{
|
||||
setFaceProps
|
||||
(
|
||||
mesh,
|
||||
faceI,
|
||||
|
||||
sidePatchID[edgeI],
|
||||
sideZoneID[edgeI],
|
||||
sideFlip[edgeI]
|
||||
);
|
||||
inflateFaceI[edgeI] = faceI;
|
||||
inflateEdgeI[edgeI] = -1;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::addPatchCellLayer::setRefinement
|
||||
(
|
||||
const globalIndex& globalFaces,
|
||||
const labelListList& globalEdgeFaces,
|
||||
const scalarField& expansionRatio,
|
||||
const indirectPrimitivePatch& pp,
|
||||
const labelList& sidePatchID,
|
||||
const labelList& exposedPatchID,
|
||||
const labelList& nFaceLayers,
|
||||
const labelList& nPointLayers,
|
||||
@ -575,7 +795,7 @@ void Foam::addPatchCellLayer::setRefinement
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "addPatchCellLayer::setRefinement : Adding up to "
|
||||
<< max(nPointLayers)
|
||||
<< gMax(nPointLayers)
|
||||
<< " layers of cells to indirectPrimitivePatch with "
|
||||
<< pp.nPoints() << " points" << endl;
|
||||
}
|
||||
@ -788,8 +1008,6 @@ void Foam::addPatchCellLayer::setRefinement
|
||||
|
||||
label meshEdgeI = meshEdges[edgeI];
|
||||
|
||||
// Mesh faces using edge
|
||||
|
||||
// Mesh faces using edge
|
||||
const labelList& meshFaces = mesh_.edgeFaces(meshEdgeI, ef);
|
||||
|
||||
@ -1213,22 +1431,6 @@ void Foam::addPatchCellLayer::setRefinement
|
||||
}
|
||||
|
||||
|
||||
// Global indices engine
|
||||
const globalIndex globalFaces(mesh_.nFaces());
|
||||
|
||||
// Get for all pp edgeFaces a unique faceID
|
||||
labelListList globalEdgeFaces
|
||||
(
|
||||
calcGlobalEdgeFaces
|
||||
(
|
||||
mesh_,
|
||||
globalFaces,
|
||||
pp,
|
||||
meshEdges
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// Mark off which edges have been extruded
|
||||
boolList doneEdge(pp.nEdges(), false);
|
||||
|
||||
@ -1474,16 +1676,17 @@ void Foam::addPatchCellLayer::setRefinement
|
||||
addSideFace
|
||||
(
|
||||
pp,
|
||||
patchID,
|
||||
addedCells,
|
||||
newFace,
|
||||
|
||||
newFace, // vertices of new face
|
||||
sidePatchID[startEdgeI],// -1 or patch for face
|
||||
|
||||
patchFaceI,
|
||||
nbrFaceI,
|
||||
startEdgeI, // edge to inflate from
|
||||
meshEdgeI, // corresponding mesh edge
|
||||
i,
|
||||
numEdgeSideFaces,
|
||||
meshFaces,
|
||||
meshEdgeI, // (mesh) edge to inflate
|
||||
i, // layer
|
||||
numEdgeSideFaces, // num layers
|
||||
meshFaces, // edgeFaces
|
||||
meshMod
|
||||
);
|
||||
}
|
||||
|
||||
@ -181,16 +181,6 @@ class addPatchCellLayer
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Per patch edge the pp faces (in global indices) using it. Uses
|
||||
// uniqueEqOp() to remove duplicates.
|
||||
labelListList calcGlobalEdgeFaces
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const globalIndex& globalFaces,
|
||||
const indirectPrimitivePatch& pp,
|
||||
const labelList& meshEdges
|
||||
);
|
||||
|
||||
//- Get the face on the other side of the edge.
|
||||
static label nbrFace
|
||||
(
|
||||
@ -226,12 +216,13 @@ class addPatchCellLayer
|
||||
label addSideFace
|
||||
(
|
||||
const indirectPrimitivePatch&,
|
||||
const labelList& patchID,
|
||||
const labelListList& addedCells,
|
||||
|
||||
const face& newFace,
|
||||
const label newPatchID,
|
||||
|
||||
const label ownFaceI,
|
||||
const label nbrFaceI,
|
||||
const label patchEdgeI,
|
||||
const label meshEdgeI,
|
||||
const label layerI,
|
||||
const label numEdgeFaces,
|
||||
@ -239,6 +230,18 @@ class addPatchCellLayer
|
||||
polyTopoChange&
|
||||
) const;
|
||||
|
||||
//- Find patch to neighbouring processor
|
||||
static label findProcPatch(const polyMesh&, const label nbrProcID);
|
||||
|
||||
//- Extract properties from mesh face
|
||||
static void setFaceProps
|
||||
(
|
||||
const polyMesh&,
|
||||
const label,
|
||||
label&,
|
||||
label&,
|
||||
bool&
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
addPatchCellLayer(const addPatchCellLayer&);
|
||||
@ -256,7 +259,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh.
|
||||
addPatchCellLayer(const polyMesh& mesh, const bool addToMesh = true);
|
||||
addPatchCellLayer(const polyMesh&, const bool addToMesh = true);
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -291,6 +294,33 @@ public:
|
||||
|
||||
// Edit
|
||||
|
||||
//- Per patch edge the pp faces (in global indices) using it. Uses
|
||||
// uniqueEqOp() to remove duplicates.
|
||||
static labelListList globalEdgeFaces
|
||||
(
|
||||
const polyMesh&,
|
||||
const globalIndex& globalFaces,
|
||||
const indirectPrimitivePatch& pp
|
||||
);
|
||||
|
||||
//- Boundary edges get extruded into boundary faces. Determine patch
|
||||
// for these faces. This might be a to-be-created processor patch
|
||||
// (patchI >= mesh.boundaryMesh().size()) in which case the
|
||||
// nbrProcToPatch, patchToNbrProc give the correspondence. nPatches
|
||||
// is the new number of patches.
|
||||
static void calcSidePatch
|
||||
(
|
||||
const polyMesh&,
|
||||
const globalIndex& globalFaces,
|
||||
const labelListList& globalEdgeFaces,
|
||||
const indirectPrimitivePatch& pp,
|
||||
|
||||
labelList& sidePatchID,
|
||||
label& nPatches,
|
||||
Map<label>& nbrProcToPatch,
|
||||
Map<label>& patchToNbrProc
|
||||
);
|
||||
|
||||
//- Play commands into polyTopoChange to create layers on top
|
||||
// of indirectPrimitivePatch (have to be outside faces).
|
||||
// Gets displacement per patch point.
|
||||
@ -313,8 +343,11 @@ public:
|
||||
// (instead of e.g. from patch faces)
|
||||
void setRefinement
|
||||
(
|
||||
const globalIndex& globalFaces,
|
||||
const labelListList& globalEdgeFaces,
|
||||
const scalarField& expansionRatio,
|
||||
const indirectPrimitivePatch& pp,
|
||||
const labelList& sidePatchID,
|
||||
const labelList& exposedPatchID,
|
||||
const labelList& nFaceLayers,
|
||||
const labelList& nPointLayers,
|
||||
@ -326,20 +359,26 @@ public:
|
||||
//- Add with constant expansion ratio and same nLayers everywhere
|
||||
void setRefinement
|
||||
(
|
||||
const globalIndex& globalFaces,
|
||||
const labelListList& globalEdgeFaces,
|
||||
const label nLayers,
|
||||
const indirectPrimitivePatch& pp,
|
||||
const labelList& sidePatchID,
|
||||
const vectorField& overallDisplacement,
|
||||
polyTopoChange& meshMod
|
||||
)
|
||||
{
|
||||
setRefinement
|
||||
(
|
||||
scalarField(pp.nPoints(), 1.0), // expansion ration
|
||||
globalFaces,
|
||||
globalEdgeFaces,
|
||||
scalarField(pp.nPoints(), 1.0), // expansion ration
|
||||
pp,
|
||||
sidePatchID,
|
||||
labelList(0),
|
||||
labelList(pp.size(), nLayers),
|
||||
labelList(pp.nPoints(), nLayers),
|
||||
overallDisplacement / nLayers,
|
||||
labelList(pp.size(), nLayers), // nFaceLayers
|
||||
labelList(pp.nPoints(), nLayers), // nPointLayers
|
||||
overallDisplacement / nLayers, // firstLayerDisp
|
||||
meshMod
|
||||
);
|
||||
}
|
||||
|
||||
@ -20,7 +20,10 @@ $(edgeFormats)/starcd/STARCDedgeFormatRunTime.C
|
||||
$(edgeFormats)/vtk/VTKedgeFormat.C
|
||||
$(edgeFormats)/vtk/VTKedgeFormatRunTime.C
|
||||
|
||||
extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C
|
||||
|
||||
featureEdgeMesh/featureEdgeMesh.C
|
||||
|
||||
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libedgeMesh
|
||||
|
||||
1028
src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C
Normal file
1028
src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C
Normal file
File diff suppressed because it is too large
Load Diff
377
src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H
Normal file
377
src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H
Normal file
@ -0,0 +1,377 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ 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/>.
|
||||
|
||||
Class
|
||||
Foam::extendedFeatureEdgeMesh
|
||||
|
||||
Description
|
||||
|
||||
Description of feature edges and points.
|
||||
|
||||
Feature points are a sorted subset at the start of the overall points list:
|
||||
0 .. concaveStart_-1 : convex points (w.r.t normals)
|
||||
concaveStart_-1 .. mixedStart_-1 : concave points
|
||||
mixedStart_ .. nonFeatureStart_ : mixed internal/external points
|
||||
nonFeatureStart_ .. size-1 : non-feature points
|
||||
|
||||
Feature edges are the edgeList of the edgeMesh and are sorted:
|
||||
0 .. internalStart_-1 : external edges (convex w.r.t normals)
|
||||
internalStart_ .. flatStart_-1 : internal edges (concave)
|
||||
flatStart_ .. openStart_-1 : flat edges (neither concave or convex)
|
||||
can arise from region interfaces on
|
||||
flat surfaces
|
||||
openStart_ .. multipleStart_-1 : open edges (e.g. from baffle surfaces)
|
||||
multipleStart_ .. size-1 : multiply connected edges
|
||||
|
||||
The edge direction and feature edge and feature point adjacent normals
|
||||
are stored.
|
||||
|
||||
SourceFiles
|
||||
extendedFeatureEdgeMeshI.H
|
||||
extendedFeatureEdgeMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef extendedFeatureEdgeMesh_H
|
||||
#define extendedFeatureEdgeMesh_H
|
||||
|
||||
#include "edgeMesh.H"
|
||||
#include "surfaceFeatures.H"
|
||||
#include "objectRegistry.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "treeDataEdge.H"
|
||||
#include "pointIndexHit.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class extendedFeatureEdgeMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class extendedFeatureEdgeMesh
|
||||
:
|
||||
public regIOobject,
|
||||
public edgeMesh
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("extendedFeatureEdgeMesh");
|
||||
|
||||
enum pointStatus
|
||||
{
|
||||
CONVEX, // Fully convex point (w.r.t normals)
|
||||
CONCAVE, // Fully concave point
|
||||
MIXED, // A point surrounded by both convex and concave edges
|
||||
NONFEATURE // Not a feature point
|
||||
};
|
||||
|
||||
enum edgeStatus
|
||||
{
|
||||
EXTERNAL, // "Convex" edge
|
||||
INTERNAL, // "Concave" edge
|
||||
FLAT, // Neither concave or convex, on a flat surface
|
||||
OPEN, // i.e. only connected to one face
|
||||
MULTIPLE, // Multiply connected (connected to more than two faces)
|
||||
NONE // Not a classified feature edge (consistency with
|
||||
// surfaceFeatures)
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
// Static data
|
||||
|
||||
//- Angular closeness tolerance for treating normals as the same
|
||||
static scalar cosNormalAngleTol_;
|
||||
|
||||
//- Index of the start of the convex feature points - static as 0
|
||||
static label convexStart_;
|
||||
|
||||
//- Index of the start of the external feature edges - static as 0
|
||||
static label externalStart_;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Index of the start of the concave feature points
|
||||
label concaveStart_;
|
||||
|
||||
//- Index of the start of the mixed type feature points
|
||||
label mixedStart_;
|
||||
|
||||
//- Index of the start of the non-feature points
|
||||
label nonFeatureStart_;
|
||||
|
||||
//- Index of the start of the internal feature edges
|
||||
label internalStart_;
|
||||
|
||||
//- Index of the start of the flat feature edges
|
||||
label flatStart_;
|
||||
|
||||
//- Index of the start of the open feature edges
|
||||
label openStart_;
|
||||
|
||||
//- Index of the start of the multiply-connected feature edges
|
||||
label multipleStart_;
|
||||
|
||||
//- Normals of the features, to be referred to by index by both feature
|
||||
// points and edges, unsorted
|
||||
vectorField normals_;
|
||||
|
||||
//- Flat and open edges require the direction of the edge
|
||||
vectorField edgeDirections_;
|
||||
|
||||
//- Indices of the normals that are adjacent to the feature edges
|
||||
labelListList edgeNormals_;
|
||||
|
||||
//- Indices of the normals that are adjacent to the feature points
|
||||
labelListList featurePointNormals_;
|
||||
|
||||
//- Feature edges which are on the boundary between regions
|
||||
labelList regionEdges_;
|
||||
|
||||
//- Search tree for all edges
|
||||
mutable autoPtr<indexedOctree<treeDataEdge> > edgeTree_;
|
||||
|
||||
//- Individual search trees for each type of edge
|
||||
mutable PtrList<indexedOctree<treeDataEdge> > edgeTreesByType_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Classify the type of feature point. Requires valid stored member
|
||||
// data for edges and normals.
|
||||
pointStatus classifyFeaturePoint(label ptI) const;
|
||||
|
||||
//- Classify the type of feature edge. Requires face centre 0 to face
|
||||
// centre 1 vector to distinguish internal from external
|
||||
edgeStatus classifyEdge
|
||||
(
|
||||
const List<vector>& norms,
|
||||
const labelList& edNorms,
|
||||
const vector& fC0tofC1
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static data
|
||||
|
||||
//- Number of possible point types (i.e. number of slices)
|
||||
static label nPointTypes;
|
||||
|
||||
//- Number of possible feature edge types (i.e. number of slices)
|
||||
static label nEdgeTypes;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct (read) given an IOobject
|
||||
extendedFeatureEdgeMesh(const IOobject&);
|
||||
|
||||
//- Construct as copy
|
||||
explicit extendedFeatureEdgeMesh
|
||||
(
|
||||
const IOobject&,
|
||||
const extendedFeatureEdgeMesh&
|
||||
);
|
||||
|
||||
//- Construct by transferring components (points, edges)
|
||||
extendedFeatureEdgeMesh
|
||||
(
|
||||
const IOobject&,
|
||||
const Xfer<pointField>&,
|
||||
const Xfer<edgeList>&
|
||||
);
|
||||
|
||||
//- Construct (read) given surfaceFeatures, an objectRegistry and a
|
||||
// fileName to write to. Extracts, classifies and reorders the data
|
||||
// from surfaceFeatures.
|
||||
extendedFeatureEdgeMesh
|
||||
(
|
||||
const surfaceFeatures& sFeat,
|
||||
const objectRegistry& obr,
|
||||
const fileName& sFeatFileName
|
||||
);
|
||||
|
||||
//- Construct from all components
|
||||
extendedFeatureEdgeMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const pointField& pts,
|
||||
const edgeList& eds,
|
||||
label concaveStart,
|
||||
label mixedStart,
|
||||
label nonFeatureStart,
|
||||
label internalStart,
|
||||
label flatStart,
|
||||
label openStart,
|
||||
label multipleStart,
|
||||
const vectorField& normals,
|
||||
const vectorField& edgeDirections,
|
||||
const labelListList& edgeNormals,
|
||||
const labelListList& featurePointNormals,
|
||||
const labelList& regionEdges
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~extendedFeatureEdgeMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Find
|
||||
|
||||
//- Find nearest surface edge for the sample point.
|
||||
void nearestFeatureEdge
|
||||
(
|
||||
const point& sample,
|
||||
scalar searchDistSqr,
|
||||
pointIndexHit& info
|
||||
) const;
|
||||
|
||||
//- Find nearest surface edge for each sample point.
|
||||
void nearestFeatureEdge
|
||||
(
|
||||
const pointField& samples,
|
||||
const scalarField& searchDistSqr,
|
||||
List<pointIndexHit>& info
|
||||
) const;
|
||||
|
||||
//- Find the nearest point on each type of feature edge
|
||||
void nearestFeatureEdgeByType
|
||||
(
|
||||
const point& sample,
|
||||
const scalarField& searchDistSqr,
|
||||
List<pointIndexHit>& info
|
||||
) const;
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the index of the start of the convex feature points
|
||||
inline label convexStart() const;
|
||||
|
||||
//- Return the index of the start of the concave feature points
|
||||
inline label concaveStart() const;
|
||||
|
||||
//- Return the index of the start of the mixed type feature points
|
||||
inline label mixedStart() const;
|
||||
|
||||
//- Return the index of the start of the non-feature points
|
||||
inline label nonFeatureStart() const;
|
||||
|
||||
//- Return the index of the start of the external feature edges
|
||||
inline label externalStart() const;
|
||||
|
||||
//- Return the index of the start of the internal feature edges
|
||||
inline label internalStart() const;
|
||||
|
||||
//- Return the index of the start of the flat feature edges
|
||||
inline label flatStart() const;
|
||||
|
||||
//- Return the index of the start of the open feature edges
|
||||
inline label openStart() const;
|
||||
|
||||
//- Return the index of the start of the multiply-connected feature
|
||||
// edges
|
||||
inline label multipleStart() const;
|
||||
|
||||
//- Return whether or not the point index is a feature point
|
||||
inline bool featurePoint(label ptI) const;
|
||||
|
||||
//- Return the normals of the surfaces adjacent to the feature edges
|
||||
// and points
|
||||
inline const vectorField& normals() const;
|
||||
|
||||
//- Return the edgeDirection vectors
|
||||
inline const vectorField& edgeDirections() const;
|
||||
|
||||
//- Return the direction of edgeI, pointing away from ptI
|
||||
inline vector edgeDirection(label edgeI, label ptI) const;
|
||||
|
||||
//- Return the indices of the normals that are adjacent to the
|
||||
// feature edges
|
||||
inline const labelListList& edgeNormals() const;
|
||||
|
||||
//- Return the normal vectors for a given set of normal indices
|
||||
inline vectorField edgeNormals(const labelList& edgeNormIs) const;
|
||||
|
||||
//- Return the normal vectors for a given edge
|
||||
inline vectorField edgeNormals(label edgeI) const;
|
||||
|
||||
//- Return the indices of the normals that are adjacent to the
|
||||
// feature points
|
||||
inline const labelListList& featurePointNormals() const;
|
||||
|
||||
//- Return the normal vectors for a given feature point
|
||||
inline vectorField featurePointNormals(label ptI) const;
|
||||
|
||||
//- Return the feature edges which are on the boundary between
|
||||
// regions
|
||||
inline const labelList& regionEdges() const;
|
||||
|
||||
//- Return the pointStatus of a specified point
|
||||
inline pointStatus getPointStatus(label ptI) const;
|
||||
|
||||
//- Return the edgeStatus of a specified edge
|
||||
inline edgeStatus getEdgeStatus(label edgeI) const;
|
||||
|
||||
//- Demand driven construction of octree for boundary edges
|
||||
const indexedOctree<treeDataEdge>& edgeTree() const;
|
||||
|
||||
//- Demand driven construction of octree for boundary edges by type
|
||||
const PtrList<indexedOctree<treeDataEdge> >&
|
||||
edgeTreesByType() const;
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
//- Write all components of the extendedFeatureEdgeMesh as obj files
|
||||
void writeObj(const fileName& prefix) const;
|
||||
|
||||
//- Give precedence to the regIOobject write
|
||||
using regIOobject::write;
|
||||
|
||||
//- WriteData function required for regIOobject write operation
|
||||
virtual bool writeData(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "extendedFeatureEdgeMeshI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,78 +25,79 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::convexStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::convexStart() const
|
||||
{
|
||||
return convexStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::concaveStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::concaveStart() const
|
||||
{
|
||||
return concaveStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::mixedStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::mixedStart() const
|
||||
{
|
||||
return mixedStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::nonFeatureStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::nonFeatureStart() const
|
||||
{
|
||||
return nonFeatureStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::externalStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::externalStart() const
|
||||
{
|
||||
return externalStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::internalStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::internalStart() const
|
||||
{
|
||||
return internalStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::flatStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::flatStart() const
|
||||
{
|
||||
return flatStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::openStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::openStart() const
|
||||
{
|
||||
return openStart_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::featureEdgeMesh::multipleStart() const
|
||||
inline Foam::label Foam::extendedFeatureEdgeMesh::multipleStart() const
|
||||
{
|
||||
return multipleStart_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::featureEdgeMesh::featurePoint(label ptI) const
|
||||
inline bool Foam::extendedFeatureEdgeMesh::featurePoint(label ptI) const
|
||||
{
|
||||
return ptI < nonFeatureStart_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::vectorField& Foam::featureEdgeMesh::normals() const
|
||||
inline const Foam::vectorField& Foam::extendedFeatureEdgeMesh::normals() const
|
||||
{
|
||||
return normals_;
|
||||
}
|
||||
|
||||
inline const Foam::vectorField& Foam::featureEdgeMesh::edgeDirections() const
|
||||
inline const Foam::vectorField& Foam::extendedFeatureEdgeMesh::edgeDirections()
|
||||
const
|
||||
{
|
||||
return edgeDirections_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::vector Foam::featureEdgeMesh::edgeDirection
|
||||
inline Foam::vector Foam::extendedFeatureEdgeMesh::edgeDirection
|
||||
(
|
||||
label edgeI,
|
||||
label ptI
|
||||
@ -114,7 +115,7 @@ inline Foam::vector Foam::featureEdgeMesh::edgeDirection
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("Foam::featureEdgeMesh::edgedirection")
|
||||
FatalErrorIn("Foam::extendedFeatureEdgeMesh::edgedirection")
|
||||
<< "Requested ptI " << ptI << " is not a point on the requested "
|
||||
<< "edgeI " << edgeI << ". edgeI start and end: "
|
||||
<< e.start() << " " << e.end()
|
||||
@ -125,13 +126,14 @@ inline Foam::vector Foam::featureEdgeMesh::edgeDirection
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelListList& Foam::featureEdgeMesh::edgeNormals() const
|
||||
inline const Foam::labelListList& Foam::extendedFeatureEdgeMesh::edgeNormals()
|
||||
const
|
||||
{
|
||||
return edgeNormals_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::vectorField Foam::featureEdgeMesh::edgeNormals
|
||||
inline Foam::vectorField Foam::extendedFeatureEdgeMesh::edgeNormals
|
||||
(
|
||||
const labelList& edgeNormIs
|
||||
) const
|
||||
@ -147,27 +149,28 @@ inline Foam::vectorField Foam::featureEdgeMesh::edgeNormals
|
||||
}
|
||||
|
||||
|
||||
inline Foam::vectorField Foam::featureEdgeMesh::edgeNormals(label edgeI) const
|
||||
inline Foam::vectorField Foam::extendedFeatureEdgeMesh::edgeNormals(label edgeI)
|
||||
const
|
||||
{
|
||||
return edgeNormals(edgeNormals_[edgeI]);
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelListList&
|
||||
Foam::featureEdgeMesh::featurePointNormals() const
|
||||
Foam::extendedFeatureEdgeMesh::featurePointNormals() const
|
||||
{
|
||||
return featurePointNormals_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::vectorField Foam::featureEdgeMesh::featurePointNormals
|
||||
inline Foam::vectorField Foam::extendedFeatureEdgeMesh::featurePointNormals
|
||||
(
|
||||
label ptI
|
||||
) const
|
||||
{
|
||||
if (!featurePoint(ptI))
|
||||
{
|
||||
WarningIn("vectorField featureEdgeMesh::featurePointNormals")
|
||||
WarningIn("vectorField extendedFeatureEdgeMesh::featurePointNormals")
|
||||
<< "Requesting the normals of a non-feature point. "
|
||||
<< "Returned zero length vectorField."
|
||||
<< endl;
|
||||
@ -188,13 +191,14 @@ inline Foam::vectorField Foam::featureEdgeMesh::featurePointNormals
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList& Foam::featureEdgeMesh::regionEdges() const
|
||||
inline const Foam::labelList& Foam::extendedFeatureEdgeMesh::regionEdges() const
|
||||
{
|
||||
return regionEdges_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::featureEdgeMesh::pointStatus Foam::featureEdgeMesh::getPointStatus
|
||||
inline Foam::extendedFeatureEdgeMesh::pointStatus
|
||||
Foam::extendedFeatureEdgeMesh::getPointStatus
|
||||
(
|
||||
label ptI
|
||||
) const
|
||||
@ -218,7 +222,8 @@ inline Foam::featureEdgeMesh::pointStatus Foam::featureEdgeMesh::getPointStatus
|
||||
}
|
||||
|
||||
|
||||
inline Foam::featureEdgeMesh::edgeStatus Foam::featureEdgeMesh::getEdgeStatus
|
||||
inline Foam::extendedFeatureEdgeMesh::edgeStatus
|
||||
Foam::extendedFeatureEdgeMesh::getEdgeStatus
|
||||
(
|
||||
label edgeI
|
||||
) const
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,27 +25,12 @@ Class
|
||||
Foam::featureEdgeMesh
|
||||
|
||||
Description
|
||||
edgeMesh + IO.
|
||||
|
||||
Feature points are a sorted subset at the start of the overall points list:
|
||||
0 .. concaveStart_-1 : convex points (w.r.t normals)
|
||||
concaveStart_-1 .. mixedStart_-1 : concave points
|
||||
mixedStart_ .. nonFeatureStart_ : mixed internal/external points
|
||||
nonFeatureStart_ .. size-1 : non-feature points
|
||||
|
||||
Feature edges are the edgeList of the edgeMesh and are sorted:
|
||||
0 .. internalStart_-1 : external edges (convex w.r.t normals)
|
||||
internalStart_ .. flatStart_-1 : internal edges (concave)
|
||||
flatStart_ .. openStart_-1 : flat edges (neither concave or convex)
|
||||
can arise from region interfaces on
|
||||
flat surfaces
|
||||
openStart_ .. multipleStart_-1 : open edges (e.g. from baffle surfaces)
|
||||
multipleStart_ .. size-1 : multiply connected edges
|
||||
|
||||
The edge direction and feature edge and feature point adjacent normals
|
||||
are stored.
|
||||
See also extendedFeatureEdgeMesh type which stores additional classification
|
||||
of features.
|
||||
|
||||
SourceFiles
|
||||
featureEdgeMeshI.H
|
||||
featureEdgeMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -54,12 +39,7 @@ SourceFiles
|
||||
#define featureEdgeMesh_H
|
||||
|
||||
#include "edgeMesh.H"
|
||||
#include "surfaceFeatures.H"
|
||||
#include "objectRegistry.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "treeDataEdge.H"
|
||||
#include "pointIndexHit.H"
|
||||
#include "regIOobject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -67,7 +47,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class featureEdgeMesh Declaration
|
||||
Class featureEdgeMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class featureEdgeMesh
|
||||
@ -78,281 +58,31 @@ class featureEdgeMesh
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("featureEdgeMesh");
|
||||
|
||||
enum pointStatus
|
||||
{
|
||||
CONVEX, // Fully convex point (w.r.t normals)
|
||||
CONCAVE, // Fully concave point
|
||||
MIXED, // A point surrounded by both convex and concave edges
|
||||
NONFEATURE // Not a feature point
|
||||
};
|
||||
|
||||
enum edgeStatus
|
||||
{
|
||||
EXTERNAL, // "Convex" edge
|
||||
INTERNAL, // "Concave" edge
|
||||
FLAT, // Neither concave or convex, on a flat surface
|
||||
OPEN, // i.e. only connected to one face
|
||||
MULTIPLE, // Multiply connected (connected to more than two faces)
|
||||
NONE // Not a classified feature edge (consistency with
|
||||
// surfaceFeatures)
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
// Static data
|
||||
|
||||
//- Angular closeness tolerance for treating normals as the same
|
||||
static scalar cosNormalAngleTol_;
|
||||
|
||||
//- Index of the start of the convex feature points - static as 0
|
||||
static label convexStart_;
|
||||
|
||||
//- Index of the start of the external feature edges - static as 0
|
||||
static label externalStart_;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Index of the start of the concave feature points
|
||||
label concaveStart_;
|
||||
|
||||
//- Index of the start of the mixed type feature points
|
||||
label mixedStart_;
|
||||
|
||||
//- Index of the start of the non-feature points
|
||||
label nonFeatureStart_;
|
||||
|
||||
//- Index of the start of the internal feature edges
|
||||
label internalStart_;
|
||||
|
||||
//- Index of the start of the flat feature edges
|
||||
label flatStart_;
|
||||
|
||||
//- Index of the start of the open feature edges
|
||||
label openStart_;
|
||||
|
||||
//- Index of the start of the multiply-connected feature edges
|
||||
label multipleStart_;
|
||||
|
||||
//- Normals of the features, to be referred to by index by both feature
|
||||
// points and edges, unsorted
|
||||
vectorField normals_;
|
||||
|
||||
//- Flat and open edges require the direction of the edge
|
||||
vectorField edgeDirections_;
|
||||
|
||||
//- Indices of the normals that are adjacent to the feature edges
|
||||
labelListList edgeNormals_;
|
||||
|
||||
//- Indices of the normals that are adjacent to the feature points
|
||||
labelListList featurePointNormals_;
|
||||
|
||||
//- Feature edges which are on the boundary between regions
|
||||
labelList regionEdges_;
|
||||
|
||||
//- Search tree for all edges
|
||||
mutable autoPtr<indexedOctree<treeDataEdge> > edgeTree_;
|
||||
|
||||
//- Individual search trees for each type of edge
|
||||
mutable PtrList<indexedOctree<treeDataEdge> > edgeTreesByType_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Classify the type of feature point. Requires valid stored member
|
||||
// data for edges and normals.
|
||||
pointStatus classifyFeaturePoint(label ptI) const;
|
||||
|
||||
//- Classify the type of feature edge. Requires face centre 0 to face
|
||||
// centre 1 vector to distinguish internal from external
|
||||
edgeStatus classifyEdge
|
||||
(
|
||||
const List<vector>& norms,
|
||||
const labelList& edNorms,
|
||||
const vector& fC0tofC1
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static data
|
||||
|
||||
//- Number of possible point types (i.e. number of slices)
|
||||
static label nPointTypes;
|
||||
|
||||
//- Number of possible feature edge types (i.e. number of slices)
|
||||
static label nEdgeTypes;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct (read) given an IOobject
|
||||
featureEdgeMesh(const IOobject&);
|
||||
|
||||
//- Construct as copy
|
||||
explicit featureEdgeMesh(const IOobject&, const featureEdgeMesh&);
|
||||
|
||||
//- Construct by transferring components (points, edges)
|
||||
//- Construct from featureEdgeMesh data
|
||||
featureEdgeMesh
|
||||
(
|
||||
const IOobject&,
|
||||
const Xfer<pointField>&,
|
||||
const Xfer<edgeList>&
|
||||
const pointField&,
|
||||
const edgeList&
|
||||
);
|
||||
|
||||
//- Construct (read) given surfaceFeatures, an objectRegistry and a
|
||||
// fileName to write to. Extracts, classifies and reorders the data
|
||||
// from surfaceFeatures.
|
||||
featureEdgeMesh
|
||||
(
|
||||
const surfaceFeatures& sFeat,
|
||||
const objectRegistry& obr,
|
||||
const fileName& sFeatFileName
|
||||
);
|
||||
|
||||
//- Construct from all components
|
||||
featureEdgeMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const pointField& pts,
|
||||
const edgeList& eds,
|
||||
label concaveStart,
|
||||
label mixedStart,
|
||||
label nonFeatureStart,
|
||||
label internalStart,
|
||||
label flatStart,
|
||||
label openStart,
|
||||
label multipleStart,
|
||||
const vectorField& normals,
|
||||
const vectorField& edgeDirections,
|
||||
const labelListList& edgeNormals,
|
||||
const labelListList& featurePointNormals,
|
||||
const labelList& regionEdges
|
||||
);
|
||||
//- Construct as copy
|
||||
featureEdgeMesh(const IOobject&, const featureEdgeMesh&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~featureEdgeMesh();
|
||||
//- ReadData function required for regIOobject read operation
|
||||
virtual bool readData(Istream&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Find
|
||||
|
||||
//- Find nearest surface edge for the sample point.
|
||||
void nearestFeatureEdge
|
||||
(
|
||||
const point& sample,
|
||||
scalar searchDistSqr,
|
||||
pointIndexHit& info
|
||||
) const;
|
||||
|
||||
//- Find nearest surface edge for each sample point.
|
||||
void nearestFeatureEdge
|
||||
(
|
||||
const pointField& samples,
|
||||
const scalarField& searchDistSqr,
|
||||
List<pointIndexHit>& info
|
||||
) const;
|
||||
|
||||
//- Find the nearest point on each type of feature edge
|
||||
void nearestFeatureEdgeByType
|
||||
(
|
||||
const point& sample,
|
||||
const scalarField& searchDistSqr,
|
||||
List<pointIndexHit>& info
|
||||
) const;
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the index of the start of the convex feature points
|
||||
inline label convexStart() const;
|
||||
|
||||
//- Return the index of the start of the concave feature points
|
||||
inline label concaveStart() const;
|
||||
|
||||
//- Return the index of the start of the mixed type feature points
|
||||
inline label mixedStart() const;
|
||||
|
||||
//- Return the index of the start of the non-feature points
|
||||
inline label nonFeatureStart() const;
|
||||
|
||||
//- Return the index of the start of the external feature edges
|
||||
inline label externalStart() const;
|
||||
|
||||
//- Return the index of the start of the internal feature edges
|
||||
inline label internalStart() const;
|
||||
|
||||
//- Return the index of the start of the flat feature edges
|
||||
inline label flatStart() const;
|
||||
|
||||
//- Return the index of the start of the open feature edges
|
||||
inline label openStart() const;
|
||||
|
||||
//- Return the index of the start of the multiply-connected feature
|
||||
// edges
|
||||
inline label multipleStart() const;
|
||||
|
||||
//- Return whether or not the point index is a feature point
|
||||
inline bool featurePoint(label ptI) const;
|
||||
|
||||
//- Return the normals of the surfaces adjacent to the feature edges
|
||||
// and points
|
||||
inline const vectorField& normals() const;
|
||||
|
||||
//- Return the edgeDirection vectors
|
||||
inline const vectorField& edgeDirections() const;
|
||||
|
||||
//- Return the direction of edgeI, pointing away from ptI
|
||||
inline vector edgeDirection(label edgeI, label ptI) const;
|
||||
|
||||
//- Return the indices of the normals that are adjacent to the
|
||||
// feature edges
|
||||
inline const labelListList& edgeNormals() const;
|
||||
|
||||
//- Return the normal vectors for a given set of normal indices
|
||||
inline vectorField edgeNormals(const labelList& edgeNormIs) const;
|
||||
|
||||
//- Return the normal vectors for a given edge
|
||||
inline vectorField edgeNormals(label edgeI) const;
|
||||
|
||||
//- Return the indices of the normals that are adjacent to the
|
||||
// feature points
|
||||
inline const labelListList& featurePointNormals() const;
|
||||
|
||||
//- Return the normal vectors for a given feature point
|
||||
inline vectorField featurePointNormals(label ptI) const;
|
||||
|
||||
//- Return the feature edges which are on the boundary between
|
||||
// regions
|
||||
inline const labelList& regionEdges() const;
|
||||
|
||||
//- Return the pointStatus of a specified point
|
||||
inline pointStatus getPointStatus(label ptI) const;
|
||||
|
||||
//- Return the edgeStatus of a specified edge
|
||||
inline edgeStatus getEdgeStatus(label edgeI) const;
|
||||
|
||||
//- Demand driven construction of octree for boundary edges
|
||||
const indexedOctree<treeDataEdge>& edgeTree() const;
|
||||
|
||||
//- Demand driven construction of octree for boundary edges by type
|
||||
const PtrList<indexedOctree<treeDataEdge> >&
|
||||
edgeTreesByType() const;
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
//- Write all components of the featureEdgeMesh as obj files
|
||||
void writeObj(const fileName& prefix) const;
|
||||
|
||||
//- Give precedence to the regIOobject write
|
||||
using regIOobject::write;
|
||||
|
||||
//- WriteData function required for regIOobject write operation
|
||||
virtual bool writeData(Ostream&) const;
|
||||
//- WriteData function required for regIOobject write operation
|
||||
virtual bool writeData(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
@ -362,10 +92,6 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "featureEdgeMeshI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -40,7 +40,8 @@ bool Foam::adjustPhi
|
||||
{
|
||||
if (p.needReference())
|
||||
{
|
||||
p.boundaryField().updateCoeffs();
|
||||
// p coefficients should not be updated here
|
||||
// p.boundaryField().updateCoeffs();
|
||||
|
||||
scalar massIn = 0.0;
|
||||
scalar fixedMassOut = 0.0;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -45,6 +45,7 @@ Description
|
||||
#include "layerParameters.H"
|
||||
#include "combineFaces.H"
|
||||
#include "IOmanip.H"
|
||||
#include "globalIndex.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -888,68 +889,6 @@ void Foam::autoLayerDriver::handleNonManifolds
|
||||
Info<< "Outside of local patch is multiply connected across edges or"
|
||||
<< " points at " << nNonManif << " points." << endl;
|
||||
|
||||
|
||||
const labelList& meshPoints = pp.meshPoints();
|
||||
|
||||
|
||||
// 2. Parallel check
|
||||
// For now disable extrusion at any shared edges.
|
||||
const labelHashSet sharedEdgeSet(mesh.globalData().sharedEdgeLabels());
|
||||
|
||||
forAll(pp.edges(), edgeI)
|
||||
{
|
||||
if (sharedEdgeSet.found(meshEdges[edgeI]))
|
||||
{
|
||||
const edge& e = mesh.edges()[meshEdges[edgeI]];
|
||||
|
||||
Pout<< "Disabling extrusion at edge "
|
||||
<< mesh.points()[e[0]] << mesh.points()[e[1]]
|
||||
<< " since it is non-manifold across coupled patches."
|
||||
<< endl;
|
||||
|
||||
nonManifoldPoints.insert(e[0]);
|
||||
nonManifoldPoints.insert(e[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// 3b. extrusion can produce multiple faces between 2 cells
|
||||
// across processor boundary
|
||||
// This occurs when a coupled face shares more than 1 edge with a
|
||||
// non-coupled boundary face.
|
||||
// This is now correctly handled by addPatchCellLayer in that it
|
||||
// extrudes a single face from the stringed up edges.
|
||||
|
||||
|
||||
nNonManif = returnReduce(nonManifoldPoints.size(), sumOp<label>());
|
||||
|
||||
if (nNonManif > 0)
|
||||
{
|
||||
Info<< "Outside of patches is multiply connected across edges or"
|
||||
<< " points at " << nNonManif << " points." << nl
|
||||
<< "Writing " << nNonManif
|
||||
<< " points where this happens to pointSet "
|
||||
<< nonManifoldPoints.name() << nl
|
||||
<< "and setting layer thickness to zero on these points."
|
||||
<< endl;
|
||||
|
||||
nonManifoldPoints.instance() = mesh.time().timeName();
|
||||
nonManifoldPoints.write();
|
||||
|
||||
forAll(meshPoints, patchPointI)
|
||||
{
|
||||
if (nonManifoldPoints.found(meshPoints[patchPointI]))
|
||||
{
|
||||
unmarkExtrusion
|
||||
(
|
||||
patchPointI,
|
||||
patchDisp,
|
||||
patchNLayers,
|
||||
extrudeStatus
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Set displacement to zero for all " << nNonManif
|
||||
<< " non-manifold points" << endl;
|
||||
}
|
||||
@ -1348,7 +1287,6 @@ void Foam::autoLayerDriver::setNumLayers
|
||||
}
|
||||
|
||||
|
||||
// Grow no-extrusion layer
|
||||
void Foam::autoLayerDriver::growNoExtrusion
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
@ -1439,6 +1377,103 @@ void Foam::autoLayerDriver::growNoExtrusion
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoLayerDriver::determineSidePatches
|
||||
(
|
||||
const globalIndex& globalFaces,
|
||||
const labelListList& edgeGlobalFaces,
|
||||
const indirectPrimitivePatch& pp,
|
||||
|
||||
labelList& sidePatchID
|
||||
)
|
||||
{
|
||||
// Sometimes edges-to-be-extruded are on more than 2 processors.
|
||||
// Work out which 2 hold the faces to be extruded and thus which procpatch
|
||||
// the side-face should be in. As an additional complication this might
|
||||
// mean that 2 procesors that were only edge-connected now suddenly need
|
||||
// to become face-connected i.e. have a processor patch between them.
|
||||
|
||||
fvMesh& mesh = meshRefiner_.mesh();
|
||||
|
||||
// Determine sidePatchID. Any additional processor boundary gets added to
|
||||
// patchToNbrProc,nbrProcToPatch and nPatches gets set to the new number
|
||||
// of patches.
|
||||
label nPatches;
|
||||
Map<label> nbrProcToPatch;
|
||||
Map<label> patchToNbrProc;
|
||||
addPatchCellLayer::calcSidePatch
|
||||
(
|
||||
mesh,
|
||||
globalFaces,
|
||||
edgeGlobalFaces,
|
||||
pp,
|
||||
|
||||
sidePatchID,
|
||||
nPatches,
|
||||
nbrProcToPatch,
|
||||
patchToNbrProc
|
||||
);
|
||||
|
||||
label nOldPatches = mesh.boundaryMesh().size();
|
||||
label nAdded = returnReduce(nPatches-nOldPatches, sumOp<label>());
|
||||
Info<< nl << "Adding in total " << nAdded/2 << " inter-processor patches to"
|
||||
<< " handle extrusion of non-manifold processor boundaries."
|
||||
<< endl;
|
||||
|
||||
if (nAdded > 0)
|
||||
{
|
||||
// We might not add patches in same order as in patchToNbrProc
|
||||
// so prepare to renumber sidePatchID
|
||||
Map<label> wantedToAddedPatch;
|
||||
|
||||
for (label patchI = nOldPatches; patchI < nPatches; patchI++)
|
||||
{
|
||||
label nbrProcI = patchToNbrProc[patchI];
|
||||
word name =
|
||||
"procBoundary"
|
||||
+ Foam::name(Pstream::myProcNo())
|
||||
+ "to"
|
||||
+ Foam::name(nbrProcI);
|
||||
|
||||
dictionary patchDict;
|
||||
patchDict.add("type", processorPolyPatch::typeName);
|
||||
patchDict.add("myProcNo", Pstream::myProcNo());
|
||||
patchDict.add("neighbProcNo", nbrProcI);
|
||||
patchDict.add("nFaces", 0);
|
||||
patchDict.add("startFace", mesh.nFaces());
|
||||
|
||||
Pout<< "Adding patch " << patchI
|
||||
<< " name:" << name
|
||||
<< " between " << Pstream::myProcNo()
|
||||
<< " and " << nbrProcI
|
||||
<< endl;
|
||||
|
||||
label procPatchI = meshRefiner_.appendPatch
|
||||
(
|
||||
mesh,
|
||||
mesh.boundaryMesh().size(), // new patch index
|
||||
name,
|
||||
patchDict
|
||||
);
|
||||
wantedToAddedPatch.insert(patchI, procPatchI);
|
||||
}
|
||||
|
||||
// Renumber sidePatchID
|
||||
forAll(sidePatchID, i)
|
||||
{
|
||||
label patchI = sidePatchID[i];
|
||||
Map<label>::const_iterator fnd = wantedToAddedPatch.find(patchI);
|
||||
if (fnd != wantedToAddedPatch.end())
|
||||
{
|
||||
sidePatchID[i] = fnd();
|
||||
}
|
||||
}
|
||||
|
||||
mesh.clearOut();
|
||||
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()).updateMesh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoLayerDriver::calculateLayerThickness
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
@ -2553,6 +2588,37 @@ void Foam::autoLayerDriver::addLayers
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// Global face indices engine
|
||||
const globalIndex globalFaces(mesh.nFaces());
|
||||
|
||||
// Determine extrudePatch.edgeFaces in global numbering (so across
|
||||
// coupled patches). This is used only to string up edges between coupled
|
||||
// faces (all edges between same (global)face indices get extruded).
|
||||
labelListList edgeGlobalFaces
|
||||
(
|
||||
addPatchCellLayer::globalEdgeFaces
|
||||
(
|
||||
mesh,
|
||||
globalFaces,
|
||||
pp
|
||||
)
|
||||
);
|
||||
|
||||
// Determine patches for extruded boundary edges. Calculates if any
|
||||
// additional processor patches need to be constructed.
|
||||
|
||||
labelList sidePatchID;
|
||||
determineSidePatches
|
||||
(
|
||||
globalFaces,
|
||||
edgeGlobalFaces,
|
||||
pp,
|
||||
|
||||
sidePatchID
|
||||
);
|
||||
|
||||
|
||||
// Construct iterative mesh mover.
|
||||
Info<< "Constructing mesh displacer ..." << endl;
|
||||
|
||||
@ -3038,8 +3104,12 @@ void Foam::autoLayerDriver::addLayers
|
||||
// Not add layer if patchDisp is zero.
|
||||
addLayer.setRefinement
|
||||
(
|
||||
globalFaces,
|
||||
edgeGlobalFaces,
|
||||
|
||||
invExpansionRatio,
|
||||
pp(),
|
||||
sidePatchID, // boundary patch for extruded boundary edges
|
||||
labelList(0), // exposed patchIDs, not used for adding layers
|
||||
nPatchFaceLayers, // layers per face
|
||||
nPatchPointLayers, // layers per point
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -243,6 +243,16 @@ class autoLayerDriver
|
||||
List<extrudeMode>& extrudeStatus
|
||||
) const;
|
||||
|
||||
//- See what patches boundaryedges should be extruded into
|
||||
void determineSidePatches
|
||||
(
|
||||
const globalIndex& globalFaces,
|
||||
const labelListList& edgeGlobalFaces,
|
||||
const indirectPrimitivePatch& pp,
|
||||
|
||||
labelList& sidePatchID
|
||||
);
|
||||
|
||||
//- Calculate pointwise wanted and minimum thickness.
|
||||
// thickness: wanted thickness
|
||||
// minthickness: when to give up and not extrude
|
||||
|
||||
@ -1549,60 +1549,28 @@ void Foam::meshRefinement::checkCoupledFaceZones(const polyMesh& mesh)
|
||||
}
|
||||
|
||||
|
||||
// Adds patch if not yet there. Returns patchID.
|
||||
Foam::label Foam::meshRefinement::addPatch
|
||||
Foam::label Foam::meshRefinement::appendPatch
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const label insertPatchI,
|
||||
const word& patchName,
|
||||
const dictionary& patchInfo
|
||||
const dictionary& patchDict
|
||||
)
|
||||
{
|
||||
polyBoundaryMesh& polyPatches =
|
||||
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
|
||||
|
||||
const label patchI = polyPatches.findPatchID(patchName);
|
||||
if (patchI != -1)
|
||||
{
|
||||
// Already there
|
||||
return patchI;
|
||||
}
|
||||
|
||||
|
||||
label insertPatchI = polyPatches.size();
|
||||
label startFaceI = mesh.nFaces();
|
||||
|
||||
forAll(polyPatches, patchI)
|
||||
{
|
||||
const polyPatch& pp = polyPatches[patchI];
|
||||
|
||||
if (isA<processorPolyPatch>(pp))
|
||||
{
|
||||
insertPatchI = patchI;
|
||||
startFaceI = pp.start();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Below is all quite a hack. Feel free to change once there is a better
|
||||
// mechanism to insert and reorder patches.
|
||||
|
||||
// Clear local fields and e.g. polyMesh parallelInfo.
|
||||
mesh.clearOut();
|
||||
|
||||
label sz = polyPatches.size();
|
||||
|
||||
polyBoundaryMesh& polyPatches =
|
||||
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
|
||||
fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary());
|
||||
|
||||
dictionary patchDict(patchInfo);
|
||||
patchDict.set("nFaces", 0);
|
||||
patchDict.set("startFace", startFaceI);
|
||||
label patchI = polyPatches.size();
|
||||
|
||||
// Add polyPatch at the end
|
||||
polyPatches.setSize(sz+1);
|
||||
polyPatches.setSize(patchI+1);
|
||||
polyPatches.set
|
||||
(
|
||||
sz,
|
||||
patchI,
|
||||
polyPatch::New
|
||||
(
|
||||
patchName,
|
||||
@ -1611,13 +1579,13 @@ Foam::label Foam::meshRefinement::addPatch
|
||||
polyPatches
|
||||
)
|
||||
);
|
||||
fvPatches.setSize(sz+1);
|
||||
fvPatches.setSize(patchI+1);
|
||||
fvPatches.set
|
||||
(
|
||||
sz,
|
||||
patchI,
|
||||
fvPatch::New
|
||||
(
|
||||
polyPatches[sz], // point to newly added polyPatch
|
||||
polyPatches[patchI], // point to newly added polyPatch
|
||||
mesh.boundary()
|
||||
)
|
||||
);
|
||||
@ -1675,21 +1643,69 @@ Foam::label Foam::meshRefinement::addPatch
|
||||
mesh,
|
||||
calculatedFvPatchField<tensor>::typeName
|
||||
);
|
||||
return patchI;
|
||||
}
|
||||
|
||||
|
||||
// Adds patch if not yet there. Returns patchID.
|
||||
Foam::label Foam::meshRefinement::addPatch
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const word& patchName,
|
||||
const dictionary& patchInfo
|
||||
)
|
||||
{
|
||||
polyBoundaryMesh& polyPatches =
|
||||
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
|
||||
fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary());
|
||||
|
||||
const label patchI = polyPatches.findPatchID(patchName);
|
||||
if (patchI != -1)
|
||||
{
|
||||
// Already there
|
||||
return patchI;
|
||||
}
|
||||
|
||||
|
||||
label insertPatchI = polyPatches.size();
|
||||
label startFaceI = mesh.nFaces();
|
||||
|
||||
forAll(polyPatches, patchI)
|
||||
{
|
||||
const polyPatch& pp = polyPatches[patchI];
|
||||
|
||||
if (isA<processorPolyPatch>(pp))
|
||||
{
|
||||
insertPatchI = patchI;
|
||||
startFaceI = pp.start();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dictionary patchDict(patchInfo);
|
||||
patchDict.set("nFaces", 0);
|
||||
patchDict.set("startFace", startFaceI);
|
||||
|
||||
// Below is all quite a hack. Feel free to change once there is a better
|
||||
// mechanism to insert and reorder patches.
|
||||
|
||||
label addedPatchI = appendPatch(mesh, insertPatchI, patchName, patchDict);
|
||||
|
||||
|
||||
// Create reordering list
|
||||
// patches before insert position stay as is
|
||||
labelList oldToNew(sz+1);
|
||||
labelList oldToNew(addedPatchI+1);
|
||||
for (label i = 0; i < insertPatchI; i++)
|
||||
{
|
||||
oldToNew[i] = i;
|
||||
}
|
||||
// patches after insert position move one up
|
||||
for (label i = insertPatchI; i < sz; i++)
|
||||
for (label i = insertPatchI; i < addedPatchI; i++)
|
||||
{
|
||||
oldToNew[i] = i+1;
|
||||
}
|
||||
// appended patch gets moved to insert position
|
||||
oldToNew[sz] = insertPatchI;
|
||||
oldToNew[addedPatchI] = insertPatchI;
|
||||
|
||||
// Shuffle into place
|
||||
polyPatches.reorder(oldToNew);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -747,8 +747,17 @@ public:
|
||||
|
||||
// Other topo changes
|
||||
|
||||
//- Helper:append patch to end of mesh.
|
||||
static label appendPatch
|
||||
(
|
||||
fvMesh&,
|
||||
const label insertPatchI,
|
||||
const word&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Helper:add patch to mesh. Update all registered fields.
|
||||
// Use addMeshedPatch to add patches originating from surfaces.
|
||||
// Used by addMeshedPatch to add patches originating from surfaces.
|
||||
static label addPatch(fvMesh&, const word& name, const dictionary&);
|
||||
|
||||
//- Add patch originating from meshing. Update meshedPatches_.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -1007,6 +1007,82 @@ void Foam::refinementSurfaces::findNearestRegion
|
||||
}
|
||||
|
||||
|
||||
void Foam::refinementSurfaces::findNearestRegion
|
||||
(
|
||||
const labelList& surfacesToTest,
|
||||
const pointField& samples,
|
||||
const scalarField& nearestDistSqr,
|
||||
labelList& hitSurface,
|
||||
List<pointIndexHit>& hitInfo,
|
||||
labelList& hitRegion,
|
||||
vectorField& hitNormal
|
||||
) const
|
||||
{
|
||||
labelList geometries(UIndirectList<label>(surfaces_, surfacesToTest));
|
||||
|
||||
// Do the tests. Note that findNearest returns index in geometries.
|
||||
searchableSurfacesQueries::findNearest
|
||||
(
|
||||
allGeometry_,
|
||||
geometries,
|
||||
samples,
|
||||
nearestDistSqr,
|
||||
hitSurface,
|
||||
hitInfo
|
||||
);
|
||||
|
||||
// Rework the hitSurface to be surface (i.e. index into surfaces_)
|
||||
forAll(hitSurface, pointI)
|
||||
{
|
||||
if (hitSurface[pointI] != -1)
|
||||
{
|
||||
hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
|
||||
}
|
||||
}
|
||||
|
||||
// Collect the region
|
||||
hitRegion.setSize(hitSurface.size());
|
||||
hitRegion = -1;
|
||||
hitNormal.setSize(hitSurface.size());
|
||||
hitNormal = vector::zero;
|
||||
|
||||
forAll(surfacesToTest, i)
|
||||
{
|
||||
label surfI = surfacesToTest[i];
|
||||
|
||||
// Collect hits for surfI
|
||||
const labelList localIndices(findIndices(hitSurface, surfI));
|
||||
|
||||
List<pointIndexHit> localHits
|
||||
(
|
||||
UIndirectList<pointIndexHit>
|
||||
(
|
||||
hitInfo,
|
||||
localIndices
|
||||
)
|
||||
);
|
||||
|
||||
// Region
|
||||
labelList localRegion;
|
||||
allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
|
||||
|
||||
forAll(localIndices, i)
|
||||
{
|
||||
hitRegion[localIndices[i]] = localRegion[i];
|
||||
}
|
||||
|
||||
// Normal
|
||||
vectorField localNormal;
|
||||
allGeometry_[surfaces_[surfI]].getNormal(localHits, localNormal);
|
||||
|
||||
forAll(localIndices, i)
|
||||
{
|
||||
hitNormal[localIndices[i]] = localNormal[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// Find intersection with max of edge. Return -1 or the surface
|
||||
//// with the highest maxLevel above currentLevel
|
||||
//Foam::label Foam::refinementSurfaces::findHighestIntersection
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -327,6 +327,19 @@ public:
|
||||
labelList& hitRegion
|
||||
) const;
|
||||
|
||||
//- Find nearest point on surfaces. Return surface, region and
|
||||
// normal on surface (so not global surface)
|
||||
void findNearestRegion
|
||||
(
|
||||
const labelList& surfacesToTest,
|
||||
const pointField& samples,
|
||||
const scalarField& nearestDistSqr,
|
||||
labelList& hitSurface,
|
||||
List<pointIndexHit>& hitInfo,
|
||||
labelList& hitRegion,
|
||||
vectorField& hitNormal
|
||||
) const;
|
||||
|
||||
//- Detect if a point is 'inside' (closed) surfaces.
|
||||
// Returns -1 if not, returns first surface it is.
|
||||
void findInside
|
||||
|
||||
@ -398,7 +398,15 @@ void Foam::decompositionMethod::calcCellCells
|
||||
// Create global cell numbers
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
label nAgglom = max(agglom)+1;
|
||||
label nAgglom;
|
||||
if (agglom.size())
|
||||
{
|
||||
nAgglom = max(agglom)+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nAgglom = 0;
|
||||
}
|
||||
globalIndex globalAgglom(nAgglom);
|
||||
|
||||
const labelList& faceOwner = mesh.faceOwner();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "simpleGeomDecomp.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "SortableList.H"
|
||||
#include "globalIndex.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,7 +54,7 @@ void Foam::simpleGeomDecomp::assignToProcessorGroup
|
||||
(
|
||||
labelList& processorGroup,
|
||||
const label nProcGroup
|
||||
)
|
||||
) const
|
||||
{
|
||||
label jump = processorGroup.size()/nProcGroup;
|
||||
label jumpb = jump + 1;
|
||||
@ -90,7 +91,7 @@ void Foam::simpleGeomDecomp::assignToProcessorGroup
|
||||
const labelList& indices,
|
||||
const scalarField& weights,
|
||||
const scalar summedWeights
|
||||
)
|
||||
) const
|
||||
{
|
||||
// This routine gets the sorted points.
|
||||
// Easiest to explain with an example.
|
||||
@ -126,7 +127,10 @@ void Foam::simpleGeomDecomp::assignToProcessorGroup
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::simpleGeomDecomp::decompose(const pointField& points)
|
||||
Foam::labelList Foam::simpleGeomDecomp::decomposeOneProc
|
||||
(
|
||||
const pointField& points
|
||||
) const
|
||||
{
|
||||
// construct a list for the final result
|
||||
labelList finalDecomp(points.size());
|
||||
@ -195,11 +199,11 @@ Foam::labelList Foam::simpleGeomDecomp::decompose(const pointField& points)
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
Foam::labelList Foam::simpleGeomDecomp::decomposeOneProc
|
||||
(
|
||||
const pointField& points,
|
||||
const scalarField& weights
|
||||
)
|
||||
) const
|
||||
{
|
||||
// construct a list for the final result
|
||||
labelList finalDecomp(points.size());
|
||||
@ -300,4 +304,162 @@ Foam::simpleGeomDecomp::simpleGeomDecomp(const dictionary& decompositionDict)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
(
|
||||
const pointField& points
|
||||
)
|
||||
{
|
||||
if (!Pstream::parRun())
|
||||
{
|
||||
return decomposeOneProc(points);
|
||||
}
|
||||
else
|
||||
{
|
||||
globalIndex globalNumbers(points.size());
|
||||
|
||||
// Collect all points on master
|
||||
if (Pstream::master())
|
||||
{
|
||||
pointField allPoints(globalNumbers.size());
|
||||
|
||||
label nTotalPoints = 0;
|
||||
// Master first
|
||||
SubField<point>(allPoints, points.size()).assign(points);
|
||||
nTotalPoints += points.size();
|
||||
|
||||
// Add slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
pointField nbrPoints(fromSlave);
|
||||
SubField<point>
|
||||
(
|
||||
allPoints,
|
||||
nbrPoints.size(),
|
||||
nTotalPoints
|
||||
).assign(nbrPoints);
|
||||
nTotalPoints += nbrPoints.size();
|
||||
}
|
||||
|
||||
// Decompose
|
||||
labelList finalDecomp(decomposeOneProc(allPoints));
|
||||
|
||||
// Send back
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
OPstream toSlave(Pstream::scheduled, slave);
|
||||
toSlave << SubField<label>
|
||||
(
|
||||
finalDecomp,
|
||||
globalNumbers.localSize(slave),
|
||||
globalNumbers.offset(slave)
|
||||
);
|
||||
}
|
||||
// Get my own part
|
||||
finalDecomp.setSize(points.size());
|
||||
|
||||
return finalDecomp;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Send my points
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< points;
|
||||
}
|
||||
|
||||
// Receive back decomposition
|
||||
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
labelList finalDecomp(fromMaster);
|
||||
|
||||
return finalDecomp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
(
|
||||
const pointField& points,
|
||||
const scalarField& weights
|
||||
)
|
||||
{
|
||||
if (!Pstream::parRun())
|
||||
{
|
||||
return decomposeOneProc(points, weights);
|
||||
}
|
||||
else
|
||||
{
|
||||
globalIndex globalNumbers(points.size());
|
||||
|
||||
// Collect all points on master
|
||||
if (Pstream::master())
|
||||
{
|
||||
pointField allPoints(globalNumbers.size());
|
||||
scalarField allWeights(allPoints.size());
|
||||
|
||||
label nTotalPoints = 0;
|
||||
// Master first
|
||||
SubField<point>(allPoints, points.size()).assign(points);
|
||||
SubField<scalar>(allWeights, points.size()).assign(weights);
|
||||
nTotalPoints += points.size();
|
||||
|
||||
// Add slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
pointField nbrPoints(fromSlave);
|
||||
scalarField nbrWeights(fromSlave);
|
||||
SubField<point>
|
||||
(
|
||||
allPoints,
|
||||
nbrPoints.size(),
|
||||
nTotalPoints
|
||||
).assign(nbrPoints);
|
||||
SubField<scalar>
|
||||
(
|
||||
allWeights,
|
||||
nbrWeights.size(),
|
||||
nTotalPoints
|
||||
).assign(nbrWeights);
|
||||
nTotalPoints += nbrPoints.size();
|
||||
}
|
||||
|
||||
// Decompose
|
||||
labelList finalDecomp(decomposeOneProc(allPoints, allWeights));
|
||||
|
||||
// Send back
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
OPstream toSlave(Pstream::scheduled, slave);
|
||||
toSlave << SubField<label>
|
||||
(
|
||||
finalDecomp,
|
||||
globalNumbers.localSize(slave),
|
||||
globalNumbers.offset(slave)
|
||||
);
|
||||
}
|
||||
// Get my own part
|
||||
finalDecomp.setSize(points.size());
|
||||
|
||||
return finalDecomp;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Send my points
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< points << weights;
|
||||
}
|
||||
|
||||
// Receive back decomposition
|
||||
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
labelList finalDecomp(fromMaster);
|
||||
|
||||
return finalDecomp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,7 +49,7 @@ class simpleGeomDecomp
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
void assignToProcessorGroup(labelList& processorGroup, const label);
|
||||
void assignToProcessorGroup(labelList&, const label) const;
|
||||
|
||||
void assignToProcessorGroup
|
||||
(
|
||||
@ -58,7 +58,15 @@ class simpleGeomDecomp
|
||||
const labelList& indices,
|
||||
const scalarField& weights,
|
||||
const scalar summedWeights
|
||||
);
|
||||
) const;
|
||||
|
||||
labelList decomposeOneProc(const pointField& points) const;
|
||||
|
||||
labelList decomposeOneProc
|
||||
(
|
||||
const pointField& points,
|
||||
const scalarField& weights
|
||||
) const;
|
||||
|
||||
//- Disallow default bitwise copy construct and assignment
|
||||
void operator=(const simpleGeomDecomp&);
|
||||
@ -86,9 +94,9 @@ public:
|
||||
|
||||
virtual bool parallelAware() const
|
||||
{
|
||||
// simpleDecomp does not attempt to do anything across proc
|
||||
// boundaries
|
||||
return false;
|
||||
// simpleDecomp sends all points to the master which does
|
||||
// the decomposition.
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual labelList decompose(const pointField&);
|
||||
|
||||
Reference in New Issue
Block a user