initial changes to compile src

This commit is contained in:
mattijs
2009-08-04 18:32:32 +01:00
parent 2dbf42085d
commit 3ca538421d
71 changed files with 3561 additions and 2713 deletions

View File

@ -300,7 +300,11 @@ label mergePatchFaces
const faceZone& fZone = mesh.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(newMasterI)];
}
label patchI = mesh.boundaryMesh().whichPatch(newMasterI);
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
newMasterI
);
Pout<< "Restoring new master face " << newMasterI
@ -316,10 +320,11 @@ label mergePatchFaces
own, // owner
-1, // neighbour
false, // face flip
patchI, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
patchIDs[1] // subPatch
)
);
@ -341,9 +346,10 @@ label mergePatchFaces
-1, // masterEdgeID,
newMasterI, // masterFaceID,
false, // flipFaceFlux,
patchI, // patchID,
patchIDs[0], // patchID,
zoneID, // zoneID,
zoneFlip // zoneFlip
zoneFlip, // zoneFlip
patchIDs[1] // subPatch
)
);
}

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "cellSplitter.H"
@ -51,17 +49,12 @@ defineTypeNameAndDebug(cellSplitter, 0);
void Foam::cellSplitter::getFaceInfo
(
const label faceI,
label& patchID,
labelPair& patchIDs,
label& zoneID,
label& zoneFlip
) const
{
patchID = -1;
if (!mesh_.isInternalFace(faceI))
{
patchID = mesh_.boundaryMesh().whichPatch(faceI);
}
patchIDs = polyTopoChange::whichPatch(mesh_.boundaryMesh(), faceI);
zoneID = mesh_.faceZones().whichZone(faceI);
@ -172,17 +165,16 @@ void Foam::cellSplitter::setRefinement
label anchorPoint = mesh_.cellPoints()[cellI][0];
label addedPointI =
meshMod.setAction
label addedPointI = meshMod.setAction
(
polyAddPoint
(
polyAddPoint
(
iter(), // point
anchorPoint, // master point
-1, // zone for point
true // supports a cell
)
);
iter(), // point
anchorPoint, // master point
-1, // zone for point
true // supports a cell
)
);
addedPoints_.insert(cellI, addedPointI);
//Pout<< "Added point " << addedPointI
@ -212,18 +204,17 @@ void Foam::cellSplitter::setRefinement
// Add other pyramids
for (label i = 1; i < cFaces.size(); i++)
{
label addedCellI =
meshMod.setAction
label addedCellI = meshMod.setAction
(
polyAddCell
(
polyAddCell
(
-1, // master point
-1, // master edge
-1, // master face
cellI, // master cell
-1 // zone
)
);
-1, // master point
-1, // master edge
-1, // master face
cellI, // master cell
-1 // zone
)
);
newCells[i] = addedCellI;
}
@ -310,7 +301,8 @@ void Foam::cellSplitter::setRefinement
false, // flux flip
-1, // patch for face
-1, // zone for face
false // face zone flip
false, // face zone flip
-1 // subPatch
)
);
}
@ -356,7 +348,8 @@ void Foam::cellSplitter::setRefinement
false, // flux flip
-1, // patch for face
-1, // zone for face
false // face zone flip
false, // face zone flip
-1 // subPatch
)
);
}
@ -411,7 +404,8 @@ void Foam::cellSplitter::setRefinement
-1, // patch for face
false, // remove from zone
-1, // zone for face
false // face zone flip
false, // face zone flip
-1 // subPatch
)
);
}
@ -429,7 +423,8 @@ void Foam::cellSplitter::setRefinement
-1, // patch for face
false, // remove from zone
-1, // zone for face
false // face zone flip
false, // face zone flip
-1 // subPatch
)
);
}
@ -439,8 +434,9 @@ void Foam::cellSplitter::setRefinement
{
label newOwn = newOwner(faceI, cellToCells);
label patchID, zoneID, zoneFlip;
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
labelPair patchIDs;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
meshMod.setAction
(
@ -451,10 +447,11 @@ void Foam::cellSplitter::setRefinement
newOwn, // owner
-1, // neighbour
false, // flux flip
patchID, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face zone flip
zoneFlip, // face zone flip
patchIDs[1]
)
);
}

View File

@ -39,6 +39,7 @@ SourceFiles
#include "Map.H"
#include "edge.H"
#include "labelPair.H"
#include "typeInfo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -73,7 +74,7 @@ class cellSplitter
void getFaceInfo
(
const label faceI,
label& patchID,
labelPair& patchIDs,
label& zoneID,
label& zoneFlip
) const;

View File

@ -1124,7 +1124,8 @@ int main(int argc, char *argv[])
false, // flipFaceFlux
-1, // patchID
faceZonei, // zoneID
false // zoneFlip
false, // zoneFlip
-1 // subPatchID
);
// Mark face as being done
@ -1158,7 +1159,8 @@ int main(int argc, char *argv[])
false, // flipFaceFlux
patchi, // patchID
-1, // zoneID
false // zoneFlip
false, // zoneFlip
-1 // subPatchID
);
// For baffles create the opposite face
@ -1175,7 +1177,8 @@ int main(int argc, char *argv[])
false, // flipFaceFlux
patchi, // patchID
-1, // zoneID
false // zoneFlip
false, // zoneFlip
-1 // subPatchID
);
}
@ -1203,13 +1206,14 @@ int main(int argc, char *argv[])
faces[facei],
owner[facei],
neighbour[facei],
-1, //masterPointID
-1, //masterEdgeID
facei, //masterFace
false, //flipFaceFlux
-1, //patchID
-1, //zoneID
false //zoneFlip
-1, // masterPointID
-1, // masterEdgeID
facei, // masterFace
false, // flipFaceFlux
-1, // patchID
-1, // zoneID
false, // zoneFlip
-1 // subPatchID
);
}
}

View File

@ -136,7 +136,8 @@ void Foam::extrude2DMesh::setRefinement
false, // flipFaceFlux
-1, // patchID
zoneID, // zoneID
zoneFlip // zoneFlip
zoneFlip, // zoneFlip
-1 // subPatchID
);
}
@ -173,7 +174,8 @@ void Foam::extrude2DMesh::setRefinement
false, // flipFaceFlux
patchI, // patchID
zoneID, // zoneID
zoneFlip // zoneFlip
zoneFlip, // zoneFlip
-1 //?TBD subPatchID
);
}
}
@ -236,7 +238,8 @@ void Foam::extrude2DMesh::setRefinement
false, // flipFaceFlux
frontPatchI, // patchID
-1, // zoneID
false // zoneFlip
false, // zoneFlip
-1 //?TDB subPatchID
);
// Offset to create front face.
@ -255,7 +258,8 @@ void Foam::extrude2DMesh::setRefinement
false, // flipFaceFlux
frontPatchI, // patchID
-1, // zoneID
false // zoneFlip
false, // zoneFlip
-1 //?TDB subPatchID
);
}
}

View File

@ -9,5 +9,4 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-L$(FOAM_MPI_LIBBIN) -lparMetisDecompositionMethod \
-lautoMesh

View File

@ -18,16 +18,16 @@ wmake libso finiteVolume
( cd decompositionAgglomeration && ./Allwmake )
#wmake libso sampling
wmake libso sampling
wmake libso dynamicMesh
#wmake libso dynamicFvMesh
#wmake libso topoChangerFvMesh
#wmake libso fvMotionSolver
#wmake libso engine
#
#wmake libso ODE
#wmake libso randomProcesses
wmake libso dynamicFvMesh
wmake libso topoChangerFvMesh
wmake libso fvMotionSolver
wmake libso engine
wmake libso ODE
wmake libso randomProcesses
( cd thermophysicalModels && ./Allwmake )
( cd transportModels && ./Allwmake )
@ -36,7 +36,7 @@ wmake libso dynamicMesh
( cd postProcessing && ./Allwmake )
( cd conversion && ./Allwmake )
#wmake libso autoMesh
#wmake libso errorEstimation
wmake libso autoMesh
wmake libso errorEstimation
# ----------------------------------------------------------------- end-of-file

View File

@ -26,6 +26,7 @@ License
#include "cyclicPointPatchField.H"
#include "Swap.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -124,6 +125,13 @@ cyclicPointPatchField<Type>::cyclicPointPatchField
template<class Type>
void cyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const
{
// Get neighbouring pointPatch
const cyclicPointPatch& nbrPatch = cyclicPatch_.neighbPatch();
// Get neighbouring patch internal field. Written out since cannot get
// access to neighbouring patch field.
Field<Type> nbrPf(pField, nbrPatch.meshPoints());
Field<Type> pf(this->patchInternalField(pField));
const edgeList& pairs = cyclicPatch_.transformPairs();
@ -132,16 +140,14 @@ void cyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const
{
forAll(pairs, pairi)
{
Type tmp = pf[pairs[pairi][0]];
pf[pairs[pairi][0]] = transform(forwardT(), pf[pairs[pairi][1]]);
pf[pairs[pairi][1]] = transform(reverseT(), tmp);
pf[pairs[pairi][0]] = transform(forwardT(), nbrPf[pairs[pairi][1]]);
}
}
else
{
forAll(pairs, pairi)
{
Swap(pf[pairs[pairi][0]], pf[pairs[pairi][1]]);
pf[pairs[pairi][0]] = nbrPf[pairs[pairi][1]];
}
}

View File

@ -144,15 +144,7 @@ tmp<Field<Type1> > pointPatchField<Type>::patchInternalField
// get addressing
const labelList& meshPoints = patch().meshPoints();
tmp<Field<Type1> > tvalues(new Field<Type1>(meshPoints.size()));
Field<Type1>& values = tvalues();
forAll (meshPoints, pointI)
{
values[pointI] = iF[meshPoints[pointI]];
}
return tvalues;
return tmp<Field<Type1> >(new Field<Type1>(iF, meshPoints));
}

View File

@ -38,6 +38,7 @@ SourceFiles
#include "coupledFacePointPatch.H"
#include "cyclicPolyPatch.H"
#include "pointBoundaryMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -123,6 +124,14 @@ public:
return cyclicPolyPatch_;
}
//- Return neighbour point patch
const cyclicPointPatch& neighbPatch() const
{
label patchI = cyclicPolyPatch_.neighbPatchID();
const pointPatch& pp = this->boundaryMesh()[patchI];
return refCast<const cyclicPointPatch>(pp);
}
//- Are the cyclic planes parallel
bool parallel() const
{
@ -145,7 +154,8 @@ public:
// Access functions for demand driven data
//- Return the set of pairs of points that require transformation
// and/or mapping
// and/or mapping. First index is on this patch, second on the
// neighbour patch.
virtual const edgeList& transformPairs() const;
};

View File

@ -132,7 +132,7 @@ public:
// associated with any faces
virtual const labelList& loneMeshPoints() const;
//- Return point unit normals. Not impelemented.
//- Return point unit normals. Not implemented.
virtual const vectorField& pointNormals() const;
};

View File

@ -39,6 +39,7 @@ SourceFiles
#define coupledPolyPatch_H
#include "polyPatch.H"
#include "diagTensorField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -231,20 +232,34 @@ public:
return true;
}
//- Are the planes separated.
virtual bool separated() const = 0;
//- Transform a patch-based field.
//!! TDB with macros?
virtual void transform(scalarField& l) const = 0;
virtual void transform(vectorField& l) const = 0;
virtual void transform(sphericalTensorField& l) const = 0;
virtual void transform(diagTensorField& l) const = 0;
virtual void transform(symmTensorField& l) const = 0;
virtual void transform(tensorField& l) const = 0;
//- If the planes are separated the separation vector.
virtual const vector& separation() const = 0;
//- Transform a patch-based position
virtual void transformPosition(pointField& l) const = 0;
//- Are the cyclic planes parallel.
virtual bool parallel() const = 0;
// Low level geometric information
//- Return face transformation tensor.
virtual const tensor& forwardT() const = 0;
//- Are the planes separated.
virtual bool separated() const = 0;
//- Return neighbour-cell transformation tensor.
virtual const tensor& reverseT() const = 0;
//- If the planes are separated the separation vector.
virtual const vector& separation() const = 0;
//- Are the cyclic planes parallel.
virtual bool parallel() const = 0;
//- Return face transformation tensor.
virtual const tensor& forwardT() const = 0;
//- Return neighbour-cell transformation tensor.
virtual const tensor& reverseT() const = 0;
//- Initialise the calculation of the patch geometry

View File

@ -30,11 +30,10 @@ Description
Note: morph patch face ordering uses geometric matching so with the
following restrictions:
-halves should be flat planes.
-coupled patches should be flat planes.
-no rotation in patch plane
Uses a featureCos to find the two halves (or should be fully
disconnected). Uses coupledPolyPatch::calcFaceTol to calculate
Uses coupledPolyPatch::calcFaceTol to calculate
tolerance per face which might need tweaking.
Switch on 'cyclicPolyPatch' debug flag to write .obj files to show
@ -49,11 +48,12 @@ SourceFiles
#define cyclicPolyPatch_H
#include "coupledPolyPatch.H"
#include "SubField.H"
#include "FixedList.H"
//#include "SubField.H"
//#include "FixedList.H"
#include "edgeList.H"
#include "transform.H"
//#include "transform.H"
#include "polyBoundaryMesh.H"
#include "diagTensorField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -92,19 +92,6 @@ private:
mutable label neighbPatchID_;
//- List of edges formed from connected points. e[0] is the point on
// the first half of the patch, e[1] the corresponding point on the
// second half.
mutable edgeList* coupledPointsPtr_;
//- List of connected edges. e[0] is the edge on the first half of the
// patch, e[1] the corresponding edge on the second half.
mutable edgeList* coupledEdgesPtr_;
//- Morph:angle between normals of neighbouring faces.
// Used to split cyclic into halves.
scalar featureCos_;
//- Type of transformation - rotational or translational
transformType transform_;
@ -115,6 +102,18 @@ private:
point rotationCentre_;
//- List of edges formed from connected points. e[0] is the point on
// the first half of the patch, e[1] the corresponding point on the
// second half.
mutable edgeList* coupledPointsPtr_;
//- List of connected edges. e[0] is the edge on the first half of the
// patch, e[1] the corresponding edge on the second half.
mutable edgeList* coupledEdgesPtr_;
//- Temporary storage of owner side patch during ordering.
mutable autoPtr<primitivePatch> ownerPatchPtr_;
// Transformation
//- Has non-zero separation
@ -152,21 +151,11 @@ private:
// Face ordering
//- Find the two parts of the faces of pp using feature edges.
// Returns true if successfull.
bool getGeometricHalves
(
const primitivePatch&,
labelList&,
labelList&
) const;
//- Calculate geometric factors of the two halves.
void getCentresAndAnchors
(
const primitivePatch&,
const faceList& half0Faces,
const faceList& half1Faces,
const primitivePatch& pp0,
const primitivePatch& pp1,
pointField& half0Ctrs,
pointField& half1Ctrs,
@ -174,29 +163,9 @@ private:
scalarField& tols
) const;
//- Given matched faces matches the anchor point. Sets faceMap,
// rotation. Returns true if all matched.
bool matchAnchors
(
const bool report,
const primitivePatch&,
const labelList&,
const pointField&,
const labelList&,
const faceList&,
const labelList&,
const scalarField&,
labelList& faceMap,
labelList& rotation
) const;
//- For rotational cases, try to find a unique face on each side
// of the cyclic.
label getConsistentRotationFace
(
const pointField& faceCentres
) const;
label getConsistentRotationFace(const pointField&) const;
protected:
@ -364,74 +333,107 @@ public:
return refCast<const cyclicPolyPatch>(pp);
}
//- Return connected points (in patch local point indexing). Demand
// driven calculation. Does primitivePatch::clearOut after calculation!
//- Return connected points (from patch local to neighbour patch local)
// Demand driven calculation. Does primitivePatch::clearOut after
// calculation!
const edgeList& coupledPoints() const;
//- Return connected edges (in patch local edge indexing). Demand
// driven calculation. Does primitivePatch::clearOut after calculation!
//- Return connected edges (from patch local to neighbour patch local).
// Demand driven calculation. Does primitivePatch::clearOut after
// calculation!
const edgeList& coupledEdges() const;
//- Are the coupled planes separated
virtual bool separated() const
//- Transform a patch-based field on this side to a field on the
// other side.
template<class T>
void transform(Field<T>& l) const
{
return separated_;
if (!parallel())
{
transform(reverseT_, l);
}
}
virtual void transform(scalarField& l) const
{
transform(l);
}
virtual void transform(vectorField& l) const
{
transform(l);
}
virtual void transform(sphericalTensorField& l) const
{
transform(l);
}
virtual void transform(diagTensorField& l) const
{
transform(l);
}
virtual void transform(symmTensorField& l) const
{
transform(l);
}
virtual void transform(tensorField& l) const
{
transform(l);
}
virtual const vector& separation() const
{
return separation_;
}
//- Transform a patch-based position on this side to a position
// the other side.
virtual void transformPosition(pointField& l) const;
//- Are the cyclic planes parallel
virtual bool parallel() const
{
return parallel_;
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
{
return forwardT_;
}
// Low level geometric information
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return reverseT_;
}
//- Are the coupled planes separated
virtual bool separated() const
{
return separated_;
}
virtual const vector& separation() const
{
return separation_;
}
//- Are the cyclic planes parallel
virtual bool parallel() const
{
return parallel_;
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
{
return forwardT_;
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return reverseT_;
}
label transformGlobalFace(const label facei) const
{
label offset = facei-start();
label neighbStart = neighbPatch().start();
//label neighbSize = neighbPatch().size();
//label neighbOffset = facei-neighbStart;
if (offset >= 0 && offset < size())
{
return neighbStart+offset;
}
//else if (neighbOffset >= 0 && neighbOffset < neighbSize)
//{
// return start()+neighbOffset;
//}
else
{
FatalErrorIn
(
"cyclicPolyPatch::transformGlobalFace(const label) const"
) << "Face " << facei << " not in patch " << name()
//<< " nor in patch " << neighbPatch().name()
<< exit(FatalError);
return -1;
}
}
////- Transform a position on a (local) face
//virtual void transformPosition(point&, const label facei) const;
//- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.)
virtual void initOrder(const primitivePatch&) const;

View File

@ -68,6 +68,18 @@ void Foam::processorPolyPatch::checkSubPatches() const
<< "starts:" << starts_ << " size:" << size()
<< exit(FatalError);
}
// If there are any faces from internal they should be first.
for (label i = 1; i < patchIDs_.size(); i++)
{
if (patchIDs_[i] == -1)
{
FatalErrorIn("processorPolyPatch::checkPatches() const")
<< "Faces originating from internal faces (subPatch is -1)"
<< " should always be first in the patch."
<< " The current list of subpatches " << patchIDs_
<< exit(FatalError);
}
}
}
@ -180,6 +192,33 @@ Foam::processorPolyPatch::~processorPolyPatch()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::processorPolyPatch::transformPosition(pointField& l) const
{
if (l.size() != size())
{
FatalErrorIn("processorPolyPatch::transformPosition(pointField&) const")
<< "Size of field " << l.size() << " differs from patch size "
<< size() << abort(FatalError);
}
forAll(patchIDs_, subI)
{
label patchI = patchIDs_[subI];
if (patchI != -1)
{
// Get field on patch
SubField<point> subFld(subSlice(l, subI));
refCast<const coupledPolyPatch>
(
boundaryMesh()[patchI]
).transformPosition(reinterpret_cast<pointField&>(subFld));
}
}
}
void Foam::processorPolyPatch::initGeometry()
{
Pout<< "**processorPolyPatch::initGeometry()" << endl;
@ -477,28 +516,28 @@ void Foam::processorPolyPatch::updateMesh()
}
const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const
{
if (!neighbPointsPtr_)
{
FatalErrorIn("processorPolyPatch::neighbPoints() const")
<< "No extended addressing calculated for patch " << name()
<< abort(FatalError);
}
return *neighbPointsPtr_;
}
const Foam::labelList& Foam::processorPolyPatch::neighbEdges() const
{
if (!neighbEdgesPtr_)
{
FatalErrorIn("processorPolyPatch::neighbEdges() const")
<< "No extended addressing calculated for patch " << name()
<< abort(FatalError);
}
return *neighbEdgesPtr_;
}
//const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const
//{
// if (!neighbPointsPtr_)
// {
// FatalErrorIn("processorPolyPatch::neighbPoints() const")
// << "No extended addressing calculated for patch " << name()
// << abort(FatalError);
// }
// return *neighbPointsPtr_;
//}
//
//
//const Foam::labelList& Foam::processorPolyPatch::neighbEdges() const
//{
// if (!neighbEdgesPtr_)
// {
// FatalErrorIn("processorPolyPatch::neighbEdges() const")
// << "No extended addressing calculated for patch " << name()
// << abort(FatalError);
// }
// return *neighbEdgesPtr_;
//}
Foam::label Foam::processorPolyPatch::whichSubPatch(const label facei) const
@ -518,7 +557,50 @@ Foam::label Foam::processorPolyPatch::whichSubPatch(const label facei) const
void Foam::processorPolyPatch::initOrder(const primitivePatch& pp) const
{
notImplemented("processorPolyPatch::order(..)");
if (!Pstream::parRun())
{
return;
}
if (debug)
{
fileName nm
(
boundaryMesh().mesh().time().path()
/name()+"_faces.obj"
);
Pout<< "processorPolyPatch::order : Writing my " << pp.size()
<< " faces to OBJ file " << nm << endl;
writeOBJ(nm, pp, pp.points());
// Calculate my face centres
pointField ctrs(calcFaceCentres(pp, pp.points()));
OFstream localStr
(
boundaryMesh().mesh().time().path()
/name() + "_localFaceCentres.obj"
);
Pout<< "processorPolyPatch::order : "
<< "Dumping " << ctrs.size()
<< " local faceCentres to " << localStr.name() << endl;
forAll(ctrs, faceI)
{
writeOBJ(localStr, ctrs[faceI]);
}
}
if (owner())
{
pointField ctrs(calcFaceCentres(pp, pp.points()));
pointField anchors(getAnchorPoints(pp, pp.points()));
// Now send all info over to the neighbour
OPstream toNeighbour(Pstream::blocking, neighbProcNo());
toNeighbour << ctrs << anchors;
}
}
@ -533,8 +615,192 @@ bool Foam::processorPolyPatch::order
labelList& rotation
) const
{
notImplemented("processorPolyPatch::order(..)");
return false;
// Note: we only get the faces that originate from internal faces.
if (!Pstream::parRun())
{
return false;
}
faceMap.setSize(pp.size());
faceMap = -1;
rotation.setSize(pp.size());
rotation = 0;
if (owner())
{
// Do nothing (i.e. identical mapping, zero rotation).
// See comment at top.
forAll(faceMap, patchFaceI)
{
faceMap[patchFaceI] = patchFaceI;
}
return false;
}
else
{
vectorField masterCtrs;
vectorField masterAnchors;
// Receive data from neighbour
{
IPstream fromNeighbour(Pstream::blocking, neighbProcNo());
fromNeighbour >> masterCtrs >> masterAnchors;
}
// Calculate my face centres
pointField ctrs(calcFaceCentres(pp, pp.points()));
// Calculate typical distance from face centre
scalarField tols(calcFaceTol(pp, pp.points(), ctrs));
if (debug || masterCtrs.size() != pp.size())
{
{
OFstream nbrStr
(
boundaryMesh().mesh().time().path()
/name() + "_nbrFaceCentres.obj"
);
Pout<< "processorPolyPatch::order : "
<< "Dumping neighbour faceCentres to " << nbrStr.name()
<< endl;
forAll(masterCtrs, faceI)
{
writeOBJ(nbrStr, masterCtrs[faceI]);
}
}
if (masterCtrs.size() != pp.size())
{
FatalErrorIn
(
"processorPolyPatch::order(const primitivePatch&"
", labelList&, labelList&) const"
) << "in patch:" << name() << " : "
<< "Local size of patch is " << pp.size() << " (faces)."
<< endl
<< "Received from neighbour " << masterCtrs.size()
<< " faceCentres!"
<< abort(FatalError);
}
}
// Geometric match of face centre vectors
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// 1. Try existing ordering and transformation
bool matchedAll = matchPoints(ctrs, masterCtrs, tols, true, faceMap);
if (!matchedAll || debug)
{
// Dump faces
fileName str
(
boundaryMesh().mesh().time().path()
/name()/name()+"_faces.obj"
);
Pout<< "processorPolyPatch::order :"
<< " Writing faces to OBJ file " << str.name() << endl;
writeOBJ(str, pp, pp.points());
OFstream ccStr
(
boundaryMesh().mesh().time().path()
/name() + "_faceCentresConnections.obj"
);
Pout<< "processorPolyPatch::order :"
<< " Dumping newly found match as lines between"
<< " corresponding face centres to OBJ file " << ccStr.name()
<< endl;
label vertI = 0;
forAll(ctrs, faceI)
{
label masterFaceI = faceMap[faceI];
if (masterFaceI != -1)
{
const point& c0 = masterCtrs[masterFaceI];
const point& c1 = ctrs[faceI];
writeOBJ(ccStr, c0, c1, vertI);
}
}
}
if (!matchedAll)
{
SeriousErrorIn
(
"processorPolyPatch::order(const primitivePatch&"
", labelList&, labelList&) const"
) << "in patch:" << name() << " : "
<< "Cannot match vectors to faces on both sides of patch"
<< endl
<< " masterCtrs[0]:" << masterCtrs[0] << endl
<< " ctrs[0]:" << ctrs[0] << endl
<< " Please check your topology changes or maybe you have"
<< " multiple separated (from cyclics) processor patches"
<< endl
<< " Continuing with incorrect face ordering from now on!"
<< endl;
return false;
}
// Set rotation.
forAll(faceMap, oldFaceI)
{
// The face f will be at newFaceI (after morphing) and we want its
// anchorPoint (= f[0]) to align with the anchorpoint for the
// corresponding face on the other side.
label newFaceI = faceMap[oldFaceI];
const point& wantedAnchor = masterAnchors[newFaceI];
rotation[newFaceI] = getRotation
(
pp.points(),
pp[oldFaceI],
wantedAnchor,
tols[oldFaceI]
);
if (rotation[newFaceI] == -1)
{
SeriousErrorIn
(
"processorPolyPatch::order(const primitivePatch&"
", labelList&, labelList&) const"
) << "in patch " << name()
<< " : "
<< "Cannot find point on face " << pp[oldFaceI]
<< " with vertices "
<< IndirectList<point>(pp.points(), pp[oldFaceI])()
<< " that matches point " << wantedAnchor
<< " when matching the halves of processor patch " << name()
<< "Continuing with incorrect face ordering from now on!"
<< endl;
return false;
}
}
forAll(faceMap, faceI)
{
if (faceMap[faceI] != faceI || rotation[faceI] != 0)
{
return true;
}
}
return false;
}
}

