ENH: collect and cleanup decompose and reconstruct methods (#2084)

- new faDecompose and faReconstruct libraries

- provide common readFields in the faDecompose library
This commit is contained in:
Mark Olesen
2021-05-05 10:52:15 +02:00
parent 830a217353
commit 0ae17908a2
38 changed files with 661 additions and 591 deletions

View File

@ -1,4 +1,5 @@
decomposePar.C decomposePar.C
domainDecomposition.C domainDecomposition.C
domainDecompositionMesh.C domainDecompositionMesh.C
domainDecompositionDistribute.C domainDecompositionDistribute.C
@ -7,10 +8,6 @@ domainDecompositionWrite.C
domainDecompositionDryRun.C domainDecompositionDryRun.C
domainDecompositionDryRunWrite.C domainDecompositionDryRunWrite.C
dimFieldDecomposer.C
pointFieldDecomposer.C
faMeshDecomposition.C
faFieldDecomposer.C
lagrangianFieldDecomposer.C lagrangianFieldDecomposer.C
EXE = $(FOAM_APPBIN)/decomposePar EXE = $(FOAM_APPBIN)/decomposePar

View File

@ -6,7 +6,8 @@ EXE_INC = \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude -I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
-I$(LIB_SRC)/parallel/decompose/faDecompose/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteArea \ -lfiniteArea \
@ -18,5 +19,6 @@ EXE_LIBS = \
-lgenericPatchFields \ -lgenericPatchFields \
-ldecompositionMethods \ -ldecompositionMethods \
-ldecompose \ -ldecompose \
-lfaDecompose \
-L$(FOAM_LIBBIN)/dummy \ -L$(FOAM_LIBBIN)/dummy \
-lkahipDecomp -lmetisDecomp -lscotchDecomp -lkahipDecomp -lmetisDecomp -lscotchDecomp

View File

@ -162,7 +162,6 @@ Usage
#include "regionProperties.H" #include "regionProperties.H"
#include "readFields.H" #include "readFields.H"
#include "dimFieldDecomposer.H"
#include "fvFieldDecomposer.H" #include "fvFieldDecomposer.H"
#include "pointFieldDecomposer.H" #include "pointFieldDecomposer.H"
#include "lagrangianFieldDecomposer.H" #include "lagrangianFieldDecomposer.H"
@ -173,11 +172,52 @@ Usage
#include "faMeshDecomposition.H" #include "faMeshDecomposition.H"
#include "faFieldDecomposer.H" #include "faFieldDecomposer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
// Read proc addressing at specific instance.
// Uses polyMesh/fvMesh meshSubDir by default
autoPtr<labelIOList> procAddressing
(
const fvMesh& procMesh,
const word& name,
const word& instance,
const word& local = fvMesh::meshSubDir
)
{
return autoPtr<labelIOList>::New
(
IOobject
(
name,
instance,
local,
procMesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false // do not register
)
);
}
// Read proc addressing at specific instance.
// Uses the finiteArea meshSubDir
autoPtr<labelIOList> faProcAddressing
(
const fvMesh& procMesh,
const word& name,
const word& instance,
const word& local = faMesh::meshSubDir
)
{
return procAddressing(procMesh, name, instance, local);
}
// Return cached or read proc addressing from facesInstance
const labelIOList& procAddressing const labelIOList& procAddressing
( (
const PtrList<fvMesh>& procMeshList, const PtrList<fvMesh>& procMeshList,
@ -193,19 +233,7 @@ const labelIOList& procAddressing
procAddressingList.set procAddressingList.set
( (
proci, proci,
new labelIOList procAddressing(procMesh, name, procMesh.facesInstance())
(
IOobject
(
name,
procMesh.facesInstance(),
procMesh.meshSubDir,
procMesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
)
); );
} }
return procAddressingList[proci]; return procAddressingList[proci];
@ -275,7 +303,7 @@ void decomposeUniform
} }
} }
} } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -682,7 +710,6 @@ int main(int argc, char *argv[])
PtrList<labelIOList> cellProcAddressingList(mesh.nProcs()); PtrList<labelIOList> cellProcAddressingList(mesh.nProcs());
PtrList<labelIOList> boundaryProcAddressingList(mesh.nProcs()); PtrList<labelIOList> boundaryProcAddressingList(mesh.nProcs());
PtrList<fvFieldDecomposer> fieldDecomposerList(mesh.nProcs()); PtrList<fvFieldDecomposer> fieldDecomposerList(mesh.nProcs());
PtrList<dimFieldDecomposer> dimFieldDecomposerList(mesh.nProcs());
PtrList<labelIOList> pointProcAddressingList(mesh.nProcs()); PtrList<labelIOList> pointProcAddressingList(mesh.nProcs());
PtrList<pointFieldDecomposer> pointFieldDecomposerList PtrList<pointFieldDecomposer> pointFieldDecomposerList
( (
@ -1047,7 +1074,6 @@ int main(int argc, char *argv[])
{ {
Info<< "Processor " << proci << ": field transfer" << endl; Info<< "Processor " << proci << ": field transfer" << endl;
// open the database // open the database
if (!processorDbList.set(proci)) if (!processorDbList.set(proci))
{ {
@ -1112,7 +1138,7 @@ int main(int argc, char *argv[])
); );
// FV fields // FV fields: volume, surface, internal
{ {
if (!fieldDecomposerList.set(proci)) if (!fieldDecomposerList.set(proci))
{ {
@ -1132,6 +1158,7 @@ int main(int argc, char *argv[])
const fvFieldDecomposer& fieldDecomposer = const fvFieldDecomposer& fieldDecomposer =
fieldDecomposerList[proci]; fieldDecomposerList[proci];
// vol fields
fieldDecomposer.decomposeFields(volScalarFields); fieldDecomposer.decomposeFields(volScalarFields);
fieldDecomposer.decomposeFields(volVectorFields); fieldDecomposer.decomposeFields(volVectorFields);
fieldDecomposer.decomposeFields fieldDecomposer.decomposeFields
@ -1141,6 +1168,7 @@ int main(int argc, char *argv[])
fieldDecomposer.decomposeFields(volSymmTensorFields); fieldDecomposer.decomposeFields(volSymmTensorFields);
fieldDecomposer.decomposeFields(volTensorFields); fieldDecomposer.decomposeFields(volTensorFields);
// surface fields
fieldDecomposer.decomposeFields(surfaceScalarFields); fieldDecomposer.decomposeFields(surfaceScalarFields);
fieldDecomposer.decomposeFields(surfaceVectorFields); fieldDecomposer.decomposeFields(surfaceVectorFields);
fieldDecomposer.decomposeFields fieldDecomposer.decomposeFields
@ -1153,6 +1181,13 @@ int main(int argc, char *argv[])
); );
fieldDecomposer.decomposeFields(surfaceTensorFields); fieldDecomposer.decomposeFields(surfaceTensorFields);
// internal fields
fieldDecomposer.decomposeFields(dimScalarFields);
fieldDecomposer.decomposeFields(dimVectorFields);
fieldDecomposer.decomposeFields(dimSphericalTensorFields);
fieldDecomposer.decomposeFields(dimSymmTensorFields);
fieldDecomposer.decomposeFields(dimTensorFields);
if (times.size() == 1) if (times.size() == 1)
{ {
// Clear cached decomposer // Clear cached decomposer
@ -1160,37 +1195,6 @@ int main(int argc, char *argv[])
} }
} }
// Dimensioned fields
{
if (!dimFieldDecomposerList.set(proci))
{
dimFieldDecomposerList.set
(
proci,
new dimFieldDecomposer
(
mesh,
procMesh,
faceProcAddressing,
cellProcAddressing
)
);
}
const dimFieldDecomposer& dimDecomposer =
dimFieldDecomposerList[proci];
dimDecomposer.decomposeFields(dimScalarFields);
dimDecomposer.decomposeFields(dimVectorFields);
dimDecomposer.decomposeFields(dimSphericalTensorFields);
dimDecomposer.decomposeFields(dimSymmTensorFields);
dimDecomposer.decomposeFields(dimTensorFields);
if (times.size() == 1)
{
dimFieldDecomposerList.set(proci, nullptr);
}
}
// Point fields // Point fields
if if
@ -1366,18 +1370,24 @@ int main(int argc, char *argv[])
faMesh::meshSubDir, faMesh::meshSubDir,
mesh, mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE IOobject::NO_WRITE,
false // not registered
); );
if (faMeshBoundaryIOobj.typeHeaderOk<faBoundaryMesh>(true)) if (faMeshBoundaryIOobj.typeHeaderOk<faBoundaryMesh>(true))
{ {
Info << "\nFinite area mesh decomposition" << endl; Info<< "\nFinite area mesh decomposition" << endl;
faMeshDecomposition aMesh(mesh); // Always based on the volume decomposition!
faMeshDecomposition aMesh
(
mesh,
mesh.nProcs(),
mesh.model()
);
aMesh.decomposeMesh(); aMesh.decomposeMesh();
aMesh.writeDecomposition(); aMesh.writeDecomposition();
@ -1404,13 +1414,29 @@ int main(int argc, char *argv[])
PtrList<edgeScalarField> edgeScalarFields; PtrList<edgeScalarField> edgeScalarFields;
readFields(aMesh, objects, edgeScalarFields); readFields(aMesh, objects, edgeScalarFields);
Info << endl; const label nAreaFields =
(
areaScalarFields.size()
+ areaVectorFields.size()
+ areaSphericalTensorFields.size()
+ areaSymmTensorFields.size()
+ areaTensorFields.size()
+ edgeScalarFields.size()
);
Info<< endl;
Info<< "Finite area field transfer: "
<< nAreaFields << " fields" << endl;
// Split the fields over processors // Split the fields over processors
for (label procI = 0; procI < mesh.nProcs(); procI++) for
(
label proci = 0;
nAreaFields && proci < mesh.nProcs();
++proci
)
{ {
Info<< "Processor " << procI Info<< " Processor " << proci << endl;
<< ": finite area field transfer" << endl;
// open the database // open the database
Time processorDb Time processorDb
@ -1418,7 +1444,7 @@ int main(int argc, char *argv[])
Time::controlDictName, Time::controlDictName,
args.rootPath(), args.rootPath(),
args.caseName() args.caseName()
/ ("processor" + Foam::name(procI)) / ("processor" + Foam::name(proci))
); );
processorDb.setTime(runTime); processorDb.setTime(runTime);
@ -1441,7 +1467,7 @@ int main(int argc, char *argv[])
// procAddressing // procAddressing
// ( // (
// procMeshList, // procMeshList,
// procI, // proci,
// "faceProcAddressing", // "faceProcAddressing",
// faceProcAddressingList // faceProcAddressingList
// ); // );
@ -1450,60 +1476,39 @@ int main(int argc, char *argv[])
// procAddressing // procAddressing
// ( // (
// procMeshList, // procMeshList,
// procI, // proci,
// "boundaryProcAddressing", // "boundaryProcAddressing",
// boundaryProcAddressingList // boundaryProcAddressingList
// ); // );
labelIOList faceProcAddressing // Addressing from faMesh (not polyMesh) meshSubDir
(
IOobject autoPtr<labelIOList> tfaceProcAddr =
faProcAddressing
( (
procFvMesh,
"faceProcAddressing", "faceProcAddressing",
"constant", runTime.constant()
procMesh.meshSubDir,
procFvMesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
); );
auto& faceProcAddressing = *tfaceProcAddr;
labelIOList boundaryProcAddressing autoPtr<labelIOList> tboundaryProcAddr =
( faProcAddressing
IOobject
( (
procFvMesh,
"boundaryProcAddressing", "boundaryProcAddressing",
"constant", runTime.constant()
procMesh.meshSubDir,
procFvMesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
); );
auto& boundaryProcAddressing = *tboundaryProcAddr;
// FA fields autoPtr<labelIOList> tedgeProcAddr =
if faProcAddressing
( (
areaScalarFields.size()
|| areaVectorFields.size()
|| areaSphericalTensorFields.size()
|| areaSymmTensorFields.size()
|| areaTensorFields.size()
|| edgeScalarFields.size()
)
{
labelIOList edgeProcAddressing
(
IOobject
(
"edgeProcAddressing",
"constant",
procMesh.meshSubDir,
procFvMesh, procFvMesh,
IOobject::MUST_READ, "edgeProcAddressing",
IOobject::NO_WRITE runTime.constant()
)
); );
const auto& edgeProcAddressing = *tedgeProcAddr;
faFieldDecomposer fieldDecomposer faFieldDecomposer fieldDecomposer
( (
@ -1520,10 +1525,7 @@ int main(int argc, char *argv[])
( (
areaSphericalTensorFields areaSphericalTensorFields
); );
fieldDecomposer.decomposeFields fieldDecomposer.decomposeFields(areaSymmTensorFields);
(
areaSymmTensorFields
);
fieldDecomposer.decomposeFields(areaTensorFields); fieldDecomposer.decomposeFields(areaTensorFields);
fieldDecomposer.decomposeFields(edgeScalarFields); fieldDecomposer.decomposeFields(edgeScalarFields);
@ -1532,7 +1534,6 @@ int main(int argc, char *argv[])
} }
} }
} }
}
Info<< "\nEnd\n" << endl; Info<< "\nEnd\n" << endl;

View File

@ -120,16 +120,27 @@ Foam::domainDecomposition::domainDecomposition
procProcessorPatchSubPatchIDs_(nProcs_), procProcessorPatchSubPatchIDs_(nProcs_),
procProcessorPatchSubPatchStarts_(nProcs_) procProcessorPatchSubPatchStarts_(nProcs_)
{ {
decompositionModel::New updateParameters(this->model());
(
*this,
decompDictFile
).readIfPresent("distributed", distributed_);
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::decompositionModel& Foam::domainDecomposition::model() const
{
return decompositionModel::New(*this, decompDictFile_);
}
void Foam::domainDecomposition::updateParameters
(
const dictionary& params
)
{
params.readIfPresent("distributed", distributed_);
}
bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
{ {
Info<< "\nConstructing processor meshes" << endl; Info<< "\nConstructing processor meshes" << endl;
@ -408,10 +419,9 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
nInterProcPatches += curSubPatchIDs[procPatchi].size(); nInterProcPatches += curSubPatchIDs[procPatchi].size();
} }
List<polyPatch*> procPatches PtrList<polyPatch> procPatches
( (
curPatchSizes.size() + nInterProcPatches, curPatchSizes.size() + nInterProcPatches
reinterpret_cast<polyPatch*>(0)
); );
label nPatches = 0; label nPatches = 0;
@ -434,13 +444,17 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
); );
// Map existing patches // Map existing patches
procPatches[nPatches] = meshPatch.clone procPatches.set
(
nPatches,
meshPatch.clone
( (
procMesh.boundaryMesh(), procMesh.boundaryMesh(),
nPatches, nPatches,
patchMapper.directAddressing(), patchMapper.directAddressing(),
curPatchStarts[patchi] curPatchStarts[patchi]
).ptr(); )
);
nPatches++; nPatches++;
} }
@ -464,7 +478,9 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
if (subPatchID[i] == -1) if (subPatchID[i] == -1)
{ {
// From internal faces // From internal faces
procPatches[nPatches] = procPatches.set
(
nPatches,
new processorPolyPatch new processorPolyPatch
( (
size, size,
@ -473,6 +489,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
procMesh.boundaryMesh(), procMesh.boundaryMesh(),
proci, proci,
curNeighbourProcessors[procPatchi] curNeighbourProcessors[procPatchi]
)
); );
} }
else else
@ -483,7 +500,9 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
boundaryMesh()[subPatchID[i]] boundaryMesh()[subPatchID[i]]
); );
procPatches[nPatches] = procPatches.set
(
nPatches,
new processorCyclicPolyPatch new processorCyclicPolyPatch
( (
size, size,
@ -494,12 +513,12 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
curNeighbourProcessors[procPatchi], curNeighbourProcessors[procPatchi],
pcPatch.name(), pcPatch.name(),
pcPatch.transform() pcPatch.transform()
)
); );
} }
curStart += size; curStart += size;
++nPatches;
nPatches++;
} }
} }

