mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: refactor/centralize handling of direct and distributed mappers (#2436)
- added templating level to avoid code duplication and provide future extensibility
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/finiteArea/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/mesh/snappyHexMesh/lnInclude \
|
||||
@ -9,8 +11,11 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfileFormats \
|
||||
-lsurfMesh \
|
||||
-lmeshTools \
|
||||
-lfiniteVolume \
|
||||
-lfiniteArea \
|
||||
-llagrangian \
|
||||
-ldynamicMesh \
|
||||
-lsnappyHexMesh \
|
||||
|
||||
@ -1,124 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 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/>.
|
||||
|
||||
Class
|
||||
Foam::distributedUnallocatedDirectFieldMapper
|
||||
|
||||
Description
|
||||
FieldMapper with direct mapping from remote quantities.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef distributedUnallocatedDirectFieldMapper_H
|
||||
#define distributedUnallocatedDirectFieldMapper_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class distributedUnallocatedDirectFieldMapper Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class distributedUnallocatedDirectFieldMapper
|
||||
:
|
||||
public FieldMapper
|
||||
{
|
||||
const labelUList& directAddressing_;
|
||||
|
||||
const mapDistributeBase& distMap_;
|
||||
|
||||
bool hasUnmapped_;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given addressing
|
||||
distributedUnallocatedDirectFieldMapper
|
||||
(
|
||||
const labelUList& directAddressing,
|
||||
const mapDistributeBase& distMap
|
||||
)
|
||||
:
|
||||
directAddressing_(directAddressing),
|
||||
distMap_(distMap),
|
||||
hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~distributedUnallocatedDirectFieldMapper() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual label size() const
|
||||
{
|
||||
return
|
||||
(
|
||||
notNull(directAddressing_)
|
||||
? directAddressing_.size()
|
||||
: distMap_.constructSize()
|
||||
);
|
||||
}
|
||||
|
||||
virtual bool direct() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool distributed() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual const mapDistributeBase& distributeMap() const
|
||||
{
|
||||
return distMap_;
|
||||
}
|
||||
|
||||
virtual bool hasUnmapped() const
|
||||
{
|
||||
return hasUnmapped_;
|
||||
}
|
||||
|
||||
virtual const labelUList& directAddressing() const
|
||||
{
|
||||
return directAddressing_;
|
||||
}
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,126 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 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/>.
|
||||
|
||||
Class
|
||||
Foam::distributedUnallocatedDirectFvPatchFieldMapper
|
||||
|
||||
Description
|
||||
FieldMapper with direct mapping from remote quantities.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef distributedUnallocatedDirectFvPatchFieldMapper_H
|
||||
#define distributedUnallocatedDirectFvPatchFieldMapper_H
|
||||
|
||||
#include "fvPatchFieldMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class distributedUnallocatedDirectFvPatchFieldMapper Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class distributedUnallocatedDirectFvPatchFieldMapper
|
||||
:
|
||||
public fvPatchFieldMapper
|
||||
{
|
||||
const labelUList& directAddressing_;
|
||||
|
||||
const mapDistributeBase& distMap_;
|
||||
|
||||
bool hasUnmapped_;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given addressing
|
||||
distributedUnallocatedDirectFvPatchFieldMapper
|
||||
(
|
||||
const labelUList& directAddressing,
|
||||
const mapDistributeBase& distMap
|
||||
)
|
||||
:
|
||||
directAddressing_(directAddressing),
|
||||
distMap_(distMap),
|
||||
hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~distributedUnallocatedDirectFvPatchFieldMapper() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual label size() const
|
||||
{
|
||||
return
|
||||
(
|
||||
notNull(directAddressing_)
|
||||
? directAddressing_.size()
|
||||
: distMap_.constructSize()
|
||||
);
|
||||
}
|
||||
|
||||
virtual bool direct() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool distributed() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual const mapDistributeBase& distributeMap() const
|
||||
{
|
||||
return distMap_;
|
||||
}
|
||||
|
||||
virtual bool hasUnmapped() const
|
||||
{
|
||||
return hasUnmapped_;
|
||||
}
|
||||
|
||||
virtual const labelUList& directAddressing() const
|
||||
{
|
||||
return directAddressing_;
|
||||
}
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -27,7 +27,6 @@ License
|
||||
|
||||
#include "parFvFieldReconstructor.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::parFvFieldReconstructor::createPatchFaceMaps()
|
||||
@ -96,9 +95,8 @@ Foam::parFvFieldReconstructor::parFvFieldReconstructor
|
||||
|
||||
void Foam::parFvFieldReconstructor::reconstructPoints()
|
||||
{
|
||||
// Reconstruct the points for moving mesh cases and write
|
||||
// them out
|
||||
distributedUnallocatedDirectFieldMapper mapper
|
||||
// Reconstruct the points for moving mesh cases and write them out
|
||||
distributedFieldMapper mapper
|
||||
(
|
||||
labelUList::null(),
|
||||
distMap_.pointMap()
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -37,9 +37,8 @@ License
|
||||
#include "mapDistributePolyMesh.H"
|
||||
#include "processorFvPatch.H"
|
||||
|
||||
#include "directFvPatchFieldMapper.H"
|
||||
#include "distributedUnallocatedDirectFieldMapper.H"
|
||||
#include "distributedUnallocatedDirectFvPatchFieldMapper.H"
|
||||
#include "distributedFieldMapper.H"
|
||||
#include "distributedFvPatchFieldMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -50,7 +49,7 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeInternalField
|
||||
const DimensionedField<Type, volMesh>& fld
|
||||
) const
|
||||
{
|
||||
distributedUnallocatedDirectFieldMapper mapper
|
||||
distributedFieldMapper mapper
|
||||
(
|
||||
labelUList::null(),
|
||||
distMap_.cellMap()
|
||||
@ -113,7 +112,7 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeField
|
||||
// Create the internalField by remote mapping
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
distributedUnallocatedDirectFieldMapper mapper
|
||||
distributedFieldMapper mapper
|
||||
(
|
||||
labelUList::null(),
|
||||
distMap_.cellMap()
|
||||
@ -138,7 +137,7 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeField
|
||||
// Clone local patch field
|
||||
patchFields.set(patchI, bfld[patchI].clone());
|
||||
|
||||
distributedUnallocatedDirectFvPatchFieldMapper mapper
|
||||
distributedFvPatchFieldMapper mapper
|
||||
(
|
||||
labelUList::null(),
|
||||
patchFaceMaps_[patchI]
|
||||
@ -256,7 +255,7 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField
|
||||
// Create the internalField by remote mapping
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
distributedUnallocatedDirectFieldMapper mapper
|
||||
distributedFieldMapper mapper
|
||||
(
|
||||
labelUList::null(),
|
||||
distMap_.faceMap()
|
||||
@ -301,7 +300,7 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField
|
||||
// Clone local patch field
|
||||
patchFields.set(patchI, bfld[patchI].clone());
|
||||
|
||||
distributedUnallocatedDirectFvPatchFieldMapper mapper
|
||||
distributedFvPatchFieldMapper mapper
|
||||
(
|
||||
labelUList::null(),
|
||||
patchFaceMaps_[patchI]
|
||||
|
||||
Reference in New Issue
Block a user