View File

@ -291,6 +291,38 @@ public:
return neighbFaceCellCentres_;
}
//- Transform a patch-based field
template<class T>
void transform(Field<T>& l) const;
virtual void transform(scalarField& l) const
{
transform(l);
}
virtual void transform(vectorField& l) const
{
transform(l);
}
virtual void transform(sphericalTensorField& l) const
{
transform(l);
}
virtual void transform(diagTensorField& l) const
{
transform(l);
}
virtual void transform(symmTensorField& l) const
{
transform(l);
}
virtual void transform(tensorField& l) const
{
transform(l);
}
//- Transform a patch-based position
virtual void transformPosition(pointField& l) const;
//- Are the planes separated.
virtual bool separated() const
{
@ -431,18 +463,16 @@ public:
);
}
//- Return neighbour point labels. This is for my local point (-1 or)
// the corresponding local point on the other side. It is -1 if
// there are multiple corresponding points on this or the other side
// (can happen for cyclics being converted into proc patches)
const labelList& neighbPoints() const;
// //- Return neighbour point labels. This is for my local point (-1 or)
// // the corresponding local point on the other side. It is -1 if
// // there are multiple corresponding points on this or the other side
// // (can happen for cyclics being converted into proc patches)
// const labelList& neighbPoints() const;
//
// //- Return neighbour edge labels. This is for my local edge (-1 or) the
// // corresponding local edge on the other side. See above for -1 cause.
// const labelList& neighbEdges() const;
//- Return neighbour edge labels. This is for my local edge (-1 or) the
// corresponding local edge on the other side. See above for -1 cause.
const labelList& neighbEdges() const;
////- Transform a position
//virtual void transformPosition(point&, const label facei) const;
//- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.)
@ -472,6 +502,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "processorPolyPatchTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "processorPolyPatch.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T>
void Foam::processorPolyPatch::transform(Field<T>& l) const
{
if (l.size() != size())
{
FatalErrorIn("processorPolyPatch::transform(Field<T>&) const")
<< "Size of field " << l.size() << " differs from patch size "
<< size() << abort(FatalError);
}
forAll(patchIDs_, subI)
{
label patchI = patchIDs_[subI];
if (patchI != -1)
{
// Get field on patch
typename Field<T>::subField subFld(subSlice(l, subI));
refCast<const coupledPolyPatch>
(
boundaryMesh()[patchI]
).transform(subFld);
}
}
}
// ************************************************************************* //

View File

