forwardFieldMapper: Rationalisation

The directFieldMapper has been renamed to forwardFieldMapper, and
instances where generalFieldMapper was used instead of a more simple
forward/direct type have been removed.
This commit is contained in:
Will Bainbridge
2023-11-14 10:19:00 +00:00
parent fbc3a122c5
commit 79ab17131e
13 changed files with 84 additions and 152 deletions

View File

@ -58,7 +58,7 @@ Foam::fvFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
)
:
labelList(mag(addressing) - 1),
directFieldMapper(static_cast<const labelList&>(*this))
forwardFieldMapper(static_cast<const labelList&>(*this))
{}

View File

@ -40,7 +40,7 @@ SourceFiles
#include "IOobjectList.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "directFieldMapper.H"
#include "forwardFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -63,7 +63,7 @@ public:
class patchFieldDecomposer
:
public labelList,
public directFieldMapper
public forwardFieldMapper
{
public:

View File

@ -26,51 +26,59 @@ License
#include "pointFieldDecomposer.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
Foam::labelList Foam::pointFieldDecomposer::patchFieldDecomposer::addressing
(
const pointPatch& completeMeshPatch,
const pointPatch& procMeshPatch,
const labelList& directAddr
const pointPatch& completePatch,
const pointPatch& procPatch,
const labelList& pointProcAddressing
)
:
generalFieldMapper(),
directAddressing_(procMeshPatch.size(), -1),
hasUnmapped_(false)
{
// Create the inverse-addressing of the patch point labels.
labelList pointMap(completeMeshPatch.boundaryMesh().mesh().size(), -1);
const labelList& completePatchPoints = completePatch.meshPoints();
const labelList& procPatchPoints = procPatch.meshPoints();
const labelList& completeMeshPatchPoints = completeMeshPatch.meshPoints();
forAll(completeMeshPatchPoints, pointi)
// Create a map from complete mesh point index to complete patch point index
labelList map(completePatch.boundaryMesh().mesh().size(), -1);
forAll(completePatchPoints, pointi)
{
pointMap[completeMeshPatchPoints[pointi]] = pointi;
map[completePatchPoints[pointi]] = pointi;
}
// Use the inverse point addressing to create the addressing table for this
// patch
const labelList& procMeshPatchPoints = procMeshPatch.meshPoints();
forAll(procMeshPatchPoints, pointi)
// Determine the complete patch point for every proc patch point, going via
// the complete mesh point index and using the above map
labelList result(procPatch.size(), -1);
forAll(procPatchPoints, pointi)
{
directAddressing_[pointi] =
pointMap[directAddr[procMeshPatchPoints[pointi]]];
result[pointi] = map[pointProcAddressing[procPatchPoints[pointi]]];
}
// Check that all the patch point addresses are set
if (directAddressing_.size() && min(directAddressing_) < 0)
if (result.size() && min(result) < 0)
{
hasUnmapped_ = true;
FatalErrorInFunction
<< "Incomplete patch point addressing"
<< abort(FatalError);
}
return result;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
(
const pointPatch& completePatch,
const pointPatch& procPatch,
const labelList& pointProcAddressing
)
:
labelList(addressing(completePatch, procPatch, pointProcAddressing)),
forwardFieldMapper(static_cast<const labelList&>(*this))
{}
Foam::pointFieldDecomposer::pointFieldDecomposer
(
const pointMesh& completeMesh,

View File

@ -38,7 +38,7 @@ SourceFiles
#include "pointMesh.H"
#include "pointFields.H"
#include "generalFieldMapper.H"
#include "forwardFieldMapper.H"
#include "IOobjectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -61,51 +61,31 @@ public:
//- Point patch field decomposer class
class patchFieldDecomposer
:
public generalFieldMapper
public labelList,
public forwardFieldMapper
{
// Private Data
// Private Member Functions
//- ...
labelList directAddressing_;
//- Does map contain any unmapped values?
bool hasUnmapped_;
//- Generate the addressing
static labelList addressing
(
const pointPatch& completePatch,
const pointPatch& procPatch,
const labelList& pointProcAddressing
);
public:
// Constructors
//- Construct given addressing
//- Construct given patches and addressing
patchFieldDecomposer
(
const pointPatch& completeMeshPatch,
const pointPatch& procMeshPatch,
const labelList& directAddr
const pointPatch& completePatch,
const pointPatch& procPatch,
const labelList& pointProcAddressing
);
// Member Functions
label size() const
{
return directAddressing_.size();
}
bool direct() const
{
return true;
}
bool hasUnmapped() const
{
return hasUnmapped_;
}
const labelUList& directAddressing() const
{
return directAddressing_;
}
};