Merge branch 'update-fvsPatchFields-mappers' into 'develop'

Fix fvsPatchFields reading/writing the "value" entry

See merge request Development/openfoam!679
This commit is contained in:
Mattijs Janssens
2024-04-24 12:35:11 +00:00
106 changed files with 1614 additions and 1506 deletions

View File

@ -30,6 +30,8 @@ Class
Description Description
A FixedValue boundary condition for pointField. A FixedValue boundary condition for pointField.
The "value" entry is normally MUST_READ.
SourceFiles SourceFiles
fixedValuePointPatchField.C fixedValuePointPatchField.C
@ -92,13 +94,13 @@ public:
const pointPatch& p, const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF, const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict, const dictionary& dict,
const bool valueReqd const bool needValue
) )
: :
fixedValuePointPatchField fixedValuePointPatchField
( (
p, iF, dict, p, iF, dict,
(valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ) (needValue? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
) )
{} {}

View File

@ -123,13 +123,13 @@ public:
const pointPatch& p, const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF, const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict, const dictionary& dict,
const bool valueReqd const bool needValue
) )
: :
valuePointPatchField valuePointPatchField
( (
p, iF, dict, p, iF, dict,
(valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ) (needValue? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
) )
{} {}

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef pointBoundaryMeshMapper_H #ifndef Foam_pointBoundaryMeshMapper_H
#define pointBoundaryMeshMapper_H #define Foam_pointBoundaryMeshMapper_H
#include "PtrList.H" #include "PtrList.H"
#include "pointPatchMapper.H" #include "pointPatchMapper.H"

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -26,7 +27,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "pointMapper.H" #include "pointMapper.H"
#include "demandDrivenData.H"
#include "pointMesh.H" #include "pointMesh.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
@ -37,9 +37,9 @@ void Foam::pointMapper::calcAddressing() const
if if
( (
directAddrPtr_ directAddrPtr_
|| interpolationAddrPtr_ || interpAddrPtr_
|| weightsPtr_ || weightsPtr_
|| insertedPointLabelsPtr_ || insertedObjectsPtr_
) )
{ {
FatalErrorInFunction FatalErrorInFunction
@ -51,160 +51,226 @@ void Foam::pointMapper::calcAddressing() const
{ {
// Direct addressing, no weights // Direct addressing, no weights
directAddrPtr_ = new labelList(mpm_.pointMap()); directAddrPtr_ = std::make_unique<labelList>
labelList& directAddr = *directAddrPtr_; (
// No retired points, so pointMap().size() == mapperLen_ anyhow
labelList::subList(mpm_.pointMap(), mapperLen_)
);
auto& directAddr = *directAddrPtr_;
// Not necessary to resize the list as there are no retired points insertedObjectsPtr_ = std::make_unique<labelList>();
// directAddr.setSize(pMesh_.size()); auto& inserted = *insertedObjectsPtr_;
insertedPointLabelsPtr_ = new labelList(pMesh_.size()); // The nInsertedObjects_ already counted in the constructor
labelList& insertedPoints = *insertedPointLabelsPtr_; if (nInsertedObjects_)
label nInsertedPoints = 0;
forAll(directAddr, pointi)
{ {
if (directAddr[pointi] < 0) inserted.resize(nInsertedObjects_);
{
// Found inserted point
directAddr[pointi] = 0;
insertedPoints[nInsertedPoints] = pointi;
nInsertedPoints++;
}
}
insertedPoints.setSize(nInsertedPoints); label nInserted = 0;
forAll(directAddr, i)
{
if (directAddr[i] < 0)
{
// Found inserted
directAddr[i] = 0;
inserted[nInserted] = i;
++nInserted;
// TBD: check (nInsertedObjects_ < nInserted)?
#ifdef FULLDEBUG
if (nInsertedObjects_ < nInserted)
{
FatalErrorInFunction
<< "Unexpected insert of more than "
<< nInsertedObjects_ << " items\n"
<< abort(FatalError);
}
#endif
}
}
// TBD: check (nInserted < nInsertedObjects_)?
#ifdef FULLDEBUG
if (nInserted < nInsertedObjects_)
{
WarningInFunction
<< "Found " << nInserted << " instead of "
<< nInsertedObjects_ << " items to insert\n";
}
#endif
// The resize should be unnecessary
inserted.resize(nInserted);
}
} }
else else
{ {
// Interpolative addressing // Interpolative addressing
interpolationAddrPtr_ = new labelListList(pMesh_.size()); interpAddrPtr_ = std::make_unique<labelListList>(mapperLen_);
labelListList& addr = *interpolationAddrPtr_; auto& addr = *interpAddrPtr_;
weightsPtr_ = std::make_unique<scalarListList>(mapperLen_);
auto& wght = *weightsPtr_;
// Set the addressing and uniform weight
const auto setAddrWeights = [&]
(
const List<objectMap>& maps,
const char * const nameOfMap
)
{
for (const objectMap& map : maps)
{
// Get index, addressing
const label pointi = map.index();
const labelList& mo = map.masterObjects();
if (mo.empty()) continue; // safety
if (addr[pointi].size())
{
FatalErrorInFunction
<< "Master point " << pointi
<< " already mapped, cannot apply "
<< nameOfMap
<< flatOutput(mo) << abort(FatalError);
}
// Map from masters, uniform weights
addr[pointi] = mo;
wght[pointi] = scalarList(mo.size(), 1.0/mo.size());
}
};
weightsPtr_ = new scalarListList(pMesh_.size());
scalarListList& w = *weightsPtr_;
// Points created from other points (i.e. points merged into it). // Points created from other points (i.e. points merged into it).
const List<objectMap>& cfc = mpm_.pointsFromPointsMap();
forAll(cfc, cfcI) setAddrWeights(mpm_.pointsFromPointsMap(), "point points");
// Do mapped points.
// - may already have been set, so check if addressing still empty().
{ {
// Get addressing const labelList& map = mpm_.pointMap();
const labelList& mo = cfc[cfcI].masterObjects();
label pointi = cfc[cfcI].index(); for (label pointi = 0; pointi < mapperLen_; ++pointi)
if (addr[pointi].size())
{ {
FatalErrorInFunction const label mappedi = map[pointi];
<< "Master point " << pointi
<< " mapped from points " << mo
<< " already destination of mapping." << abort(FatalError);
}
// Map from masters, uniform weights if (mappedi >= 0 && addr[pointi].empty())
addr[pointi] = mo; {
w[pointi] = scalarList(mo.size(), 1.0/mo.size()); // Mapped from a single point
} addr[pointi].resize(1, mappedi);
wght[pointi].resize(1, 1.0);
}
// Do mapped points. Note that can already be set from pointsFromPoints
// so check if addressing size still zero.
const labelList& cm = mpm_.pointMap();
forAll(cm, pointi)
{
if (cm[pointi] > -1 && addr[pointi].empty())
{
// Mapped from a single point
addr[pointi] = labelList(1, cm[pointi]);
w[pointi] = scalarList(1, scalar(1));
} }
} }
// Grab inserted points (for them the size of addressing is still zero) // Grab inserted points (for them the size of addressing is still zero)
insertedPointLabelsPtr_ = new labelList(pMesh_.size()); insertedObjectsPtr_ = std::make_unique<labelList>();
labelList& insertedPoints = *insertedPointLabelsPtr_; auto& inserted = *insertedObjectsPtr_;
label nInsertedPoints = 0; // The nInsertedObjects_ already counted in the constructor
if (nInsertedObjects_)
forAll(addr, pointi)
{ {
if (addr[pointi].empty()) inserted.resize(nInsertedObjects_);
label nInserted = 0;
forAll(addr, i)
{ {
// Mapped from a dummy point. Take point 0 with weight 1. if (addr[i].empty())
addr[pointi] = labelList(1, Zero); {
w[pointi] = scalarList(1, scalar(1)); // Mapped from dummy point 0
addr[i].resize(1, 0);
wght[i].resize(1, 1.0);
insertedPoints[nInsertedPoints] = pointi; inserted[nInserted] = i;
nInsertedPoints++; ++nInserted;
// TBD: check (nInsertedObjects_ < nInserted)?
#ifdef FULLDEBUG
if (nInsertedObjects_ < nInserted)
{
FatalErrorInFunction
<< "Unexpected insert of more than "
<< nInsertedObjects_ << " items\n"
<< abort(FatalError);
}
#endif
}
} }
// TBD: check (nInserted < nInsertedObjects_)?
#ifdef FULLDEBUG
if (nInserted < nInsertedObjects_)
{
WarningInFunction
<< "Found " << nInserted << " instead of "
<< nInsertedObjects_ << " items to insert\n";
}
#endif
// The resize should be unnecessary
inserted.resize(nInserted);
} }
insertedPoints.setSize(nInsertedPoints);
} }
} }
void Foam::pointMapper::clearOut() // void Foam::pointMapper::clearOut()
{ // {
deleteDemandDrivenData(directAddrPtr_); // directAddrPtr_.reset(nullptr);
deleteDemandDrivenData(interpolationAddrPtr_); // interpAddrPtr_.reset(nullptr);
deleteDemandDrivenData(weightsPtr_); // weightsPtr_.reset(nullptr);
deleteDemandDrivenData(insertedPointLabelsPtr_); // insertedObjectsPtr_.reset(nullptr);
} // }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointMapper::pointMapper(const pointMesh& pMesh, const mapPolyMesh& mpm) Foam::pointMapper::pointMapper(const pointMesh& pMesh, const mapPolyMesh& mpm)
: :
pMesh_(pMesh),
mpm_(mpm), mpm_(mpm),
insertedPoints_(true), mapperLen_(pMesh.size()),
direct_(false), nInsertedObjects_(0),
directAddrPtr_(nullptr), direct_
interpolationAddrPtr_(nullptr), (
weightsPtr_(nullptr), // Mapping without interpolation?
insertedPointLabelsPtr_(nullptr) mpm.pointsFromPointsMap().empty()
)
{ {
// Check for possibility of direct mapping const auto& directMap = mpm_.pointMap();
if (mpm_.pointsFromPointsMap().empty())
if (!mapperLen_)
{ {
// Empty mesh
direct_ = true; direct_ = true;
nInsertedObjects_ = 0;
}
else if (direct_)
{
// Number of inserted points (-ve values)
nInsertedObjects_ = std::count_if
(
directMap.cbegin(),
directMap.cbegin(mapperLen_),
[](label i) { return (i < 0); }
);
} }
else else
{ {
direct_ = false; // Check if there are inserted points with no owner
} // (check all lists)
// Check for inserted points bitSet unmapped(mapperLen_, true);
if (direct_ && (mpm_.pointMap().empty() || min(mpm_.pointMap()) > -1))
{
insertedPoints_ = false;
}
else
{
//Check if there are inserted points with no owner
// Make a copy of the point map, add the entries for points from points unmapped.unset(directMap); // direct mapped
// and check for left-overs
labelList cm(pMesh_.size(), -1);
const List<objectMap>& cfc = mpm_.pointsFromPointsMap(); for (const objectMap& map : mpm_.pointsFromPointsMap())
forAll(cfc, cfcI)
{ {
cm[cfc[cfcI].index()] = 0; if (!map.empty()) unmapped.unset(map.index());
} }
if (min(cm) < 0) nInsertedObjects_ = label(unmapped.count());
{
insertedPoints_ = true;
}
} }
} }
@ -212,15 +278,14 @@ Foam::pointMapper::pointMapper(const pointMesh& pMesh, const mapPolyMesh& mpm)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::pointMapper::~pointMapper() Foam::pointMapper::~pointMapper()
{ {}
clearOut();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::pointMapper::size() const Foam::label Foam::pointMapper::size() const
{ {
// OR: return mapperLen_;
return mpm_.pointMap().size(); return mpm_.pointMap().size();
} }
@ -266,12 +331,12 @@ const Foam::labelListList& Foam::pointMapper::addressing() const
<< abort(FatalError); << abort(FatalError);
} }
if (!interpolationAddrPtr_) if (!interpAddrPtr_)
{ {
calcAddressing(); calcAddressing();
} }
return *interpolationAddrPtr_; return *interpAddrPtr_;
} }
@ -295,30 +360,19 @@ const Foam::scalarListList& Foam::pointMapper::weights() const
const Foam::labelList& Foam::pointMapper::insertedObjectLabels() const const Foam::labelList& Foam::pointMapper::insertedObjectLabels() const
{ {
if (!insertedPointLabelsPtr_) if (!insertedObjectsPtr_)
{ {
if (!insertedObjects()) if (!nInsertedObjects_)
{ {
// There are no inserted points // No inserted objects will be created
insertedPointLabelsPtr_ = new labelList(0); return labelList::null();
}
else
{
calcAddressing();
} }
calcAddressing();
} }
return *insertedPointLabelsPtr_; return *insertedObjectsPtr_;
} }
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef pointMapper_H #ifndef Foam_pointMapper_H
#define pointMapper_H #define Foam_pointMapper_H
#include "morphFieldMapper.H" #include "morphFieldMapper.H"
@ -46,10 +47,9 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward Declarations
class pointMesh;
class mapPolyMesh; class mapPolyMesh;
class polyMesh; class pointMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class pointMapper Declaration Class pointMapper Declaration
@ -59,38 +59,45 @@ class pointMapper
: :
public morphFieldMapper public morphFieldMapper
{ {
// Private data // Private Data
//- Reference to pointMesh
const pointMesh& pMesh_;
//- Reference to mapPolyMesh //- Reference to mapPolyMesh
const mapPolyMesh& mpm_; const mapPolyMesh& mpm_;
//- Are there any inserted (unmapped) points //- The size of the mapper = pointMesh::size()
bool insertedPoints_; const label mapperLen_;
//- Number of inserted (unmapped) points
label nInsertedObjects_;
//- Is the mapping direct //- Is the mapping direct
bool direct_; bool direct_;
// Demand-driven private data // Demand-Driven Data
//- Direct addressing (only one for of addressing is used) //- Direct addressing (only one for of addressing is used)
mutable labelList* directAddrPtr_; mutable std::unique_ptr<labelList> directAddrPtr_;
//- Interpolated addressing (only one for of addressing is used) //- Interpolated addressing (only one for of addressing is used)
mutable labelListList* interpolationAddrPtr_; mutable std::unique_ptr<labelListList> interpAddrPtr_;
//- Interpolation weights //- Interpolation weights
mutable scalarListList* weightsPtr_; mutable std::unique_ptr<scalarListList> weightsPtr_;
//- Inserted points //- Inserted points
mutable labelList* insertedPointLabelsPtr_; mutable std::unique_ptr<labelList> insertedObjectsPtr_;
// Private Member Functions // Private Member Functions
//- Calculate addressing for mapping with inserted points
void calcAddressing() const;
public:
// Generated Methods
//- No copy construct //- No copy construct
pointMapper(const pointMapper&) = delete; pointMapper(const pointMapper&) = delete;
@ -98,28 +105,20 @@ class pointMapper
void operator=(const pointMapper&) = delete; void operator=(const pointMapper&) = delete;
//- Calculate addressing for mapping with inserted points
void calcAddressing() const;
//- Clear out local storage
void clearOut();
public:
// Constructors // Constructors
//- Construct from mapPolyMesh //- Construct from mapPolyMesh
pointMapper(const pointMesh&, const mapPolyMesh& mpm); pointMapper(const pointMesh&, const mapPolyMesh& mpm);
//- Destructor //- Destructor
virtual ~pointMapper(); virtual ~pointMapper();
// Member Functions // Member Functions
//- Return size //- The mapper size
virtual label size() const; virtual label size() const;
//- Return size before mapping //- Return size before mapping
@ -131,8 +130,7 @@ public:
return direct_; return direct_;
} }
//- Are there unmapped values? I.e. do all size() elements get //- Are there unmapped values? i.e. do all size() elements get value
// get value
virtual bool hasUnmapped() const virtual bool hasUnmapped() const
{ {
return insertedObjects(); return insertedObjects();
@ -148,9 +146,9 @@ public:
virtual const scalarListList& weights() const; virtual const scalarListList& weights() const;
//- Are there any inserted points //- Are there any inserted points
bool insertedObjects() const bool insertedObjects() const noexcept
{ {
return insertedPoints_; return bool(nInsertedObjects_);
} }
//- Return list of inserted points //- Return list of inserted points

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef pointMeshMapper_H #ifndef Foam_pointMeshMapper_H
#define pointMeshMapper_H #define Foam_pointMeshMapper_H
#include "pointMapper.H" #include "pointMapper.H"
#include "pointBoundaryMeshMapper.H" #include "pointBoundaryMeshMapper.H"
@ -46,7 +46,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward Declarations
class pointMesh; class pointMesh;
class mapPolyMesh; class mapPolyMesh;
@ -56,7 +56,7 @@ class mapPolyMesh;
class pointMeshMapper class pointMeshMapper
{ {
// Private data // Private Data
//- Reference to mesh //- Reference to mesh
const pointMesh& mesh_; const pointMesh& mesh_;
@ -92,28 +92,27 @@ public:
// Member Functions // Member Functions
//- Return reference to mesh fields belong to //- Return reference to mesh fields belong to
const pointMesh& mesh() const const pointMesh& mesh() const noexcept
{ {
return mesh_; return mesh_;
} }
//- Return reference to objectRegistry storing fields. Can be //- Return reference to objectRegistry storing fields. Can be
// removed once fields stored on pointMesh. // removed once fields stored on pointMesh.
const objectRegistry& thisDb() const const objectRegistry& thisDb() const noexcept
{ {
return mesh_(); return mesh_();
} }
//- Return point mapper //- Return point mapper
const morphFieldMapper& pointMap() const const morphFieldMapper& pointMap() const noexcept
{ {
return pointMap_; return pointMap_;
} }
//- Return boundary mapper //- Return boundary mapper
const pointBoundaryMeshMapper& boundaryMap() const const pointBoundaryMeshMapper& boundaryMap() const noexcept
{ {
return boundaryMap_; return boundaryMap_;
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,7 +30,6 @@ License
#include "pointPatch.H" #include "pointPatch.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "faceMapper.H" #include "faceMapper.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -38,7 +38,7 @@ void Foam::pointPatchMapper::calcAddressing() const
if if
( (
directAddrPtr_ directAddrPtr_
|| interpolationAddrPtr_ || interpAddrPtr_
|| weightsPtr_ || weightsPtr_
) )
{ {
@ -52,8 +52,11 @@ void Foam::pointPatchMapper::calcAddressing() const
if (direct()) if (direct())
{ {
// Direct mapping. // Direct mapping.
directAddrPtr_ = new labelList(mpm_.patchPointMap()[patch_.index()]); directAddrPtr_ = std::make_unique<labelList>
labelList& addr = *directAddrPtr_; (
mpm_.patchPointMap()[patch_.index()]
);
auto& addr = *directAddrPtr_;
forAll(addr, i) forAll(addr, i)
{ {
@ -73,11 +76,11 @@ void Foam::pointPatchMapper::calcAddressing() const
// patch points. Problem is we don't know what points were in the patch // patch points. Problem is we don't know what points were in the patch
// for points that were merged. // for points that were merged.
interpolationAddrPtr_ = new labelListList(size()); interpAddrPtr_ = std::make_unique<labelListList>(size());
labelListList& addr = *interpolationAddrPtr_; auto& addr = *interpAddrPtr_;
weightsPtr_ = new scalarListList(addr.size()); weightsPtr_ = std::make_unique<scalarListList>(addr.size());
scalarListList& w = *weightsPtr_; auto& wght = *weightsPtr_;
const labelList& ppm = mpm_.patchPointMap()[patch_.index()]; const labelList& ppm = mpm_.patchPointMap()[patch_.index()];
@ -85,15 +88,15 @@ void Foam::pointPatchMapper::calcAddressing() const
{ {
if (ppm[i] >= 0) if (ppm[i] >= 0)
{ {
addr[i] = labelList(1, ppm[i]); addr[i].resize(1, ppm[i]);
w[i] = scalarList(1, scalar(1)); wght[i].resize(1, 1.0);
} }
else else
{ {
// Inserted point. // Inserted point.
///// Map from point0 (arbitrary choice) ///// Map from point0 (arbitrary choice)
//addr[i] = labelList(1, Zero); //addr[i].resize(1, 0);
//w[i] = scalarList(1, scalar(1)); //wght[i].resize(1, 1.0);
hasUnmapped_ = true; hasUnmapped_ = true;
} }
} }
@ -101,13 +104,13 @@ void Foam::pointPatchMapper::calcAddressing() const
} }
void Foam::pointPatchMapper::clearOut() // void Foam::pointPatchMapper::clearOut()
{ // {
deleteDemandDrivenData(directAddrPtr_); // directAddrPtr_.reset(nullptr);
deleteDemandDrivenData(interpolationAddrPtr_); // interpAddrPtr_.reset(nullptr);
deleteDemandDrivenData(weightsPtr_); // weightsPtr_.reset(nullptr);
hasUnmapped_ = false; // hasUnmapped_ = false;
} // }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -129,19 +132,14 @@ Foam::pointPatchMapper::pointPatchMapper
? mpm_.oldPatchNMeshPoints()[patch_.index()] ? mpm_.oldPatchNMeshPoints()[patch_.index()]
: 0 : 0
), ),
hasUnmapped_(false), hasUnmapped_(false)
directAddrPtr_(nullptr),
interpolationAddrPtr_(nullptr),
weightsPtr_(nullptr)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::pointPatchMapper::~pointPatchMapper() Foam::pointPatchMapper::~pointPatchMapper()
{ {}
clearOut();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -173,12 +171,12 @@ const Foam::labelListList& Foam::pointPatchMapper::addressing() const
<< abort(FatalError); << abort(FatalError);
} }
if (!interpolationAddrPtr_) if (!interpAddrPtr_)
{ {
calcAddressing(); calcAddressing();
} }
return *interpolationAddrPtr_; return *interpAddrPtr_;
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef pointPatchMapper_H #ifndef Foam_pointPatchMapper_H
#define pointPatchMapper_H #define Foam_pointPatchMapper_H
#include "pointMapper.H" #include "pointMapper.H"
#include "pointPatchFieldMapper.H" #include "pointPatchFieldMapper.H"
@ -47,7 +48,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward Declarations
class pointPatch; class pointPatch;
class mapPolyMesh; class mapPolyMesh;
@ -59,7 +60,7 @@ class pointPatchMapper
: :
public pointPatchFieldMapper public pointPatchFieldMapper
{ {
// Private data // Private Data
//- Reference to patch //- Reference to patch
const pointPatch& patch_; const pointPatch& patch_;
@ -74,18 +75,18 @@ class pointPatchMapper
const label sizeBeforeMapping_; const label sizeBeforeMapping_;
// Demand-driven private data // Demand-driven Data
mutable bool hasUnmapped_; mutable bool hasUnmapped_;
//- Direct addressing (only one for of addressing is used) //- Direct addressing (only one for of addressing is used)
mutable labelList* directAddrPtr_; mutable std::unique_ptr<labelList> directAddrPtr_;
//- Interpolated addressing (only one for of addressing is used) //- Interpolated addressing (only one for of addressing is used)
mutable labelListList* interpolationAddrPtr_; mutable std::unique_ptr<labelListList> interpAddrPtr_;
//- Interpolation weights //- Interpolation weights
mutable scalarListList* weightsPtr_; mutable std::unique_ptr<scalarListList> weightsPtr_;
// Private Member Functions // Private Member Functions
@ -100,9 +101,6 @@ class pointPatchMapper
//- Calculate addressing for mapping with inserted cells //- Calculate addressing for mapping with inserted cells
void calcAddressing() const; void calcAddressing() const;
//- Clear out local storage
void clearOut();
public: public:
@ -156,7 +154,6 @@ public:
//- Return interpolaion weights //- Return interpolaion weights
virtual const scalarListList& weights() const; virtual const scalarListList& weights() const;
}; };

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -26,7 +27,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cellMapper.H" #include "cellMapper.H"
#include "demandDrivenData.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
@ -37,9 +37,9 @@ void Foam::cellMapper::calcAddressing() const
if if
( (
directAddrPtr_ directAddrPtr_
|| interpolationAddrPtr_ || interpAddrPtr_
|| weightsPtr_ || weightsPtr_
|| insertedCellLabelsPtr_ || insertedObjectsPtr_
) )
{ {
FatalErrorInFunction FatalErrorInFunction
@ -51,129 +51,105 @@ void Foam::cellMapper::calcAddressing() const
{ {
// Direct addressing, no weights // Direct addressing, no weights
directAddrPtr_ = new labelList(mpm_.cellMap()); directAddrPtr_ = std::make_unique<labelList>
labelList& directAddr = *directAddrPtr_; (
// No retired cells, so cellMap().size() == mapperLen_ anyhow
labelList::subList(mpm_.cellMap(), mapperLen_)
);
auto& directAddr = *directAddrPtr_;
// Not necessary to resize the list as there are no retired cells insertedObjectsPtr_ = std::make_unique<labelList>();
// directAddr.setSize(mesh_.nCells()); auto& inserted = *insertedObjectsPtr_;
insertedCellLabelsPtr_ = new labelList(mesh_.nCells()); // The nInsertedObjects_ already counted in the constructor
labelList& insertedCells = *insertedCellLabelsPtr_; if (nInsertedObjects_)
label nInsertedCells = 0;
forAll(directAddr, celli)
{ {
if (directAddr[celli] < 0) inserted.resize(nInsertedObjects_);
{
// Found inserted cell
directAddr[celli] = 0;
insertedCells[nInsertedCells] = celli;
nInsertedCells++;
}
}
insertedCells.setSize(nInsertedCells); label nInserted = 0;
forAll(directAddr, i)
{
if (directAddr[i] < 0)
{
// Found inserted
directAddr[i] = 0;
inserted[nInserted] = i;
++nInserted;
// TBD: check (nInsertedObjects_ < nInserted)?
#ifdef FULLDEBUG
if (nInsertedObjects_ < nInserted)
{
FatalErrorInFunction
<< "Unexpected insert of more than "
<< nInsertedObjects_ << " items\n"
<< abort(FatalError);
}
#endif
}
}
// TBD: check (nInserted < nInsertedObjects_)?
#ifdef FULLDEBUG
if (nInserted < nInsertedObjects_)
{
WarningInFunction
<< "Found " << nInserted << " instead of "
<< nInsertedObjects_ << " items to insert\n";
}
#endif
// The resize should be unnecessary
inserted.resize(nInserted);
}
} }
else else
{ {
// Interpolative addressing // Interpolative addressing
interpolationAddrPtr_ = new labelListList(mesh_.nCells()); interpAddrPtr_ = std::make_unique<labelListList>(mapperLen_);
labelListList& addr = *interpolationAddrPtr_; auto& addr = *interpAddrPtr_;
weightsPtr_ = new scalarListList(mesh_.nCells()); weightsPtr_ = std::make_unique<scalarListList>(mapperLen_);
scalarListList& w = *weightsPtr_; auto& wght = *weightsPtr_;
const List<objectMap>& cfp = mpm_.cellsFromPointsMap();
forAll(cfp, cfpI) // Set the addressing and uniform weight
const auto setAddrWeights = [&]
(
const List<objectMap>& maps,
const char * const nameOfMap
)
{ {
// Get addressing for (const objectMap& map : maps)
const labelList& mo = cfp[cfpI].masterObjects();
label celli = cfp[cfpI].index();
if (addr[celli].size())
{ {
FatalErrorInFunction // Get index, addressing
<< "Master cell " << celli const label celli = map.index();
<< " mapped from point cells " << mo const labelList& mo = map.masterObjects();
<< " already destination of mapping." << abort(FatalError); if (mo.empty()) continue; // safety
if (addr[celli].size())
{
FatalErrorInFunction
<< "Master cell " << celli
<< " already mapped, cannot apply "
<< nameOfMap
<< flatOutput(mo) << abort(FatalError);
}
// Map from masters, uniform weights
addr[celli] = mo;
wght[celli] = scalarList(mo.size(), 1.0/mo.size());
} }
};
// Map from masters, uniform weights
addr[celli] = mo;
w[celli] = scalarList(mo.size(), 1.0/mo.size());
}
const List<objectMap>& cfe = mpm_.cellsFromEdgesMap(); setAddrWeights(mpm_.cellsFromPointsMap(), "point cells");
setAddrWeights(mpm_.cellsFromEdgesMap(), "edge cells");
forAll(cfe, cfeI) setAddrWeights(mpm_.cellsFromFacesMap(), "face cells");
{
// Get addressing
const labelList& mo = cfe[cfeI].masterObjects();
label celli = cfe[cfeI].index();
if (addr[celli].size())
{
FatalErrorInFunction
<< "Master cell " << celli
<< " mapped from edge cells " << mo
<< " already destination of mapping." << abort(FatalError);
}
// Map from masters, uniform weights
addr[celli] = mo;
w[celli] = scalarList(mo.size(), 1.0/mo.size());
}
const List<objectMap>& cff = mpm_.cellsFromFacesMap();
forAll(cff, cffI)
{
// Get addressing
const labelList& mo = cff[cffI].masterObjects();
label celli = cff[cffI].index();
if (addr[celli].size())
{
FatalErrorInFunction
<< "Master cell " << celli
<< " mapped from face cells " << mo
<< " already destination of mapping." << abort(FatalError);
}
// Map from masters, uniform weights
addr[celli] = mo;
w[celli] = scalarList(mo.size(), 1.0/mo.size());
}
// Volume conservative mapping if possible // Volume conservative mapping if possible
const List<objectMap>& cfc = mpm_.cellsFromCellsMap(); const List<objectMap>& cellsFromCells = mpm_.cellsFromCellsMap();
setAddrWeights(cellsFromCells, "cell cells");
forAll(cfc, cfcI)
{
// Get addressing
const labelList& mo = cfc[cfcI].masterObjects();
label celli = cfc[cfcI].index();
if (addr[celli].size())
{
FatalErrorInFunction
<< "Master cell " << celli
<< " mapped from cell cells " << mo
<< " already destination of mapping."
<< abort(FatalError);
}
// Map from masters
addr[celli] = mo;
}
if (mpm_.hasOldCellVolumes()) if (mpm_.hasOldCellVolumes())
{ {
@ -185,182 +161,188 @@ void Foam::cellMapper::calcAddressing() const
{ {
FatalErrorInFunction FatalErrorInFunction
<< "cellVolumes size " << V.size() << "cellVolumes size " << V.size()
<< " is not the old number of cells " << sizeBeforeMapping() << " != old number of cells " << sizeBeforeMapping()
<< ". Are your cellVolumes already mapped?" << ". Are your cellVolumes already mapped?"
<< " (new number of cells " << size() << ")" << " (new number of cells " << size() << ")"
<< abort(FatalError); << abort(FatalError);
} }
forAll(cfc, cfcI) for (const auto& map : cellsFromCells)
{ {
const labelList& mo = cfc[cfcI].masterObjects(); // Get index, addressing
const label celli = map.index();
const labelList& mo = map.masterObjects();
if (mo.empty()) continue; // safety
label celli = cfc[cfcI].index(); // wght[celli] is already sized and uniform weighted
auto& wght_cell = wght[celli];
w[celli].setSize(mo.size()); scalar sumV = 0;
forAll(mo, ci)
if (mo.size())
{ {
scalar sumV = 0; wght_cell[ci] = V[mo[ci]];
forAll(mo, ci) sumV += V[mo[ci]];
}
if (sumV > VSMALL)
{
for (auto& w : wght_cell)
{ {
w[celli][ci] = V[mo[ci]]; w /= sumV;
sumV += V[mo[ci]];
}
if (sumV > VSMALL)
{
forAll(mo, ci)
{
w[celli][ci] /= sumV;
}
}
else
{
// Exception: zero volume. Use uniform mapping
w[celli] = scalarList(mo.size(), 1.0/mo.size());
} }
} }
else
{
// Exception: zero volume. Use uniform mapping
wght_cell = (1.0/mo.size());
}
} }
} }
else
// Do mapped cells.
// - may already have been set, so check if addressing still empty().
{ {
// Uniform weighted const labelList& map = mpm_.cellMap();
forAll(cfc, cfcI) // The cellMap.size() == nCells() anyhow
for (label celli = 0; celli < mapperLen_; ++celli)
{ {
const labelList& mo = cfc[cfcI].masterObjects(); const label mappedi = map[celli];
label celli = cfc[cfcI].index(); if (mappedi >= 0 && addr[celli].empty())
{
w[celli] = scalarList(mo.size(), 1.0/mo.size()); // Mapped from a single cell
addr[celli].resize(1, mappedi);
wght[celli].resize(1, 1.0);
}
} }
} }
// Do mapped faces. Note that can already be set from cellsFromCells
// so check if addressing size still zero.
const labelList& cm = mpm_.cellMap();
forAll(cm, celli)
{
if (cm[celli] > -1 && addr[celli].empty())
{
// Mapped from a single cell
addr[celli] = labelList(1, cm[celli]);
w[celli] = scalarList(1, 1.0);
}
}
// Grab inserted points (for them the size of addressing is still zero) // Grab inserted points (for them the size of addressing is still zero)
insertedCellLabelsPtr_ = new labelList(mesh_.nCells()); insertedObjectsPtr_ = std::make_unique<labelList>();
labelList& insertedCells = *insertedCellLabelsPtr_; auto& inserted = *insertedObjectsPtr_;
label nInsertedCells = 0; // The nInsertedObjects_ already counted in the constructor
if (nInsertedObjects_)
forAll(addr, celli)
{ {
if (addr[celli].empty()) inserted.resize(nInsertedObjects_);
label nInserted = 0;
forAll(addr, i)
{ {
// Mapped from a dummy cell if (addr[i].empty())
addr[celli] = labelList(1, Zero); {
w[celli] = scalarList(1, scalar(1)); // Mapped from dummy cell 0
addr[i].resize(1, 0);
wght[i].resize(1, 1.0);
insertedCells[nInsertedCells] = celli; inserted[nInserted] = i;
nInsertedCells++; ++nInserted;
// TBD: check (nInsertedObjects_ < nInserted)?
#ifdef FULLDEBUG
if (nInsertedObjects_ < nInserted)
{
FatalErrorInFunction
<< "Unexpected insert of more than "
<< nInsertedObjects_ << " items\n"
<< abort(FatalError);
}
#endif
}
} }
// TBD: check (nInserted < nInsertedObjects_)?
#ifdef FULLDEBUG
if (nInserted < nInsertedObjects_)
{
WarningInFunction
<< "Found " << nInserted << " instead of "
<< nInsertedObjects_ << " items to insert\n";
}
#endif
// The resize should be unnecessary
inserted.resize(nInserted);
} }
insertedCells.setSize(nInsertedCells);
} }
} }
void Foam::cellMapper::clearOut() // void Foam::cellMapper::clearOut()
{ // {
deleteDemandDrivenData(directAddrPtr_); // directAddrPtr_.reset(nullptr);
deleteDemandDrivenData(interpolationAddrPtr_); // interpAddrPtr_.reset(nullptr);
deleteDemandDrivenData(weightsPtr_); // weightsPtr_.reset(nullptr);
deleteDemandDrivenData(insertedCellLabelsPtr_); // insertedObjectsPtr_.reset(nullptr);
} // }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cellMapper::cellMapper(const mapPolyMesh& mpm) Foam::cellMapper::cellMapper(const mapPolyMesh& mpm)
: :
mesh_(mpm.mesh()),
mpm_(mpm), mpm_(mpm),
insertedCells_(true), mapperLen_(mpm.mesh().nCells()),
direct_(false), nInsertedObjects_(0),
directAddrPtr_(nullptr), direct_
interpolationAddrPtr_(nullptr),
weightsPtr_(nullptr),
insertedCellLabelsPtr_(nullptr)
{
// Check for possibility of direct mapping
if
( (
mpm_.cellsFromPointsMap().empty() // Mapping without interpolation?
&& mpm_.cellsFromEdgesMap().empty() mpm.cellsFromPointsMap().empty()
&& mpm_.cellsFromFacesMap().empty() && mpm.cellsFromEdgesMap().empty()
&& mpm_.cellsFromCellsMap().empty() && mpm.cellsFromFacesMap().empty()
&& mpm.cellsFromCellsMap().empty()
) )
{
const auto& directMap = mpm_.cellMap();
if (!mapperLen_)
{ {
// Empty mesh
direct_ = true; direct_ = true;
nInsertedObjects_ = 0;
}
else if (direct_)
{
// Number of inserted cells (-ve values)
nInsertedObjects_ = std::count_if
(
directMap.cbegin(),
directMap.cbegin(mapperLen_),
[](label i) { return (i < 0); }
);
} }
else else
{ {
direct_ = false; // Check if there are inserted cells with no owner
} // (check all lists)
// Check for inserted cells bitSet unmapped(mapperLen_, true);
if (direct_ && (mpm_.cellMap().empty() || min(mpm_.cellMap()) > -1))
{
insertedCells_ = false;
}
else
{
// Need to check all 3 lists to see if there are inserted cells
// with no owner
// Make a copy of the cell map, add the entried for cells from points, unmapped.unset(directMap); // direct mapped
// cells from edges and cells from faces and check for left-overs
labelList cm(mesh_.nCells(), -1);
const List<objectMap>& cfp = mpm_.cellsFromPointsMap(); for (const auto& map : mpm_.cellsFromPointsMap())
forAll(cfp, cfpI)
{ {
cm[cfp[cfpI].index()] = 0; if (!map.empty()) unmapped.unset(map.index());
} }
const List<objectMap>& cfe = mpm_.cellsFromEdgesMap(); for (const auto& map : mpm_.cellsFromEdgesMap())
forAll(cfe, cfeI)
{ {
cm[cfe[cfeI].index()] = 0; if (!map.empty()) unmapped.unset(map.index());
} }
const List<objectMap>& cff = mpm_.cellsFromFacesMap(); for (const auto& map : mpm_.cellsFromFacesMap())
forAll(cff, cffI)
{ {
cm[cff[cffI].index()] = 0; if (!map.empty()) unmapped.unset(map.index());
} }
const List<objectMap>& cfc = mpm_.cellsFromCellsMap(); for (const auto& map : mpm_.cellsFromCellsMap())
forAll(cfc, cfcI)
{ {
cm[cfc[cfcI].index()] = 0; if (!map.empty()) unmapped.unset(map.index());
} }
if (min(cm) < 0) nInsertedObjects_ = label(unmapped.count());
{
insertedCells_ = true;
}
} }
} }
@ -368,15 +350,14 @@ Foam::cellMapper::cellMapper(const mapPolyMesh& mpm)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cellMapper::~cellMapper() Foam::cellMapper::~cellMapper()
{ {}
clearOut();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::cellMapper::size() const Foam::label Foam::cellMapper::size() const
{ {
// OR: return mapperLen_;
return mpm_.cellMap().size(); return mpm_.cellMap().size();
} }
@ -422,12 +403,12 @@ const Foam::labelListList& Foam::cellMapper::addressing() const
<< abort(FatalError); << abort(FatalError);
} }
if (!interpolationAddrPtr_) if (!interpAddrPtr_)
{ {
calcAddressing(); calcAddressing();
} }
return *interpolationAddrPtr_; return *interpAddrPtr_;
} }
@ -451,20 +432,18 @@ const Foam::scalarListList& Foam::cellMapper::weights() const
const Foam::labelList& Foam::cellMapper::insertedObjectLabels() const const Foam::labelList& Foam::cellMapper::insertedObjectLabels() const
{ {
if (!insertedCellLabelsPtr_) if (!insertedObjectsPtr_)
{ {
if (!insertedObjects()) if (!nInsertedObjects_)
{ {
// There are no inserted cells // No inserted objects will be created
insertedCellLabelsPtr_ = new labelList(0); return labelList::null();
}
else
{
calcAddressing();
} }
calcAddressing();
} }
return *insertedCellLabelsPtr_; return *insertedObjectsPtr_;
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef cellMapper_H #ifndef Foam_cellMapper_H
#define cellMapper_H #define Foam_cellMapper_H
#include "morphFieldMapper.H" #include "morphFieldMapper.H"
@ -46,8 +47,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward Declarations
class polyMesh;
class mapPolyMesh; class mapPolyMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -58,38 +58,45 @@ class cellMapper
: :
public morphFieldMapper public morphFieldMapper
{ {
// Private data // Private Data
//- Reference to polyMesh
const polyMesh& mesh_;
//- Reference to mapPolyMesh //- Reference to mapPolyMesh
const mapPolyMesh& mpm_; const mapPolyMesh& mpm_;
//- Are there any inserted (unmapped) cells //- The size of the mapper = polyMesh::nCells()
bool insertedCells_; const label mapperLen_;
//- Number of inserted (unmapped) cells
label nInsertedObjects_;
//- Is the mapping direct //- Is the mapping direct
bool direct_; bool direct_;
// Demand-driven private data // Demand-Driven Data
//- Direct addressing (only one for of addressing is used) //- Direct addressing (only one for of addressing is used)
mutable labelList* directAddrPtr_; mutable std::unique_ptr<labelList> directAddrPtr_;
//- Interpolated addressing (only one for of addressing is used) //- Interpolated addressing (only one for of addressing is used)
mutable labelListList* interpolationAddrPtr_; mutable std::unique_ptr<labelListList> interpAddrPtr_;
//- Interpolation weights //- Interpolation weights
mutable scalarListList* weightsPtr_; mutable std::unique_ptr<scalarListList> weightsPtr_;
//- Inserted cells //- Inserted cells
mutable labelList* insertedCellLabelsPtr_; mutable std::unique_ptr<labelList> insertedObjectsPtr_;
// Private Member Functions // Private Member Functions
//- Calculate addressing for mapping with inserted cells
void calcAddressing() const;
public:
// Generated Methods
//- No copy construct //- No copy construct
cellMapper(const cellMapper&) = delete; cellMapper(const cellMapper&) = delete;
@ -97,21 +104,10 @@ class cellMapper
void operator=(const cellMapper&) = delete; void operator=(const cellMapper&) = delete;
//- Calculate addressing for mapping with inserted cells
void calcAddressing() const;
//- Clear out local storage
void clearOut();
public:
// Static data members
// Constructors // Constructors
//- Construct from mapPolyMesh //- Construct from mapPolyMesh
cellMapper(const mapPolyMesh& mpm); explicit cellMapper(const mapPolyMesh& mpm);
//- Destructor //- Destructor
@ -120,7 +116,7 @@ public:
// Member Functions // Member Functions
//- Return size //- The mapper size
virtual label size() const; virtual label size() const;
//- Return size before mapping //- Return size before mapping
@ -132,6 +128,7 @@ public:
return direct_; return direct_;
} }
//- Are there unmapped values?
virtual bool hasUnmapped() const virtual bool hasUnmapped() const
{ {
return insertedObjects(); return insertedObjects();
@ -149,7 +146,7 @@ public:
//- Are there any inserted cells //- Are there any inserted cells
virtual bool insertedObjects() const virtual bool insertedObjects() const
{ {
return insertedCells_; return bool(nInsertedObjects_);
} }
//- Return list of inserted cells //- Return list of inserted cells

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -26,7 +27,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faceMapper.H" #include "faceMapper.H"
#include "demandDrivenData.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
@ -37,9 +37,9 @@ void Foam::faceMapper::calcAddressing() const
if if
( (
directAddrPtr_ directAddrPtr_
|| interpolationAddrPtr_ || interpAddrPtr_
|| weightsPtr_ || weightsPtr_
|| insertedFaceLabelsPtr_ || insertedObjectsPtr_
) )
{ {
FatalErrorInFunction FatalErrorInFunction
@ -51,223 +51,240 @@ void Foam::faceMapper::calcAddressing() const
{ {
// Direct addressing, no weights // Direct addressing, no weights
directAddrPtr_ = new labelList(mpm_.faceMap()); // Restrict addressing list to contain only live faces
labelList& directAddr = *directAddrPtr_; directAddrPtr_ = std::make_unique<labelList>
(
labelList::subList(mpm_.faceMap(), mapperLen_)
);
auto& directAddr = *directAddrPtr_;
// Reset the size of addressing list to contain only live faces insertedObjectsPtr_ = std::make_unique<labelList>();
directAddr.setSize(mesh_.nFaces()); auto& inserted = *insertedObjectsPtr_;
insertedFaceLabelsPtr_ = new labelList(mesh_.nFaces()); // The nInsertedObjects_ already counted in the constructor
labelList& insertedFaces = *insertedFaceLabelsPtr_; if (nInsertedObjects_)
label nInsertedFaces = 0;
forAll(directAddr, facei)
{ {
if (directAddr[facei] < 0) inserted.resize(nInsertedObjects_);
{
// Found inserted face
directAddr[facei] = 0;
insertedFaces[nInsertedFaces] = facei;
nInsertedFaces++;
}
}
insertedFaces.setSize(nInsertedFaces); label nInserted = 0;
forAll(directAddr, i)
{
if (directAddr[i] < 0)
{
// Found inserted
directAddr[i] = 0;
inserted[nInserted] = i;
++nInserted;
// TBD: check (nInsertedObjects_ < nInserted)?
#ifdef FULLDEBUG
if (nInsertedObjects_ < nInserted)
{
FatalErrorInFunction
<< "Unexpected insert of more than "
<< nInsertedObjects_ << " items\n"
<< abort(FatalError);
}
#endif
}
}
// TBD: check (nInserted < nInsertedObjects_)?
#ifdef FULLDEBUG
if (nInserted < nInsertedObjects_)
{
WarningInFunction
<< "Found " << nInserted << " instead of "
<< nInsertedObjects_ << " items to insert\n";
}
#endif
// The resize should be unnecessary
inserted.resize(nInserted);
}
} }
else else
{ {
// Interpolative addressing // Interpolative addressing
interpolationAddrPtr_ = new labelListList(mesh_.nFaces()); interpAddrPtr_ = std::make_unique<labelListList>(mapperLen_);
labelListList& addr = *interpolationAddrPtr_; auto& addr = *interpAddrPtr_;
weightsPtr_ = new scalarListList(mesh_.nFaces()); weightsPtr_ = std::make_unique<scalarListList>(mapperLen_);
scalarListList& w = *weightsPtr_; auto& wght = *weightsPtr_;
const List<objectMap>& ffp = mpm_.facesFromPointsMap();
forAll(ffp, ffpI) // Set the addressing and uniform weight
const auto setAddrWeights = [&]
(
const List<objectMap>& maps,
const char * const nameOfMap
)
{ {
// Get addressing for (const objectMap& map : maps)
const labelList& mo = ffp[ffpI].masterObjects();
label facei = ffp[ffpI].index();
if (addr[facei].size())
{ {
FatalErrorInFunction // Get index, addressing
<< "Master face " << facei const label facei = map.index();
<< " mapped from point faces " << mo const labelList& mo = map.masterObjects();
<< " already destination of mapping." << abort(FatalError); if (mo.empty()) continue; // safety
if (addr[facei].size())
{
FatalErrorInFunction
<< "Master face " << facei
<< " already mapped, cannot apply "
<< nameOfMap
<< flatOutput(mo) << abort(FatalError);
}
// Map from masters, uniform weights
addr[facei] = mo;
wght[facei] = scalarList(mo.size(), 1.0/mo.size());
} }
};
// Map from masters, uniform weights
addr[facei] = mo;
w[facei] = scalarList(mo.size(), 1.0/mo.size());
}
const List<objectMap>& ffe = mpm_.facesFromEdgesMap(); setAddrWeights(mpm_.facesFromPointsMap(), "point faces");
setAddrWeights(mpm_.facesFromEdgesMap(), "edge faces");
setAddrWeights(mpm_.facesFromFacesMap(), "face faces");
// Do mapped faces.
// - may already have been set, so check if addressing still empty().
forAll(ffe, ffeI)
{ {
// Get addressing const labelList& map = mpm_.faceMap();
const labelList& mo = ffe[ffeI].masterObjects();
label facei = ffe[ffeI].index(); // NB: faceMap can be longer than nFaces()
for (label facei = 0; facei < mapperLen_; ++facei)
if (addr[facei].size())
{ {
FatalErrorInFunction const label mappedi = map[facei];
<< "Master face " << facei
<< " mapped from edge faces " << mo
<< " already destination of mapping." << abort(FatalError);
}
// Map from masters, uniform weights if (mappedi >= 0 && addr[facei].empty())
addr[facei] = mo; {
w[facei] = scalarList(mo.size(), 1.0/mo.size()); // Mapped from a single face
} addr[facei].resize(1, mappedi);
wght[facei].resize(1, 1.0);
const List<objectMap>& fff = mpm_.facesFromFacesMap(); }
forAll(fff, fffI)
{
// Get addressing
const labelList& mo = fff[fffI].masterObjects();
label facei = fff[fffI].index();
if (addr[facei].size())
{
FatalErrorInFunction
<< "Master face " << facei
<< " mapped from face faces " << mo
<< " already destination of mapping." << abort(FatalError);
}
// Map from masters, uniform weights
addr[facei] = mo;
w[facei] = scalarList(mo.size(), 1.0/mo.size());
}
// Do mapped faces. Note that can already be set from facesFromFaces
// so check if addressing size still zero.
const labelList& fm = mpm_.faceMap();
forAll(fm, facei)
{
if (fm[facei] > -1 && addr[facei].empty())
{
// Mapped from a single face
addr[facei] = labelList(1, fm[facei]);
w[facei] = scalarList(1, 1.0);
} }
} }
// Grab inserted faces (for them the size of addressing is still zero) // Grab inserted faces (for them the size of addressing is still zero)
insertedFaceLabelsPtr_ = new labelList(mesh_.nFaces()); insertedObjectsPtr_ = std::make_unique<labelList>();
labelList& insertedFaces = *insertedFaceLabelsPtr_; auto& inserted = *insertedObjectsPtr_;
label nInsertedFaces = 0; // The nInsertedObjects_ already counted in the constructor
if (nInsertedObjects_)
forAll(addr, facei)
{ {
if (addr[facei].empty()) inserted.resize(nInsertedObjects_);
label nInserted = 0;
forAll(addr, i)
{ {
// Mapped from a dummy face if (addr[i].empty())
addr[facei] = labelList(1, Zero); {
w[facei] = scalarList(1, scalar(1)); // Mapped from dummy face 0
addr[i].resize(1, 0);
wght[i].resize(1, 1.0);
insertedFaces[nInsertedFaces] = facei; inserted[nInserted] = i;
nInsertedFaces++; ++nInserted;
// TBD: check (nInsertedObjects_ < nInserted)?
#ifdef FULLDEBUG
if (nInsertedObjects_ < nInserted)
{
FatalErrorInFunction
<< "Unexpected insert of more than "
<< nInsertedObjects_ << " items\n"
<< abort(FatalError);
}
#endif
}
} }
// TBD: check (nInserted < nInsertedObjects_)?
#ifdef FULLDEBUG
if (nInserted < nInsertedObjects_)
{
WarningInFunction
<< "Found " << nInserted << " instead of "
<< nInsertedObjects_ << " items to insert\n";
}
#endif
// The resize should be unnecessary
inserted.resize(nInserted);
} }
insertedFaces.setSize(nInsertedFaces);
} }
} }
void Foam::faceMapper::clearOut() // void Foam::faceMapper::clearOut()
{ // {
deleteDemandDrivenData(directAddrPtr_); // directAddrPtr_.reset(nullptr);
deleteDemandDrivenData(interpolationAddrPtr_); // interpAddrPtr_.reset(nullptr);
deleteDemandDrivenData(weightsPtr_); // weightsPtr_.reset(nullptr);
deleteDemandDrivenData(insertedFaceLabelsPtr_); // insertedObjectsPtr_.reset(nullptr);
} // }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::faceMapper::faceMapper(const mapPolyMesh& mpm) Foam::faceMapper::faceMapper(const mapPolyMesh& mpm)
: :
mesh_(mpm.mesh()),
mpm_(mpm), mpm_(mpm),
insertedFaces_(true), mapperLen_(mpm.mesh().nFaces()),
direct_(false), nInsertedObjects_(0),
directAddrPtr_(nullptr), direct_
interpolationAddrPtr_(nullptr),
weightsPtr_(nullptr),
insertedFaceLabelsPtr_(nullptr)
{
// Check for possibility of direct mapping
if
( (
mpm_.facesFromPointsMap().empty() // Mapping without interpolation?
&& mpm_.facesFromEdgesMap().empty() mpm.facesFromPointsMap().empty()
&& mpm_.facesFromFacesMap().empty() && mpm.facesFromEdgesMap().empty()
&& mpm.facesFromFacesMap().empty()
) )
{
const auto& directMap = mpm_.faceMap();
if (!mapperLen_)
{ {
// Empty mesh
direct_ = true; direct_ = true;
nInsertedObjects_ = 0;
}
else if (direct_)
{
// Number of inserted faces (-ve values)
nInsertedObjects_ = std::count_if
(
directMap.cbegin(),
directMap.cbegin(mapperLen_),
[](label i) { return (i < 0); }
);
} }
else else
{ {
direct_ = false; // Check if there are inserted faces with no owner
} // (check all lists)
// Check for inserted faces bitSet unmapped(mapperLen_, true);
if (direct_ && (mpm_.faceMap().empty() || min(mpm_.faceMap()) > -1))
{
insertedFaces_ = false;
}
else
{
// Need to check all 3 lists to see if there are inserted faces
// with no owner
// Make a copy of the face map, add the entries for faces from points unmapped.unset(directMap); // direct mapped
// and faces from edges and check for left-overs
labelList fm(mesh_.nFaces(), -1);
const List<objectMap>& ffp = mpm_.facesFromPointsMap(); for (const auto& map : mpm_.facesFromPointsMap())
forAll(ffp, ffpI)
{ {
fm[ffp[ffpI].index()] = 0; if (!map.empty()) unmapped.unset(map.index());
} }
const List<objectMap>& ffe = mpm_.facesFromEdgesMap(); for (const auto& map : mpm_.facesFromEdgesMap())
forAll(ffe, ffeI)
{ {
fm[ffe[ffeI].index()] = 0; if (!map.empty()) unmapped.unset(map.index());
} }
const List<objectMap>& fff = mpm_.facesFromFacesMap(); for (const auto& map : mpm_.facesFromFacesMap())
forAll(fff, fffI)
{ {
fm[fff[fffI].index()] = 0; if (!map.empty()) unmapped.unset(map.index());
} }
if (min(fm) < 0) nInsertedObjects_ = label(unmapped.count());
{
insertedFaces_ = true;
}
} }
} }
@ -275,16 +292,14 @@ Foam::faceMapper::faceMapper(const mapPolyMesh& mpm)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faceMapper::~faceMapper() Foam::faceMapper::~faceMapper()
{ {}
clearOut();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::faceMapper::size() const Foam::label Foam::faceMapper::size() const
{ {
return mesh_.nFaces(); return mapperLen_;
} }
@ -335,12 +350,12 @@ const Foam::labelListList& Foam::faceMapper::addressing() const
<< abort(FatalError); << abort(FatalError);
} }
if (!interpolationAddrPtr_) if (!interpAddrPtr_)
{ {
calcAddressing(); calcAddressing();
} }
return *interpolationAddrPtr_; return *interpAddrPtr_;
} }
@ -364,20 +379,18 @@ const Foam::scalarListList& Foam::faceMapper::weights() const
const Foam::labelList& Foam::faceMapper::insertedObjectLabels() const const Foam::labelList& Foam::faceMapper::insertedObjectLabels() const
{ {
if (!insertedFaceLabelsPtr_) if (!insertedObjectsPtr_)
{ {
if (!insertedObjects()) if (!nInsertedObjects_)
{ {
// There are no inserted faces // No inserted objects will be created
insertedFaceLabelsPtr_ = new labelList(0); return labelList::null();
}
else
{
calcAddressing();
} }
calcAddressing();
} }
return *insertedFaceLabelsPtr_; return *insertedObjectsPtr_;
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef faceMapper_H #ifndef Foam_faceMapper_H
#define faceMapper_H #define Foam_faceMapper_H
#include "morphFieldMapper.H" #include "morphFieldMapper.H"
#include "HashSet.H" #include "HashSet.H"
@ -47,8 +48,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward Declarations
class polyMesh;
class mapPolyMesh; class mapPolyMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -59,38 +59,45 @@ class faceMapper
: :
public morphFieldMapper public morphFieldMapper
{ {
// Private data // Private Data
//- Reference to polyMesh
const polyMesh& mesh_;
//- Reference to mapPolyMesh //- Reference to mapPolyMesh
const mapPolyMesh& mpm_; const mapPolyMesh& mpm_;
//- Are there any inserted (unmapped) faces //- The size of the mapper = polyMesh::nFaces()
bool insertedFaces_; const label mapperLen_;
//- Number of inserted (unmapped) faces
label nInsertedObjects_;
//- Is the mapping direct //- Is the mapping direct
bool direct_; bool direct_;
// Demand-driven private data // Demand-Driven Data
//- Direct addressing (only one for of addressing is used) //- Direct addressing (only one for of addressing is used)
mutable labelList* directAddrPtr_; mutable std::unique_ptr<labelList> directAddrPtr_;
//- Interpolated addressing (only one for of addressing is used) //- Interpolated addressing (only one for of addressing is used)
mutable labelListList* interpolationAddrPtr_; mutable std::unique_ptr<labelListList> interpAddrPtr_;
//- Interpolation weights //- Interpolation weights
mutable scalarListList* weightsPtr_; mutable std::unique_ptr<scalarListList> weightsPtr_;
//- Inserted faces //- Inserted faces
mutable labelList* insertedFaceLabelsPtr_; mutable std::unique_ptr<labelList> insertedObjectsPtr_;
// Private Member Functions // Private Member Functions
//- Calculate addressing for mapping with inserted faces
void calcAddressing() const;
public:
// Generated Methods
//- No copy construct //- No copy construct
faceMapper(const faceMapper&) = delete; faceMapper(const faceMapper&) = delete;
@ -98,21 +105,10 @@ class faceMapper
void operator=(const faceMapper&) = delete; void operator=(const faceMapper&) = delete;
//- Calculate addressing for mapping with inserted faces
void calcAddressing() const;
//- Clear out local storage
void clearOut();
public:
// Static data members
// Constructors // Constructors
//- Construct from mapPolyMesh //- Construct from mapPolyMesh
faceMapper(const mapPolyMesh& mpm); explicit faceMapper(const mapPolyMesh& mpm);
//- Destructor //- Destructor
@ -121,7 +117,7 @@ public:
// Member Functions // Member Functions
//- Return size //- The mapper size
virtual label size() const; virtual label size() const;
//- Return size of field before mapping //- Return size of field before mapping
@ -165,7 +161,7 @@ public:
//- Are there any inserted faces //- Are there any inserted faces
virtual bool insertedObjects() const virtual bool insertedObjects() const
{ {
return insertedFaces_; return bool(nInsertedObjects_);
} }
//- Return list of inserted faces //- Return list of inserted faces

View File

@ -257,7 +257,7 @@ Foam::mapPolyMesh::mapPolyMesh
oldCellVolumesPtr_ = oldCellVolumesPtr.clone(); oldCellVolumesPtr_ = oldCellVolumesPtr.clone();
} }
if (oldPatchStarts_.size() > 0) if (oldPatchStarts_.size())
{ {
// Calculate old patch sizes // Calculate old patch sizes
for (label patchi = 0; patchi < oldPatchStarts_.size() - 1; patchi++) for (label patchi = 0; patchi < oldPatchStarts_.size() - 1; patchi++)

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -153,6 +153,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class polyMesh; class polyMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -161,7 +162,7 @@ class polyMesh;
class mapPolyMesh class mapPolyMesh
{ {
// Private data // Private Data
//- Reference to polyMesh //- Reference to polyMesh
const polyMesh& mesh_; const polyMesh& mesh_;
@ -273,7 +274,9 @@ class mapPolyMesh
autoPtr<scalarField> oldCellVolumesPtr_; autoPtr<scalarField> oldCellVolumesPtr_;
// Private Member Functions public:
// Generated Methods
//- No copy construct //- No copy construct
mapPolyMesh(const mapPolyMesh&) = delete; mapPolyMesh(const mapPolyMesh&) = delete;
@ -282,14 +285,13 @@ class mapPolyMesh
void operator=(const mapPolyMesh&) = delete; void operator=(const mapPolyMesh&) = delete;
public:
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh
mapPolyMesh(const polyMesh& mesh); mapPolyMesh(const polyMesh& mesh);
//- Construct from components. Copy (except for oldCellVolumes). //- Copy construct from components,
//- except for oldCellVolumes which is move construct
mapPolyMesh mapPolyMesh
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -356,18 +358,19 @@ public:
const bool reuse const bool reuse
); );
// Member Functions // Member Functions
// Access // Access
//- Return polyMesh //- Return polyMesh
const polyMesh& mesh() const const polyMesh& mesh() const noexcept
{ {
return mesh_; return mesh_;
} }
//- Number of old points //- Number of old points
label nOldPoints() const label nOldPoints() const noexcept
{ {
return nOldPoints_; return nOldPoints_;
} }
@ -379,13 +382,13 @@ public:
} }
//- Number of old faces //- Number of old faces
label nOldFaces() const label nOldFaces() const noexcept
{ {
return nOldFaces_; return nOldFaces_;
} }
//- Number of old cells //- Number of old cells
label nOldCells() const label nOldCells() const noexcept
{ {
return nOldCells_; return nOldCells_;
} }
@ -394,13 +397,13 @@ public:
// Contains the old point label for all new points. // Contains the old point label for all new points.
// For preserved points this is the old point label. // For preserved points this is the old point label.
// For added points this is the master point ID // For added points this is the master point ID
const labelList& pointMap() const const labelList& pointMap() const noexcept
{ {
return pointMap_; return pointMap_;
} }
//- Points originating from points //- Points originating from points
const List<objectMap>& pointsFromPointsMap() const const List<objectMap>& pointsFromPointsMap() const noexcept
{ {
return pointsFromPointsMap_; return pointsFromPointsMap_;
} }
@ -408,56 +411,56 @@ public:
//- Old face map. //- Old face map.
// Contains a list of old face labels for every new face. // Contains a list of old face labels for every new face.
// Warning: this map contains invalid entries for new faces // Warning: this map contains invalid entries for new faces
const labelList& faceMap() const const labelList& faceMap() const noexcept
{ {
return faceMap_; return faceMap_;
} }
//- Faces inflated from points //- Faces inflated from points
const List<objectMap>& facesFromPointsMap() const const List<objectMap>& facesFromPointsMap() const noexcept
{ {
return facesFromPointsMap_; return facesFromPointsMap_;
} }
//- Faces inflated from edges //- Faces inflated from edges
const List<objectMap>& facesFromEdgesMap() const const List<objectMap>& facesFromEdgesMap() const noexcept
{ {
return facesFromEdgesMap_; return facesFromEdgesMap_;
} }
//- Faces originating from faces //- Faces originating from faces
const List<objectMap>& facesFromFacesMap() const const List<objectMap>& facesFromFacesMap() const noexcept
{ {
return facesFromFacesMap_; return facesFromFacesMap_;
} }
//- Old cell map. //- Old cell map.
// Contains old cell label for all preserved cells. // Contains old cell label for all preserved cells.
const labelList& cellMap() const const labelList& cellMap() const noexcept
{ {
return cellMap_; return cellMap_;
} }
//- Cells inflated from points //- Cells inflated from points
const List<objectMap>& cellsFromPointsMap() const const List<objectMap>& cellsFromPointsMap() const noexcept
{ {
return cellsFromPointsMap_; return cellsFromPointsMap_;
} }
//- Cells inflated from edges //- Cells inflated from edges
const List<objectMap>& cellsFromEdgesMap() const const List<objectMap>& cellsFromEdgesMap() const noexcept
{ {
return cellsFromEdgesMap_; return cellsFromEdgesMap_;
} }
//- Cells inflated from faces //- Cells inflated from faces
const List<objectMap>& cellsFromFacesMap() const const List<objectMap>& cellsFromFacesMap() const noexcept
{ {
return cellsFromFacesMap_; return cellsFromFacesMap_;
} }
//- Cells originating from cells //- Cells originating from cells
const List<objectMap>& cellsFromCellsMap() const const List<objectMap>& cellsFromCellsMap() const noexcept
{ {
return cellsFromCellsMap_; return cellsFromCellsMap_;
} }
@ -467,7 +470,7 @@ public:
//- Reverse point map //- Reverse point map
// Contains new point label for all old and added points // Contains new point label for all old and added points
const labelList& reversePointMap() const const labelList& reversePointMap() const noexcept
{ {
return reversePointMap_; return reversePointMap_;
} }
@ -499,7 +502,7 @@ public:
//- Reverse face map //- Reverse face map
// Contains new face label for all old and added faces // Contains new face label for all old and added faces
const labelList& reverseFaceMap() const const labelList& reverseFaceMap() const noexcept
{ {
return reverseFaceMap_; return reverseFaceMap_;
} }
@ -530,7 +533,7 @@ public:
//- Reverse cell map //- Reverse cell map
// Contains new cell label for all old and added cells // Contains new cell label for all old and added cells
const labelList& reverseCellMap() const const labelList& reverseCellMap() const noexcept
{ {
return reverseCellMap_; return reverseCellMap_;
} }
@ -560,7 +563,7 @@ public:
} }
//- Map of flipped face flux faces //- Map of flipped face flux faces
const labelHashSet& flipFaceFlux() const const labelHashSet& flipFaceFlux() const noexcept
{ {
return flipFaceFlux_; return flipFaceFlux_;
} }
@ -568,7 +571,7 @@ public:
//- Patch point renumbering //- Patch point renumbering
// For every preserved point on a patch give the old position. // For every preserved point on a patch give the old position.
// For added points, the index is set to -1 // For added points, the index is set to -1
const labelListList& patchPointMap() const const labelListList& patchPointMap() const noexcept
{ {
return patchPointMap_; return patchPointMap_;
} }
@ -579,7 +582,7 @@ public:
//- Point zone renumbering //- Point zone renumbering
// For every preserved point in zone give the old position. // For every preserved point in zone give the old position.
// For added points, the index is set to -1 // For added points, the index is set to -1
const labelListList& pointZoneMap() const const labelListList& pointZoneMap() const noexcept
{ {
return pointZoneMap_; return pointZoneMap_;
} }
@ -587,7 +590,7 @@ public:
//- Face zone point renumbering //- Face zone point renumbering
// For every preserved point in zone give the old position. // For every preserved point in zone give the old position.
// For added points, the index is set to -1 // For added points, the index is set to -1
const labelListList& faceZonePointMap() const const labelListList& faceZonePointMap() const noexcept
{ {
return faceZonePointMap_; return faceZonePointMap_;
} }
@ -595,7 +598,7 @@ public:
//- Face zone face renumbering //- Face zone face renumbering
// For every preserved face in zone give the old position. // For every preserved face in zone give the old position.
// For added faces, the index is set to -1 // For added faces, the index is set to -1
const labelListList& faceZoneFaceMap() const const labelListList& faceZoneFaceMap() const noexcept
{ {
return faceZoneFaceMap_; return faceZoneFaceMap_;
} }
@ -603,7 +606,7 @@ public:
//- Cell zone renumbering //- Cell zone renumbering
// For every preserved cell in zone give the old position. // For every preserved cell in zone give the old position.
// For added cells, the index is set to -1 // For added cells, the index is set to -1
const labelListList& cellZoneMap() const const labelListList& cellZoneMap() const noexcept
{ {
return cellZoneMap_; return cellZoneMap_;
} }
@ -611,49 +614,48 @@ public:
//- Pre-motion point positions. //- Pre-motion point positions.
// This specifies the correct way of blowing up // This specifies the correct way of blowing up
// zero-volume objects // zero-volume objects
const pointField& preMotionPoints() const const pointField& preMotionPoints() const noexcept
{ {
return preMotionPoints_; return preMotionPoints_;
} }
//- Has valid preMotionPoints? //- Has valid preMotionPoints?
bool hasMotionPoints() const bool hasMotionPoints() const noexcept
{ {
return preMotionPoints_.size() > 0; return !preMotionPoints_.empty();
} }
//- Return list of the old patch sizes //- Return list of the old patch sizes
const labelList& oldPatchSizes() const const labelList& oldPatchSizes() const noexcept
{ {
return oldPatchSizes_; return oldPatchSizes_;
} }
//- Return list of the old patch start labels //- Return list of the old patch start labels
const labelList& oldPatchStarts() const const labelList& oldPatchStarts() const noexcept
{ {
return oldPatchStarts_; return oldPatchStarts_;
} }
//- Return numbers of mesh points per old patch //- Return numbers of mesh points per old patch
const labelList& oldPatchNMeshPoints() const const labelList& oldPatchNMeshPoints() const noexcept
{ {
return oldPatchNMeshPoints_; return oldPatchNMeshPoints_;
} }
// Geometric mapping data // Geometric mapping data
bool hasOldCellVolumes() const bool hasOldCellVolumes() const noexcept
{ {
return bool(oldCellVolumesPtr_); return bool(oldCellVolumesPtr_);
} }
const scalarField& oldCellVolumes() const
{
return *oldCellVolumesPtr_;
}
const scalarField& oldCellVolumes() const
{
return *oldCellVolumesPtr_;
}
}; };

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -35,10 +36,10 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef objectMap_H #ifndef Foam_objectMap_H
#define objectMap_H #define Foam_objectMap_H
#include "labelList.H" #include "List.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -46,7 +47,6 @@ namespace Foam
{ {
// Forward Declarations // Forward Declarations
class objectMap; class objectMap;
inline bool operator==(const objectMap& a, const objectMap& b); inline bool operator==(const objectMap& a, const objectMap& b);
inline bool operator!=(const objectMap& a, const objectMap& b); inline bool operator!=(const objectMap& a, const objectMap& b);
@ -60,38 +60,51 @@ inline Istream& operator>>(Istream&, objectMap&);
class objectMap class objectMap
{ {
// Private data // Private Data
//- Object index //- Object index
label index_; label index_;
//- Master object index //- Master object indices
labelList masterObjects_; labelList objects_;
public: public:
// Constructors // Constructors
//- Null constructor, with index=-1 and no objects //- Default construct, with index=-1 and no objects
inline objectMap(); objectMap() noexcept : index_(-1) {}
//- Construct from components //- Copy construct from components
inline objectMap(const label index, const UList<label>& master); inline objectMap(const label index, const labelUList& master);
//- Move construct from components
inline objectMap(const label index, labelList&& master);
//- Construct from Istream //- Construct from Istream
inline objectMap(Istream& is); inline explicit objectMap(Istream& is);
// Member Functions // Member Functions
//- Return object index //- True if there are no objects
inline label& index(); bool empty() const noexcept { return objects_.empty(); }
inline label index() const;
//- Return master object index //- The number of objects
inline labelList& masterObjects(); label size() const noexcept { return objects_.size(); }
inline const labelList& masterObjects() const;
//- The object index
label& index() noexcept { return index_; }
//- The object index
label index() const noexcept { return index_; }
//- The master object indices
labelList& masterObjects() noexcept { return objects_; }
//- The master object indices
const labelList& masterObjects() const noexcept { return objects_; }
// Friend Operators // Friend Operators

View File

@ -29,17 +29,17 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::objectMap::objectMap() inline Foam::objectMap::objectMap(const label index, const labelUList& master)
: :
index_(-1), index_(index),
masterObjects_() objects_(master)
{} {}
inline Foam::objectMap::objectMap(const label index, const UList<label>& master) inline Foam::objectMap::objectMap(const label index, labelList&& master)
: :
index_(index), index_(index),
masterObjects_(master) objects_(std::move(master))
{} {}
@ -47,46 +47,20 @@ inline Foam::objectMap::objectMap(Istream& is)
{ {
is.readBegin("objectMap"); is.readBegin("objectMap");
is >> index_ >> static_cast<labelList&>(masterObjects_); is >> index_ >> objects_;
is.readEnd("objectMap"); is.readEnd("objectMap");
is.check(FUNCTION_NAME); is.check(FUNCTION_NAME);
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label& Foam::objectMap::index()
{
return index_;
}
inline Foam::label Foam::objectMap::index() const
{
return index_;
}
inline Foam::labelList& Foam::objectMap::masterObjects()
{
return masterObjects_;
}
inline const Foam::labelList& Foam::objectMap::masterObjects() const
{
return masterObjects_;
}
// * * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * //
inline bool Foam::operator==(const objectMap& a, const objectMap& b) inline bool Foam::operator==(const objectMap& a, const objectMap& b)
{ {
return return
( (
(a.index_ == b.index_) && (a.masterObjects_ == b.masterObjects_) (a.index_ == b.index_) && (a.objects_ == b.objects_)
); );
} }
@ -103,7 +77,7 @@ inline Foam::Ostream& Foam::operator<<(Ostream& os, const objectMap& a)
{ {
os << token::BEGIN_LIST os << token::BEGIN_LIST
<< a.index_ << token::SPACE << a.index_ << token::SPACE
<< a.masterObjects_ << a.objects_
<< token::END_LIST; << token::END_LIST;
os.check(FUNCTION_NAME); os.check(FUNCTION_NAME);
@ -114,7 +88,7 @@ inline Foam::Ostream& Foam::operator<<(Ostream& os, const objectMap& a)
inline Foam::Istream& Foam::operator>>(Istream& is, objectMap& a) inline Foam::Istream& Foam::operator>>(Istream& is, objectMap& a)
{ {
is.readBegin("objectMap"); is.readBegin("objectMap");
is >> a.index_ >> a.masterObjects_; is >> a.index_ >> a.objects_;
is.readEnd("objectMap"); is.readEnd("objectMap");
is.check(FUNCTION_NAME); is.check(FUNCTION_NAME);

View File

@ -54,10 +54,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF, const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict, const dictionary& dict,
const bool valueRequired const bool needValue
) )
: :
fixedJumpFvPatchField<scalar>(p, iF, dict, false), fixedJumpFvPatchField<scalar>(p, iF, dict, false), // needValue = false
phiName_(dict.getOrDefault<word>("phi", "phi")), phiName_(dict.getOrDefault<word>("phi", "phi")),
rhoName_(dict.getOrDefault<word>("rho", "rho")), rhoName_(dict.getOrDefault<word>("rho", "rho")),
D_(Function1<scalar>::New("D", dict, &db())), D_(Function1<scalar>::New("D", dict, &db())),
@ -65,7 +65,7 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
length_(dict.get<scalar>("length")), length_(dict.get<scalar>("length")),
uniformJump_(dict.getOrDefault("uniformJump", false)) uniformJump_(dict.getOrDefault("uniformJump", false))
{ {
if (valueRequired) if (needValue)
{ {
if (!this->readValueEntry(dict)) if (!this->readValueEntry(dict))
{ {

View File

@ -163,7 +163,7 @@ public:
const fvPatch&, const fvPatch&,
const DimensionedField<scalar, volMesh>&, const DimensionedField<scalar, volMesh>&,
const dictionary&, const dictionary&,
const bool valueRequired = true const bool needValue = true
); );
//- Construct by mapping given porousBafflePressureFvPatchField //- Construct by mapping given porousBafflePressureFvPatchField

View File

@ -27,7 +27,6 @@ License
#include "faAreaMapper.H" #include "faAreaMapper.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -38,9 +37,9 @@ void Foam::faAreaMapper::calcAddressing() const
newFaceLabelsPtr_ newFaceLabelsPtr_
|| newFaceLabelsMapPtr_ || newFaceLabelsMapPtr_
|| directAddrPtr_ || directAddrPtr_
|| interpolationAddrPtr_ || interpAddrPtr_
|| weightsPtr_ || weightsPtr_
|| insertedObjectLabelsPtr_ || insertedObjectsPtr_
) )
{ {
FatalErrorInFunction FatalErrorInFunction
@ -73,7 +72,7 @@ void Foam::faAreaMapper::calcAddressing() const
mesh_.mesh().nBoundaryFaces(), mesh_.mesh().nBoundaryFaces(),
-1 -1
); );
labelList& newFaceLabelsMap = *newFaceLabelsMapPtr_; auto& newFaceLabelsMap = *newFaceLabelsMapPtr_;
label nNewFaces = 0; label nNewFaces = 0;
Info<< "Old face list size: " << oldFaces.size() Info<< "Old face list size: " << oldFaces.size()
@ -91,7 +90,7 @@ void Foam::faAreaMapper::calcAddressing() const
newFaceLabels[nNewFaces] = reverseFaceMap[oldFaces[faceI]]; newFaceLabels[nNewFaces] = reverseFaceMap[oldFaces[faceI]];
newFaceLabelsMap[nNewFaces] = faceI; newFaceLabelsMap[nNewFaces] = faceI;
nNewFaces++; ++nNewFaces;
} }
} }
@ -100,21 +99,20 @@ void Foam::faAreaMapper::calcAddressing() const
{ {
Info<< "Direct"<< endl; Info<< "Direct"<< endl;
// Direct mapping: no further faces to add. Resize list // Direct mapping: no further faces to add. Resize list
newFaceLabels.setSize(nNewFaces); newFaceLabels.resize(nNewFaces);
directAddrPtr_ = std::make_unique<labelList>(newFaceLabels.size()); directAddrPtr_ = std::make_unique<labelList>
labelList& addr = *directAddrPtr_; (
labelList::subList(newFaceLabelsMap, nNewFaces)
);
auto& addr = *directAddrPtr_;
// Adjust for creation of a boundary face from an internal face // Adjust for creation of a boundary face from an internal face
forAll(addr, faceI) forAll(addr, facei)
{ {
if (newFaceLabelsMap[faceI] < oldNInternal) if (addr[facei] < oldNInternal)
{ {
addr[faceI] = 0; addr[facei] = 0;
}
else
{
addr[faceI] = newFaceLabelsMap[faceI];
} }
} }
} }
@ -122,20 +120,20 @@ void Foam::faAreaMapper::calcAddressing() const
{ {
// There are further faces to add. Prepare interpolation addressing // There are further faces to add. Prepare interpolation addressing
// and weights to full size // and weights to full size
interpolationAddrPtr_ = std::make_unique<labelListList> interpAddrPtr_ = std::make_unique<labelListList>
( (
newFaceLabels.size() newFaceLabels.size()
); );
labelListList& addr = *interpolationAddrPtr_; auto& addr = *interpAddrPtr_;
weightsPtr_ = std::make_unique<scalarListList>(newFaceLabels.size()); weightsPtr_ = std::make_unique<scalarListList>(addr.size());
scalarListList& w = *weightsPtr_; auto& wght = *weightsPtr_;
// Insert single addressing and weights // Insert single addressing and weights
for (label addrI = 0; addrI < nNewFaces; ++addrI) for (label addrI = 0; addrI < nNewFaces; ++addrI)
{ {
addr[addrI] = labelList(1, newFaceLabelsMap[addrI]); addr[addrI].resize(1, newFaceLabelsMap[addrI]);
w[addrI] = scalarList(1, scalar(1)); wght[addrI].resize(1, 1.0);
} }
// Pick up faces from points, edges and faces where the origin // Pick up faces from points, edges and faces where the origin
@ -143,146 +141,87 @@ void Foam::faAreaMapper::calcAddressing() const
// fast lookup // fast lookup
// Set of faces previously in the mesh // Set of faces previously in the mesh
labelHashSet oldFaceLookup(oldFaces); const labelHashSet oldFaceLookup(oldFaces);
// Check if master objects are in faMesh
DynamicList<label> validMo(128);
const auto addCheckedObjects = [&](const List<objectMap>& maps)
{
for (const objectMap& map : maps)
{
// Get target index, addressing
const label facei = map.index();
const labelList& mo = map.masterObjects();
if (mo.empty()) continue; // safety
validMo.clear();
validMo.reserve(mo.size());
for (const label obji : mo)
{
if (oldFaceLookup.contains(obji))
{
validMo.push_back(obji);
}
}
if (validMo.size())
{
// Some objects found: add face and interpolation to list
newFaceLabels[nNewFaces] = facei;
// No old face available
newFaceLabelsMap[nNewFaces] = -1;
// Map from masters, uniform weights
addr[nNewFaces] = validMo;
wght[nNewFaces] =
scalarList(validMo.size(), 1.0/validMo.size());
++nNewFaces;
}
}
};
// Go through faces-from lists and add the ones where all // Go through faces-from lists and add the ones where all
// old face labels belonged to the faMesh // old face labels belonged to the faMesh
const List<objectMap>& ffp = mpm_.facesFromPointsMap();
forAll(ffp, ffpI)
{ {
// Get addressing addCheckedObjects(mpm_.facesFromPointsMap());
const labelList& mo = ffp[ffpI].masterObjects(); addCheckedObjects(mpm_.facesFromEdgesMap());
addCheckedObjects(mpm_.facesFromFacesMap());
// Check if master objects are in faMesh
labelList validMo(mo.size());
label nValidMo = 0;
forAll(mo, moI)
{
if (oldFaceLookup.found(mo[moI]))
{
validMo[nValidMo] = oldFaceLookup[mo[moI]];
nValidMo++;
}
}
if (nValidMo > 0)
{
// Some objects found: add face and interpolation to list
newFaceLabels[nNewFaces] = ffp[ffpI].index();
// No old face available
newFaceLabelsMap[nNewFaces] = -1;
// Map from masters, uniform weights
addr[nNewFaces] = validMo;
w[nNewFaces] = scalarList(validMo.size(), 1.0/validMo.size());
nNewFaces++;
}
}
const List<objectMap>& ffe = mpm_.facesFromEdgesMap();
forAll(ffe, ffeI)
{
// Get addressing
const labelList& mo = ffe[ffeI].masterObjects();
// Check if master objects are in faMesh
labelList validMo(mo.size());
label nValidMo = 0;
forAll(mo, moI)
{
if (oldFaceLookup.found(mo[moI]))
{
validMo[nValidMo] = oldFaceLookup[mo[moI]];
nValidMo++;
}
}
if (nValidMo > 0)
{
// Some objects found: add face and interpolation to list
newFaceLabels[nNewFaces] = ffe[ffeI].index();
// No old face available
newFaceLabelsMap[nNewFaces] = -1;
// Map from masters, uniform weights
addr[nNewFaces] = validMo;
w[nNewFaces] = scalarList(validMo.size(), 1.0/validMo.size());
nNewFaces++;
}
}
const List<objectMap>& fff = mpm_.facesFromFacesMap();
forAll(fff, fffI)
{
// Get addressing
const labelList& mo = fff[fffI].masterObjects();
// Check if master objects are in faMesh
labelList validMo(mo.size());
label nValidMo = 0;
forAll(mo, moI)
{
if (oldFaceLookup.found(mo[moI]))
{
validMo[nValidMo] = oldFaceLookup[mo[moI]];
nValidMo++;
}
}
if (nValidMo > 0)
{
// Some objects found: add face and interpolation to list
newFaceLabels[nNewFaces] = fff[fffI].index();
// No old face available
newFaceLabelsMap[nNewFaces] = -1;
// Map from masters, uniform weights
addr[nNewFaces] = validMo;
w[nNewFaces] = scalarList(validMo.size(), 1.0/validMo.size());
nNewFaces++;
}
} }
// All faces collected. Reset sizes of lists // All faces collected. Reset sizes of lists
newFaceLabels.setSize(nNewFaces); newFaceLabels.resize(nNewFaces);
newFaceLabelsMap.setSize(nNewFaces); newFaceLabelsMap.resize(nNewFaces);
addr.setSize(nNewFaces); addr.resize(nNewFaces);
w.setSize(nNewFaces); wght.resize(nNewFaces);
Info<< "addr: " << addr << nl Info<< "addr: " << addr << nl
<< "w: " << w << endl; << "wght: " << wght << endl;
} }
// Inserted objects cannot appear in the new faMesh as they have no master // Inserted objects cannot appear in the new faMesh as they have no master
// HJ, 10/Aug/2011 // HJ, 10/Aug/2011
insertedObjectLabelsPtr_ = std::make_unique<labelList>(); insertedObjectsPtr_ = std::make_unique<labelList>();
} }
void Foam::faAreaMapper::clearOut() // void Foam::faAreaMapper::clearOut()
{ // {
newFaceLabelsPtr_.reset(nullptr); // newFaceLabelsPtr_.reset(nullptr);
newFaceLabelsMapPtr_.reset(nullptr); // newFaceLabelsMapPtr_.reset(nullptr);
//
directAddrPtr_.reset(nullptr); // directAddrPtr_.reset(nullptr);
interpolationAddrPtr_.reset(nullptr); // interpAddrPtr_.reset(nullptr);
weightsPtr_.reset(nullptr); // weightsPtr_.reset(nullptr);
//
insertedObjectLabelsPtr_.reset(nullptr); // insertedObjectsPtr_.reset(nullptr);
hasUnmapped_ = false; // hasUnmapped_ = false;
} // }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -295,25 +234,16 @@ Foam::faAreaMapper::faAreaMapper
: :
mesh_(mesh), mesh_(mesh),
mpm_(mpm), mpm_(mpm),
direct_(false), sizeBeforeMapping_(mesh.nFaces()),
hasUnmapped_(false), direct_
sizeBeforeMapping_(mesh.nFaces())
{
// Check for possibility of direct mapping
if
( (
mpm_.facesFromPointsMap().empty() // Mapping without interpolation?
&& mpm_.facesFromEdgesMap().empty() mpm.facesFromPointsMap().empty()
&& mpm_.facesFromFacesMap().empty() && mpm.facesFromEdgesMap().empty()
) && mpm.facesFromFacesMap().empty()
{ ),
direct_ = true; hasUnmapped_(false)
} {
else
{
direct_ = false;
}
// Inserted objects not supported: no master // Inserted objects not supported: no master
} }
@ -321,9 +251,7 @@ Foam::faAreaMapper::faAreaMapper
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faAreaMapper::~faAreaMapper() Foam::faAreaMapper::~faAreaMapper()
{ {}
clearOut();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -377,12 +305,12 @@ const Foam::labelListList& Foam::faAreaMapper::addressing() const
<< abort(FatalError); << abort(FatalError);
} }
if (!interpolationAddrPtr_) if (!interpAddrPtr_)
{ {
calcAddressing(); calcAddressing();
} }
return *interpolationAddrPtr_; return *interpAddrPtr_;
} }
@ -406,12 +334,12 @@ const Foam::scalarListList& Foam::faAreaMapper::weights() const
const Foam::labelList& Foam::faAreaMapper::insertedObjectLabels() const const Foam::labelList& Foam::faAreaMapper::insertedObjectLabels() const
{ {
if (!insertedObjectLabelsPtr_) if (!insertedObjectsPtr_)
{ {
calcAddressing(); calcAddressing();
} }
return *insertedObjectLabelsPtr_; return *insertedObjectsPtr_;
} }

View File

@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef faAreaMapper_H #ifndef Foam_faAreaMapper_H
#define faAreaMapper_H #define Foam_faAreaMapper_H
#include "morphFieldMapper.H" #include "morphFieldMapper.H"
#include "faMesh.H" #include "faMesh.H"
@ -65,17 +65,17 @@ class faAreaMapper
//- Reference to mapPolyMesh //- Reference to mapPolyMesh
const mapPolyMesh& mpm_; const mapPolyMesh& mpm_;
//- Size before mapping (old mesh size)
const label sizeBeforeMapping_;
//- Is the mapping direct //- Is the mapping direct
bool direct_; bool direct_;
// Demand-driven private data // Demand-Driven Data
mutable bool hasUnmapped_; mutable bool hasUnmapped_;
//- Old mesh size
label sizeBeforeMapping_;
//- New face labels after mapping //- New face labels after mapping
mutable std::unique_ptr<labelList> newFaceLabelsPtr_; mutable std::unique_ptr<labelList> newFaceLabelsPtr_;
@ -87,13 +87,13 @@ class faAreaMapper
mutable std::unique_ptr<labelList> directAddrPtr_; mutable std::unique_ptr<labelList> directAddrPtr_;
//- Interpolated addressing (only one form of addressing is used) //- Interpolated addressing (only one form of addressing is used)
mutable std::unique_ptr<labelListList> interpolationAddrPtr_; mutable std::unique_ptr<labelListList> interpAddrPtr_;
//- Interpolation weights //- Interpolation weights
mutable std::unique_ptr<scalarListList> weightsPtr_; mutable std::unique_ptr<scalarListList> weightsPtr_;
//- Inserted faces //- Inserted faces
mutable std::unique_ptr<labelList> insertedObjectLabelsPtr_; mutable std::unique_ptr<labelList> insertedObjectsPtr_;
// Private Member Functions // Private Member Functions
@ -101,9 +101,6 @@ class faAreaMapper
//- Calculate addressing //- Calculate addressing
void calcAddressing() const; void calcAddressing() const;
//- Clear out local storage
void clearOut();
public: public:
@ -116,17 +113,20 @@ public:
void operator=(const faAreaMapper&) = delete; void operator=(const faAreaMapper&) = delete;
//- Construct from components // Constructors
faAreaMapper
( //- Construct from components
const faMesh& mesh, faAreaMapper
const mapPolyMesh& mpm (
); const faMesh& mesh,
const mapPolyMesh& mpm
);
//- Destructor //- Destructor
virtual ~faAreaMapper(); virtual ~faAreaMapper();
// Member Functions // Member Functions
//- Return new face labels //- Return new face labels

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef faBoundaryMeshMapper_H #ifndef Foam_faBoundaryMeshMapper_H
#define faBoundaryMeshMapper_H #define Foam_faBoundaryMeshMapper_H
#include "faPatchMapper.H" #include "faPatchMapper.H"

View File

@ -27,7 +27,6 @@ License
#include "faEdgeMapper.H" #include "faEdgeMapper.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -47,11 +46,11 @@ void Foam::faEdgeMapper::calcAddressing() const
} }
void Foam::faEdgeMapper::clearOut() // void Foam::faEdgeMapper::clearOut()
{ // {
directAddrPtr_.reset(nullptr); // directAddrPtr_.reset(nullptr);
hasUnmapped_ = false; // hasUnmapped_ = false;
} // }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -62,7 +61,9 @@ Foam::faEdgeMapper::faEdgeMapper
const mapPolyMesh& mpm const mapPolyMesh& mpm
) )
: :
mesh_(mesh), // currently unused: mesh_(mesh),
// currently unused: mpm_(mpm),
mapperLen_(mesh.nInternalEdges()),
sizeBeforeMapping_(mesh.nInternalEdges()), sizeBeforeMapping_(mesh.nInternalEdges()),
hasUnmapped_(false) hasUnmapped_(false)
{} {}
@ -71,13 +72,17 @@ Foam::faEdgeMapper::faEdgeMapper
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faEdgeMapper::~faEdgeMapper() Foam::faEdgeMapper::~faEdgeMapper()
{ {}
clearOut();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::faEdgeMapper::size() const
{
return mapperLen_;
}
const Foam::labelUList& Foam::faEdgeMapper::directAddressing() const const Foam::labelUList& Foam::faEdgeMapper::directAddressing() const
{ {
if (!directAddrPtr_) if (!directAddrPtr_)

View File

@ -39,8 +39,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef faEdgeMapper_H #ifndef Foam_faEdgeMapper_H
#define faEdgeMapper_H #define Foam_faEdgeMapper_H
#include "morphFieldMapper.H" #include "morphFieldMapper.H"
#include "faMesh.H" #include "faMesh.H"
@ -63,13 +63,19 @@ class faEdgeMapper
// Private Data // Private Data
//- Reference to mesh //- Reference to mesh
const faMesh& mesh_; // currently unused: const faMesh& mesh_;
//- Old mesh size //- Reference to mapPolyMesh
label sizeBeforeMapping_; // currently unused: const mapPolyMesh& mpm_;
//- The size of the mapper = mesh_.nInternalEdges()
const label mapperLen_;
//- Size before mapping (old mesh size)
const label sizeBeforeMapping_;
// Demand-driven private data // Demand-Driven Data
mutable bool hasUnmapped_; mutable bool hasUnmapped_;
@ -82,10 +88,6 @@ class faEdgeMapper
//- Calculate addressing //- Calculate addressing
void calcAddressing() const; void calcAddressing() const;
//- Clear out local storage
void clearOut();
public: public:
// Generated Methods // Generated Methods
@ -97,12 +99,14 @@ public:
void operator=(const faEdgeMapper&) = delete; void operator=(const faEdgeMapper&) = delete;
//- Construct from components // Constructors
faEdgeMapper
( //- Construct from components
const faMesh& mesh, faEdgeMapper
const mapPolyMesh& mpm (
); const faMesh& mesh,
const mapPolyMesh& mpm
);
//- Destructor //- Destructor
@ -111,11 +115,8 @@ public:
// Member Functions // Member Functions
//- Return size //- Return mapper size
virtual label size() const virtual label size() const;
{
return mesh_.nInternalEdges();
}
//- Return size of field before mapping //- Return size of field before mapping
virtual label sizeBeforeMapping() const virtual label sizeBeforeMapping() const
@ -143,13 +144,13 @@ public:
//- Return interpolation weights //- Return interpolation weights
virtual const scalarListList& weights() const; virtual const scalarListList& weights() const;
//- Are there any inserted faces //- Are there any inserted edges
virtual bool insertedObjects() const virtual bool insertedObjects() const
{ {
return false; return false;
} }
//- Return list of inserted faces //- Return list of inserted edges
virtual const labelList& insertedObjectLabels() const virtual const labelList& insertedObjectLabels() const
{ {
return labelList::null(); return labelList::null();

View File

@ -40,9 +40,9 @@ Foam::faMeshMapper::faMeshMapper
nOldEdges_(mesh.nEdges()), nOldEdges_(mesh.nEdges()),
nOldInternalEdges_(mesh.nInternalEdges()), nOldInternalEdges_(mesh.nInternalEdges()),
nOldFaces_(mesh.nFaces()), nOldFaces_(mesh.nFaces()),
oldPatchSizes_(mesh.boundary().size(), 0), oldPatchSizes_(),
oldPatchStarts_(mesh.boundary().size(), -1), oldPatchStarts_(),
oldPatchEdgeFaces_(mesh.boundary().size()), oldPatchEdgeFaces_(),
areaMap_(mesh, mpm), areaMap_(mesh, mpm),
edgeMap_(mesh, mpm), edgeMap_(mesh, mpm),
boundaryMap_(mesh, mpm) boundaryMap_(mesh, mpm)
@ -50,6 +50,10 @@ Foam::faMeshMapper::faMeshMapper
// Capture old patch information // Capture old patch information
const faBoundaryMesh& patches = mesh.boundary(); const faBoundaryMesh& patches = mesh.boundary();
oldPatchSizes_.resize(patches.size());
oldPatchStarts_.resize(patches.size());
oldPatchEdgeFaces_.resize(patches.size());
forAll(patches, patchI) forAll(patches, patchI)
{ {
oldPatchSizes_[patchI] = patches[patchI].size(); oldPatchSizes_[patchI] = patches[patchI].size();

View File

@ -45,8 +45,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef faMeshMapper_H #ifndef Foam_faMeshMapper_H
#define faMeshMapper_H #define Foam_faMeshMapper_H
#include "faceMapper.H" #include "faceMapper.H"
#include "faAreaMapper.H" #include "faAreaMapper.H"
@ -58,7 +58,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward Declarations
class faMesh; class faMesh;
class mapPolyMesh; class mapPolyMesh;

View File

@ -27,7 +27,6 @@ License
#include "faPatchMapper.H" #include "faPatchMapper.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -44,7 +43,7 @@ void Foam::faPatchMapper::calcAddressing() const
hasUnmapped_ = false; hasUnmapped_ = false;
directAddrPtr_ = std::make_unique<labelList>(patch_.size(), Foam::zero{}); directAddrPtr_ = std::make_unique<labelList>(patch_.size(), Foam::zero{});
labelList& addr = *directAddrPtr_; auto& addr = *directAddrPtr_;
// Make a map of old edgeFaces, giving edge index in patch given the new // Make a map of old edgeFaces, giving edge index in patch given the new
// face label next to the patch // face label next to the patch
@ -68,9 +67,11 @@ void Foam::faPatchMapper::calcAddressing() const
forAll(ef, efI) forAll(ef, efI)
{ {
if (edgeIndexLookup.found(ef[efI])) const auto iter = edgeIndexLookup.cfind(ef[efI]);
if (iter.good())
{ {
addr[efI] = edgeIndexLookup[ef[efI]]; addr[efI] = iter.val();
} }
else else
{ {
@ -84,11 +85,11 @@ void Foam::faPatchMapper::calcAddressing() const
} }
void Foam::faPatchMapper::clearOut() // void Foam::faPatchMapper::clearOut()
{ // {
directAddrPtr_.reset(nullptr); // directAddrPtr_.reset(nullptr);
hasUnmapped_ = false; // hasUnmapped_ = false;
} // }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -110,9 +111,7 @@ Foam::faPatchMapper::faPatchMapper
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faPatchMapper::~faPatchMapper() Foam::faPatchMapper::~faPatchMapper()
{ {}
clearOut();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -39,8 +39,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef faPatchMapper_H #ifndef Foam_faPatchMapper_H
#define faPatchMapper_H #define Foam_faPatchMapper_H
#include "faPatchFieldMapper.H" #include "faPatchFieldMapper.H"
#include "faceMapper.H" #include "faceMapper.H"
@ -51,7 +51,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward Declarations
class faPatch; class faPatch;
class mapPolyMesh; class mapPolyMesh;
@ -78,7 +78,7 @@ class faPatchMapper
const labelList oldEdgeFaces_; const labelList oldEdgeFaces_;
// Demand-driven private data // Demand-Driven Data
mutable bool hasUnmapped_; mutable bool hasUnmapped_;
@ -91,9 +91,6 @@ class faPatchMapper
//- Calculate addressing for mapping with inserted cells //- Calculate addressing for mapping with inserted cells
void calcAddressing() const; void calcAddressing() const;
//- Clear out local storage
void clearOut();
public: public:
@ -106,12 +103,10 @@ public:
void operator=(const faPatchMapper&) = delete; void operator=(const faPatchMapper&) = delete;
//- Construct from mappers // Constructors
faPatchMapper
( //- Construct from mappers
const faPatch& patch, faPatchMapper(const faPatch& patch, const mapPolyMesh& mpm);
const mapPolyMesh& mpm
);
//- Destructor //- Destructor

View File

@ -95,7 +95,8 @@ public:
const DimensionedField<Type, areaMesh>& const DimensionedField<Type, areaMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- Not implemented
slicedFaPatchField slicedFaPatchField
( (
const faPatch&, const faPatch&,
@ -103,8 +104,8 @@ public:
const dictionary& const dictionary&
); );
//- Construct by mapping the given sliced patch field //- Construct by mapping the given patch field onto a new patch.
//- onto a new patch //- Not implemented
slicedFaPatchField slicedFaPatchField
( (
const slicedFaPatchField<Type>&, const slicedFaPatchField<Type>&,

View File

@ -38,7 +38,7 @@ Foam::emptyFaPatchField<Type>::emptyFaPatchField
const DimensionedField<Type, areaMesh>& iF const DimensionedField<Type, areaMesh>& iF
) )
: :
faPatchField<Type>(p, iF, Field<Type>()) faPatchField<Type>(p, iF, Field<Type>()) // zero-sized patch field
{} {}
@ -51,7 +51,7 @@ Foam::emptyFaPatchField<Type>::emptyFaPatchField
const faPatchFieldMapper& const faPatchFieldMapper&
) )
: :
faPatchField<Type>(p, iF, Field<Type>()) faPatchField<Type>(p, iF, Field<Type>()) // zero-sized patch field
{ {
if (!isType<emptyFaPatch>(p)) if (!isType<emptyFaPatch>(p))
{ {
@ -74,8 +74,11 @@ Foam::emptyFaPatchField<Type>::emptyFaPatchField
const dictionary& dict const dictionary& dict
) )
: :
faPatchField<Type>(p, iF, Field<Type>()) faPatchField<Type>(p, iF, Field<Type>()) // zero-sized patch field
{ {
// Empty means empty, so no patchType override
// with faPatchFieldBase::readDict(dict);
if (!isA<emptyFaPatch>(p)) if (!isA<emptyFaPatch>(p))
{ {
FatalIOErrorInFunction(dict) FatalIOErrorInFunction(dict)
@ -92,21 +95,21 @@ Foam::emptyFaPatchField<Type>::emptyFaPatchField
template<class Type> template<class Type>
Foam::emptyFaPatchField<Type>::emptyFaPatchField Foam::emptyFaPatchField<Type>::emptyFaPatchField
( (
const emptyFaPatchField<Type>& ptf const emptyFaPatchField<Type>& ptf,
const DimensionedField<Type, areaMesh>& iF
) )
: :
faPatchField<Type>(ptf.patch(), ptf.internalField(), Field<Type>()) faPatchField<Type>(ptf.patch(), iF, Field<Type>()) // zero-sized
{} {}
template<class Type> template<class Type>
Foam::emptyFaPatchField<Type>::emptyFaPatchField Foam::emptyFaPatchField<Type>::emptyFaPatchField
( (
const emptyFaPatchField<Type>& ptf, const emptyFaPatchField<Type>& ptf
const DimensionedField<Type, areaMesh>& iF
) )
: :
faPatchField<Type>(ptf.patch(), iF, Field<Type>()) emptyFaPatchField<Type>(ptf, ptf.internalField())
{} {}

View File

@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef emptyFaPatchField_H #ifndef Foam_emptyFaPatchField_H
#define emptyFaPatchField_H #define Foam_emptyFaPatchField_H
#include "faPatchField.H" #include "faPatchField.H"
#include "emptyFaPatch.H" #include "emptyFaPatch.H"
@ -74,7 +74,8 @@ public:
const DimensionedField<Type, areaMesh>& const DimensionedField<Type, areaMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
emptyFaPatchField emptyFaPatchField
( (
const faPatch&, const faPatch&,

View File

@ -183,7 +183,7 @@ public:
// IO // IO
//- Write //- Write includes "value" entry
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
}; };

View File

@ -159,7 +159,7 @@ public:
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();
//- Write //- Write includes "value" entry
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
}; };

View File

@ -150,11 +150,11 @@ public:
virtual tmp<Field<Type>> gradientBoundaryCoeffs() const; virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
//- Write //- Write includes "value" entry
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
// Member operators // Member Operators
virtual void operator=(const UList<Type>&) {} virtual void operator=(const UList<Type>&) {}

View File

@ -168,7 +168,7 @@ public:
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();
//- Write //- Write includes "value" entry
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
}; };

View File

@ -163,7 +163,7 @@ public:
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();
//- Write //- Write includes "value" entry
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
}; };

View File

@ -183,7 +183,7 @@ public:
// IO // IO
//- Write //- Write includes "value" entry
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
}; };

View File

@ -161,12 +161,12 @@ public:
} }
// Member functions // Member Functions
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();
//- Write //- Write includes "value" entry
virtual void write(Ostream& os) const; virtual void write(Ostream& os) const;
}; };

View File

@ -167,7 +167,7 @@ public:
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();
//- Write //- Write includes "value" entry
virtual void write(Ostream& os) const; virtual void write(Ostream& os) const;
}; };