@ -29,6 +29,54 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Field<label>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<label>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<label>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Field<bool>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<bool>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<bool>&
) const
{}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Does anyone have couples? Since meshes might have 0 cells and 0 proc
// boundaries need to reduce this info.
bool Foam::syncTools::hasCouples(const polyBoundaryMesh& patches)
@ -47,37 +95,12 @@ bool Foam::syncTools::hasCouples(const polyBoundaryMesh& patches)
}
void Foam::syncTools::checkTransform
(
const processorPolyPatch& pp,
const bool applySeparation
)
{
// if (!pp.parallel() && pp.forwardT().size() > 1)
// {
// FatalErrorIn("syncTools::checkTransform(const coupledPolyPatch&)")
// << "Non-uniform transformation not supported for point or edge"
// << " fields." << endl
// << "Patch:" << pp.name()
// << abort(FatalError);
// }
// if (applySeparation && pp.separated() && pp.separation().size() > 1)
// {
// FatalErrorIn("syncTools::checkTransform(const coupledPolyPatch&)")
// << "Non-uniform separation vector not supported for point or edge"
// << " fields." << endl
// << "Patch:" << pp.name()
// << abort(FatalError);
// }
}
// Determines for every point whether it is coupled and if so sets only one.
Foam::PackedList<1> Foam::syncTools::getMasterPoints(const polyMesh& mesh)
{
PackedList<1> isMasterPoint(mesh.nPoints(), 0);
PackedList<1> isMasterPoint(mesh.nPoints());
PackedList<1> donePoint(mesh.nPoints(), 0);
PackedList<1> donePoint(mesh.nPoints());
// Do multiple shared points. Min. proc is master
@ -196,9 +219,9 @@ Foam::PackedList<1> Foam::syncTools::getMasterPoints(const polyMesh& mesh)
// Determines for every edge whether it is coupled and if so sets only one.
Foam::PackedList<1> Foam::syncTools::getMasterEdges(const polyMesh& mesh)
{
PackedList<1> isMasterEdge(mesh.nEdges(), 0);
PackedList<1> isMasterEdge(mesh.nEdges());
PackedList<1> doneEdge(mesh.nEdges(), 0);
PackedList<1> doneEdge(mesh.nEdges());
// Do multiple shared edges. Min. proc is master
@ -362,46 +385,4 @@ Foam::PackedList<1> Foam::syncTools::getMasterFaces(const polyMesh& mesh)
}
template <>
void Foam::syncTools::separateList
(
const vector& separation,
UList<vector>& field
)
{
forAll(field, i)
{
field[i] += separation;
}
}
template <>
void Foam::syncTools::separateList
(
const vector& separation,
Map<vector>& field
)
{
forAllIter(Map<vector>, field, iter)
{
iter() += separation;
}
}
template <>
void Foam::syncTools::separateList
(
const vector& separation,
EdgeMap<vector>& field
)
{
forAllIter(EdgeMap<vector>, field, iter)
{
iter() += separation;
}
}
// ************************************************************************* //

View File

@ -51,6 +51,8 @@ SourceFiles
#include "Map.H"
#include "EdgeMap.H"
#include "PackedList.H"
#include "polyMesh.H"
#include "coupledPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,8 +60,8 @@ namespace Foam
{
class polyBoundaryMesh;
class polyMesh;
class processorPolyPatch;
//class polyMesh;
//class processorPolyPatch;
/*---------------------------------------------------------------------------*\
Class syncTools Declaration
@ -72,19 +74,6 @@ class syncTools
//- Check whether uses couples.
static bool hasCouples(const polyBoundaryMesh&);
//- Check for single transformation tensor only.
static void checkTransform(const processorPolyPatch&, const bool);
//- Apply separation to list.
template <class T>
static void separateList(const vector&, UList<T>&);
template <class T>
static void separateList(const vector&, Map<T>&);
template <class T>
static void separateList(const vector&, EdgeMap<T>&);
//- Combine value with existing value in map.
template <class T, class CombineOp>
static void combine
@ -108,117 +97,386 @@ class syncTools
public:
// Static data members
// Public classes
//- Synchronize values on all mesh points.
// Applies rotation and optionally separation for parallel cyclics
template <class T, class CombineOp>
static void syncPointList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const T& nullValue,
const bool applySeparation
);
class transform
{
public:
template<class T>
void operator()(const coupledPolyPatch& cpp, Field<T>& fld) const
{
cpp.transform(fld);
}
template<class T, template<class> class Container>
void operator()(const coupledPolyPatch& cpp, Container<T>& map)
const
{
Field<T> fld(map.size());
label i = 0;
forAllConstIter(typename Container<T>, map, iter)
{
fld[i++] = iter();
}
cpp.transform(fld);
i = 0;
forAllIter(typename Container<T>, map, iter)
{
iter() = fld[i++];
}
}
};
//- Synchronize values on selected mesh points.
// Applies rotation and optionally separation for parallel cyclics
template <class T, class CombineOp>
static void syncPointList
(
const polyMesh&,
const labelList& meshPoints,
UList<T>&,
const CombineOp& bop,
const T& nullValue,
const bool applySeparation
);
class transformPosition
{
public:
void operator()(const coupledPolyPatch& cpp, pointField& fld) const
{
cpp.transformPosition(fld);
}
template<template<class> class Container>
void operator()(const coupledPolyPatch& cpp, Container<point>& map)
const
{
Field<point> fld(map.size());
label i = 0;
forAllConstIter(typename Container<point>, map, iter)
{
fld[i++] = iter();
}
cpp.transform(fld);
i = 0;
forAllIter(typename Container<point>, map, iter)
{
iter() = fld[i++];
}
}
};
//- Synchronize values on all mesh edges.
// Applies rotation and optionally separation for parallel cyclics
template <class T, class CombineOp>
static void syncEdgeList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const T& nullValue,
const bool applySeparation
);
//- Synchronize values on boundary faces only.
// Optionally applies rotation tensor for non-parallel cyclics
// (but not separation!)
template <class T, class CombineOp>
static void syncBoundaryFaceList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const bool applySeparation
);
//- Synchronize values on all mesh faces.
// Optionally applies rotation tensor for non-parallel cyclics
// (but not separation!)
template <class T, class CombineOp>
static void syncFaceList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const bool applySeparation
);
//- Swap coupled face values.
// Applies rotation and optionally separation for parallel cyclics
template <class T>
static void swapBoundaryFaceList
(
const polyMesh&,
UList<T>&,
const bool applySeparation
);
//- Swap coupled face values.
// Applies rotation and optionally separation for parallel cyclics
template <class T>
static void swapFaceList
(
const polyMesh&,
UList<T>&,
const bool applySeparation
);
// Sparse versions
// Basic routines with user-supplied transformation. Preferably
// use specialisations below.
//- Synchronize values on selected points.
// Applies rotation and optionally separation for parallel
// cyclics.
template <class T, class CombineOp>
template <class T, class CombineOp, class TransformOp>
static void syncPointMap
(
const polyMesh&,
Map<T>& pointValues,
const CombineOp& cop,
const bool applySeparation
const TransformOp& top
);
//- Synchronize values on selected edges. Edges are represented
// by the two vertices that make it up so global edges never get
// constructed.
// Applies rotation and optionally separation for parallel
// cyclics.
template <class T, class CombineOp>
//- Synchronize values on selected edges.
template <class T, class CombineOp, class TransformOp>
static void syncEdgeMap
(
const polyMesh&,
EdgeMap<T>& edgeValues,
const CombineOp& cop,
const bool applySeparation
const TransformOp& top
);
//- Synchronize values on all mesh points.
template <class T, class CombineOp, class TransformOp>
static void syncPointList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const T& nullValue,
const TransformOp& top
);
//- Synchronize values on selected mesh points.
template <class T, class CombineOp, class TransformOp>
static void syncPointList
(
const polyMesh&,
const labelList& meshPoints,
UList<T>&,
const CombineOp& cop,
const T& nullValue,
const TransformOp& top
);
//- Synchronize values on all mesh edges.
template <class T, class CombineOp, class TransformOp>
static void syncEdgeList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const T& nullValue,
const TransformOp& top
);
//- Synchronize values on boundary faces only.
template <class T, class CombineOp, class TransformOp>
static void syncBoundaryFaceList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const TransformOp& top
);
// Synchronise point-wise data
//- Synchronize values on all mesh points.
template <class T, class CombineOp>
static void syncPointList
(
const polyMesh& mesh,
UList<T>& l,
const CombineOp& cop,
const T& nullValue
)
{
syncPointList(mesh, l, cop, nullValue, transform());
}
//- Synchronize locations on all mesh points.
template <class CombineOp>
static void syncPointPositions
(
const polyMesh& mesh,
UList<point>& l,
const CombineOp& cop,
const point& nullValue
)
{
syncPointList(mesh, l, cop, nullValue, transformPosition());
}
//- Synchronize values on selected mesh points.
template <class T, class CombineOp>
static void syncPointList
(
const polyMesh& mesh,
const labelList& meshPoints,
UList<T>& l,
const CombineOp& cop,
const T& nullValue
)
{
syncPointList
(
mesh,
meshPoints,
l,
cop,
nullValue,
transform()
);
}
//- Synchronize locations on selected mesh points.
template <class CombineOp>
static void syncPointPositions
(
const polyMesh& mesh,
const labelList& meshPoints,
UList<point>& l,
const CombineOp& cop,
const point& nullValue
)
{
syncPointList
(
mesh,
meshPoints,
l,
cop,
nullValue,
transformPosition()
);
}
// Synchronise edge-wise data
//- Synchronize values on all mesh edges.
template <class T, class CombineOp>
static void syncEdgeList
(
const polyMesh& mesh,
UList<T>& l,
const CombineOp& cop,
const T& nullValue
)
{
syncEdgeList(mesh, l, cop, nullValue, transform());
}
//- Synchronize values on all mesh edges.
template <class CombineOp>
static void syncEdgePositions
(
const polyMesh& mesh,
UList<point>& l,
const CombineOp& cop,
const point& nullValue
)
{
syncEdgeList(mesh, l, cop, nullValue, transformPosition());
}
// Synchronise face-wise data
//- Synchronize values on boundary faces only.
template <class T, class CombineOp>
static void syncBoundaryFaceList
(
const polyMesh& mesh,
UList<T>& l,
const CombineOp& cop
)
{
syncBoundaryFaceList(mesh, l, cop, transform());
}
//- Synchronize locations on boundary faces only.
template <class CombineOp>
static void syncBoundaryFacePositions
(
const polyMesh& mesh,
UList<point>& l,
const CombineOp& cop
)
{
syncBoundaryFaceList(mesh, l, cop, transformPosition());
}
//- Synchronize values on all mesh faces.
template <class T, class CombineOp>
static void syncFaceList
(
const polyMesh& mesh,
UList<T>& l,
const CombineOp& cop
)
{
SubList<T> bndValues
(
l,
mesh.nFaces()-mesh.nInternalFaces(),
mesh.nInternalFaces()
);
syncBoundaryFaceList(mesh, bndValues, cop, transform());
}
//- Synchronize locations on all mesh faces.
template <class CombineOp>
static void syncFacePositions
(
const polyMesh& mesh,
UList<point>& l,
const CombineOp& cop
)
{
SubList<point> bndValues
(
l,
mesh.nFaces()-mesh.nInternalFaces(),
mesh.nInternalFaces()
);
syncBoundaryFaceList(mesh, bndValues, cop, transformPosition());
}
//- Swap coupled boundary face values.
template <class T>
static void swapBoundaryFaceList
(
const polyMesh& mesh,
UList<T>& l
)
{
syncBoundaryFaceList(mesh, l, eqOp<T>(), transform());
}
//- Swap coupled positions.
template <class T>
static void swapBoundaryFacePositions
(
const polyMesh& mesh,
UList<T>& l
)
{
syncBoundaryFaceList(mesh, l, eqOp<T>(), transformPosition());
}
//- Swap coupled face values.
template <class T>
static void swapFaceList
(
const polyMesh& mesh,
UList<T>& l
)
{
SubList<T> bndValues
(
l,
mesh.nFaces()-mesh.nInternalFaces(),
mesh.nInternalFaces()
);
syncBoundaryFaceList(mesh, bndValues, eqOp<T>(), transform());
}
// Sparse versions
//- Synchronize values on selected points.
template <class T, class CombineOp>
static void syncPointMap
(
const polyMesh& mesh,
Map<T>& l,
const CombineOp& cop
)
{
syncPointMap(mesh, l, cop, transform());
}
//- Synchronize locations on selected points.
template <class CombineOp>
static void syncPointPositions
(
const polyMesh& mesh,
Map<point>& l,
const CombineOp& cop
)
{
syncPointMap(mesh, l, cop, transformPosition());
}
//- Synchronize values on selected edges. Edges are represented
// by the two vertices that make it up so global edges never get
// constructed.
template <class T, class CombineOp>
static void syncEdgeMap
(
const polyMesh& mesh,
EdgeMap<T>& l,
const CombineOp& cop
)
{
syncEdgeMap(mesh, l, cop, transform());
}
//- Synchronize locations on selected edges.
template <class T, class CombineOp>
static void syncEdgePositions
(
const polyMesh& mesh,
EdgeMap<T>& l,
const CombineOp& cop
)
{
syncEdgeMap(mesh, l, cop, transformPosition());
}
// PackedList versions
template <int nBits, class CombineOp>
@ -269,13 +527,42 @@ public:
template<>
void syncTools::separateList(const vector&, UList<vector>&);
void syncTools::transform::operator()
(
const coupledPolyPatch&,
Field<label>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<label>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<label>&
) const;
template<>
void syncTools::separateList(const vector&, Map<vector>&);
void syncTools::transform::operator()
(
const coupledPolyPatch& cpp,
Field<bool>& fld
) const;
template<>
void syncTools::separateList(const vector&, EdgeMap<vector>&);
void syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<bool>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<bool>&
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

File diff suppressed because it is too large Load Diff

View File

@ -445,8 +445,7 @@ Foam::labelList Foam::autoLayerDriver::collectFaces
(
mesh,
selected,
orEqOp<bool>(), // combine operator
false // separation
orEqOp<bool>() // combine operator
);
labelList selectedFaces(findIndices(selected, true));
@ -492,8 +491,7 @@ Foam::labelList Foam::autoLayerDriver::growFaceCellFace
(
mesh,
selected,
orEqOp<bool>(), // combine operator
false // separation
orEqOp<bool>() // combine operator
);
return findIndices(selected, true);
}
@ -970,8 +968,7 @@ void Foam::autoLayerDriver::handleFeatureAngle
mesh,
edgeNormal,
nomalsCombine(),
wallPoint::greatPoint, // null value
false // no separation
wallPoint::greatPoint // null value
);
label vertI = 0;
@ -1261,8 +1258,7 @@ void Foam::autoLayerDriver::setNumLayers
pp.meshPoints(),
maxLayers,
maxEqOp<label>(),
labelMin, // null value
false // no separation
labelMin // null value
);
syncTools::syncPointList
(
@ -1270,8 +1266,7 @@ void Foam::autoLayerDriver::setNumLayers
pp.meshPoints(),
minLayers,
minEqOp<label>(),
labelMax, // null value
false // no separation
labelMax // null value
);
// Unmark any point with different min and max
@ -1442,8 +1437,7 @@ void Foam::autoLayerDriver::calculateLayerThickness
pp.meshPoints(),
maxPointLevel,
maxEqOp<label>(),
labelMin, // null value
false // no separation
labelMin // null value
);
}
@ -1491,8 +1485,7 @@ void Foam::autoLayerDriver::calculateLayerThickness
pp.meshPoints(),
expansionRatio,
minEqOp<scalar>(),
GREAT, // null value
false // no separation
GREAT // null value
);
syncTools::syncPointList
(
@ -1500,8 +1493,7 @@ void Foam::autoLayerDriver::calculateLayerThickness
pp.meshPoints(),
finalLayerRatio,
minEqOp<scalar>(),
GREAT, // null value
false // no separation
GREAT // null value
);
syncTools::syncPointList
(
@ -1509,8 +1501,7 @@ void Foam::autoLayerDriver::calculateLayerThickness
pp.meshPoints(),
relMinThickness,
minEqOp<scalar>(),
GREAT, // null value
false // no separation
GREAT // null value
);
}
@ -1581,8 +1572,7 @@ void Foam::autoLayerDriver::syncPatchDisplacement
meshPoints,
patchDisp,
minEqOp<vector>(),
wallPoint::greatPoint, // null value
false // no separation
wallPoint::greatPoint // null value
);
// Unmark if displacement too small
@ -1614,8 +1604,7 @@ void Foam::autoLayerDriver::syncPatchDisplacement
meshPoints,
syncPatchNLayers,
minEqOp<label>(),
labelMax, // null value
false // no separation
labelMax // null value
);
// Reset if differs
@ -1645,8 +1634,7 @@ void Foam::autoLayerDriver::syncPatchDisplacement
meshPoints,
syncPatchNLayers,
maxEqOp<label>(),
labelMin, // null value
false // no separation
labelMin // null value
);
// Reset if differs
@ -1732,8 +1720,7 @@ void Foam::autoLayerDriver::getPatchDisplacement
meshPoints,
pointNormals,
plusEqOp<vector>(),
vector::zero, // null value
false // no separation
vector::zero // null value
);
syncTools::syncPointList
@ -1742,8 +1729,7 @@ void Foam::autoLayerDriver::getPatchDisplacement
meshPoints,
nPointFaces,
plusEqOp<label>(),
0, // null value
false // no separation
0 // null value
);
forAll(pointNormals, i)
@ -2175,8 +2161,7 @@ void Foam::autoLayerDriver::setupLayerInfoTruncation
pp.meshPoints(),
foundNeighbour,
orEqOp<bool>(),
false, // null value
false // no separation
false // null value
);
forAll(pp.meshPoints(), patchPointI)
@ -2235,8 +2220,7 @@ void Foam::autoLayerDriver::setupLayerInfoTruncation
pp.meshPoints(),
nPatchPointLayers,
maxEqOp<label>(),
0, // null value
false // no separation
0 // null value
);
}
}

View File

@ -71,8 +71,7 @@ void Foam::autoLayerDriver::sumWeights
meshPoints,
invSumWeight,
plusEqOp<scalar>(),
scalar(0.0), // null value
false // no separation
scalar(0.0) // null value
);
forAll(invSumWeight, pointI)
@ -525,8 +524,7 @@ void Foam::autoLayerDriver::findIsolatedRegions
pp.meshPoints(),
keptPoints,
orEqOp<bool>(),
false, // null value
false // no separation
false // null value
);
label nChanged = 0;
@ -593,8 +591,7 @@ void Foam::autoLayerDriver::findIsolatedRegions
pp.meshPoints(),
isolatedPoint,
plusEqOp<label>(),
0, // null value
false // no separation
0 // null value
);
// stop layer growth on isolated faces
@ -729,8 +726,7 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
meshPoints,
pointNormals,
plusEqOp<vector>(),
vector::zero, // null value
false // no separation
vector::zero // null value
);
syncTools::syncPointList
@ -739,8 +735,7 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
meshPoints,
nPointFaces,
plusEqOp<label>(),
0, // null value
false // no separation
0 // null value
);
forAll(pointNormals, i)

View File

@ -65,8 +65,7 @@ void Foam::autoLayerDriver::averageNeighbours
meshPoints,
average,
plusEqOp<Type>(),
pTraits<Type>::zero, // null value
false // no separation
pTraits<Type>::zero // null value
);
average *= invSumWeight;

View File

@ -277,8 +277,7 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
pp.meshPoints(),
avgBoundary,
plusEqOp<point>(), // combine op
vector::zero, // null value
false // no separation
vector::zero // null value
);
syncTools::syncPointList
(
@ -286,8 +285,7 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
pp.meshPoints(),
nBoundary,
plusEqOp<label>(), // combine op
0, // null value
false // no separation
0 // null value
);
forAll(avgBoundary, i)
@ -373,16 +371,14 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
mesh,
globalSum,
plusEqOp<vector>(), // combine op
vector::zero, // null value
false // no separation
vector::zero // null value
);
syncTools::syncPointList
(
mesh,
globalNum,
plusEqOp<label>(), // combine op
0, // null value
false // no separation
0 // null value
);
avgInternal.setSize(meshPoints.size());
@ -822,8 +818,7 @@ Foam::scalarField Foam::autoSnapDriver::calcSnapDistance
pp.meshPoints(),
maxEdgeLen,
maxEqOp<scalar>(), // combine op
-GREAT, // null value
false // no separation
-GREAT // null value
);
return snapParams.snapTol()*maxEdgeLen;
@ -1155,8 +1150,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
pp.meshPoints(),
patchDisp,
minMagEqOp(), // combine op
vector(GREAT, GREAT, GREAT), // null value
false // no separation
vector(GREAT, GREAT, GREAT) // null value
);
@ -1210,7 +1204,7 @@ void Foam::autoSnapDriver::smoothDisplacement
}
pointVectorField oldDisp(disp);
meshMover.smooth(oldDisp, edgeGamma, false, disp);
meshMover.smooth(oldDisp, edgeGamma, disp);
}
Info<< "Displacement smoothed in = "
<< mesh.time().cpuTimeIncrement() << " s\n" << nl << endl;

View File

@ -114,8 +114,8 @@ void Foam::meshRefinement::calcNeighbourData
}
// Swap coupled boundaries. Apply separation to cc since is coordinate.
syncTools::swapBoundaryFaceList(mesh_, neiCc, true);
syncTools::swapBoundaryFaceList(mesh_, neiLevel, false);
syncTools::swapBoundaryFacePositions(mesh_, neiCc);
syncTools::swapBoundaryFaceList(mesh_, neiLevel);
}
@ -203,7 +203,7 @@ void Foam::meshRefinement::updateIntersections(const labelList& changedFaces)
// Make sure both sides have same information. This should be
// case in general since same vectors but just to make sure.
syncTools::syncFaceList(mesh_, surfaceIndex_, maxEqOp<label>(), false);
syncTools::syncFaceList(mesh_, surfaceIndex_, maxEqOp<label>());
label nHits = countHits();
label nTotHits = returnReduce(nHits, sumOp<label>());
@ -241,11 +241,11 @@ void Foam::meshRefinement::checkData()
// Get neighbouring face centres
pointField neiBoundaryFc(boundaryFc);
syncTools::swapBoundaryFaceList
syncTools::syncBoundaryFacePositions
(
mesh_,
neiBoundaryFc,
true
eqOp<point>()
);
// Compare
@ -340,8 +340,7 @@ void Foam::meshRefinement::checkData()
syncTools::swapBoundaryFaceList
(
mesh_,
neiBoundarySurface,
false
neiBoundarySurface
);
// Compare
@ -1463,7 +1462,7 @@ void Foam::meshRefinement::checkCoupledFaceZones(const polyMesh& mesh)
}
labelList neiFaceToZone(faceToZone);
syncTools::swapBoundaryFaceList(mesh, neiFaceToZone, false);
syncTools::swapBoundaryFaceList(mesh, neiFaceToZone);
forAll(faceToZone, i)
{

View File

@ -83,7 +83,8 @@ Foam::label Foam::meshRefinement::createBaffle
ownPatch, // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
-1 // sub patch
)
);
@ -113,10 +114,11 @@ Foam::label Foam::meshRefinement::createBaffle
-1, // masterPointID
-1, // masterEdgeID
faceI, // masterFaceID,
false, // face flip
true, // face flip
neiPatch, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
-1 // sub patch
)
);
}
@ -365,8 +367,8 @@ void Foam::meshRefinement::getBafflePatches
// might not be owner on the other processor but the neighbour is
// not used when creating baffles from proc faces.
// - tolerances issues occasionally crop up.
syncTools::syncFaceList(mesh_, ownPatch, maxEqOp<label>(), false);
syncTools::syncFaceList(mesh_, neiPatch, maxEqOp<label>(), false);
syncTools::syncFaceList(mesh_, ownPatch, maxEqOp<label>());
syncTools::syncFaceList(mesh_, neiPatch, maxEqOp<label>());
}
@ -397,9 +399,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createBaffles
if (debug)
{
labelList syncedOwnPatch(ownPatch);
syncTools::syncFaceList(mesh_, syncedOwnPatch, maxEqOp<label>(), false);
syncTools::syncFaceList(mesh_, syncedOwnPatch, maxEqOp<label>());
labelList syncedNeiPatch(neiPatch);
syncTools::syncFaceList(mesh_, syncedNeiPatch, maxEqOp<label>(), false);
syncTools::syncFaceList(mesh_, syncedNeiPatch, maxEqOp<label>());
forAll(syncedOwnPatch, faceI)
{
@ -586,8 +588,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
mesh_,
isBoundaryPoint,
orEqOp<bool>(),
false, // null value
false // no separation
false // null value
);
syncTools::syncEdgeList
@ -595,16 +596,14 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
mesh_,
isBoundaryEdge,
orEqOp<bool>(),
false, // null value
false // no separation
false // null value
);
syncTools::syncFaceList
(
mesh_,
isBoundaryFace,
orEqOp<bool>(),
false // no separation
orEqOp<bool>()
);
@ -786,8 +785,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
mesh_,
isBoundaryPoint,
orEqOp<bool>(),
false, // null value
false // no separation
false // null value
);
syncTools::syncEdgeList
@ -795,16 +793,14 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
mesh_,
isBoundaryEdge,
orEqOp<bool>(),
false, // null value
false // no separation
false // null value
);
syncTools::syncFaceList
(
mesh_,
isBoundaryFace,
orEqOp<bool>(),
false // no separation
orEqOp<bool>()
);
@ -1131,8 +1127,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCellsGeometric
(
mesh_,
facePatch,
maxEqOp<label>(),
false // no separation
maxEqOp<label>()
);
return facePatch;
@ -1305,8 +1300,7 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::filterDuplicateFaces
mesh_,
nBafflesPerEdge,
plusEqOp<label>(), // in-place add
0, // initial value
false // no separation
0 // initial value
);
@ -1402,7 +1396,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeBaffles
-1, // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
-1 // sub patch
)
);
}
@ -1431,7 +1426,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeBaffles
-1, // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
-1 // sub patch
)
);
}
@ -1646,7 +1642,7 @@ void Foam::meshRefinement::findCellZoneTopo
blockedFace[faceI] = true;
}
}
syncTools::syncFaceList(mesh_, blockedFace, orEqOp<bool>(), false);
syncTools::syncFaceList(mesh_, blockedFace, orEqOp<bool>());
// Set region per cell based on walking
regionSplit cellRegion(mesh_, blockedFace);
@ -2113,7 +2109,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
blockedFace[faceI] = true;
}
}
syncTools::syncFaceList(mesh_, blockedFace, orEqOp<bool>(), false);
syncTools::syncFaceList(mesh_, blockedFace, orEqOp<bool>());
// Set region per cell based on walking
regionSplit cellRegion(mesh_, blockedFace);
@ -2225,8 +2221,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
mesh_,
pointBaffle,
maxEqOp<label>(),
-1, // null value
false // no separation
-1 // null value
);
@ -2251,7 +2246,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
}
}
}
syncTools::syncFaceList(mesh_, ownPatch, maxEqOp<label>(), false);
syncTools::syncFaceList(mesh_, ownPatch, maxEqOp<label>());
// 3. From faces to cells (cellRegion) and back to faces (ownPatch)
@ -2300,7 +2295,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
ownPatch.transfer(newOwnPatch);
syncTools::syncFaceList(mesh_, ownPatch, maxEqOp<label>(), false);
syncTools::syncFaceList(mesh_, ownPatch, maxEqOp<label>());
}
@ -2669,8 +2664,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
(
mesh_,
namedSurfaceIndex,
maxEqOp<label>(),
false
maxEqOp<label>()
);
// Print a bit
@ -2712,7 +2706,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
-1, // patch for face
false, // remove from zone
surfaceToFaceZone[surfI], // zone for face
false // face flip in zone
false, // face flip in zone
-1 // sub patch
)
);
}
@ -2742,7 +2737,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
patchI, // patch for face
false, // remove from zone
surfaceToFaceZone[surfI], // zone for face
false // face flip in zone
false, // face flip in zone
polyTopoChange::whichSubPatch(pp, faceI) // sub patch
)
);
}

View File

@ -133,8 +133,7 @@ Foam::labelList Foam::meshRefinement::getChangedFaces
(
mesh,
refinedBoundaryFace,
orEqOp<bool>(),
false
orEqOp<bool>()
);
@ -176,8 +175,7 @@ Foam::labelList Foam::meshRefinement::getChangedFaces
(
mesh,
changedFace,
orEqOp<bool>(),
false
orEqOp<bool>()
);
@ -925,8 +923,8 @@ Foam::label Foam::meshRefinement::markSurfaceCurvatureRefinement
neiBndMaxLevel[bFaceI] = cellMaxLevel[own];
neiBndMaxNormal[bFaceI] = cellMaxNormal[own];
}
syncTools::swapBoundaryFaceList(mesh_, neiBndMaxLevel, false);
syncTools::swapBoundaryFaceList(mesh_, neiBndMaxNormal, false);
syncTools::swapBoundaryFaceList(mesh_, neiBndMaxLevel);
syncTools::swapBoundaryFaceList(mesh_, neiBndMaxNormal);
// Loop over all faces. Could only be checkFaces.. except if they're coupled

View File

@ -83,7 +83,7 @@ void dynamicRefineFvMesh::calculateProtectedCells
{
neiLevel[faceI-nInternalFaces()] = cellLevel[faceOwner()[faceI]];
}
syncTools::swapBoundaryFaceList(*this, neiLevel, false);
syncTools::swapBoundaryFaceList(*this, neiLevel);
while (true)
@ -121,7 +121,7 @@ void dynamicRefineFvMesh::calculateProtectedCells
}
}
syncTools::syncFaceList(*this, seedFace, orEqOp<bool>(), false);
syncTools::syncFaceList(*this, seedFace, orEqOp<bool>());
// Extend unrefineableCell
@ -836,7 +836,7 @@ void dynamicRefineFvMesh::extendMarkedCells(PackedList<1>& markedCell) const
}
}
syncTools::syncFaceList(*this, markedFace, orEqOp<bool>(), false);
syncTools::syncFaceList(*this, markedFace, orEqOp<bool>());
// Update cells using any markedFace
for (label faceI = 0; faceI < nInternalFaces(); faceI++)
@ -919,7 +919,7 @@ dynamicRefineFvMesh::dynamicRefineFvMesh(const IOobject& io)
{
neiLevel[faceI] = cellLevel[faceOwner()[faceI]];
}
syncTools::swapFaceList(*this, neiLevel, false);
syncTools::swapFaceList(*this, neiLevel);
boolList protectedFace(nFaces(), false);
@ -951,13 +951,7 @@ dynamicRefineFvMesh::dynamicRefineFvMesh(const IOobject& io)
}
}
syncTools::syncFaceList
(
*this,
protectedFace,
orEqOp<bool>(),
false
);
syncTools::syncFaceList(*this, protectedFace, orEqOp<bool>());
for (label faceI = 0; faceI < nInternalFaces(); faceI++)
{

View File

@ -119,7 +119,8 @@ void Foam::attachDetach::attachInterface
-1, // patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
mfFlip[faceI] // face flip in zone
mfFlip[faceI], // face flip in zone
-1 // subpatch
)
);
}
@ -138,7 +139,8 @@ void Foam::attachDetach::attachInterface
-1, // patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
!mfFlip[faceI] // face flip in zone
!mfFlip[faceI], // face flip in zone
-1 // subpatch
)
);
}
@ -207,7 +209,13 @@ void Foam::attachDetach::attachInterface
mesh.faceZones()[modifiedFaceZone].whichFace(curFaceID)
];
}
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curFaceID
);
// Modify the face
ref.setAction
(
@ -218,10 +226,11 @@ void Foam::attachDetach::attachInterface
own[curFaceID], // owner
nei[curFaceID], // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curFaceID),// patch for face
patchIDs[0], // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
modifiedFaceZoneFlip, // face flip in zone
patchIDs[1]
)
);
}

View File

@ -180,7 +180,8 @@ void Foam::attachDetach::detachInterface
masterPatchID_.index(), // patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
!mfFlip[faceI] // face flip in zone
!mfFlip[faceI], // face flip in zone
-1 // sub patch
)
);
@ -198,7 +199,8 @@ void Foam::attachDetach::detachInterface
false, // flip flux
slavePatchID_.index(), // patch to add the face to
-1, // zone for face
false // zone flip
false, // zone flip
-1 // sub patch
)
);
// Pout << "Flip. Modifying face: " << faces[curFaceID].reverseFace() << " next to cell: " << nei[curFaceID] << " and adding face: " << newFace << " next to cell: " << own[curFaceID] << endl;
@ -218,7 +220,8 @@ void Foam::attachDetach::detachInterface
masterPatchID_.index(), // patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
mfFlip[faceI] // face flip in zone
mfFlip[faceI], // face flip in zone
-1 // sub patch
)
);
@ -236,7 +239,8 @@ void Foam::attachDetach::detachInterface
true, // flip flux
slavePatchID_.index(), // patch to add the face to
-1, // zone for face
false // face flip in zone
false, // face flip in zone
-1 // sub patch
)
);
// Pout << "No flip. Modifying face: " << faces[curFaceID] << " next to cell: " << own[curFaceID] << " and adding face: " << newFace << " next to cell: " << nei[curFaceID] << endl;
@ -389,7 +393,8 @@ void Foam::attachDetach::detachInterface
-1, // patch for face
false, // remove from zone
-1, // zone for face
false // face zone flip
false, // face zone flip
-1 // sub patch
)
);
// Pout << "modifying stick-out face. Internal Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " nei: " << nei[curFaceID] << endl;
@ -408,7 +413,8 @@ void Foam::attachDetach::detachInterface
mesh.boundaryMesh().whichPatch(curFaceID), // patch
false, // remove from zone
-1, // zone for face
false // face zone flip
false, // face zone flip
-1 // sub patch
)
);
// Pout << "modifying stick-out face. Boundary Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " patch: " << mesh.boundaryMesh().whichPatch(curFaceID) << endl;

View File

@ -167,11 +167,11 @@ void Foam::layerAdditionRemoval::addCellLayer
(
polyAddCell
(
-1, // master point
-1, // master edge
mf[faceI], // master face
-1, // master cell
-1 // zone for cell
-1, // master point
-1, // master edge
mf[faceI], // master face
-1, // master cell
-1 // zone for cell
)
);
}
@ -216,16 +216,17 @@ void Foam::layerAdditionRemoval::addCellLayer
(
polyAddFace
(
newFace, // face
mc[faceI], // owner
addedCells[faceI], // neighbour
-1, // master point
-1, // master edge
mf[faceI], // master face for addition
flipFaceFlux, // flux flip
-1, // patch for face
-1, // zone for face
false // face zone flip
newFace, // face
mc[faceI], // owner
addedCells[faceI], // neighbour
-1, // master point
-1, // master edge
mf[faceI], // master face for addition
flipFaceFlux, // flux flip
-1, // patch for face
-1, // zone for face
false, // face zone flip
-1 // sub patch for face
)
);
@ -240,6 +241,15 @@ void Foam::layerAdditionRemoval::addCellLayer
{
const label curfaceID = mf[faceI];
labelPair patchIDs
(
polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curfaceID
)
);
// If the face is internal, modify its owner to be the newly
// created cell. No flip is necessary
if (!mesh.isInternalFace(curfaceID))
@ -248,15 +258,16 @@ void Foam::layerAdditionRemoval::addCellLayer
(
polyModifyFace
(
faces[curfaceID], // modified face
curfaceID, // label of face being modified
addedCells[faceI], // owner
-1, // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curfaceID),// patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
mfFlip[faceI] // face flip in zone
faces[curfaceID], // modified face
curfaceID, // label of face being modified
addedCells[faceI], // owner
-1, // neighbour
false, // face flip
patchIDs[0], // patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
mfFlip[faceI], // face flip in zone
patchIDs[1] // subpatch id
)
);
// Pout << "Modifying a boundary face. Face: " << curfaceID << " flip: " << mfFlip[faceI] << endl;
@ -271,15 +282,16 @@ void Foam::layerAdditionRemoval::addCellLayer
(
polyModifyFace
(
faces[curfaceID], // modified face
curfaceID, // label of face being modified
own[curfaceID], // owner
addedCells[faceI], // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curfaceID),// patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
mfFlip[faceI] // face flip in zone
faces[curfaceID], // modified face
curfaceID, // label of face being modified
own[curfaceID], // owner
addedCells[faceI], // neighbour
false, // face flip
patchIDs[0], // patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
mfFlip[faceI], // face flip in zone
patchIDs[1] // subpatch id
)
);
@ -293,14 +305,15 @@ void Foam::layerAdditionRemoval::addCellLayer
polyModifyFace
(
faces[curfaceID].reverseFace(), // modified face
curfaceID, // label of face being modified
curfaceID, // label of face being modified
nei[curfaceID], // owner
addedCells[faceI], // neighbour
true, // face flip
mesh.boundaryMesh().whichPatch(curfaceID), // patch for face
patchIDs[0], // patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
!mfFlip[faceI] // face flip in zone
!mfFlip[faceI], // face flip in zone
patchIDs[1] // subpatch id
)
);
// Pout << "modify face, with flip " << curfaceID << " own: " << own[curfaceID] << " nei: " << addedCells[faceI] << endl;
@ -332,16 +345,17 @@ void Foam::layerAdditionRemoval::addCellLayer
(
polyAddFace
(
newFace, // face
addedCells[edgeFaces[curEdgeID][0]], // owner
addedCells[edgeFaces[curEdgeID][1]], // neighbour
-1, // master point
meshEdges[curEdgeID], // master edge
-1, // master face
false, // flip flux
-1, // patch for face
-1, // zone for face
false // face zone flip
newFace, // face
addedCells[edgeFaces[curEdgeID][0]], // owner
addedCells[edgeFaces[curEdgeID][1]], // neighbour
-1, // master point
meshEdges[curEdgeID], // master edge
-1, // master face
false, // flip flux
-1, // patch for face
-1, // zone for face
false, // face zone flip
-1 // subpatch id
)
);
@ -379,7 +393,7 @@ void Foam::layerAdditionRemoval::addCellLayer
// Determine the patch for insertion
const labelList& curFaces = meshEdgeFaces[meshEdges[curEdgeID]];
label patchID = -1;
labelPair patchIDs(-1, -1);
label zoneID = -1;
forAll (curFaces, faceI)
@ -392,7 +406,11 @@ void Foam::layerAdditionRemoval::addCellLayer
if (zoneMesh.whichZone(cf) != faceZoneID_.index())
{
// Found the face in a boundary patch which is not in zone
patchID = mesh.boundaryMesh().whichPatch(cf);
patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
cf
);
zoneID = mesh.faceZones().whichZone(cf);
break;
@ -400,7 +418,7 @@ void Foam::layerAdditionRemoval::addCellLayer
}
}
if (patchID < 0)
if (patchIDs[0] < 0)
{
FatalErrorIn
(
@ -415,16 +433,17 @@ void Foam::layerAdditionRemoval::addCellLayer
(
polyAddFace
(
newFace, // face
addedCells[edgeFaces[curEdgeID][0]], // owner
-1, // neighbour
-1, // master point
meshEdges[curEdgeID], // master edge
-1, // master face
false, // flip flux
patchID, // patch for face
zoneID, // zone
false // zone face flip
newFace, // face
addedCells[edgeFaces[curEdgeID][0]], // owner
-1, // neighbour
-1, // master point
meshEdges[curEdgeID], // master edge
-1, // master face
false, // flip flux
patchIDs[0], // patch for face
zoneID, // zone
false, // zone face flip
patchIDs[1] // subpatch id
)
);
// Pout << "add boundary face: " << newFace << " into patch " << patchID << " own: " << addedCells[edgeFaces[curEdgeID][0]] << endl;
@ -534,13 +553,20 @@ void Foam::layerAdditionRemoval::addCellLayer
-1, // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
modifiedFaceZoneFlip, // face flip in zone
-1 // subpatch ID
)
);
// Pout << "modifying stick-out face. Internal Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " nei: " << nei[curFaceID] << endl;
}
else
{
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curFaceID
);
ref.setAction
(
polyModifyFace
@ -550,10 +576,11 @@ void Foam::layerAdditionRemoval::addCellLayer
own[curFaceID], // owner
-1, // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
patchIDs[0], // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
modifiedFaceZoneFlip, // face flip in zone
patchIDs[1] // subpatch
)
);
// Pout << "modifying stick-out face. Boundary Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " patch: " << mesh.boundaryMesh().whichPatch(curFaceID) << endl;

View File

@ -247,6 +247,12 @@ void Foam::layerAdditionRemoval::removeCellLayer
newNei = -1;
}
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curFaceID
);
// Modify the face
ref.setAction
(
@ -257,10 +263,11 @@ void Foam::layerAdditionRemoval::removeCellLayer
own[curFaceID], // owner
newNei, // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curFaceID),// patch for face
patchIDs[0], // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
modifiedFaceZoneFlip, // face flip in zone
patchIDs[1] // subpatch
)
);
}
@ -296,7 +303,9 @@ void Foam::layerAdditionRemoval::removeCellLayer
label newOwner = -1;
label newNeighbour = -1;
bool flipFace = false;
label newPatchID = -1;
labelPair newPatchIDs(-1, -1);
//label newPatchID = -1;
//label newSubPatchID = -1;
label newZoneID = -1;
// Is any of the faces a boundary face? If so, grab the patch
@ -309,7 +318,11 @@ void Foam::layerAdditionRemoval::removeCellLayer
newOwner = slaveSideCell;
newNeighbour = -1;
flipFace = false;
newPatchID = mesh.boundaryMesh().whichPatch(mf[faceI]);
newPatchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
mf[faceI]
);
newZoneID = mesh.faceZones().whichZone(mf[faceI]);
}
else if (!mesh.isInternalFace(ftc[faceI]))
@ -328,7 +341,11 @@ void Foam::layerAdditionRemoval::removeCellLayer
flipFace = true;
}
newPatchID = mesh.boundaryMesh().whichPatch(ftc[faceI]);
newPatchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
ftc[faceI]
);
// The zone of the master face is preserved
newZoneID = mesh.faceZones().whichZone(mf[faceI]);
@ -349,7 +366,7 @@ void Foam::layerAdditionRemoval::removeCellLayer
flipFace = true;
}
newPatchID = -1;
newPatchIDs = labelPair(-1, -1);
// The zone of the master face is preserved
newZoneID = mesh.faceZones().whichZone(mf[faceI]);
@ -379,15 +396,16 @@ void Foam::layerAdditionRemoval::removeCellLayer
(
polyModifyFace
(
newFace, // modified face
mf[faceI], // label of face being modified
newOwner, // owner
newNeighbour, // neighbour
flipFace, // flip
newPatchID, // patch for face
false, // remove from zone
newZoneID, // new zone
zoneFlip // face flip in zone
newFace, // modified face
mf[faceI], // label of face being modified
newOwner, // owner
newNeighbour, // neighbour
flipFace, // flip
newPatchIDs[0], // patch for face
false, // remove from zone
newZoneID, // new zone
zoneFlip, // face flip in zone
newPatchIDs[1] // subpatch for face
)
);
}

View File

@ -55,17 +55,12 @@ defineTypeNameAndDebug(boundaryCutter, 0);
void Foam::boundaryCutter::getFaceInfo
(
const label faceI,
label& patchID,
labelPair& patchIDs,
label& zoneID,
label& zoneFlip
) const
{
patchID = -1;
if (!mesh_.isInternalFace(faceI))
{
patchID = mesh_.boundaryMesh().whichPatch(faceI);
}
patchIDs = polyTopoChange::whichPatch(mesh_.boundaryMesh(), faceI);
zoneID = mesh_.faceZones().whichZone(faceI);
@ -158,8 +153,9 @@ void Foam::boundaryCutter::addFace
) const
{
// Information about old face
label patchID, zoneID, zoneFlip;
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
label zoneID, zoneFlip;
labelPair patchIDs;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
label own = mesh_.faceOwner()[faceI];
label masterPoint = mesh_.faces()[faceI][0];
@ -169,15 +165,16 @@ void Foam::boundaryCutter::addFace
(
polyModifyFace
(
newFace, // face
newFace, // face
faceI,
own, // owner
-1, // neighbour
false, // flux flip
patchID, // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face zone flip
own, // owner
-1, // neighbour
false, // flux flip
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip, // face zone flip
patchIDs[1] // subPatch ID
)
);
@ -196,9 +193,10 @@ void Foam::boundaryCutter::addFace
-1, // master edge
-1, // master face for addition
false, // flux flip
patchID, // patch for face
patchIDs[0], // patch for face
zoneID, // zone for face
zoneFlip // face zone flip
zoneFlip, // face zone flip
patchIDs[1]
)
);
}
@ -276,10 +274,6 @@ bool Foam::boundaryCutter::splitFace
// - walk to next cut. Make face
// - loop until face done.
// Information about old face
label patchID, zoneID, zoneFlip;
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
// Get face with new points on cut edges for ease of looping
face extendedFace(addEdgeCutsToFace(faceI, edgeToAddedPoints));
@ -578,8 +572,9 @@ void Foam::boundaryCutter::setRefinement
label addedPointI = iter();
// Information about old face
label patchID, zoneID, zoneFlip;
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
labelPair patchIDs;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
label own = mesh_.faceOwner()[faceI];
label masterPoint = mesh_.faces()[faceI][0];
@ -607,10 +602,11 @@ void Foam::boundaryCutter::setRefinement
own, // owner
-1, // neighbour
false, // flux flip
patchID, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face zone flip
zoneFlip, // face zone flip
patchIDs[1]
)
);
}
@ -628,9 +624,10 @@ void Foam::boundaryCutter::setRefinement
-1, // master edge
-1, // master face for addition
false, // flux flip
patchID, // patch for face
patchIDs[0], // patch for face
zoneID, // zone for face
zoneFlip // face zone flip
zoneFlip, // face zone flip
patchIDs[1]
)
);
}
@ -661,8 +658,9 @@ void Foam::boundaryCutter::setRefinement
face newFace(addEdgeCutsToFace(faceI, edgeToAddedPoints));
// Information about old face
label patchID, zoneID, zoneFlip;
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
labelPair patchIDs;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
label own = mesh_.faceOwner()[faceI];
label masterPoint = mesh_.faces()[faceI][0];
@ -710,10 +708,11 @@ void Foam::boundaryCutter::setRefinement
own, // owner
-1, // neighbour
false, // flux flip
patchID, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face zone flip
zoneFlip, // face zone flip
patchIDs[1]
)
);
@ -744,9 +743,10 @@ void Foam::boundaryCutter::setRefinement
-1, // master edge
-1, // master face for addition
false, // flux flip
patchID, // patch for face
patchIDs[0], // patch for face
zoneID, // zone for face
zoneFlip // face zone flip
zoneFlip, // face zone flip
patchIDs[1]
)
);
@ -806,8 +806,9 @@ void Foam::boundaryCutter::setRefinement
nei = mesh_.faceNeighbour()[faceI];
}
label patchID, zoneID, zoneFlip;
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
labelPair patchIDs;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
meshMod.setAction
(
@ -818,10 +819,11 @@ void Foam::boundaryCutter::setRefinement
own, // owner
nei, // neighbour
false, // face flip
patchID, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
patchIDs[1]
)
);

View File

@ -84,7 +84,7 @@ class boundaryCutter
void getFaceInfo
(
const label faceI,
label& patchID,
labelPair& patchID,
label& zoneID,
label& zoneFlip
) const;

View File

@ -202,7 +202,7 @@ void Foam::meshCutAndRemove::faceCells
const label faceI,
label& own,
label& nei,
label& patchID
labelPair& patchIDs
) const
{
const labelListList& anchorPts = cuts.cellAnchorPoints();
@ -230,12 +230,12 @@ void Foam::meshCutAndRemove::faceCells
}
}
patchID = mesh().boundaryMesh().whichPatch(faceI);
patchIDs = polyTopoChange::whichPatch(mesh().boundaryMesh(), faceI);
if (patchID == -1 && (own == -1 || nei == -1))
if (patchIDs[0] == -1 && (own == -1 || nei == -1))
{
// Face was internal but becomes external
patchID = exposedPatchI;
patchIDs[0] = exposedPatchI;
}
}
@ -269,7 +269,7 @@ void Foam::meshCutAndRemove::addFace
const face& newFace,
const label own,
const label nei,
const label patchID
const labelPair& patchIDs
)
{
label zoneID;
@ -285,7 +285,7 @@ void Foam::meshCutAndRemove::addFace
Pout<< "Adding face " << newFace
<< " with new owner:" << own
<< " with new neighbour:" << nei
<< " patchID:" << patchID
<< " patchIDs:" << patchIDs
<< " anchor:" << masterPointI
<< " zoneID:" << zoneID
<< " zoneFlip:" << zoneFlip
@ -303,9 +303,10 @@ void Foam::meshCutAndRemove::addFace
-1, // master edge
-1, // master face for addition
false, // flux flip
patchID, // patch for face
patchIDs[0], // patch for face
zoneID, // zone for face
zoneFlip // face zone flip
zoneFlip, // face zone flip
patchIDs[1]
)
);
}
@ -317,7 +318,7 @@ void Foam::meshCutAndRemove::addFace
Pout<< "Adding (reversed) face " << newFace.reverseFace()
<< " with new owner:" << nei
<< " with new neighbour:" << own
<< " patchID:" << patchID
<< " patchIDs:" << patchIDs
<< " anchor:" << masterPointI
<< " zoneID:" << zoneID
<< " zoneFlip:" << zoneFlip
@ -335,9 +336,10 @@ void Foam::meshCutAndRemove::addFace
-1, // master edge
-1, // master face for addition
false, // flux flip
patchID, // patch for face
patchIDs[0], // patch for face
zoneID, // zone for face
zoneFlip // face zone flip
zoneFlip, // face zone flip
patchIDs[1]
)
);
}
@ -352,7 +354,7 @@ void Foam::meshCutAndRemove::modFace
const face& newFace,
const label own,
const label nei,
const label patchID
const labelPair& patchIDs
)
{
label zoneID;
@ -377,7 +379,7 @@ void Foam::meshCutAndRemove::modFace
<< " new vertices:" << newFace
<< " new owner:" << own
<< " new neighbour:" << nei
<< " new patch:" << patchID
<< " new patch:" << patchIDs[0]
<< " new zoneID:" << zoneID
<< " new zoneFlip:" << zoneFlip
<< endl;
@ -394,10 +396,11 @@ void Foam::meshCutAndRemove::modFace
own, // owner
nei, // neighbour
false, // face flip
patchID, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
patchIDs[1] // subPatch
)
);
}
@ -412,10 +415,11 @@ void Foam::meshCutAndRemove::modFace
nei, // owner
own, // neighbour
false, // face flip
patchID, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
patchIDs[1] // subPatch
)
);
}
@ -861,7 +865,8 @@ void Foam::meshCutAndRemove::setRefinement
false, // flux flip
cutPatch[cellI], // patch for face
-1, // zone for face
false // face zone flip
false, // face zone flip
-1 //? TBD
)
);
@ -1083,11 +1088,11 @@ void Foam::meshCutAndRemove::setRefinement
// If faces were internal but now become external set a patch.
// If they were external already keep the patch.
label patchID = patches.whichPatch(faceI);
labelPair patchIDs = polyTopoChange::whichPatch(patches, faceI);
if (patchID == -1)
if (patchIDs[0] == -1)
{
patchID = exposedPatchI;
patchIDs[0] = exposedPatchI;
}
@ -1101,7 +1106,7 @@ void Foam::meshCutAndRemove::setRefinement
if (f0Nei != -1)
{
// f0 becomes external face (note:modFace will reverse face)
modFace(meshMod, faceI, f0, f0Own, f0Nei, patchID);
modFace(meshMod, faceI, f0, f0Own, f0Nei, patchIDs);
modifiedFaceI = true;
}
}
@ -1110,13 +1115,13 @@ void Foam::meshCutAndRemove::setRefinement
if (f0Nei == -1)
{
// f0 becomes external face
modFace(meshMod, faceI, f0, f0Own, f0Nei, patchID);
modFace(meshMod, faceI, f0, f0Own, f0Nei, patchIDs);
modifiedFaceI = true;
}
else
{
// f0 stays internal face.
modFace(meshMod, faceI, f0, f0Own, f0Nei, -1);
modFace(meshMod, faceI, f0, f0Own, f0Nei, labelPair(-1, -1));
modifiedFaceI = true;
}
}
@ -1135,12 +1140,12 @@ void Foam::meshCutAndRemove::setRefinement
// f1 becomes external face (note:modFace will reverse face)
if (!modifiedFaceI)
{
modFace(meshMod, faceI, f1, f1Own, f1Nei, patchID);
modFace(meshMod, faceI, f1, f1Own, f1Nei, patchIDs);
modifiedFaceI = true;
}
else
{
label masterPointI = findPatchFacePoint(f1, patchID);
label masterPointI = findPatchFacePoint(f1, patchIDs[0]);
addFace
(
@ -1150,7 +1155,7 @@ void Foam::meshCutAndRemove::setRefinement
f1, // vertices of face
f1Own,
f1Nei,
patchID // patch for new face
patchIDs // patch for new face
);
}
}
@ -1162,12 +1167,12 @@ void Foam::meshCutAndRemove::setRefinement
// f1 becomes external face
if (!modifiedFaceI)
{
modFace(meshMod, faceI, f1, f1Own, f1Nei, patchID);
modFace(meshMod, faceI, f1, f1Own, f1Nei, patchIDs);
modifiedFaceI = true;
}
else
{
label masterPointI = findPatchFacePoint(f1, patchID);
label masterPointI = findPatchFacePoint(f1, patchIDs[0]);
addFace
(
@ -1177,7 +1182,7 @@ void Foam::meshCutAndRemove::setRefinement
f1,
f1Own,
f1Nei,
patchID
patchIDs
);
}
}
@ -1186,14 +1191,31 @@ void Foam::meshCutAndRemove::setRefinement
// f1 is internal face.
if (!modifiedFaceI)
{
modFace(meshMod, faceI, f1, f1Own, f1Nei, -1);
modFace
(
meshMod,
faceI,
f1,
f1Own,
f1Nei,
labelPair(-1, -1)
);
modifiedFaceI = true;
}
else
{
label masterPointI = findPatchFacePoint(f1, -1);
addFace(meshMod, faceI, masterPointI, f1, f1Own, f1Nei, -1);
addFace
(
meshMod,
faceI,
masterPointI,
f1,
f1Own,
f1Nei,
labelPair(-1, -1)
);
}
}
}
@ -1236,8 +1258,9 @@ void Foam::meshCutAndRemove::setRefinement
// borders by edge a cell which has been split.
// Get (new or original) owner and neighbour of faceI
label own, nei, patchID;
faceCells(cuts, exposedPatchI, faceI, own, nei, patchID);
label own, nei;
labelPair patchIDs;
faceCells(cuts, exposedPatchI, faceI, own, nei, patchIDs);
if (own == -1 && nei == -1)
@ -1268,7 +1291,7 @@ void Foam::meshCutAndRemove::setRefinement
newFace,
own,
nei,
patchID
patchIDs
);
}
@ -1292,8 +1315,9 @@ void Foam::meshCutAndRemove::setRefinement
if (!faceUptodate[faceI])
{
// Get (new or original) owner and neighbour of faceI
label own, nei, patchID;
faceCells(cuts, exposedPatchI, faceI, own, nei, patchID);
labelPair patchIDs;
label own, nei;
faceCells(cuts, exposedPatchI, faceI, own, nei, patchIDs);
if (own == -1 && nei == -1)
{
@ -1306,7 +1330,7 @@ void Foam::meshCutAndRemove::setRefinement
}
else
{
modFace(meshMod, faceI, faces[faceI], own, nei, patchID);
modFace(meshMod, faceI, faces[faceI], own, nei, patchIDs);
}
faceUptodate[faceI] = true;

View File

@ -106,7 +106,7 @@ class meshCutAndRemove
const label faceI,
label& own,
label& nei,
label& patchID
labelPair& patchIDs
) const;
//- Get zone information for face.
@ -126,7 +126,7 @@ class meshCutAndRemove
const face& newFace,
const label owner,
const label neighbour,
const label patchID
const labelPair& patchIDs
);
//- Modifies existing faceI for either new owner/neighbour or
@ -139,7 +139,7 @@ class meshCutAndRemove
const face& newFace,
const label owner,
const label neighbour,
const label patchID
const labelPair& patchIDs
);
// Copies face starting from startFp. Jumps cuts. Marks visited

View File

@ -195,17 +195,12 @@ void Foam::meshCutter::faceCells
void Foam::meshCutter::getFaceInfo
(
const label faceI,
label& patchID,
labelPair& patchIDs,
label& zoneID,
label& zoneFlip
) const
{
patchID = -1;
if (!mesh().isInternalFace(faceI))
{
patchID = mesh().boundaryMesh().whichPatch(faceI);
}
patchIDs = polyTopoChange::whichPatch(mesh().boundaryMesh(), faceI);
zoneID = mesh().faceZones().whichZone(faceI);
@ -230,9 +225,9 @@ void Foam::meshCutter::addFace
const label nei
)
{
label patchID, zoneID, zoneFlip;
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
labelPair patchIDs;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
if ((nei == -1) || (own < nei))
{
@ -242,7 +237,7 @@ void Foam::meshCutter::addFace
Pout<< "Adding face " << newFace
<< " with new owner:" << own
<< " with new neighbour:" << nei
<< " patchID:" << patchID
<< " patchIDs:" << patchIDs
<< " zoneID:" << zoneID
<< " zoneFlip:" << zoneFlip
<< endl;
@ -259,9 +254,10 @@ void Foam::meshCutter::addFace
-1, // master edge
faceI, // master face for addition
false, // flux flip
patchID, // patch for face
patchIDs[0], // patch for face
zoneID, // zone for face
zoneFlip // face zone flip
zoneFlip, // face zone flip
patchIDs[1] // subPatch
)
);
}
@ -273,7 +269,7 @@ void Foam::meshCutter::addFace
Pout<< "Adding (reversed) face " << newFace.reverseFace()
<< " with new owner:" << nei
<< " with new neighbour:" << own
<< " patchID:" << patchID
<< " patchIDs:" << patchIDs
<< " zoneID:" << zoneID
<< " zoneFlip:" << zoneFlip
<< endl;
@ -290,9 +286,10 @@ void Foam::meshCutter::addFace
-1, // master edge
faceI, // master face for addition
false, // flux flip
patchID, // patch for face
patchIDs[0], // patch for face
zoneID, // zone for face
zoneFlip // face zone flip
zoneFlip, // face zone flip
patchIDs[1] // subPatch
)
);
}
@ -309,9 +306,9 @@ void Foam::meshCutter::modFace
const label nei
)
{
label patchID, zoneID, zoneFlip;
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
labelPair patchIDs;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
if
(
@ -346,10 +343,11 @@ void Foam::meshCutter::modFace
own, // owner
nei, // neighbour
false, // face flip
patchID, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
patchIDs[1] // subPatch
)
);
}
@ -364,10 +362,11 @@ void Foam::meshCutter::modFace
nei, // owner
own, // neighbour
false, // face flip
patchID, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
patchIDs[1] // subPatch
)
);
}
@ -713,7 +712,8 @@ void Foam::meshCutter::setRefinement
false, // flux flip
-1, // patch for face
-1, // zone for face
false // face zone flip
false, // face zone flip
-1 // subpatch
)
);

View File

@ -185,7 +185,7 @@ class meshCutter
void getFaceInfo
(
const label faceI,
label& patchID,
labelPair& patchIDs,
label& zoneID,
label& zoneFlip
) const;

View File

@ -46,6 +46,76 @@ defineTypeNameAndDebug(motionSmoother, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::motionSmoother::testSyncPositions(const pointField& fld) const
{
pointField syncedFld(fld);
syncTools::syncPointPositions
(
mesh_,
syncedFld,
minEqOp<point>(), // combine op
point(GREAT,GREAT,GREAT) // null
);
forAll(syncedFld, i)
{
if (syncedFld[i] != fld[i])
{
FatalErrorIn
(
"motionSmoother::testSyncPositions(const pointField&)"
) << "On point " << i << " point:" << fld[i]
<< " synchronised point:" << syncedFld[i]
<< abort(FatalError);
}
}
}
//Foam::tmp<Foam::scalarField> Foam::motionSmoother::sumWeights
//(
// const scalarField& edgeWeight
//) const
//{
// tmp<scalarField> tsumWeight
// (
// new scalarField
// (
// mesh_.nPoints(),
// 0.0
// )
// );
// scalarField& sumWeight = tsumWeight();
//
// const edgeList& edges = mesh_.edges();
//
// forAll(edges, edgeI)
// {
// if (isMasterEdge_.get(edgeI) == 1)
// {
// const edge& e = edges[edgeI];
// const scalar w = edgeWeight[edgeI];
// sumWeight[e[0]] += w;
// sumWeight[e[1]] += w;
// }
// }
//
//
// // Add coupled contributions
// // ~~~~~~~~~~~~~~~~~~~~~~~~~
// syncTools::syncPointList
// (
// mesh,
// sumWeight,
// plusEqOp<scalar>(),
// scalar(0) // null value
// );
//
// return tsumWeight;
//}
// From pointPatchInterpolation
void Foam::motionSmoother::makePatchPatchAddressing()
{
@ -215,8 +285,7 @@ void Foam::motionSmoother::minSmooth
tmp<pointScalarField> tavgFld = avg
(
fld,
scalarField(mesh_.nEdges(), 1.0), // uniform weighting
false // fld is not position.
scalarField(mesh_.nEdges(), 1.0) // uniform weighting
);
const pointScalarField& avgFld = tavgFld();
@ -249,8 +318,7 @@ void Foam::motionSmoother::minSmooth
tmp<pointScalarField> tavgFld = avg
(
fld,
scalarField(mesh_.nEdges(), 1.0), // uniform weighting
false // fld is not position.
scalarField(mesh_.nEdges(), 1.0) // uniform weighting
);
const pointScalarField& avgFld = tavgFld();
@ -612,8 +680,7 @@ void Foam::motionSmoother::setDisplacement(pointField& patchDisp)
mesh_,
displacement_,
maxMagEqOp(), // combine op
vector::zero, // null value
false // no separation
vector::zero // null value
);
// Adapt the fixedValue bc's (i.e. copy internal point data to
@ -718,8 +785,7 @@ void Foam::motionSmoother::correctBoundaryConditions
mesh_,
displacement,
maxMagEqOp(), // combine op
vector::zero, // null value
false // no separation
vector::zero // null value
);
}
@ -769,13 +835,7 @@ Foam::tmp<Foam::scalarField> Foam::motionSmoother::movePoints
{
Pout<< "motionSmoother::movePoints : testing sync of newPoints."
<< endl;
testSyncField
(
newPoints,
minEqOp<point>(), // combine op
vector(GREAT,GREAT,GREAT), // null
true // separation
);
testSyncPositions(newPoints);
}
tmp<scalarField> tsweptVol = mesh_.movePoints(newPoints);
@ -874,8 +934,7 @@ bool Foam::motionSmoother::scaleMesh
mesh_,
displacement_,
maxMagEqOp(),
vector::zero, // null value
false // no separation
vector::zero // null value
);
// Set newPoints as old + scale*displacement
@ -905,8 +964,7 @@ bool Foam::motionSmoother::scaleMesh
(
totalDisplacement,
maxMagEqOp(),
vector::zero, // null value
false // separation
vector::zero // null value
);
}
@ -1035,8 +1093,7 @@ bool Foam::motionSmoother::scaleMesh
mesh_,
scale_,
maxEqOp<scalar>(),
-GREAT, // null value
false // no separation
-GREAT // null value
);

View File

@ -176,13 +176,20 @@ class motionSmoother
// Private Member Functions
//- Average of connected points.
//- Average value (not positions!) of connected points.
template <class Type>
tmp<GeometricField<Type, pointPatchField, pointMesh> > avg
(
const GeometricField<Type, pointPatchField, pointMesh>& fld,
const scalarField& edgeWeight,
const bool separation
const scalarField& edgeWeight
) const;
//- Average postion of connected points.
template <class Type>
tmp<GeometricField<Type, pointPatchField, pointMesh> > avgPositions
(
const GeometricField<Type, pointPatchField, pointMesh>& fld,
const scalarField& edgeWeight
) const;
//- Check constraints
@ -199,16 +206,18 @@ class motionSmoother
GeometricField<Type, pointPatchField, pointMesh>&
) const;
//- Test synchronisation of pointField
//- Test synchronisation of generic field (not positions!) on points
template<class Type, class CombineOp>
void testSyncField
(
const Field<Type>&,
const CombineOp& cop,
const Type& zero,
const bool separation
const Type& zero
) const;
//- Test synchronisation of points
void testSyncPositions(const pointField&) const;
//- Assemble tensors for multi-patch constraints
void makePatchPatchAddressing();
@ -461,14 +470,13 @@ public:
// Helper functions to manipulate displacement vector.
//- Fully explicit smoothing of internal points with varying
// diffusivity.
//- Fully explicit smoothing of fields (not positions)
// of internal points with varying diffusivity.
template <class Type>
void smooth
(
const GeometricField<Type, pointPatchField, pointMesh>& fld,
const scalarField& edgeWeight,
const bool separation,
GeometricField<Type, pointPatchField, pointMesh>& newFld
) const;
};

View File

@ -157,11 +157,10 @@ void Foam::motionSmoother::applyCornerConstraints
// Average of connected points.
template <class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
Foam::motionSmoother::avg
Foam::motionSmoother::avg
(
const GeometricField<Type, pointPatchField, pointMesh>& fld,
const scalarField& edgeWeight,
const bool separation
const scalarField& edgeWeight
) const
{
tmp<GeometricField<Type, pointPatchField, pointMesh> > tres
@ -174,7 +173,8 @@ Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
fld.time().timeName(),
fld.db(),
IOobject::NO_READ,
IOobject::NO_WRITE
IOobject::NO_WRITE,
false
),
fld.mesh(),
dimensioned<Type>("zero", fld.dimensions(), pTraits<Type>::zero)
@ -219,20 +219,16 @@ Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
mesh,
res,
plusEqOp<Type>(),
pTraits<Type>::zero, // null value
separation // separation
pTraits<Type>::zero // null value
);
syncTools::syncPointList
(
mesh,
sumWeight,
plusEqOp<scalar>(),
scalar(0), // null value
false // separation
scalar(0) // null value
);
// Average
// ~~~~~~~
@ -262,16 +258,10 @@ void Foam::motionSmoother::smooth
(
const GeometricField<Type, pointPatchField, pointMesh>& fld,
const scalarField& edgeWeight,
const bool separation,
GeometricField<Type, pointPatchField, pointMesh>& newFld
) const
{
tmp<pointVectorField> tavgFld = avg
(
fld,
edgeWeight, // weighting
separation // whether to apply separation vector
);
tmp<pointVectorField> tavgFld = avg(fld, edgeWeight);
const pointVectorField& avgFld = tavgFld();
forAll(fld, pointI)
@ -287,14 +277,13 @@ void Foam::motionSmoother::smooth
}
//- Test synchronisation of pointField
//- Test synchronisation of generic field (not positions!) on points
template<class Type, class CombineOp>
void Foam::motionSmoother::testSyncField
(
const Field<Type>& fld,
const CombineOp& cop,
const Type& zero,
const bool separation
const Type& zero
) const
{
if (debug)
@ -310,8 +299,7 @@ void Foam::motionSmoother::testSyncField
mesh_,
syncedFld,
cop,
zero, // null value
separation // separation
zero
);
forAll(syncedFld, i)

View File

@ -372,13 +372,13 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct
// Calculate coupled cell centre
vectorField neiCc(mesh.nFaces()-mesh.nInternalFaces());
pointField neiCc(mesh.nFaces()-mesh.nInternalFaces());
for (label faceI = mesh.nInternalFaces(); faceI < mesh.nFaces(); faceI++)
{
neiCc[faceI-mesh.nInternalFaces()] = cellCentres[own[faceI]];
}
syncTools::swapBoundaryFaceList(mesh, neiCc, true);
syncTools::swapBoundaryFacePositions(mesh, neiCc);
scalar minDDotS = GREAT;
@ -742,13 +742,13 @@ bool Foam::polyMeshGeometry::checkFaceSkewness
const polyBoundaryMesh& patches = mesh.boundaryMesh();
// Calculate coupled cell centre
vectorField neiCc(mesh.nFaces()-mesh.nInternalFaces());
pointField neiCc(mesh.nFaces()-mesh.nInternalFaces());
for (label faceI = mesh.nInternalFaces(); faceI < mesh.nFaces(); faceI++)
{
neiCc[faceI-mesh.nInternalFaces()] = cellCentres[own[faceI]];
}
syncTools::swapBoundaryFaceList(mesh, neiCc, true);
syncTools::swapBoundaryFacePositions(mesh, neiCc);
scalar maxSkew = 0;
@ -950,13 +950,13 @@ bool Foam::polyMeshGeometry::checkFaceWeights
const polyBoundaryMesh& patches = mesh.boundaryMesh();
// Calculate coupled cell centre
vectorField neiCc(mesh.nFaces()-mesh.nInternalFaces());
pointField neiCc(mesh.nFaces()-mesh.nInternalFaces());
for (label faceI = mesh.nInternalFaces(); faceI < mesh.nFaces(); faceI++)
{
neiCc[faceI-mesh.nInternalFaces()] = cellCentres[own[faceI]];
}
syncTools::swapBoundaryFaceList(mesh, neiCc, true);
syncTools::swapBoundaryFacePositions(mesh, neiCc);
scalar minWeight = GREAT;
@ -1113,7 +1113,7 @@ bool Foam::polyMeshGeometry::checkVolRatio
{
neiVols[faceI-mesh.nInternalFaces()] = cellVolumes[own[faceI]];
}
syncTools::swapBoundaryFaceList(mesh, neiVols, true);
syncTools::swapBoundaryFaceList(mesh, neiVols);
scalar minRatio = GREAT;
@ -1457,13 +1457,13 @@ bool Foam::polyMeshGeometry::checkFaceTwist
const polyBoundaryMesh& patches = mesh.boundaryMesh();
// Calculate coupled cell centre
vectorField neiCc(mesh.nFaces()-mesh.nInternalFaces());
pointField neiCc(mesh.nFaces()-mesh.nInternalFaces());
for (label faceI = mesh.nInternalFaces(); faceI < mesh.nFaces(); faceI++)
{
neiCc[faceI-mesh.nInternalFaces()] = cellCentres[own[faceI]];
}
syncTools::swapBoundaryFaceList(mesh, neiCc, true);
syncTools::swapBoundaryFacePositions(mesh, neiCc);
forAll(checkFaces, i)
{

View File

@ -335,16 +335,12 @@ void Foam::perfectInterface::setRefinement(polyTopoChange& ref) const
label nbr = -1;
label patchI = -1;
labelPair patchIds = polyTopoChange::whichPatch(patches, faceI);
if (mesh.isInternalFace(faceI))
{
nbr = mesh.faceNeighbour()[faceI];
}
else
{
patchI = patches.whichPatch(faceI);
}
label zoneID = mesh.faceZones().whichZone(faceI);
@ -366,10 +362,11 @@ void Foam::perfectInterface::setRefinement(polyTopoChange& ref) const
mesh.faceOwner()[faceI], // owner
nbr, // neighbour
false, // face flip
patchI, // patch for face
patchIds[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
patchIds[1] // subPatch
)
);
}
@ -433,7 +430,8 @@ void Foam::perfectInterface::setRefinement(polyTopoChange& ref) const
-1, // patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
mfFlip[i] // face flip in zone
mfFlip[i], // face flip in zone
-1 // subPatch
)
);
}
@ -451,7 +449,8 @@ void Foam::perfectInterface::setRefinement(polyTopoChange& ref) const
-1, // patch for face
false, // remove from zone
faceZoneID_.index(), // zone for face
!mfFlip[i] // face flip in zone
!mfFlip[i], // face flip in zone
-1 // subPatch
)
);
}

View File

@ -86,6 +86,8 @@ class polyAddFace
//- Face zone flip
bool zoneFlip_;
//- Sub patch ID (for proc patches)
label subPatchID_;
public:
@ -109,7 +111,8 @@ public:
flipFaceFlux_(false),
patchID_(-1),
zoneID_(-1),
zoneFlip_(false)
zoneFlip_(false),
subPatchID_(-1)
{}
@ -125,7 +128,8 @@ public:
const bool flipFaceFlux,
const label patchID,
const label zoneID,
const bool zoneFlip
const bool zoneFlip,
const label subPatchID
)
:
face_(f),
@ -137,7 +141,8 @@ public:
flipFaceFlux_(flipFaceFlux),
patchID_(patchID),
zoneID_(zoneID),
zoneFlip_(zoneFlip)
zoneFlip_(zoneFlip),
subPatchID_(subPatchID)
{
if (face_.size() < 3)
{
@ -154,7 +159,8 @@ public:
" const bool flipFaceFlux,\n"
" const label patchID,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
" const bool zoneFlip,\n"
" const label subPatchID\n"
")"
) << "Invalid face: less than 3 points. "
<< "This is not allowed.\n"
@ -183,7 +189,8 @@ public:
" const bool flipFaceFlux,\n"
" const label patchID,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
" const bool zoneFlip,\n"
" const label subPatchID\n"
")"
) << "Face contains invalid vertex ID: " << face_ << ". "
<< "This is not allowed.\n"
@ -212,7 +219,8 @@ public:
" const bool flipFaceFlux,\n"
" const label patchID,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
" const bool zoneFlip,\n"
" const label subPatchID\n"
")"
) << "Face owner and neighbour are identical. "
<< "This is not allowed.\n"
@ -241,7 +249,8 @@ public:
" const bool flipFaceFlux,\n"
" const label patchID,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
" const bool zoneFlip,\n"
" const label subPatchID\n"
")"
) << "Patch face has got a neighbour. Patch ID: " << patchID
<< ". This is not allowed.\n"
@ -264,8 +273,14 @@ public:
" const face& f,\n"
" const label owner,"
" const label neighbour,\n"
" const label masterPointID,\n"
" const label masterEdgeID,\n"
" const label masterFaceID,\n"
" const bool flipFaceFlux,\n"
" const label patchID,\n"
" const label zoneID"
" const label zoneID,\n"
" const bool zoneFlip,\n"
" const label subPatchID\n"
")"
) << "Face has no owner and is not in a zone. "
<< "This is not allowed.\n"
@ -292,9 +307,12 @@ public:
" const label masterPointID,\n"
" const label masterEdgeID,\n"
" const label masterFaceID,\n"
" const bool flipFaceFlux,\n"
" const label patchID,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
" const bool zoneFlip,\n"
" const label subPatchID\n"
")"
")"
) << "Specified zone flip for a face that does not "
<< "belong to zone. This is not allowed.\n"
@ -421,6 +439,13 @@ public:
{
return zoneFlip_;
}
//- Boundary sub patch ID
label subPatchID() const
{
return subPatchID_;
}
};

View File

@ -39,8 +39,59 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::addPatchCellLayer, 0);
namespace Foam
{
defineTypeNameAndDebug(addPatchCellLayer, 0);
// To combineReduce a labelList. Filters out duplicates.
class uniqueEqOp
{
public:
void operator()(labelList& x, const labelList& y) const
{
if (x.size() == 0)
{
if (y.size() > 0)
{
x = y;
}
}
else
{
forAll(y, yi)
{
if (findIndex(x, y[yi]) == -1)
{
label sz = x.size();
x.setSize(sz+1);
x[sz] = y[yi];
}
}
}
}
};
// Dummy transform for List. Used in synchronisation
class dummyTransformList
{
public:
void operator()(const coupledPolyPatch&, Field<labelList>&) const
{}
};
// Dummy template specialisation for pTraits<face>. Used in synchronisation
template<>
class pTraits<labelList>
{
public:
//- Component type
typedef label cmptType;
};
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -106,7 +157,7 @@ Foam::labelListList Foam::addPatchCellLayer::calcGlobalEdgeFaces
globalEdgeFaces,
uniqueEqOp(),
labelList(), // null value
false // no separation
dummyTransformList() // dummy transform
);
// Extract pp part
@ -321,7 +372,7 @@ Foam::labelPair Foam::addPatchCellLayer::getEdgeString
Foam::label Foam::addPatchCellLayer::addSideFace
(
const indirectPrimitivePatch& pp,
const labelList& patchID, // prestored patch per pp face
const List<labelPair>& patchIDs, // prestored patch per pp face
const labelListList& addedCells, // per pp face the new extruded cell
const face& newFace,
const label ownFaceI, // pp face that provides owner
@ -365,7 +416,7 @@ Foam::label Foam::addPatchCellLayer::addSideFace
// Loop over all faces connected to edge to inflate and
// see if any boundary face (but not meshFaceI)
label otherPatchID = patchID[ownFaceI];
labelPair otherPatchID = patchIDs[ownFaceI];
forAll(meshFaces, k)
{
@ -377,7 +428,7 @@ Foam::label Foam::addPatchCellLayer::addSideFace
&& !mesh_.isInternalFace(faceI)
)
{
otherPatchID = patches.whichPatch(faceI);
otherPatchID = polyTopoChange::whichPatch(patches, faceI);
break;
}
}
@ -422,9 +473,10 @@ Foam::label Foam::addPatchCellLayer::addSideFace
inflateEdgeI, // master edge
-1, // master face
false, // flux flip
otherPatchID, // patch for face
otherPatchID[0], // patch for face
zoneI, // zone for face
false // face zone flip
false, // face zone flip
otherPatchID[1] // subPatch
)
);
}
@ -490,7 +542,8 @@ Foam::label Foam::addPatchCellLayer::addSideFace
false, // flux flip
-1, // patch for face
zoneI, // zone for face
false // face zone flip
false, // face zone flip
-1 // subPatch
)
);
@ -633,7 +686,7 @@ void Foam::addPatchCellLayer::setRefinement
{
labelList n(mesh_.nPoints(), 0);
IndirectList<label>(n, meshPoints) = nPointLayers;
syncTools::syncPointList(mesh_, n, maxEqOp<label>(), 0, false);
syncTools::syncPointList(mesh_, n, maxEqOp<label>(), 0);
// Non-synced
forAll(meshPoints, i)
@ -677,8 +730,7 @@ void Foam::addPatchCellLayer::setRefinement
mesh_,
nFromFace,
maxEqOp<label>(),
0,
false
0
);
forAll(nPointLayers, i)
@ -715,8 +767,7 @@ void Foam::addPatchCellLayer::setRefinement
mesh_,
d,
minEqOp<vector>(),
wallPoint::greatPoint,
false
wallPoint::greatPoint
);
forAll(meshPoints, i)
@ -942,14 +993,14 @@ void Foam::addPatchCellLayer::setRefinement
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
// Precalculated patchID for each patch face
labelList patchID(pp.size());
// Precalculated patchID (patch+subpatch) for each patch face
List<labelPair> patchIDs(pp.size());
forAll(pp, patchFaceI)
{
label meshFaceI = pp.addressing()[patchFaceI];
patchID[patchFaceI] = patches.whichPatch(meshFaceI);
patchIDs[patchFaceI] = polyTopoChange::whichPatch(patches, meshFaceI);
}
@ -999,19 +1050,19 @@ void Foam::addPatchCellLayer::setRefinement
// Get new neighbour
label nei;
label patchI;
labelPair patchID;
if (i == addedCells[patchFaceI].size()-1)
{
// Top layer so is patch face.
nei = -1;
patchI = patchID[patchFaceI];
patchID = patchIDs[patchFaceI];
}
else
{
// Internal face between layer i and i+1
nei = addedCells[patchFaceI][i+1];
patchI = -1;
patchID = labelPair(-1, -1);
}
@ -1026,15 +1077,16 @@ void Foam::addPatchCellLayer::setRefinement
-1, // master edge
meshFaceI, // master face for addition
false, // flux flip
patchI, // patch for face
patchID[0], // patch for face
zoneI, // zone for face
false // face zone flip
false, // face zone flip
patchID[1] // subPatch
)
);
//Pout<< "Added inbetween face " << newFace
// << " own:" << addedCells[patchFaceI][i]
// << " nei:" << nei
// << " patch:" << patchI
// << " patch:" << patchID[0]
// << endl;
}
}
@ -1063,7 +1115,8 @@ void Foam::addPatchCellLayer::setRefinement
-1, // patch for face
false, // remove from zone
zoneI, // zone for face
false // face flip in zone
false, // face flip in zone
-1 // subPatch
)
);
//Pout<< "Modified old patch face " << meshFaceI
@ -1121,8 +1174,7 @@ void Foam::addPatchCellLayer::setRefinement
mesh_,
meshEdgeLayers,
maxEqOp<label>(),
0, // initial value
false // no separation
0 // initial value
);
forAll(meshEdges, edgeI)
@ -1366,7 +1418,7 @@ void Foam::addPatchCellLayer::setRefinement
addSideFace
(
pp,
patchID,
patchIDs,
addedCells,
newFace,
patchFaceI,

View File

@ -125,40 +125,6 @@ class globalIndex;
class addPatchCellLayer
{
// Private classes
// To combineReduce a labelList. Filters out duplicates.
class uniqueEqOp
{
public:
void operator()(labelList& x, const labelList& y) const
{
if (x.size() == 0)
{
if (y.size() > 0)
{
x = y;
}
}
else
{
forAll(y, yi)
{
if (findIndex(x, y[yi]) == -1)
{
label sz = x.size();
x.setSize(sz+1);
x[sz] = y[yi];
}
}
}
}
};
// Private data
//- Reference to mesh
@ -223,7 +189,7 @@ class addPatchCellLayer
label addSideFace
(
const indirectPrimitivePatch&,
const labelList& patchID,
const List<labelPair>& patchIDs,
const labelListList& addedCells,
const face& newFace,
const label ownFaceI,

View File

@ -658,7 +658,11 @@ void Foam::combineFaces::setRefinement
zoneFlip = fZone.flipMap()[fZone.whichFace(masterFaceI)];
}
label patchI = mesh_.boundaryMesh().whichPatch(masterFaceI);
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh_.boundaryMesh(),
masterFaceI
);
meshMod.setAction
(
@ -669,10 +673,11 @@ void Foam::combineFaces::setRefinement
mesh_.faceOwner()[masterFaceI], // owner
-1, // neighbour
false, // face flip
patchI, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
patchIDs[1]
)
);
@ -713,8 +718,7 @@ void Foam::combineFaces::setRefinement
mesh_,
nPointFaces,
plusEqOp<label>(),
0, // null value
false // no separation
0 // null value
);
// Remove all unused points. Store position if undoable.
@ -957,9 +961,13 @@ void Foam::combineFaces::setUnrefinement
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(masterFaceI)];
}
label patchI = mesh_.boundaryMesh().whichPatch(masterFaceI);
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh_.boundaryMesh(),
masterFaceI
);
if (mesh_.boundaryMesh()[patchI].coupled())
if (mesh_.boundaryMesh()[patchIDs[0]].coupled())
{
FatalErrorIn
(
@ -967,7 +975,7 @@ void Foam::combineFaces::setUnrefinement
"(const labelList&, polyTopoChange&"
", Map<label>&, Map<label>&, Map<label>&)"
) << "Master face " << masterFaceI << " is on coupled patch "
<< mesh_.boundaryMesh()[patchI].name()
<< mesh_.boundaryMesh()[patchIDs[0]].name()
<< abort(FatalError);
}
@ -984,10 +992,11 @@ void Foam::combineFaces::setUnrefinement
own, // owner
-1, // neighbour
false, // face flip
patchI, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
patchIDs[1] // subPatchID
)
);
@ -1001,16 +1010,17 @@ void Foam::combineFaces::setUnrefinement
(
polyAddFace
(
faces[i], // vertices
own, // owner,
-1, // neighbour,
-1, // masterPointID,
-1, // masterEdgeID,
masterFaceI, // masterFaceID,
false, // flipFaceFlux,
patchI, // patchID,
zoneID, // zoneID,
zoneFlip // zoneFlip
faces[i], // vertices
own, // owner,
-1, // neighbour,
-1, // masterPointID,
-1, // masterEdgeID,
masterFaceI, // masterFaceID,
false, // flipFaceFlux,
patchIDs[0], // patchID,
zoneID, // zoneID,
zoneFlip, // zoneFlip
patchIDs[1] // subPatchID
)
);
}

View File

@ -154,34 +154,36 @@ void Foam::duplicatePoints::setRefinement
const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
}
labelPair patchIDs = polyTopoChange::whichPatch(patches, faceI);
if (mesh_.isInternalFace(faceI))
{
meshMod.modifyFace
(
newFace, // modified face
faceI, // label of face being modified
mesh_.faceOwner()[faceI], // owner
newFace, // modified face
faceI, // label of face being modified
mesh_.faceOwner()[faceI], // owner
mesh_.faceNeighbour()[faceI], // neighbour
false, // face flip
-1, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
false, // face flip
-1, // patch for face
zoneID, // zone for face
zoneFlip, // face flip in zone
-1 // subPatch
);
}
else
{
meshMod.modifyFace
(
newFace, // modified face
faceI, // label of face being modified
mesh_.faceOwner()[faceI], // owner
-1, // neighbour
false, // face flip
patches.whichPatch(faceI), // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
newFace, // modified face
faceI, // label of face being modified
mesh_.faceOwner()[faceI], // owner
-1, // neighbour
false, // face flip
patchIDs[0], // patch for face
zoneID, // zone for face
zoneFlip, // face flip in zone
patchIDs[1]
);
}
}

View File

@ -559,16 +559,16 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod)
// Get current connectivity
label own = faceOwner[faceI];
label nei = -1;
label patchID = -1;
labelPair patchIDs = polyTopoChange::whichPatch
(
boundaryMesh,
faceI
);
if (mesh_.isInternalFace(faceI))
{
nei = faceNeighbour[faceI];
}
else
{
patchID = boundaryMesh.whichPatch(faceI);
}
meshMod.modifyFace
(
@ -577,9 +577,10 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod)
own, // owner
nei, // neighbour
false, // flipFaceFlux
patchID, // patch
patchIDs[0], // patch
zoneID,
zoneFlip
zoneFlip,
patchIDs[1] // subpatch for face
);
meshChanged = true;
}

View File

@ -156,16 +156,16 @@ void Foam::faceCollapser::filterFace
{
label nei = -1;
label patchI = -1;
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh_.boundaryMesh(),
faceI
);
if (mesh_.isInternalFace(faceI))
{
nei = mesh_.faceNeighbour()[faceI];
}
else
{
patchI = mesh_.boundaryMesh().whichPatch(faceI);
}
// Get current zone info
label zoneID = mesh_.faceZones().whichZone(faceI);
@ -188,10 +188,11 @@ void Foam::faceCollapser::filterFace
mesh_.faceOwner()[faceI], // owner
nei, // neighbour
false, // face flip
patchI, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
patchIDs[1]
)
);
}

View File

@ -97,17 +97,12 @@ void Foam::hexRef8::reorder
void Foam::hexRef8::getFaceInfo
(
const label faceI,
label& patchID,
labelPair& patchIDs,
label& zoneID,
label& zoneFlip
) const
{
patchID = -1;
if (!mesh_.isInternalFace(faceI))
{
patchID = mesh_.boundaryMesh().whichPatch(faceI);
}
patchIDs = polyTopoChange::whichPatch(mesh_.boundaryMesh(), faceI);
zoneID = mesh_.faceZones().whichZone(faceI);
@ -132,9 +127,9 @@ Foam::label Foam::hexRef8::addFace
const label nei
) const
{
label patchID, zoneID, zoneFlip;
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
labelPair patchIDs;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
label newFaceI = -1;
@ -152,9 +147,10 @@ Foam::label Foam::hexRef8::addFace
-1, // master edge
faceI, // master face for addition
false, // flux flip
patchID, // patch for face
patchIDs[0], // patch for face
zoneID, // zone for face
zoneFlip // face zone flip
zoneFlip, // face zone flip
patchIDs[1] // subPatch
)
);
}
@ -172,9 +168,10 @@ Foam::label Foam::hexRef8::addFace
-1, // master edge
faceI, // master face for addition
false, // flux flip
patchID, // patch for face
patchIDs[0], // patch for face
zoneID, // zone for face
zoneFlip // face zone flip
zoneFlip, // face zone flip
patchIDs[1] // subPatch
)
);
}
@ -213,7 +210,8 @@ Foam::label Foam::hexRef8::addInternalFace
false, // flux flip
-1, // patch for face
-1, // zone for face
false // face zone flip
false, // face zone flip
-1 // subPatch
)
);
}
@ -241,7 +239,8 @@ Foam::label Foam::hexRef8::addInternalFace
false, // flux flip
-1, // patch for face
-1, // zone for face
false // face zone flip
false, // face zone flip
-1 // subPatch
)
);
@ -276,7 +275,8 @@ Foam::label Foam::hexRef8::addInternalFace
// false, // flux flip
// -1, // patch for face
// -1, // zone for face
// false // face zone flip
// false, // face zone flip
// -1 // subPatch
// )
//);
}
@ -293,9 +293,9 @@ void Foam::hexRef8::modFace
const label nei
) const
{
label patchID, zoneID, zoneFlip;
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
labelPair patchIDs;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
if
(
@ -318,10 +318,11 @@ void Foam::hexRef8::modFace
own, // owner
nei, // neighbour
false, // face flip
patchID, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
patchIDs[1] // subPatch
)
);
}
@ -336,10 +337,11 @@ void Foam::hexRef8::modFace
nei, // owner
own, // neighbour
false, // face flip
patchID, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
patchIDs[1] // subPatch
)
);
}
@ -401,8 +403,7 @@ Foam::scalar Foam::hexRef8::getLevel0EdgeLength() const
mesh_,
edgeLevel,
ifEqEqOp<labelMax>(),
labelMin,
false // no separation
labelMin
);
// Now use the edgeLevel with a valid value to determine the
@ -1608,7 +1609,7 @@ Foam::label Foam::hexRef8::faceConsistentRefinement
}
// Swap to neighbour
syncTools::swapBoundaryFaceList(mesh_, neiLevel, false);
syncTools::swapBoundaryFaceList(mesh_, neiLevel);
// Now we have neighbour value see which cells need refinement
forAll(neiLevel, i)
@ -1690,7 +1691,7 @@ void Foam::hexRef8::checkWantedRefinementLevels
}
// Swap to neighbour
syncTools::swapBoundaryFaceList(mesh_, neiLevel, false);
syncTools::swapBoundaryFaceList(mesh_, neiLevel);
// Now we have neighbour value see which cells need refinement
forAll(neiLevel, i)
@ -2359,8 +2360,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement
mesh_,
maxPointCount,
maxEqOp<label>(),
labelMin, // null value
false // no separation
labelMin // null value
);
// Update allFaceInfo from maxPointCount for all points to check
@ -2499,9 +2499,9 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement
}
// Swap to neighbour
syncTools::swapBoundaryFaceList(mesh_, neiLevel, false);
syncTools::swapBoundaryFaceList(mesh_, neiCount, false);
syncTools::swapBoundaryFaceList(mesh_, neiRefCount, false);
syncTools::swapBoundaryFaceList(mesh_, neiLevel);
syncTools::swapBoundaryFaceList(mesh_, neiCount);
syncTools::swapBoundaryFaceList(mesh_, neiRefCount);
// Now we have neighbour value see which cells need refinement
forAll(neiLevel, i)
@ -3129,8 +3129,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
mesh_,
edgeMidPoint,
maxEqOp<label>(),
labelMin,
false // no separation
labelMin
);
@ -3152,13 +3151,12 @@ Foam::labelListList Foam::hexRef8::setRefinement
edgeMids[edgeI] = mesh_.edges()[edgeI].centre(mesh_.points());
}
}
syncTools::syncEdgeList
syncTools::syncEdgePositions
(
mesh_,
edgeMids,
maxEqOp<vector>(),
point(-GREAT, -GREAT, -GREAT),
true // apply separation
point(-GREAT, -GREAT, -GREAT)
);
@ -3283,7 +3281,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
}
// Swap.
syncTools::swapBoundaryFaceList(mesh_, newNeiLevel, false);
syncTools::swapBoundaryFaceList(mesh_, newNeiLevel);
// So now we have information on the neighbour.
@ -3315,8 +3313,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
(
mesh_,
faceMidPoint,
maxEqOp<label>(),
false
maxEqOp<label>()
);
@ -3342,12 +3339,11 @@ Foam::labelListList Foam::hexRef8::setRefinement
bFaceMids[i] = mesh_.faceCentres()[faceI];
}
}
syncTools::syncBoundaryFaceList
syncTools::syncBoundaryFacePositions
(
mesh_,
bFaceMids,
maxEqOp<vector>(),
true // apply separation
maxEqOp<vector>()
);
forAll(faceMidPoint, faceI)
@ -4382,7 +4378,7 @@ void Foam::hexRef8::checkMesh() const
}
// Replace data on coupled patches with their neighbour ones.
syncTools::swapBoundaryFaceList(mesh_, nei, false);
syncTools::swapBoundaryFaceList(mesh_, nei);
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
@ -4437,7 +4433,7 @@ void Foam::hexRef8::checkMesh() const
}
// Replace data on coupled patches with their neighbour ones.
syncTools::swapBoundaryFaceList(mesh_, neiFaceAreas, false);
syncTools::swapBoundaryFaceList(mesh_, neiFaceAreas);
forAll(neiFaceAreas, i)
{
@ -4480,7 +4476,7 @@ void Foam::hexRef8::checkMesh() const
}
// Replace data on coupled patches with their neighbour ones.
syncTools::swapBoundaryFaceList(mesh_, nVerts, false);
syncTools::swapBoundaryFaceList(mesh_, nVerts);
forAll(nVerts, i)
{
@ -4529,7 +4525,7 @@ void Foam::hexRef8::checkMesh() const
// Replace data on coupled patches with their neighbour ones. Apply
// rotation transformation (but not separation since is relative vector
// to point on same face.
syncTools::swapBoundaryFaceList(mesh_, anchorPoints, false);
syncTools::swapBoundaryFaceList(mesh_, anchorPoints);
forAll(anchorPoints, i)
{
@ -4634,7 +4630,7 @@ void Foam::hexRef8::checkRefinementLevels
}
// No separation
syncTools::swapBoundaryFaceList(mesh_, neiLevel, false);
syncTools::swapBoundaryFaceList(mesh_, neiLevel);
forAll(neiLevel, i)
{
@ -4676,8 +4672,7 @@ void Foam::hexRef8::checkRefinementLevels
mesh_,
syncPointLevel,
minEqOp<label>(),
labelMax,
false // no separation
labelMax
);
@ -4724,8 +4719,7 @@ void Foam::hexRef8::checkRefinementLevels
mesh_,
maxPointLevel,
maxEqOp<label>(),
labelMin, // null value
false // no separation
labelMin // null value
);
// Check 2:1 across boundary points
@ -4797,8 +4791,7 @@ void Foam::hexRef8::checkRefinementLevels
mesh_,
isHangingPoint,
andEqOp<bool>(), // only if all decide it is hanging point
true, // null
false // no separation
true // null
);
//OFstream str(mesh_.time().path()/"hangingPoints.obj");
@ -5167,7 +5160,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
}
// Swap to neighbour
syncTools::swapBoundaryFaceList(mesh_, neiLevel, false);
syncTools::swapBoundaryFaceList(mesh_, neiLevel);
forAll(neiLevel, i)
{
@ -5298,7 +5291,8 @@ void Foam::hexRef8::setUnrefinement
{
FatalErrorIn
(
"hexRef8::setUnrefinement(const labelList&, polyTopoChange&)"
"hexRef8::setUnrefinement"
"(const labelList&, polyTopoChange&)"
) << "Illegal cell level " << cellLevel_[cellI]
<< " for cell " << cellI
<< abort(FatalError);

View File

@ -105,7 +105,7 @@ class hexRef8
void getFaceInfo
(
const label faceI,
label& patchID,
labelPair& patchIDs,
label& zoneID,
label& zoneFlip
) const;

View File

@ -57,18 +57,26 @@ public:
}
};
};
// Dummy transform for faces. Used in synchronisation
void transformList
(
const tensor& rotTensor,
UList<face>& field
)
{};
class transformFace
{
public:
void operator()(const coupledPolyPatch&, Field<face>&) const
{}
};
// Dummy template specialisation for pTraits<face>. Used in synchronisation
template<>
class pTraits<face>
{
public:
//- Component type
typedef label cmptType;
};
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Are two lists identical either in forward or in reverse order.
@ -264,8 +272,7 @@ void Foam::localPointRegion::calcPointRegions
mesh,
candidatePoint,
orEqOp<bool>(),
false, // nullValue
false // applySeparation
false // nullValue
);
@ -420,12 +427,18 @@ void Foam::localPointRegion::calcPointRegions
// Transport minimum across coupled faces
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
syncTools::syncFaceList
SubList<face> l
(
minRegion,
mesh.nFaces()-mesh.nInternalFaces(),
mesh.nInternalFaces()
);
syncTools::syncBoundaryFaceList
(
mesh,
minRegion,
l,
minEqOpFace(),
false // applySeparation
transformFace() // dummy transformation
);
}

View File

@ -80,6 +80,9 @@ class polyModifyFace
//- Face zone flip
bool zoneFlip_;
//- Sub patch ID (for proc patches)
label subPatchID_;
public:
@ -102,7 +105,8 @@ public:
patchID_(-1),
removeFromZone_(false),
zoneID_(-1),
zoneFlip_(false)
zoneFlip_(false),
subPatchID_(-1)
{}
//- Construct from components
@ -116,7 +120,8 @@ public:
const label patchID,
const bool removeFromZone,
const label zoneID,
const bool zoneFlip
const bool zoneFlip,
const label subPatchID
)
:
face_(f),
@ -127,7 +132,8 @@ public:
patchID_(patchID),
removeFromZone_(removeFromZone),
zoneID_(zoneID),
zoneFlip_(zoneFlip)
zoneFlip_(zoneFlip),
subPatchID_(subPatchID)
{
if (face_.size() < 3)
{
@ -143,7 +149,8 @@ public:
" const label patchID,\n"
" const bool removeFromZone,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
" const bool zoneFlip,\n"
" const label subPatchID\n"
")"
) << "Invalid face: less than 3 points. This is not allowed\n"
<< "Face: " << face_
@ -167,7 +174,8 @@ public:
" const label patchID,\n"
" const bool removeFromZone,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
" const bool zoneFlip,\n"
" const label subPatchID\n"
")"
) << "Face contains invalid vertex ID: " << face_ << ". "
<< "This is not allowed.\n"
@ -191,7 +199,8 @@ public:
" const label patchID,\n"
" const bool removeFromZone,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
" const bool zoneFlip,\n"
" const label subPatchID\n"
")"
) << "Face owner and neighbour are identical. "
<< "This is not allowed.\n"
@ -216,7 +225,8 @@ public:
" const label patchID,\n"
" const bool removeFromZone,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
" const bool zoneFlip,\n"
" const label subPatchID\n"
")"
) << "Patch face has got a neighbour "
<< "This is not allowed.\n"
@ -242,7 +252,8 @@ public:
" const label patchID,\n"
" const bool removeFromZone,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
" const bool zoneFlip,\n"
" const label subPatchID\n"
")"
) << "Specified zone flip for a face that does not "
<< "belong to zone. This is not allowed.\n"
@ -252,6 +263,32 @@ public:
<< " neighbour:" << neighbour_
<< abort(FatalError);
}
if (patchID < 0 && subPatchID_ >= 0)
{
FatalErrorIn
(
"polyModifyFace::polyModifyFace\n"
"(\n"
" const face& f,\n"
" const label faceID,\n"
" const label owner,\n"
" const label neighbour,\n"
" const bool flipFaceFlux,\n"
" const label patchID,\n"
" const bool removeFromZone,\n"
" const label zoneID,\n"
" const bool zoneFlip,\n"
" const label subPatchID\n"
")"
) << "Specified subPatchID on an internal face (patchID < 0"
<< ". This is not allowed.\n"
<< "Face: " << face_
<< " faceID:" << faceID_
<< " owner:" << owner_
<< " neighbour:" << neighbour_
<< abort(FatalError);
}
}
//- Construct and return a clone
@ -335,6 +372,12 @@ public:
{
return zoneFlip_;
}
//- Boundary sub patch ID
label subPatchID() const
{
return subPatchID_;
}
};

View File

@ -386,6 +386,29 @@ void Foam::polyTopoChange::checkFace
}
//- Return -1 or subRegion for face
Foam::label Foam::polyTopoChange::subRegion(const label faceI) const
{
if (region_[faceI] != -1)
{
Map<label>::const_iterator iter = subRegion_.find(faceI);
if (iter != subRegion_.end())
{
return iter();
}
else
{
return -1;
}
}
else
{
return -1;
}
}
void Foam::polyTopoChange::makeCells
(
const label nActiveFaces,
@ -684,10 +707,12 @@ void Foam::polyTopoChange::getFaceOrder
{
patchSizes[region_[faceI]]++;
if (subRegion_[faceI] >= 0)
label subPatchI = subRegion(faceI);
if (subPatchI >= 0)
{
Map<label>& subSizes = subPatchSizeMap[region_[faceI]];
Map<label>::iterator iter = subSizes.find(subRegion_[faceI]);
Map<label>::iterator iter = subSizes.find(subPatchI);
if (iter != subSizes.end())
{
@ -695,7 +720,7 @@ void Foam::polyTopoChange::getFaceOrder
}
else
{
subSizes.insert(subRegion_[faceI], 1);
subSizes.insert(subPatchI, 1);
}
}
}
@ -796,7 +821,7 @@ void Foam::polyTopoChange::getFaceOrder
if (subPatchStarts[patchI].size() > 0)
{
label subPatchI = subRegion_[faceI];
label subPatchI = subRegion(faceI);
label index = subRegionToIndex[patchI][subPatchI];
oldToNew[faceI] = workSubPatchStarts[patchI][index]++;
@ -851,9 +876,7 @@ void Foam::polyTopoChange::reorderCompactFaces
region_.setSize(newSize);
region_.shrink();
reorder(oldToNew, subRegion_);
subRegion_.setSize(newSize);
subRegion_.shrink();
renumberKey(oldToNew, subRegion_);
reorder(oldToNew, faceOwner_);
faceOwner_.setSize(newSize);
@ -900,7 +923,6 @@ void Foam::polyTopoChange::compact
faces_.shrink();
region_.shrink();
subRegion_.shrink();
faceOwner_.shrink();
faceNeighbour_.shrink();
faceMap_.shrink();
@ -1894,6 +1916,43 @@ Foam::face Foam::polyTopoChange::rotateFace
}
bool Foam::polyTopoChange::orderAndMerge
(
const polyPatch& pp,
const primitivePatch& faces,
const label start,
labelList& oldToNew,
labelList& rotation
) const
{
labelList patchFaceMap(faces.size(), -1);
labelList patchFaceRotation(faces.size(), 0);
bool changed = pp.order
(
faces,
patchFaceMap,
patchFaceRotation
);
if (changed)
{
// Merge patch face reordering into mesh face reordering table
forAll(patchFaceMap, patchFaceI)
{
oldToNew[patchFaceI + start] = start + patchFaceMap[patchFaceI];
}
forAll(patchFaceRotation, patchFaceI)
{
rotation[patchFaceI + start] = patchFaceRotation[patchFaceI];
}
}
return changed;
}
void Foam::polyTopoChange::reorderCoupledFaces
(
const bool syncParallel,
@ -1908,6 +1967,12 @@ void Foam::polyTopoChange::reorderCoupledFaces
const pointField& points
)
{
// Reordering:
// 1. all the non-processor patches are ordered (i.e. the cyclic patches).
// This will set-up the transformation vectors on the cyclics.
// 2. the processorpatches then can use the transformation vectors for
// the parts originating from cyclics.
// Mapping for faces (old to new). Extends over all mesh faces for
// convenience (could be just the external faces)
labelList oldToNew(identity(faces_.size()));
@ -1915,10 +1980,15 @@ void Foam::polyTopoChange::reorderCoupledFaces
// Rotation on new faces.
labelList rotation(faces_.size(), 0);
bool anyChanged = false;
// 1. Do non-processor patches
// Send ordering
forAll(boundary, patchI)
{
if (syncParallel || !isA<processorPolyPatch>(boundary[patchI]))
if (!isA<processorPolyPatch>(boundary[patchI]))
{
boundary[patchI].initOrder
(
@ -1937,18 +2007,13 @@ void Foam::polyTopoChange::reorderCoupledFaces
}
// Receive and calculate ordering
bool anyChanged = false;
forAll(boundary, patchI)
{
if (syncParallel || !isA<processorPolyPatch>(boundary[patchI]))
if (!isA<processorPolyPatch>(boundary[patchI]))
{
labelList patchFaceMap(patchSizes[patchI], -1);
labelList patchFaceRotation(patchSizes[patchI], 0);
bool changed = boundary[patchI].order
bool changed = orderAndMerge
(
boundary[patchI],
primitivePatch
(
SubList<face>
@ -1959,32 +2024,83 @@ void Foam::polyTopoChange::reorderCoupledFaces
),
points
),
patchFaceMap,
patchFaceRotation
patchStarts[patchI],
oldToNew,
rotation
);
if (changed)
anyChanged = anyChanged || changed;
}
}
// 2. Do processor patches. Do only the part originating from internal faces
if (syncParallel)
{
// Send ordering
forAll(boundary, patchI)
{
if (isA<processorPolyPatch>(boundary[patchI]))
{
// Merge patch face reordering into mesh face reordering table
label start = patchStarts[patchI];
forAll(patchFaceMap, patchFaceI)
forAll(subPatches[patchI], i)
{
oldToNew[patchFaceI + start] =
start + patchFaceMap[patchFaceI];
label subPatchI = subPatches[patchI][i];
boundary[subPatchI].initOrder
(
primitivePatch
(
SubList<face>
(
faces_,
subPatchSizes[patchI][i],
patchStarts[patchI]+subPatchStarts[patchI][i]
),
points
)
);
}
}
}
forAll(patchFaceRotation, patchFaceI)
// Receive and calculate ordering
forAll(boundary, patchI)
{
if (isA<processorPolyPatch>(boundary[patchI]))
{
forAll(subPatches[patchI], i)
{
rotation[patchFaceI + start] =
patchFaceRotation[patchFaceI];
}
label subPatchI = subPatches[patchI][i];
label subStartI =
patchStarts[patchI]
+ subPatchStarts[patchI][0];
anyChanged = true;
bool changed = orderAndMerge
(
boundary[subPatchI],
primitivePatch
(
SubList<face>
(
faces_,
subPatchSizes[patchI][0],
subStartI
),
points
),
subStartI,
oldToNew,
rotation
);
anyChanged = anyChanged || changed;
}
}
}
}
if (syncParallel)
{
reduce(anyChanged, orOp<bool>());
@ -2261,7 +2377,6 @@ void Foam::polyTopoChange::clear()
region_.clear();
region_.setSize(0);
subRegion_.clear();
subRegion_.setSize(0);
faceOwner_.clear();
faceOwner_.setSize(0);
faceNeighbour_.clear();
@ -2422,7 +2537,7 @@ void Foam::polyTopoChange::addMesh
faces_.setSize(faces_.size() + nAllFaces);
region_.setSize(region_.size() + nAllFaces);
subRegion_.setSize(subRegion_.size() + nAllFaces);
subRegion_.resize((mesh.nFaces()-mesh.nInternalFaces())/100);
faceOwner_.setSize(faceOwner_.size() + nAllFaces);
faceNeighbour_.setSize(faceNeighbour_.size() + nAllFaces);
faceMap_.setSize(faceMap_.size() + nAllFaces);
@ -2465,7 +2580,8 @@ void Foam::polyTopoChange::addMesh
false, // flipFaceFlux
-1, // patchID
newZoneID[faceI], // zoneID
zoneFlip[faceI] // zoneFlip
zoneFlip[faceI], // zoneFlip
-1 // subpatchID
);
}
@ -2491,6 +2607,15 @@ void Foam::polyTopoChange::addMesh
{
label faceI = pp.start() + patchFaceI;
label subPatchI = -1;
if (isA<processorPolyPatch>(pp))
{
subPatchI = refCast<const processorPolyPatch>
(
pp
).whichSubPatch(patchFaceI);
}
addFace
(
faces[faceI],
@ -2502,7 +2627,8 @@ void Foam::polyTopoChange::addMesh
false, // flipFaceFlux
patchMap[patchI], // patchID
newZoneID[faceI], // zoneID
zoneFlip[faceI] // zoneFlip
zoneFlip[faceI], // zoneFlip
patchMap[subPatchI] // subPatchID
);
}
}
@ -2561,7 +2687,8 @@ Foam::label Foam::polyTopoChange::setAction(const topoAction& action)
paf.flipFaceFlux(),
paf.patchID(),
paf.zoneID(),
paf.zoneFlip()
paf.zoneFlip(),
paf.subPatchID()
);
}
else if (isType<polyModifyFace>(action))
@ -2577,7 +2704,8 @@ Foam::label Foam::polyTopoChange::setAction(const topoAction& action)
pmf.flipFaceFlux(),
pmf.patchID(),
pmf.zoneID(),
pmf.zoneFlip()
pmf.zoneFlip(),
pmf.subPatchID()
);
return -1;
@ -2783,6 +2911,61 @@ void Foam::polyTopoChange::removePoint
}
Foam::labelPair Foam::polyTopoChange::whichPatch
(
const polyBoundaryMesh& patches,
const label faceI
)
{
// patchID + subPatchID
labelPair patchInfo
(
patches.whichPatch(faceI),
-1
);
if (patchInfo[0] != -1 && isA<processorPolyPatch>(patches[patchInfo[0]]))
{
const polyPatch& pp = patches[patchInfo[0]];
patchInfo[1] = refCast<const processorPolyPatch>
(
pp
).whichSubPatch(faceI-pp.start());
}
return patchInfo;
}
Foam::label Foam::polyTopoChange::whichSubPatch
(
const polyPatch& pp,
const label faceI
)
{
label localI = faceI - pp.start();
if (localI < 0 || localI >= pp.size())
{
FatalErrorIn
(
"polyTopoChange::whichPatch(const polyPatch&, const label)"
) << "Face " << faceI << " is not on patch " << pp.name()
<< abort(FatalError);
}
label subPatchI = -1;
if (isA<processorPolyPatch>(pp))
{
subPatchI = refCast<const processorPolyPatch>(pp).whichSubPatch(localI);
}
return subPatchI;
}
Foam::label Foam::polyTopoChange::addFace
(
const face& f,
@ -2808,7 +2991,17 @@ Foam::label Foam::polyTopoChange::addFace
faces_.append(f);
region_.append(patchID);
subRegion_.append(subPatchID);
if (subPatchID != -1)
{
if (patchID == -1)
{
FatalErrorIn("polyTopoChange::addFace(..)")
<< "Cannot have subpatchID on internal face "
<< f << " own:" << own << " nei:" << nei
<< abort(FatalError);
}
subRegion_.insert(faceI, subPatchID);
}
faceOwner_.append(own);
faceNeighbour_.append(nei);
@ -2875,7 +3068,17 @@ void Foam::polyTopoChange::modifyFace
faceOwner_[faceI] = own;
faceNeighbour_[faceI] = nei;
region_[faceI] = patchID;
subRegion_[faceI] = subPatchID;
if (subPatchID != -1)
{
if (patchID == -1)
{
FatalErrorIn("polyTopoChange::modifyFace(..)")
<< "Cannot have subpatchID on internal face "
<< faceI << " own:" << own << " nei:" << nei
<< abort(FatalError);
}
subRegion_.insert(faceI, subPatchID);
}
if (flipFaceFlux)
{
@ -2932,8 +3135,11 @@ void Foam::polyTopoChange::removeFace(const label faceI, const label mergeFaceI)
}
faces_[faceI].setSize(0);
region_[faceI] = -1;
subRegion_[faceI] = -1;
if (region_[faceI] != -1)
{
subRegion_.erase(faceI);
region_[faceI] = -1;
}
faceOwner_[faceI] = -1;
faceNeighbour_[faceI] = -1;
faceMap_[faceI] = -1;
@ -3226,7 +3432,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::changeMesh
region_.clear();
region_.setSize(0);
subRegion_.clear();
subRegion_.setSize(0);
faceOwner_.clear();
faceOwner_.setSize(0);
faceNeighbour_.clear();
@ -3469,7 +3674,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::makeMesh
region_.clear();
region_.setSize(0);
subRegion_.clear();
subRegion_.setSize(0);
faceOwner_.clear();
faceOwner_.setSize(0);
faceNeighbour_.clear();

View File

@ -68,7 +68,7 @@ SourceFiles
#include "labelList.H"
#include "IOobject.H"
#include "typeInfo.H"
#include "pointField.H"
#include "labelPair.H"
#include "PtrList.H"
#include "cellList.H"
#include "Map.H"
@ -76,6 +76,7 @@ SourceFiles
#include "mapPolyMesh.H"
#include "CompactListList.H"
#include "PackedList.H"
#include "primitivePatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -147,9 +148,8 @@ class polyTopoChange
//- Patch for every external face (-1 for internal faces)
DynamicList<label> region_;
//- Sub-patch (for processor faces). -1 for internal and non-
// processor patches.
DynamicList<label> subRegion_;
//- Sub-patch (for processor faces).
Map<label> subRegion_;
//- Owner for all faces
DynamicList<label> faceOwner_;
@ -262,6 +262,9 @@ class polyTopoChange
const label zoneI
) const;
//- Return -1 or subRegion for face
label subRegion(const label faceI) const;
//- Construct cells (in packed storage)
void makeCells
(
@ -375,6 +378,16 @@ class polyTopoChange
//- Rotate face by number of positions
static face rotateFace(const face& f, const label nPos);
//- Order patch faces and merge into overall ordering
bool orderAndMerge
(
const polyPatch&,
const primitivePatch&,
const label start,
labelList& oldToNew,
labelList& rotation
) const;
//- Do all coupled patch face reordering
void reorderCoupledFaces
(
@ -518,6 +531,12 @@ public:
//- Remove/merge point.
void removePoint(const label, const label);
//- Helper function to get patchID and subPatchID for a global face
static labelPair whichPatch(const polyBoundaryMesh&, const label);
//- Helper function to get subPatchID for a global face on a patch
static label whichSubPatch(const polyPatch&, const label);
//- Add face to cells. Return new face label.
// own,nei<0, zoneID>=0 : add inactive face (to end of face list)
label addFace
@ -532,7 +551,7 @@ public:
const label patchID,
const label zoneID,
const bool zoneFlip,
const label subPatchID = -1
const label subPatchID
);
//- Modify vertices or cell of face.
@ -546,7 +565,7 @@ public:
const label patchID,
const label zoneID,
const bool zoneFlip,
const label subPatchID = -1
const label subPatchID
);
//- Remove/merge face.

View File

@ -131,8 +131,7 @@ Foam::labelList Foam::removeCells::getExposedFaces
(
mesh_,
nCellsUsingFace,
plusEqOp<label>(),
false
plusEqOp<label>()
);
}
@ -339,11 +338,12 @@ void Foam::removeCells::setRefinement
faceI, // label of face being modified
nei, // owner
-1, // neighbour
false, // face flip
true, // face flip
newPatchID[faceI], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
-1
)
);
}
@ -389,7 +389,8 @@ void Foam::removeCells::setRefinement
newPatchID[faceI], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
-1
)
);
}
@ -432,7 +433,8 @@ void Foam::removeCells::setRefinement
newPatchID[faceI], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
-1
)
);
}

View File

@ -330,9 +330,9 @@ void Foam::removeFaces::mergeFaces
own = cellRegionMaster[cellRegion[own]];
}
label patchID, zoneID, zoneFlip;
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
labelPair patchIDs;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
label nei = -1;
@ -391,7 +391,7 @@ void Foam::removeFaces::mergeFaces
own, // owner
nei, // neighbour
false, // face flip
patchID, // patch for face
patchIDs, // patch info for face
false, // remove from zone
zoneID, // zone for face
zoneFlip, // face flip in zone
@ -417,18 +417,12 @@ void Foam::removeFaces::mergeFaces
void Foam::removeFaces::getFaceInfo
(
const label faceI,
label& patchID,
labelPair& patchIDs,
label& zoneID,
label& zoneFlip
) const
{
patchID = -1;
if (!mesh_.isInternalFace(faceI))
{
patchID = mesh_.boundaryMesh().whichPatch(faceI);
}
patchIDs = polyTopoChange::whichPatch(mesh_.boundaryMesh(), faceI);
zoneID = mesh_.faceZones().whichZone(faceI);
@ -480,7 +474,7 @@ void Foam::removeFaces::modFace
const label own,
const label nei,
const bool flipFaceFlux,
const label newPatchID,
const labelPair& newPatchIDs,
const bool removeFromZone,
const label zoneID,
const bool zoneFlip,
@ -498,7 +492,7 @@ void Foam::removeFaces::modFace
// << " own:" << own
// << " nei:" << nei
// << " flipFaceFlux:" << flipFaceFlux
// << " newPatchID:" << newPatchID
// << " newPatchIDs:" << newPatchIDs
// << " removeFromZone:" << removeFromZone
// << " zoneID:" << zoneID
// << " zoneFlip:" << zoneFlip
@ -514,10 +508,11 @@ void Foam::removeFaces::modFace
own, // owner
nei, // neighbour
flipFaceFlux, // face flip
newPatchID, // patch for face
newPatchIDs[0], // patch for face
removeFromZone, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
newPatchIDs[1]
)
);
}
@ -531,7 +526,7 @@ void Foam::removeFaces::modFace
// << " own:" << nei
// << " nei:" << own
// << " flipFaceFlux:" << flipFaceFlux
// << " newPatchID:" << newPatchID
// << " newPatchIDs:" << newPatchIDs
// << " removeFromZone:" << removeFromZone
// << " zoneID:" << zoneID
// << " zoneFlip:" << zoneFlip
@ -547,10 +542,11 @@ void Foam::removeFaces::modFace
nei, // owner
own, // neighbour
flipFaceFlux, // face flip
newPatchID, // patch for face
newPatchIDs[0], // patch for face
removeFromZone, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
newPatchIDs[1]
)
);
}
@ -1087,8 +1083,7 @@ void Foam::removeFaces::setRefinement
mesh_,
nFacesPerEdge,
maxEqOp<label>(),
labelMin, // guaranteed to be overridden by maxEqOp
false // no separation
labelMin // guaranteed to be overridden by maxEqOp
);
// Convert to labelHashSet
@ -1190,8 +1185,7 @@ void Foam::removeFaces::setRefinement
syncTools::swapFaceList
(
mesh_,
nbrFaceRegion,
false // no separation
nbrFaceRegion
);
labelList toNbrRegion(nRegions, -1);
@ -1308,8 +1302,7 @@ void Foam::removeFaces::setRefinement
mesh_,
nEdgesPerPoint,
maxEqOp<label>(),
labelMin,
false // no separation
labelMin
);
forAll(nEdgesPerPoint, pointI)
@ -1470,9 +1463,9 @@ void Foam::removeFaces::setRefinement
own = cellRegionMaster[cellRegion[own]];
}
label patchID, zoneID, zoneFlip;
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
labelPair patchIDs;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
label nei = -1;
@ -1503,7 +1496,7 @@ void Foam::removeFaces::setRefinement
own, // owner
nei, // neighbour
false, // face flip
patchID, // patch for face
patchIDs, // patchinfo for face
false, // remove from zone
zoneID, // zone for face
zoneFlip, // face flip in zone

View File

@ -44,6 +44,7 @@ SourceFiles
#include "Map.H"
#include "boolList.H"
#include "indirectPrimitivePatch.H"
#include "labelPair.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -131,14 +132,13 @@ class removeFaces
void getFaceInfo
(
const label faceI,
label& patchID,
labelPair& patchIDs,
label& zoneID,
label& zoneFlip
) const;
//- Return face with all pointsToRemove removed.
face filterFace(const labelHashSet& pointsToRemove, const label)
const;
face filterFace(const labelHashSet&, const label) const;
//- Wrapper for meshMod.modifyFace. Reverses face if own>nei.
void modFace
@ -148,7 +148,7 @@ class removeFaces
const label own,
const label nei,
const bool flipFaceFlux,
const label newPatchID,
const labelPair& newPatchIDs,
const bool removeFromZone,
const label zoneID,
const bool zoneFlip,

View File

@ -43,6 +43,55 @@ namespace Foam
defineTypeNameAndDebug(removePoints, 0);
//- Combine-reduce operator to combine data on faces. Takes care
// of reverse orientation on coupled face.
template <class T, template<class> class CombineOp>
class faceEqOp
{
public:
void operator()(List<T>& x, const List<T>& y) const
{
if (y.size() > 0)
{
if (x.size() == 0)
{
x = y;
}
else
{
label j = 0;
forAll(x, i)
{
CombineOp<T>()(x[i], y[j]);
j = y.rcIndex(j);
}
}
}
}
};
// Dummy transform for List. Used in synchronisation.
template <class T>
class dummyTransformList
{
public:
void operator()(const coupledPolyPatch&, Field<List<T> >&) const
{}
};
// Dummy template specialisation. Used in synchronisation.
template<>
class pTraits<boolList>
{
public:
//- Component type
typedef label cmptType;
};
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -56,7 +105,11 @@ void Foam::removePoints::modifyFace
) const
{
// Get other face data.
label patchI = -1;
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh_.boundaryMesh(),
faceI
);
label owner = mesh_.faceOwner()[faceI];
label neighbour = -1;
@ -64,10 +117,6 @@ void Foam::removePoints::modifyFace
{
neighbour = mesh_.faceNeighbour()[faceI];
}
else
{
patchI = mesh_.boundaryMesh().whichPatch(faceI);
}
label zoneID = mesh_.faceZones().whichZone(faceI);
@ -89,10 +138,11 @@ void Foam::removePoints::modifyFace
owner, // owner
neighbour, // neighbour
false, // face flip
patchI, // patch for face
patchIDs[0], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
zoneFlip, // face flip in zone
patchIDs[1]
)
);
}
@ -216,8 +266,7 @@ Foam::label Foam::removePoints::countPointUsage
mesh_,
pointCanBeDeleted,
andEqOp<bool>(),
true, // null value
false // no separation
true // null value
);
return returnReduce(nDeleted, sumOp<label>());
@ -631,7 +680,7 @@ void Foam::removePoints::getUnrefimentSet
mesh_,
faceVertexRestore,
faceEqOp<bool, orEqOp>(), // special operator to handle faces
false // no separation
dummyTransformList<bool>() // dummy transform
);
// So now if any of the points-to-restore is used by any coupled face

View File

@ -60,38 +60,6 @@ class face;
class removePoints
{
// Private classes
//- Combine-reduce operator to combine data on faces. Takes care
// of reverse orientation on coupled face.
template <class T, template<class> class CombineOp>
class faceEqOp
{
public:
void operator()(List<T>& x, const List<T>& y) const
{
if (y.size() > 0)
{
if (x.size() == 0)
{
x = y;
}
else
{
label j = 0;
forAll(x, i)
{
CombineOp<T>()(x[i], y[j]);
j = y.rcIndex(j);
}
}
}
}
};
// Private data
//- Reference to mesh

View File

@ -132,7 +132,8 @@ void Foam::repatchPolyTopoChanger::changePatchID
patchID, // patch ID
false, // remove from zone
zoneID, // zone ID
zoneFlip // zone flip
zoneFlip, // zone flip
-1 //? subPatch TBD.
)
);
}
@ -164,6 +165,12 @@ void Foam::repatchPolyTopoChanger::setFaceZone
}
}
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh_.boundaryMesh(),
faceID
);
meshMod().setAction
(
polyModifyFace
@ -173,10 +180,11 @@ void Foam::repatchPolyTopoChanger::setFaceZone
mesh_.faceOwner()[faceID], // owner
mesh_.faceNeighbour()[faceID], // neighbour
false, // flip flux
mesh_.boundaryMesh().whichPatch(faceID), // patch ID
patchIDs[0], // patch ID
true, // remove from zone
zoneID, // zone ID
zoneFlip // zone flip
zoneFlip, // zone flip
patchIDs[1]
)
);
}
@ -223,7 +231,11 @@ void Foam::repatchPolyTopoChanger::changeAnchorPoint
<< abort(FatalError);
}
label patchID = mesh_.boundaryMesh().whichPatch(faceID);
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh_.boundaryMesh(),
faceID
);
const label zoneID = mesh_.faceZones().whichZone(faceID);
@ -248,10 +260,11 @@ void Foam::repatchPolyTopoChanger::changeAnchorPoint
mesh_.faceOwner()[faceID], // owner
-1, // neighbour
false, // flip flux
patchID, // patch ID
patchIDs[0], // patch ID
false, // remove from zone
zoneID, // zone ID
zoneFlip // zone flip
zoneFlip, // zone flip
patchIDs[1]
)
);
}
@ -283,10 +296,11 @@ void Foam::repatchPolyTopoChanger::changeAnchorPoint
mesh_.faceOwner()[faceID], // owner
-1, // neighbour
false, // flip flux
patchID, // patch ID
patchIDs[0], // patch ID
false, // remove from zone
zoneID, // zone ID
zoneFlip // zone flip
zoneFlip, // zone flip
patchIDs[1]
)
);
}

View File

@ -826,7 +826,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
-1, // patch ID
false, // remove from zone
masterFaceZoneID_.index(), // zone ID
masterPatchFlip[curMaster] // zone flip
masterPatchFlip[curMaster], // zone flip
-1 // subPatch ID
)
);
// Pout << "modifying master face. Old master: " << masterPatch[curMaster] << " new face: " << curCutFace.reverseFace() << " own: " << masterFc[curMaster] << " nei: " << slaveFc[curSlave] << endl;
@ -847,7 +848,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
-1, // patch ID
false, // remove from zone
masterFaceZoneID_.index(), // zone ID
!masterPatchFlip[curMaster] // zone flip
!masterPatchFlip[curMaster], // zone flip
-1 // subPatch ID
)
);
}
@ -870,7 +872,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
masterPatchID_.index(), // patch ID
false, // remove from zone
masterFaceZoneID_.index(), // zone ID
masterPatchFlip[curMaster] // zone flip
masterPatchFlip[curMaster], // zone flip
-1 // subPatchID - TBD
)
);
}
@ -917,7 +920,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
-1, // patch ID
false, // remove from zone
slaveFaceZoneID_.index(), // zone ID
!slavePatchFlip[curMaster] // zone flip
!slavePatchFlip[curMaster], // zone flip
-1 // subPatch ID
)
);
}
@ -938,7 +942,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
-1, // patch ID
false, // remove from zone
slaveFaceZoneID_.index(), // zone ID
slavePatchFlip[curSlave] // zone flip
slavePatchFlip[curSlave], // zone flip
-1 // subPatch ID
)
);
}
@ -961,7 +966,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
slavePatchID_.index(), // patch ID
false, // remove from zone
slaveFaceZoneID_.index(), // zone ID
slavePatchFlip[curSlave] // zone flip
slavePatchFlip[curSlave], // zone flip
-1 // subPatchID - TBD
)
);
}
@ -1007,7 +1013,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
false, // flux flip
-1, // patch ID
cutFaceZoneID_.index(), // zone ID
false // zone flip
false, // zone flip
-1 // subPatch ID
)
);
}
@ -1027,7 +1034,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
true, // flux flip
-1, // patch ID
cutFaceZoneID_.index(), // zone ID
true // zone flip
true, // zone flip
-1 // subPatch ID
)
);
}
@ -1052,7 +1060,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
false, // flux flip
masterPatchID_.index(), // patch ID
cutFaceZoneID_.index(), // zone ID
false // zone flip
false, // zone flip
-1 // subPatchID - TBD
)
);
}
@ -1077,7 +1086,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
false, // flux flip
slavePatchID_.index(), // patch ID
cutFaceZoneID_.index(), // zone ID
false // zone flip
false, // zone flip
-1 // subPatchID - TBD
)
);
@ -1122,7 +1132,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
-1, // patch ID
false, // remove from zone
masterFaceZoneID_.index(), // zone ID
false // zone flip
false, // zone flip
-1 // subPatch ID
)
);
}
@ -1149,7 +1160,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
-1, // patch ID
false, // remove from zone
slaveFaceZoneID_.index(), // zone ID
false // zone flip
false, // zone flip
-1 // subPatch ID
)
);
}
@ -1402,6 +1414,12 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
// Pout << "Modifying master stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curFaceID
);
// Modify the face
ref.setAction
(
@ -1412,10 +1430,11 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
own[curFaceID], // owner
nei[curFaceID], // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
patchIDs[0], // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
modifiedFaceZoneFlip, // face flip in zone
patchIDs[1] // subPatch ID
)
);
}
@ -1686,6 +1705,11 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
newFace.transfer(newFaceLabels.shrink());
// Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curFaceID
);
// Modify the face
ref.setAction
@ -1697,10 +1721,11 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
own[curFaceID], // owner
nei[curFaceID], // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
patchIDs[0], // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
modifiedFaceZoneFlip, // face flip in zone
patchIDs[1] // subPatch ID
)
);
}

View File

@ -97,15 +97,16 @@ void Foam::slidingInterface::decoupleInterface
(
polyModifyFace
(
newFace, // new face
masterPatchAddr[faceI], // master face index
masterFc[faceI], // owner
-1, // neighbour
false, // flux flip
masterPatchID_.index(), // patch ID
false, // remove from zone
masterFaceZoneID_.index(), // zone ID
false // zone flip. Face corrected
newFace, // new face
masterPatchAddr[faceI], // master face index
masterFc[faceI], // owner
-1, // neighbour
false, // flux flip
masterPatchID_.index(), // patch ID
false, // remove from zone
masterFaceZoneID_.index(), // zone ID
false, // zone flip. Face corrected
-1 //?TBD subPatch
)
);
// Pout << "Modifying master patch face no " << masterPatchAddr[faceI] << " face: " << faces[masterPatchAddr[faceI]] << " old owner: " << own[masterPatchAddr[faceI]] << " new owner: " << masterFc[faceI] << endl;
@ -155,15 +156,16 @@ void Foam::slidingInterface::decoupleInterface
(
polyModifyFace
(
newFace, // new face
slavePatchAddr[faceI], // master face index
slaveFc[faceI], // owner
-1, // neighbour
false, // flux flip
slavePatchID_.index(), // patch ID
false, // remove from zone
slaveFaceZoneID_.index(), // zone ID
false // zone flip. Face corrected
newFace, // new face
slavePatchAddr[faceI], // master face index
slaveFc[faceI], // owner
-1, // neighbour
false, // flux flip
slavePatchID_.index(), // patch ID
false, // remove from zone
slaveFaceZoneID_.index(), // zone ID
false, // zone flip. Face corrected
-1 //?TBD subPatch
)
);
}
@ -231,6 +233,12 @@ void Foam::slidingInterface::decoupleInterface
// Pout << "Modifying master stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curFaceID
);
// Modify the face
ref.setAction
(
@ -241,10 +249,11 @@ void Foam::slidingInterface::decoupleInterface
own[curFaceID], // owner
nei[curFaceID], // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
patchIDs[0], // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
modifiedFaceZoneFlip, // face flip in zone
patchIDs[1]
)
);
}
@ -354,6 +363,12 @@ void Foam::slidingInterface::decoupleInterface
// Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curFaceID
);
// Modify the face
ref.setAction
(
@ -364,10 +379,11 @@ void Foam::slidingInterface::decoupleInterface
own[curFaceID], // owner
nei[curFaceID], // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
patchIDs[0], // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
modifiedFaceZoneFlip, // face flip in zone
patchIDs[1]
)
);
}

View File

@ -27,6 +27,7 @@ License
#include "cyclicFvPatch.H"
#include "addToRunTimeSelectionTable.H"
#include "fvMesh.H"
#include "transform.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -122,22 +122,25 @@ void Foam::Particle<ParticleType>::correctAfterParallelTransfer
label subPatchI = ppp.whichSubPatch(facei_);
const coupledPolyPatch& cpp =
refCast<const coupledPolyPatch>
(cloud_.pMesh().boundaryMesh()[subPatchI]);
if (subPatchI != -1)
{
const coupledPolyPatch& cpp =
refCast<const coupledPolyPatch>
(cloud_.pMesh().boundaryMesh()[subPatchI]);
// We are on receiving end.
if (!cpp.parallel())
{
const tensor& T = cpp.forwardT();
transformPosition(T);
static_cast<ParticleType&>(*this).transformProperties(T);
}
else if (cpp.separated())
{
const vector d = -cpp.separation();
position_ += d;
static_cast<ParticleType&>(*this).transformProperties(d);
// We are on receiving end.
if (!cpp.parallel())
{
const tensor& T = cpp.forwardT();
transformPosition(T);
static_cast<ParticleType&>(*this).transformProperties(T);
}
else if (cpp.separated())
{
const vector d = -cpp.separation();
position_ += d;
static_cast<ParticleType&>(*this).transformProperties(d);
}
}
// Reset the face index for the next tracking operation
@ -452,6 +455,8 @@ void Foam::Particle<ParticleType>::hitCyclicPatch
celli_ = cloud_.polyMesh_.faceOwner()[facei_];
// Now the particle is on the receiving side
if (!cpp.parallel())
{
const tensor& T = cpp.reverseT();
@ -461,10 +466,8 @@ void Foam::Particle<ParticleType>::hitCyclicPatch
}
else if (cpp.separated())
{
const vector& d = cpp.separation();
position_ += d;
static_cast<ParticleType&>(*this).transformProperties(d);
position_ += cpp.separation();
static_cast<ParticleType&>(*this).transformProperties(cpp.separation());
}
}

View File

@ -153,30 +153,13 @@ void Foam::PointEdgeWave<Type>::enterDomain
template <class Type>
void Foam::PointEdgeWave<Type>::transform
(
const tensorField& rotTensor,
const tensor& T,
List<Type>& pointInfo
) const
{
if (rotTensor.size() == 1)
forAll(pointInfo, i)
{
const tensor& T = rotTensor[0];
forAll(pointInfo, i)
{
pointInfo[i].transform(T);
}
}
else
{
FatalErrorIn
(
"PointEdgeWave<Type>::transform(const tensorField&, List<Type>&)"
) << "Parallel cyclics not supported" << abort(FatalError);
forAll(pointInfo, i)
{
pointInfo[i].transform(rotTensor[i]);
}
pointInfo[i].transform(T);
}
}

View File

@ -167,7 +167,7 @@ class PointEdgeWave
//- Transform. Implementation referred to Type
void transform
(
const tensorField& rotTensor,
const tensor& T,
List<Type>& pointInfo
) const;

View File

@ -270,7 +270,7 @@ Foam::label Foam::regionSplit::calcRegionSplit
{
// Check that blockedFace is synced.
boolList syncBlockedFace(blockedFace);
syncTools::swapFaceList(mesh_, syncBlockedFace, false);
syncTools::swapFaceList(mesh_, syncBlockedFace);
forAll(syncBlockedFace, faceI)
{

View File

@ -29,6 +29,7 @@ License
#include "polyMesh.H"
#include "processorPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "syncTools.H"
#include "addToRunTimeSelectionTable.H"
@ -101,116 +102,136 @@ faceSet::~faceSet()
void faceSet::sync(const polyMesh& mesh)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
boolList set(mesh.nFaces());
forAllConstIter(faceSet, *this, iter)
{
set[iter.key()] = true;
}
boolList syncSet(set);
syncTools::syncFaceList(mesh, syncSet, orEqOp<bool>());
label nAdded = 0;
if (Pstream::parRun())
forAll(set, faceI)
{
// Send faces in set that are on a processorPatch. Send as patch face
// indices.
forAll(patches, patchI)
if (!set[faceI] && syncSet[faceI])
{
const polyPatch& pp = patches[patchI];
if (isType<processorPolyPatch>(pp))
if (!insert(faceI))
{
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp);
// Convert faceSet locally to labelList.
DynamicList<label> setFaces(pp.size());
forAll(pp, i)
{
if (found(pp.start() + i))
{
setFaces.append(i);
}
}
setFaces.shrink();
OPstream toNeighbour
(
Pstream::blocking,
procPatch.neighbProcNo()
);
toNeighbour << setFaces;
}
}
// Receive
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
if (isType<processorPolyPatch>(pp))
{
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp);
IPstream fromNeighbour
(
Pstream::blocking,
procPatch.neighbProcNo()
);
labelList setFaces(fromNeighbour);
forAll(setFaces, i)
{
if (insert(pp.start() + setFaces[i]))
{
nAdded++;
}
}
}
}
}
// Couple cyclic patches
forAll (patches, patchI)
{
const polyPatch& pp = patches[patchI];
if (typeid(pp) == typeid(cyclicPolyPatch))
{
const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(pp);
forAll (cycPatch, i)
{
label thisFaceI = cycPatch.start() + i;
label otherFaceI = cycPatch.transformGlobalFace(thisFaceI);
if (found(thisFaceI))
{
if (insert(otherFaceI))
{
nAdded++;
}
}
else if (found(otherFaceI))
{
if (insert(thisFaceI))
{
nAdded++;
}
}
FatalErrorIn("faceSet::sync(const polyMesh&)")
<< "Problem at face " << faceI
<< abort(FatalError);
}
nAdded++;
}
}
//const polyBoundaryMesh& patches = mesh.boundaryMesh();
//
//if (Pstream::parRun())
//{
// // Send faces in set that are on a processorPatch. Send as patch face
// // indices.
// forAll(patches, patchI)
// {
// const polyPatch& pp = patches[patchI];
//
// if (isType<processorPolyPatch>(pp))
// {
// const processorPolyPatch& procPatch =
// refCast<const processorPolyPatch>(pp);
//
// // Convert faceSet locally to labelList.
// DynamicList<label> setFaces(pp.size());
//
// forAll(pp, i)
// {
// if (found(pp.start() + i))
// {
// setFaces.append(i);
// }
// }
// setFaces.shrink();
//
// OPstream toNeighbour
// (
// Pstream::blocking,
// procPatch.neighbProcNo()
// );
//
// toNeighbour << setFaces;
// }
// }
//
// // Receive
// forAll(patches, patchI)
// {
// const polyPatch& pp = patches[patchI];
//
// if (isType<processorPolyPatch>(pp))
// {
// const processorPolyPatch& procPatch =
// refCast<const processorPolyPatch>(pp);
//
// IPstream fromNeighbour
// (
// Pstream::blocking,
// procPatch.neighbProcNo()
// );
//
// labelList setFaces(fromNeighbour);
//
// forAll(setFaces, i)
// {
// if (insert(pp.start() + setFaces[i]))
// {
// nAdded++;
// }
// }
// }
// }
//}
//
//// Couple cyclic patches
//forAll (patches, patchI)
//{
// const polyPatch& pp = patches[patchI];
//
// if (typeid(pp) == typeid(cyclicPolyPatch))
// {
// const cyclicPolyPatch& cycPatch =
// refCast<const cyclicPolyPatch>(pp);
//
// forAll (cycPatch, i)
// {
// label thisFaceI = cycPatch.start() + i;
// label otherFaceI = cycPatch.transformGlobalFace(thisFaceI);
//
// if (found(thisFaceI))
// {
// if (insert(otherFaceI))
// {
// nAdded++;
// }
// }
// else if (found(otherFaceI))
// {
// if (insert(thisFaceI))
// {
// nAdded++;
// }
// }
// }
// }
//}
reduce(nAdded, sumOp<label>());
//if (nAdded > 0)
//{
// Info<< "Added an additional " << nAdded
// << " faces on coupled patches. "
// << "(processorPolyPatch, cyclicPolyPatch)" << endl;
//}
if (nAdded > 0)
{
Info<< "Added an additional " << nAdded
<< " faces on coupled patches. "
<< "(processorPolyPatch, cyclicPolyPatch)" << endl;
}
}

View File

@ -113,8 +113,7 @@ void pointSet::sync(const polyMesh& mesh)
mesh,
contents,
orEqOp<bool>(),
false, // null value
false // no separation
false // null value
);
// Convert back to labelHashSet