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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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]
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,8 +32,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef FieldMapper_H
|
||||
#define FieldMapper_H
|
||||
#ifndef Foam_FieldMapper_H
|
||||
#define Foam_FieldMapper_H
|
||||
|
||||
#include "mapDistributeBase.H"
|
||||
#include "nullObject.H"
|
||||
@ -49,14 +49,12 @@ namespace Foam
|
||||
|
||||
class FieldMapper
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor
|
||||
FieldMapper()
|
||||
{}
|
||||
//- Default construct
|
||||
FieldMapper() = default;
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -65,28 +63,23 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- The size of the mapper
|
||||
virtual label size() const = 0;
|
||||
|
||||
//- Is it a direct (non-interpolating) mapper?
|
||||
virtual bool direct() const = 0;
|
||||
|
||||
//- Does the mapper have remote contributions?
|
||||
virtual bool distributed() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual const mapDistributeBase& distributeMap() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "attempt to access null distributeMap"
|
||||
<< abort(FatalError);
|
||||
|
||||
return NullObjectRef<mapDistributeBase>();
|
||||
}
|
||||
|
||||
//- Are there unmapped values? I.e. do all size() elements get
|
||||
// get value
|
||||
//- Any unmapped values?
|
||||
// I.e. do all size() elements get value
|
||||
virtual bool hasUnmapped() const = 0;
|
||||
|
||||
//- Return the direct addressing values
|
||||
virtual const labelUList& directAddressing() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -96,6 +89,17 @@ public:
|
||||
return labelUList::null();
|
||||
}
|
||||
|
||||
//- Return the distribution map
|
||||
virtual const mapDistributeBase& distributeMap() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "attempt to access null distributeMap"
|
||||
<< abort(FatalError);
|
||||
|
||||
return NullObjectRef<mapDistributeBase>();
|
||||
}
|
||||
|
||||
//- Return the interpolation addressing
|
||||
virtual const labelListList& addressing() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -105,6 +109,7 @@ public:
|
||||
return labelListList::null();
|
||||
}
|
||||
|
||||
//- Return the interpolation weights
|
||||
virtual const scalarListList& weights() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -117,10 +122,11 @@ public:
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Perform mapping on the given field
|
||||
template<class Type>
|
||||
tmp<Field<Type>> operator()(const Field<Type>& f) const
|
||||
tmp<Field<Type>> operator()(const Field<Type>& fld) const
|
||||
{
|
||||
return tmp<Field<Type>>::New(f, *this);
|
||||
return tmp<Field<Type>>::New(fld, *this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2013 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,72 +25,129 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::directFieldMapper
|
||||
Foam::DirectFieldMapper
|
||||
|
||||
Description
|
||||
FieldMapper with direct mapping.
|
||||
A templated direct mapper for the given FieldMapper type
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef directFieldMapper_H
|
||||
#define directFieldMapper_H
|
||||
#ifndef Foam_directFieldMapper_H
|
||||
#define Foam_directFieldMapper_H
|
||||
|
||||
#include "FieldMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
template<class FieldMapperType> class DirectFieldMapper;
|
||||
|
||||
// Standard Types
|
||||
|
||||
//- A FieldMapper with direct mapping
|
||||
typedef DirectFieldMapper<FieldMapper> directFieldMapper;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class directFieldMapper Declaration
|
||||
Class DirectFieldMapper Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class directFieldMapper
|
||||
template<class FieldMapperType>
|
||||
class DirectFieldMapper
|
||||
:
|
||||
public FieldMapper
|
||||
public FieldMapperType
|
||||
{
|
||||
const labelUList& directAddressing_;
|
||||
// Private Data
|
||||
|
||||
bool hasUnmapped_;
|
||||
//- Addressing from new back to old
|
||||
const labelUList& directAddressing_;
|
||||
|
||||
//- Does map contain any unmapped values
|
||||
bool hasUnmapped_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Any negative (unmapped) values in the addressing?
|
||||
static bool hasUnmappedEntry(const labelUList& directAddr)
|
||||
{
|
||||
for (const label val : directAddr)
|
||||
{
|
||||
if (val < 0) return true; // early exit
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Public Types
|
||||
|
||||
//- The base mapper type
|
||||
typedef FieldMapperType mapper_type;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given addressing
|
||||
directFieldMapper(const labelUList& directAddressing)
|
||||
//- Construct given addressing, check for unmapped (negative) values
|
||||
explicit DirectFieldMapper
|
||||
(
|
||||
const labelUList& directAddr,
|
||||
const bool checkUnmapped = true
|
||||
)
|
||||
:
|
||||
directAddressing_(directAddressing),
|
||||
hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0)
|
||||
FieldMapperType(),
|
||||
directAddressing_(directAddr),
|
||||
hasUnmapped_(checkUnmapped && hasUnmappedEntry(directAddr))
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~directFieldMapper() = default;
|
||||
virtual ~DirectFieldMapper() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
label size() const
|
||||
//- True if directAddressing is not the null object (unallocated)
|
||||
virtual bool hasDirectAddressing() const
|
||||
{
|
||||
return notNull(directAddressing_);
|
||||
}
|
||||
|
||||
//- The mapper size is given by the size of the direct addressing
|
||||
virtual label size() const
|
||||
{
|
||||
return directAddressing_.size();
|
||||
}
|
||||
|
||||
bool direct() const
|
||||
//- It is a direct mapper
|
||||
virtual bool direct() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hasUnmapped() const
|
||||
//- Any unmapped values?
|
||||
virtual bool hasUnmapped() const
|
||||
{
|
||||
return hasUnmapped_;
|
||||
}
|
||||
|
||||
const labelUList& directAddressing() const
|
||||
//- Allow modification
|
||||
virtual bool& hasUnmapped()
|
||||
{
|
||||
return hasUnmapped_;
|
||||
}
|
||||
|
||||
//- Return the direct addressing values
|
||||
virtual const labelUList& directAddressing() const
|
||||
{
|
||||
return directAddressing_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,96 +24,102 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::distributedUnallocatedDirectFvPatchFieldMapper
|
||||
Foam::DistributedFieldMapper
|
||||
|
||||
Description
|
||||
FieldMapper with direct mapping from remote quantities.
|
||||
A templated field mapper
|
||||
with direct mapping from local or remote quantities.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef distributedUnallocatedDirectFvPatchFieldMapper_H
|
||||
#define distributedUnallocatedDirectFvPatchFieldMapper_H
|
||||
#ifndef Foam_distributedFieldMapper_H
|
||||
#define Foam_distributedFieldMapper_H
|
||||
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "directFieldMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
template<class DirectFieldMapperType> class DistributedFieldMapper;
|
||||
|
||||
// Standard Types
|
||||
|
||||
//- A directFieldMapper with distributed (with local or remote) quantities
|
||||
typedef DistributedFieldMapper<directFieldMapper> distributedFieldMapper;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class distributedUnallocatedDirectFvPatchFieldMapper Declaration
|
||||
Class DistributedFieldMapper Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class distributedUnallocatedDirectFvPatchFieldMapper
|
||||
template<class DirectFieldMapperType>
|
||||
class DistributedFieldMapper
|
||||
:
|
||||
public fvPatchFieldMapper
|
||||
public DirectFieldMapperType
|
||||
{
|
||||
const labelUList& directAddressing_;
|
||||
// Private Data
|
||||
|
||||
const mapDistributeBase& distMap_;
|
||||
//- The distributed map
|
||||
const mapDistributeBase& distMap_;
|
||||
|
||||
bool hasUnmapped_;
|
||||
|
||||
public:
|
||||
|
||||
// Public Types
|
||||
|
||||
//- The base direct mapper type
|
||||
typedef DirectFieldMapperType mapper_type;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given addressing
|
||||
distributedUnallocatedDirectFvPatchFieldMapper
|
||||
//- Construct with addressing and distribute map
|
||||
DistributedFieldMapper
|
||||
(
|
||||
const labelUList& directAddressing,
|
||||
const labelUList& directAddr,
|
||||
const mapDistributeBase& distMap
|
||||
)
|
||||
:
|
||||
directAddressing_(directAddressing),
|
||||
distMap_(distMap),
|
||||
hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0)
|
||||
DirectFieldMapperType(directAddr),
|
||||
distMap_(distMap)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~distributedUnallocatedDirectFvPatchFieldMapper() = default;
|
||||
virtual ~DistributedFieldMapper() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- The mapper size is given by the direct addressing size (if valid)
|
||||
//- or from the distributeMap construct size.
|
||||
virtual label size() const
|
||||
{
|
||||
return
|
||||
(
|
||||
notNull(directAddressing_)
|
||||
? directAddressing_.size()
|
||||
DirectFieldMapperType::hasDirectAddressing()
|
||||
? DirectFieldMapperType::size()
|
||||
: distMap_.constructSize()
|
||||
);
|
||||
}
|
||||
|
||||
virtual bool direct() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//- It is a distributed mapper
|
||||
virtual bool distributed() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//- Return the distribution map
|
||||
virtual const mapDistributeBase& distributeMap() const
|
||||
{
|
||||
return distMap_;
|
||||
}
|
||||
|
||||
virtual bool hasUnmapped() const
|
||||
{
|
||||
return hasUnmapped_;
|
||||
}
|
||||
|
||||
virtual const labelUList& directAddressing() const
|
||||
{
|
||||
return directAddressing_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
@ -5,8 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -24,17 +23,18 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Typedef
|
||||
Foam::directPointPatchFieldMapper
|
||||
|
||||
Description
|
||||
direct pointPatchFieldMapper
|
||||
A direct pointPatchFieldMapper
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef directPointPatchFieldMapper_H
|
||||
#define directPointPatchFieldMapper_H
|
||||
#ifndef Foam_directPointPatchFieldMapper_H
|
||||
#define Foam_directPointPatchFieldMapper_H
|
||||
|
||||
#include "directFieldMapper.H"
|
||||
#include "pointPatchFieldMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -42,65 +42,11 @@ Description
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class directPointPatchFieldMapper Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
typedef
|
||||
DirectFieldMapper<pointPatchFieldMapper>
|
||||
directPointPatchFieldMapper;
|
||||
|
||||
class directPointPatchFieldMapper
|
||||
:
|
||||
public pointPatchFieldMapper
|
||||
{
|
||||
|
||||
//- Addressing from new back to old
|
||||
const labelUList& directAddressing_;
|
||||
|
||||
//- Does map contain any unmapped values
|
||||
bool hasUnmapped_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given addressing
|
||||
directPointPatchFieldMapper(const labelUList& directAddressing)
|
||||
:
|
||||
directAddressing_(directAddressing),
|
||||
hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~directPointPatchFieldMapper() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
label size() const
|
||||
{
|
||||
return directAddressing_.size();
|
||||
}
|
||||
|
||||
bool direct() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hasUnmapped() const
|
||||
{
|
||||
return hasUnmapped_;
|
||||
}
|
||||
|
||||
const labelUList& directAddressing() const
|
||||
{
|
||||
return directAddressing_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022 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/>.
|
||||
|
||||
Typedef
|
||||
Foam::distributedPointPatchFieldMapper
|
||||
|
||||
Description
|
||||
A directPointPatchFieldMapper
|
||||
with direct mapping from local or remote quantities.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_distributedPointPatchFieldMapper_H
|
||||
#define Foam_distributedPointPatchFieldMapper_H
|
||||
|
||||
#include "distributedFieldMapper.H"
|
||||
#include "directPointPatchFieldMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
typedef
|
||||
DistributedFieldMapper<directPointPatchFieldMapper>
|
||||
distributedPointPatchFieldMapper;
|
||||
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -31,11 +31,10 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef pointPatchFieldMapper_H
|
||||
#define pointPatchFieldMapper_H
|
||||
#ifndef Foam_pointPatchFieldMapper_H
|
||||
#define Foam_pointPatchFieldMapper_H
|
||||
|
||||
#include "primitiveFields.H"
|
||||
#include "FieldMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -50,14 +49,12 @@ class pointPatchFieldMapper
|
||||
:
|
||||
public FieldMapper
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor
|
||||
pointPatchFieldMapper()
|
||||
{}
|
||||
//- Default construct
|
||||
pointPatchFieldMapper() = default;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -50,7 +50,15 @@ class pointBoundaryMeshMapper
|
||||
:
|
||||
public PtrList<pointPatchMapper>
|
||||
{
|
||||
// Private Member Functions
|
||||
public:
|
||||
|
||||
// Public Types
|
||||
|
||||
//- The patch mapper type
|
||||
typedef pointPatchMapper mapper_type;
|
||||
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- No copy construct
|
||||
pointBoundaryMeshMapper(const pointBoundaryMeshMapper&) = delete;
|
||||
@ -59,8 +67,6 @@ class pointBoundaryMeshMapper
|
||||
void operator=(const pointBoundaryMeshMapper&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
|
||||
@ -200,13 +200,4 @@ const Foam::scalarListList& Foam::pointPatchMapper::weights() const
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -33,7 +33,7 @@ License
|
||||
|
||||
void Foam::mapDistributePolyMesh::calcPatchSizes()
|
||||
{
|
||||
oldPatchSizes_.setSize(oldPatchStarts_.size());
|
||||
oldPatchSizes_.resize_nocopy(oldPatchStarts_.size());
|
||||
|
||||
if (oldPatchStarts_.size())
|
||||
{
|
||||
@ -192,6 +192,12 @@ Foam::mapDistributePolyMesh::mapDistributePolyMesh(Istream& is)
|
||||
|
||||
void Foam::mapDistributePolyMesh::transfer(mapDistributePolyMesh& rhs)
|
||||
{
|
||||
if (this == &rhs)
|
||||
{
|
||||
// Self-assignment is a no-op
|
||||
return;
|
||||
}
|
||||
|
||||
nOldPoints_ = rhs.nOldPoints_;
|
||||
nOldFaces_ = rhs.nOldFaces_;
|
||||
nOldCells_ = rhs.nOldCells_;
|
||||
@ -283,6 +289,12 @@ void Foam::mapDistributePolyMesh::distributePatchIndices(labelList& lst) const
|
||||
|
||||
void Foam::mapDistributePolyMesh::operator=(const mapDistributePolyMesh& rhs)
|
||||
{
|
||||
if (this == &rhs)
|
||||
{
|
||||
// Self-assignment is a no-op
|
||||
return;
|
||||
}
|
||||
|
||||
nOldPoints_ = rhs.nOldPoints_;
|
||||
nOldFaces_ = rhs.nOldFaces_;
|
||||
nOldCells_ = rhs.nOldCells_;
|
||||
@ -298,7 +310,11 @@ void Foam::mapDistributePolyMesh::operator=(const mapDistributePolyMesh& rhs)
|
||||
|
||||
void Foam::mapDistributePolyMesh::operator=(mapDistributePolyMesh&& rhs)
|
||||
{
|
||||
transfer(rhs);
|
||||
if (this != &rhs)
|
||||
{
|
||||
// Avoid self assignment
|
||||
transfer(rhs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -327,9 +343,10 @@ Foam::Istream& Foam::operator>>(Istream& is, mapDistributePolyMesh& map)
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const mapDistributePolyMesh& map)
|
||||
{
|
||||
os << map.nOldPoints_
|
||||
<< token::SPACE << map.nOldFaces_
|
||||
<< token::SPACE << map.nOldCells_ << token::NL
|
||||
os << map.nOldPoints_ << token::SPACE
|
||||
<< map.nOldFaces_ << token::SPACE
|
||||
<< map.nOldCells_ << token::NL
|
||||
|
||||
<< map.oldPatchSizes_ << token::NL
|
||||
<< map.oldPatchStarts_ << token::NL
|
||||
<< map.oldPatchNMeshPoints_ << token::NL
|
||||
|
||||
@ -41,8 +41,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mapDistributePolyMesh_H
|
||||
#define mapDistributePolyMesh_H
|
||||
#ifndef Foam_mapDistributePolyMesh_H
|
||||
#define Foam_mapDistributePolyMesh_H
|
||||
|
||||
#include "mapDistribute.H"
|
||||
|
||||
@ -51,7 +51,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
// Forward Declarations
|
||||
class mapPolyMesh;
|
||||
class polyMesh;
|
||||
class mapDistributePolyMesh;
|
||||
@ -66,7 +66,7 @@ Ostream& operator<<(Ostream&, const mapDistributePolyMesh&);
|
||||
|
||||
class mapDistributePolyMesh
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- Number of old live points
|
||||
label nOldPoints_;
|
||||
@ -112,7 +112,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
mapDistributePolyMesh();
|
||||
|
||||
//- Move construct
|
||||
@ -165,7 +165,7 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
mapDistributePolyMesh(Istream& is);
|
||||
explicit mapDistributePolyMesh(Istream& is);
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -173,61 +173,61 @@ public:
|
||||
// Access
|
||||
|
||||
//- Number of points in mesh before distribution
|
||||
label nOldPoints() const
|
||||
label nOldPoints() const noexcept
|
||||
{
|
||||
return nOldPoints_;
|
||||
}
|
||||
|
||||
//- Number of faces in mesh before distribution
|
||||
label nOldFaces() const
|
||||
label nOldFaces() const noexcept
|
||||
{
|
||||
return nOldFaces_;
|
||||
}
|
||||
|
||||
//- Number of cells in mesh before distribution
|
||||
label nOldCells() const
|
||||
label nOldCells() const noexcept
|
||||
{
|
||||
return nOldCells_;
|
||||
}
|
||||
|
||||
//- List of the old patch sizes
|
||||
const labelList& oldPatchSizes() const
|
||||
const labelList& oldPatchSizes() const noexcept
|
||||
{
|
||||
return oldPatchSizes_;
|
||||
}
|
||||
|
||||
//- List of the old patch start labels
|
||||
const labelList& oldPatchStarts() const
|
||||
const labelList& oldPatchStarts() const noexcept
|
||||
{
|
||||
return oldPatchStarts_;
|
||||
}
|
||||
|
||||
//- List of numbers of mesh points per old patch
|
||||
const labelList& oldPatchNMeshPoints() const
|
||||
const labelList& oldPatchNMeshPoints() const noexcept
|
||||
{
|
||||
return oldPatchNMeshPoints_;
|
||||
}
|
||||
|
||||
//- Point distribute map
|
||||
const mapDistribute& pointMap() const
|
||||
const mapDistribute& pointMap() const noexcept
|
||||
{
|
||||
return pointMap_;
|
||||
}
|
||||
|
||||
//- Face distribute map
|
||||
const mapDistribute& faceMap() const
|
||||
const mapDistribute& faceMap() const noexcept
|
||||
{
|
||||
return faceMap_;
|
||||
}
|
||||
|
||||
//- Cell distribute map
|
||||
const mapDistribute& cellMap() const
|
||||
const mapDistribute& cellMap() const noexcept
|
||||
{
|
||||
return cellMap_;
|
||||
}
|
||||
|
||||
//- Patch distribute map
|
||||
const mapDistribute& patchMap() const
|
||||
const mapDistribute& patchMap() const noexcept
|
||||
{
|
||||
return patchMap_;
|
||||
}
|
||||
@ -240,30 +240,30 @@ public:
|
||||
|
||||
//- Distribute list of point data
|
||||
template<class T>
|
||||
void distributePointData(List<T>& lst) const
|
||||
void distributePointData(List<T>& values) const
|
||||
{
|
||||
pointMap_.distribute(lst);
|
||||
pointMap_.distribute(values);
|
||||
}
|
||||
|
||||
//- Distribute list of face data
|
||||
template<class T>
|
||||
void distributeFaceData(List<T>& lst) const
|
||||
void distributeFaceData(List<T>& values) const
|
||||
{
|
||||
faceMap_.distribute(lst);
|
||||
faceMap_.distribute(values);
|
||||
}
|
||||
|
||||
//- Distribute list of cell data
|
||||
template<class T>
|
||||
void distributeCellData(List<T>& lst) const
|
||||
void distributeCellData(List<T>& values) const
|
||||
{
|
||||
cellMap_.distribute(lst);
|
||||
cellMap_.distribute(values);
|
||||
}
|
||||
|
||||
//- Distribute list of patch data
|
||||
template<class T>
|
||||
void distributePatchData(List<T>& lst) const
|
||||
void distributePatchData(List<T>& values) const
|
||||
{
|
||||
patchMap_.distribute(lst);
|
||||
patchMap_.distribute(values);
|
||||
}
|
||||
|
||||
|
||||
@ -294,12 +294,11 @@ public:
|
||||
|
||||
// IOstream operators
|
||||
|
||||
//- Read dictionary from Istream
|
||||
//- Read content (not dictionary) from Istream
|
||||
friend Istream& operator>>(Istream&, mapDistributePolyMesh&);
|
||||
|
||||
//- Write dictionary to Ostream
|
||||
//- Write content (not dictionary) to Ostream
|
||||
friend Ostream& operator<<(Ostream&, const mapDistributePolyMesh&);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -32,8 +32,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef morphFieldMapper_H
|
||||
#define morphFieldMapper_H
|
||||
#ifndef Foam_morphFieldMapper_H
|
||||
#define Foam_morphFieldMapper_H
|
||||
|
||||
#include "Field.H"
|
||||
#include "Map.H"
|
||||
@ -51,14 +51,12 @@ class morphFieldMapper
|
||||
:
|
||||
public FieldMapper
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor
|
||||
morphFieldMapper()
|
||||
{}
|
||||
//- Default construct
|
||||
morphFieldMapper() = default;
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -75,7 +73,6 @@ public:
|
||||
|
||||
//- Return list of inserted objects
|
||||
virtual const labelList& insertedObjectLabels() const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -50,7 +50,15 @@ class faBoundaryMeshMapper
|
||||
:
|
||||
public PtrList<faPatchMapper>
|
||||
{
|
||||
// Private Member Functions
|
||||
public:
|
||||
|
||||
// Public Types
|
||||
|
||||
//- The patch mapper type
|
||||
typedef faPatchMapper mapper_type;
|
||||
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- No copy construct
|
||||
faBoundaryMeshMapper(const faBoundaryMeshMapper&) = delete;
|
||||
@ -59,8 +67,6 @@ class faBoundaryMeshMapper
|
||||
void operator=(const faBoundaryMeshMapper&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
@ -74,14 +80,14 @@ public:
|
||||
{
|
||||
const faBoundaryMesh& patches = mesh.boundary();
|
||||
|
||||
forAll(patches, patchI)
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
set
|
||||
(
|
||||
patchI,
|
||||
patchi,
|
||||
new faPatchMapper
|
||||
(
|
||||
patches[patchI],
|
||||
patches[patchi],
|
||||
mpm
|
||||
)
|
||||
);
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022 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/>.
|
||||
|
||||
Typedef
|
||||
Foam::directFaPatchFieldMapper
|
||||
|
||||
Description
|
||||
A direct faPatchFieldMapper
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_directFaPatchFieldMapper_H
|
||||
#define Foam_directFaPatchFieldMapper_H
|
||||
|
||||
#include "directFieldMapper.H"
|
||||
#include "faPatchFieldMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
typedef
|
||||
DirectFieldMapper<faPatchFieldMapper>
|
||||
directFaPatchFieldMapper;
|
||||
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,56 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022 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/>.
|
||||
|
||||
Typedef
|
||||
Foam::distributedFaPatchFieldMapper
|
||||
|
||||
Description
|
||||
A directFaPatchFieldMapper
|
||||
with direct mapping from local or remote quantities.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_distributedFaPatchFieldMapper_H
|
||||
#define Foam_distributedFaPatchFieldMapper_H
|
||||
|
||||
#include "distributedFieldMapper.H"
|
||||
#include "directFaPatchFieldMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
typedef
|
||||
DistributedFieldMapper<directFaPatchFieldMapper>
|
||||
distributedFaPatchFieldMapper;
|
||||
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -26,10 +26,13 @@ License
|
||||
Class
|
||||
Foam::faPatchFieldMapper
|
||||
|
||||
Description
|
||||
A FieldMapper for finite-area patch fields
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faPatchFieldMapper_H
|
||||
#define faPatchFieldMapper_H
|
||||
#ifndef Foam_faPatchFieldMapper_H
|
||||
#define Foam_faPatchFieldMapper_H
|
||||
|
||||
#include "primitiveFields.H"
|
||||
|
||||
@ -46,14 +49,12 @@ class faPatchFieldMapper
|
||||
:
|
||||
public FieldMapper
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor
|
||||
faPatchFieldMapper()
|
||||
{}
|
||||
//- Default construct
|
||||
faPatchFieldMapper() = default;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -24,17 +23,18 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Typedef
|
||||
Foam::directFvPatchFieldMapper
|
||||
|
||||
Description
|
||||
direct fvPatchFieldMapper
|
||||
A fvPatchFieldMapper with direct mapping
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef directFvPatchFieldMapper_H
|
||||
#define directFvPatchFieldMapper_H
|
||||
#ifndef Foam_directFvPatchFieldMapper_H
|
||||
#define Foam_directFvPatchFieldMapper_H
|
||||
|
||||
#include "directFieldMapper.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -42,70 +42,11 @@ Description
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class directFvPatchFieldMapper Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
typedef
|
||||
DirectFieldMapper<fvPatchFieldMapper>
|
||||
directFvPatchFieldMapper;
|
||||
|
||||
class directFvPatchFieldMapper
|
||||
:
|
||||
public fvPatchFieldMapper
|
||||
{
|
||||
|
||||
//- Addressing from new back to old
|
||||
const labelUList& directAddressing_;
|
||||
|
||||
//- Does map contain any unmapped values
|
||||
bool hasUnmapped_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given addressing
|
||||
directFvPatchFieldMapper(const labelUList& directAddressing)
|
||||
:
|
||||
directAddressing_(directAddressing),
|
||||
hasUnmapped_(directAddressing_.size() && min(directAddressing_) < 0)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~directFvPatchFieldMapper() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
label size() const
|
||||
{
|
||||
return directAddressing_.size();
|
||||
}
|
||||
|
||||
bool direct() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hasUnmapped() const
|
||||
{
|
||||
return hasUnmapped_;
|
||||
}
|
||||
|
||||
bool& hasUnmapped()
|
||||
{
|
||||
return hasUnmapped_;
|
||||
}
|
||||
|
||||
const labelUList& directAddressing() const
|
||||
{
|
||||
return directAddressing_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022 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/>.
|
||||
|
||||
Typedef
|
||||
Foam::distributedFvPatchFieldMapper
|
||||
|
||||
Description
|
||||
A directFvPatchFieldMapper
|
||||
with direct mapping from local or remote quantities.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_distributedFvPatchFieldMapper_H
|
||||
#define Foam_distributedFvPatchFieldMapper_H
|
||||
|
||||
#include "distributedFieldMapper.H"
|
||||
#include "directFvPatchFieldMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
typedef
|
||||
DistributedFieldMapper<directFvPatchFieldMapper>
|
||||
distributedFvPatchFieldMapper;
|
||||
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -27,12 +27,12 @@ Class
|
||||
Foam::fvPatchFieldMapper
|
||||
|
||||
Description
|
||||
Foam::fvPatchFieldMapper
|
||||
A FieldMapper for finite-volume patch fields
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fvPatchFieldMapper_H
|
||||
#define fvPatchFieldMapper_H
|
||||
#ifndef Foam_fvPatchFieldMapper_H
|
||||
#define Foam_fvPatchFieldMapper_H
|
||||
|
||||
#include "primitiveFields.H"
|
||||
|
||||
@ -49,14 +49,12 @@ class fvPatchFieldMapper
|
||||
:
|
||||
public FieldMapper
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor
|
||||
fvPatchFieldMapper()
|
||||
{}
|
||||
//- Default construct
|
||||
fvPatchFieldMapper() = default;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -50,7 +50,15 @@ class fvBoundaryMeshMapper
|
||||
:
|
||||
public PtrList<fvPatchMapper>
|
||||
{
|
||||
// Private Member Functions
|
||||
public:
|
||||
|
||||
// Public Types
|
||||
|
||||
//- The patch mapper type
|
||||
typedef fvPatchMapper mapper_type;
|
||||
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- No copy construct
|
||||
fvBoundaryMeshMapper(const fvBoundaryMeshMapper&) = delete;
|
||||
@ -59,8 +67,6 @@ class fvBoundaryMeshMapper
|
||||
void operator=(const fvBoundaryMeshMapper&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
|
||||
Reference in New Issue
Block a user