Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2009-08-24 16:21:53 +01:00
24 changed files with 1041 additions and 593 deletions

View File

@ -2987,6 +2987,7 @@ void Foam::autoLayerDriver::addLayers
(
invExpansionRatio,
pp,
labelList(0), // exposed patchIDs, not used for adding layers
nPatchFaceLayers, // layers per face
nPatchPointLayers, // layers per point
firstDisp, // thickness of layer nearest internal mesh

View File

@ -38,6 +38,7 @@ Description
#include "polyModifyFace.H"
#include "polyRemovePoint.H"
#include "polyRemoveFace.H"
#include "indirectPrimitivePatch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -61,7 +62,7 @@ const Foam::scalar Foam::perfectInterface::tol_ = 1E-3;
Foam::pointField Foam::perfectInterface::calcFaceCentres
(
const primitivePatch& pp
const indirectPrimitivePatch& pp
)
{
const pointField& points = pp.points();
@ -155,6 +156,295 @@ bool Foam::perfectInterface::changeTopology() const
}
void Foam::perfectInterface::setRefinement
(
const indirectPrimitivePatch& pp0,
const indirectPrimitivePatch& pp1,
polyTopoChange& ref
) const
{
const polyMesh& mesh = topoChanger().mesh();
const polyBoundaryMesh& patches = mesh.boundaryMesh();
// Some aliases
const edgeList& edges0 = pp0.edges();
const pointField& pts0 = pp0.localPoints();
const pointField& pts1 = pp1.localPoints();
const labelList& meshPts0 = pp0.meshPoints();
const labelList& meshPts1 = pp1.meshPoints();
// Get local dimension as fraction of minimum edge length
scalar minLen = GREAT;
forAll(edges0, edgeI)
{
minLen = min(minLen, edges0[edgeI].mag(pts0));
}
scalar typDim = tol_*minLen;
if (debug)
{
Pout<< "typDim:" << typDim << " edges0:" << edges0.size()
<< " pts0:" << pts0.size() << " pts1:" << pts1.size()
<< " pp0:" << pp0.size() << " pp1:" << pp1.size() << endl;
}
// Determine pointMapping in mesh point labels. Uses geometric
// comparison to find correspondence between patch points.
labelList renumberPoints(mesh.points().size());
forAll(renumberPoints, i)
{
renumberPoints[i] = i;
}
{
labelList from1To0Points(pts1.size());
bool matchOk = matchPoints
(
pts1,
pts0,
scalarField(pts1.size(), typDim), // tolerance
true, // verbose
from1To0Points
);
if (!matchOk)
{
FatalErrorIn
(
"perfectInterface::setRefinement(polyTopoChange& ref) const"
) << "Points on patch sides do not match to within tolerance "
<< typDim << exit(FatalError);
}
forAll(pts1, i)
{
renumberPoints[meshPts1[i]] = meshPts0[from1To0Points[i]];
}
}
// Calculate correspondence between patch faces
labelList from0To1Faces(pp1.size());
bool matchOk = matchPoints
(
calcFaceCentres(pp0),
calcFaceCentres(pp1),
scalarField(pp0.size(), typDim), // tolerance
true, // verbose
from0To1Faces
);
if (!matchOk)
{
FatalErrorIn
(
"perfectInterface::setRefinement(polyTopoChange& ref) const"
) << "Face centres of patch sides do not match to within tolerance "
<< typDim << exit(FatalError);
}
// Now
// - renumber faces using pts1 (except patch1 faces)
// - remove patch1 faces. Remember cell label on owner side.
// - modify patch0 faces to be internal.
// 1. Get faces to be renumbered
labelHashSet affectedFaces(2*pp1.size());
forAll(meshPts1, i)
{
label meshPointI = meshPts1[i];
if (meshPointI != renumberPoints[meshPointI])
{
const labelList& pFaces = mesh.pointFaces()[meshPointI];
forAll(pFaces, pFaceI)
{
affectedFaces.insert(pFaces[pFaceI]);
}
}
}
forAll(pp1, i)
{
affectedFaces.erase(pp1.addressing()[i]);
}
// Remove patch0 from renumbered faces. Should not be nessecary since
// patch0 and 1 should not share any point (if created by mergeMeshing)
// so affectedFaces should not contain any patch0 faces but you can
// never be sure what the user is doing.
forAll(pp0, i)
{
label faceI = pp0.addressing()[i];
if (affectedFaces.erase(faceI))
{
WarningIn
(
"perfectInterface::setRefinement(polyTopoChange&) const"
) << "Found face " << faceI << " vertices "
<< mesh.faces()[faceI] << " whose points are"
<< " used both by master patch and slave patch" << endl;
}
}
// 2. Renumber (non patch0/1) faces.
for
(
labelHashSet::const_iterator iter = affectedFaces.begin();
iter != affectedFaces.end();
++iter
)
{
label faceI = iter.key();
const face& f = mesh.faces()[faceI];
face newFace(f.size());
forAll(newFace, fp)
{
newFace[fp] = renumberPoints[f[fp]];
}
label nbr = -1;
label patchI = -1;
if (mesh.isInternalFace(faceI))
{
nbr = mesh.faceNeighbour()[faceI];
}
else
{
patchI = patches.whichPatch(faceI);
}
label zoneID = mesh.faceZones().whichZone(faceI);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
}
ref.setAction
(
polyModifyFace
(
newFace, // modified face
faceI, // label of face being modified
mesh.faceOwner()[faceI], // owner
nbr, // neighbour
false, // face flip
patchI, // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
}
// 3. Remove patch1 points
forAll(meshPts1, i)
{
label meshPointI = meshPts1[i];
if (meshPointI != renumberPoints[meshPointI])
{
ref.setAction(polyRemovePoint(meshPointI));
}
}
// 4. Remove patch1 faces
forAll(pp1, i)
{
label faceI = pp1.addressing()[i];
ref.setAction(polyRemoveFace(faceI));
}
// 5. Modify patch0 faces for new points (not really nessecary; see
// comment above about patch1 and patch0 never sharing points) and
// becoming internal.
const boolList& mfFlip =
mesh.faceZones()[faceZoneID_.index()].flipMap();
forAll(pp0, i)
{
label faceI = pp0.addressing()[i];
const face& f = mesh.faces()[faceI];
face newFace(f.size());
forAll(newFace, fp)
{
newFace[fp] = renumberPoints[f[fp]];
}
label own = mesh.faceOwner()[faceI];
label pp1FaceI = pp1.addressing()[from0To1Faces[i]];
label nbr = mesh.faceOwner()[pp1FaceI];
if (own < nbr)
{
ref.setAction
(
polyModifyFace
(
newFace, // modified face
faceI, // label of face being modified
own, // owner
nbr, // neighbour
false, // face flip
-1, // patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
mfFlip[i] // face flip in zone
)
);
}
else
{
ref.setAction
(
polyModifyFace
(
newFace.reverseFace(), // modified face
faceI, // label of face being modified
nbr, // owner
own, // neighbour
true, // face flip
-1, // patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
!mfFlip[i] // face flip in zone
)
);
}
}
}
void Foam::perfectInterface::setRefinement(polyTopoChange& ref) const
{
if (debug)
@ -176,286 +466,25 @@ void Foam::perfectInterface::setRefinement(polyTopoChange& ref) const
const polyMesh& mesh = topoChanger().mesh();
const polyBoundaryMesh& patches = mesh.boundaryMesh();
const polyPatch& pp0 = patches[masterPatchID_.index()];
const polyPatch& pp1 = patches[slavePatchID_.index()];
// Some aliases
const edgeList& edges0 = pp0.edges();
const pointField& pts0 = pp0.localPoints();
const pointField& pts1 = pp1.localPoints();
const labelList& meshPts0 = pp0.meshPoints();
const labelList& meshPts1 = pp1.meshPoints();
// Get local dimension as fraction of minimum edge length
scalar minLen = GREAT;
forAll(edges0, edgeI)
{
minLen = min(minLen, edges0[edgeI].mag(pts0));
}
scalar typDim = tol_*minLen;
if (debug)
{
Pout<< "typDim:" << typDim << " edges0:" << edges0.size()
<< " pts0:" << pts0.size() << " pts1:" << pts1.size()
<< " pp0:" << pp0.size() << " pp1:" << pp1.size() << endl;
}
const polyPatch& patch0 = patches[masterPatchID_.index()];
const polyPatch& patch1 = patches[slavePatchID_.index()];
// Determine pointMapping in mesh point labels. Uses geometric
// comparison to find correspondence between patch points.
labelList renumberPoints(mesh.points().size());
forAll(renumberPoints, i)
{
renumberPoints[i] = i;
}
{
labelList from1To0Points(pts1.size());
bool matchOk = matchPoints
(
pts1,
pts0,
scalarField(pts1.size(), typDim), // tolerance
true, // verbose
from1To0Points
);
if (!matchOk)
{
FatalErrorIn
(
"perfectInterface::setRefinement(polyTopoChange& ref) const"
) << "Points on patches " << pp0.name() << " and "
<< pp1.name() << " do not match to within tolerance "
<< typDim << exit(FatalError);
}
forAll(pts1, i)
{
renumberPoints[meshPts1[i]] = meshPts0[from1To0Points[i]];
}
}
// Calculate correspondence between patch faces
labelList from0To1Faces(pp1.size());
bool matchOk = matchPoints
labelList pp0Labels(identity(patch0.size())+patch0.start());
indirectPrimitivePatch pp0
(
calcFaceCentres(pp0),
calcFaceCentres(pp1),
scalarField(pp0.size(), typDim), // tolerance
true, // verbose
from0To1Faces
IndirectList<face>(mesh.faces(), pp0Labels),
mesh.points()
);
if (!matchOk)
{
FatalErrorIn
(
"perfectInterface::setRefinement(polyTopoChange& ref) const"
) << "Face centres of patches " << pp0.name() << " and "
<< pp1.name() << " do not match to within tolerance " << typDim
<< exit(FatalError);
}
// Now
// - renumber faces using pts1 (except patch1 faces)
// - remove patch1 faces. Remember cell label on owner side.
// - modify patch0 faces to be internal.
// 1. Get faces to be renumbered
labelHashSet affectedFaces(2*pp1.size());
forAll(meshPts1, i)
{
label meshPointI = meshPts1[i];
if (meshPointI != renumberPoints[meshPointI])
{
const labelList& pFaces = mesh.pointFaces()[meshPointI];
forAll(pFaces, pFaceI)
{
affectedFaces.insert(pFaces[pFaceI]);
}
}
}
forAll(pp1, i)
{
affectedFaces.erase(pp1.start() + i);
}
// Remove patch0 from renumbered faces. Should not be nessecary since
// patch0 and 1 should not share any point (if created by mergeMeshing)
// so affectedFaces should not contain any patch0 faces but you can
// never be sure what the user is doing.
forAll(pp0, i)
{
if (affectedFaces.erase(pp0.start() + i))
{
WarningIn
(
"perfectInterface::setRefinement(polyTopoChange&) const"
) << "Found face " << pp0.start() + i << " vertices "
<< mesh.faces()[pp0.start() + i] << " whose points are"
<< " used both by master patch " << pp0.name()
<< " and slave patch " << pp1.name()
<< endl;
}
}
// 2. Renumber (non patch0/1) faces.
for
labelList pp1Labels(identity(patch1.size())+patch1.start());
indirectPrimitivePatch pp1
(
labelHashSet::const_iterator iter = affectedFaces.begin();
iter != affectedFaces.end();
++iter
)
{
label faceI = iter.key();
IndirectList<face>(mesh.faces(), pp1Labels),
mesh.points()
);
const face& f = mesh.faces()[faceI];
face newFace(f.size());
forAll(newFace, fp)
{
newFace[fp] = renumberPoints[f[fp]];
}
label nbr = -1;
label patchI = -1;
if (mesh.isInternalFace(faceI))
{
nbr = mesh.faceNeighbour()[faceI];
}
else
{
patchI = patches.whichPatch(faceI);
}
label zoneID = mesh.faceZones().whichZone(faceI);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = mesh.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
}
ref.setAction
(
polyModifyFace
(
newFace, // modified face
faceI, // label of face being modified
mesh.faceOwner()[faceI], // owner
nbr, // neighbour
false, // face flip
patchI, // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
}
// 3. Remove patch1 points
forAll(meshPts1, i)
{
label meshPointI = meshPts1[i];
if (meshPointI != renumberPoints[meshPointI])
{
ref.setAction(polyRemovePoint(meshPointI));
}
}
// 4. Remove patch1 faces
forAll(pp1, i)
{
ref.setAction(polyRemoveFace(pp1.start() + i));
}
// 5. Modify patch0 faces for new points (not really nessecary; see
// comment above about patch1 and patch0 never sharing points) and
// becoming internal.
const boolList& mfFlip =
mesh.faceZones()[faceZoneID_.index()].flipMap();
forAll(pp0, i)
{
label faceI = pp0.start() + i;
const face& f = mesh.faces()[faceI];
face newFace(f.size());
forAll(newFace, fp)
{
newFace[fp] = renumberPoints[f[fp]];
}
label own = mesh.faceOwner()[faceI];
label pp1FaceI = pp1.start() + from0To1Faces[i];
label nbr = mesh.faceOwner()[pp1FaceI];
if (own < nbr)
{
ref.setAction
(
polyModifyFace
(
newFace, // modified face
faceI, // label of face being modified
own, // owner
nbr, // neighbour
false, // face flip
-1, // patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
mfFlip[i] // face flip in zone
)
);
}
else
{
ref.setAction
(
polyModifyFace
(
newFace.reverseFace(), // modified face
faceI, // label of face being modified
nbr, // owner
own, // neighbour
false, // face flip
-1, // patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
!mfFlip[i] // face flip in zone
)
);
}
}
setRefinement(pp0, pp1, ref);
}
}

View File

@ -40,6 +40,7 @@ SourceFiles
#include "polyMeshModifier.H"
#include "polyPatchID.H"
#include "ZoneIDs.H"
#include "indirectPrimitivePatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -75,7 +76,7 @@ class perfectInterface
// Private Member Functions
//- Calculate face centres on patch
static pointField calcFaceCentres(const primitivePatch&);
static pointField calcFaceCentres(const indirectPrimitivePatch&);
//- Disallow default bitwise copy construct
@ -128,6 +129,17 @@ public:
// into the topological change
virtual void setRefinement(polyTopoChange&) const;
//- Insert the layer addition/removal instructions
// into the topological change. Uses only mesh, not any of the
// patch and zone indices. Bit of a workaround - used in extruding
// a mesh.
virtual void setRefinement
(
const indirectPrimitivePatch& pp0,
const indirectPrimitivePatch& pp1,
polyTopoChange&
) const;
//- Modify motion points to comply with the topological change
virtual void modifyMotionPoints(pointField& motionPoints) const;

View File

@ -335,17 +335,19 @@ Foam::label Foam::addPatchCellLayer::addSideFace
label inflateEdgeI = -1;
// Check mesh faces using edge
forAll(meshFaces, i)
if (addToMesh_)
{
if (mesh_.isInternalFace(meshFaces[i]))
forAll(meshFaces, i)
{
// meshEdge uses internal faces so ok to inflate from it
inflateEdgeI = meshEdgeI;
break;
if (mesh_.isInternalFace(meshFaces[i]))
{
// meshEdge uses internal faces so ok to inflate from it
inflateEdgeI = meshEdgeI;
break;
}
}
}
// Get my mesh face and its zone.
label meshFaceI = pp.addressing()[ownFaceI];
label zoneI = mesh_.faceZones().whichZone(meshFaceI);
@ -504,9 +506,14 @@ Foam::label Foam::addPatchCellLayer::addSideFace
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from mesh
Foam::addPatchCellLayer::addPatchCellLayer(const polyMesh& mesh)
Foam::addPatchCellLayer::addPatchCellLayer
(
const polyMesh& mesh,
const bool addToMesh
)
:
mesh_(mesh),
addToMesh_(addToMesh),
addedPoints_(0),
layerFaces_(0)
{}
@ -551,6 +558,7 @@ void Foam::addPatchCellLayer::setRefinement
(
const scalarField& expansionRatio,
const indirectPrimitivePatch& pp,
const labelList& exposedPatchID,
const labelList& nFaceLayers,
const labelList& nPointLayers,
const vectorField& firstLayerDisp,
@ -827,6 +835,19 @@ void Foam::addPatchCellLayer::setRefinement
}
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
// Precalculated patchID for each patch face
labelList patchID(pp.size());
forAll(pp, patchFaceI)
{
label meshFaceI = pp.addressing()[patchFaceI];
patchID[patchFaceI] = patches.whichPatch(meshFaceI);
}
// From master point (in patch point label) to added points (in mesh point
// label)
addedPoints_.setSize(pp.nPoints());
@ -857,6 +878,33 @@ void Foam::addPatchCellLayer::setRefinement
// Create new points
//
// If creating new mesh: copy existing patch points
labelList copiedPatchPoints;
if (!addToMesh_)
{
copiedPatchPoints.setSize(firstLayerDisp.size());
forAll(firstLayerDisp, patchPointI)
{
if (addedPoints_[patchPointI].size())
{
label meshPointI = meshPoints[patchPointI];
label zoneI = mesh_.pointZones().whichZone(meshPointI);
copiedPatchPoints[patchPointI] = meshMod.setAction
(
polyAddPoint
(
mesh_.points()[meshPointI], // point
-1, // master point
zoneI, // zone for point
true // supports a cell
)
);
}
}
}
// Create points for additional layers
forAll(firstLayerDisp, patchPointI)
{
if (addedPoints_[patchPointI].size())
@ -878,7 +926,7 @@ void Foam::addPatchCellLayer::setRefinement
polyAddPoint
(
pt, // point
meshPointI, // master point
(addToMesh_ ? meshPointI : -1), // master point
zoneI, // zone for point
true // supports a cell
)
@ -922,34 +970,15 @@ void Foam::addPatchCellLayer::setRefinement
-1, // master point
-1, // master edge
-1, // master face
mesh_.faceOwner()[meshFaceI], // master cell id
(addToMesh_ ? mesh_.faceOwner()[meshFaceI] : -1),//master
ownZoneI // zone for cell
)
);
//Pout<< "For patchFace:" << patchFaceI
// << " meshFace:" << pp.addressing()[patchFaceI]
// << " layer:" << i << " added cell:"
// << addedCells[patchFaceI][i]
// << endl;
}
}
}
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
// Precalculated patchID for each patch face
labelList patchID(pp.size());
forAll(pp, patchFaceI)
{
label meshFaceI = pp.addressing()[patchFaceI];
patchID[patchFaceI] = patches.whichPatch(meshFaceI);
}
// Create faces on top of the original patch faces.
// These faces are created from original patch faces outwards so in order
@ -965,7 +994,6 @@ void Foam::addPatchCellLayer::setRefinement
if (addedCells[patchFaceI].size())
{
layerFaces_[patchFaceI].setSize(addedCells[patchFaceI].size() + 1);
layerFaces_[patchFaceI][0] = meshFaceI;
label zoneI = mesh_.faceZones().whichZone(meshFaceI);
@ -981,7 +1009,12 @@ void Foam::addPatchCellLayer::setRefinement
if (addedPoints_[f[fp]].empty())
{
// Keep original point
newFace[fp] = meshPoints[f[fp]];
newFace[fp] =
(
addToMesh_
? meshPoints[f[fp]]
: copiedPatchPoints[f[fp]]
);
}
else
{
@ -1021,18 +1054,13 @@ void Foam::addPatchCellLayer::setRefinement
nei, // neighbour
-1, // master point
-1, // master edge
meshFaceI, // master face for addition
(addToMesh_ ? meshFaceI : -1), // master face
false, // flux flip
patchI, // patch for face
zoneI, // zone for face
false // face zone flip
)
);
//Pout<< "Added inbetween face " << newFace
// << " own:" << addedCells[patchFaceI][i]
// << " nei:" << nei
// << " patch:" << patchI
// << endl;
}
}
}
@ -1040,35 +1068,81 @@ void Foam::addPatchCellLayer::setRefinement
//
// Modify old patch faces to be on the inside
//
forAll(pp, patchFaceI)
if (addToMesh_)
{
if (addedCells[patchFaceI].size())
forAll(pp, patchFaceI)
{
label meshFaceI = pp.addressing()[patchFaceI];
if (addedCells[patchFaceI].size())
{
label meshFaceI = pp.addressing()[patchFaceI];
label zoneI = mesh_.faceZones().whichZone(meshFaceI);
layerFaces_[patchFaceI][0] = meshFaceI;
meshMod.setAction
(
polyModifyFace
label zoneI = mesh_.faceZones().whichZone(meshFaceI);
meshMod.setAction
(
pp[patchFaceI], // modified face
meshFaceI, // label of face
mesh_.faceOwner()[meshFaceI], // owner
addedCells[patchFaceI][0], // neighbour
false, // face flip
-1, // patch for face
false, // remove from zone
zoneI, // zone for face
false // face flip in zone
)
);
//Pout<< "Modified old patch face " << meshFaceI
// << " own:" << mesh_.faceOwner()[meshFaceI]
// << " nei:" << addedCells[patchFaceI][0]
// << endl;
polyModifyFace
(
pp[patchFaceI], // modified face
meshFaceI, // label of face
mesh_.faceOwner()[meshFaceI], // owner
addedCells[patchFaceI][0], // neighbour
false, // face flip
-1, // patch for face
false, // remove from zone
zoneI, // zone for face
false // face flip in zone
)
);
}
}
}
else
{
// If creating new mesh: reverse original faces and put them
// in the exposed patch ID.
forAll(pp, patchFaceI)
{
if (nFaceLayers[patchFaceI] > 0)
{
label meshFaceI = pp.addressing()[patchFaceI];
label zoneI = mesh_.faceZones().whichZone(meshFaceI);
bool zoneFlip = false;
if (zoneI != -1)
{
const faceZone& fz = mesh_.faceZones()[zoneI];
zoneFlip = !fz.flipMap()[fz.whichFace(meshFaceI)];
}
// Reverse and renumber old patch face.
face f(pp.localFaces()[patchFaceI].reverseFace());
forAll(f, fp)
{
f[fp] = copiedPatchPoints[f[fp]];
}
layerFaces_[patchFaceI][0] = meshMod.setAction
(
polyAddFace
(
f, // modified face
addedCells[patchFaceI][0], // owner
-1, // neighbour
-1, // masterPoint
-1, // masterEdge
-1, // masterFace
true, // face flip
exposedPatchID[patchFaceI], // patch for face
zoneI, // zone for face
zoneFlip // face flip in zone
)
);
}
}
}
//
@ -1255,7 +1329,16 @@ void Foam::addPatchCellLayer::setRefinement
forAll(stringedVerts, stringedI)
{
label v = stringedVerts[stringedI];
addVertex(meshPoints[v], newFace, newFp);
addVertex
(
(
addToMesh_
? meshPoints[v]
: copiedPatchPoints[v]
),
newFace,
newFp
);
}
}
else
@ -1276,7 +1359,16 @@ void Foam::addPatchCellLayer::setRefinement
}
else
{
addVertex(meshPoints[v], newFace, newFp);
addVertex
(
(
addToMesh_
? meshPoints[v]
: copiedPatchPoints[v]
),
newFace,
newFp
);
}
}
}
@ -1316,7 +1408,16 @@ void Foam::addPatchCellLayer::setRefinement
}
else
{
addVertex(meshPoints[v], newFace, newFp);
addVertex
(
(
addToMesh_
? meshPoints[v]
: copiedPatchPoints[v]
),
newFace,
newFp
);
}
}

