mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: decompose/reconstruct using labelUList, UPtrList addressing
ENH: reduce some overhead for processorMeshes reconstructPoints
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
decompositionInformation.C
|
||||
decompositionModel.C
|
||||
decompositionInformation.cxx
|
||||
decompositionModel.cxx
|
||||
|
||||
dimFieldDecomposer.C
|
||||
dimFieldDecomposer.cxx
|
||||
|
||||
fvFieldDecomposer.C
|
||||
fvFieldDecomposerCache.C
|
||||
fvFieldDecomposer.cxx
|
||||
fvFieldDecomposerCache.cxx
|
||||
|
||||
pointFieldDecomposer.C
|
||||
pointFieldDecomposerCache.C
|
||||
pointFieldDecomposer.cxx
|
||||
pointFieldDecomposerCache.cxx
|
||||
|
||||
lagrangianFieldDecomposer.C
|
||||
lagrangianFieldDecomposerCache.C
|
||||
lagrangianFieldDecomposer.cxx
|
||||
lagrangianFieldDecomposerCache.cxx
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libdecompose
|
||||
|
||||
@ -55,7 +55,7 @@ void Foam::decompositionInformation::populate
|
||||
{
|
||||
const label ownProc = decomp[celli];
|
||||
|
||||
labelList& subdist = distrib_[ownProc];
|
||||
labelUList& subdist = distrib_[ownProc];
|
||||
|
||||
// Number of cells
|
||||
++subdist[ownProc];
|
||||
@ -80,7 +80,7 @@ void Foam::decompositionInformation::populate
|
||||
|
||||
forAll(distrib_, ownProc)
|
||||
{
|
||||
const labelList& subdist = distrib_[ownProc];
|
||||
const labelUList& subdist = distrib_[ownProc];
|
||||
|
||||
cellsCount[ownProc] = subdist[ownProc];
|
||||
|
||||
@ -172,7 +172,7 @@ void Foam::decompositionInformation::printDetails(Ostream& os) const
|
||||
|
||||
forAll(distrib_, ownProc)
|
||||
{
|
||||
const labelList& subdist = distrib_[ownProc];
|
||||
const labelUList& subdist = distrib_[ownProc];
|
||||
|
||||
// First pass:
|
||||
label neighCount = 0;
|
||||
@ -31,8 +31,8 @@ Description
|
||||
Dimensioned field decomposer.
|
||||
|
||||
SourceFiles
|
||||
dimFieldDecomposer.C
|
||||
dimFieldDecomposerTemplates.C
|
||||
dimFieldDecomposer.cxx
|
||||
dimFieldDecomposer.txx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -40,7 +40,7 @@ SourceFiles
|
||||
#define Foam_dimFieldDecomposer_H
|
||||
|
||||
#include "fvMesh.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "DimensionedField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -59,10 +59,10 @@ class dimFieldDecomposer
|
||||
const fvMesh& procMesh_;
|
||||
|
||||
//- Reference to face addressing
|
||||
//UNUSED: const labelList& faceAddressing_;
|
||||
//UNUSED: const labelUList& faceAddressing_;
|
||||
|
||||
//- Reference to cell addressing
|
||||
const labelList& cellAddressing_;
|
||||
const labelUList& cellAddressing_;
|
||||
|
||||
|
||||
public:
|
||||
@ -80,7 +80,7 @@ public:
|
||||
dimFieldDecomposer
|
||||
(
|
||||
const fvMesh& procMesh,
|
||||
const labelList& cellAddressing
|
||||
const labelUList& cellAddressing
|
||||
);
|
||||
|
||||
//- Construct from components with API as per fvFieldDecomposer
|
||||
@ -88,8 +88,8 @@ public:
|
||||
(
|
||||
const fvMesh& completeMesh, //!< unused
|
||||
const fvMesh& procMesh,
|
||||
const labelList& faceAddressing, //!< unused
|
||||
const labelList& cellAddressing
|
||||
const labelUList& faceAddressing, //!< unused
|
||||
const labelUList& cellAddressing
|
||||
);
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ public:
|
||||
|
||||
//- Decompose list of fields
|
||||
template<class GeoField>
|
||||
void decomposeFields(const PtrList<GeoField>& fields) const;
|
||||
void decomposeFields(const UPtrList<GeoField>& fields) const;
|
||||
};
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "dimFieldDecomposerTemplates.C"
|
||||
#include "dimFieldDecomposer.txx"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -33,7 +33,7 @@ License
|
||||
Foam::dimFieldDecomposer::dimFieldDecomposer
|
||||
(
|
||||
const fvMesh& procMesh,
|
||||
const labelList& cellAddressing
|
||||
const labelUList& cellAddressing
|
||||
)
|
||||
:
|
||||
procMesh_(procMesh),
|
||||
@ -45,8 +45,8 @@ Foam::dimFieldDecomposer::dimFieldDecomposer
|
||||
(
|
||||
const fvMesh& /* unused: completeMesh */,
|
||||
const fvMesh& procMesh,
|
||||
const labelList& /* unused: faceAddressing */,
|
||||
const labelList& cellAddressing
|
||||
const labelUList& /* unused: faceAddressing */,
|
||||
const labelUList& cellAddressing
|
||||
)
|
||||
:
|
||||
procMesh_(procMesh),
|
||||
@ -54,7 +54,7 @@ Foam::dimFieldDecomposer::decomposeField
|
||||
template<class GeoField>
|
||||
void Foam::dimFieldDecomposer::decomposeFields
|
||||
(
|
||||
const PtrList<GeoField>& fields
|
||||
const UPtrList<GeoField>& fields
|
||||
) const
|
||||
{
|
||||
for (const auto& fld : fields)
|
||||
@ -31,9 +31,9 @@ Description
|
||||
Finite Volume volume and surface field decomposer.
|
||||
|
||||
SourceFiles
|
||||
fvFieldDecomposer.C
|
||||
fvFieldDecomposerCache.C
|
||||
fvFieldDecomposerTemplates.C
|
||||
fvFieldDecomposer.cxx
|
||||
fvFieldDecomposer.txx
|
||||
fvFieldDecomposerCache.cxx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -42,6 +42,7 @@ SourceFiles
|
||||
|
||||
#include "fvMesh.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -62,6 +63,9 @@ public:
|
||||
|
||||
// Public Classes
|
||||
|
||||
//- Internal caching for field reading
|
||||
class fieldsCache;
|
||||
|
||||
//- Patch field decomposer class
|
||||
class patchFieldDecomposer
|
||||
:
|
||||
@ -85,23 +89,23 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
label size() const
|
||||
label size() const noexcept
|
||||
{
|
||||
return directAddressing_.size();
|
||||
}
|
||||
|
||||
bool direct() const
|
||||
bool direct() const noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//- Are there unmapped values
|
||||
bool hasUnmapped() const
|
||||
bool hasUnmapped() const noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const labelUList& directAddressing() const
|
||||
const labelUList& directAddressing() const noexcept
|
||||
{
|
||||
return directAddressing_;
|
||||
}
|
||||
@ -139,23 +143,23 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
label size() const
|
||||
label size() const noexcept
|
||||
{
|
||||
return directAddressing_.size();
|
||||
}
|
||||
|
||||
bool direct() const
|
||||
bool direct() const noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//- Are there unmapped values
|
||||
bool hasUnmapped() const
|
||||
bool hasUnmapped() const noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const labelUList& directAddressing() const
|
||||
const labelUList& directAddressing() const noexcept
|
||||
{
|
||||
return directAddressing_;
|
||||
}
|
||||
@ -174,36 +178,36 @@ public:
|
||||
public:
|
||||
|
||||
//- Construct given addressing
|
||||
processorSurfacePatchFieldDecomposer
|
||||
explicit processorSurfacePatchFieldDecomposer
|
||||
(
|
||||
const labelUList& addressingSlice
|
||||
);
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
label size() const
|
||||
label size() const noexcept
|
||||
{
|
||||
return addressing_.size();
|
||||
}
|
||||
|
||||
bool direct() const
|
||||
bool direct() const noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//- Are there unmapped values
|
||||
bool hasUnmapped() const
|
||||
bool hasUnmapped() const noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const labelListList& addressing() const
|
||||
const labelListList& addressing() const noexcept
|
||||
{
|
||||
return addressing_;
|
||||
}
|
||||
|
||||
const scalarListList& weights() const
|
||||
const scalarListList& weights() const noexcept
|
||||
{
|
||||
return weights_;
|
||||
}
|
||||
@ -218,13 +222,13 @@ private:
|
||||
const fvMesh& procMesh_;
|
||||
|
||||
//- Reference to face addressing
|
||||
const labelList& faceAddressing_;
|
||||
const labelUList& faceAddressing_;
|
||||
|
||||
//- Reference to cell addressing
|
||||
const labelList& cellAddressing_;
|
||||
const labelUList& cellAddressing_;
|
||||
|
||||
//- Reference to boundary addressing
|
||||
const labelList& boundaryAddressing_;
|
||||
const labelUList& boundaryAddressing_;
|
||||
|
||||
//- List of patch field decomposers
|
||||
PtrList<patchFieldDecomposer> patchFieldDecomposerPtrs_;
|
||||
@ -248,10 +252,6 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
// Public Classes
|
||||
class fieldsCache;
|
||||
|
||||
|
||||
// Static Data
|
||||
|
||||
//- Output verbosity when writing
|
||||
@ -263,11 +263,11 @@ public:
|
||||
//- Construct without mappers, added later with reset()
|
||||
fvFieldDecomposer
|
||||
(
|
||||
const Foam::zero,
|
||||
Foam::zero,
|
||||
const fvMesh& procMesh,
|
||||
const labelList& faceAddressing,
|
||||
const labelList& cellAddressing,
|
||||
const labelList& boundaryAddressing
|
||||
const labelUList& faceAddressing,
|
||||
const labelUList& cellAddressing,
|
||||
const labelUList& boundaryAddressing
|
||||
);
|
||||
|
||||
//- Construct from components using information from the complete mesh
|
||||
@ -275,24 +275,24 @@ public:
|
||||
(
|
||||
const fvMesh& completeMesh,
|
||||
const fvMesh& procMesh,
|
||||
const labelList& faceAddressing,
|
||||
const labelList& cellAddressing,
|
||||
const labelList& boundaryAddressing
|
||||
const labelUList& faceAddressing,
|
||||
const labelUList& cellAddressing,
|
||||
const labelUList& boundaryAddressing
|
||||
);
|
||||
|
||||
//- Construct from components without the complete mesh
|
||||
fvFieldDecomposer
|
||||
(
|
||||
// Information about the complete mesh
|
||||
const List<labelRange>& boundaryRanges,
|
||||
const UList<labelRange>& boundaryRanges,
|
||||
const labelUList& faceOwner,
|
||||
const labelUList& faceNeigbour,
|
||||
|
||||
// Addressing for processor mesh
|
||||
const fvMesh& procMesh,
|
||||
const labelList& faceAddressing,
|
||||
const labelList& cellAddressing,
|
||||
const labelList& boundaryAddressing
|
||||
const labelUList& faceAddressing,
|
||||
const labelUList& cellAddressing,
|
||||
const labelUList& boundaryAddressing
|
||||
);
|
||||
|
||||
|
||||
@ -303,7 +303,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- True if no mappers have been allocated
|
||||
bool empty() const;
|
||||
bool empty() const noexcept;
|
||||
|
||||
//- Remove all mappers
|
||||
void clear();
|
||||
@ -314,7 +314,7 @@ public:
|
||||
//- Reset mapper using information about the complete mesh
|
||||
void reset
|
||||
(
|
||||
const List<labelRange>& boundaryRanges,
|
||||
const UList<labelRange>& boundaryRanges,
|
||||
const labelUList& faceOwner,
|
||||
const labelUList& faceNeigbour
|
||||
);
|
||||
@ -349,7 +349,7 @@ public:
|
||||
|
||||
//- Decompose list of fields
|
||||
template<class GeoField>
|
||||
void decomposeFields(const PtrList<GeoField>& fields) const;
|
||||
void decomposeFields(const UPtrList<GeoField>& fields) const;
|
||||
};
|
||||
|
||||
|
||||
@ -359,21 +359,14 @@ public:
|
||||
|
||||
class fvFieldDecomposer::fieldsCache
|
||||
{
|
||||
// Private Data
|
||||
class privateCache;
|
||||
std::unique_ptr<privateCache> cache_;
|
||||
|
||||
class privateCache;
|
||||
//- No copy construct
|
||||
fieldsCache(const fieldsCache&) = delete;
|
||||
|
||||
//- All field and field-field types for lagrangian
|
||||
std::unique_ptr<privateCache> cache_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
fieldsCache(const fieldsCache&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const fieldsCache&) = delete;
|
||||
//- No copy assignment
|
||||
void operator=(const fieldsCache&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
@ -391,10 +384,10 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- No fields
|
||||
bool empty() const;
|
||||
bool empty() const noexcept;
|
||||
|
||||
//- Total number of fields
|
||||
label size() const;
|
||||
label size() const noexcept;
|
||||
|
||||
//- Clear out
|
||||
void clear();
|
||||
@ -423,7 +416,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "fvFieldDecomposerTemplates.C"
|
||||
#include "fvFieldDecomposer.txx"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -135,22 +135,17 @@ processorSurfacePatchFieldDecomposer
|
||||
|
||||
Foam::fvFieldDecomposer::fvFieldDecomposer
|
||||
(
|
||||
const Foam::zero,
|
||||
Foam::zero,
|
||||
const fvMesh& procMesh,
|
||||
const labelList& faceAddressing,
|
||||
const labelList& cellAddressing,
|
||||
const labelList& boundaryAddressing
|
||||
const labelUList& faceAddressing,
|
||||
const labelUList& cellAddressing,
|
||||
const labelUList& boundaryAddressing
|
||||
)
|
||||
:
|
||||
procMesh_(procMesh),
|
||||
faceAddressing_(faceAddressing),
|
||||
cellAddressing_(cellAddressing),
|
||||
boundaryAddressing_(boundaryAddressing),
|
||||
// Mappers
|
||||
patchFieldDecomposerPtrs_(),
|
||||
processorVolPatchFieldDecomposerPtrs_(),
|
||||
processorSurfacePatchFieldDecomposerPtrs_(),
|
||||
faceSign_()
|
||||
boundaryAddressing_(boundaryAddressing)
|
||||
{}
|
||||
|
||||
|
||||
@ -158,14 +153,14 @@ Foam::fvFieldDecomposer::fvFieldDecomposer
|
||||
(
|
||||
const fvMesh& completeMesh,
|
||||
const fvMesh& procMesh,
|
||||
const labelList& faceAddressing,
|
||||
const labelList& cellAddressing,
|
||||
const labelList& boundaryAddressing
|
||||
const labelUList& faceAddressing,
|
||||
const labelUList& cellAddressing,
|
||||
const labelUList& boundaryAddressing
|
||||
)
|
||||
:
|
||||
fvFieldDecomposer
|
||||
(
|
||||
zero{},
|
||||
Foam::zero{},
|
||||
procMesh,
|
||||
faceAddressing,
|
||||
cellAddressing,
|
||||
@ -178,19 +173,19 @@ Foam::fvFieldDecomposer::fvFieldDecomposer
|
||||
|
||||
Foam::fvFieldDecomposer::fvFieldDecomposer
|
||||
(
|
||||
const List<labelRange>& boundaryRanges,
|
||||
const UList<labelRange>& boundaryRanges,
|
||||
const labelUList& faceOwner,
|
||||
const labelUList& faceNeighbour,
|
||||
|
||||
const fvMesh& procMesh,
|
||||
const labelList& faceAddressing,
|
||||
const labelList& cellAddressing,
|
||||
const labelList& boundaryAddressing
|
||||
const labelUList& faceAddressing,
|
||||
const labelUList& cellAddressing,
|
||||
const labelUList& boundaryAddressing
|
||||
)
|
||||
:
|
||||
fvFieldDecomposer
|
||||
(
|
||||
zero{},
|
||||
Foam::zero{},
|
||||
procMesh,
|
||||
faceAddressing,
|
||||
cellAddressing,
|
||||
@ -203,7 +198,7 @@ Foam::fvFieldDecomposer::fvFieldDecomposer
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::fvFieldDecomposer::empty() const
|
||||
bool Foam::fvFieldDecomposer::empty() const noexcept
|
||||
{
|
||||
return patchFieldDecomposerPtrs_.empty();
|
||||
}
|
||||
@ -220,17 +215,17 @@ void Foam::fvFieldDecomposer::clear()
|
||||
|
||||
void Foam::fvFieldDecomposer::reset
|
||||
(
|
||||
const List<labelRange>& boundaryRanges,
|
||||
const UList<labelRange>& boundaryRanges,
|
||||
const labelUList& faceOwner,
|
||||
const labelUList& faceNeighbour
|
||||
)
|
||||
{
|
||||
clear();
|
||||
const label nMappers = procMesh_.boundary().size();
|
||||
patchFieldDecomposerPtrs_.resize(nMappers);
|
||||
processorVolPatchFieldDecomposerPtrs_.resize(nMappers);
|
||||
processorSurfacePatchFieldDecomposerPtrs_.resize(nMappers);
|
||||
faceSign_.resize(nMappers);
|
||||
|
||||
patchFieldDecomposerPtrs_.resize_null(nMappers);
|
||||
processorVolPatchFieldDecomposerPtrs_.resize_null(nMappers);
|
||||
processorSurfacePatchFieldDecomposerPtrs_.resize_null(nMappers);
|
||||
faceSign_.resize_null(nMappers);
|
||||
|
||||
forAll(boundaryAddressing_, patchi)
|
||||
{
|
||||
@ -270,10 +265,7 @@ void Foam::fvFieldDecomposer::reset
|
||||
processorSurfacePatchFieldDecomposerPtrs_.set
|
||||
(
|
||||
patchi,
|
||||
new processorSurfacePatchFieldDecomposer
|
||||
(
|
||||
static_cast<const labelUList&>(localPatchSlice)
|
||||
)
|
||||
new processorSurfacePatchFieldDecomposer(localPatchSlice)
|
||||
);
|
||||
|
||||
faceSign_.set
|
||||
@ -296,12 +288,12 @@ void Foam::fvFieldDecomposer::reset
|
||||
|
||||
void Foam::fvFieldDecomposer::reset(const fvMesh& completeMesh)
|
||||
{
|
||||
clear();
|
||||
const label nMappers = procMesh_.boundary().size();
|
||||
patchFieldDecomposerPtrs_.resize(nMappers);
|
||||
processorVolPatchFieldDecomposerPtrs_.resize(nMappers);
|
||||
processorSurfacePatchFieldDecomposerPtrs_.resize(nMappers);
|
||||
faceSign_.resize(nMappers);
|
||||
|
||||
patchFieldDecomposerPtrs_.resize_null(nMappers);
|
||||
processorVolPatchFieldDecomposerPtrs_.resize_null(nMappers);
|
||||
processorSurfacePatchFieldDecomposerPtrs_.resize_null(nMappers);
|
||||
faceSign_.resize_null(nMappers);
|
||||
|
||||
forAll(boundaryAddressing_, patchi)
|
||||
{
|
||||
@ -340,10 +332,7 @@ void Foam::fvFieldDecomposer::reset(const fvMesh& completeMesh)
|
||||
processorSurfacePatchFieldDecomposerPtrs_.set
|
||||
(
|
||||
patchi,
|
||||
new processorSurfacePatchFieldDecomposer
|
||||
(
|
||||
static_cast<const labelUList&>(localPatchSlice)
|
||||
)
|
||||
new processorSurfacePatchFieldDecomposer(localPatchSlice)
|
||||
);
|
||||
|
||||
faceSign_.set
|
||||
@ -295,7 +295,7 @@ Foam::fvFieldDecomposer::decomposeField
|
||||
template<class GeoField>
|
||||
void Foam::fvFieldDecomposer::decomposeFields
|
||||
(
|
||||
const PtrList<GeoField>& fields
|
||||
const UPtrList<GeoField>& fields
|
||||
) const
|
||||
{
|
||||
for (const auto& fld : fields)
|
||||
@ -119,7 +119,7 @@ public:
|
||||
static void decompose
|
||||
(
|
||||
const fvFieldDecomposer& decomposer,
|
||||
const PtrList<GeoField>& fields,
|
||||
const UPtrList<GeoField>& fields,
|
||||
bool report
|
||||
)
|
||||
{
|
||||
@ -181,13 +181,13 @@ Foam::fvFieldDecomposer::fieldsCache::~fieldsCache()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::fvFieldDecomposer::fieldsCache::empty() const
|
||||
bool Foam::fvFieldDecomposer::fieldsCache::empty() const noexcept
|
||||
{
|
||||
return (!cache_ || cache_->empty());
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::fvFieldDecomposer::fieldsCache::size() const
|
||||
Foam::label Foam::fvFieldDecomposer::fieldsCache::size() const noexcept
|
||||
{
|
||||
return (cache_ ? cache_->size() : label(0));
|
||||
}
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
Copyright (C) 2022-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,10 +31,9 @@ Description
|
||||
Lagrangian field decomposer.
|
||||
|
||||
SourceFiles
|
||||
lagrangianFieldDecomposer.C
|
||||
lagrangianFieldDecomposerCache.C
|
||||
lagrangianFieldDecomposerReadFields.C
|
||||
lagrangianFieldDecomposerTemplates.C
|
||||
lagrangianFieldDecomposer.cxx
|
||||
lagrangianFieldDecomposer.txx
|
||||
lagrangianFieldDecomposerCache.cxx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -92,13 +91,13 @@ public:
|
||||
//- Construct from components
|
||||
lagrangianFieldDecomposer
|
||||
(
|
||||
const polyMesh& mesh, //<! unused
|
||||
const polyMesh& mesh, //!< unused
|
||||
const polyMesh& procMesh,
|
||||
const labelList& faceProcAddressing,
|
||||
const labelList& cellProcAddressing,
|
||||
const labelUList& faceProcAddressing,
|
||||
const labelUList& cellProcAddressing,
|
||||
const word& cloudName,
|
||||
const Cloud<indexedParticle>& lagrangianPositions,
|
||||
const List<SLList<indexedParticle*>*>& cellParticles
|
||||
const UList<SLList<indexedParticle*>*>& cellParticles
|
||||
);
|
||||
|
||||
|
||||
@ -125,7 +124,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Decompose volume field
|
||||
//- Decompose field
|
||||
template<class Type>
|
||||
tmp<IOField<Type>> decomposeField
|
||||
(
|
||||
@ -133,6 +132,7 @@ public:
|
||||
const IOField<Type>& field
|
||||
) const;
|
||||
|
||||
//- Decompose field-field
|
||||
template<class Type>
|
||||
tmp<CompactIOField<Field<Type>>> decomposeFieldField
|
||||
(
|
||||
@ -141,18 +141,20 @@ public:
|
||||
) const;
|
||||
|
||||
|
||||
//- Decompose fields
|
||||
template<class GeoField>
|
||||
void decomposeFields
|
||||
(
|
||||
const word& cloudName,
|
||||
const PtrList<GeoField>& fields
|
||||
const UPtrList<GeoField>& fields
|
||||
) const;
|
||||
|
||||
//- Decompose field-fields
|
||||
template<class GeoField>
|
||||
void decomposeFieldFields
|
||||
(
|
||||
const word& cloudName,
|
||||
const PtrList<GeoField>& fields
|
||||
const UPtrList<GeoField>& fields
|
||||
) const;
|
||||
};
|
||||
|
||||
@ -163,21 +165,14 @@ public:
|
||||
|
||||
class lagrangianFieldDecomposer::fieldsCache
|
||||
{
|
||||
// Private Data
|
||||
class privateCache;
|
||||
std::unique_ptr<privateCache> cache_;
|
||||
|
||||
class privateCache;
|
||||
//- No copy construct
|
||||
fieldsCache(const fieldsCache&) = delete;
|
||||
|
||||
//- All field and field-field types for lagrangian
|
||||
std::unique_ptr<privateCache> cache_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
fieldsCache(const fieldsCache&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const fieldsCache&) = delete;
|
||||
//- No copy assignment
|
||||
void operator=(const fieldsCache&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
@ -188,7 +183,7 @@ public:
|
||||
fieldsCache();
|
||||
|
||||
//- Construct for given number of clouds
|
||||
explicit fieldsCache(const label nClouds);
|
||||
explicit fieldsCache(label nClouds);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -198,16 +193,16 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- No clouds
|
||||
bool empty() const;
|
||||
bool empty() const noexcept;
|
||||
|
||||
//- Number of clouds
|
||||
label size() const;
|
||||
label size() const noexcept;
|
||||
|
||||
//- Clear out
|
||||
void clear();
|
||||
|
||||
//- Resize for the number of clouds
|
||||
void resize(const label nClouds);
|
||||
void resize(label nClouds);
|
||||
|
||||
|
||||
//- Read all fields and field-fields for given cloud and objects
|
||||
@ -235,8 +230,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "lagrangianFieldDecomposerReadFields.C"
|
||||
#include "lagrangianFieldDecomposerTemplates.C"
|
||||
#include "lagrangianFieldDecomposer.txx"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -23,9 +24,6 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Lagrangian field decomposer.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "lagrangianFieldDecomposer.H"
|
||||
@ -36,11 +34,11 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const polyMesh& procMesh,
|
||||
const labelList& faceProcAddressing,
|
||||
const labelList& cellProcAddressing,
|
||||
const labelUList& faceProcAddressing,
|
||||
const labelUList& cellProcAddressing,
|
||||
const word& cloudName,
|
||||
const Cloud<indexedParticle>& lagrangianPositions,
|
||||
const List<SLList<indexedParticle*>*>& cellParticles
|
||||
const UList<SLList<indexedParticle*>*>& cellParticles
|
||||
)
|
||||
:
|
||||
procMesh_(procMesh),
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
Copyright (C) 2022-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,6 +31,64 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::lagrangianFieldDecomposer::readFields
|
||||
(
|
||||
const label cloudi,
|
||||
const IOobjectList& lagrangianObjects,
|
||||
PtrList<PtrList<IOField<Type>>>& lagrangianFields
|
||||
)
|
||||
{
|
||||
// Lagrangian field objects
|
||||
const UPtrList<const IOobject> fieldObjects
|
||||
(
|
||||
lagrangianObjects.csorted<IOField<Type>>()
|
||||
);
|
||||
|
||||
|
||||
auto& cloudFields =
|
||||
lagrangianFields.emplace_set(cloudi, fieldObjects.size());
|
||||
|
||||
forAll(fieldObjects, fieldi)
|
||||
{
|
||||
cloudFields.emplace_set(fieldi, fieldObjects[fieldi]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::lagrangianFieldDecomposer::readFieldFields
|
||||
(
|
||||
const label cloudi,
|
||||
const IOobjectList& lagrangianObjects,
|
||||
PtrList<PtrList<CompactIOField<Field<Type>>>>& lagrangianFields
|
||||
)
|
||||
{
|
||||
// Lagrangian field objects
|
||||
UPtrList<const IOobject> fieldObjects
|
||||
(
|
||||
lagrangianObjects.cobjects<IOField<Field<Type>>>()
|
||||
);
|
||||
|
||||
// Lagrangian field-field objects
|
||||
fieldObjects.push_back
|
||||
(
|
||||
lagrangianObjects.cobjects<CompactIOField<Field<Type>>>()
|
||||
);
|
||||
|
||||
Foam::sort(fieldObjects, nameOp<IOobject>());
|
||||
|
||||
|
||||
auto& cloudFields =
|
||||
lagrangianFields.emplace_set(cloudi, fieldObjects.size());
|
||||
|
||||
forAll(fieldObjects, fieldi)
|
||||
{
|
||||
cloudFields.emplace_set(fieldi, fieldObjects[fieldi]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::IOField<Type>>
|
||||
Foam::lagrangianFieldDecomposer::decomposeField
|
||||
@ -89,10 +147,10 @@ template<class GeoField>
|
||||
void Foam::lagrangianFieldDecomposer::decomposeFields
|
||||
(
|
||||
const word& cloudName,
|
||||
const PtrList<GeoField>& fields
|
||||
const UPtrList<GeoField>& fields
|
||||
) const
|
||||
{
|
||||
const bool existsOnProc = (particleIndices_.size() > 0);
|
||||
const bool existsOnProc = (!particleIndices_.empty());
|
||||
|
||||
for (const GeoField& fld : fields)
|
||||
{
|
||||
@ -105,10 +163,10 @@ template<class GeoField>
|
||||
void Foam::lagrangianFieldDecomposer::decomposeFieldFields
|
||||
(
|
||||
const word& cloudName,
|
||||
const PtrList<GeoField>& fields
|
||||
const UPtrList<GeoField>& fields
|
||||
) const
|
||||
{
|
||||
const bool existsOnProc = (particleIndices_.size() > 0);
|
||||
const bool existsOnProc = (!particleIndices_.empty());
|
||||
|
||||
for (const GeoField& fld : fields)
|
||||
{
|
||||
@ -160,10 +160,7 @@ Foam::lagrangianFieldDecomposer::fieldsCache::fieldsCache()
|
||||
{}
|
||||
|
||||
|
||||
Foam::lagrangianFieldDecomposer::fieldsCache::fieldsCache
|
||||
(
|
||||
const label nClouds
|
||||
)
|
||||
Foam::lagrangianFieldDecomposer::fieldsCache::fieldsCache(label nClouds)
|
||||
:
|
||||
cache_(new privateCache)
|
||||
{
|
||||
@ -180,13 +177,13 @@ Foam::lagrangianFieldDecomposer::fieldsCache::~fieldsCache()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::lagrangianFieldDecomposer::fieldsCache::empty() const
|
||||
bool Foam::lagrangianFieldDecomposer::fieldsCache::empty() const noexcept
|
||||
{
|
||||
return (!cache_ || cache_->empty());
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::lagrangianFieldDecomposer::fieldsCache::size() const
|
||||
Foam::label Foam::lagrangianFieldDecomposer::fieldsCache::size() const noexcept
|
||||
{
|
||||
return (cache_ ? cache_->size() : label(0));
|
||||
}
|
||||
@ -198,10 +195,7 @@ void Foam::lagrangianFieldDecomposer::fieldsCache::clear()
|
||||
}
|
||||
|
||||
|
||||
void Foam::lagrangianFieldDecomposer::fieldsCache::resize
|
||||
(
|
||||
const label nClouds
|
||||
)
|
||||
void Foam::lagrangianFieldDecomposer::fieldsCache::resize(label nClouds)
|
||||
{
|
||||
if (cache_)
|
||||
{
|
||||
@ -1,90 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2022-2023 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 "lagrangianFieldDecomposer.H"
|
||||
#include "IOobjectList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::lagrangianFieldDecomposer::readFields
|
||||
(
|
||||
const label cloudi,
|
||||
const IOobjectList& lagrangianObjects,
|
||||
PtrList<PtrList<IOField<Type>>>& lagrangianFields
|
||||
)
|
||||
{
|
||||
// List of lagrangian field objects
|
||||
const UPtrList<const IOobject> fieldObjects
|
||||
(
|
||||
lagrangianObjects.csorted<IOField<Type>>()
|
||||
);
|
||||
|
||||
auto& cloudFields =
|
||||
lagrangianFields.emplace_set(cloudi, fieldObjects.size());
|
||||
|
||||
forAll(fieldObjects, fieldi)
|
||||
{
|
||||
cloudFields.emplace_set(fieldi, fieldObjects[fieldi]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::lagrangianFieldDecomposer::readFieldFields
|
||||
(
|
||||
const label cloudi,
|
||||
const IOobjectList& lagrangianObjects,
|
||||
PtrList<PtrList<CompactIOField<Field<Type>>>>& lagrangianFields
|
||||
)
|
||||
{
|
||||
// List of lagrangian field objects
|
||||
UPtrList<const IOobject> fieldObjects
|
||||
(
|
||||
lagrangianObjects.cobjects<IOField<Field<Type>>>()
|
||||
);
|
||||
|
||||
fieldObjects.push_back
|
||||
(
|
||||
lagrangianObjects.cobjects<CompactIOField<Field<Type>>>()
|
||||
);
|
||||
|
||||
Foam::sort(fieldObjects, nameOp<IOobject>());
|
||||
|
||||
|
||||
auto& cloudFields =
|
||||
lagrangianFields.emplace_set(cloudi, fieldObjects.size());
|
||||
|
||||
forAll(fieldObjects, fieldi)
|
||||
{
|
||||
cloudFields.emplace_set(fieldi, fieldObjects[fieldi]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,9 +31,9 @@ Description
|
||||
Point field decomposer.
|
||||
|
||||
SourceFiles
|
||||
pointFieldDecomposer.C
|
||||
pointFieldDecomposerCache.C
|
||||
pointFieldDecomposerTemplates.C
|
||||
pointFieldDecomposer.cxx
|
||||
pointFieldDecomposer.txx
|
||||
pointFieldDecomposerCache.cxx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -41,8 +41,8 @@ SourceFiles
|
||||
#define Foam_pointFieldDecomposer_H
|
||||
|
||||
#include "pointMesh.H"
|
||||
#include "pointPatchFieldMapperPatchRef.H"
|
||||
#include "pointFields.H"
|
||||
#include "pointPatchFieldMapper.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -62,12 +62,15 @@ public:
|
||||
|
||||
// Public Classes
|
||||
|
||||
//- Internal caching for field reading
|
||||
class fieldsCache;
|
||||
|
||||
//- Point patch field decomposer class
|
||||
class patchFieldDecomposer
|
||||
:
|
||||
public pointPatchFieldMapperPatchRef
|
||||
public pointPatchFieldMapper
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
labelList directAddressing_;
|
||||
|
||||
@ -83,28 +86,28 @@ public:
|
||||
(
|
||||
const pointPatch& completeMeshPatch,
|
||||
const pointPatch& procMeshPatch,
|
||||
const labelList& directAddr
|
||||
const labelUList& directAddr
|
||||
);
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
label size() const
|
||||
label size() const noexcept
|
||||
{
|
||||
return directAddressing_.size();
|
||||
}
|
||||
|
||||
bool direct() const
|
||||
bool direct() const noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hasUnmapped() const
|
||||
bool hasUnmapped() const noexcept
|
||||
{
|
||||
return hasUnmapped_;
|
||||
}
|
||||
|
||||
const labelUList& directAddressing() const
|
||||
const labelUList& directAddressing() const noexcept
|
||||
{
|
||||
return directAddressing_;
|
||||
}
|
||||
@ -119,27 +122,22 @@ private:
|
||||
const pointMesh& procMesh_;
|
||||
|
||||
//- Reference to point addressing
|
||||
const labelList& pointAddressing_;
|
||||
const labelUList& pointAddressing_;
|
||||
|
||||
//- Reference to boundary addressing
|
||||
const labelList& boundaryAddressing_;
|
||||
const labelUList& boundaryAddressing_;
|
||||
|
||||
//- List of patch field decomposers
|
||||
PtrList<patchFieldDecomposer> patchFieldDecomposerPtrs_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
pointFieldDecomposer(const pointFieldDecomposer&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const pointFieldDecomposer&) = delete;
|
||||
|
||||
public:
|
||||
|
||||
// Public Classes
|
||||
class fieldsCache;
|
||||
//- No copy construct
|
||||
pointFieldDecomposer(const pointFieldDecomposer&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const pointFieldDecomposer&) = delete;
|
||||
|
||||
|
||||
// Constructors
|
||||
@ -147,10 +145,10 @@ public:
|
||||
//- Construct without mappers, added later with reset()
|
||||
pointFieldDecomposer
|
||||
(
|
||||
const Foam::zero,
|
||||
Foam::zero,
|
||||
const pointMesh& procMesh,
|
||||
const labelList& pointAddressing,
|
||||
const labelList& boundaryAddressing
|
||||
const labelUList& pointAddressing,
|
||||
const labelUList& boundaryAddressing
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
@ -158,8 +156,8 @@ public:
|
||||
(
|
||||
const pointMesh& completeMesh,
|
||||
const pointMesh& procMesh,
|
||||
const labelList& pointAddressing,
|
||||
const labelList& boundaryAddressing
|
||||
const labelUList& pointAddressing,
|
||||
const labelUList& boundaryAddressing
|
||||
);
|
||||
|
||||
|
||||
@ -170,7 +168,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- True if no mappers have been allocated
|
||||
bool empty() const;
|
||||
bool empty() const noexcept;
|
||||
|
||||
//- Remove all mappers
|
||||
void clear();
|
||||
@ -191,7 +189,7 @@ public:
|
||||
|
||||
//- Decompose list of fields
|
||||
template<class GeoField>
|
||||
void decomposeFields(const PtrList<GeoField>& fields) const;
|
||||
void decomposeFields(const UPtrList<GeoField>& fields) const;
|
||||
};
|
||||
|
||||
|
||||
@ -201,21 +199,14 @@ public:
|
||||
|
||||
class pointFieldDecomposer::fieldsCache
|
||||
{
|
||||
// Private Data
|
||||
class privateCache;
|
||||
std::unique_ptr<privateCache> cache_;
|
||||
|
||||
class privateCache;
|
||||
//- No copy construct
|
||||
fieldsCache(const fieldsCache&) = delete;
|
||||
|
||||
//- All field and field-field types for lagrangian
|
||||
std::unique_ptr<privateCache> cache_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
fieldsCache(const fieldsCache&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const fieldsCache&) = delete;
|
||||
//- No copy assignment
|
||||
void operator=(const fieldsCache&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
@ -233,10 +224,10 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- No fields
|
||||
bool empty() const;
|
||||
bool empty() const noexcept;
|
||||
|
||||
//- Total number of fields
|
||||
label size() const;
|
||||
label size() const noexcept;
|
||||
|
||||
//- Clear out
|
||||
void clear();
|
||||
@ -265,7 +256,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "pointFieldDecomposerTemplates.C"
|
||||
#include "pointFieldDecomposer.txx"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,21 +34,16 @@ Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
|
||||
(
|
||||
const pointPatch& completeMeshPatch,
|
||||
const pointPatch& procMeshPatch,
|
||||
const labelList& directAddr
|
||||
const labelUList& directAddr
|
||||
)
|
||||
:
|
||||
pointPatchFieldMapperPatchRef
|
||||
(
|
||||
completeMeshPatch,
|
||||
procMeshPatch
|
||||
),
|
||||
directAddressing_(procMeshPatch.size(), -1),
|
||||
hasUnmapped_(false)
|
||||
{
|
||||
// Create the inverse-addressing of the patch point labels.
|
||||
labelList pointMap(completeMeshPatch.boundaryMesh().mesh().size(), -1);
|
||||
|
||||
const labelList& completeMeshPatchPoints = completeMeshPatch.meshPoints();
|
||||
const labelUList& completeMeshPatchPoints = completeMeshPatch.meshPoints();
|
||||
|
||||
forAll(completeMeshPatchPoints, pointi)
|
||||
{
|
||||
@ -57,7 +52,7 @@ Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
|
||||
|
||||
// Use the inverse point addressing to create the addressing table for this
|
||||
// patch
|
||||
const labelList& procMeshPatchPoints = procMeshPatch.meshPoints();
|
||||
const labelUList& procMeshPatchPoints = procMeshPatch.meshPoints();
|
||||
|
||||
forAll(procMeshPatchPoints, pointi)
|
||||
{
|
||||
@ -66,7 +61,7 @@ Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
|
||||
}
|
||||
|
||||
// Check that all the patch point addresses are set
|
||||
if (directAddressing_.size() && min(directAddressing_) < 0)
|
||||
if (directAddressing_.contains(-1))
|
||||
{
|
||||
hasUnmapped_ = true;
|
||||
|
||||
@ -79,17 +74,15 @@ Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
|
||||
|
||||
Foam::pointFieldDecomposer::pointFieldDecomposer
|
||||
(
|
||||
const Foam::zero,
|
||||
Foam::zero,
|
||||
const pointMesh& procMesh,
|
||||
const labelList& pointAddressing,
|
||||
const labelList& boundaryAddressing
|
||||
const labelUList& pointAddressing,
|
||||
const labelUList& boundaryAddressing
|
||||
)
|
||||
:
|
||||
procMesh_(procMesh),
|
||||
pointAddressing_(pointAddressing),
|
||||
boundaryAddressing_(boundaryAddressing),
|
||||
// Mappers
|
||||
patchFieldDecomposerPtrs_()
|
||||
boundaryAddressing_(boundaryAddressing)
|
||||
{}
|
||||
|
||||
|
||||
@ -97,13 +90,13 @@ Foam::pointFieldDecomposer::pointFieldDecomposer
|
||||
(
|
||||
const pointMesh& completeMesh,
|
||||
const pointMesh& procMesh,
|
||||
const labelList& pointAddressing,
|
||||
const labelList& boundaryAddressing
|
||||
const labelUList& pointAddressing,
|
||||
const labelUList& boundaryAddressing
|
||||
)
|
||||
:
|
||||
pointFieldDecomposer
|
||||
(
|
||||
zero{},
|
||||
Foam::zero{},
|
||||
procMesh,
|
||||
pointAddressing,
|
||||
boundaryAddressing
|
||||
@ -115,7 +108,7 @@ Foam::pointFieldDecomposer::pointFieldDecomposer
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::pointFieldDecomposer::empty() const
|
||||
bool Foam::pointFieldDecomposer::empty() const noexcept
|
||||
{
|
||||
return patchFieldDecomposerPtrs_.empty();
|
||||
}
|
||||
@ -132,9 +125,9 @@ void Foam::pointFieldDecomposer::reset
|
||||
const pointMesh& completeMesh
|
||||
)
|
||||
{
|
||||
clear();
|
||||
const label nMappers = procMesh_.boundary().size();
|
||||
patchFieldDecomposerPtrs_.resize(nMappers);
|
||||
|
||||
patchFieldDecomposerPtrs_.resize_null(nMappers);
|
||||
|
||||
forAll(boundaryAddressing_, patchi)
|
||||
{
|
||||
@ -90,7 +90,7 @@ Foam::pointFieldDecomposer::decomposeField
|
||||
template<class GeoField>
|
||||
void Foam::pointFieldDecomposer::decomposeFields
|
||||
(
|
||||
const PtrList<GeoField>& fields
|
||||
const UPtrList<GeoField>& fields
|
||||
) const
|
||||
{
|
||||
for (const auto& fld : fields)
|
||||
@ -101,7 +101,7 @@ public:
|
||||
static void decompose
|
||||
(
|
||||
const pointFieldDecomposer& decomposer,
|
||||
const PtrList<GeoField>& fields,
|
||||
const UPtrList<GeoField>& fields,
|
||||
bool report
|
||||
)
|
||||
{
|
||||
@ -161,13 +161,13 @@ Foam::pointFieldDecomposer::fieldsCache::~fieldsCache()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::pointFieldDecomposer::fieldsCache::empty() const
|
||||
bool Foam::pointFieldDecomposer::fieldsCache::empty() const noexcept
|
||||
{
|
||||
return (!cache_ || cache_->empty());
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::pointFieldDecomposer::fieldsCache::size() const
|
||||
Foam::label Foam::pointFieldDecomposer::fieldsCache::size() const noexcept
|
||||
{
|
||||
return (cache_ ? cache_->size() : label(0));
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
processorMeshes.C
|
||||
fvFieldReconstructor.C
|
||||
pointFieldReconstructor.C
|
||||
passivePositionParticleCloud.C
|
||||
lagrangianReconstructor.C
|
||||
processorMeshes.cxx
|
||||
fvFieldReconstructor.cxx
|
||||
pointFieldReconstructor.cxx
|
||||
passivePositionParticleCloud.cxx
|
||||
lagrangianReconstructor.cxx
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libreconstruct
|
||||
|
||||
@ -31,8 +31,8 @@ Description
|
||||
Finite volume reconstructor for volume and surface fields.
|
||||
|
||||
SourceFiles
|
||||
fvFieldReconstructor.C
|
||||
fvFieldReconstructorTemplates.C
|
||||
fvFieldReconstructor.cxx
|
||||
fvFieldReconstructor.txx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -62,16 +62,16 @@ class fvFieldReconstructor
|
||||
fvMesh& mesh_;
|
||||
|
||||
//- List of processor meshes
|
||||
const PtrList<fvMesh>& procMeshes_;
|
||||
const UPtrList<fvMesh>& procMeshes_;
|
||||
|
||||
//- List of processor face addressing lists
|
||||
const PtrList<labelIOList>& faceProcAddressing_;
|
||||
const UPtrList<labelIOList>& faceProcAddressing_;
|
||||
|
||||
//- List of processor cell addressing lists
|
||||
const PtrList<labelIOList>& cellProcAddressing_;
|
||||
const UPtrList<labelIOList>& cellProcAddressing_;
|
||||
|
||||
//- List of processor boundary addressing lists
|
||||
const PtrList<labelIOList>& boundaryProcAddressing_;
|
||||
const UPtrList<labelIOList>& boundaryProcAddressing_;
|
||||
|
||||
//- Number of fields reconstructed
|
||||
label nReconstructed_;
|
||||
@ -144,10 +144,10 @@ public:
|
||||
fvFieldReconstructor
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const PtrList<fvMesh>& procMeshes,
|
||||
const PtrList<labelIOList>& faceProcAddressing,
|
||||
const PtrList<labelIOList>& cellProcAddressing,
|
||||
const PtrList<labelIOList>& boundaryProcAddressing
|
||||
const UPtrList<fvMesh>& procMeshes,
|
||||
const UPtrList<labelIOList>& faceProcAddressing,
|
||||
const UPtrList<labelIOList>& cellProcAddressing,
|
||||
const UPtrList<labelIOList>& boundaryProcAddressing
|
||||
);
|
||||
|
||||
|
||||
@ -165,7 +165,7 @@ public:
|
||||
reconstructField
|
||||
(
|
||||
const IOobject& fieldObject,
|
||||
const PtrList<DimensionedField<Type, volMesh>>& procFields
|
||||
const UPtrList<DimensionedField<Type, volMesh>>& procFields
|
||||
) const;
|
||||
|
||||
//- Read and reconstruct volume internal field
|
||||
@ -180,7 +180,7 @@ public:
|
||||
reconstructField
|
||||
(
|
||||
const IOobject& fieldObject,
|
||||
const PtrList<GeometricField<Type, fvPatchField, volMesh>>&
|
||||
const UPtrList<GeometricField<Type, fvPatchField, volMesh>>&
|
||||
) const;
|
||||
|
||||
//- Read and reconstruct volume field
|
||||
@ -195,7 +195,7 @@ public:
|
||||
reconstructField
|
||||
(
|
||||
const IOobject& fieldObject,
|
||||
const PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>&
|
||||
const UPtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>&
|
||||
) const;
|
||||
|
||||
//- Read and reconstruct surface field
|
||||
@ -269,7 +269,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "fvFieldReconstructorTemplates.C"
|
||||
#include "fvFieldReconstructor.txx"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -40,10 +40,10 @@ int Foam::fvFieldReconstructor::verbose_ = 1;
|
||||
Foam::fvFieldReconstructor::fvFieldReconstructor
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const PtrList<fvMesh>& procMeshes,
|
||||
const PtrList<labelIOList>& faceProcAddressing,
|
||||
const PtrList<labelIOList>& cellProcAddressing,
|
||||
const PtrList<labelIOList>& boundaryProcAddressing
|
||||
const UPtrList<fvMesh>& procMeshes,
|
||||
const UPtrList<labelIOList>& faceProcAddressing,
|
||||
const UPtrList<labelIOList>& cellProcAddressing,
|
||||
const UPtrList<labelIOList>& boundaryProcAddressing
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
@ -40,7 +40,7 @@ Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh>>
|
||||
Foam::fvFieldReconstructor::reconstructField
|
||||
(
|
||||
const IOobject& fieldObject,
|
||||
const PtrList<DimensionedField<Type, volMesh>>& procFields
|
||||
const UPtrList<DimensionedField<Type, volMesh>>& procFields
|
||||
) const
|
||||
{
|
||||
// Create the internalField
|
||||
@ -48,7 +48,7 @@ Foam::fvFieldReconstructor::reconstructField
|
||||
|
||||
forAll(procMeshes_, proci)
|
||||
{
|
||||
const DimensionedField<Type, volMesh>& procField = procFields[proci];
|
||||
const auto& procField = procFields[proci];
|
||||
|
||||
// Set the cell values in the reconstructed field
|
||||
internalField.rmap
|
||||
@ -77,7 +77,7 @@ Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
|
||||
Foam::fvFieldReconstructor::reconstructField
|
||||
(
|
||||
const IOobject& fieldObject,
|
||||
const PtrList<GeometricField<Type, fvPatchField, volMesh>>& procFields
|
||||
const UPtrList<GeometricField<Type, fvPatchField, volMesh>>& procFields
|
||||
) const
|
||||
{
|
||||
// Create the internalField
|
||||
@ -255,7 +255,7 @@ Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>>
|
||||
Foam::fvFieldReconstructor::reconstructField
|
||||
(
|
||||
const IOobject& fieldObject,
|
||||
const PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& procFields
|
||||
const UPtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& procFields
|
||||
) const
|
||||
{
|
||||
// Create the internalField
|
||||
@ -31,8 +31,8 @@ Description
|
||||
Reconstructor for lagrangian positions and fields
|
||||
|
||||
SourceFiles
|
||||
lagrangianReconstructor.C
|
||||
lagrangianReconstructorTemplates.C
|
||||
lagrangianReconstructor.cxx
|
||||
lagrangianReconstructor.txx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -59,16 +59,16 @@ class lagrangianReconstructor
|
||||
// Private Data
|
||||
|
||||
//- Mesh reference
|
||||
const fvMesh& mesh_;
|
||||
const polyMesh& mesh_;
|
||||
|
||||
//- List of processor meshes
|
||||
const PtrList<fvMesh>& procMeshes_;
|
||||
const UPtrList<fvMesh>& procMeshes_;
|
||||
|
||||
//- List of processor face addressing lists
|
||||
const PtrList<labelIOList>& faceProcAddressing_;
|
||||
const UPtrList<labelIOList>& faceProcAddressing_;
|
||||
|
||||
//- List of processor cell addressing lists
|
||||
const PtrList<labelIOList>& cellProcAddressing_;
|
||||
const UPtrList<labelIOList>& cellProcAddressing_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -93,10 +93,10 @@ public:
|
||||
//- Construct from components
|
||||
lagrangianReconstructor
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const PtrList<fvMesh>& procMeshes,
|
||||
const PtrList<labelIOList>& faceProcAddressing,
|
||||
const PtrList<labelIOList>& cellProcAddressing
|
||||
const polyMesh& mesh,
|
||||
const UPtrList<fvMesh>& procMeshes,
|
||||
const UPtrList<labelIOList>& faceProcAddressing,
|
||||
const UPtrList<labelIOList>& cellProcAddressing
|
||||
);
|
||||
|
||||
|
||||
@ -166,7 +166,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "lagrangianReconstructorTemplates.C"
|
||||
#include "lagrangianReconstructor.txx"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -38,10 +38,10 @@ int Foam::lagrangianReconstructor::verbose_ = 1;
|
||||
|
||||
Foam::lagrangianReconstructor::lagrangianReconstructor
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const PtrList<fvMesh>& procMeshes,
|
||||
const PtrList<labelIOList>& faceProcAddressing,
|
||||
const PtrList<labelIOList>& cellProcAddressing
|
||||
const polyMesh& mesh,
|
||||
const UPtrList<fvMesh>& procMeshes,
|
||||
const UPtrList<labelIOList>& faceProcAddressing,
|
||||
const UPtrList<labelIOList>& cellProcAddressing
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
@ -30,7 +30,7 @@ Description
|
||||
A Cloud of passive particles
|
||||
|
||||
SourceFiles
|
||||
passivePositionParticleCloud.C
|
||||
passivePositionParticleCloud.cxx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -79,7 +79,7 @@ public:
|
||||
passivePositionParticleCloud
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const Foam::zero,
|
||||
Foam::zero,
|
||||
const word& cloudName = cloud::defaultName
|
||||
)
|
||||
:
|
||||
|
||||
@ -31,8 +31,8 @@ Description
|
||||
Point field reconstructor.
|
||||
|
||||
SourceFiles
|
||||
pointFieldReconstructor.C
|
||||
pointFieldReconstructorTemplates.C
|
||||
pointFieldReconstructor.cxx
|
||||
pointFieldReconstructor.txx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -41,7 +41,7 @@ SourceFiles
|
||||
|
||||
#include "pointMesh.H"
|
||||
#include "pointFields.H"
|
||||
#include "pointPatchFieldMapperPatchRef.H"
|
||||
#include "pointPatchFieldMapper.H"
|
||||
#include "IOobjectList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -61,13 +61,13 @@ class pointFieldReconstructor
|
||||
const pointMesh& mesh_;
|
||||
|
||||
//- List of processor meshes
|
||||
const PtrList<pointMesh>& procMeshes_;
|
||||
const UPtrList<pointMesh>& procMeshes_;
|
||||
|
||||
//- List of processor point addressing lists
|
||||
const PtrList<labelIOList>& pointProcAddressing_;
|
||||
const UPtrList<labelIOList>& pointProcAddressing_;
|
||||
|
||||
//- List of processor boundary addressing lists
|
||||
const PtrList<labelIOList>& boundaryProcAddressing_;
|
||||
const UPtrList<labelIOList>& boundaryProcAddressing_;
|
||||
|
||||
//- Point patch addressing
|
||||
labelListListList patchPointAddressing_;
|
||||
@ -100,7 +100,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct given size
|
||||
pointPatchFieldReconstructor(const label size)
|
||||
explicit pointPatchFieldReconstructor(const label size)
|
||||
:
|
||||
size_(size)
|
||||
{}
|
||||
@ -108,22 +108,22 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
label size() const
|
||||
label size() const noexcept
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
bool direct() const
|
||||
bool direct() const noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hasUnmapped() const
|
||||
bool hasUnmapped() const noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const labelUList& directAddressing() const
|
||||
const labelUList& directAddressing() const noexcept
|
||||
{
|
||||
return labelUList::null();
|
||||
}
|
||||
@ -142,9 +142,9 @@ public:
|
||||
pointFieldReconstructor
|
||||
(
|
||||
const pointMesh& mesh,
|
||||
const PtrList<pointMesh>& procMeshes,
|
||||
const PtrList<labelIOList>& pointProcAddressing,
|
||||
const PtrList<labelIOList>& boundaryProcAddressing
|
||||
const UPtrList<pointMesh>& procMeshes,
|
||||
const UPtrList<labelIOList>& pointProcAddressing,
|
||||
const UPtrList<labelIOList>& boundaryProcAddressing
|
||||
);
|
||||
|
||||
|
||||
@ -163,7 +163,7 @@ public:
|
||||
reconstructField
|
||||
(
|
||||
const IOobject& fieldObject,
|
||||
const PtrList<GeometricField<Type, pointPatchField, pointMesh>>&
|
||||
const UPtrList<GeometricField<Type, pointPatchField, pointMesh>>&
|
||||
) const;
|
||||
|
||||
|
||||
@ -204,7 +204,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "pointFieldReconstructorTemplates.C"
|
||||
#include "pointFieldReconstructor.txx"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
Copyright (C) 2022-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,9 +39,9 @@ int Foam::pointFieldReconstructor::verbose_ = 1;
|
||||
Foam::pointFieldReconstructor::pointFieldReconstructor
|
||||
(
|
||||
const pointMesh& mesh,
|
||||
const PtrList<pointMesh>& procMeshes,
|
||||
const PtrList<labelIOList>& pointProcAddressing,
|
||||
const PtrList<labelIOList>& boundaryProcAddressing
|
||||
const UPtrList<pointMesh>& procMeshes,
|
||||
const UPtrList<labelIOList>& pointProcAddressing,
|
||||
const UPtrList<labelIOList>& boundaryProcAddressing
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
@ -59,14 +59,14 @@ Foam::pointFieldReconstructor::pointFieldReconstructor
|
||||
{
|
||||
const pointMesh& procMesh = procMeshes_[proci];
|
||||
|
||||
patchPointAddressing_[proci].setSize(procMesh.boundary().size());
|
||||
patchPointAddressing_[proci].resize(procMesh.boundary().size());
|
||||
|
||||
forAll(procMesh.boundary(), patchi)
|
||||
{
|
||||
if (boundaryProcAddressing_[proci][patchi] >= 0)
|
||||
{
|
||||
labelList& procPatchAddr = patchPointAddressing_[proci][patchi];
|
||||
procPatchAddr.setSize(procMesh.boundary()[patchi].size(), -1);
|
||||
procPatchAddr.resize(procMesh.boundary()[patchi].size(), -1);
|
||||
|
||||
const labelList& patchPointLabels =
|
||||
mesh_.boundary()[boundaryProcAddressing_[proci][patchi]]
|
||||
@ -90,7 +90,7 @@ Foam::pointFieldReconstructor::pointFieldReconstructor
|
||||
];
|
||||
}
|
||||
|
||||
if (procPatchAddr.size() && min(procPatchAddr) < 0)
|
||||
if (procPatchAddr.contains(-1))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Incomplete patch point addressing"
|
||||
@ -112,11 +112,23 @@ Foam::label Foam::pointFieldReconstructor::reconstructAllFields
|
||||
{
|
||||
label nTotal = 0;
|
||||
|
||||
nTotal += reconstructPointFields<scalar>(objects, selected);
|
||||
nTotal += reconstructPointFields<vector>(objects, selected);
|
||||
nTotal += reconstructPointFields<symmTensor>(objects, selected);
|
||||
nTotal += reconstructPointFields<sphericalTensor>(objects, selected);
|
||||
nTotal += reconstructPointFields<tensor>(objects, selected);
|
||||
do
|
||||
{
|
||||
#undef doLocalCode
|
||||
#define doLocalCode(Method) \
|
||||
{ \
|
||||
nTotal += this->Method <scalar> (objects, selected); \
|
||||
nTotal += this->Method <vector> (objects, selected); \
|
||||
nTotal += this->Method <sphericalTensor> (objects, selected); \
|
||||
nTotal += this->Method <symmTensor> (objects, selected); \
|
||||
nTotal += this->Method <tensor> (objects, selected); \
|
||||
}
|
||||
|
||||
doLocalCode(reconstructPointFields);
|
||||
|
||||
#undef doLocalCode
|
||||
}
|
||||
while (false);
|
||||
|
||||
return nTotal;
|
||||
}
|
||||
@ -35,16 +35,17 @@ Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>>
|
||||
Foam::pointFieldReconstructor::reconstructField
|
||||
(
|
||||
const IOobject& fieldObject,
|
||||
const PtrList<GeometricField<Type, pointPatchField, pointMesh>>& procFields
|
||||
const UPtrList<GeometricField<Type, pointPatchField, pointMesh>>& procFields
|
||||
) const
|
||||
{
|
||||
typedef GeometricField<Type, pointPatchField, pointMesh> fieldType;
|
||||
typedef pointPatchField<Type> patchFieldType;
|
||||
|
||||
// Create the internalField
|
||||
Field<Type> internalField(mesh_.size());
|
||||
|
||||
// Create the patch fields
|
||||
PtrList<pointPatchField<Type>> patchFields(mesh_.boundary().size());
|
||||
PtrList<patchFieldType> patchFields(mesh_.boundary().size());
|
||||
|
||||
|
||||
forAll(procMeshes_, proci)
|
||||
@ -75,11 +76,11 @@ Foam::pointFieldReconstructor::reconstructField
|
||||
patchFields.set
|
||||
(
|
||||
curBPatch,
|
||||
pointPatchField<Type>::New
|
||||
patchFieldType::New
|
||||
(
|
||||
procField.boundaryField()[patchi],
|
||||
mesh_.boundary()[curBPatch],
|
||||
pointPatchField<Type>::Internal::null(),
|
||||
patchFieldType::Internal::null(),
|
||||
pointPatchFieldReconstructor
|
||||
(
|
||||
mesh_.boundary()[curBPatch].size()
|
||||
@ -31,7 +31,7 @@ Description
|
||||
Container for processor mesh addressing.
|
||||
|
||||
SourceFiles
|
||||
processorMeshes.C
|
||||
processorMeshes.cxx
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -40,7 +40,6 @@ SourceFiles
|
||||
|
||||
#include "PtrList.H"
|
||||
#include "fvMesh.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "labelIOList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -56,10 +55,11 @@ class processorMeshes
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- The (volume) mesh-region name
|
||||
const word meshName_;
|
||||
|
||||
//- Processor databases
|
||||
PtrList<Time>& databases_;
|
||||
const UPtrList<Time>& databases_;
|
||||
|
||||
//- List of processor meshes
|
||||
PtrList<fvMesh> meshes_;
|
||||
@ -76,14 +76,11 @@ class processorMeshes
|
||||
//- List of processor boundary addressing lists
|
||||
PtrList<labelIOList> boundaryProcAddressing_;
|
||||
|
||||
//- List of pointMesh processor meshes
|
||||
PtrList<pointMesh> pMeshes_;
|
||||
|
||||
// pointMesh
|
||||
|
||||
//- List of processor meshes
|
||||
PtrList<pointMesh> pMeshes_;
|
||||
|
||||
//- List of processor boundary addressing lists for pointMeshes
|
||||
PtrList<labelIOList> pBoundaryProcAddressing_;
|
||||
//- List of processor boundary addressing lists for pointMeshes
|
||||
PtrList<labelIOList> pBoundaryProcAddressing_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -107,22 +104,30 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
processorMeshes(PtrList<Time>& databases, const word& meshName);
|
||||
processorMeshes(const UPtrList<Time>& databases, const word& meshName);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Update the meshes based on the mesh files saved in time directories
|
||||
//- Update meshes based on the mesh files saved in time directories
|
||||
polyMesh::readUpdateState readUpdate();
|
||||
|
||||
//- Reconstruct point position after motion in parallel
|
||||
void reconstructPoints(fvMesh&);
|
||||
|
||||
//- The (volume) mesh-region name
|
||||
const word& name() const noexcept { return meshName_; }
|
||||
|
||||
//- The number of processors used
|
||||
label nProcs() const noexcept { return databases_.size(); }
|
||||
|
||||
//- The processor meshes
|
||||
const PtrList<fvMesh>& meshes() const noexcept
|
||||
{
|
||||
return meshes_;
|
||||
}
|
||||
|
||||
//- The processor meshes
|
||||
PtrList<fvMesh>& meshes() noexcept
|
||||
{
|
||||
return meshes_;
|
||||
@ -149,18 +154,17 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// pointMesh
|
||||
//- The processor point meshes
|
||||
const PtrList<pointMesh>& pointMeshes() const noexcept
|
||||
{
|
||||
return pMeshes_;
|
||||
}
|
||||
|
||||
const PtrList<pointMesh>& pointMeshes() const noexcept
|
||||
{
|
||||
return pMeshes_;
|
||||
}
|
||||
|
||||
const PtrList<labelIOList>& pointMeshBoundaryProcAddressing()
|
||||
const noexcept
|
||||
{
|
||||
return pBoundaryProcAddressing_;
|
||||
}
|
||||
const PtrList<labelIOList>& pointMeshBoundaryProcAddressing()
|
||||
const noexcept
|
||||
{
|
||||
return pBoundaryProcAddressing_;
|
||||
}
|
||||
|
||||
|
||||
//- Helper: remove all procAddressing files from mesh instance
|
||||
|
||||
@ -30,8 +30,8 @@ License
|
||||
#include "Time.H"
|
||||
#include "IndirectList.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "OSspecific.H"
|
||||
#include "pointMesh.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -47,16 +47,19 @@ void Foam::processorMeshes::read()
|
||||
{
|
||||
// Make sure to clear (and hence unregister) any previously loaded meshes
|
||||
// and fields
|
||||
pBoundaryProcAddressing_.free();
|
||||
pMeshes_.free();
|
||||
|
||||
boundaryProcAddressing_.free();
|
||||
cellProcAddressing_.free();
|
||||
faceProcAddressing_.free();
|
||||
pointProcAddressing_.free();
|
||||
meshes_.free();
|
||||
const label numProc = databases_.size();
|
||||
|
||||
forAll(databases_, proci)
|
||||
pBoundaryProcAddressing_.resize_null(numProc);
|
||||
pMeshes_.resize_null(numProc);
|
||||
|
||||
boundaryProcAddressing_.resize_null(numProc);
|
||||
cellProcAddressing_.resize_null(numProc);
|
||||
faceProcAddressing_.resize_null(numProc);
|
||||
pointProcAddressing_.resize_null(numProc);
|
||||
meshes_.resize_null(numProc);
|
||||
|
||||
for (label proci = 0; proci < numProc; ++proci)
|
||||
{
|
||||
meshes_.emplace_set
|
||||
(
|
||||
@ -104,11 +107,7 @@ void Foam::processorMeshes::read()
|
||||
pMeshes_.set
|
||||
(
|
||||
proci,
|
||||
new pointMesh
|
||||
(
|
||||
meshes_[proci],
|
||||
IOobject::READ_IF_PRESENT
|
||||
)
|
||||
new pointMesh(meshes_[proci], IOobjectOption::READ_IF_PRESENT)
|
||||
);
|
||||
|
||||
pBoundaryProcAddressing_.set
|
||||
@ -122,9 +121,9 @@ void Foam::processorMeshes::read()
|
||||
meshes_[proci].facesInstance(),
|
||||
polyMesh::meshSubDir/pointMesh::meshSubDir,
|
||||
pMeshes_[proci].thisDb(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
IOobjectOption::READ_IF_PRESENT,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
boundaryProcAddressing_[proci]
|
||||
)
|
||||
@ -137,19 +136,12 @@ void Foam::processorMeshes::read()
|
||||
|
||||
Foam::processorMeshes::processorMeshes
|
||||
(
|
||||
PtrList<Time>& databases,
|
||||
const UPtrList<Time>& databases,
|
||||
const word& meshName
|
||||
)
|
||||
:
|
||||
meshName_(meshName),
|
||||
databases_(databases),
|
||||
meshes_(databases.size()),
|
||||
pointProcAddressing_(databases.size()),
|
||||
faceProcAddressing_(databases.size()),
|
||||
cellProcAddressing_(databases.size()),
|
||||
boundaryProcAddressing_(databases.size()),
|
||||
pMeshes_(databases.size()),
|
||||
pBoundaryProcAddressing_(databases.size())
|
||||
meshName_(meshName.empty() ? polyMesh::defaultRegion : meshName),
|
||||
databases_(databases)
|
||||
{
|
||||
read();
|
||||
}
|
||||
@ -161,7 +153,9 @@ Foam::polyMesh::readUpdateState Foam::processorMeshes::readUpdate()
|
||||
{
|
||||
polyMesh::readUpdateState stat = polyMesh::UNCHANGED;
|
||||
|
||||
forAll(databases_, proci)
|
||||
const label numProc = meshes_.size();
|
||||
|
||||
for (label proci = 0; proci < numProc; ++proci)
|
||||
{
|
||||
// Check if any new meshes need to be read.
|
||||
polyMesh::readUpdateState procStat = meshes_[proci].readUpdate();
|
||||
@ -210,43 +204,34 @@ Foam::polyMesh::readUpdateState Foam::processorMeshes::readUpdate()
|
||||
|
||||
void Foam::processorMeshes::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].thisDb(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Create the new points
|
||||
// The new points
|
||||
vectorField newPoints(mesh.nPoints());
|
||||
|
||||
forAll(meshes_, proci)
|
||||
{
|
||||
const vectorField& procPoints = procsPoints[proci];
|
||||
// Read the "points" field for each processor
|
||||
const label numProc = meshes_.size();
|
||||
|
||||
const labelList& pointProcAddr = pointProcAddressing_[proci];
|
||||
for (label proci = 0; proci < numProc; ++proci)
|
||||
{
|
||||
pointIOField procPoints
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
meshes_[proci].time().timeName(),
|
||||
polyMesh::meshSubDir,
|
||||
meshes_[proci].thisDb(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
)
|
||||
);
|
||||
|
||||
const labelUList& pointProcAddr = pointProcAddressing_[proci];
|
||||
|
||||
if (pointProcAddr.size() != procPoints.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "problem :"
|
||||
<< "problem [proc=" << proci << "] :"
|
||||
<< " pointProcAddr:" << pointProcAddr.size()
|
||||
<< " procPoints:" << procPoints.size()
|
||||
<< abort(FatalError);
|
||||
Reference in New Issue
Block a user