View File

@ -26,12 +26,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "domainDecomposition.H" #include "domainDecomposition.H"
#include "decompositionMethod.H"
#include "cpuTime.H" #include "cpuTime.H"
#include "cellSet.H" #include "decompositionMethod.H"
#include "regionSplit.H"
#include "Tuple2.H"
#include "faceSet.H"
#include "decompositionModel.H" #include "decompositionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -31,7 +31,7 @@ Description
SourceFiles SourceFiles
lagrangianFieldDecomposer.C lagrangianFieldDecomposer.C
lagrangianFieldDecomposerDecomposeFields.C lagrangianFieldDecomposerFields.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -84,7 +84,7 @@ public:
//- Construct from components //- Construct from components
lagrangianFieldDecomposer lagrangianFieldDecomposer
( (
const polyMesh& mesh, const polyMesh& mesh, //<! unused
const polyMesh& procMesh, const polyMesh& procMesh,
const labelList& faceProcAddressing, const labelList& faceProcAddressing,
const labelList& cellProcAddressing, const labelList& cellProcAddressing,
@ -156,7 +156,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
#include "lagrangianFieldDecomposerDecomposeFields.C" #include "lagrangianFieldDecomposerFields.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -42,7 +42,7 @@ void Foam::readFields
typedef GeometricField<Type, PatchField, GeoMesh> GeoField; typedef GeometricField<Type, PatchField, GeoMesh> GeoField;
// Search list of objects for fields of type GeoField // Search list of objects for fields of type GeoField
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName)); IOobjectList fieldObjects(objects.lookupClass<GeoField>());
// Remove the cellDist field // Remove the cellDist field
auto iter = fieldObjects.find("cellDist"); auto iter = fieldObjects.find("cellDist");
@ -51,12 +51,12 @@ void Foam::readFields
fieldObjects.erase(iter); fieldObjects.erase(iter);
} }
// Get sorted set of names (different processors might read objects in // Use sorted set of names
// different order) // (different processors might read objects in different order)
const wordList masterNames(fieldObjects.sortedNames()); const wordList masterNames(fieldObjects.sortedNames());
// Construct the fields // Construct the fields
fields.setSize(masterNames.size()); fields.resize(masterNames.size());
forAll(masterNames, i) forAll(masterNames, i)
{ {
@ -76,17 +76,14 @@ void Foam::readFields
) )
{ {
// Search list of objects for fields of type GeomField // Search list of objects for fields of type GeomField
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName)); IOobjectList fieldObjects(objects.lookupClass<GeoField>());
// Construct the fields // Use sorted set of names
fields.setSize(fieldObjects.size()); // (different processors might read objects in different order)
// Get sorted set of names (different processors might read objects in
// different order)
const wordList masterNames(fieldObjects.sortedNames()); const wordList masterNames(fieldObjects.sortedNames());
// Construct the fields // Construct the fields
fields.setSize(masterNames.size()); fields.resize(masterNames.size());
forAll(masterNames, i) forAll(masterNames, i)
{ {

View File

@ -1,5 +1,3 @@
processorFaMeshes.C
faFieldReconstructor.C
reconstructPar.C reconstructPar.C
EXE = $(FOAM_APPBIN)/reconstructPar EXE = $(FOAM_APPBIN)/reconstructPar

View File

@ -4,7 +4,8 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude -I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/faReconstruct/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteArea \ -lfiniteArea \
@ -13,4 +14,5 @@ EXE_LIBS = \
-llagrangian \ -llagrangian \
-lgenericPatchFields \ -lgenericPatchFields \
-ldynamicMesh \ -ldynamicMesh \
-lreconstruct -lreconstruct \
-lfaReconstruct

View File

@ -8,6 +8,7 @@ wclean kahipDecomp
wclean scotchDecomp wclean scotchDecomp
wclean decompositionMethods wclean decompositionMethods
wclean decompose wclean decompose
wclean faDecompose
./Allwclean-mpi ./Allwclean-mpi

View File

@ -12,6 +12,7 @@ export FOAM_EXT_LIBBIN
wmake $targetType decompositionMethods wmake $targetType decompositionMethods
wmake $targetType decompose wmake $targetType decompose
wmake $targetType faDecompose
if have_kahip if have_kahip
then then

View File

@ -1,5 +1,8 @@
decompositionInformation.C decompositionInformation.C
decompositionModel.C decompositionModel.C
dimFieldDecomposer.C
fvFieldDecomposer.C fvFieldDecomposer.C
pointFieldDecomposer.C
LIB = $(FOAM_LIBBIN)/libdecompose LIB = $(FOAM_LIBBIN)/libdecompose

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,9 +28,19 @@ License
#include "dimFieldDecomposer.H" #include "dimFieldDecomposer.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dimFieldDecomposer::dimFieldDecomposer
(
const fvMesh& procMesh,
const labelList& cellAddressing
)
:
procMesh_(procMesh),
cellAddressing_(cellAddressing)
{}
Foam::dimFieldDecomposer::dimFieldDecomposer Foam::dimFieldDecomposer::dimFieldDecomposer
( (
const fvMesh& completeMesh, const fvMesh& completeMesh,
@ -38,17 +49,11 @@ Foam::dimFieldDecomposer::dimFieldDecomposer
const labelList& cellAddressing const labelList& cellAddressing
) )
: :
completeMesh_(completeMesh), //UNUSED: completeMesh_(completeMesh),
procMesh_(procMesh), procMesh_(procMesh),
faceAddressing_(faceAddressing), //UNUSED: faceAddressing_(faceAddressing),
cellAddressing_(cellAddressing) cellAddressing_(cellAddressing)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::dimFieldDecomposer::~dimFieldDecomposer()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,7 +32,7 @@ Description
SourceFiles SourceFiles
dimFieldDecomposer.C dimFieldDecomposer.C
dimFieldDecomposerDecomposeFields.C dimFieldDecomposerFields.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -46,32 +47,25 @@ SourceFiles
namespace Foam namespace Foam
{ {
class IOobjectList;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class fvFieldDecomposer Declaration Class fvFieldDecomposer Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class dimFieldDecomposer class dimFieldDecomposer
{ {
private: // Private Data
// Private data
//- Reference to complete mesh
const fvMesh& completeMesh_;
//- Reference to processor mesh //- Reference to processor mesh
const fvMesh& procMesh_; const fvMesh& procMesh_;
//- Reference to face addressing //- Reference to face addressing
const labelList& faceAddressing_; //UNUSED: const labelList& faceAddressing_;
//- Reference to cell addressing //- Reference to cell addressing
const labelList& cellAddressing_; const labelList& cellAddressing_;
// Private Member Functions public:
//- No copy construct //- No copy construct
dimFieldDecomposer(const dimFieldDecomposer&) = delete; dimFieldDecomposer(const dimFieldDecomposer&) = delete;
@ -80,35 +74,41 @@ private:
void operator=(const dimFieldDecomposer&) = delete; void operator=(const dimFieldDecomposer&) = delete;
public:
// Constructors // Constructors
//- Construct from components //- Construct from minimal components
dimFieldDecomposer dimFieldDecomposer
( (
const fvMesh& completeMesh,
const fvMesh& procMesh, const fvMesh& procMesh,
const labelList& faceAddressing, const labelList& cellAddressing
);
//- Construct from components with API as per fvFieldDecomposer
dimFieldDecomposer
(
const fvMesh& completeMesh, //!< unused
const fvMesh& procMesh,
const labelList& faceAddressing, //!< unused
const labelList& cellAddressing const labelList& cellAddressing
); );
//- Destructor //- Destructor
~dimFieldDecomposer(); ~dimFieldDecomposer() = default;
// Member Functions // Member Functions
//- Decompose field //- Decompose field
template<class Type> template<class Type>
tmp<DimensionedField<Type, volMesh>> decomposeField tmp<DimensionedField<Type, volMesh>>
decomposeField
( (
const DimensionedField<Type, volMesh>& field const DimensionedField<Type, volMesh>& field
) const; ) const;
//- Decompose llist of fields //- Decompose list of fields
template<class GeoField> template<class GeoField>
void decomposeFields(const PtrList<GeoField>& fields) const; void decomposeFields(const PtrList<GeoField>& fields) const;
}; };
@ -121,7 +121,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
#include "dimFieldDecomposerDecomposeFields.C" #include "dimFieldDecomposerFields.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -40,9 +41,8 @@ Foam::dimFieldDecomposer::decomposeField
Field<Type> mappedField(field, cellAddressing_); Field<Type> mappedField(field, cellAddressing_);
// Create the field for the processor // Create the field for the processor
return tmp<DimensionedField<Type, volMesh>> return
( tmp<DimensionedField<Type, volMesh>>::New
new DimensionedField<Type, volMesh>
( (
IOobject IOobject
( (
@ -55,8 +55,7 @@ Foam::dimFieldDecomposer::decomposeField
), ),
procMesh_, procMesh_,
field.dimensions(), field.dimensions(),
mappedField std::move(mappedField)
)
); );
} }

View File

@ -27,7 +27,6 @@ License
#include "fvFieldDecomposer.H" #include "fvFieldDecomposer.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fvFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer Foam::fvFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
@ -135,11 +134,12 @@ Foam::fvFieldDecomposer::fvFieldDecomposer
{ {
forAll(boundaryAddressing_, patchi) forAll(boundaryAddressing_, patchi)
{ {
const label oldPatchi = boundaryAddressing_[patchi];
const fvPatch& fvp = procMesh_.boundary()[patchi]; const fvPatch& fvp = procMesh_.boundary()[patchi];
if if
( (
boundaryAddressing_[patchi] >= 0 oldPatchi >= 0
&& !isA<processorLduInterface>(procMesh.boundary()[patchi]) && !isA<processorLduInterface>(procMesh.boundary()[patchi])
) )
{ {
@ -149,10 +149,7 @@ Foam::fvFieldDecomposer::fvFieldDecomposer
new patchFieldDecomposer new patchFieldDecomposer
( (
fvp.patchSlice(faceAddressing_), fvp.patchSlice(faceAddressing_),
completeMesh_.boundaryMesh() completeMesh_.boundaryMesh()[oldPatchi].start()
[
boundaryAddressing_[patchi]
].start()
) )
); );
} }
@ -202,10 +199,4 @@ Foam::fvFieldDecomposer::fvFieldDecomposer
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fvFieldDecomposer::~fvFieldDecomposer()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,7 +32,7 @@ Description
SourceFiles SourceFiles
fvFieldDecomposer.C fvFieldDecomposer.C
fvFieldDecomposerDecomposeFields.C fvFieldDecomposerFields.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -47,8 +48,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
class IOobjectList;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class fvFieldDecomposer Declaration Class fvFieldDecomposer Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -62,7 +61,7 @@ public:
: :
public fvPatchFieldMapper public fvPatchFieldMapper
{ {
// Private data // Private Data
labelList directAddressing_; labelList directAddressing_;
@ -78,7 +77,7 @@ public:
); );
// Member functions // Member Functions
label size() const label size() const
{ {
@ -110,7 +109,7 @@ public:
: :
public fvPatchFieldMapper public fvPatchFieldMapper
{ {
// Private data // Private Data
labelList directAddressing_; labelList directAddressing_;
@ -124,7 +123,7 @@ public:
); );
// Member functions // Member Functions
label size() const label size() const
{ {
@ -199,7 +198,7 @@ public:
private: private:
// Private data // Private Data
//- Reference to complete mesh //- Reference to complete mesh
const fvMesh& completeMesh_; const fvMesh& completeMesh_;
@ -225,11 +224,10 @@ private:
PtrList<processorSurfacePatchFieldDecomposer> PtrList<processorSurfacePatchFieldDecomposer>
processorSurfacePatchFieldDecomposerPtrs_; processorSurfacePatchFieldDecomposerPtrs_;
PtrList<scalarField> faceSign_; PtrList<scalarField> faceSign_;
// Private Member Functions public:
//- No copy construct //- No copy construct
fvFieldDecomposer(const fvFieldDecomposer&) = delete; fvFieldDecomposer(const fvFieldDecomposer&) = delete;
@ -238,8 +236,6 @@ private:
void operator=(const fvFieldDecomposer&) = delete; void operator=(const fvFieldDecomposer&) = delete;
public:
// Constructors // Constructors
//- Construct from components //- Construct from components
@ -254,11 +250,19 @@ public:
//- Destructor //- Destructor
~fvFieldDecomposer(); ~fvFieldDecomposer() = default;
// Member Functions // Member Functions
//- Decompose internal field
template<class Type>
tmp<DimensionedField<Type, volMesh>>
decomposeField
(
const DimensionedField<Type, volMesh>& field
) const;
//- Decompose volume field //- Decompose volume field
template<class Type> template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> tmp<GeometricField<Type, fvPatchField, volMesh>>
@ -276,6 +280,7 @@ public:
const GeometricField<Type, fvsPatchField, surfaceMesh>& field const GeometricField<Type, fvsPatchField, surfaceMesh>& field
) const; ) const;
//- Decompose list of fields
template<class GeoField> template<class GeoField>
void decomposeFields(const PtrList<GeoField>& fields) const; void decomposeFields(const PtrList<GeoField>& fields) const;
}; };
@ -288,7 +293,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
#include "fvFieldDecomposerDecomposeFields.C" #include "fvFieldDecomposerFields.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,6 +35,36 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh>>
Foam::fvFieldDecomposer::decomposeField
(
const DimensionedField<Type, volMesh>& field
) const
{
// Create and map the internal field values
Field<Type> mappedField(field, cellAddressing_);
// Create the field for the processor
return
tmp<DimensionedField<Type, volMesh>>::New
(
IOobject
(
field.name(),
procMesh_.time().timeName(),
procMesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
procMesh_,
field.dimensions(),
std::move(mappedField)
);
}
template<class Type> template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::fvFieldDecomposer::decomposeField Foam::fvFieldDecomposer::decomposeField

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -88,41 +89,28 @@ Foam::pointFieldDecomposer::pointFieldDecomposer
procMesh_(procMesh), procMesh_(procMesh),
pointAddressing_(pointAddressing), pointAddressing_(pointAddressing),
boundaryAddressing_(boundaryAddressing), boundaryAddressing_(boundaryAddressing),
patchFieldDecomposerPtrs_
( patchFieldDecomposerPtrs_(procMesh_.boundary().size())
procMesh_.boundary().size(),
static_cast<patchFieldDecomposer*>(nullptr)
)
{ {
forAll(boundaryAddressing_, patchi) forAll(boundaryAddressing_, patchi)
{ {
if (boundaryAddressing_[patchi] >= 0) const label oldPatchi = boundaryAddressing_[patchi];
if (oldPatchi >= 0)
{ {
patchFieldDecomposerPtrs_[patchi] = new patchFieldDecomposer patchFieldDecomposerPtrs_.set
( (
completeMesh_.boundary()[boundaryAddressing_[patchi]], patchi,
new patchFieldDecomposer
(
completeMesh_.boundary()[oldPatchi],
procMesh_.boundary()[patchi], procMesh_.boundary()[patchi],
pointAddressing_ pointAddressing_
)
); );
} }
} }
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::pointFieldDecomposer::~pointFieldDecomposer()
{
forAll(patchFieldDecomposerPtrs_, patchi)
{
if (patchFieldDecomposerPtrs_[patchi])
{
delete patchFieldDecomposerPtrs_[patchi];
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,7 +32,7 @@ Description
SourceFiles SourceFiles
pointFieldDecomposer.C pointFieldDecomposer.C
pointFieldDecomposerDecomposeFields.C pointFieldDecomposerFields.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -53,7 +54,6 @@ namespace Foam
class pointFieldDecomposer class pointFieldDecomposer
{ {
public: public:
//- Point patch field decomposer class //- Point patch field decomposer class
@ -107,7 +107,7 @@ public:
private: private:
// Private data // Private Data
//- Reference to complete mesh //- Reference to complete mesh
const pointMesh& completeMesh_; const pointMesh& completeMesh_;
@ -122,10 +122,10 @@ private:
const labelList& boundaryAddressing_; const labelList& boundaryAddressing_;
//- List of patch field decomposers //- List of patch field decomposers
List<patchFieldDecomposer*> patchFieldDecomposerPtrs_; PtrList<patchFieldDecomposer> patchFieldDecomposerPtrs_;
// Private Member Functions public:
//- No copy construct //- No copy construct
pointFieldDecomposer(const pointFieldDecomposer&) = delete; pointFieldDecomposer(const pointFieldDecomposer&) = delete;
@ -134,8 +134,6 @@ private:
void operator=(const pointFieldDecomposer&) = delete; void operator=(const pointFieldDecomposer&) = delete;
public:
// Constructors // Constructors
//- Construct from components //- Construct from components
@ -149,7 +147,7 @@ public:
//- Destructor //- Destructor
~pointFieldDecomposer(); ~pointFieldDecomposer() = default;
// Member Functions // Member Functions
@ -174,7 +172,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
#include "pointFieldDecomposerDecomposeFields.C" #include "pointFieldDecomposerFields.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -46,7 +47,7 @@ Foam::pointFieldDecomposer::decomposeField
// Create and map the patch field values // Create and map the patch field values
forAll(boundaryAddressing_, patchi) forAll(boundaryAddressing_, patchi)
{ {
if (patchFieldDecomposerPtrs_[patchi]) if (patchFieldDecomposerPtrs_.set(patchi))
{ {
patchFields.set patchFields.set
( (
@ -56,7 +57,7 @@ Foam::pointFieldDecomposer::decomposeField
field.boundaryField()[boundaryAddressing_[patchi]], field.boundaryField()[boundaryAddressing_[patchi]],
procMesh_.boundary()[patchi], procMesh_.boundary()[patchi],
DimensionedField<Type, pointMesh>::null(), DimensionedField<Type, pointMesh>::null(),
*patchFieldDecomposerPtrs_[patchi] patchFieldDecomposerPtrs_[patchi]
) )
); );
} }
@ -75,9 +76,8 @@ Foam::pointFieldDecomposer::decomposeField
} }
// Create the field for the processor // Create the field for the processor
return tmp<GeometricField<Type, pointPatchField, pointMesh>> return
( tmp<GeometricField<Type, pointPatchField, pointMesh>>::New
new GeometricField<Type, pointPatchField, pointMesh>
( (
IOobject IOobject
( (
@ -92,7 +92,6 @@ Foam::pointFieldDecomposer::decomposeField
field.dimensions(), field.dimensions(),
internalField, internalField,
patchFields patchFields
)
); );
} }

View File

@ -0,0 +1,4 @@
faFieldDecomposer.C
faMeshDecomposition.C
LIB = $(FOAM_LIBBIN)/libfaDecompose

View File

@ -0,0 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
LIB_LIBS = \
-lfiniteVolume \
-lfiniteArea \
-lmeshTools

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,14 +28,9 @@ License
#include "faFieldDecomposer.H" #include "faFieldDecomposer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
faFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer Foam::faFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
( (
const label sizeBeforeMapping, const label sizeBeforeMapping,
const labelUList& addressingSlice, const labelUList& addressingSlice,
@ -54,7 +50,7 @@ faFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
} }
faFieldDecomposer::processorAreaPatchFieldDecomposer:: Foam::faFieldDecomposer::processorAreaPatchFieldDecomposer::
processorAreaPatchFieldDecomposer processorAreaPatchFieldDecomposer
( (
const faMesh& mesh, const faMesh& mesh,
@ -108,7 +104,7 @@ processorAreaPatchFieldDecomposer
} }
faFieldDecomposer::processorEdgePatchFieldDecomposer:: Foam::faFieldDecomposer::processorEdgePatchFieldDecomposer::
processorEdgePatchFieldDecomposer processorEdgePatchFieldDecomposer
( (
label sizeBeforeMapping, label sizeBeforeMapping,
@ -130,7 +126,7 @@ processorEdgePatchFieldDecomposer
} }
faFieldDecomposer::faFieldDecomposer Foam::faFieldDecomposer::faFieldDecomposer
( (
const faMesh& completeMesh, const faMesh& completeMesh,
const faMesh& procMesh, const faMesh& procMesh,
@ -144,47 +140,43 @@ faFieldDecomposer::faFieldDecomposer
edgeAddressing_(edgeAddressing), edgeAddressing_(edgeAddressing),
faceAddressing_(faceAddressing), faceAddressing_(faceAddressing),
boundaryAddressing_(boundaryAddressing), boundaryAddressing_(boundaryAddressing),
patchFieldDecomposerPtrs_
( patchFieldDecomposerPtrs_(procMesh_.boundary().size()),
procMesh_.boundary().size(), processorAreaPatchFieldDecomposerPtrs_(procMesh_.boundary().size()),
static_cast<patchFieldDecomposer*>(NULL) processorEdgePatchFieldDecomposerPtrs_(procMesh_.boundary().size())
),
processorAreaPatchFieldDecomposerPtrs_
(
procMesh_.boundary().size(),
static_cast<processorAreaPatchFieldDecomposer*>(NULL)
),
processorEdgePatchFieldDecomposerPtrs_
(
procMesh_.boundary().size(),
static_cast<processorEdgePatchFieldDecomposer*>(NULL)
)
{ {
forAll(boundaryAddressing_, patchi) forAll(boundaryAddressing_, patchi)
{ {
if (boundaryAddressing_[patchi] >= 0) const label oldPatchi = boundaryAddressing_[patchi];
if (oldPatchi >= 0)
{ {
patchFieldDecomposerPtrs_[patchi] = new patchFieldDecomposer patchFieldDecomposerPtrs_.set
( (
completeMesh_.boundary()[boundaryAddressing_[patchi]].size(), patchi,
new patchFieldDecomposer
(
completeMesh_.boundary()[oldPatchi].size(),
procMesh_.boundary()[patchi].patchSlice(edgeAddressing_), procMesh_.boundary()[patchi].patchSlice(edgeAddressing_),
// completeMesh_.boundaryMesh() completeMesh_.boundary()[oldPatchi].start()
completeMesh_.boundary() )
[
boundaryAddressing_[patchi]
].start()
); );
} }
else else
{ {
processorAreaPatchFieldDecomposerPtrs_[patchi] = processorAreaPatchFieldDecomposerPtrs_.set
(
patchi,
new processorAreaPatchFieldDecomposer new processorAreaPatchFieldDecomposer
( (
completeMesh_, completeMesh_,
procMesh_.boundary()[patchi].patchSlice(edgeAddressing_) procMesh_.boundary()[patchi].patchSlice(edgeAddressing_)
)
); );
processorEdgePatchFieldDecomposerPtrs_[patchi] = processorEdgePatchFieldDecomposerPtrs_.set
(
patchi,
new processorEdgePatchFieldDecomposer new processorEdgePatchFieldDecomposer
( (
procMesh_.boundary()[patchi].size(), procMesh_.boundary()[patchi].size(),
@ -195,44 +187,11 @@ faFieldDecomposer::faFieldDecomposer
edgeAddressing_ edgeAddressing_
) )
) )
)
); );
} }
} }
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
faFieldDecomposer::~faFieldDecomposer()
{
forAll(patchFieldDecomposerPtrs_, patchi)
{
if (patchFieldDecomposerPtrs_[patchi])
{
delete patchFieldDecomposerPtrs_[patchi];
}
}
forAll(processorAreaPatchFieldDecomposerPtrs_, patchi)
{
if (processorAreaPatchFieldDecomposerPtrs_[patchi])
{
delete processorAreaPatchFieldDecomposerPtrs_[patchi];
}
}
forAll(processorEdgePatchFieldDecomposerPtrs_, patchi)
{
if (processorEdgePatchFieldDecomposerPtrs_[patchi])
{
delete processorEdgePatchFieldDecomposerPtrs_[patchi];
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -35,7 +36,7 @@ Author
SourceFiles SourceFiles
faFieldDecomposer.C faFieldDecomposer.C
faFieldDecomposerDecomposeFields.C faFieldDecomposerFields.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -51,6 +52,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class IOobjectList; class IOobjectList;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -66,7 +68,7 @@ public:
: :
public faPatchFieldMapper public faPatchFieldMapper
{ {
// Private data // Private Data
label sizeBeforeMapping_; label sizeBeforeMapping_;
labelList directAddressing_; labelList directAddressing_;
@ -241,12 +243,12 @@ private:
const labelList& boundaryAddressing_; const labelList& boundaryAddressing_;
//- List of patch field decomposers //- List of patch field decomposers
List<patchFieldDecomposer*> patchFieldDecomposerPtrs_; PtrList<patchFieldDecomposer> patchFieldDecomposerPtrs_;
List<processorAreaPatchFieldDecomposer*> PtrList<processorAreaPatchFieldDecomposer>
processorAreaPatchFieldDecomposerPtrs_; processorAreaPatchFieldDecomposerPtrs_;
List<processorEdgePatchFieldDecomposer*> PtrList<processorEdgePatchFieldDecomposer>
processorEdgePatchFieldDecomposerPtrs_; processorEdgePatchFieldDecomposerPtrs_;
@ -275,8 +277,7 @@ public:
// Destructor // Destructor
~faFieldDecomposer() = default;
~faFieldDecomposer();
// Member Functions // Member Functions
@ -299,6 +300,33 @@ public:
template<class GeoField> template<class GeoField>
void decomposeFields(const PtrList<GeoField>& fields) const; void decomposeFields(const PtrList<GeoField>& fields) const;
// Reading helpers
//- Read the fields and hold on the pointer list
template
<
class Type,
template<class> class PatchField,
class GeoMesh
>
static void readFields
(
const typename GeoMesh::Mesh& mesh,
const IOobjectList& objects,
PtrList<GeometricField<Type, PatchField, GeoMesh>>& fields,
const bool readOldTime
);
//- Read fields and hold on the pointer list
template<class Mesh, class GeoField>
static void readFields
(
const Mesh& mesh,
const IOobjectList& objects,
PtrList<GeoField>& fields
);
}; };
@ -309,7 +337,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "faFieldDecomposerDecomposeFields.C" #include "faFieldDecomposerFields.C"
#include "faFieldDecomposerReadFields.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,16 +30,11 @@ License
#include "processorFaPatchField.H" #include "processorFaPatchField.H"
#include "processorFaePatchField.H" #include "processorFaePatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh>> Foam::tmp<Foam::GeometricField<Type, Foam::faPatchField, Foam::areaMesh>>
faFieldDecomposer::decomposeField Foam::faFieldDecomposer::decomposeField
( (
const GeometricField<Type, faPatchField, areaMesh>& field const GeometricField<Type, faPatchField, areaMesh>& field
) const ) const
@ -51,17 +47,19 @@ faFieldDecomposer::decomposeField
forAll(boundaryAddressing_, patchi) forAll(boundaryAddressing_, patchi)
{ {
if (boundaryAddressing_[patchi] >= 0) const label oldPatchi = boundaryAddressing_[patchi];
if (oldPatchi >= 0)
{ {
patchFields.set patchFields.set
( (
patchi, patchi,
faPatchField<Type>::New faPatchField<Type>::New
( (
field.boundaryField()[boundaryAddressing_[patchi]], field.boundaryField()[oldPatchi],
procMesh_.boundary()[patchi], procMesh_.boundary()[patchi],
DimensionedField<Type, areaMesh>::null(), DimensionedField<Type, areaMesh>::null(),
*patchFieldDecomposerPtrs_[patchi] patchFieldDecomposerPtrs_[patchi]
) )
); );
} }
@ -77,7 +75,7 @@ faFieldDecomposer::decomposeField
Field<Type> Field<Type>
( (
field.internalField(), field.internalField(),
*processorAreaPatchFieldDecomposerPtrs_[patchi] processorAreaPatchFieldDecomposerPtrs_[patchi]
) )
) )
); );
@ -85,9 +83,8 @@ faFieldDecomposer::decomposeField
} }
// Create the field for the processor // Create the field for the processor
return tmp<GeometricField<Type, faPatchField, areaMesh>> return
( tmp<GeometricField<Type, faPatchField, areaMesh>>::New
new GeometricField<Type, faPatchField, areaMesh>
( (
IOobject IOobject
( (
@ -101,14 +98,13 @@ faFieldDecomposer::decomposeField
field.dimensions(), field.dimensions(),
internalField, internalField,
patchFields patchFields
)
); );
} }
template<class Type> template<class Type>
tmp<GeometricField<Type, faePatchField, edgeMesh>> Foam::tmp<Foam::GeometricField<Type, Foam::faePatchField, Foam::edgeMesh>>
faFieldDecomposer::decomposeField Foam::faFieldDecomposer::decomposeField
( (
const GeometricField<Type, faePatchField, edgeMesh>& field const GeometricField<Type, faePatchField, edgeMesh>& field
) const ) const
@ -147,7 +143,7 @@ faFieldDecomposer::decomposeField
forAll(field.boundaryField(), patchi) forAll(field.boundaryField(), patchi)
{ {
const Field<Type> & p = field.boundaryField()[patchi]; const Field<Type>& p = field.boundaryField()[patchi];
const label patchStart = field.mesh().boundary()[patchi].start(); const label patchStart = field.mesh().boundary()[patchi].start();
@ -162,17 +158,19 @@ faFieldDecomposer::decomposeField
forAll(boundaryAddressing_, patchi) forAll(boundaryAddressing_, patchi)
{ {
if (boundaryAddressing_[patchi] >= 0) const label oldPatchi = boundaryAddressing_[patchi];
if (oldPatchi >= 0)
{ {
patchFields.set patchFields.set
( (
patchi, patchi,
faePatchField<Type>::New faePatchField<Type>::New
( (
field.boundaryField()[boundaryAddressing_[patchi]], field.boundaryField()[oldPatchi],
procMesh_.boundary()[patchi], procMesh_.boundary()[patchi],
DimensionedField<Type, edgeMesh>::null(), DimensionedField<Type, edgeMesh>::null(),
*patchFieldDecomposerPtrs_[patchi] patchFieldDecomposerPtrs_[patchi]
) )
); );
} }
@ -188,7 +186,7 @@ faFieldDecomposer::decomposeField
Field<Type> Field<Type>
( (
allEdgeField, allEdgeField,
*processorEdgePatchFieldDecomposerPtrs_[patchi] processorEdgePatchFieldDecomposerPtrs_[patchi]
) )
) )
); );
@ -196,9 +194,8 @@ faFieldDecomposer::decomposeField
} }
// Create the field for the processor // Create the field for the processor
return tmp<GeometricField<Type, faePatchField, edgeMesh>> return
( tmp<GeometricField<Type, faePatchField, edgeMesh>>::New
new GeometricField<Type, faePatchField, edgeMesh>
( (
IOobject IOobject
( (
@ -212,13 +209,12 @@ faFieldDecomposer::decomposeField
field.dimensions(), field.dimensions(),
internalField, internalField,
patchFields patchFields
)
); );
} }
template<class GeoField> template<class GeoField>
void faFieldDecomposer::decomposeFields void Foam::faFieldDecomposer::decomposeFields
( (
const PtrList<GeoField>& fields const PtrList<GeoField>& fields
) const ) const
@ -230,8 +226,4 @@ void faFieldDecomposer::decomposeFields
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "faFieldDecomposer.H"
#include "GeometricField.H"
#include "IOobjectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::faFieldDecomposer::readFields
(
const typename GeoMesh::Mesh& mesh,
const IOobjectList& objects,
PtrList<GeometricField<Type, PatchField, GeoMesh>>& fields,
const bool readOldTime
)
{
typedef GeometricField<Type, PatchField, GeoMesh> GeoField;
// Search list of objects for fields of type GeoField
IOobjectList fieldObjects(objects.lookupClass<GeoField>());
/// // Remove the cellDist field
/// auto iter = fieldObjects.find("cellDist");
/// if (iter.found())
/// {
/// fieldObjects.erase(iter);
/// }
// Use sorted set of names
// (different processors might read objects in different order)
const wordList masterNames(fieldObjects.sortedNames());
// Construct the fields
fields.resize(masterNames.size());
forAll(masterNames, i)
{
const IOobject& io = *fieldObjects[masterNames[i]];
fields.set(i, new GeoField(io, mesh, readOldTime));
}
}
template<class Mesh, class GeoField>
void Foam::faFieldDecomposer::readFields
(
const Mesh& mesh,
const IOobjectList& objects,
PtrList<GeoField>& fields
)
{
// Search list of objects for fields of type GeomField
IOobjectList fieldObjects(objects.lookupClass<GeoField>());
// Use sorted set of names
// (different processors might read objects in different order)
const wordList masterNames(fieldObjects.sortedNames());
// Construct the fields
fields.resize(masterNames.size());
forAll(masterNames, i)
{
const IOobject& io = *fieldObjects[masterNames[i]];
fields.set(i, new GeoField(io, mesh));
}
}
// ************************************************************************* //

View File

@ -34,8 +34,8 @@ License
#include "faMesh.H" #include "faMesh.H"
#include "OSspecific.H" #include "OSspecific.H"
#include "Map.H" #include "Map.H"
#include "SLList.H"
#include "globalMeshData.H" #include "globalMeshData.H"
#include "decompositionModel.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -43,7 +43,7 @@ void Foam::faMeshDecomposition::distributeFaces()
{ {
const word& polyMeshRegionName = mesh().name(); const word& polyMeshRegionName = mesh().name();
Info<< "\nCalculating distribution of faces" << endl; Info<< "\nCalculating distribution of finiteArea faces" << endl;
cpuTime decompositionTime; cpuTime decompositionTime;
@ -162,22 +162,12 @@ void Foam::faMeshDecomposition::distributeFaces()
Foam::faMeshDecomposition::faMeshDecomposition Foam::faMeshDecomposition::faMeshDecomposition
( (
const fvMesh& mesh, const fvMesh& mesh,
const fileName& decompDictFile const label nProcessors,
const dictionary& params
) )
: :
faMesh(mesh), faMesh(mesh),
decompDictFile_(decompDictFile), nProcs_(nProcessors),
nProcs_
(
decompositionMethod::nDomains
(
decompositionModel::New
(
mesh,
decompDictFile
)
)
),
distributed_(false), distributed_(false),
hasGlobalFaceZones_(false), hasGlobalFaceZones_(false),
faceToProc_(nFaces()), faceToProc_(nFaces()),
@ -195,22 +185,28 @@ Foam::faMeshDecomposition::faMeshDecomposition
procNeighbourProcessors_(nProcs_), procNeighbourProcessors_(nProcs_),
procProcessorPatchSize_(nProcs_), procProcessorPatchSize_(nProcs_),
procProcessorPatchStartIndex_(nProcs_), procProcessorPatchStartIndex_(nProcs_),
globallySharedPoints_(0), globallySharedPoints_(),
cyclicParallel_(false) cyclicParallel_(false)
{ {
const decompositionModel& model = decompositionModel::New updateParameters(params);
(
mesh,
decompDictFile
);
model.readIfPresent("distributed", distributed_);
hasGlobalFaceZones_ = model.found("globalFaceZones");
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::faMeshDecomposition::updateParameters
(
const dictionary& params
)
{
params.readIfPresent("distributed", distributed_);
if (params.found("globalFaceZones"))
{
hasGlobalFaceZones_ = true;
}
}
void Foam::faMeshDecomposition::decomposeMesh() void Foam::faMeshDecomposition::decomposeMesh()
{ {
// Decide which cell goes to which processor // Decide which cell goes to which processor
@ -220,30 +216,42 @@ void Foam::faMeshDecomposition::decomposeMesh()
Info<< "\nDistributing faces to processors" << endl; Info<< "\nDistributing faces to processors" << endl;
// Memory management labelList nLocalFaces(nProcs_, Zero);
{
List<SLList<label>> procFaceList(nProcs());
forAll(faceToProc_, faceI) // Pass 1: determine local sizes, sanity check
forAll(faceToProc_, facei)
{ {
if (faceToProc_[faceI] >= nProcs()) const label proci = faceToProc_[facei];
if (proci < 0 || proci >= nProcs_)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Impossible processor label " << faceToProc_[faceI] << "Invalid processor label " << proci
<< "for face " << faceI << nl << " for face " << facei << nl
<< abort(FatalError); << abort(FatalError);
} }
else else
{ {
procFaceList[faceToProc_[faceI]].append(faceI); ++nLocalFaces[proci];
} }
} }
// Convert linked lists into normal lists // Adjust lengths
forAll(procFaceList, procI) forAll(nLocalFaces, proci)
{ {
procFaceAddressing_[procI] = procFaceList[procI]; procFaceAddressing_[proci].resize(nLocalFaces[proci]);
nLocalFaces[proci] = 0; // restart list
} }
// Pass 2: fill in local lists
forAll(faceToProc_, facei)
{
const label proci = faceToProc_[facei];
const label localFacei = nLocalFaces[proci];
++nLocalFaces[proci];
procFaceAddressing_[proci][localFacei] = facei;
} }
@ -1081,8 +1089,7 @@ void Foam::faMeshDecomposition::decomposeMesh()
procProcessorPatchSize_[procI]; procProcessorPatchSize_[procI];
labelListList& curPatchEdgeLabels = procPatchEdgeLabels_[procI]; labelListList& curPatchEdgeLabels = procPatchEdgeLabels_[procI];
curPatchEdgeLabels = curPatchEdgeLabels.resize
labelListList
( (
curPatchSize.size() curPatchSize.size()
+ curProcessorPatchSize.size() + curProcessorPatchSize.size()

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -44,7 +45,6 @@ SourceFiles
#include "fvMesh.H" #include "fvMesh.H"
#include "faMesh.H" #include "faMesh.H"
#include "labelList.H" #include "labelList.H"
#include "SLList.H"
#include "PtrList.H" #include "PtrList.H"
#include "point.H" #include "point.H"
@ -59,10 +59,7 @@ class faMeshDecomposition
: :
public faMesh public faMesh
{ {
// Private data // Private Data
//- Optional non-standard file for decomposeParDict
const fileName decompDictFile_;
//- Number of processors in decomposition //- Number of processors in decomposition
label nProcs_; label nProcs_;
@ -86,7 +83,7 @@ class faMeshDecomposition
labelList procNInternalEdges_; labelList procNInternalEdges_;
//- Edge labels for patches of processor meshes //- Edge labels for patches of processor meshes
List<List<List<label>>> procPatchEdgeLabels_; List<labelListList> procPatchEdgeLabels_;
//- Labels of points for each processor //- Labels of points for each processor
labelListList procPatchPointAddressing_; labelListList procPatchPointAddressing_;
@ -131,18 +128,21 @@ class faMeshDecomposition
void distributeFaces(); void distributeFaces();
public: public:
// Constructors // Constructors
//- Construct from components. //- Construct from components.
//- Values will come from the volume decomposition
// \param mesh the fvMesh // \param mesh the fvMesh
// \param decompDictFile optional non-standard location for the // \param nProcessors the number of processors
// decomposeParDict file // \param params additional parameters, sent to updateParameters
faMeshDecomposition faMeshDecomposition
( (
const fvMesh& mesh, const fvMesh& mesh,
const fileName& decompDictFile = "" const label nProcessors,
const dictionary& params = dictionary::null
); );
@ -152,29 +152,63 @@ public:
// Member Functions // Member Functions
// Settings
//- Number of processor in decomposition //- Number of processor in decomposition
label nProcs() const label nProcs() const
{ {
return nProcs_; return nProcs_;
} }
//- Is the decomposition data to be distributed for each processor //- Is decomposition data to be distributed for each processor
bool distributed() const bool distributed() const
{ {
return distributed_; return distributed_;
} }
//- Change distributed flag
bool distributed(const bool on)
{
bool old(distributed_);
distributed_ = on;
return old;
}
//- Are global face zones used
bool useGlobalFaceZones() const
{
return distributed_;
}
//- Change global face zones flag
bool useGlobalFaceZones(const bool on)
{
bool old(hasGlobalFaceZones_);
hasGlobalFaceZones_ = on;
return old;
}
//- Update flags based on the decomposition model settings
// Sets "distributed", detects presence of "globalFaceZones"
void updateParameters(const dictionary& params);
// Mappings
//- Face-processor decomposition labels
const labelList& faceToProc() const noexcept
{
return faceToProc_;
}
// Decompose
//- Decompose mesh //- Decompose mesh
void decomposeMesh(); void decomposeMesh();
//- Write decomposition //- Write decomposition
bool writeDecomposition(); bool writeDecomposition();
//- Cell-processor decomposition labels
const labelList& faceToProc() const
{
return faceToProc_;
}
}; };

View File

@ -5,5 +5,6 @@ cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
wmake $targetType reconstruct wmake $targetType reconstruct
wmake $targetType faReconstruct
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -0,0 +1,4 @@
processorFaMeshes.C
faFieldReconstructor.C
LIB = $(FOAM_LIBBIN)/libfaReconstruct

View File

@ -0,0 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteArea \
-lfiniteVolume \
-lmeshTools

View File

@ -35,7 +35,7 @@ Author
SourceFiles SourceFiles
faFieldReconstructor.C faFieldReconstructor.C
faFieldReconstructorReconstructFields.C faFieldReconstructorFields.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -194,7 +194,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "faFieldReconstructorReconstructFields.C" # include "faFieldReconstructorFields.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -145,116 +145,4 @@ Foam::processorFaMeshes::processorFaMeshes
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Foam::fvMesh::readUpdateState Foam::processorFaMeshes::readUpdate()
// {
// fvMesh::readUpdateState stat = fvMesh::UNCHANGED;
// forAll(databases_, procI)
// {
// // Check if any new meshes need to be read.
// fvMesh::readUpdateState procStat = meshes_[procI].readUpdate();
// /*
// if (procStat != fvMesh::UNCHANGED)
// {
// Info<< "Processor " << procI
// << " at time " << databases_[procI].timeName()
// << " detected mesh change " << procStat
// << endl;
// }
// */
// // Combine into overall mesh change status
// if (stat == fvMesh::UNCHANGED)
// {
// stat = procStat;
// }
// else
// {
// if (stat != procStat)
// {
// FatalErrorIn("processorFaMeshes::readUpdate()")
// << "Processor " << procI
// << " has a different polyMesh at time "
// << databases_[procI].timeName()
// << " compared to any previous processors." << nl
// << "Please check time " << databases_[procI].timeName()
// << " directories on all processors for consistent"
// << " mesh files."
// << exit(FatalError);
// }
// }
// }
// if
// (
// stat == fvMesh::TOPO_CHANGE
// || stat == fvMesh::TOPO_PATCH_CHANGE
// )
// {
// // Reread all meshes and addressing
// read();
// }
// return stat;
// }
// void Foam::processorFaMeshes::reconstructPoints(fvMesh& mesh)
// {
// // Read the field for all the processors
// PtrList<pointIOField> procsPoints(meshes_.size());
// forAll(meshes_, procI)
// {
// procsPoints.set
// (
// procI,
// new pointIOField
// (
// IOobject
// (
// "points",
// meshes_[procI].time().timeName(),
// polyMesh::meshSubDir,
// meshes_[procI],
// IOobject::MUST_READ,
// IOobject::NO_WRITE
// )
// )
// );
// }
// // Create the new points
// vectorField newPoints(mesh.nPoints());
// forAll(meshes_, procI)
// {
// const vectorField& procPoints = procsPoints[procI];
// // Set the cell values in the reconstructed field
// const labelList& pointProcAddressingI = pointProcAddressing_[procI];
// if (pointProcAddressingI.size() != procPoints.size())
// {
// FatalErrorIn("processorFaMeshes")
// << "problem :"
// << " pointProcAddressingI:" << pointProcAddressingI.size()
// << " procPoints:" << procPoints.size()
// << abort(FatalError);
// }
// forAll(pointProcAddressingI, pointI)
// {
// newPoints[pointProcAddressingI[pointI]] = procPoints[pointI];
// }
// }
// mesh.movePoints(newPoints);
// mesh.write();
// }
// ************************************************************************* // // ************************************************************************* //

View File

@ -27,7 +27,7 @@ Class
Foam::processorFaMeshes Foam::processorFaMeshes
Description Description
Container for processor mesh addressing. Container for finite-area processor mesh addressing.
Author Author
Zeljko Tukovic, FSB Zagreb Zeljko Tukovic, FSB Zagreb
@ -41,8 +41,8 @@ SourceFiles
#define processorFaMeshes_H #define processorFaMeshes_H
#include "PtrList.H" #include "PtrList.H"
#include "fvMesh.H"
#include "faMesh.H" #include "faMesh.H"
#include "fvMesh.H"
#include "IOobjectList.H" #include "IOobjectList.H"
#include "labelIOList.H" #include "labelIOList.H"
@ -100,29 +100,31 @@ public:
// Member Functions // Member Functions
//- Update the meshes based on the mesh files saved in const PtrList<faMesh>& meshes() const
// time directories {
// fvMesh::readUpdateState readUpdate(); return meshes_;
}
//- Reconstruct point position after motion in parallel
// void reconstructPoints(faMesh& mesh);
PtrList<faMesh>& meshes() PtrList<faMesh>& meshes()
{ {
return meshes_; return meshes_;
} }
const PtrList<labelIOList>& pointProcAddressing() const const PtrList<labelIOList>& pointProcAddressing() const
{ {
return pointProcAddressing_; return pointProcAddressing_;
} }
PtrList<labelIOList>& edgeProcAddressing() PtrList<labelIOList>& edgeProcAddressing()
{ {
return edgeProcAddressing_; return edgeProcAddressing_;
} }
const PtrList<labelIOList>& faceProcAddressing() const const PtrList<labelIOList>& faceProcAddressing() const
{ {
return faceProcAddressing_; return faceProcAddressing_;
} }
const PtrList<labelIOList>& boundaryProcAddressing() const const PtrList<labelIOList>& boundaryProcAddressing() const
{ {
return boundaryProcAddressing_; return boundaryProcAddressing_;