View File

@ -188,7 +188,7 @@ public:
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();
//- Write //- Write includes "value" entry (for visualisation / restart)
virtual void write(Ostream& os) const; virtual void write(Ostream& os) const;
}; };

View File

@ -37,7 +37,7 @@ Foam::emptyFaePatchField<Type>::emptyFaePatchField
const DimensionedField<Type, edgeMesh>& iF const DimensionedField<Type, edgeMesh>& iF
) )
: :
faePatchField<Type>(p, iF, Field<Type>()) faePatchField<Type>(p, iF, Field<Type>()) // zero-sized patch field
{} {}
@ -50,7 +50,7 @@ Foam::emptyFaePatchField<Type>::emptyFaePatchField
const faPatchFieldMapper& const faPatchFieldMapper&
) )
: :
faePatchField<Type>(p, iF, Field<Type>()) faePatchField<Type>(p, iF, Field<Type>()) // zero-sized patch field
{ {
if (!isType<emptyFaPatch>(this->patch())) if (!isType<emptyFaPatch>(this->patch()))
{ {
@ -72,8 +72,11 @@ Foam::emptyFaePatchField<Type>::emptyFaePatchField
const dictionary& dict const dictionary& dict
) )
: :
faePatchField<Type>(p, iF, Field<Type>()) faePatchField<Type>(p, iF, Field<Type>()) // zero-sized patch field
{ {
// Empty means empty, so no patchType override
// with faePatchFieldBase::readDict(dict);
if (!isType<emptyFaPatch>(p)) if (!isType<emptyFaPatch>(p))
{ {
FatalIOErrorInFunction(dict) FatalIOErrorInFunction(dict)
@ -87,21 +90,21 @@ Foam::emptyFaePatchField<Type>::emptyFaePatchField
template<class Type> template<class Type>
Foam::emptyFaePatchField<Type>::emptyFaePatchField Foam::emptyFaePatchField<Type>::emptyFaePatchField
( (
const emptyFaePatchField<Type>& ptf const emptyFaePatchField<Type>& ptf,
const DimensionedField<Type, edgeMesh>& iF
) )
: :
faePatchField<Type>(ptf.patch(), ptf.internalField(), Field<Type>()) faePatchField<Type>(ptf.patch(), iF, Field<Type>()) // zero-sized
{} {}
template<class Type> template<class Type>
Foam::emptyFaePatchField<Type>::emptyFaePatchField Foam::emptyFaePatchField<Type>::emptyFaePatchField
( (
const emptyFaePatchField<Type>& ptf, const emptyFaePatchField<Type>& ptf
const DimensionedField<Type, edgeMesh>& iF
) )
: :
faePatchField<Type>(ptf.patch(), iF, Field<Type>()) emptyFaePatchField<Type>(ptf, ptf.internalField())
{} {}

View File

@ -73,7 +73,8 @@ public:
const DimensionedField<Type, edgeMesh>& const DimensionedField<Type, edgeMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
emptyFaePatchField emptyFaePatchField
( (
const faPatch&, const faPatch&,

View File

@ -30,7 +30,8 @@ Group
grpConstraintBoundaryConditions grpConstraintBoundaryConditions
Description Description
A symmetry patch A symmetry patch.
The "value" entry is NO_READ, NO_WRITE.
SourceFiles SourceFiles
basicSymmetryFvPatchField.C basicSymmetryFvPatchField.C
@ -57,7 +58,6 @@ class basicSymmetryFvPatchField
: :
public transformFvPatchField<Type> public transformFvPatchField<Type>
{ {
public: public:
// Constructors // Constructors
@ -69,7 +69,8 @@ public:
const DimensionedField<Type, volMesh>& const DimensionedField<Type, volMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
basicSymmetryFvPatchField basicSymmetryFvPatchField
( (
const fvPatch&, const fvPatch&,
@ -77,8 +78,8 @@ public:
const dictionary& const dictionary&
); );
//- Construct by mapping given basicSymmetryFvPatchField onto a new //- Construct by mapping given basicSymmetry patch field
// patch //- onto a new patch
basicSymmetryFvPatchField basicSymmetryFvPatchField
( (
const basicSymmetryFvPatchField<Type>&, const basicSymmetryFvPatchField<Type>&,

View File

@ -31,11 +31,16 @@ Group
grpGenericBoundaryConditions grpGenericBoundaryConditions
Description Description
This boundary condition is not designed to be evaluated; it is assmued This boundary condition is not designed to be evaluated; it is assumed
that the value is assigned via field assignment, and not via a call to that the value is assigned via field assignment, and not via a call to
e.g. \c updateCoeffs or \c evaluate. e.g. \c updateCoeffs or \c evaluate.
Usage Usage
\table
Property | Description | Required | Default
value | field value | yes |
\endtable
Example of the boundary condition specification: Example of the boundary condition specification:
\verbatim \verbatim
<patchName> <patchName>
@ -99,13 +104,13 @@ public:
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
const dictionary& dict, const dictionary& dict,
const bool valueReqd const bool needValue
) )
: :
calculatedFvPatchField calculatedFvPatchField
( (
p, iF, dict, p, iF, dict,
(valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ) (needValue? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
) )
{} {}
@ -178,7 +183,7 @@ public:
tmp<Field<Type>> gradientBoundaryCoeffs() const; tmp<Field<Type>> gradientBoundaryCoeffs() const;
//- Write //- Write includes "value" entry
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
}; };

View File

@ -33,6 +33,8 @@ Group
Description Description
Abstract base class for coupled patches. Abstract base class for coupled patches.
The "value" entry is usually MUST_READ and always WRITE.
SourceFiles SourceFiles
coupledFvPatchField.C coupledFvPatchField.C
@ -98,13 +100,13 @@ public:
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
const dictionary& dict, const dictionary& dict,
const bool valueReqd const bool needValue
) )
: :
coupledFvPatchField coupledFvPatchField
( (
p, iF, dict, p, iF, dict,
(valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ) (needValue? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
) )
{} {}
@ -144,8 +146,7 @@ public:
// Access // Access
//- Return true if this patch field is derived from //- True if this patch field is derived from coupledFvPatchField.
// coupledFvPatchField<Type>.
virtual bool coupled() const virtual bool coupled() const
{ {
return true; return true;
@ -268,7 +269,7 @@ public:
) const = 0; ) const = 0;
//- Write //- Write includes "value" entry
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
}; };

View File

@ -92,21 +92,21 @@ Foam::fixedValueFvPatchField<Type>::fixedValueFvPatchField
template<class Type> template<class Type>
Foam::fixedValueFvPatchField<Type>::fixedValueFvPatchField Foam::fixedValueFvPatchField<Type>::fixedValueFvPatchField
( (
const fixedValueFvPatchField<Type>& ptf const fixedValueFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
) )
: :
fvPatchField<Type>(ptf) fvPatchField<Type>(ptf, iF)
{} {}
template<class Type> template<class Type>
Foam::fixedValueFvPatchField<Type>::fixedValueFvPatchField Foam::fixedValueFvPatchField<Type>::fixedValueFvPatchField
( (
const fixedValueFvPatchField<Type>& ptf, const fixedValueFvPatchField<Type>& ptf
const DimensionedField<Type, volMesh>& iF
) )
: :
fvPatchField<Type>(ptf, iF) fixedValueFvPatchField<Type>(ptf, ptf.internalField())
{} {}

View File

@ -111,13 +111,13 @@ public:
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
const dictionary& dict, const dictionary& dict,
const bool valueReqd const bool needValue
) )
: :
fixedValueFvPatchField fixedValueFvPatchField
( (
p, iF, dict, p, iF, dict,
(valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ) (needValue? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
) )
{} {}
@ -168,6 +168,9 @@ public:
//- False: this patch field is not altered by assignment. //- False: this patch field is not altered by assignment.
virtual bool assignable() const { return false; } virtual bool assignable() const { return false; }
//- Write includes "value" entry
virtual void write(Ostream&) const;
// Evaluation functions // Evaluation functions
@ -194,11 +197,7 @@ public:
virtual tmp<Field<Type>> gradientBoundaryCoeffs() const; virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
//- Write // Member Operators
virtual void write(Ostream&) const;
// Member operators
virtual void operator=(const UList<Type>&) {} virtual void operator=(const UList<Type>&) {}

View File

@ -30,15 +30,16 @@ Group
grpGenericBoundaryConditions grpGenericBoundaryConditions
Description Description
Foam::transformFvPatchField Intermediate layer (not used directly as a user boundary condition).
The "value" entry is NO_READ, NO_WRITE.
SourceFiles SourceFiles
transformFvPatchField.C transformFvPatchField.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef transformFvPatchField_H #ifndef Foam_transformFvPatchField_H
#define transformFvPatchField_H #define Foam_transformFvPatchField_H
#include "fvPatchField.H" #include "fvPatchField.H"
@ -56,7 +57,6 @@ class transformFvPatchField
: :
public fvPatchField<Type> public fvPatchField<Type>
{ {
public: public:
//- Runtime type information //- Runtime type information
@ -72,7 +72,8 @@ public:
const DimensionedField<Type, volMesh>& const DimensionedField<Type, volMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
transformFvPatchField transformFvPatchField
( (
const fvPatch&, const fvPatch&,

View File

@ -51,7 +51,7 @@ Foam::cyclicFvPatchField<Type>::cyclicFvPatchField
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
const dictionary& dict, const dictionary& dict,
const bool valueRequired const bool needValue
) )
: :
coupledFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ), coupledFvPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ),
@ -68,7 +68,7 @@ Foam::cyclicFvPatchField<Type>::cyclicFvPatchField
<< exit(FatalIOError); << exit(FatalIOError);
} }
if (valueRequired) if (needValue)
{ {
this->evaluate(Pstream::commsTypes::blocking); this->evaluate(Pstream::commsTypes::blocking);
} }
@ -324,4 +324,5 @@ void Foam::cyclicFvPatchField<Type>::manipulateMatrix
} }
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -34,6 +34,8 @@ Description
This boundary condition enforces a cyclic condition between a pair of This boundary condition enforces a cyclic condition between a pair of
boundaries. boundaries.
The "value" entry is NO_READ.
Usage Usage
Example of the boundary condition specification: Example of the boundary condition specification:
\verbatim \verbatim
@ -75,7 +77,7 @@ class cyclicFvPatchField
virtual public cyclicLduInterfaceField, virtual public cyclicLduInterfaceField,
public coupledFvPatchField<Type> public coupledFvPatchField<Type>
{ {
// Private data // Private Data
//- Local reference cast into the cyclic patch //- Local reference cast into the cyclic patch
const cyclicFvPatch& cyclicPatch_; const cyclicFvPatch& cyclicPatch_;
@ -113,7 +115,7 @@ public:
const fvPatch&, const fvPatch&,
const DimensionedField<Type, volMesh>&, const DimensionedField<Type, volMesh>&,
const dictionary&, const dictionary&,
const bool valueRequired = true const bool needValue = true //!< evaluate
); );
//- Construct by mapping given cyclicFvPatchField onto a new patch //- Construct by mapping given cyclicFvPatchField onto a new patch
@ -154,7 +156,7 @@ public:
} }
// Member functions // Member Functions
// Access // Access

