meshObjects: Formalise support for multiple named meshObjects of the same type
This commit is contained in:
@ -31,19 +31,12 @@ License
|
|||||||
template<class Mesh, template<class> class MeshObjectType, class Type>
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::DemandDrivenMeshObject
|
Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::DemandDrivenMeshObject
|
||||||
(
|
(
|
||||||
|
const IOobject& io,
|
||||||
const Mesh& mesh
|
const Mesh& mesh
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
regIOobject
|
regIOobject(io),
|
||||||
(
|
MeshObjectType<Mesh>(*this),
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
Type::typeName,
|
|
||||||
mesh.thisDb().instance(),
|
|
||||||
mesh.thisDb()
|
|
||||||
)
|
|
||||||
),
|
|
||||||
MeshObjectType<Mesh>(*this, mesh),
|
|
||||||
mesh_(mesh)
|
mesh_(mesh)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -51,18 +44,67 @@ Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::DemandDrivenMeshObject
|
|||||||
template<class Mesh, template<class> class MeshObjectType, class Type>
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::DemandDrivenMeshObject
|
Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::DemandDrivenMeshObject
|
||||||
(
|
(
|
||||||
const Mesh& mesh,
|
const word& name,
|
||||||
const IOobject& io
|
const Mesh& mesh
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
regIOobject(io),
|
regIOobject
|
||||||
MeshObjectType<Mesh>(*this, mesh),
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
name,
|
||||||
|
mesh.thisDb().instance(),
|
||||||
|
mesh.thisDb()
|
||||||
|
)
|
||||||
|
),
|
||||||
|
MeshObjectType<Mesh>(*this),
|
||||||
mesh_(mesh)
|
mesh_(mesh)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
|
Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::DemandDrivenMeshObject
|
||||||
|
(
|
||||||
|
const Mesh& mesh
|
||||||
|
)
|
||||||
|
:
|
||||||
|
DemandDrivenMeshObject<Mesh, MeshObjectType, Type>(Type::typeName, mesh)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
|
Type& Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Mesh& mesh
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (found(name, mesh))
|
||||||
|
{
|
||||||
|
return mesh.thisDb().objectRegistry::template lookupObjectRef<Type>
|
||||||
|
(
|
||||||
|
name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (meshObjects::debug)
|
||||||
|
{
|
||||||
|
Pout<< "DemandDrivenMeshObject::New(" << Mesh::typeName
|
||||||
|
<< "&) : constructing " << name
|
||||||
|
<< " of type " << Type::typeName
|
||||||
|
<< " for region " << mesh.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Type* objectPtr = new Type(name, mesh);
|
||||||
|
|
||||||
|
return regIOobject::store(objectPtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Mesh, template<class> class MeshObjectType, class Type>
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
Type& Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::New
|
Type& Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::New
|
||||||
(
|
(
|
||||||
@ -92,6 +134,39 @@ Type& Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::New
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
|
template<class... Args>
|
||||||
|
Type& Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const Args&... args
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (found(name, mesh))
|
||||||
|
{
|
||||||
|
return mesh.thisDb().objectRegistry::template lookupObjectRef<Type>
|
||||||
|
(
|
||||||
|
name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (meshObjects::debug)
|
||||||
|
{
|
||||||
|
Pout<< "DemandDrivenMeshObject::New(" << Mesh::typeName
|
||||||
|
<< "&, const Data1&) : constructing " << name
|
||||||
|
<< " of type " << Type::typeName
|
||||||
|
<< " for region " << mesh.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Type* objectPtr = new Type(name, mesh, args...);
|
||||||
|
|
||||||
|
return regIOobject::store(objectPtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Mesh, template<class> class MeshObjectType, class Type>
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
Type& Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::New
|
Type& Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::New
|
||||||
@ -125,38 +200,6 @@ Type& Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::New
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Mesh, template<class> class MeshObjectType, class Type>
|
|
||||||
bool Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::Delete
|
|
||||||
(
|
|
||||||
const Mesh& mesh
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (found(mesh))
|
|
||||||
{
|
|
||||||
if (meshObjects::debug)
|
|
||||||
{
|
|
||||||
Pout<< "DemandDrivenMeshObject::Delete(const Mesh&) : deleting "
|
|
||||||
<< Type::typeName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mesh.thisDb().checkOut
|
|
||||||
(
|
|
||||||
const_cast<Type&>
|
|
||||||
(
|
|
||||||
mesh.thisDb().objectRegistry::template lookupObject<Type>
|
|
||||||
(
|
|
||||||
Type::typeName
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Mesh, template<class> class MeshObjectType, class Type>
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::
|
Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::
|
||||||
~DemandDrivenMeshObject()
|
~DemandDrivenMeshObject()
|
||||||
@ -178,13 +221,21 @@ Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::type() const
|
|||||||
template<class Mesh, template<class> class MeshObjectType, class Type>
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
bool Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::found
|
bool Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::found
|
||||||
(
|
(
|
||||||
|
const word& name,
|
||||||
const Mesh& mesh
|
const Mesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return mesh.thisDb().objectRegistry::template foundObject<Type>
|
return mesh.thisDb().objectRegistry::template foundObject<Type>(name);
|
||||||
(
|
}
|
||||||
Type::typeName
|
|
||||||
);
|
|
||||||
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
|
bool Foam::DemandDrivenMeshObject<Mesh, MeshObjectType, Type>::found
|
||||||
|
(
|
||||||
|
const Mesh& mesh
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return found(Type::typeName, mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -109,13 +109,17 @@ protected:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from mesh
|
|
||||||
// Only derived classes can construct DemandDrivenMeshObject
|
|
||||||
DemandDrivenMeshObject(const Mesh& mesh);
|
|
||||||
|
|
||||||
//- Construct from mesh and IOobject
|
//- Construct from mesh and IOobject
|
||||||
// Only derived classes can construct DemandDrivenMeshObject
|
// Only derived classes can construct DemandDrivenMeshObject
|
||||||
DemandDrivenMeshObject(const Mesh& mesh, const IOobject& io);
|
DemandDrivenMeshObject(const IOobject& io, const Mesh& mesh);
|
||||||
|
|
||||||
|
//- Construct from mesh and name
|
||||||
|
// Only derived classes can construct DemandDrivenMeshObject
|
||||||
|
DemandDrivenMeshObject(const word& name, const Mesh& mesh);
|
||||||
|
|
||||||
|
//- Construct from mesh, the name is set to Type::typeName
|
||||||
|
// Only derived classes can construct DemandDrivenMeshObject
|
||||||
|
DemandDrivenMeshObject(const Mesh& mesh);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -126,8 +130,24 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct and return the named DemandDrivenMeshObject
|
||||||
|
static Type& New(const word& name, const Mesh& mesh);
|
||||||
|
|
||||||
|
//- Construct and return the DemandDrivenMeshObject named Type::typeName
|
||||||
static Type& New(const Mesh& mesh);
|
static Type& New(const Mesh& mesh);
|
||||||
|
|
||||||
|
//- Construct and return the named DemandDrivenMeshObject
|
||||||
|
// with the additional arguments
|
||||||
|
template<class... Args>
|
||||||
|
static Type& New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const Args&... args
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return the DemandDrivenMeshObject named Type::typeName
|
||||||
|
// with the additional arguments
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
static Type& New
|
static Type& New
|
||||||
(
|
(
|
||||||
@ -140,14 +160,15 @@ public:
|
|||||||
|
|
||||||
virtual ~DemandDrivenMeshObject();
|
virtual ~DemandDrivenMeshObject();
|
||||||
|
|
||||||
//- Lookup DemandDrivenMeshObject and delete
|
|
||||||
static bool Delete(const Mesh& mesh);
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return true if this DemandDrivenMeshObject is found
|
//- Return true if the DemandDrivenMeshObject with the given name
|
||||||
// in the mesh registry
|
// is found in the mesh registry
|
||||||
|
static bool found(const word& name, const Mesh& mesh);
|
||||||
|
|
||||||
|
//- Return true if the DemandDrivenMeshObject named Type::typeName
|
||||||
|
// is found in the mesh registry
|
||||||
static bool found(const Mesh& mesh);
|
static bool found(const Mesh& mesh);
|
||||||
|
|
||||||
const Mesh& mesh() const
|
const Mesh& mesh() const
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -74,9 +74,10 @@ class DeletableMeshObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DeletableMeshObject(regIOobject& io, const Mesh& mesh)
|
template<class Type>
|
||||||
|
DeletableMeshObject(Type& mo)
|
||||||
:
|
:
|
||||||
io_(io)
|
io_(mo)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//- Virtual destructor to make class polymorphic
|
//- Virtual destructor to make class polymorphic
|
||||||
@ -95,9 +96,10 @@ class MoveableMeshObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MoveableMeshObject(regIOobject& io, const Mesh& mesh)
|
template<class Type>
|
||||||
|
MoveableMeshObject(Type& mo)
|
||||||
:
|
:
|
||||||
DeletableMeshObject<Mesh>(io, mesh)
|
DeletableMeshObject<Mesh>(mo)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//- Update for mesh motion
|
//- Update for mesh motion
|
||||||
@ -116,9 +118,10 @@ class DistributeableMeshObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DistributeableMeshObject(regIOobject& io, const Mesh& mesh)
|
template<class Type>
|
||||||
|
DistributeableMeshObject(Type& mo)
|
||||||
:
|
:
|
||||||
MoveableMeshObject<Mesh>(io, mesh)
|
MoveableMeshObject<Mesh>(mo)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//- Redistribute or update using the given distribution map
|
//- Redistribute or update using the given distribution map
|
||||||
@ -137,9 +140,10 @@ class TopoChangeableMeshObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TopoChangeableMeshObject(regIOobject& io, const Mesh& mesh)
|
template<class Type>
|
||||||
|
TopoChangeableMeshObject(Type& mo)
|
||||||
:
|
:
|
||||||
DistributeableMeshObject<Mesh>(io, mesh)
|
DistributeableMeshObject<Mesh>(mo)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//- Update topology using the given map
|
//- Update topology using the given map
|
||||||
@ -161,9 +165,10 @@ class RepatchableMeshObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RepatchableMeshObject(regIOobject& io, const Mesh& mesh)
|
template<class Type>
|
||||||
|
RepatchableMeshObject(Type& mo)
|
||||||
:
|
:
|
||||||
TopoChangeableMeshObject<Mesh>(io, mesh)
|
TopoChangeableMeshObject<Mesh>(mo)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//- Reordered/removed trailing patches. If validBoundary call is parallel
|
//- Reordered/removed trailing patches. If validBoundary call is parallel
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -94,8 +94,6 @@ class polyDistributionMap;
|
|||||||
|
|
||||||
class meshObjects
|
class meshObjects
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
|
|
||||||
//- Checkout and delete object if owned by registry
|
//- Checkout and delete object if owned by registry
|
||||||
// otherwise error
|
// otherwise error
|
||||||
template<class Mesh>
|
template<class Mesh>
|
||||||
|
|||||||
@ -141,7 +141,7 @@ Fickian<BasicThermophysicalTransportModel>::Fickian
|
|||||||
thermo
|
thermo
|
||||||
),
|
),
|
||||||
|
|
||||||
TopoChangeableMeshObject(*this, thermo.mesh()),
|
TopoChangeableMeshObject(*this),
|
||||||
|
|
||||||
mixtureDiffusionCoefficients_(true),
|
mixtureDiffusionCoefficients_(true),
|
||||||
|
|
||||||
|
|||||||
@ -361,7 +361,7 @@ MaxwellStefan<BasicThermophysicalTransportModel>::MaxwellStefan
|
|||||||
thermo
|
thermo
|
||||||
),
|
),
|
||||||
|
|
||||||
TopoChangeableMeshObject(*this, thermo.mesh()),
|
TopoChangeableMeshObject(*this),
|
||||||
|
|
||||||
DFuncs_(this->thermo().species().size()),
|
DFuncs_(this->thermo().species().size()),
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -104,7 +104,7 @@ anisotropic<SolidThermophysicalTransportModel>::anisotropic
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
SolidThermophysicalTransportModel(typeName, alpha, thermo),
|
SolidThermophysicalTransportModel(typeName, alpha, thermo),
|
||||||
TopoChangeableMeshObject(*this, thermo.mesh()),
|
TopoChangeableMeshObject(*this),
|
||||||
coordinateSystem_(coordinateSystem::New(thermo.mesh(), this->coeffDict())),
|
coordinateSystem_(coordinateSystem::New(thermo.mesh(), this->coeffDict())),
|
||||||
boundaryAligned_
|
boundaryAligned_
|
||||||
(
|
(
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -142,8 +142,8 @@ Foam::fvConstraints::fvConstraints
|
|||||||
:
|
:
|
||||||
DemandDrivenMeshObject<fvMesh, TopoChangeableMeshObject, fvConstraints>
|
DemandDrivenMeshObject<fvMesh, TopoChangeableMeshObject, fvConstraints>
|
||||||
(
|
(
|
||||||
mesh,
|
createIOobject(mesh),
|
||||||
createIOobject(mesh)
|
mesh
|
||||||
),
|
),
|
||||||
PtrListDictionary<fvConstraint>(0),
|
PtrListDictionary<fvConstraint>(0),
|
||||||
checkTimeIndex_(mesh.time().timeIndex() + 1),
|
checkTimeIndex_(mesh.time().timeIndex() + 1),
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -147,8 +147,8 @@ Foam::fvModels::fvModels
|
|||||||
:
|
:
|
||||||
DemandDrivenMeshObject<fvMesh, TopoChangeableMeshObject, fvModels>
|
DemandDrivenMeshObject<fvMesh, TopoChangeableMeshObject, fvModels>
|
||||||
(
|
(
|
||||||
mesh,
|
createIOobject(mesh),
|
||||||
createIOobject(mesh)
|
mesh
|
||||||
),
|
),
|
||||||
PtrListDictionary<fvModel>(0),
|
PtrListDictionary<fvModel>(0),
|
||||||
checkTimeIndex_(mesh.time().timeIndex() + 1),
|
checkTimeIndex_(mesh.time().timeIndex() + 1),
|
||||||
|
|||||||
@ -40,17 +40,12 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::cpuLoad::cpuLoad(const fvMesh& mesh, const word& name)
|
Foam::cpuLoad::cpuLoad( const word& name, const fvMesh& mesh)
|
||||||
:
|
:
|
||||||
DemandDrivenMeshObject<fvMesh, TopoChangeableMeshObject, cpuLoad>
|
DemandDrivenMeshObject<fvMesh, TopoChangeableMeshObject, cpuLoad>
|
||||||
(
|
(
|
||||||
mesh,
|
name,
|
||||||
IOobject
|
mesh
|
||||||
(
|
|
||||||
name,
|
|
||||||
mesh.time().name(),
|
|
||||||
mesh
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
scalarField(mesh.nCells(), 0.0)
|
scalarField(mesh.nCells(), 0.0)
|
||||||
{}
|
{}
|
||||||
@ -66,43 +61,19 @@ Foam::cpuLoad::~cpuLoad()
|
|||||||
|
|
||||||
Foam::optionalCpuLoad& Foam::optionalCpuLoad::New
|
Foam::optionalCpuLoad& Foam::optionalCpuLoad::New
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
|
||||||
const word& name,
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
const bool loadBalancing
|
const bool loadBalancing
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (loadBalancing)
|
if (loadBalancing)
|
||||||
{
|
{
|
||||||
if
|
return DemandDrivenMeshObject
|
||||||
(
|
<
|
||||||
mesh.thisDb().objectRegistry::template
|
fvMesh,
|
||||||
foundObject<cpuLoad>
|
TopoChangeableMeshObject,
|
||||||
(
|
cpuLoad
|
||||||
name
|
>::New(name, mesh);
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return mesh.thisDb().objectRegistry::template
|
|
||||||
lookupObjectRef<cpuLoad>
|
|
||||||
(
|
|
||||||
name
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (cpuLoad::debug)
|
|
||||||
{
|
|
||||||
InfoInFunction
|
|
||||||
<< "constructing " << name
|
|
||||||
<< " for region " << mesh.name() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
cpuLoad* cpuLoadPtr(new cpuLoad(mesh, name));
|
|
||||||
|
|
||||||
regIOobject::store(cpuLoadPtr);
|
|
||||||
|
|
||||||
return *cpuLoadPtr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -113,14 +84,14 @@ Foam::optionalCpuLoad& Foam::optionalCpuLoad::New
|
|||||||
|
|
||||||
Foam::optionalCpuLoad& Foam::optionalCpuLoad::New
|
Foam::optionalCpuLoad& Foam::optionalCpuLoad::New
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
|
||||||
const word& name,
|
const word& name,
|
||||||
|
const polyMesh& mesh,
|
||||||
const bool loadBalancing
|
const bool loadBalancing
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (loadBalancing && isA<fvMesh>(mesh))
|
if (loadBalancing && isA<fvMesh>(mesh))
|
||||||
{
|
{
|
||||||
return New(refCast<const fvMesh>(mesh), name, loadBalancing);
|
return New(name, refCast<const fvMesh>(mesh), loadBalancing);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -83,8 +83,8 @@ public:
|
|||||||
// otherwise return the dummy optionalCpuLoad
|
// otherwise return the dummy optionalCpuLoad
|
||||||
static optionalCpuLoad& New
|
static optionalCpuLoad& New
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
|
||||||
const word& name,
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
const bool loadBalancing
|
const bool loadBalancing
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -92,8 +92,8 @@ public:
|
|||||||
// otherwise return the dummy optionalCpuLoad
|
// otherwise return the dummy optionalCpuLoad
|
||||||
static optionalCpuLoad& New
|
static optionalCpuLoad& New
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
|
||||||
const word& name,
|
const word& name,
|
||||||
|
const polyMesh& mesh,
|
||||||
const bool loadBalancing
|
const bool loadBalancing
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -151,8 +151,8 @@ public:
|
|||||||
//- Construct from mesh, name and switch
|
//- Construct from mesh, name and switch
|
||||||
cpuLoad
|
cpuLoad
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const word& name,
|
||||||
const word& name
|
const fvMesh& mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Disallow default bitwise copy construction
|
//- Disallow default bitwise copy construction
|
||||||
|
|||||||
@ -304,7 +304,7 @@ void Foam::Cloud<ParticleType>::move
|
|||||||
|
|
||||||
optionalCpuLoad& cloudCpuTime
|
optionalCpuLoad& cloudCpuTime
|
||||||
(
|
(
|
||||||
optionalCpuLoad::New(pMesh_, name() + ":cpuLoad", cloud.cpuLoad())
|
optionalCpuLoad::New(name() + ":cpuLoad", pMesh_, cloud.cpuLoad())
|
||||||
);
|
);
|
||||||
|
|
||||||
// While there are particles to transfer
|
// While there are particles to transfer
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -51,7 +51,6 @@ Foam::coordinateSystems::coordinateSystems::coordinateSystems
|
|||||||
coordinateSystems
|
coordinateSystems
|
||||||
>
|
>
|
||||||
(
|
(
|
||||||
obr,
|
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
typeName,
|
typeName,
|
||||||
@ -59,7 +58,8 @@ Foam::coordinateSystems::coordinateSystems::coordinateSystems
|
|||||||
obr,
|
obr,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
)
|
),
|
||||||
|
obr
|
||||||
),
|
),
|
||||||
PtrDictionary<coordinateSystem>()
|
PtrDictionary<coordinateSystem>()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -584,7 +584,7 @@ Foam::scalar Foam::chemistryModel<ThermoType>::solve
|
|||||||
{
|
{
|
||||||
optionalCpuLoad& chemistryCpuLoad
|
optionalCpuLoad& chemistryCpuLoad
|
||||||
(
|
(
|
||||||
optionalCpuLoad::New(this->mesh(), name() + ":cpuLoad", cpuLoad_)
|
optionalCpuLoad::New(name() + ":cpuLoad", this->mesh(), cpuLoad_)
|
||||||
);
|
);
|
||||||
|
|
||||||
// CPU time logging
|
// CPU time logging
|
||||||
|
|||||||
Reference in New Issue
Block a user