Formatting and scalarFieldFieldList

This commit is contained in:
Hrvoje Jasak 2019-09-09 19:26:02 +01:00
parent 874a994a5d
commit d223d4f466
15 changed files with 99 additions and 61 deletions

View file

@ -211,6 +211,12 @@ public:
return acceptorPoint_; return acceptorPoint_;
} }
//- Return access to acceptor location
point& acceptorPoint()
{
return acceptorPoint_;
}
// Donor side // Donor side
@ -257,18 +263,36 @@ public:
} }
} }
//- Return access to donor point
point& donorPoint()
{
return donorPoint_;
}
//- Return extended donor cell numbers //- Return extended donor cell numbers
const DynamicLabelList& extendedDonorCells() const const DynamicLabelList& extendedDonorCells() const
{ {
return extendedDonorCells_; return extendedDonorCells_;
} }
//- Return access to extended donor cell numbers
DynamicLabelList& extendedDonorCells()
{
return extendedDonorCells_;
}
//- Return extended donor cell centres //- Return extended donor cell centres
const DynamicPointList& extendedDonorPoints() const const DynamicPointList& extendedDonorPoints() const
{ {
return extendedDonorPoints_; return extendedDonorPoints_;
} }
//- Return access to extended donor cell centres
DynamicPointList& extendedDonorPoints()
{
return extendedDonorPoints_;
}
//- Return donor to acceptor distance //- Return donor to acceptor distance
scalar distance() const scalar distance() const
{ {

View file

@ -68,12 +68,21 @@ const Foam::oversetMesh& Foam::oversetFvPatch::overset() const
return oversetMesh::New(boundaryMesh().mesh()); return oversetMesh::New(boundaryMesh().mesh());
} }
const Foam::oversetPolyPatch& Foam::oversetFvPatch::oversetPatch() const
{
return oversetPatch_;
}
Foam::tmp<Foam::labelField> Foam::oversetFvPatch::interfaceInternalField Foam::tmp<Foam::labelField> Foam::oversetFvPatch::interfaceInternalField
( (
const unallocLabelList& internalData const unallocLabelList& internalData
) const ) const
{ {
return patchInternalField(internalData); // Return the copy of the parameter since we need all the mapping for
// overset
return tmp<labelField>(new labelField(internalData));
} }
@ -88,10 +97,9 @@ void Foam::oversetFvPatch::initTransfer
Foam::tmp<Foam::labelField> Foam::oversetFvPatch::transfer Foam::tmp<Foam::labelField> Foam::oversetFvPatch::transfer
( (
const Pstream::commsTypes commsType, const Pstream::commsTypes commsType,
const unallocLabelList& const unallocLabelList& interfaceData
) const ) const
{ {
// Missing
return labelField::null(); return labelField::null();
} }
@ -107,10 +115,17 @@ void Foam::oversetFvPatch::initInternalFieldTransfer
Foam::tmp<Foam::labelField> Foam::oversetFvPatch::internalFieldTransfer Foam::tmp<Foam::labelField> Foam::oversetFvPatch::internalFieldTransfer
( (
const Pstream::commsTypes commsType, const Pstream::commsTypes commsType,
const unallocLabelList& const unallocLabelList& iF
) const ) const
{ {
return labelField::null(); // Repackage donor data to acceptors
// Note: result is copied as internal field, re-scaled and passed across
tmp<labelField> tresult(new labelField(iF));
labelList& result = tresult();
overset().map().distribute(result);
return tresult;
} }

View file