View File

@ -26,7 +26,8 @@ Class
Foam::addPatchCellLayer
Description
Adds layers of cells to outside of polyPatch.
Adds layers of cells to outside of polyPatch. Can optionally create
stand-alone extruded mesh (addToMesh=false).
Call setRefinement with offset vector for every patch point and number
of layers per patch face and number of layers per patch point.
@ -164,6 +165,9 @@ class addPatchCellLayer
//- Reference to mesh
const polyMesh& mesh_;
//- Add layers to existing mesh or create new mesh
const bool addToMesh_;
//- For all patchpoints: list of added points (size 0 or nLayers)
// First point in list is one nearest to original point in patch,
// last one is the new point on the surface.
@ -253,7 +257,7 @@ public:
// Constructors
//- Construct from mesh.
addPatchCellLayer(const polyMesh& mesh);
addPatchCellLayer(const polyMesh& mesh, const bool addToMesh = true);
// Member Functions
@ -291,8 +295,10 @@ public:
//- Play commands into polyTopoChange to create layers on top
// of indirectPrimitivePatch (have to be outside faces).
// Gets displacement per patch point.
// - nPointLayers : number of layers per (patch)point
// - nFaceLayers : number of layers per (patch) face
// - exposedPatchID : only used if creating a new mesh (addToMesh=false)
// gives per pp face the patch the exposed face should get.
// - nPointLayers : number of layers per (patch)point.
// - nFaceLayers : number of layers per (patch) face.
// - firstDisplacement : displacement per point for first
// layer of points (i.e. nearest to original mesh). If zero
// do not add point.
@ -305,14 +311,15 @@ public:
// get a cell should firstDisplacement be <> 0
// Note: cells get added from owner cells of patch faces
// (instead of e.g. from patch faces)
void setRefinement
(
const scalarField& expansionRatio,
const indirectPrimitivePatch& pp,
const labelList& nFaceLayers,
const labelList& nPointLayers,
const vectorField& firstLayerDisp,
polyTopoChange& meshMod
void setRefinement
(
const scalarField& expansionRatio,
const indirectPrimitivePatch& pp,
const labelList& exposedPatchID,
const labelList& nFaceLayers,
const labelList& nPointLayers,
const vectorField& firstLayerDisp,
polyTopoChange& meshMod
);
@ -329,6 +336,7 @@ public:
(
scalarField(pp.nPoints(), 1.0), // expansion ration
pp,
labelList(0),
labelList(pp.size(), nLayers),
labelList(pp.nPoints(), nLayers),
overallDisplacement / nLayers,

View File

@ -749,6 +749,11 @@ void Foam::polyTopoChange::getFaceOrder
" const"
) << "Did not determine new position"
<< " for face " << faceI
<< " owner " << faceOwner_[faceI]
<< " neighbour " << faceNeighbour_[faceI]
<< " region " << region_[faceI] << endl
<< "This is usually caused by not specifying a patch for"
<< " a boundary face."
<< abort(FatalError);
}
}
@ -3176,7 +3181,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::makeMesh
(
autoPtr<fvMesh>& newMeshPtr,
const IOobject& io,
const fvMesh& mesh,
const polyMesh& mesh,
const bool syncParallel,
const bool orderCells,
const bool orderPoints

View File

@ -585,7 +585,7 @@ public:
(
autoPtr<fvMesh>& newMesh,
const IOobject& io,
const fvMesh& mesh,
const polyMesh& mesh,
const bool syncParallel = true,
const bool orderCells = false,
const bool orderPoints = false

View File

@ -48,7 +48,8 @@ int Foam::fileFormats::STLsurfaceFormatCore::detectBINARY
{
off_t dataFileSize = Foam::fileSize(filename);
istream& is = IFstream(filename, IOstream::BINARY)().stdStream();
IFstream str(filename, IOstream::BINARY);
istream& is = str().stdStream();
// Read the STL header
char header[headerSize];