Revert GGI change
This commit is contained in:
parent
5460dcb963
commit
d1b82b1a66
4 changed files with 27 additions and 384 deletions
|
@ -97,26 +97,13 @@ void GGIInterpolation<MasterPatch, SlavePatch>::bridge
|
||||||
(
|
(
|
||||||
const Field<Type>& bridgeField,
|
const Field<Type>& bridgeField,
|
||||||
Field<Type>& ff,
|
Field<Type>& ff,
|
||||||
const labelList& addr,
|
const labelList& addr
|
||||||
const labelList& partiallyCoveredAddr,
|
|
||||||
const scalarField& coveredFractions
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Fully uncovered faces
|
|
||||||
forAll (addr, faceI)
|
forAll (addr, faceI)
|
||||||
{
|
{
|
||||||
ff[addr[faceI]] = bridgeField[addr[faceI]];
|
ff[addr[faceI]] = bridgeField[addr[faceI]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop through partially covered faces and correct them. Note the
|
|
||||||
// operator+= since we assume that the interpolation part is carried out
|
|
||||||
// before bridging (see e.g. ggiFvPatchField::patchNeighbourField()) using
|
|
||||||
// weights that do not sum up to 1
|
|
||||||
forAll (partiallyCoveredAddr, pcfI)
|
|
||||||
{
|
|
||||||
ff[partiallyCoveredAddr[pcfI]] +=
|
|
||||||
coveredFractions[pcfI]*bridgeField[partiallyCoveredAddr[pcfI]];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,9 +114,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::maskedBridge
|
||||||
const Field<Type>& bridgeField,
|
const Field<Type>& bridgeField,
|
||||||
Field<Type>& ff,
|
Field<Type>& ff,
|
||||||
const labelList& mask,
|
const labelList& mask,
|
||||||
const labelList& uncoveredFaces,
|
const labelList& uncoveredFaces
|
||||||
const labelList& partiallyCoveredAddr,
|
|
||||||
const scalarField& coveredFractions
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Note: tricky algorithm
|
// Note: tricky algorithm
|
||||||
|
@ -146,7 +131,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::maskedBridge
|
||||||
const label faceI = uncoveredFaces[uncoI];
|
const label faceI = uncoveredFaces[uncoI];
|
||||||
|
|
||||||
// Search through the mask
|
// Search through the mask
|
||||||
for (; maskAddrI < mask.size(); ++maskAddrI)
|
for (; maskAddrI < mask.size(); maskAddrI++)
|
||||||
{
|
{
|
||||||
if (faceI == mask[maskAddrI])
|
if (faceI == mask[maskAddrI])
|
||||||
{
|
{
|
||||||
|
@ -162,38 +147,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::maskedBridge
|
||||||
// Go one back and check for next uncovered face
|
// Go one back and check for next uncovered face
|
||||||
if (maskAddrI > 0)
|
if (maskAddrI > 0)
|
||||||
{
|
{
|
||||||
--maskAddrI;
|
maskAddrI--;
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset maskAddrI
|
|
||||||
maskAddrI = 0;
|
|
||||||
|
|
||||||
forAll (partiallyCoveredAddr, pcfI)
|
|
||||||
{
|
|
||||||
// Pick partially covered face
|
|
||||||
const label faceI = partiallyCoveredAddr[pcfI];
|
|
||||||
|
|
||||||
for (; maskAddrI < mask.size(); ++maskAddrI)
|
|
||||||
{
|
|
||||||
if (faceI == mask[maskAddrI])
|
|
||||||
{
|
|
||||||
// Found masked partially covered face
|
|
||||||
ff[maskAddrI] += coveredFractions[pcfI]*bridgeField[maskAddrI];
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (mask[maskAddrI] > faceI)
|
|
||||||
{
|
|
||||||
// Gone beyond my index: my face is not present in the mask
|
|
||||||
// Go one back and check for next uncovered face
|
|
||||||
if (maskAddrI > 0)
|
|
||||||
{
|
|
||||||
--maskAddrI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -557,8 +511,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::bridgeMaster
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
bridgeField.size() != masterPatch_.size()
|
bridgeField.size() != masterPatch_.size()
|
||||||
|| ff.size() != masterPatch_.size()
|
|| ff.size() != masterPatch_.size())
|
||||||
)
|
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
|
@ -574,14 +527,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::bridgeMaster
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
bridge
|
bridge(bridgeField, ff, uncoveredMasterFaces());
|
||||||
(
|
|
||||||
bridgeField,
|
|
||||||
ff,
|
|
||||||
uncoveredMasterFaces(),
|
|
||||||
partiallyCoveredMasterFaces(),
|
|
||||||
masterFaceCoveredFractions()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -605,7 +551,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::maskedBridgeMaster
|
||||||
" Field<Type>& ff,\n"
|
" Field<Type>& ff,\n"
|
||||||
" const labelList& mask\n"
|
" const labelList& mask\n"
|
||||||
") const"
|
") const"
|
||||||
) << "given field does not correspond to patch. Patch (mask) size: "
|
) << "given field does not correspond to patch. Patch size: "
|
||||||
<< masterPatch_.size()
|
<< masterPatch_.size()
|
||||||
<< " bridge field size: " << bridgeField.size()
|
<< " bridge field size: " << bridgeField.size()
|
||||||
<< " field size: " << ff.size()
|
<< " field size: " << ff.size()
|
||||||
|
@ -613,15 +559,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::maskedBridgeMaster
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
maskedBridge
|
maskedBridge(bridgeField, ff, mask, uncoveredMasterFaces());
|
||||||
(
|
|
||||||
bridgeField,
|
|
||||||
ff,
|
|
||||||
mask,
|
|
||||||
uncoveredMasterFaces(),
|
|
||||||
partiallyCoveredMasterFaces(),
|
|
||||||
masterFaceCoveredFractions()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -654,14 +592,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::bridgeSlave
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
bridge
|
bridge(bridgeField, ff, uncoveredSlaveFaces());
|
||||||
(
|
|
||||||
bridgeField,
|
|
||||||
ff,
|
|
||||||
uncoveredSlaveFaces(),
|
|
||||||
partiallyCoveredSlaveFaces(),
|
|
||||||
slaveFaceCoveredFractions()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -685,7 +616,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::maskedBridgeSlave
|
||||||
" Field<Type>& ff\n,"
|
" Field<Type>& ff\n,"
|
||||||
" const labelList& mask\n"
|
" const labelList& mask\n"
|
||||||
") const"
|
") const"
|
||||||
) << "given field does not correspond to patch. Patch (mask) size: "
|
) << "given field does not correspond to patch. Patch size: "
|
||||||
<< slavePatch_.size()
|
<< slavePatch_.size()
|
||||||
<< " bridge field size: " << bridgeField.size()
|
<< " bridge field size: " << bridgeField.size()
|
||||||
<< " field size: " << ff.size()
|
<< " field size: " << ff.size()
|
||||||
|
@ -693,18 +624,12 @@ void GGIInterpolation<MasterPatch, SlavePatch>::maskedBridgeSlave
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
maskedBridge
|
maskedBridge(bridgeField, ff, mask, uncoveredSlaveFaces());
|
||||||
(
|
|
||||||
bridgeField,
|
|
||||||
ff,
|
|
||||||
mask,
|
|
||||||
uncoveredSlaveFaces(),
|
|
||||||
partiallyCoveredSlaveFaces(),
|
|
||||||
slaveFaceCoveredFractions()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
|
@ -104,11 +104,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::clearOut()
|
||||||
deleteDemandDrivenData(slaveWeightsPtr_);
|
deleteDemandDrivenData(slaveWeightsPtr_);
|
||||||
|
|
||||||
deleteDemandDrivenData(uncoveredMasterAddrPtr_);
|
deleteDemandDrivenData(uncoveredMasterAddrPtr_);
|
||||||
deleteDemandDrivenData(partiallyCoveredMasterAddrPtr_);
|
|
||||||
deleteDemandDrivenData(masterFaceCoveredFractionsPtr_);
|
|
||||||
deleteDemandDrivenData(uncoveredSlaveAddrPtr_);
|
deleteDemandDrivenData(uncoveredSlaveAddrPtr_);
|
||||||
deleteDemandDrivenData(partiallyCoveredSlaveAddrPtr_);
|
|
||||||
deleteDemandDrivenData(slaveFaceCoveredFractionsPtr_);
|
|
||||||
|
|
||||||
deleteDemandDrivenData(masterPointAddressingPtr_);
|
deleteDemandDrivenData(masterPointAddressingPtr_);
|
||||||
deleteDemandDrivenData(masterPointWeightsPtr_);
|
deleteDemandDrivenData(masterPointWeightsPtr_);
|
||||||
|
@ -159,11 +155,7 @@ GGIInterpolation<MasterPatch, SlavePatch>::GGIInterpolation
|
||||||
slavePointWeightsPtr_(NULL),
|
slavePointWeightsPtr_(NULL),
|
||||||
slavePointDistancePtr_(NULL),
|
slavePointDistancePtr_(NULL),
|
||||||
uncoveredMasterAddrPtr_(NULL),
|
uncoveredMasterAddrPtr_(NULL),
|
||||||
partiallyCoveredMasterAddrPtr_(NULL),
|
uncoveredSlaveAddrPtr_(NULL)
|
||||||
masterFaceCoveredFractionsPtr_(NULL),
|
|
||||||
uncoveredSlaveAddrPtr_(NULL),
|
|
||||||
partiallyCoveredSlaveAddrPtr_(NULL),
|
|
||||||
slaveFaceCoveredFractionsPtr_(NULL)
|
|
||||||
{
|
{
|
||||||
// Check size of transform. They should be equal to slave patch size
|
// Check size of transform. They should be equal to slave patch size
|
||||||
// if the transform is not constant
|
// if the transform is not constant
|
||||||
|
@ -264,32 +256,6 @@ GGIInterpolation<MasterPatch, SlavePatch>::uncoveredMasterFaces() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class MasterPatch, class SlavePatch>
|
|
||||||
const labelList&
|
|
||||||
GGIInterpolation<MasterPatch, SlavePatch>::partiallyCoveredMasterFaces() const
|
|
||||||
{
|
|
||||||
if (!partiallyCoveredMasterAddrPtr_)
|
|
||||||
{
|
|
||||||
calcAddressing();
|
|
||||||
}
|
|
||||||
|
|
||||||
return *partiallyCoveredMasterAddrPtr_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class MasterPatch, class SlavePatch>
|
|
||||||
const scalarField&
|
|
||||||
GGIInterpolation<MasterPatch, SlavePatch>::masterFaceCoveredFractions() const
|
|
||||||
{
|
|
||||||
if (!masterFaceCoveredFractionsPtr_)
|
|
||||||
{
|
|
||||||
calcAddressing();
|
|
||||||
}
|
|
||||||
|
|
||||||
return *masterFaceCoveredFractionsPtr_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class MasterPatch, class SlavePatch>
|
template<class MasterPatch, class SlavePatch>
|
||||||
const labelList&
|
const labelList&
|
||||||
GGIInterpolation<MasterPatch, SlavePatch>::uncoveredSlaveFaces() const
|
GGIInterpolation<MasterPatch, SlavePatch>::uncoveredSlaveFaces() const
|
||||||
|
@ -303,32 +269,6 @@ GGIInterpolation<MasterPatch, SlavePatch>::uncoveredSlaveFaces() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class MasterPatch, class SlavePatch>
|
|
||||||
const labelList&
|
|
||||||
GGIInterpolation<MasterPatch, SlavePatch>::partiallyCoveredSlaveFaces() const
|
|
||||||
{
|
|
||||||
if (!partiallyCoveredSlaveAddrPtr_)
|
|
||||||
{
|
|
||||||
calcAddressing();
|
|
||||||
}
|
|
||||||
|
|
||||||
return *partiallyCoveredSlaveAddrPtr_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class MasterPatch, class SlavePatch>
|
|
||||||
const scalarField&
|
|
||||||
GGIInterpolation<MasterPatch, SlavePatch>::slaveFaceCoveredFractions() const
|
|
||||||
{
|
|
||||||
if (!slaveFaceCoveredFractionsPtr_)
|
|
||||||
{
|
|
||||||
calcAddressing();
|
|
||||||
}
|
|
||||||
|
|
||||||
return *slaveFaceCoveredFractionsPtr_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class MasterPatch, class SlavePatch>
|
template<class MasterPatch, class SlavePatch>
|
||||||
bool GGIInterpolation<MasterPatch, SlavePatch>::movePoints
|
bool GGIInterpolation<MasterPatch, SlavePatch>::movePoints
|
||||||
(
|
(
|
||||||
|
|
|
@ -218,29 +218,9 @@ class GGIInterpolation
|
||||||
//- List of uncovered master faces
|
//- List of uncovered master faces
|
||||||
mutable labelList* uncoveredMasterAddrPtr_;
|
mutable labelList* uncoveredMasterAddrPtr_;
|
||||||
|
|
||||||
//- List of partially covered master faces. Contains faces with
|
|
||||||
// weights between masterNonOverlapFaceTol_ and
|
|
||||||
// uncoveredFaceAreaTol_. Used in bridging
|
|
||||||
mutable labelList* partiallyCoveredMasterAddrPtr_;
|
|
||||||
|
|
||||||
//- List of face fractions for partially covered master faces. Range
|
|
||||||
// anywhere from 1 to uncoveredFaceAreaTol_ (e.g. 0.2 means
|
|
||||||
// that the face area is covered by 20% on the other side)
|
|
||||||
mutable scalarField* masterFaceCoveredFractionsPtr_;
|
|
||||||
|
|
||||||
//- List of uncovered slave faces
|
//- List of uncovered slave faces
|
||||||
mutable labelList* uncoveredSlaveAddrPtr_;
|
mutable labelList* uncoveredSlaveAddrPtr_;
|
||||||
|
|
||||||
//- List of partially covered slave faces. Contains faces with
|
|
||||||
// weights between masterNonOverlapFaceTol_ and
|
|
||||||
// uncoveredFaceAreaTol_. Used in bridging
|
|
||||||
mutable labelList* partiallyCoveredSlaveAddrPtr_;
|
|
||||||
|
|
||||||
//- List of face fractions for partially covered slave faces. Range
|
|
||||||
// anywhere from 1 to uncoveredFaceAreaTol_ (e.g. 0.2 means
|
|
||||||
// that the face area is covered by 20% on the other side)
|
|
||||||
mutable scalarField* slaveFaceCoveredFractionsPtr_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private static data
|
// Private static data
|
||||||
|
|
||||||
|
@ -253,9 +233,6 @@ class GGIInterpolation
|
||||||
//- Facet bound box extension factor
|
//- Facet bound box extension factor
|
||||||
static const debug::tolerancesSwitch faceBoundBoxExtendSpanFraction_;
|
static const debug::tolerancesSwitch faceBoundBoxExtendSpanFraction_;
|
||||||
|
|
||||||
//- Tolerance for uncovered face areas
|
|
||||||
static const debug::tolerancesSwitch uncoveredFaceAreaTol_;
|
|
||||||
|
|
||||||
//- The next 3 attributes are parameters controlling the creation
|
//- The next 3 attributes are parameters controlling the creation
|
||||||
// of an octree search engine for the GGI facets neighbourhood
|
// of an octree search engine for the GGI facets neighbourhood
|
||||||
// determination.
|
// determination.
|
||||||
|
@ -440,14 +417,6 @@ class GGIInterpolation
|
||||||
const scalar& nonOverlapFaceTol
|
const scalar& nonOverlapFaceTol
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Calculate partially covered faces
|
|
||||||
void calcPartiallyCoveredFaces
|
|
||||||
(
|
|
||||||
const scalarListList& patchWeights,
|
|
||||||
const scalar& nonOverlapFaceTo,
|
|
||||||
const bool isMaster
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Clear all geometry and addressing
|
//- Clear all geometry and addressing
|
||||||
void clearOut();
|
void clearOut();
|
||||||
|
|
||||||
|
@ -482,9 +451,7 @@ class GGIInterpolation
|
||||||
(
|
(
|
||||||
const Field<Type>& bridgeField,
|
const Field<Type>& bridgeField,
|
||||||
Field<Type>& ff,
|
Field<Type>& ff,
|
||||||
const labelList& addr,
|
const labelList& addr
|
||||||
const labelList& partiallyCoveredAddr,
|
|
||||||
const scalarField& coveredFractions
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Bridge uncovered faces given addressing
|
//- Bridge uncovered faces given addressing
|
||||||
|
@ -495,9 +462,7 @@ class GGIInterpolation
|
||||||
const Field<Type>& bridgeField,
|
const Field<Type>& bridgeField,
|
||||||
Field<Type>& ff,
|
Field<Type>& ff,
|
||||||
const labelList& mask,
|
const labelList& mask,
|
||||||
const labelList& uncoveredFaces,
|
const labelList& uncoveredFaces
|
||||||
const labelList& partiallyCoveredAddr,
|
|
||||||
const scalarField& coveredFractions
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Is a transform required?
|
//- Is a transform required?
|
||||||
|
@ -568,21 +533,9 @@ public:
|
||||||
//- Return reference to the master list of non-overlap faces
|
//- Return reference to the master list of non-overlap faces
|
||||||
const labelList& uncoveredMasterFaces() const;
|
const labelList& uncoveredMasterFaces() const;
|
||||||
|
|
||||||
//- Return reference to master list of partially covered faces
|
|
||||||
const labelList& partiallyCoveredMasterFaces() const;
|
|
||||||
|
|
||||||
//- Return covered fractions of partially covered master faces
|
|
||||||
const scalarField& masterFaceCoveredFractions() const;
|
|
||||||
|
|
||||||
//- Return reference to the slave list of non-overlap faces
|
//- Return reference to the slave list of non-overlap faces
|
||||||
const labelList& uncoveredSlaveFaces() const;
|
const labelList& uncoveredSlaveFaces() const;
|
||||||
|
|
||||||
//- Return reference to slave list of partially covered faces
|
|
||||||
const labelList& partiallyCoveredSlaveFaces() const;
|
|
||||||
|
|
||||||
//- Return covered fractions of partially covered slave faces
|
|
||||||
const scalarField& slaveFaceCoveredFractions() const;
|
|
||||||
|
|
||||||
//- Return reference to point addressing
|
//- Return reference to point addressing
|
||||||
const List<labelPair>& masterPointAddr() const;
|
const List<labelPair>& masterPointAddr() const;
|
||||||
|
|
||||||
|
@ -601,7 +554,6 @@ public:
|
||||||
//- Return distance to intersection for patch points
|
//- Return distance to intersection for patch points
|
||||||
const scalarField& slavePointDistanceToIntersection() const;
|
const scalarField& slavePointDistanceToIntersection() const;
|
||||||
|
|
||||||
|
|
||||||
// Interpolation functions
|
// Interpolation functions
|
||||||
|
|
||||||
//- Interpolate from master to slave
|
//- Interpolate from master to slave
|
||||||
|
@ -688,6 +640,12 @@ public:
|
||||||
const Field<Type>& pf
|
const Field<Type>& pf
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > slaveToMasterPointInterpolate
|
||||||
|
(
|
||||||
|
const Field<Type>& pf
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
|
|
|
@ -68,16 +68,6 @@ GGIInterpolation<MasterPatch, SlavePatch>::featureCosTol_
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
template<class MasterPatch, class SlavePatch>
|
|
||||||
const Foam::debug::tolerancesSwitch
|
|
||||||
GGIInterpolation<MasterPatch, SlavePatch>::uncoveredFaceAreaTol_
|
|
||||||
(
|
|
||||||
"GGIUncoveredFaceAreaTol",
|
|
||||||
0.999,
|
|
||||||
"Fraction of face area mismatch (sum of weights) to consider a face "
|
|
||||||
"as uncovered, i.e. not to rescale weights."
|
|
||||||
);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class MasterPatch, class SlavePatch>
|
template<class MasterPatch, class SlavePatch>
|
||||||
|
@ -90,11 +80,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::calcAddressing() const
|
||||||
|| slaveAddrPtr_
|
|| slaveAddrPtr_
|
||||||
|| slaveWeightsPtr_
|
|| slaveWeightsPtr_
|
||||||
|| uncoveredMasterAddrPtr_
|
|| uncoveredMasterAddrPtr_
|
||||||
|| partiallyCoveredMasterAddrPtr_
|
|
||||||
|| masterFaceCoveredFractionsPtr_
|
|
||||||
|| uncoveredSlaveAddrPtr_
|
|| uncoveredSlaveAddrPtr_
|
||||||
|| partiallyCoveredSlaveAddrPtr_
|
|
||||||
|| slaveFaceCoveredFractionsPtr_
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
|
@ -445,7 +431,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::calcAddressing() const
|
||||||
);
|
);
|
||||||
|
|
||||||
// Fix: previously checked for VSMALL.
|
// Fix: previously checked for VSMALL.
|
||||||
// HJ, 19/Sep/2016
|
// HJ, 19/Sep2/106
|
||||||
if (intersectionArea > intersectionTestArea)
|
if (intersectionArea > intersectionTestArea)
|
||||||
{
|
{
|
||||||
// We compute the GGI weights based on this
|
// We compute the GGI weights based on this
|
||||||
|
@ -569,7 +555,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::calcAddressing() const
|
||||||
const labelList& curMa = ma[mfI];
|
const labelList& curMa = ma[mfI];
|
||||||
const scalarList& cursmaW = smaW[mfI];
|
const scalarList& cursmaW = smaW[mfI];
|
||||||
|
|
||||||
// Current master face index
|
// Current master face indes
|
||||||
const label faceMaster = mfI;
|
const label faceMaster = mfI;
|
||||||
|
|
||||||
forAll (curMa, mAI)
|
forAll (curMa, mAI)
|
||||||
|
@ -615,29 +601,6 @@ void GGIInterpolation<MasterPatch, SlavePatch>::calcAddressing() const
|
||||||
findNonOverlappingFaces(saW, slaveNonOverlapFaceTol_)
|
findNonOverlappingFaces(saW, slaveNonOverlapFaceTol_)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Calculate master and slave partially covered addressing
|
|
||||||
|
|
||||||
// Note: This function allocates:
|
|
||||||
// 1. partiallyCoveredMasterAddrPtr_
|
|
||||||
// 2. masterFaceCoveredFractionsPtr_
|
|
||||||
calcPartiallyCoveredFaces
|
|
||||||
(
|
|
||||||
maW,
|
|
||||||
masterNonOverlapFaceTol_,
|
|
||||||
true // This is master
|
|
||||||
);
|
|
||||||
|
|
||||||
// Note: this function allocates:
|
|
||||||
// 1. partiallyCoveredSlaveAddrPtr_
|
|
||||||
// 2. slaveFaceCoveredFractionsPtr_
|
|
||||||
calcPartiallyCoveredFaces
|
|
||||||
(
|
|
||||||
saW,
|
|
||||||
slaveNonOverlapFaceTol_,
|
|
||||||
false // This is not master
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Rescaling the weighting factors so they will sum up to 1.0
|
// Rescaling the weighting factors so they will sum up to 1.0
|
||||||
// See the comment for the method ::rescaleWeightingFactors() for
|
// See the comment for the method ::rescaleWeightingFactors() for
|
||||||
// more information. By default, we always rescale. But for some
|
// more information. By default, we always rescale. But for some
|
||||||
|
@ -645,8 +608,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::calcAddressing() const
|
||||||
// then we need the brute values, so no rescaling in that
|
// then we need the brute values, so no rescaling in that
|
||||||
// case. Hence the little flag rescaleGGIWeightingFactors_
|
// case. Hence the little flag rescaleGGIWeightingFactors_
|
||||||
|
|
||||||
// Not parallelised. HJ, 27/Apr/2016. Rescaling is not performed for
|
// Not parallelised. HJ, 27/Apr/2016
|
||||||
// partially overlapping faces for their correct treatment. VV, 16/Oct/2017.
|
|
||||||
if (rescaleGGIWeightingFactors_)
|
if (rescaleGGIWeightingFactors_)
|
||||||
{
|
{
|
||||||
rescaleWeightingFactors();
|
rescaleWeightingFactors();
|
||||||
|
@ -694,35 +656,6 @@ void GGIInterpolation<MasterPatch, SlavePatch>::rescaleWeightingFactors() const
|
||||||
scalar sumMWC = 0;
|
scalar sumMWC = 0;
|
||||||
scalar curMWC = 0;
|
scalar curMWC = 0;
|
||||||
|
|
||||||
// Note: do not rescale weighting factors for partially covered faces
|
|
||||||
if (!partiallyCoveredMasterAddrPtr_ || !partiallyCoveredSlaveAddrPtr_)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"void GGIInterpolation<MasterPatch, SlavePatch>::"
|
|
||||||
"rescaleWeightingFactors() const"
|
|
||||||
) << "Master or slave partially covered faces are not calculated."
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
const labelList& partiallyCoveredMasterFaces =
|
|
||||||
*partiallyCoveredMasterAddrPtr_;
|
|
||||||
const labelList& partiallyCoveredSlaveFaces =
|
|
||||||
*partiallyCoveredSlaveAddrPtr_;
|
|
||||||
|
|
||||||
// Create a mask for partially covered master/slave faces
|
|
||||||
boolList masterPCMask(maW.size(), false);
|
|
||||||
boolList slavePCMask(saW.size(), false);
|
|
||||||
|
|
||||||
forAll (partiallyCoveredMasterFaces, pfmI)
|
|
||||||
{
|
|
||||||
masterPCMask[partiallyCoveredMasterFaces[pfmI]] = true;
|
|
||||||
}
|
|
||||||
forAll (partiallyCoveredSlaveFaces, pfsI)
|
|
||||||
{
|
|
||||||
slavePCMask[partiallyCoveredSlaveFaces[pfsI]] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rescaling the slave weights
|
// Rescaling the slave weights
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
@ -746,7 +679,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::rescaleWeightingFactors() const
|
||||||
{
|
{
|
||||||
scalar slaveWeightSum = Foam::sum(saW[saWi]);
|
scalar slaveWeightSum = Foam::sum(saW[saWi]);
|
||||||
|
|
||||||
if (saW[saWi].size() > 0 && !slavePCMask[saWi])
|
if (saW[saWi].size() > 0)
|
||||||
{
|
{
|
||||||
saW[saWi] = saW[saWi]/slaveWeightSum;
|
saW[saWi] = saW[saWi]/slaveWeightSum;
|
||||||
|
|
||||||
|
@ -763,7 +696,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::rescaleWeightingFactors() const
|
||||||
{
|
{
|
||||||
scalar masterWeightSum = Foam::sum(maW[maWi]);
|
scalar masterWeightSum = Foam::sum(maW[maWi]);
|
||||||
|
|
||||||
if (maW[maWi].size() > 0 && !masterPCMask[maWi])
|
if (maW[maWi].size() > 0)
|
||||||
{
|
{
|
||||||
maW[maWi] = maW[maWi]/masterWeightSum;
|
maW[maWi] = maW[maWi]/masterWeightSum;
|
||||||
|
|
||||||
|
@ -834,119 +767,6 @@ GGIInterpolation<MasterPatch, SlavePatch>::findNonOverlappingFaces
|
||||||
return tpatchFaceNonOverlapAddr;
|
return tpatchFaceNonOverlapAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class MasterPatch, class SlavePatch>
|
|
||||||
void GGIInterpolation<MasterPatch, SlavePatch>::calcPartiallyCoveredFaces
|
|
||||||
(
|
|
||||||
const scalarListList& patchWeights,
|
|
||||||
const scalar& nonOverlapFaceTol,
|
|
||||||
const bool isMaster
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
// Sanity checks first
|
|
||||||
if
|
|
||||||
(
|
|
||||||
isMaster
|
|
||||||
&& (partiallyCoveredMasterAddrPtr_ || masterFaceCoveredFractionsPtr_)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"void GGIInterpolation<MasterPatch, SlavePatch>::"
|
|
||||||
"calcPartiallyCoveredFaces() const"
|
|
||||||
) << "Already calculated master partially covered faces"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!isMaster
|
|
||||||
&& (partiallyCoveredSlaveAddrPtr_ || slaveFaceCoveredFractionsPtr_)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"void GGIInterpolation<MasterPatch, SlavePatch>::"
|
|
||||||
"calcPartiallyCoveredFaces() const"
|
|
||||||
) << "Already calculated slave partially covered faces"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Temporary storage
|
|
||||||
DynamicList<label, 64> patchFacePartialOverlap(patchWeights.size());
|
|
||||||
DynamicList<scalar, 64> uncoveredFaceFractions(patchWeights.size());
|
|
||||||
|
|
||||||
// Scan the list of patch weights and collect ones inbetween
|
|
||||||
// nonOverlapFaceTol and uncoveredFaceAreaTol_
|
|
||||||
forAll (patchWeights, paWi)
|
|
||||||
{
|
|
||||||
const scalar sumWeightsFace = sum(patchWeights[paWi]);
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
sumWeightsFace > nonOverlapFaceTol
|
|
||||||
&& sumWeightsFace <= uncoveredFaceAreaTol_()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// This is considered partially overlapped face, store the index and
|
|
||||||
// the non-overlapping area (1 - sum of weights)
|
|
||||||
patchFacePartialOverlap.append(paWi);
|
|
||||||
uncoveredFaceFractions.append(1.0 - sumWeightsFace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Transfer the storage
|
|
||||||
if (isMaster)
|
|
||||||
{
|
|
||||||
// Allocate master side
|
|
||||||
partiallyCoveredMasterAddrPtr_ =
|
|
||||||
new labelList(patchFacePartialOverlap.xfer());
|
|
||||||
masterFaceCoveredFractionsPtr_ =
|
|
||||||
new scalarField(uncoveredFaceFractions.xfer());
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
InfoIn("GGIInterpolation::calcPartiallyCoveredFaces")
|
|
||||||
<< " : Found " << partiallyCoveredMasterAddrPtr_->size()
|
|
||||||
<< " partially overlapping faces for master GGI patch" << endl;
|
|
||||||
|
|
||||||
if (partiallyCoveredMasterAddrPtr_->size())
|
|
||||||
{
|
|
||||||
Info<< "Max coverage: "
|
|
||||||
<< max(*masterFaceCoveredFractionsPtr_)
|
|
||||||
<< ", min coverage: "
|
|
||||||
<< min(*masterFaceCoveredFractionsPtr_)
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Allocate slave side
|
|
||||||
partiallyCoveredSlaveAddrPtr_ =
|
|
||||||
new labelList(patchFacePartialOverlap.xfer());
|
|
||||||
slaveFaceCoveredFractionsPtr_ =
|
|
||||||
new scalarField(uncoveredFaceFractions.xfer());
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
InfoIn("GGIInterpolation::calcPartiallyCoveredFaces")
|
|
||||||
<< " : Found " << partiallyCoveredSlaveAddrPtr_->size()
|
|
||||||
<< " partially overlapping faces for slave GGI patch" << endl;
|
|
||||||
|
|
||||||
if (partiallyCoveredSlaveAddrPtr_->size())
|
|
||||||
{
|
|
||||||
Info<< "Max coverage: "
|
|
||||||
<< max(*slaveFaceCoveredFractionsPtr_)
|
|
||||||
<< ", min coverage: "
|
|
||||||
<< min(*slaveFaceCoveredFractionsPtr_)
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class FromPatch, class ToPatch>
|
template<class FromPatch, class ToPatch>
|
||||||
void GGIInterpolation<FromPatch, ToPatch>::
|
void GGIInterpolation<FromPatch, ToPatch>::
|
||||||
calcMasterPointAddressing() const
|
calcMasterPointAddressing() const
|
||||||
|
|
Reference in a new issue