View File

@ -61,7 +61,7 @@ Foam::cyclicSlipFvPatchField<Type>::cyclicSlipFvPatchField
const dictionary& dict const dictionary& dict
) )
: :
cyclicFvPatchField<Type>(p, iF, dict) cyclicFvPatchField<Type>(p, iF, dict) // needValue (evaluate) = true
{} {}

View File

@ -33,6 +33,8 @@ Description
This boundary condition is a light wrapper around the cyclicFvPatchField This boundary condition is a light wrapper around the cyclicFvPatchField
condition, providing no new functionality. condition, providing no new functionality.
The "value" entry is NO_READ.
Usage Usage
Example of the boundary condition specification: Example of the boundary condition specification:
\verbatim \verbatim
@ -50,8 +52,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef cyclicSlipFvPatchField_H #ifndef Foam_cyclicSlipFvPatchField_H
#define cyclicSlipFvPatchField_H #define Foam_cyclicSlipFvPatchField_H
#include "cyclicFvPatchField.H" #include "cyclicFvPatchField.H"
#include "cyclicSlipFvPatch.H" #include "cyclicSlipFvPatch.H"
@ -70,7 +72,6 @@ class cyclicSlipFvPatchField
: :
public cyclicFvPatchField<Type> public cyclicFvPatchField<Type>
{ {
public: public:
//- Runtime type information //- Runtime type information
@ -86,7 +87,8 @@ public:
const DimensionedField<Type, volMesh>& const DimensionedField<Type, volMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
cyclicSlipFvPatchField cyclicSlipFvPatchField
( (
const fvPatch&, const fvPatch&,

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,7 +38,7 @@ Foam::emptyFvPatchField<Type>::emptyFvPatchField
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
) )
: :
fvPatchField<Type>(p, iF, Field<Type>(0)) fvPatchField<Type>(p, iF, Field<Type>()) // zero-sized patch field
{} {}
@ -50,7 +51,7 @@ Foam::emptyFvPatchField<Type>::emptyFvPatchField
const fvPatchFieldMapper& const fvPatchFieldMapper&
) )
: :
fvPatchField<Type>(p, iF, Field<Type>(0)) fvPatchField<Type>(p, iF, Field<Type>()) // zero-sized patch field
{ {
if (!isType<emptyFvPatch>(p)) if (!isType<emptyFvPatch>(p))
{ {
@ -73,8 +74,11 @@ Foam::emptyFvPatchField<Type>::emptyFvPatchField
const dictionary& dict const dictionary& dict
) )
: :
fvPatchField<Type>(p, iF, Field<Type>(0)) fvPatchField<Type>(p, iF, Field<Type>()) // zero-sized patch field
{ {
// Empty means empty, so no patchType override
// with fvPatchFieldBase::readDict(dict);
if (!isType<emptyFvPatch>(p)) if (!isType<emptyFvPatch>(p))
{ {
FatalIOErrorInFunction(dict) FatalIOErrorInFunction(dict)
@ -91,26 +95,21 @@ Foam::emptyFvPatchField<Type>::emptyFvPatchField
template<class Type> template<class Type>
Foam::emptyFvPatchField<Type>::emptyFvPatchField Foam::emptyFvPatchField<Type>::emptyFvPatchField
( (
const emptyFvPatchField<Type>& ptf const emptyFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
) )
: :
fvPatchField<Type> fvPatchField<Type>(ptf.patch(), iF, Field<Type>()) // zero-sized
(
ptf.patch(),
ptf.internalField(),
Field<Type>(0)
)
{} {}
template<class Type> template<class Type>
Foam::emptyFvPatchField<Type>::emptyFvPatchField Foam::emptyFvPatchField<Type>::emptyFvPatchField
( (
const emptyFvPatchField<Type>& ptf, const emptyFvPatchField<Type>& ptf
const DimensionedField<Type, volMesh>& iF
) )
: :
fvPatchField<Type>(ptf.patch(), iF, Field<Type>(0)) emptyFvPatchField<Type>(ptf, ptf.internalField())
{} {}

View File

@ -33,7 +33,9 @@ Description
This boundary condition provides an 'empty' condition for reduced This boundary condition provides an 'empty' condition for reduced
dimensions cases, i.e. 1- and 2-D geometries. Apply this condition to dimensions cases, i.e. 1- and 2-D geometries. Apply this condition to
patches whose normal is aligned to geometric directions that do not patches whose normal is aligned to geometric directions that do not
constitue solution directions. constitute solution directions.
The "value" entry is NO_READ, NO_WRITE.
Usage Usage
Example of the boundary condition specification: Example of the boundary condition specification:
@ -84,7 +86,8 @@ public:
const DimensionedField<Type, volMesh>& const DimensionedField<Type, volMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
emptyFvPatchField emptyFvPatchField
( (
const fvPatch&, const fvPatch&,

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -60,14 +60,11 @@ Foam::jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
const dictionary& dict, const dictionary& dict,
const bool valueRequired const bool needValue
) )
: :
cyclicFvPatchField<Type>(p, iF, dict, valueRequired) cyclicFvPatchField<Type>(p, iF, dict, needValue)
{ {}
// Call this evaluation in derived classes
//this->evaluate(Pstream::commsTypes::blocking);
}
template<class Type> template<class Type>

View File

@ -34,6 +34,8 @@ Description
This boundary condition provides a base class for coupled-cyclic This boundary condition provides a base class for coupled-cyclic
conditions with a specified 'jump' (or offset) between the values conditions with a specified 'jump' (or offset) between the values
The "value" entry is NO_READ.
See also See also
Foam::cyclicFvPatchField Foam::cyclicFvPatchField
@ -42,8 +44,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef jumpCyclicFvPatchField_H #ifndef Foam_jumpCyclicFvPatchField_H
#define jumpCyclicFvPatchField_H #define Foam_jumpCyclicFvPatchField_H
#include "cyclicFvPatchField.H" #include "cyclicFvPatchField.H"
@ -61,7 +63,6 @@ class jumpCyclicFvPatchField
: :
public cyclicFvPatchField<Type> public cyclicFvPatchField<Type>
{ {
public: public:
//- Runtime type information //- Runtime type information
@ -77,13 +78,14 @@ public:
const DimensionedField<Type, volMesh>& const DimensionedField<Type, volMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
jumpCyclicFvPatchField jumpCyclicFvPatchField
( (
const fvPatch&, const fvPatch&,
const DimensionedField<Type, volMesh>&, const DimensionedField<Type, volMesh>&,
const dictionary&, const dictionary&,
const bool valueRequired = true const bool needValue = true //!< evaluate
); );
//- Construct by mapping given jumpCyclicFvPatchField onto a new patch //- Construct by mapping given jumpCyclicFvPatchField onto a new patch

View File

@ -50,7 +50,7 @@ nonuniformTransformCyclicFvPatchField
const dictionary& dict const dictionary& dict
) )
: :
cyclicFvPatchField<Type>(p, iF, dict) cyclicFvPatchField<Type>(p, iF, dict) // needValue (evaluate) = true
{} {}

View File

@ -33,6 +33,8 @@ Description
This boundary condition enforces a cyclic condition between a pair of This boundary condition enforces a cyclic condition between a pair of
boundaries, incorporating a non-uniform transformation. boundaries, incorporating a non-uniform transformation.
The "value" entry is NO_READ.
SourceFiles SourceFiles
nonuniformTransformCyclicFvPatchField.C nonuniformTransformCyclicFvPatchField.C
nonuniformTransformCyclicFvPatchFields.H nonuniformTransformCyclicFvPatchFields.H
@ -41,8 +43,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef nonuniformTransformCyclicFvPatchField_H #ifndef Foam_nonuniformTransformCyclicFvPatchField_H
#define nonuniformTransformCyclicFvPatchField_H #define Foam_nonuniformTransformCyclicFvPatchField_H
#include "cyclicFvPatchField.H" #include "cyclicFvPatchField.H"
#include "nonuniformTransformCyclicFvPatch.H" #include "nonuniformTransformCyclicFvPatch.H"
@ -61,8 +63,6 @@ class nonuniformTransformCyclicFvPatchField
: :
public cyclicFvPatchField<Type> public cyclicFvPatchField<Type>
{ {
// Private data
public: public:
//- Runtime type information //- Runtime type information
@ -78,7 +78,8 @@ public:
const DimensionedField<Type, volMesh>& const DimensionedField<Type, volMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
nonuniformTransformCyclicFvPatchField nonuniformTransformCyclicFvPatchField
( (
const fvPatch&, const fvPatch&,

View File

@ -28,7 +28,6 @@ License
#include "processorFvPatchField.H" #include "processorFvPatchField.H"
#include "processorFvPatch.H" #include "processorFvPatch.H"
#include "demandDrivenData.H"
#include "transformField.H" #include "transformField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -135,11 +135,4 @@ Foam::processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
{} {}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
Foam::processorCyclicFvPatchField<Type>::~processorCyclicFvPatchField()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -73,7 +73,7 @@ class processorCyclicFvPatchField
: :
public processorFvPatchField<Type> public processorFvPatchField<Type>
{ {
// Private data // Private Data
//- Local reference cast into the processor patch //- Local reference cast into the processor patch
const processorCyclicFvPatch& procPatch_; const processorCyclicFvPatch& procPatch_;
@ -146,10 +146,10 @@ public:
//- Destructor //- Destructor
virtual ~processorCyclicFvPatchField(); virtual ~processorCyclicFvPatchField() = default;
// Member functions // Member Functions
// Access // Access

View File

@ -69,7 +69,6 @@ class symmetryFvPatchField
: :
public basicSymmetryFvPatchField<Type> public basicSymmetryFvPatchField<Type>
{ {
public: public:
//- Runtime type information //- Runtime type information

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,7 +32,6 @@ License
#include "symmTransform.H" #include "symmTransform.H"
#include "diagTensor.H" #include "diagTensor.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class Type>
@ -41,7 +41,7 @@ Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
) )
: :
transformFvPatchField<Type>(p, iF) parent_bctype(p, iF)
{} {}
@ -54,7 +54,7 @@ Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
transformFvPatchField<Type>(ptf, p, iF, mapper) parent_bctype(ptf, p, iF, mapper)
{ {
if (!isType<wedgeFvPatch>(this->patch())) if (!isType<wedgeFvPatch>(this->patch()))
{ {
@ -77,7 +77,7 @@ Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
const dictionary& dict const dictionary& dict
) )
: :
transformFvPatchField<Type>(p, iF, dict) parent_bctype(p, iF, dict) // "value" is NO_READ
{ {
if (!isType<wedgeFvPatch>(p)) if (!isType<wedgeFvPatch>(p))
{ {
@ -97,21 +97,21 @@ Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
template<class Type> template<class Type>
Foam::wedgeFvPatchField<Type>::wedgeFvPatchField Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
( (
const wedgeFvPatchField<Type>& ptf const wedgeFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
) )
: :
transformFvPatchField<Type>(ptf) parent_bctype(ptf, iF)
{} {}
template<class Type> template<class Type>
Foam::wedgeFvPatchField<Type>::wedgeFvPatchField Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
( (
const wedgeFvPatchField<Type>& ptf, const wedgeFvPatchField<Type>& ptf
const DimensionedField<Type, volMesh>& iF
) )
: :
transformFvPatchField<Type>(ptf, iF) wedgeFvPatchField<Type>(ptf, ptf.internalField())
{} {}

View File

@ -33,6 +33,8 @@ Description
This boundary condition is similar to the cyclic condition, except that This boundary condition is similar to the cyclic condition, except that
it is applied to 2-D geometries. it is applied to 2-D geometries.
The "value" entry is NO_READ, NO_WRITE.
Usage Usage
Example of the boundary condition specification: Example of the boundary condition specification:
\verbatim \verbatim
@ -50,8 +52,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef wedgeFvPatchField_H #ifndef Foam_wedgeFvPatchField_H
#define wedgeFvPatchField_H #define Foam_wedgeFvPatchField_H
#include "transformFvPatchField.H" #include "transformFvPatchField.H"
#include "wedgeFvPatch.H" #include "wedgeFvPatch.H"
@ -70,6 +72,9 @@ class wedgeFvPatchField
: :
public transformFvPatchField<Type> public transformFvPatchField<Type>
{ {
//- The parent boundary condition type
typedef transformFvPatchField<Type> parent_bctype;
public: public:
@ -86,7 +91,8 @@ public:
const DimensionedField<Type, volMesh>& const DimensionedField<Type, volMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
wedgeFvPatchField wedgeFvPatchField
( (
const fvPatch&, const fvPatch&,

View File

@ -67,7 +67,7 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
const dictionary& dict const dictionary& dict
) )
: :
uniformJumpFvPatchField<Type>(p, iF, dict, false), // Pass no valueRequired uniformJumpFvPatchField<Type>(p, iF, dict, false), // needValue = false
phiName_(dict.getOrDefault<word>("phi", "phi")), phiName_(dict.getOrDefault<word>("phi", "phi")),
rhoName_(dict.getOrDefault<word>("rho", "rho")), rhoName_(dict.getOrDefault<word>("rho", "rho")),
uniformJump_(dict.getOrDefault("uniformJump", false)), uniformJump_(dict.getOrDefault("uniformJump", false)),

View File

@ -70,10 +70,10 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
const dictionary& dict, const dictionary& dict,
const bool valueRequired const bool needValue
) )
: :
jumpCyclicFvPatchField<Type>(p, iF, dict, false), // Pass no valueRequired jumpCyclicFvPatchField<Type>(p, iF, dict, false), // needValue = false
jump_(p.size(), Zero), jump_(p.size(), Zero),
jump0_(p.size(), Zero), jump0_(p.size(), Zero),
minJump_(dict.getOrDefault<Type>("minJump", pTraits<Type>::min)), minJump_(dict.getOrDefault<Type>("minJump", pTraits<Type>::min)),
@ -82,7 +82,7 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
{ {
if (this->cyclicPatch().owner()) if (this->cyclicPatch().owner())
{ {
if (valueRequired) if (needValue)
{ {
jump_.assign("jump", dict, p.size(), IOobjectOption::MUST_READ); jump_.assign("jump", dict, p.size(), IOobjectOption::MUST_READ);
} }
@ -90,7 +90,7 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
jump0_.assign("jump0", dict, p.size(), IOobjectOption::LAZY_READ); jump0_.assign("jump0", dict, p.size(), IOobjectOption::LAZY_READ);
} }
if (valueRequired) if (needValue)
{ {
if (!this->readValueEntry(dict)) if (!this->readValueEntry(dict))
{ {

View File

@ -128,7 +128,7 @@ public:
const fvPatch&, const fvPatch&,
const DimensionedField<Type, volMesh>&, const DimensionedField<Type, volMesh>&,
const dictionary&, const dictionary&,
const bool valueRequired = true const bool needValue = true
); );
//- Construct by mapping given fixedJumpFvPatchField onto a //- Construct by mapping given fixedJumpFvPatchField onto a

View File

@ -39,7 +39,7 @@ Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
) )
: :
parent_bctype(p, iF), parent_bctype(p, iF),
fixedValue_(p.size(), Zero), fixedValue_(p.size(), Foam::zero{}),
writeValue_(false) writeValue_(false)
{} {}
@ -72,6 +72,7 @@ Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
writeValue_(dict.getOrDefault("writeValue", false)) writeValue_(dict.getOrDefault("writeValue", false))
{ {
fvPatchFieldBase::readDict(dict); fvPatchFieldBase::readDict(dict);
evaluate(); evaluate();
} }
@ -181,11 +182,13 @@ template<class Type>
void Foam::fixedNormalSlipFvPatchField<Type>::write(Ostream& os) const void Foam::fixedNormalSlipFvPatchField<Type>::write(Ostream& os) const
{ {
this->parent_bctype::write(os); this->parent_bctype::write(os);
fixedValue_.writeEntry("fixedValue", os);
if (writeValue_) if (writeValue_)
{ {
os.writeEntry("writeValue", "true"); os.writeEntry("writeValue", "true");
}
fixedValue_.writeEntry("fixedValue", os);
if (writeValue_)
{
fvPatchField<Type>::writeValueEntry(os); fvPatchField<Type>::writeValueEntry(os);
} }
} }

View File

@ -36,6 +36,8 @@ Description
The tangential component is treated as slip, i.e. copied from the internal The tangential component is treated as slip, i.e. copied from the internal
field. field.
The "value" entry is NO_READ, optional write.
Usage Usage
Example of the boundary condition specification: Example of the boundary condition specification:
\verbatim \verbatim
@ -76,8 +78,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef fixedNormalSlipFvPatchField_H #ifndef Foam_fixedNormalSlipFvPatchField_H
#define fixedNormalSlipFvPatchField_H #define Foam_fixedNormalSlipFvPatchField_H
#include "transformFvPatchField.H" #include "transformFvPatchField.H"
@ -123,7 +125,8 @@ public:
const DimensionedField<Type, volMesh>& const DimensionedField<Type, volMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
fixedNormalSlipFvPatchField fixedNormalSlipFvPatchField
( (
const fvPatch&, const fvPatch&,

View File

@ -39,7 +39,7 @@ Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
) )
: :
parent_bctype(p, iF), parent_bctype(p, iF),
refValue_(p.size(), Zero), refValue_(p.size(), Foam::zero{}),
valueFraction_(p.size(), 1.0), valueFraction_(p.size(), 1.0),
writeValue_(false) writeValue_(false)
{} {}
@ -70,7 +70,7 @@ Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
) )
: :
parent_bctype(p, iF), parent_bctype(p, iF),
refValue_(p.size(), Zero), refValue_(p.size(), Foam::zero{}),
valueFraction_("valueFraction", dict, p.size()), valueFraction_("valueFraction", dict, p.size()),
writeValue_(dict.getOrDefault("writeValue", false)) writeValue_(dict.getOrDefault("writeValue", false))
{ {
@ -86,10 +86,11 @@ Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
template<class Type> template<class Type>
Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
( (
const partialSlipFvPatchField<Type>& ptf const partialSlipFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
) )
: :
parent_bctype(ptf), parent_bctype(ptf, iF),
refValue_(ptf.refValue_), refValue_(ptf.refValue_),
valueFraction_(ptf.valueFraction_), valueFraction_(ptf.valueFraction_),
writeValue_(ptf.writeValue_) writeValue_(ptf.writeValue_)
@ -99,14 +100,10 @@ Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
template<class Type> template<class Type>
Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
( (
const partialSlipFvPatchField<Type>& ptf, const partialSlipFvPatchField<Type>& ptf
const DimensionedField<Type, volMesh>& iF
) )
: :
parent_bctype(ptf, iF), partialSlipFvPatchField<Type>(ptf, ptf.internalField())
refValue_(ptf.refValue_),
valueFraction_(ptf.valueFraction_),
writeValue_(ptf.writeValue_)
{} {}
@ -204,12 +201,14 @@ template<class Type>
void Foam::partialSlipFvPatchField<Type>::write(Ostream& os) const void Foam::partialSlipFvPatchField<Type>::write(Ostream& os) const
{ {
this->parent_bctype::write(os); this->parent_bctype::write(os);
refValue_.writeEntry("refValue", os);
valueFraction_.writeEntry("valueFraction", os);
if (writeValue_) if (writeValue_)
{ {
os.writeEntry("writeValue", "true"); os.writeEntry("writeValue", "true");
}
refValue_.writeEntry("refValue", os);
valueFraction_.writeEntry("valueFraction", os);
if (writeValue_)
{
fvPatchField<Type>::writeValueEntry(os); fvPatchField<Type>::writeValueEntry(os);
} }
} }

View File

@ -31,8 +31,10 @@ Group
grpWallBoundaryConditions grpGenericBoundaryConditions grpWallBoundaryConditions grpGenericBoundaryConditions
Description Description
This boundary condition provides a partial slip condition. The amount of This boundary condition provides a partial slip condition.
slip is controlled by a user-supplied field. The amount of slip is controlled by a user-supplied field.
The "value" entry is NO_READ, optional write.
Usage Usage
\table \table
@ -50,7 +52,6 @@ Usage
type partialSlip; type partialSlip;
refValue uniform 0.001; refValue uniform 0.001;
valueFraction uniform 0.1; valueFraction uniform 0.1;
value uniform 0;
} }
\endverbatim \endverbatim
@ -62,8 +63,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef partialSlipFvPatchField_H #ifndef Foam_partialSlipFvPatchField_H
#define partialSlipFvPatchField_H #define Foam_partialSlipFvPatchField_H
#include "transformFvPatchField.H" #include "transformFvPatchField.H"
@ -112,7 +113,8 @@ public:
const DimensionedField<Type, volMesh>& const DimensionedField<Type, volMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
partialSlipFvPatchField partialSlipFvPatchField
( (
const fvPatch&, const fvPatch&,
@ -120,7 +122,8 @@ public:
const dictionary& const dictionary&
); );
//- Construct by mapping given partialSlipFvPatchField onto a new patch //- Construct by mapping given partialSlip patch field
//- onto a new patch
partialSlipFvPatchField partialSlipFvPatchField
( (
const partialSlipFvPatchField<Type>&, const partialSlipFvPatchField<Type>&,
@ -163,6 +166,7 @@ public:
//- False: this patch field is not altered by assignment //- False: this patch field is not altered by assignment
virtual bool assignable() const { return false; } virtual bool assignable() const { return false; }
// Access // Access
virtual Field<Type>& refValue() virtual Field<Type>& refValue()

View File

@ -62,13 +62,13 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
const dictionary& dict, const dictionary& dict,
const bool valueRequired const bool needValue
) )
: :
fixedJumpFvPatchField<Type>(p, iF, dict, false), // Pass no valueRequired fixedJumpFvPatchField<Type>(p, iF, dict, false), // needValue = false
jumpTable_() jumpTable_()
{ {
if (valueRequired) if (needValue)
{ {
if (this->cyclicPatch().owner()) if (this->cyclicPatch().owner())
{ {

View File

@ -118,7 +118,7 @@ public:
const fvPatch&, const fvPatch&,
const DimensionedField<Type, volMesh>&, const DimensionedField<Type, volMesh>&,
const dictionary&, const dictionary&,
const bool valueRequired = true const bool needValue = true
); );
//- Construct by mapping given uniformJumpFvPatchField onto a //- Construct by mapping given uniformJumpFvPatchField onto a

View File

@ -430,13 +430,13 @@ public:
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
const dictionary& dict, const dictionary& dict,
const bool valueReqd const bool needValue
) )
: :
fvPatchField fvPatchField
( (
p, iF, dict, p, iF, dict,
(valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ) (needValue? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
) )
{} {}

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021-2023 OpenCFD Ltd. Copyright (C) 2021-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -131,4 +131,14 @@ Foam::fvsPatchField<Type>::NewCalculatedType
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::calculatedFvsPatchField<Type>::write(Ostream& os) const
{
fvsPatchField<Type>::write(os);
fvsPatchField<Type>::writeValueEntry(os);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,7 +28,25 @@ Class
Foam::calculatedFvsPatchField Foam::calculatedFvsPatchField
Description Description
Foam::calculatedFvsPatchField This boundary condition is not designed to be evaluated; it is assumed
that the value is assigned via field assignment.
The "value" entry is MUST_READ.
Usage
\table
Property | Description | Required | Default
value | Patch face values | yes |
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type calculated;
value uniform (0 0 0); // Required value entry
}
\endverbatim
SourceFiles SourceFiles
calculatedFvsPatchField.C calculatedFvsPatchField.C
@ -118,6 +137,9 @@ public:
//- True: this patch field fixes a value. //- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; } virtual bool fixesValue() const { return true; }
//- Write includes "value" entry
virtual void write(Ostream&) const;
}; };

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -57,10 +58,11 @@ Foam::coupledFvsPatchField<Type>::coupledFvsPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF, const DimensionedField<Type, surfaceMesh>& iF,
const dictionary& dict const dictionary& dict,
IOobjectOption::readOption requireValue
) )
: :
fvsPatchField<Type>(p, iF, dict) fvsPatchField<Type>(p, iF, dict, requireValue)
{} {}
@ -98,4 +100,14 @@ Foam::coupledFvsPatchField<Type>::coupledFvsPatchField
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::coupledFvsPatchField<Type>::write(Ostream& os) const
{
fvsPatchField<Type>::write(os);
fvsPatchField<Type>::writeValueEntry(os);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,15 +28,17 @@ Class
Foam::coupledFvsPatchField Foam::coupledFvsPatchField
Description Description
Foam::coupledFvsPatchField Abstract base class for coupled patches.
The "value" entry is usually MUST_READ and always WRITE.
SourceFiles SourceFiles
coupledFvsPatchField.C coupledFvsPatchField.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef coupledFvsPatchField_H #ifndef Foam_coupledFvsPatchField_H
#define coupledFvsPatchField_H #define Foam_coupledFvsPatchField_H
#include "fvsPatchField.H" #include "fvsPatchField.H"
#include "coupledFvPatch.H" #include "coupledFvPatch.H"
@ -46,7 +49,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class coupledFvsPatch Declaration Class coupledFvsPatchField Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
@ -54,7 +57,6 @@ class coupledFvsPatchField
: :
public fvsPatchField<Type> public fvsPatchField<Type>
{ {
public: public:
//- Runtime type information //- Runtime type information
@ -83,7 +85,8 @@ public:
( (
const fvPatch&, const fvPatch&,
const DimensionedField<Type, surfaceMesh>&, const DimensionedField<Type, surfaceMesh>&,
const dictionary& const dictionary&,
IOobjectOption::readOption requireValue = IOobjectOption::MUST_READ
); );
//- Construct by mapping the given coupledFvsPatchField onto a new patch //- Construct by mapping the given coupledFvsPatchField onto a new patch
@ -118,16 +121,16 @@ public:
) const = 0; ) const = 0;
// Member functions // Member Functions
// Access //- True if this patch field is derived from coupledFvsPatchField
virtual bool coupled() const
{
return true;
}
//- Return true if this patch field is derived from //- Write includes "value" entry
// coupledFvsPatchField<Type>. virtual void write(Ostream&) const;
virtual bool coupled() const
{
return true;
}
}; };

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -57,7 +58,8 @@ Foam::fixedValueFvsPatchField<Type>::fixedValueFvsPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF, const DimensionedField<Type, surfaceMesh>& iF,
const dictionary& dict const dictionary& dict,
IOobjectOption::readOption requireValue
) )
: :
fvsPatchField<Type>(p, iF, dict, IOobjectOption::MUST_READ) fvsPatchField<Type>(p, iF, dict, IOobjectOption::MUST_READ)
@ -80,21 +82,21 @@ Foam::fixedValueFvsPatchField<Type>::fixedValueFvsPatchField
template<class Type> template<class Type>
Foam::fixedValueFvsPatchField<Type>::fixedValueFvsPatchField Foam::fixedValueFvsPatchField<Type>::fixedValueFvsPatchField
( (
const fixedValueFvsPatchField<Type>& ptf const fixedValueFvsPatchField<Type>& ptf,
const DimensionedField<Type, surfaceMesh>& iF
) )
: :
fvsPatchField<Type>(ptf) fvsPatchField<Type>(ptf, iF)
{} {}
template<class Type> template<class Type>
Foam::fixedValueFvsPatchField<Type>::fixedValueFvsPatchField Foam::fixedValueFvsPatchField<Type>::fixedValueFvsPatchField
( (
const fixedValueFvsPatchField<Type>& ptf, const fixedValueFvsPatchField<Type>& ptf
const DimensionedField<Type, surfaceMesh>& iF
) )
: :
fvsPatchField<Type>(ptf, iF) fixedValueFvsPatchField<Type>(ptf, ptf.internalField())
{} {}
@ -138,4 +140,12 @@ Foam::fixedValueFvsPatchField<Type>::gradientBoundaryCoeffs() const
} }
template<class Type>
void Foam::fixedValueFvsPatchField<Type>::write(Ostream& os) const
{
fvsPatchField<Type>::write(os);
fvsPatchField<Type>::writeValueEntry(os);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,15 +28,33 @@ Class
Foam::fixedValueFvsPatchField Foam::fixedValueFvsPatchField
Description Description
Foam::fixedValueFvsPatchField This boundary condition supplies a fixed value constraint, and is the base
class for a number of other boundary conditions.
The "value" entry is MUST_READ.
Usage
\table
Property | Description | Required | Default
value | Patch face values | yes |
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type fixedValue;
value uniform 0; // Example for scalar field usage
}
\endverbatim
SourceFiles SourceFiles
fixedValueFvsPatchField.C fixedValueFvsPatchField.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef fixedValueFvsPatchField_H #ifndef Foam_fixedValueFvsPatchField_H
#define fixedValueFvsPatchField_H #define Foam_fixedValueFvsPatchField_H
#include "fvsPatchField.H" #include "fvsPatchField.H"
@ -45,7 +64,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class fixedValueFvsPatch Declaration Class fixedValueFvsPatchField Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
@ -81,7 +100,8 @@ public:
( (
const fvPatch&, const fvPatch&,
const DimensionedField<Type, surfaceMesh>&, const DimensionedField<Type, surfaceMesh>&,
const dictionary& const dictionary&,
IOobjectOption::readOption requireValue = IOobjectOption::MUST_READ
); );
//- Construct by mapping the given fixedValue patch field //- Construct by mapping the given fixedValue patch field
@ -127,6 +147,9 @@ public:
//- True: this patch field fixes a value. //- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; } virtual bool fixesValue() const { return true; }
//- Write includes "value" entry
virtual void write(Ostream&) const;
// Evaluation functions // Evaluation functions
@ -153,7 +176,7 @@ public:
virtual tmp<Field<Type>> gradientBoundaryCoeffs() const; virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
// Member operators // Member Operators
virtual void operator=(const UList<Type>&) {} virtual void operator=(const UList<Type>&) {}

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd. Copyright (C) 2023-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -131,4 +131,14 @@ Foam::slicedFvsPatchField<Type>::~slicedFvsPatchField()
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::slicedFvsPatchField<Type>::write(Ostream& os) const
{
fvsPatchField<Type>::write(os);
fvsPatchField<Type>::writeValueEntry(os);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd. Copyright (C) 2023-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -89,7 +89,8 @@ public:
const DimensionedField<Type, surfaceMesh>& const DimensionedField<Type, surfaceMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
// Not implemented.
slicedFvsPatchField slicedFvsPatchField
( (
const fvPatch&, const fvPatch&,
@ -98,6 +99,7 @@ public:
); );
//- Construct by mapping the given sliced patch field onto a new patch //- Construct by mapping the given sliced patch field onto a new patch
// Not implemented.
slicedFvsPatchField slicedFvsPatchField
( (
const slicedFvsPatchField<Type>&, const slicedFvsPatchField<Type>&,
@ -141,6 +143,9 @@ public:
//- True: this patch field fixes a value. //- True: this patch field fixes a value.
virtual bool fixesValue() const { return true; } virtual bool fixesValue() const { return true; }
//- Write includes "value" entry
virtual void write(Ostream&) const;
// Member Operators // Member Operators

View File

@ -27,15 +27,27 @@ Class
Foam::cyclicFvsPatchField Foam::cyclicFvsPatchField
Description Description
Foam::cyclicFvsPatchField This boundary condition enforces a cyclic condition between a pair of
boundaries.
The "value" entry is NO_READ, but is written.
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type cyclic;
}
\endverbatim
SourceFiles SourceFiles
cyclicFvsPatchField.C cyclicFvsPatchField.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef cyclicFvsPatchField_H #ifndef Foam_cyclicFvsPatchField_H
#define cyclicFvsPatchField_H #define Foam_cyclicFvsPatchField_H
#include "coupledFvsPatchField.H" #include "coupledFvsPatchField.H"
#include "cyclicFvPatch.H" #include "cyclicFvPatch.H"
@ -46,7 +58,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class cyclicFvsPatch Declaration Class cyclicFvsPatchField Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
@ -54,7 +66,7 @@ class cyclicFvsPatchField
: :
public coupledFvsPatchField<Type> public coupledFvsPatchField<Type>
{ {
// Private data // Private Data
//- Local reference cast into the cyclic patch //- Local reference cast into the cyclic patch
const cyclicFvPatch& cyclicPatch_; const cyclicFvPatch& cyclicPatch_;
@ -75,7 +87,8 @@ public:
const DimensionedField<Type, surfaceMesh>& const DimensionedField<Type, surfaceMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
cyclicFvsPatchField cyclicFvsPatchField
( (
const fvPatch&, const fvPatch&,

View File

@ -117,7 +117,7 @@ bool Foam::cyclicACMIFvsPatchField<Type>::coupled() const
{ {
if if
( (
Pstream::parRun() UPstream::parRun()
|| ( || (
this->cyclicACMIPatch_.size() this->cyclicACMIPatch_.size()
&& this->cyclicACMIPatch_.cyclicACMIPatch().neighbPatch().size() && this->cyclicACMIPatch_.cyclicACMIPatch().neighbPatch().size()

View File

@ -27,7 +27,9 @@ Class
Foam::cyclicACMIFvsPatchField Foam::cyclicACMIFvsPatchField
Description Description
Foam::cyclicACMIFvsPatchField This boundary condition enforces a cyclic condition between a pair of
boundaries, whereby communication between the patches is performed using
an arbitrarily coupled mesh interface (ACMI) interpolation.
SourceFiles SourceFiles
cyclicACMIFvsPatchField.C cyclicACMIFvsPatchField.C
@ -54,7 +56,7 @@ class cyclicACMIFvsPatchField
: :
public coupledFvsPatchField<Type> public coupledFvsPatchField<Type>
{ {
// Private data // Private Data
//- Local reference cast into the cyclic patch //- Local reference cast into the cyclic patch
const cyclicACMIFvPatch& cyclicACMIPatch_; const cyclicACMIFvPatch& cyclicACMIPatch_;
@ -75,7 +77,8 @@ public:
const DimensionedField<Type, surfaceMesh>& const DimensionedField<Type, surfaceMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is MUST_READ.
cyclicACMIFvsPatchField cyclicACMIFvsPatchField
( (
const fvPatch&, const fvPatch&,

View File

@ -27,7 +27,11 @@ Class
Foam::cyclicAMIFvsPatchField Foam::cyclicAMIFvsPatchField
Description Description
Foam::cyclicAMIFvsPatchField This boundary condition enforces a cyclic condition between a pair of
boundaries, whereby communication between the patches is performed using
an arbitrary mesh interface (AMI) interpolation.
The "value" entry is MUST_READ.
SourceFiles SourceFiles
cyclicAMIFvsPatchField.C cyclicAMIFvsPatchField.C
@ -54,7 +58,7 @@ class cyclicAMIFvsPatchField
: :
public coupledFvsPatchField<Type> public coupledFvsPatchField<Type>
{ {
// Private data // Private Data
//- Local reference cast into the cyclic patch //- Local reference cast into the cyclic patch
const cyclicAMIFvPatch& cyclicAMIPatch_; const cyclicAMIFvPatch& cyclicAMIPatch_;
@ -75,7 +79,8 @@ public:
const DimensionedField<Type, surfaceMesh>& const DimensionedField<Type, surfaceMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is MUST_READ.
cyclicAMIFvsPatchField cyclicAMIFvsPatchField
( (
const fvPatch&, const fvPatch&,

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -38,7 +39,7 @@ Foam::emptyFvsPatchField<Type>::emptyFvsPatchField
const DimensionedField<Type, surfaceMesh>& iF const DimensionedField<Type, surfaceMesh>& iF
) )
: :
fvsPatchField<Type>(p, iF, Field<Type>(0)) fvsPatchField<Type>(p, iF, Field<Type>()) // zero-sized patch field
{} {}
@ -50,8 +51,11 @@ Foam::emptyFvsPatchField<Type>::emptyFvsPatchField
const dictionary& dict const dictionary& dict
) )
: :
fvsPatchField<Type>(p, iF, Field<Type>(0)) fvsPatchField<Type>(p, iF, Field<Type>()) // zero-sized patch field
{ {
// Empty means empty, so no patchType override
// with fvsPatchFieldBase::readDict(dict);
if (!isType<emptyFvPatch>(p)) if (!isType<emptyFvPatch>(p))
{ {
FatalIOErrorInFunction(dict) FatalIOErrorInFunction(dict)
@ -71,7 +75,7 @@ Foam::emptyFvsPatchField<Type>::emptyFvsPatchField
const fvPatchFieldMapper& const fvPatchFieldMapper&
) )
: :
fvsPatchField<Type>(p, iF, Field<Type>(0)) fvsPatchField<Type>(p, iF, Field<Type>()) // zero-sized patch field
{ {
if (!isType<emptyFvPatch>(this->patch())) if (!isType<emptyFvPatch>(this->patch()))
{ {
@ -88,26 +92,21 @@ Foam::emptyFvsPatchField<Type>::emptyFvsPatchField
template<class Type> template<class Type>
Foam::emptyFvsPatchField<Type>::emptyFvsPatchField Foam::emptyFvsPatchField<Type>::emptyFvsPatchField
( (
const emptyFvsPatchField<Type>& ptf const emptyFvsPatchField<Type>& ptf,
const DimensionedField<Type, surfaceMesh>& iF
) )
: :
fvsPatchField<Type> fvsPatchField<Type>(ptf.patch(), iF, Field<Type>()) // zero-sized
(
ptf.patch(),
ptf.internalField(),
Field<Type>(0)
)
{} {}
template<class Type> template<class Type>
Foam::emptyFvsPatchField<Type>::emptyFvsPatchField Foam::emptyFvsPatchField<Type>::emptyFvsPatchField
( (
const emptyFvsPatchField<Type>& ptf, const emptyFvsPatchField<Type>& ptf
const DimensionedField<Type, surfaceMesh>& iF
) )
: :
fvsPatchField<Type>(ptf.patch(), iF, Field<Type>(0)) emptyFvsPatchField<Type>(ptf, ptf.internalField())
{} {}

View File

@ -27,7 +27,19 @@ Class
Foam::emptyFvsPatchField Foam::emptyFvsPatchField
Description Description
Foam::emptyFvsPatchField This boundary condition provides an 'empty' condition for reduced
dimensions cases.
The "value" entry is NO_READ, NO_WRITE.
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type empty;
}
\endverbatim
SourceFiles SourceFiles
emptyFvsPatchField.C emptyFvsPatchField.C
@ -69,7 +81,8 @@ public:
const DimensionedField<Type, surfaceMesh>& const DimensionedField<Type, surfaceMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
emptyFvsPatchField emptyFvsPatchField
( (
const fvPatch&, const fvPatch&,
@ -115,9 +128,9 @@ public:
} }
// Member functions // Member Functions
// Mapping functions // Mapping Functions
//- Map (and resize as needed) from self given a mapping object //- Map (and resize as needed) from self given a mapping object
virtual void autoMap virtual void autoMap

View File

@ -122,11 +122,4 @@ Foam::processorFvsPatchField<Type>::processorFvsPatchField
{} {}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
Foam::processorFvsPatchField<Type>::~processorFvsPatchField()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,15 +28,26 @@ Class
Foam::processorFvsPatchField Foam::processorFvsPatchField
Description Description
Foam::processorFvsPatchField This boundary condition enables processor communication across patches.
The "value" entry is MUST_READ.
Example of the boundary condition specification:
\verbatim
<patchName>
{
type processor;
value uniform (0 0 0); // Mandatory
}
\endverbatim
SourceFiles SourceFiles
processorFvsPatchField.C processorFvsPatchField.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef processorFvsPatchField_H #ifndef Foam_processorFvsPatchField_H
#define processorFvsPatchField_H #define Foam_processorFvsPatchField_H
#include "coupledFvsPatchField.H" #include "coupledFvsPatchField.H"
#include "processorFvPatch.H" #include "processorFvPatch.H"
@ -54,7 +66,7 @@ class processorFvsPatchField
: :
public coupledFvsPatchField<Type> public coupledFvsPatchField<Type>
{ {
// Private data // Private Data
//- Local reference cast into the processor patch //- Local reference cast into the processor patch
const processorFvPatch& procPatch_; const processorFvPatch& procPatch_;
@ -83,7 +95,8 @@ public:
const Field<Type>& const Field<Type>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is MUST_READ.
processorFvsPatchField processorFvsPatchField
( (
const fvPatch&, const fvPatch&,
@ -127,15 +140,15 @@ public:
//- Destructor //- Destructor
virtual ~processorFvsPatchField(); virtual ~processorFvsPatchField() = default;
// Member Functions // Member Functions
//- Return true if running parallel //- True if running parallel
virtual bool coupled() const virtual bool coupled() const
{ {
return Pstream::parRun(); return UPstream::parRun();
} }
}; };

View File

@ -122,11 +122,4 @@ Foam::processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
{} {}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
Foam::processorCyclicFvsPatchField<Type>::~processorCyclicFvsPatchField()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -27,15 +27,18 @@ Class
Foam::processorCyclicFvsPatchField Foam::processorCyclicFvsPatchField
Description Description
Foam::processorCyclicFvsPatchField This boundary condition enables processor communication across cyclic
patches.
The "value" entry is MUST_READ.
SourceFiles SourceFiles
processorCyclicFvsPatchField.C processorCyclicFvsPatchField.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef processorCyclicFvsPatchField_H #ifndef Foam_processorCyclicFvsPatchField_H
#define processorCyclicFvsPatchField_H #define Foam_processorCyclicFvsPatchField_H
#include "coupledFvsPatchField.H" #include "coupledFvsPatchField.H"
#include "processorCyclicFvPatch.H" #include "processorCyclicFvPatch.H"
@ -54,7 +57,7 @@ class processorCyclicFvsPatchField
: :
public coupledFvsPatchField<Type> public coupledFvsPatchField<Type>
{ {
// Private data // Private Data
//- Local reference cast into the processor patch //- Local reference cast into the processor patch
const processorCyclicFvPatch& procPatch_; const processorCyclicFvPatch& procPatch_;
@ -83,7 +86,8 @@ public:
const Field<Type>& const Field<Type>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is MUST_READ.
processorCyclicFvsPatchField processorCyclicFvsPatchField
( (
const fvPatch&, const fvPatch&,
@ -91,8 +95,7 @@ public:
const dictionary& const dictionary&
); );
//- Construct by mapping given processorCyclicFvsPatchField onto a //- Construct by mapping given patch field onto a new patch
// new patch
processorCyclicFvsPatchField processorCyclicFvsPatchField
( (
const processorCyclicFvsPatchField<Type>&, const processorCyclicFvsPatchField<Type>&,
@ -128,15 +131,15 @@ public:
//- Destructor //- Destructor
virtual ~processorCyclicFvsPatchField(); virtual ~processorCyclicFvsPatchField() = default;
// Member Functions // Member Functions
//- Return true if running parallel //- True if running parallel
virtual bool coupled() const virtual bool coupled() const
{ {
return Pstream::parRun(); return UPstream::parRun();
} }
}; };

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -48,7 +49,7 @@ Foam::symmetryFvsPatchField<Type>::symmetryFvsPatchField
const dictionary& dict const dictionary& dict
) )
: :
fvsPatchField<Type>(p, iF, dict) fvsPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{ {
if (!isType<symmetryFvPatch>(p)) if (!isType<symmetryFvPatch>(p))
{ {
@ -83,16 +84,6 @@ Foam::symmetryFvsPatchField<Type>::symmetryFvsPatchField
} }
template<class Type>
Foam::symmetryFvsPatchField<Type>::symmetryFvsPatchField
(
const symmetryFvsPatchField<Type>& ptf
)
:
fvsPatchField<Type>(ptf)
{}
template<class Type> template<class Type>
Foam::symmetryFvsPatchField<Type>::symmetryFvsPatchField Foam::symmetryFvsPatchField<Type>::symmetryFvsPatchField
( (
@ -104,4 +95,14 @@ Foam::symmetryFvsPatchField<Type>::symmetryFvsPatchField
{} {}
template<class Type>
Foam::symmetryFvsPatchField<Type>::symmetryFvsPatchField
(
const symmetryFvsPatchField<Type>& ptf
)
:
symmetryFvsPatchField<Type>(ptf, ptf.internalField())
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,15 +28,26 @@ Class
Foam::symmetryFvsPatchField Foam::symmetryFvsPatchField
Description Description
Foam::symmetryFvsPatchField This boundary condition enforces a symmetry constraint
The "value" entry is NO_READ, NO_WRITE.
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type symmetry;
}
\endverbatim
SourceFiles SourceFiles
symmetryFvsPatchField.C symmetryFvsPatchField.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef symmetryFvsPatchField_H #ifndef Foam_symmetryFvsPatchField_H
#define symmetryFvsPatchField_H #define Foam_symmetryFvsPatchField_H
#include "fvsPatchField.H" #include "fvsPatchField.H"
#include "symmetryFvPatch.H" #include "symmetryFvPatch.H"
@ -54,7 +66,6 @@ class symmetryFvsPatchField
: :
public fvsPatchField<Type> public fvsPatchField<Type>
{ {
public: public:
//- Runtime type information //- Runtime type information
@ -71,6 +82,7 @@ public:
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary
//- The "value" entry is NO_READ.
symmetryFvsPatchField symmetryFvsPatchField
( (
const fvPatch&, const fvPatch&,

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2015 OpenFOAM Foundation Copyright (C) 2013-2015 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -48,7 +49,7 @@ Foam::symmetryPlaneFvsPatchField<Type>::symmetryPlaneFvsPatchField
const dictionary& dict const dictionary& dict
) )
: :
fvsPatchField<Type>(p, iF, dict) fvsPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{ {
if (!isType<symmetryPlaneFvPatch>(p)) if (!isType<symmetryPlaneFvPatch>(p))
{ {
@ -83,16 +84,6 @@ Foam::symmetryPlaneFvsPatchField<Type>::symmetryPlaneFvsPatchField
} }
template<class Type>
Foam::symmetryPlaneFvsPatchField<Type>::symmetryPlaneFvsPatchField
(
const symmetryPlaneFvsPatchField<Type>& ptf
)
:
fvsPatchField<Type>(ptf)
{}
template<class Type> template<class Type>
Foam::symmetryPlaneFvsPatchField<Type>::symmetryPlaneFvsPatchField Foam::symmetryPlaneFvsPatchField<Type>::symmetryPlaneFvsPatchField
( (
@ -104,4 +95,14 @@ Foam::symmetryPlaneFvsPatchField<Type>::symmetryPlaneFvsPatchField
{} {}
template<class Type>
Foam::symmetryPlaneFvsPatchField<Type>::symmetryPlaneFvsPatchField
(
const symmetryPlaneFvsPatchField<Type>& ptf
)
:
symmetryPlaneFvsPatchField<Type>(ptf, ptf.internalField())
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -27,15 +27,26 @@ Class
Foam::symmetryPlaneFvsPatchField Foam::symmetryPlaneFvsPatchField
Description Description
Foam::symmetryPlaneFvsPatchField This boundary condition enforces a symmetryPlane constraint
The "value" entry is NO_READ, NO_WRITE.
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type symmetryPlane;
}
\endverbatim
SourceFiles SourceFiles
symmetryPlaneFvsPatchField.C symmetryPlaneFvsPatchField.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef symmetryPlaneFvsPatchField_H #ifndef Foam_symmetryPlaneFvsPatchField_H
#define symmetryPlaneFvsPatchField_H #define Foam_symmetryPlaneFvsPatchField_H
#include "fvsPatchField.H" #include "fvsPatchField.H"
#include "symmetryPlaneFvPatch.H" #include "symmetryPlaneFvPatch.H"
@ -54,7 +65,6 @@ class symmetryPlaneFvsPatchField
: :
public fvsPatchField<Type> public fvsPatchField<Type>
{ {
public: public:
//- Runtime type information //- Runtime type information
@ -70,7 +80,8 @@ public:
const DimensionedField<Type, surfaceMesh>& const DimensionedField<Type, surfaceMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
symmetryPlaneFvsPatchField symmetryPlaneFvsPatchField
( (
const fvPatch&, const fvPatch&,
@ -78,8 +89,7 @@ public:
const dictionary& const dictionary&
); );
//- Construct by mapping given symmetryPlaneFvsPatchField //- Construct by mapping given patch field onto a new patch
// onto a new patch
symmetryPlaneFvsPatchField symmetryPlaneFvsPatchField
( (
const symmetryPlaneFvsPatchField<Type>&, const symmetryPlaneFvsPatchField<Type>&,

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -48,7 +49,7 @@ Foam::wedgeFvsPatchField<Type>::wedgeFvsPatchField
const dictionary& dict const dictionary& dict
) )
: :
fvsPatchField<Type>(p, iF, dict) fvsPatchField<Type>(p, iF, dict, IOobjectOption::NO_READ)
{ {
if (!isType<wedgeFvPatch>(p)) if (!isType<wedgeFvPatch>(p))
{ {
@ -83,16 +84,6 @@ Foam::wedgeFvsPatchField<Type>::wedgeFvsPatchField
} }
template<class Type>
Foam::wedgeFvsPatchField<Type>::wedgeFvsPatchField
(
const wedgeFvsPatchField<Type>& ptf
)
:
fvsPatchField<Type>(ptf)
{}
template<class Type> template<class Type>
Foam::wedgeFvsPatchField<Type>::wedgeFvsPatchField Foam::wedgeFvsPatchField<Type>::wedgeFvsPatchField
( (
@ -104,4 +95,14 @@ Foam::wedgeFvsPatchField<Type>::wedgeFvsPatchField
{} {}
template<class Type>
Foam::wedgeFvsPatchField<Type>::wedgeFvsPatchField
(
const wedgeFvsPatchField<Type>& ptf
)
:
wedgeFvsPatchField<Type>(ptf, ptf.internalField())
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,15 +28,27 @@ Class
Foam::wedgeFvsPatchField Foam::wedgeFvsPatchField
Description Description
Foam::wedgeFvsPatchField This boundary condition is similar to the cyclic condition, except that
it is applied to 2-D geometries.
The "value" entry is NO_READ, NO_WRITE.
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type wedge;
}
\endverbatim
SourceFiles SourceFiles
wedgeFvsPatchField.C wedgeFvsPatchField.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef wedgeFvsPatchField_H #ifndef Foam_wedgeFvsPatchField_H
#define wedgeFvsPatchField_H #define Foam_wedgeFvsPatchField_H
#include "fvsPatchField.H" #include "fvsPatchField.H"
#include "wedgeFvPatch.H" #include "wedgeFvPatch.H"
@ -54,7 +67,6 @@ class wedgeFvsPatchField
: :
public fvsPatchField<Type> public fvsPatchField<Type>
{ {
public: public:
//- Runtime type information //- Runtime type information
@ -70,7 +82,8 @@ public:
const DimensionedField<Type, surfaceMesh>& const DimensionedField<Type, surfaceMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary.
//- The "value" entry is NO_READ.
wedgeFvsPatchField wedgeFvsPatchField
( (
const fvPatch&, const fvPatch&,

View File

@ -207,7 +207,6 @@ template<class Type>
void Foam::fvsPatchField<Type>::write(Ostream& os) const void Foam::fvsPatchField<Type>::write(Ostream& os) const
{ {
os.writeEntry("type", type()); os.writeEntry("type", type());
Field<Type>::writeEntry("value", os);
} }

View File

@ -343,13 +343,13 @@ public:
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF, const DimensionedField<Type, surfaceMesh>& iF,
const dictionary& dict, const dictionary& dict,
const bool valueReqd const bool needValue
) )
: :
fvsPatchField fvsPatchField
( (
p, iF, dict, p, iF, dict,
(valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ) (needValue? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
) )
{} {}
@ -541,7 +541,7 @@ public:
{} {}
//- Write //- Write the patch "type"
virtual void write(Ostream& os) const; virtual void write(Ostream& os) const;
//- Check against given patch field //- Check against given patch field

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef fvBoundaryMeshMapper_H #ifndef Foam_fvBoundaryMeshMapper_H
#define fvBoundaryMeshMapper_H #define Foam_fvBoundaryMeshMapper_H
#include "PtrList.H" #include "PtrList.H"
#include "fvPatchMapper.H" #include "fvPatchMapper.H"

Some files were not shown because too many files have changed in this diff Show More