Bug fix: parallel cell-to-point interpolation and evaluation of conditions on coupled boundaries
This commit is contained in:
parent
b0b3e192ae
commit
dc0c8ceda6
24 changed files with 69 additions and 798 deletions
|
@ -153,12 +153,6 @@ public:
|
|||
//- Add field to internal field
|
||||
virtual void addField(Field<Type>&) const = 0;
|
||||
|
||||
//- Initialise swap of patch point values
|
||||
virtual void initSwapAdd(Field<Type>&) const
|
||||
{}
|
||||
|
||||
//- Complete swap of patch point values and add to local values
|
||||
virtual void swapAdd(Field<Type>&) const = 0;
|
||||
|
||||
// Matrix construction (completion) functionality
|
||||
|
||||
|
|
|
@ -230,47 +230,6 @@ CyclicPointPatchField
|
|||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template
|
||||
<
|
||||
template<class> class PatchField,
|
||||
class Mesh,
|
||||
class PointPatch,
|
||||
class CyclicPointPatch,
|
||||
template<class> class MatrixType,
|
||||
class Type
|
||||
>
|
||||
void
|
||||
CyclicPointPatchField
|
||||
<PatchField, Mesh, PointPatch, CyclicPointPatch, MatrixType, Type>::
|
||||
swapAdd(Field<Type>& pField) const
|
||||
{
|
||||
Field<Type> pf(this->patchInternalField(pField));
|
||||
|
||||
const edgeList& pairs = cyclicPatch_.transformPairs();
|
||||
|
||||
if (doTransform())
|
||||
{
|
||||
forAll(pairs, pairi)
|
||||
{
|
||||
Type tmp = pf[pairs[pairi][0]];
|
||||
pf[pairs[pairi][0]] = transform(forwardT()[0], pf[pairs[pairi][1]]);
|
||||
pf[pairs[pairi][1]] = transform(reverseT()[0], tmp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(pairs, pairi)
|
||||
{
|
||||
Swap(pf[pairs[pairi][0]], pf[pairs[pairi][1]]);
|
||||
}
|
||||
}
|
||||
|
||||
addToInternalField(pField, pf);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
|
|
@ -194,8 +194,6 @@ public:
|
|||
virtual void addField(Field<Type>&) const
|
||||
{}
|
||||
|
||||
//- Complete swap of patch point values and add to local values
|
||||
virtual void swapAdd(Field<Type>&) const;
|
||||
|
||||
// Matrix construction (completion) functionality. Currently faked
|
||||
// HJ, 31/May/2007
|
||||
|
|
|
@ -601,86 +601,6 @@ setBoundaryCondition
|
|||
}
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
template<class> class PatchField,
|
||||
class Mesh,
|
||||
class PointPatch,
|
||||
class ProcessorPointPatch,
|
||||
template<class> class MatrixType,
|
||||
class Type
|
||||
>
|
||||
void
|
||||
ProcessorPointPatchField
|
||||
<PatchField, Mesh, PointPatch, ProcessorPointPatch, MatrixType, Type>::
|
||||
initSwapAdd(Field<Type>& pField) const
|
||||
{
|
||||
Field<Type> pf(this->patchInternalField(pField));
|
||||
|
||||
OPstream::write
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch_.neighbProcNo(),
|
||||
reinterpret_cast<const char*>(pf.begin()),
|
||||
pf.byteSize()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
template<class> class PatchField,
|
||||
class Mesh,
|
||||
class PointPatch,
|
||||
class ProcessorPointPatch,
|
||||
template<class> class MatrixType,
|
||||
class Type
|
||||
>
|
||||
void
|
||||
ProcessorPointPatchField
|
||||
<PatchField, Mesh, PointPatch, ProcessorPointPatch, MatrixType, Type>::
|
||||
swapAdd(Field<Type>& pField) const
|
||||
{
|
||||
Field<Type> pnf(this->size());
|
||||
|
||||
IPstream::read
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch_.neighbProcNo(),
|
||||
reinterpret_cast<char*>(pnf.begin()),
|
||||
pnf.byteSize()
|
||||
);
|
||||
|
||||
if (doTransform())
|
||||
{
|
||||
const labelList& nonGlobalPatchPoints =
|
||||
procPatch_.nonGlobalPatchPoints();
|
||||
|
||||
const processorPolyPatch& ppp = procPatch_.procPolyPatch();
|
||||
const labelListList& pointFaces = ppp.pointFaces();
|
||||
const tensorField& forwardT = ppp.forwardT();
|
||||
|
||||
if (forwardT.size() == 1)
|
||||
{
|
||||
transform(pnf, forwardT[0], pnf);
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(nonGlobalPatchPoints, pfi)
|
||||
{
|
||||
pnf[pfi] = transform
|
||||
(
|
||||
forwardT[pointFaces[nonGlobalPatchPoints[pfi]][0]],
|
||||
pnf[pfi]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addToInternalField(pField, pnf);
|
||||
}
|
||||
|
||||
|
||||
// Initialise transfer of diagonal coefficients
|
||||
template
|
||||
<
|
||||
|
|
|
@ -291,12 +291,6 @@ public:
|
|||
Map<typename MatrixType<Type>::ConstraintType> &
|
||||
) const;
|
||||
|
||||
//- Initialise swap of patch point values
|
||||
virtual void initSwapAdd(Field<Type>&) const;
|
||||
|
||||
//- Complete swap of patch point values and add to local values
|
||||
virtual void swapAdd(Field<Type>&) const;
|
||||
|
||||
|
||||
// Matrix construction (completion) functionality
|
||||
|
||||
|
|
|
@ -629,55 +629,6 @@ void GlobalPointPatchField
|
|||
}
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
template<class> class PatchField,
|
||||
class Mesh,
|
||||
class PointPatch,
|
||||
class GlobalPointPatch,
|
||||
template<class> class MatrixType,
|
||||
class Type
|
||||
>
|
||||
void GlobalPointPatchField
|
||||
<
|
||||
PatchField,
|
||||
Mesh,
|
||||
PointPatch,
|
||||
GlobalPointPatch,
|
||||
MatrixType,
|
||||
Type
|
||||
>::swapAdd(Field<Type>& pField) const
|
||||
{
|
||||
// Create the global list and insert local values
|
||||
if (globalPointPatch_.globalPointSize() > 0)
|
||||
{
|
||||
Field<Type> lpf = patchInternalField(pField);
|
||||
const labelList& addr = globalPointPatch_.sharedPointAddr();
|
||||
|
||||
Field<Type> gpf
|
||||
(
|
||||
globalPointPatch_.globalPointSize(),
|
||||
pTraits<Type>::zero
|
||||
);
|
||||
|
||||
forAll(addr, i)
|
||||
{
|
||||
gpf[addr[i]] += lpf[i];
|
||||
}
|
||||
|
||||
combineReduce(gpf, plusEqOp<Field<Type> >());
|
||||
|
||||
// Extract local data
|
||||
forAll (addr, i)
|
||||
{
|
||||
lpf[i] = gpf[addr[i]];
|
||||
}
|
||||
|
||||
setInInternalField(pField, lpf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add diagonal coefficients
|
||||
template
|
||||
<
|
||||
|
|
|
@ -198,9 +198,6 @@ public:
|
|||
Map<typename MatrixType<Type>::ConstraintType> &
|
||||
) const;
|
||||
|
||||
//- Complete swap of patch point values and add to local values
|
||||
virtual void swapAdd(Field<Type>&) const;
|
||||
|
||||
|
||||
// Matrix construction (completion) functionality
|
||||
|
||||
|
|
|
@ -64,7 +64,8 @@ class pointBoundaryMesh
|
|||
|
||||
// Private Member Functions
|
||||
|
||||
//- Calculate the geometry for the patches (transformation tensors etc.)
|
||||
//- Calculate the geometry for the patches
|
||||
// (transformation tensors etc.)
|
||||
void calcGeometry();
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
|
|
|
@ -48,118 +48,15 @@ addToRunTimeSelectionTable
|
|||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::cyclicPointPatch::initGeometry()
|
||||
{
|
||||
transformPairs_.setSize(0);
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicPointPatch::calcGeometry()
|
||||
{
|
||||
const edgeList& cp = cyclicPolyPatch_.coupledPoints();
|
||||
const labelList& mp = cyclicPolyPatch_.meshPoints();
|
||||
|
||||
// If there are no global points create a 1->1 map
|
||||
if (!boundaryMesh().mesh().globalData().nGlobalPoints())
|
||||
{
|
||||
nonGlobalPatchPoints_.setSize(mp.size());
|
||||
forAll(nonGlobalPatchPoints_, i)
|
||||
{
|
||||
nonGlobalPatchPoints_[i] = i;
|
||||
}
|
||||
|
||||
meshPoints_ = cyclicPolyPatch_.meshPoints();
|
||||
transformPairs_ = cp;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get reference to shared points
|
||||
const labelList& sharedPoints =
|
||||
boundaryMesh().globalPatch().meshPoints();
|
||||
|
||||
nonGlobalPatchPoints_.setSize(mp.size());
|
||||
meshPoints_.setSize(mp.size());
|
||||
|
||||
labelList pointMap(mp.size(), -1);
|
||||
|
||||
label noFiltPoints = 0;
|
||||
|
||||
forAll (mp, pointI)
|
||||
{
|
||||
label curP = mp[pointI];
|
||||
|
||||
bool found = false;
|
||||
|
||||
forAll (sharedPoints, sharedI)
|
||||
{
|
||||
if (sharedPoints[sharedI] == curP)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
pointMap[pointI] = noFiltPoints;
|
||||
nonGlobalPatchPoints_[noFiltPoints] = pointI;
|
||||
meshPoints_[noFiltPoints] = curP;
|
||||
noFiltPoints++;
|
||||
}
|
||||
}
|
||||
|
||||
nonGlobalPatchPoints_.setSize(noFiltPoints);
|
||||
meshPoints_.setSize(noFiltPoints);
|
||||
|
||||
|
||||
transformPairs_.setSize(cp.size());
|
||||
|
||||
label noFiltPointPairs = 0;
|
||||
|
||||
forAll(cp, i)
|
||||
{
|
||||
if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] != -1)
|
||||
{
|
||||
transformPairs_[noFiltPointPairs][0] = pointMap[cp[i][0]];
|
||||
transformPairs_[noFiltPointPairs][1] = pointMap[cp[i][1]];
|
||||
noFiltPointPairs++;
|
||||
}
|
||||
else if (pointMap[cp[i][0]] == -1 && pointMap[cp[i][1]] != -1)
|
||||
{
|
||||
FatalErrorIn("cyclicPointPatch::calcGeometry() const")
|
||||
<< "Point " << cp[i][0] << "of point-pair " << i
|
||||
<< " is a global point but the other point "
|
||||
<< cp[i][1] << " is not"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
else if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] == -1)
|
||||
{
|
||||
FatalErrorIn("cyclicPointPatch::calcGeometry() const")
|
||||
<< "Point " << cp[i][1] << "of point-pair " << i
|
||||
<< " is a global point but the other point "
|
||||
<< cp[i][0] << " is not"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
transformPairs_.setSize(noFiltPointPairs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cyclicPointPatch::initUpdateMesh()
|
||||
{
|
||||
facePointPatch::initUpdateMesh();
|
||||
cyclicPointPatch::initGeometry();
|
||||
}
|
||||
|
||||
|
||||
void cyclicPointPatch::updateMesh()
|
||||
{
|
||||
facePointPatch::updateMesh();
|
||||
cyclicPointPatch::calcGeometry();
|
||||
}
|
||||
|
||||
|
||||
|
@ -184,10 +81,6 @@ cyclicPointPatch::~cyclicPointPatch()
|
|||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const edgeList& cyclicPointPatch::transformPairs() const
|
||||
{
|
||||
return transformPairs_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
|
|
@ -79,10 +79,12 @@ protected:
|
|||
// Protected Member Functions
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
virtual void initGeometry();
|
||||
virtual void initGeometry()
|
||||
{}
|
||||
|
||||
//- Calculate the patch geometry
|
||||
virtual void calcGeometry();
|
||||
virtual void calcGeometry()
|
||||
{}
|
||||
|
||||
//- Correct patches after moving points
|
||||
virtual void movePoints()
|
||||
|
@ -147,13 +149,6 @@ public:
|
|||
{
|
||||
return cyclicPolyPatch_.reverseT();
|
||||
}
|
||||
|
||||
|
||||
// Access functions for demand driven data
|
||||
|
||||
//- Return the set of pairs of points that require transformation
|
||||
// and/or mapping
|
||||
virtual const edgeList& transformPairs() const;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -49,33 +49,15 @@ namespace Foam
|
|||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::cyclicGgiPointPatch::initGeometry()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::cyclicGgiPointPatch::calcGeometry()
|
||||
{
|
||||
meshPoints_ = cyclicGgiPolyPatch_.meshPoints();
|
||||
|
||||
nonGlobalPatchPoints_.setSize(meshPoints_.size());
|
||||
forAll(nonGlobalPatchPoints_, i)
|
||||
{
|
||||
nonGlobalPatchPoints_[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicGgiPointPatch::initUpdateMesh()
|
||||
{
|
||||
facePointPatch::initUpdateMesh();
|
||||
cyclicGgiPointPatch::initGeometry();
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicGgiPointPatch::updateMesh()
|
||||
{
|
||||
facePointPatch::updateMesh();
|
||||
cyclicGgiPointPatch::calcGeometry();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -78,10 +78,12 @@ protected:
|
|||
// Protected Member Functions
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
virtual void initGeometry();
|
||||
virtual void initGeometry()
|
||||
{}
|
||||
|
||||
//- Calculate mesh points
|
||||
virtual void calcGeometry();
|
||||
virtual void calcGeometry()
|
||||
{}
|
||||
|
||||
//- Correct patches after moving points
|
||||
virtual void movePoints()
|
||||
|
|
|
@ -49,33 +49,15 @@ namespace Foam
|
|||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::ggiPointPatch::initGeometry()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::ggiPointPatch::calcGeometry()
|
||||
{
|
||||
meshPoints_ = ggiPolyPatch_.meshPoints();
|
||||
|
||||
nonGlobalPatchPoints_.setSize(meshPoints_.size());
|
||||
forAll(nonGlobalPatchPoints_, i)
|
||||
{
|
||||
nonGlobalPatchPoints_[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ggiPointPatch::initUpdateMesh()
|
||||
{
|
||||
facePointPatch::initUpdateMesh();
|
||||
ggiPointPatch::initGeometry();
|
||||
}
|
||||
|
||||
|
||||
void Foam::ggiPointPatch::updateMesh()
|
||||
{
|
||||
facePointPatch::updateMesh();
|
||||
ggiPointPatch::calcGeometry();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -75,10 +75,12 @@ protected:
|
|||
// Protected Member Functions
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
virtual void initGeometry();
|
||||
virtual void initGeometry()
|
||||
{}
|
||||
|
||||
//- Calculate mesh points
|
||||
virtual void calcGeometry();
|
||||
virtual void calcGeometry()
|
||||
{}
|
||||
|
||||
//- Correct patches after moving points
|
||||
virtual void movePoints()
|
||||
|
|
|
@ -49,33 +49,15 @@ namespace Foam
|
|||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::overlapGgiPointPatch::initGeometry()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::overlapGgiPointPatch::calcGeometry()
|
||||
{
|
||||
meshPoints_ = overlapGgiPolyPatch_.meshPoints();
|
||||
|
||||
nonGlobalPatchPoints_.setSize(meshPoints_.size());
|
||||
forAll(nonGlobalPatchPoints_, i)
|
||||
{
|
||||
nonGlobalPatchPoints_[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::overlapGgiPointPatch::initUpdateMesh()
|
||||
{
|
||||
facePointPatch::initUpdateMesh();
|
||||
overlapGgiPointPatch::initGeometry();
|
||||
}
|
||||
|
||||
|
||||
void Foam::overlapGgiPointPatch::updateMesh()
|
||||
{
|
||||
facePointPatch::updateMesh();
|
||||
overlapGgiPointPatch::calcGeometry();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -75,10 +75,12 @@ protected:
|
|||
// Protected Member Functions
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
virtual void initGeometry();
|
||||
virtual void initGeometry()
|
||||
{}
|
||||
|
||||
//- Calculate mesh points
|
||||
virtual void calcGeometry();
|
||||
virtual void calcGeometry()
|
||||
{}
|
||||
|
||||
//- Initialise the patches for moving points
|
||||
virtual void initMovePoints(const pointField&)
|
||||
|
|
|
@ -81,284 +81,11 @@ void Foam::processorPointPatch::initGeometry()
|
|||
pp.points()
|
||||
).meshPoints();
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
initPatchPatchPoints();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorPointPatch::calcGeometry()
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
calcPatchPatchPoints();
|
||||
}
|
||||
|
||||
// If it is not runing parallel or there are no global points
|
||||
// create a 1->1 map
|
||||
if
|
||||
(
|
||||
!Pstream::parRun()
|
||||
|| !boundaryMesh().mesh().globalData().nGlobalPoints()
|
||||
)
|
||||
{
|
||||
nonGlobalPatchPoints_.setSize(meshPoints_.size());
|
||||
forAll(nonGlobalPatchPoints_, i)
|
||||
{
|
||||
nonGlobalPatchPoints_[i] = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get reference to shared points
|
||||
const labelList& sharedPoints =
|
||||
boundaryMesh().globalPatch().meshPoints();
|
||||
|
||||
nonGlobalPatchPoints_.setSize(meshPoints_.size());
|
||||
|
||||
label noFiltPoints = 0;
|
||||
|
||||
forAll (meshPoints_, pointI)
|
||||
{
|
||||
label curP = meshPoints_[pointI];
|
||||
|
||||
bool found = false;
|
||||
|
||||
forAll (sharedPoints, sharedI)
|
||||
{
|
||||
if (sharedPoints[sharedI] == curP)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
nonGlobalPatchPoints_[noFiltPoints] = pointI;
|
||||
meshPoints_[noFiltPoints] = curP;
|
||||
noFiltPoints++;
|
||||
}
|
||||
}
|
||||
|
||||
nonGlobalPatchPoints_.setSize(noFiltPoints);
|
||||
meshPoints_.setSize(noFiltPoints);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void processorPointPatch::initPatchPatchPoints()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "processorPointPatch::calcPatchPatchPoints() : "
|
||||
<< "constructing patch-patch points"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
const polyBoundaryMesh& bm = boundaryMesh().mesh()().boundaryMesh();
|
||||
|
||||
// Get the mesh points for this patch corresponding to the faces
|
||||
const labelList& ppmp = meshPoints();
|
||||
|
||||
// Create a HashSet of the point labels for this patch
|
||||
Map<label> patchPointSet(2*ppmp.size());
|
||||
|
||||
forAll (ppmp, ppi)
|
||||
{
|
||||
patchPointSet.insert(ppmp[ppi], ppi);
|
||||
}
|
||||
|
||||
|
||||
// Create the lists of patch-patch points
|
||||
labelListList patchPatchPoints(bm.size());
|
||||
|
||||
// Create the lists of patch-patch point normals
|
||||
List<List<vector> > patchPatchPointNormals(bm.size());
|
||||
|
||||
// Loop over all patches looking for other patches that share points
|
||||
forAll(bm, patchi)
|
||||
{
|
||||
if
|
||||
(
|
||||
patchi != index() // Ignore self-self
|
||||
&& !isA<emptyPolyPatch>(bm[patchi]) // Ignore empty
|
||||
&& !bm[patchi].coupled() // Ignore other couples
|
||||
)
|
||||
{
|
||||
// Get the meshPoints for the other patch
|
||||
const labelList& meshPoints = bm[patchi].meshPoints();
|
||||
|
||||
// Get the normals for the other patch
|
||||
const vectorField& normals = bm[patchi].pointNormals();
|
||||
|
||||
label pppi = 0;
|
||||
forAll(meshPoints, pointi)
|
||||
{
|
||||
label ppp = meshPoints[pointi];
|
||||
|
||||
// Check to see if the point of the other patch is shared with
|
||||
// this patch
|
||||
Map<label>::iterator iter = patchPointSet.find(ppp);
|
||||
|
||||
if (iter != patchPointSet.end())
|
||||
{
|
||||
// If it is shared initialise the patchPatchPoints for this
|
||||
// patch
|
||||
if (!patchPatchPoints[patchi].size())
|
||||
{
|
||||
patchPatchPoints[patchi].setSize(ppmp.size());
|
||||
patchPatchPointNormals[patchi].setSize(ppmp.size());
|
||||
}
|
||||
|
||||
// and add the entry
|
||||
patchPatchPoints[patchi][pppi] = iter();
|
||||
patchPatchPointNormals[patchi][pppi] = normals[pointi];
|
||||
pppi++;
|
||||
}
|
||||
}
|
||||
|
||||
// Resise the list of shared points and normals for the patch
|
||||
// being considerd
|
||||
patchPatchPoints[patchi].setSize(pppi);
|
||||
patchPatchPointNormals[patchi].setSize(pppi);
|
||||
}
|
||||
}
|
||||
|
||||
// Send the patchPatchPoints to the neighbouring processor
|
||||
|
||||
OPstream toNeighbProc
|
||||
(
|
||||
Pstream::blocking,
|
||||
neighbProcNo()
|
||||
);
|
||||
|
||||
toNeighbProc
|
||||
<< ppmp.size() // number of points for checking
|
||||
<< patchPatchPoints
|
||||
<< patchPatchPointNormals;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "processorPointPatch::calcPatchPatchPoints() : "
|
||||
<< "constructed patch-patch points"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorPointPatch::calcPatchPatchPoints()
|
||||
{
|
||||
// Get the patchPatchPoints from the neighbouring processor
|
||||
IPstream fromNeighbProc
|
||||
(
|
||||
Pstream::blocking,
|
||||
neighbProcNo()
|
||||
);
|
||||
|
||||
label nbrNPoints(readLabel(fromNeighbProc));
|
||||
labelListList patchPatchPoints(fromNeighbProc);
|
||||
List<List<vector> > patchPatchPointNormals(fromNeighbProc);
|
||||
|
||||
pointBoundaryMesh& pbm = const_cast<pointBoundaryMesh&>(boundaryMesh());
|
||||
const labelList& ppmp = meshPoints();
|
||||
|
||||
// Simple check for the very rare situation when not the same number
|
||||
// of points on both sides. This can happen with decomposed cyclics.
|
||||
// If on one side the cyclic shares a point with proc faces coming from
|
||||
// internal faces it will have a different number of points from
|
||||
// the situation where the cyclic and the 'normal' proc faces are fully
|
||||
// separate.
|
||||
if (nbrNPoints != ppmp.size())
|
||||
{
|
||||
WarningIn("processorPointPatch::calcPatchPatchPoints()")
|
||||
<< "Processor patch " << name()
|
||||
<< " has " << ppmp.size() << " points; coupled patch has "
|
||||
<< nbrNPoints << " points." << endl
|
||||
<< " (usually due to decomposed cyclics)."
|
||||
<< " This might give problems" << endl
|
||||
<< " when using point fields (interpolation, mesh motion)."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Loop over the patches looking for other patches that share points
|
||||
forAll(patchPatchPoints, patchi)
|
||||
{
|
||||
const labelList& patchPoints = patchPatchPoints[patchi];
|
||||
const List<vector>& patchPointNormals = patchPatchPointNormals[patchi];
|
||||
|
||||
// If there are potentially shared points for the patch
|
||||
// being considered
|
||||
if (patchPoints.size())
|
||||
{
|
||||
// Get the current meshPoints list for the patch
|
||||
facePointPatch& fpp = refCast<facePointPatch>(pbm[patchi]);
|
||||
const labelList& fmp = fpp.meshPoints();
|
||||
labelList& mp = fpp.meshPoints_;
|
||||
|
||||
const vectorField& fnormals = fpp.pointNormals();
|
||||
vectorField& normals = fpp.pointNormals_;
|
||||
|
||||
// Create a HashSet of the point labels for the patch
|
||||
Map<label> patchPointSet(2*fmp.size());
|
||||
|
||||
forAll (fmp, ppi)
|
||||
{
|
||||
patchPointSet.insert(fmp[ppi], ppi);
|
||||
}
|
||||
|
||||
label nPoints = mp.size();
|
||||
label lpi = 0;
|
||||
bool resized = false;
|
||||
|
||||
// For each potentially shared point...
|
||||
forAll(patchPoints, ppi)
|
||||
{
|
||||
// Check if it is not already in the patch,
|
||||
// i.e. not part of a face of the patch
|
||||
if (!patchPointSet.found(ppmp[patchPoints[ppi]]))
|
||||
{
|
||||
// If it isn't already in the patch check if the local
|
||||
// meshPoints is already set and if not initialise the
|
||||
// meshPoints_ and pointNormals_
|
||||
if (!resized)
|
||||
{
|
||||
if (!mp.size() && fmp.size())
|
||||
{
|
||||
mp = fmp;
|
||||
normals = fnormals;
|
||||
|
||||
nPoints = mp.size();
|
||||
}
|
||||
|
||||
mp.setSize(nPoints + patchPoints.size());
|
||||
loneMeshPoints_.setSize(patchPoints.size());
|
||||
normals.setSize(nPoints + patchPoints.size());
|
||||
resized = true;
|
||||
}
|
||||
|
||||
// Add the new point to the patch
|
||||
mp[nPoints] = ppmp[patchPoints[ppi]];
|
||||
loneMeshPoints_[lpi++] = ppmp[patchPoints[ppi]];
|
||||
normals[nPoints++] = patchPointNormals[ppi];
|
||||
}
|
||||
}
|
||||
|
||||
// If the lists have been resized points have been added.
|
||||
// Shrink the lists to the current size.
|
||||
if (resized)
|
||||
{
|
||||
mp.setSize(nPoints);
|
||||
loneMeshPoints_.setSize(lpi);
|
||||
normals.setSize(nPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void processorPointPatch::initUpdateMesh()
|
||||
|
@ -384,7 +111,8 @@ processorPointPatch::processorPointPatch
|
|||
)
|
||||
:
|
||||
coupledFacePointPatch(patch, bm),
|
||||
procPolyPatch_(refCast<const processorPolyPatch>(patch))
|
||||
procPolyPatch_(refCast<const processorPolyPatch>(patch)),
|
||||
meshPoints_()
|
||||
{}
|
||||
|
||||
|
||||
|
@ -396,6 +124,12 @@ processorPointPatch::~processorPointPatch()
|
|||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const labelList& processorPointPatch::meshPoints() const
|
||||
{
|
||||
return meshPoints_;
|
||||
}
|
||||
|
||||
|
||||
const pointField& processorPointPatch::localPoints() const
|
||||
{
|
||||
notImplemented("processorPointPatch::localPoints() const");
|
||||
|
|
|
@ -62,8 +62,12 @@ class processorPointPatch
|
|||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to processor patch
|
||||
const processorPolyPatch& procPolyPatch_;
|
||||
|
||||
//- Mesh points. On slave they will be reversed
|
||||
mutable labelList meshPoints_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
@ -174,10 +178,13 @@ public:
|
|||
|
||||
// Access functions for demand driven data
|
||||
|
||||
//- Return pointField of points in patch. Not implemented.
|
||||
//- Return mesh points
|
||||
virtual const labelList& meshPoints() const;
|
||||
|
||||
//- Return pointField of points in patch. Not implemented
|
||||
virtual const pointField& localPoints() const;
|
||||
|
||||
//- Return point unit normals. Not impelemented.
|
||||
//- Return point unit normals. Not implemented
|
||||
virtual const vectorField& pointNormals() const;
|
||||
|
||||
//- Return list of edge indices for edges local to the patch
|
||||
|
|
|
@ -51,34 +51,15 @@ addToRunTimeSelectionTable
|
|||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::regionCouplePointPatch::initGeometry()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::regionCouplePointPatch::calcGeometry()
|
||||
{
|
||||
meshPoints_ = regionCouplePolyPatch_.meshPoints();
|
||||
|
||||
nonGlobalPatchPoints_.setSize(meshPoints_.size());
|
||||
|
||||
forAll(nonGlobalPatchPoints_, i)
|
||||
{
|
||||
nonGlobalPatchPoints_[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::regionCouplePointPatch::initUpdateMesh()
|
||||
{
|
||||
facePointPatch::initUpdateMesh();
|
||||
regionCouplePointPatch::initGeometry();
|
||||
}
|
||||
|
||||
|
||||
void Foam::regionCouplePointPatch::updateMesh()
|
||||
{
|
||||
facePointPatch::updateMesh();
|
||||
regionCouplePointPatch::calcGeometry();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -75,10 +75,12 @@ protected:
|
|||
// Protected Member Functions
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
virtual void initGeometry();
|
||||
virtual void initGeometry()
|
||||
{}
|
||||
|
||||
//- Calculate mesh points
|
||||
virtual void calcGeometry();
|
||||
virtual void calcGeometry()
|
||||
{}
|
||||
|
||||
//- Correct patches after moving points
|
||||
virtual void movePoints()
|
||||
|
|
|
@ -57,25 +57,6 @@ coupledFacePointPatch::~coupledFacePointPatch()
|
|||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const labelList& coupledFacePointPatch::nonGlobalPatchPoints() const
|
||||
{
|
||||
return nonGlobalPatchPoints_;
|
||||
}
|
||||
|
||||
const labelList& coupledFacePointPatch::loneMeshPoints() const
|
||||
{
|
||||
return loneMeshPoints_;
|
||||
}
|
||||
|
||||
const vectorField& coupledFacePointPatch::pointNormals() const
|
||||
{
|
||||
notImplemented("coupledFacePointPatch::pointNormals() const");
|
||||
return Field<vector>::null();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
|
|
@ -71,24 +71,6 @@ class coupledFacePointPatch
|
|||
void operator=(const coupledFacePointPatch&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Demand driven private data
|
||||
|
||||
//- The set of labels of the pointPatch points which are
|
||||
// non-global, i.e. present only in this coupledPointPatch.
|
||||
// MUST be initialised by calcGeometry()!
|
||||
labelList nonGlobalPatchPoints_;
|
||||
|
||||
labelList loneMeshPoints_;
|
||||
|
||||
|
||||
// Construction of demand-driven data
|
||||
|
||||
//- Calculate mesh points
|
||||
virtual void calcGeometry() = 0;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
|
@ -119,21 +101,6 @@ public:
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Access functions for demand driven data
|
||||
|
||||
//- Return the set of labels of the pointPatch points which are
|
||||
// non-global, i.e. present in this coupledFacePointPatch
|
||||
virtual const labelList& nonGlobalPatchPoints() const;
|
||||
|
||||
//- Return the set of labels of the pointPatch points which are
|
||||
// lone, i.e. present in this coupledFacePointPatch but not
|
||||
// associated with any faces
|
||||
virtual const labelList& loneMeshPoints() const;
|
||||
|
||||
//- Return point unit normals. Not impelemented.
|
||||
virtual const vectorField& pointNormals() const;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -52,11 +52,7 @@ addToRunTimeSelectionTable
|
|||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void facePointPatch::initGeometry()
|
||||
{
|
||||
meshPoints_.setSize(0);
|
||||
localPoints_.setSize(0);
|
||||
pointNormals_.setSize(0);
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void facePointPatch::calcGeometry()
|
||||
|
@ -94,60 +90,6 @@ facePointPatch::facePointPatch
|
|||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const labelList& facePointPatch::meshPoints() const
|
||||
{
|
||||
if (meshPoints_.size())
|
||||
{
|
||||
return meshPoints_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return polyPatch_.meshPoints();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const pointField& facePointPatch::localPoints() const
|
||||
{
|
||||
if (meshPoints_.size())
|
||||
{
|
||||
if (localPoints_.size() != meshPoints_.size())
|
||||
{
|
||||
const labelList& meshPts = meshPoints();
|
||||
|
||||
localPoints_.setSize(meshPts.size());
|
||||
const pointField& points = polyPatch_.points();
|
||||
|
||||
forAll (meshPts, pointi)
|
||||
{
|
||||
localPoints_[pointi] = points[meshPts[pointi]];
|
||||
}
|
||||
}
|
||||
|
||||
return localPoints_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return polyPatch_.localPoints();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const vectorField& facePointPatch::pointNormals() const
|
||||
{
|
||||
if (pointNormals_.size())
|
||||
{
|
||||
return pointNormals_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return polyPatch_.pointNormals();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
|
|
@ -47,9 +47,6 @@ SourceFiles
|
|||
namespace Foam
|
||||
{
|
||||
|
||||
class processorPointPatch;
|
||||
class cyclicPointPatch;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class facePointPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
@ -58,20 +55,13 @@ class facePointPatch
|
|||
:
|
||||
public pointPatch
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
// Private data
|
||||
|
||||
//- Reference to the underlying polyPatch
|
||||
const polyPatch& polyPatch_;
|
||||
|
||||
// Optional data used if the pointPatch has points not associated
|
||||
// with faces, i.e. not accessible via polyPatch
|
||||
|
||||
mutable labelList meshPoints_;
|
||||
mutable pointField localPoints_;
|
||||
mutable vectorField pointNormals_;
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
|
@ -94,8 +84,6 @@ protected:
|
|||
virtual void updateMesh();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
|
@ -107,10 +95,6 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
// Declare friendship with the coupledPointPatches to allow them to extend
|
||||
// the set of points with those not associated with faces
|
||||
friend class processorPointPatch;
|
||||
friend class cyclicPointPatch;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
|
@ -172,7 +156,13 @@ public:
|
|||
//- Return size
|
||||
virtual label size() const
|
||||
{
|
||||
return meshPoints().size();
|
||||
return polyPatch_.nPoints();
|
||||
}
|
||||
|
||||
//- Return number of faces
|
||||
virtual label nFaces() const
|
||||
{
|
||||
return polyPatch_.size();
|
||||
}
|
||||
|
||||
//- Return the index of this patch in the pointBoundaryMesh
|
||||
|
@ -181,14 +171,27 @@ public:
|
|||
return polyPatch_.index();
|
||||
}
|
||||
|
||||
//- Return mesh points
|
||||
virtual const labelList& meshPoints() const;
|
||||
|
||||
//- Return pointField of points in patch
|
||||
virtual const pointField& localPoints() const;
|
||||
// Access functions for demand driven data
|
||||
|
||||
//- Return mesh points
|
||||
virtual const labelList& meshPoints() const
|
||||
{
|
||||
return polyPatch_.meshPoints();
|
||||
}
|
||||
|
||||
//- Return pointField of points in patch
|
||||
virtual const pointField& localPoints() const
|
||||
{
|
||||
return polyPatch_.localPoints();
|
||||
}
|
||||
|
||||
//- Return point unit normals
|
||||
virtual const vectorField& pointNormals() const
|
||||
{
|
||||
return polyPatch_.pointNormals();
|
||||
}
|
||||
|
||||
//- Return point unit normals
|
||||
virtual const vectorField& pointNormals() const;
|
||||
};
|
||||
|
||||
|
||||
|
|
Reference in a new issue