@ -59,7 +59,7 @@ class oversetFvPatch
// Private Data // Private Data
//- Reference to overset patch //- Reference to overset patch
const oversetPolyPatch& overPolyPatch_; const oversetPolyPatch& oversetPatch_;
protected: protected:
@ -104,6 +104,9 @@ public:
//- Return access to overset mesh //- Return access to overset mesh
const oversetMesh& overset() const; const oversetMesh& overset() const;
//- Const access to overset poly patch
const oversetPolyPatch& oversetPatch() const;
//- Return true: coupled patch //- Return true: coupled patch
virtual bool coupled() const virtual bool coupled() const
{ {
@ -113,7 +116,7 @@ public:
// Interface transfer functions // Interface transfer functions
//- Return the values of the given internal data adjacent to //- Return the values of the given internal data adjacent to
// the interface as a field // the interface as a field. For overset, this is acceptor data
virtual tmp<labelField> interfaceInternalField virtual tmp<labelField> interfaceInternalField
( (
const unallocLabelList& internalData const unallocLabelList& internalData
@ -141,6 +144,7 @@ public:
) const; ) const;
//- Return neighbour field //- Return neighbour field
// For overset, this is donor data for each acceptor
virtual tmp<labelField> internalFieldTransfer virtual tmp<labelField> internalFieldTransfer
( (
const Pstream::commsTypes commsType, const Pstream::commsTypes commsType,

View file

@ -55,8 +55,8 @@ void Foam::averageValueInterpolation::calcWeights() const
} }
// Allocate necessary storage // Allocate necessary storage
weightsPtr_ = new ListScalarFieldField(overset().regions().size()); weightsPtr_ = new scalarFieldFieldList(overset().regions().size());
ListScalarFieldField& weights = *weightsPtr_; scalarFieldFieldList& weights = *weightsPtr_;
// Loop through all overset regions // Loop through all overset regions
forAll (overset().regions(), regionI) forAll (overset().regions(), regionI)
@ -66,7 +66,7 @@ void Foam::averageValueInterpolation::calcWeights() const
overset().regions()[regionI].acceptors(); overset().regions()[regionI].acceptors();
// Get weights for this region // Get weights for this region
ScalarFieldField& regionWeights = weights[regionI]; scalarFieldField& regionWeights = weights[regionI];
regionWeights.setSize(curAcceptors.size()); regionWeights.setSize(curAcceptors.size());
// Loop through acceptors of this region // Loop through acceptors of this region
@ -121,7 +121,7 @@ Foam::averageValueInterpolation::~averageValueInterpolation()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::oversetInterpolation::ListScalarFieldField& const Foam::oversetInterpolation::scalarFieldFieldList&
Foam::averageValueInterpolation::weights() const Foam::averageValueInterpolation::weights() const
{ {
if (!weightsPtr_) if (!weightsPtr_)

View file

@ -63,7 +63,7 @@ class averageValueInterpolation
// Note: for each acceptor in each region, we have a list of scalars // Note: for each acceptor in each region, we have a list of scalars
// for all donors: master + neighbouring. Master weight is the first // for all donors: master + neighbouring. Master weight is the first
// [index 0], followed by neighbouring weights. // [index 0], followed by neighbouring weights.
mutable ListScalarFieldField* weightsPtr_; mutable scalarFieldFieldList* weightsPtr_;
// Private Member Functions // Private Member Functions
@ -110,7 +110,7 @@ public:
// Access // Access
//- Return weights //- Return weights
virtual const ListScalarFieldField& weights() const; virtual const scalarFieldFieldList& weights() const;
//- Update the interpolation //- Update the interpolation

View file

@ -55,8 +55,8 @@ void Foam::injectionInterpolation::calcWeights() const
} }
// Allocate necessary storage // Allocate necessary storage
weightsPtr_ = new ListScalarFieldField(overset().regions().size()); weightsPtr_ = new scalarFieldFieldList(overset().regions().size());
ListScalarFieldField& weights = *weightsPtr_; scalarFieldFieldList& weights = *weightsPtr_;
// Loop through all overset regions // Loop through all overset regions
forAll (overset().regions(), regionI) forAll (overset().regions(), regionI)
@ -66,7 +66,7 @@ void Foam::injectionInterpolation::calcWeights() const
overset().regions()[regionI].acceptors(); overset().regions()[regionI].acceptors();
// Get weights for this region // Get weights for this region
ScalarFieldField& regionWeights = weights[regionI]; scalarFieldField& regionWeights = weights[regionI];
regionWeights.setSize(curAcceptors.size()); regionWeights.setSize(curAcceptors.size());
// Loop through acceptors of this region // Loop through acceptors of this region
@ -124,7 +124,7 @@ Foam::injectionInterpolation::~injectionInterpolation()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::oversetInterpolation::ListScalarFieldField& const Foam::oversetInterpolation::scalarFieldFieldList&
Foam::injectionInterpolation::weights() const Foam::injectionInterpolation::weights() const
{ {
if (!weightsPtr_) if (!weightsPtr_)

View file

@ -65,7 +65,7 @@ class injectionInterpolation
// Note: for each acceptor in each region, we have a list of scalars // Note: for each acceptor in each region, we have a list of scalars
// for all donors: master + neighbouring. Master weight is the first // for all donors: master + neighbouring. Master weight is the first
// [index 0], followed by neighbouring weights. // [index 0], followed by neighbouring weights.
mutable ListScalarFieldField* weightsPtr_; mutable scalarFieldFieldList* weightsPtr_;
// Private Member Functions // Private Member Functions
@ -102,9 +102,8 @@ public:
); );
// Destructor //- Destructor
virtual ~injectionInterpolation();
virtual ~injectionInterpolation();
// Member Functions // Member Functions
@ -112,7 +111,7 @@ public:
// Access // Access
//- Return weights //- Return weights
virtual const ListScalarFieldField& weights() const; virtual const scalarFieldFieldList& weights() const;
//- Update the interpolation //- Update the interpolation

View file

@ -55,8 +55,8 @@ void Foam::inverseDistanceInterpolation::calcWeights() const
} }
// Allocate necessary storage // Allocate necessary storage
weightsPtr_ = new ListScalarFieldField(overset().regions().size()); weightsPtr_ = new scalarFieldFieldList(overset().regions().size());
ListScalarFieldField& weights = *weightsPtr_; scalarFieldFieldList& weights = *weightsPtr_;
// Loop through all overset regions // Loop through all overset regions
forAll (overset().regions(), regionI) forAll (overset().regions(), regionI)
@ -66,7 +66,7 @@ void Foam::inverseDistanceInterpolation::calcWeights() const
overset().regions()[regionI].acceptors(); overset().regions()[regionI].acceptors();
// Get weights for this region // Get weights for this region
ScalarFieldField& regionWeights = weights[regionI]; scalarFieldField& regionWeights = weights[regionI];
regionWeights.setSize(curAcceptors.size()); regionWeights.setSize(curAcceptors.size());
// Loop through acceptors of this region // Loop through acceptors of this region
@ -146,7 +146,7 @@ Foam::inverseDistanceInterpolation::~inverseDistanceInterpolation()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::oversetInterpolation::ListScalarFieldField& const Foam::oversetInterpolation::scalarFieldFieldList&
Foam::inverseDistanceInterpolation::weights() const Foam::inverseDistanceInterpolation::weights() const
{ {
if (!weightsPtr_) if (!weightsPtr_)

View file

@ -63,7 +63,7 @@ class inverseDistanceInterpolation
// Note: for each acceptor in each region, we have a list of scalars // Note: for each acceptor in each region, we have a list of scalars
// for all donors: master + neighbouring. Master weight is the first // for all donors: master + neighbouring. Master weight is the first
// [index 0], followed by neighbouring weights. // [index 0], followed by neighbouring weights.
mutable ListScalarFieldField* weightsPtr_; mutable scalarFieldFieldList* weightsPtr_;
// Private Member Functions // Private Member Functions
@ -100,9 +100,8 @@ public:
); );
// Destructor //-Destructor
virtual ~inverseDistanceInterpolation();
virtual ~inverseDistanceInterpolation();
// Member Functions // Member Functions
@ -110,7 +109,7 @@ public:
// Access // Access
//- Return weights //- Return weights
virtual const ListScalarFieldField& weights() const; virtual const scalarFieldFieldList& weights() const;
//- Update the interpolation //- Update the interpolation

