Added interfaceSize member to ggi ldu interfaces
This commit is contained in:
parent
1b5c56340e
commit
685c316758
8 changed files with 67 additions and 38 deletions
|
@ -221,6 +221,12 @@ const Foam::ggiLduInterface& Foam::ggiFvPatch::shadowInterface() const
|
|||
}
|
||||
|
||||
|
||||
Foam::label Foam::ggiFvPatch::interfaceSize() const
|
||||
{
|
||||
return ggiPolyPatch_.size();
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::ggiFvPatch::zoneSize() const
|
||||
{
|
||||
return ggiPolyPatch_.zone().size();
|
||||
|
|
|
@ -155,6 +155,9 @@ public:
|
|||
//- Return shadow interface
|
||||
virtual const ggiLduInterface& shadowInterface() const;
|
||||
|
||||
//- Return interface size
|
||||
virtual label interfaceSize() const;
|
||||
|
||||
//- Return zone size
|
||||
virtual label zoneSize() const;
|
||||
|
||||
|
|
|
@ -265,6 +265,12 @@ Foam::regionCoupleFvPatch::shadowInterface() const
|
|||
}
|
||||
|
||||
|
||||
Foam::label Foam::regionCoupleFvPatch::interfaceSize() const
|
||||
{
|
||||
return rcPolyPatch_.size();
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::regionCoupleFvPatch::zoneSize() const
|
||||
{
|
||||
return rcPolyPatch_.zone().size();
|
||||
|
|
|
@ -164,6 +164,9 @@ public:
|
|||
//- Return shadow interface
|
||||
virtual const ggiLduInterface& shadowInterface() const;
|
||||
|
||||
//- Return interface size
|
||||
virtual label interfaceSize() const;
|
||||
|
||||
//- Return zone size
|
||||
virtual label zoneSize() const;
|
||||
|
||||
|
|
|
@ -97,6 +97,9 @@ public:
|
|||
//- Return shadow interface
|
||||
virtual const ggiLduInterface& shadowInterface() const = 0;
|
||||
|
||||
//- Return interface size
|
||||
virtual label interfaceSize() const = 0;
|
||||
|
||||
//- Return zone size
|
||||
virtual label zoneSize() const = 0;
|
||||
|
||||
|
|
|
@ -44,6 +44,13 @@ namespace Foam
|
|||
|
||||
void Foam::ggiAMGInterface::initFastReduce() const
|
||||
{
|
||||
if (mapPtr_)
|
||||
{
|
||||
FatalErrorIn("void ggiAMGInterface::initFastReduce() const")
|
||||
<< "map already calculated"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (!Pstream::parRun())
|
||||
{
|
||||
FatalErrorIn("void ggiAMGInterface::initFastReduce() const")
|
||||
|
@ -52,9 +59,6 @@ void Foam::ggiAMGInterface::initFastReduce() const
|
|||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Init should be executed only once
|
||||
initReduce_ = true;
|
||||
|
||||
// Note: this is different from ggiPolyPatch comms because zone
|
||||
// is the same on master the slave side.
|
||||
// HJ, 31/May/2016
|
||||
|
@ -183,17 +187,6 @@ void Foam::ggiAMGInterface::initFastReduce() const
|
|||
}
|
||||
|
||||
|
||||
const Foam::mapDistribute& Foam::ggiAMGInterface::map() const
|
||||
{
|
||||
if (!mapPtr_)
|
||||
{
|
||||
initFastReduce();
|
||||
}
|
||||
|
||||
return *mapPtr_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ggiAMGInterface::ggiAMGInterface
|
||||
|
@ -208,7 +201,6 @@ Foam::ggiAMGInterface::ggiAMGInterface
|
|||
fineGgiInterface_(refCast<const ggiLduInterface>(fineInterface)),
|
||||
zoneSize_(0),
|
||||
zoneAddressing_(),
|
||||
initReduce_(false),
|
||||
mapPtr_(NULL)
|
||||
{
|
||||
// Note.
|
||||
|
@ -245,6 +237,8 @@ Foam::ggiAMGInterface::ggiAMGInterface
|
|||
|
||||
if (!localParallel())
|
||||
{
|
||||
// Optimisation of this comms call is needed
|
||||
// HJ, 9/Jun/2016
|
||||
reduce(localExpandAddressing, sumOp<labelField>());
|
||||
}
|
||||
}
|
||||
|
@ -269,6 +263,8 @@ Foam::ggiAMGInterface::ggiAMGInterface
|
|||
|
||||
if (!localParallel())
|
||||
{
|
||||
// Optimisation of this comms call is needed
|
||||
// HJ, 9/Jun/2016
|
||||
reduce(neighbourExpandAddressing, sumOp<labelField>());
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +417,7 @@ Foam::ggiAMGInterface::ggiAMGInterface
|
|||
else
|
||||
{
|
||||
// Coarse level, addressing is stored in faceCells
|
||||
forAll (localExpandAddressing, ffi)
|
||||
forAll (localExpandAddressing, ffI)
|
||||
{
|
||||
label curMaster = -1;
|
||||
label curSlave = -1;
|
||||
|
@ -432,14 +428,14 @@ Foam::ggiAMGInterface::ggiAMGInterface
|
|||
if (master())
|
||||
{
|
||||
// Master side
|
||||
curMaster = localExpandAddressing[ffi];
|
||||
curSlave = neighbourExpandAddressing[ffi];
|
||||
curMaster = localExpandAddressing[ffI];
|
||||
curSlave = neighbourExpandAddressing[ffI];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Slave side
|
||||
curMaster = neighbourExpandAddressing[ffi];
|
||||
curSlave = localExpandAddressing[ffi];
|
||||
curMaster = neighbourExpandAddressing[ffI];
|
||||
curSlave = localExpandAddressing[ffI];
|
||||
}
|
||||
|
||||
// Look for the master cell. If it has already got a face,
|
||||
|
@ -481,7 +477,7 @@ Foam::ggiAMGInterface::ggiAMGInterface
|
|||
if (nbrsIter() == curSlave)
|
||||
{
|
||||
nbrFound = true;
|
||||
faceFacesIter().append(ffi);
|
||||
faceFacesIter().append(ffI);
|
||||
// Add dummy weight
|
||||
faceFaceWeightsIter().append(1.0);
|
||||
nAgglomPairs++;
|
||||
|
@ -492,7 +488,7 @@ Foam::ggiAMGInterface::ggiAMGInterface
|
|||
if (!nbrFound)
|
||||
{
|
||||
curNbrs.append(curSlave);
|
||||
curFaceFaces.append(SLList<label>(ffi));
|
||||
curFaceFaces.append(SLList<label>(ffI));
|
||||
// Add dummy weight
|
||||
curFaceWeights.append(SLList<scalar>(1.0));
|
||||
|
||||
|
@ -510,7 +506,7 @@ Foam::ggiAMGInterface::ggiAMGInterface
|
|||
faceFaceTable.insert
|
||||
(
|
||||
curMaster,
|
||||
SLList<SLList<label> >(SLList<label>(ffi))
|
||||
SLList<SLList<label> >(SLList<label>(ffI))
|
||||
);
|
||||
|
||||
// Add dummy weight
|
||||
|
@ -535,7 +531,9 @@ Foam::ggiAMGInterface::ggiAMGInterface
|
|||
labelList contents = neighboursTable.toc();
|
||||
|
||||
// Sort makes sure the order is identical on both sides.
|
||||
// HJ, 20/Feb.2009
|
||||
// Since the global zone is defined by this sort, the neighboursTable
|
||||
// must be complete on all processors
|
||||
// HJ, 20/Feb/2009 and 6/Jun/2016
|
||||
sort(contents);
|
||||
|
||||
// Grab zone size and create zone addressing
|
||||
|
@ -734,16 +732,13 @@ Foam::tmp<Foam::scalarField> Foam::ggiAMGInterface::agglomerateCoeffs
|
|||
zoneFineCoeffs[fineZa[i]] = fineCoeffs[i];
|
||||
}
|
||||
|
||||
// Reduce zone data
|
||||
if (!localParallel())
|
||||
{
|
||||
reduce(zoneFineCoeffs, sumOp<scalarField>());
|
||||
}
|
||||
// Reduce zone data is not required: all coefficients are local
|
||||
// HJ, 9/Jun/2016
|
||||
|
||||
scalarField zoneCoarseCoeffs(zoneSize(), 0);
|
||||
|
||||
// Restrict coefficient
|
||||
forAll(restrictAddressing_, ffi)
|
||||
forAll (restrictAddressing_, ffi)
|
||||
{
|
||||
zoneCoarseCoeffs[restrictAddressing_[ffi]] +=
|
||||
restrictWeights_[ffi]*zoneFineCoeffs[fineAddressing_[ffi]];
|
||||
|
@ -788,6 +783,11 @@ const Foam::ggiLduInterface& Foam::ggiAMGInterface::shadowInterface() const
|
|||
}
|
||||
|
||||
|
||||
Foam::label Foam::ggiAMGInterface::interfaceSize() const
|
||||
{
|
||||
return faceCells_.size();
|
||||
}
|
||||
|
||||
Foam::label Foam::ggiAMGInterface::zoneSize() const
|
||||
{
|
||||
return zoneSize_;
|
||||
|
@ -816,6 +816,17 @@ bool Foam::ggiAMGInterface::localParallel() const
|
|||
}
|
||||
|
||||
|
||||
const Foam::mapDistribute& Foam::ggiAMGInterface::map() const
|
||||
{
|
||||
if (!mapPtr_)
|
||||
{
|
||||
initFastReduce();
|
||||
}
|
||||
|
||||
return *mapPtr_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::scalarListList& Foam::ggiAMGInterface::weights() const
|
||||
{
|
||||
FatalErrorIn("const labelListList& ggiAMGInterface::weights() const")
|
||||
|
|
|
@ -69,10 +69,7 @@ class ggiAMGInterface
|
|||
labelList zoneAddressing_;
|
||||
|
||||
|
||||
// Parallel communication optimisation, stored on master processor
|
||||
|
||||
//- Has reduce been initialised?
|
||||
mutable bool initReduce_;
|
||||
// Parallel communication
|
||||
|
||||
//- Map-distribute comms tool
|
||||
mutable mapDistribute* mapPtr_;
|
||||
|
@ -214,6 +211,9 @@ public:
|
|||
return fineGgiInterface_;
|
||||
}
|
||||
|
||||
//- Return interface size
|
||||
virtual label interfaceSize() const;
|
||||
|
||||
//- Return zone size
|
||||
virtual label zoneSize() const;
|
||||
|
||||
|
|
|
@ -69,10 +69,7 @@ tmp<Field<Type> > ggiAMGInterface::fastReduce(const UList<Type>& ff) const
|
|||
// Optimised mapDistribute
|
||||
|
||||
// Execute init reduce to calculate addressing if not already done
|
||||
if (!initReduce_)
|
||||
{
|
||||
initFastReduce();
|
||||
}
|
||||
map();
|
||||
|
||||
// Prepare for distribute: field will be expanded to zone size
|
||||
List<Type> expand = ff;
|
||||
|
|
Reference in a new issue