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

View file

@ -68,12 +68,21 @@ const Foam::oversetMesh& Foam::oversetFvPatch::overset() const
return oversetMesh::New(boundaryMesh().mesh());
}
const Foam::oversetPolyPatch& Foam::oversetFvPatch::oversetPatch() const
{
return oversetPatch_;
}
Foam::tmp<Foam::labelField> Foam::oversetFvPatch::interfaceInternalField
(
const unallocLabelList& internalData
) 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
(
const Pstream::commsTypes commsType,
const unallocLabelList&
const unallocLabelList& interfaceData
) const
{
// Missing
return labelField::null();
}
@ -107,10 +115,17 @@ void Foam::oversetFvPatch::initInternalFieldTransfer
Foam::tmp<Foam::labelField> Foam::oversetFvPatch::internalFieldTransfer
(
const Pstream::commsTypes commsType,
const unallocLabelList&
const unallocLabelList& iF
) 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
//- Reference to overset patch
const oversetPolyPatch& overPolyPatch_;
const oversetPolyPatch& oversetPatch_;
protected:
@ -104,6 +104,9 @@ public:
//- Return access to overset mesh
const oversetMesh& overset() const;
//- Const access to overset poly patch
const oversetPolyPatch& oversetPatch() const;
//- Return true: coupled patch
virtual bool coupled() const
{
@ -113,7 +116,7 @@ public:
// Interface transfer functions
//- 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
(
const unallocLabelList& internalData
@ -141,6 +144,7 @@ public:
) const;
//- Return neighbour field
// For overset, this is donor data for each acceptor
virtual tmp<labelField> internalFieldTransfer
(
const Pstream::commsTypes commsType,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -997,6 +997,7 @@ void Foam::oversetMesh::calcInterpolationMap() const
...
...
...
)
*/
// Create construct map
@ -1093,7 +1094,7 @@ void Foam::oversetMesh::calcInterpolationMap() const
const labelList::subList procDonorIDs
(
donorIDs, // Original list
nCurProcRec, // Size of the data
nCurProcRec, // Size of the received data
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
// given region
const oversetInterpolation::ListScalarFieldField& weights =
const oversetInterpolation::scalarFieldFieldList& weights =
interpolation.weights();
// Note: accF field indexed by number of acceptors (region-wise
@ -91,8 +91,7 @@ void Foam::oversetMesh::interpolate
const donorAcceptorList& curAcceptors = regions_[regionI].acceptors();
// Get weights for this region
const oversetInterpolation::ScalarFieldField& regionWeights =
weights[regionI];
const scalarFieldField& regionWeights = weights[regionI];
// Loop through all acceptors of this region
forAll (curAcceptors, regionAccI)