View file

@ -98,9 +98,8 @@ public:
); );
// Destructor //- Destructor
virtual ~leastSquareInterpolation();
virtual ~leastSquareInterpolation();
// Member Functions // Member Functions

View file

@ -79,8 +79,8 @@ void Foam::leastSquaresGradientInterpolation::calcWeights() const
const vectorField& neiLsIn = lsv.nVectors().internalField(); const vectorField& neiLsIn = lsv.nVectors().internalField();
// Create a local weight field // Create a local weight field
localWeightsPtr_ = new ScalarFieldField(ld.size()); localWeightsPtr_ = new scalarFieldField(ld.size());
ScalarFieldField& localWeights = *localWeightsPtr_; scalarFieldField& localWeights = *localWeightsPtr_;
// Loop through local donors, setting the weights // Loop through local donors, setting the weights
forAll (ld, ldI) forAll (ld, ldI)
@ -155,15 +155,15 @@ void Foam::leastSquaresGradientInterpolation::calcWeights() const
const labelListList& rnd = overset().remoteNeighbouringDonors(); const labelListList& rnd = overset().remoteNeighbouringDonors();
// Create a global weights list for remote donor weights // Create a global weights list for remote donor weights
remoteWeightsPtr_ = new ListScalarFieldField(Pstream::nProcs()); remoteWeightsPtr_ = new scalarFieldFieldList(Pstream::nProcs());
ListScalarFieldField& remoteWeights = *remoteWeightsPtr_; scalarFieldFieldList& remoteWeights = *remoteWeightsPtr_;
// Get the corresponding acceptor cell centres for remote donors on this // Get the corresponding acceptor cell centres for remote donors on this
// processor // processor
const vectorField& procRemAccCC = remoteAccCC()[Pstream::myProcNo()]; const vectorField& procRemAccCC = remoteAccCC()[Pstream::myProcNo()];
// Set the size of the weight field for this processor // Set the size of the weight field for this processor
ScalarFieldField& myProcRemoteWeights = scalarFieldField& myProcRemoteWeights =
remoteWeights[Pstream::myProcNo()]; remoteWeights[Pstream::myProcNo()];
myProcRemoteWeights.setSize(rd.size()); myProcRemoteWeights.setSize(rd.size());
@ -266,7 +266,7 @@ Foam::leastSquaresGradientInterpolation::~leastSquaresGradientInterpolation()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::oversetInterpolation::ScalarFieldField& const Foam::scalarFieldField&
Foam::leastSquaresGradientInterpolation::localWeights() const Foam::leastSquaresGradientInterpolation::localWeights() const
{ {
if (!localWeightsPtr_) if (!localWeightsPtr_)
@ -278,7 +278,7 @@ Foam::leastSquaresGradientInterpolation::localWeights() const
} }
const Foam::oversetInterpolation::ListScalarFieldField& const Foam::oversetInterpolation::scalarFieldFieldList&
Foam::leastSquaresGradientInterpolation::remoteWeights() const Foam::leastSquaresGradientInterpolation::remoteWeights() const
{ {
// We cannot calculate the remoteWeights using usual lazy evaluation // We cannot calculate the remoteWeights using usual lazy evaluation
@ -288,7 +288,7 @@ Foam::leastSquaresGradientInterpolation::remoteWeights() const
{ {
FatalErrorIn FatalErrorIn
( (
"const oversetInterpolation::ListScalarFieldField&\n" "const oversetInterpolation::scalarFieldFieldList&\n"
"averageValueInterpolation::remoteWeights() const" "averageValueInterpolation::remoteWeights() const"
) << "Attempted to calculate remoteWeights for a serial run." ) << "Attempted to calculate remoteWeights for a serial run."
<< "This is not allowed." << "This is not allowed."
@ -298,7 +298,7 @@ Foam::leastSquaresGradientInterpolation::remoteWeights() const
{ {
FatalErrorIn FatalErrorIn
( (
"const oversetInterpolation::ListScalarFieldField&\n" "const oversetInterpolation::scalarFieldFieldList&\n"
"averageValueInterpolation::remoteWeights() const" "averageValueInterpolation::remoteWeights() const"
) << "Attempted to calculate remoteWeights for a slave processor. " ) << "Attempted to calculate remoteWeights for a slave processor. "
<< "This is not allowed." << "This is not allowed."
@ -308,7 +308,7 @@ Foam::leastSquaresGradientInterpolation::remoteWeights() const
{ {
FatalErrorIn FatalErrorIn
( (
"const oversetInterpolation::ListScalarFieldField&\n" "const oversetInterpolation::scalarFieldFieldList&\n"
"averageValueInterpolation::remoteWeights() const" "averageValueInterpolation::remoteWeights() const"
) << "Calculation of remoteWeights not possible because the data \n" ) << "Calculation of remoteWeights not possible because the data \n"
<< "exists only on the master processor. Please calculate \n" << "exists only on the master processor. Please calculate \n"

View file

@ -48,7 +48,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class leastSquaresGradientInterpolation Declaration Class leastSquaresGradientInterpolation Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class leastSquaresGradientInterpolation class leastSquaresGradientInterpolation
@ -65,14 +65,14 @@ class leastSquaresGradientInterpolation
//- Weights for local donor/acceptor pairs (all donors and acceptor //- Weights for local donor/acceptor pairs (all donors and acceptor
// are on the same processor) // are on the same processor)
mutable ScalarFieldField* localWeightsPtr_; mutable scalarFieldField* localWeightsPtr_;
// Master processor data (only accessible on master processor) // Master processor data (only accessible on master processor)
//- Weights for remote donor/acceptor pairs (all donors are on a //- Weights for remote donor/acceptor pairs (all donors are on a
// remote processor). List for all processors is stored on // remote processor). List for all processors is stored on
// master processor (trading off memory for CPU performance) // master processor (trading off memory for CPU performance)
mutable ListScalarFieldField* remoteWeightsPtr_; mutable scalarFieldFieldList* remoteWeightsPtr_;
// Private Member Functions // Private Member Functions
@ -118,10 +118,10 @@ public:
// Member Functions // Member Functions
//- Return local donor weights //- Return local donor weights
virtual const ScalarFieldField& localWeights() const; virtual const scalarFieldField& localWeights() const;
//- Return remote donor weights //- Return remote donor weights
virtual const ListScalarFieldField& remoteWeights() const; virtual const scalarFieldFieldList& remoteWeights() const;
//- Update the interpolation //- Update the interpolation
virtual void update() const; virtual void update() const;

View file

@ -72,8 +72,7 @@ public:
// Public data types // Public data types
typedef FieldField<Field, scalar> ScalarFieldField; typedef List<scalarFieldField> scalarFieldFieldList;
typedef List<ScalarFieldField> ListScalarFieldField;
private: private:
@ -134,10 +133,9 @@ public:
); );
// Destructor //- Destructor
virtual ~oversetInterpolation()
virtual ~oversetInterpolation() {}
{}
// Member Functions // Member Functions
@ -151,7 +149,7 @@ public:
} }
//- Return weights //- Return weights
virtual const ListScalarFieldField& weights() const = 0; virtual const scalarFieldFieldList& weights() const = 0;
//- Update the interpolation //- Update the interpolation

View file

@ -997,6 +997,7 @@ void Foam::oversetMesh::calcInterpolationMap() const
... ...
... ...
... ...
)
*/ */
// Create construct map // Create construct map
@ -1092,8 +1093,8 @@ void Foam::oversetMesh::calcInterpolationMap() const
// Get the corresponding subList // Get the corresponding subList
const labelList::subList procDonorIDs const labelList::subList procDonorIDs
( (
donorIDs, // Original list donorIDs, // Original list
nCurProcRec, // Size of the data nCurProcRec, // Size of the received data
startProcIndex // Start index startProcIndex // Start index
); );

View file

@ -77,7 +77,7 @@ void Foam::oversetMesh::interpolate
// Get interpolation weights for all donors for a given local acceptor in a // Get interpolation weights for all donors for a given local acceptor in a
// given region // given region
const oversetInterpolation::ListScalarFieldField& weights = const oversetInterpolation::scalarFieldFieldList& weights =
interpolation.weights(); interpolation.weights();
// Note: accF field indexed by number of acceptors (region-wise // Note: accF field indexed by number of acceptors (region-wise
@ -91,8 +91,7 @@ void Foam::oversetMesh::interpolate
const donorAcceptorList& curAcceptors = regions_[regionI].acceptors(); const donorAcceptorList& curAcceptors = regions_[regionI].acceptors();
// Get weights for this region // Get weights for this region
const oversetInterpolation::ScalarFieldField& regionWeights = const scalarFieldField& regionWeights = weights[regionI];
weights[regionI];
// Loop through all acceptors of this region // Loop through all acceptors of this region
forAll (curAcceptors, regionAccI) forAll (curAcceptors, regionAccI)