mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-named-MeshObject' into 'develop'
ENH: MeshObject: specify name (instead of typeName) See merge request Development/openfoam!589
This commit is contained in:
3
applications/test/gravityMeshObject/Make/files
Normal file
3
applications/test/gravityMeshObject/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Test-gravityMeshObject.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/Test-gravityMeshObject
|
||||||
5
applications/test/gravityMeshObject/Make/options
Normal file
5
applications/test/gravityMeshObject/Make/options
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume
|
||||||
88
applications/test/gravityMeshObject/Test-gravityMeshObject.C
Normal file
88
applications/test/gravityMeshObject/Test-gravityMeshObject.C
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2023 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Test loading of different gravity items
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "MeshObject.H"
|
||||||
|
#include "gravityMeshObject.H"
|
||||||
|
#include "IOobjectList.H"
|
||||||
|
#include "IOstreams.H"
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
void printInfo(const meshObjects::gravity& g)
|
||||||
|
{
|
||||||
|
Pout<< "name:" << g.uniformDimensionedVectorField::name()
|
||||||
|
<< " type:" << g.type()
|
||||||
|
<< " value:" << g.value() << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
#include "createTime.H"
|
||||||
|
|
||||||
|
IOobjectList objects(runTime, runTime.constant());
|
||||||
|
|
||||||
|
Info<< "Found: " << objects << nl << endl;
|
||||||
|
|
||||||
|
for (const IOobject& io : objects.sorted<uniformDimensionedVectorField>())
|
||||||
|
{
|
||||||
|
if (io.name() == meshObjects::gravity::typeName)
|
||||||
|
{
|
||||||
|
const auto& g = meshObjects::gravity::New(runTime);
|
||||||
|
printInfo(g);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const auto& g = meshObjects::gravity::New(io.name(), runTime);
|
||||||
|
printInfo(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
Pout<< "registered:" << flatOutput(runTime.sortedToc()) << nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
meshObjects::gravity::Delete("g", runTime);
|
||||||
|
meshObjects::gravity::Delete("something-not-in-registry", runTime);
|
||||||
|
|
||||||
|
Info<< "after Delete" << nl;
|
||||||
|
Pout<< "registered:" << flatOutput(runTime.sortedToc()) << endl;
|
||||||
|
|
||||||
|
Info<< "\nEnd\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
21
applications/test/gravityMeshObject/case1/constant/banana
Normal file
21
applications/test/gravityMeshObject/case1/constant/banana
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2212 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class uniformDimensionedVectorField;
|
||||||
|
location "constant";
|
||||||
|
object banana;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 1 -2 0 0 0 0];
|
||||||
|
value (0 0 -10);
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
21
applications/test/gravityMeshObject/case1/constant/g
Normal file
21
applications/test/gravityMeshObject/case1/constant/g
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2212 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class uniformDimensionedVectorField;
|
||||||
|
location "constant";
|
||||||
|
object g;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 1 -2 0 0 0 0];
|
||||||
|
value (0 -9.81 0);
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
21
applications/test/gravityMeshObject/case1/constant/saturn
Normal file
21
applications/test/gravityMeshObject/case1/constant/saturn
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2212 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class uniformDimensionedVectorField;
|
||||||
|
location "constant";
|
||||||
|
object saturn;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 1 -2 0 0 0 0];
|
||||||
|
value (-100 0 0);
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
34
applications/test/gravityMeshObject/case1/system/controlDict
Normal file
34
applications/test/gravityMeshObject/case1/system/controlDict
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2212 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
location "system";
|
||||||
|
object controlDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
application blockMesh;
|
||||||
|
|
||||||
|
startFrom startTime;
|
||||||
|
|
||||||
|
startTime 0;
|
||||||
|
|
||||||
|
stopAt endTime;
|
||||||
|
|
||||||
|
endTime 10;
|
||||||
|
|
||||||
|
deltaT 1;
|
||||||
|
|
||||||
|
writeControl timeStep;
|
||||||
|
|
||||||
|
writeInterval 1;
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,6 +40,18 @@ Foam::MeshObject<Mesh, MeshObjectType, Type>::MeshObject(const Mesh& mesh)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
|
Foam::MeshObject<Mesh, MeshObjectType, Type>::MeshObject
|
||||||
|
(
|
||||||
|
const word& objName,
|
||||||
|
const Mesh& mesh
|
||||||
|
)
|
||||||
|
:
|
||||||
|
MeshObjectType<Mesh>(objName, mesh.thisDb()),
|
||||||
|
mesh_(mesh)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Mesh, template<class> class MeshObjectType, class Type>
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
@ -50,11 +62,9 @@ const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New
|
|||||||
Args&&... args
|
Args&&... args
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const Type* ptr =
|
Type* ptr =
|
||||||
mesh.thisDb().objectRegistry::template cfindObject<Type>
|
mesh.thisDb().objectRegistry::template
|
||||||
(
|
getObjectPtr<Type>(Type::typeName);
|
||||||
Type::typeName
|
|
||||||
);
|
|
||||||
|
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
@ -68,34 +78,71 @@ const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New
|
|||||||
<< " for region " << mesh.name() << endl;
|
<< " for region " << mesh.name() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Type* objectPtr = new Type(mesh, std::forward<Args>(args)...);
|
ptr = new Type(mesh, std::forward<Args>(args)...);
|
||||||
|
|
||||||
regIOobject::store(static_cast<MeshObjectType<Mesh>*>(objectPtr));
|
regIOobject::store(static_cast<MeshObjectType<Mesh>*>(ptr));
|
||||||
|
|
||||||
return *objectPtr;
|
return *ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
|
template<class... Args>
|
||||||
|
const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New
|
||||||
|
(
|
||||||
|
const word& objName,
|
||||||
|
const Mesh& mesh,
|
||||||
|
Args&&... args
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Type* ptr =
|
||||||
|
mesh.thisDb().objectRegistry::template
|
||||||
|
getObjectPtr<Type>(objName);
|
||||||
|
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
return *ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (meshObject::debug)
|
||||||
|
{
|
||||||
|
Pout<< "MeshObject::New('" << objName
|
||||||
|
<< "', const " << Mesh::typeName
|
||||||
|
<< "&, ...) : constructing " << objName
|
||||||
|
<< " of type " << Type::typeName
|
||||||
|
<< " for region " << mesh.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr = new Type(objName, mesh, std::forward<Args>(args)...);
|
||||||
|
|
||||||
|
regIOobject::store(static_cast<MeshObjectType<Mesh>*>(ptr));
|
||||||
|
|
||||||
|
return *ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Mesh, template<class> class MeshObjectType, class Type>
|
template<class Mesh, template<class> class MeshObjectType, class Type>
|
||||||
bool Foam::MeshObject<Mesh, MeshObjectType, Type>::Delete(const Mesh& mesh)
|
bool Foam::MeshObject<Mesh, MeshObjectType, Type>::Delete
|
||||||
|
(
|
||||||
|
const word& objName,
|
||||||
|
const Mesh& mesh
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Type* ptr =
|
Type* ptr =
|
||||||
mesh.thisDb().objectRegistry::template getObjectPtr<Type>
|
mesh.thisDb().objectRegistry::template
|
||||||
(
|
getObjectPtr<Type>(objName);
|
||||||
Type::typeName
|
|
||||||
);
|
|
||||||
|
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
if (meshObject::debug)
|
if (meshObject::debug)
|
||||||
{
|
{
|
||||||
Pout<< "MeshObject::Delete(const Mesh&) : deleting "
|
Pout<< "MeshObject::Delete(const Mesh&) : deleting "
|
||||||
<< Type::typeName << endl;
|
<< objName << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mesh.thisDb().checkOut(ptr);
|
return mesh.thisDb().checkOut(static_cast<MeshObjectType<Mesh>*>(ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -63,12 +63,13 @@ Note
|
|||||||
MeshObjects of type UpdateableMeshObject.
|
MeshObjects of type UpdateableMeshObject.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
|
meshObject.C
|
||||||
MeshObject.C
|
MeshObject.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef MeshObject_H
|
#ifndef Foam_MeshObject_H
|
||||||
#define MeshObject_H
|
#define Foam_MeshObject_H
|
||||||
|
|
||||||
#include "regIOobject.H"
|
#include "regIOobject.H"
|
||||||
#include "objectRegistry.H"
|
#include "objectRegistry.H"
|
||||||
@ -78,7 +79,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declarations
|
// Forward Declarations
|
||||||
class mapPolyMesh;
|
class mapPolyMesh;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -90,10 +91,9 @@ class MeshObject
|
|||||||
:
|
:
|
||||||
public MeshObjectType<Mesh>
|
public MeshObjectType<Mesh>
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Reference to Mesh
|
//- Reference to the mesh
|
||||||
const Mesh& mesh_;
|
const Mesh& mesh_;
|
||||||
|
|
||||||
|
|
||||||
@ -101,30 +101,52 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct on Mesh type
|
//- Construct with Type::typeName on Mesh
|
||||||
explicit MeshObject(const Mesh& mesh);
|
explicit MeshObject(const Mesh& mesh);
|
||||||
|
|
||||||
// Selectors
|
//- Construct with given object name on Mesh
|
||||||
|
MeshObject(const word& objName, const Mesh& mesh);
|
||||||
|
|
||||||
//- Get existing or create a new MeshObject
|
|
||||||
|
// Factory Methods
|
||||||
|
|
||||||
|
//- Get existing or create a new MeshObject. Registered with typeName
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
static const Type& New(const Mesh& mesh, Args&&... args);
|
static const Type& New(const Mesh& mesh, Args&&... args);
|
||||||
|
|
||||||
|
//- Get existing or create a new MeshObject using supplied
|
||||||
|
//- registration name
|
||||||
|
template<class... Args>
|
||||||
|
static const Type& New
|
||||||
|
(
|
||||||
|
const word& objName,
|
||||||
|
const Mesh& mesh,
|
||||||
|
Args&&... args
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~MeshObject() = default;
|
virtual ~MeshObject() = default;
|
||||||
|
|
||||||
//- Static destructor
|
//- Static destructor using supplied registration name
|
||||||
static bool Delete(const Mesh& mesh);
|
static bool Delete(const word& objName, const Mesh& mesh);
|
||||||
|
|
||||||
|
//- Static destructor using Type::typeName
|
||||||
|
static bool Delete(const Mesh& mesh)
|
||||||
|
{
|
||||||
|
return Delete(Type::typeName, mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
const Mesh& mesh() const
|
//- Reference to the mesh
|
||||||
|
const Mesh& mesh() const noexcept
|
||||||
{
|
{
|
||||||
return mesh_;
|
return mesh_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Dummy write
|
||||||
virtual bool writeData(Ostream& os) const
|
virtual bool writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -136,19 +158,21 @@ public:
|
|||||||
Class meshObject Declaration
|
Class meshObject Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
//- The meshObject is a concrete regIOobject
|
||||||
class meshObject
|
class meshObject
|
||||||
:
|
:
|
||||||
public regIOobject
|
public regIOobject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Declare name of the class and its debug switch
|
//- Runtime declaration and debug switch
|
||||||
ClassName("meshObject");
|
ClassName("meshObject");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from name and instance on registry
|
//- Construct with given object name on a registry
|
||||||
meshObject(const word& typeName, const objectRegistry& obr);
|
meshObject(const word& objName, const objectRegistry& obr);
|
||||||
|
|
||||||
|
|
||||||
// Static Member Functions
|
// Static Member Functions
|
||||||
@ -187,9 +211,9 @@ class TopologicalMeshObject
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Construct from name and instance on registry
|
//- Construct from name and instance on registry
|
||||||
TopologicalMeshObject(const word& typeName, const objectRegistry& obr)
|
TopologicalMeshObject(const word& objName, const objectRegistry& obr)
|
||||||
:
|
:
|
||||||
meshObject(typeName, obr)
|
meshObject(objName, obr)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -206,9 +230,9 @@ class GeometricMeshObject
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Construct from name and instance on registry
|
//- Construct from name and instance on registry
|
||||||
GeometricMeshObject(const word& typeName, const objectRegistry& obr)
|
GeometricMeshObject(const word& objName, const objectRegistry& obr)
|
||||||
:
|
:
|
||||||
TopologicalMeshObject<Mesh>(typeName, obr)
|
TopologicalMeshObject<Mesh>(objName, obr)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -225,9 +249,9 @@ class MoveableMeshObject
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Construct from name and instance on registry
|
//- Construct from name and instance on registry
|
||||||
MoveableMeshObject(const word& typeName, const objectRegistry& obr)
|
MoveableMeshObject(const word& objName, const objectRegistry& obr)
|
||||||
:
|
:
|
||||||
GeometricMeshObject<Mesh>(typeName, obr)
|
GeometricMeshObject<Mesh>(objName, obr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual bool movePoints() = 0;
|
virtual bool movePoints() = 0;
|
||||||
@ -246,9 +270,9 @@ class UpdateableMeshObject
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Construct from name and instance on registry
|
//- Construct from name and instance on registry
|
||||||
UpdateableMeshObject(const word& typeName, const objectRegistry& obr)
|
UpdateableMeshObject(const word& objName, const objectRegistry& obr)
|
||||||
:
|
:
|
||||||
MoveableMeshObject<Mesh>(typeName, obr)
|
MoveableMeshObject<Mesh>(objName, obr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void updateMesh(const mapPolyMesh& mpm) = 0;
|
virtual void updateMesh(const mapPolyMesh& mpm) = 0;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2013 OpenFOAM Foundation
|
Copyright (C) 2013 OpenFOAM Foundation
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,15 +38,18 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::meshObject::meshObject(const word& typeName, const objectRegistry& obr)
|
Foam::meshObject::meshObject(const word& objName, const objectRegistry& obr)
|
||||||
:
|
:
|
||||||
regIOobject
|
regIOobject
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
typeName,
|
objName,
|
||||||
obr.instance(),
|
obr.instance(),
|
||||||
obr
|
obr,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
IOobject::REGISTER
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,14 +40,14 @@ namespace meshObjects
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::meshObjects::gravity::gravity(const Time& runTime)
|
Foam::meshObjects::gravity::gravity(const word& name, const Time& runTime)
|
||||||
:
|
:
|
||||||
MeshObject<Time, TopologicalMeshObject, gravity>(runTime),
|
MeshObject<Time, TopologicalMeshObject, gravity>(name, runTime),
|
||||||
uniformDimensionedVectorField
|
uniformDimensionedVectorField
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"g", // Must be identical to gravity::typeName!
|
name,
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -70,15 +70,39 @@ public:
|
|||||||
TypeNameNoDebug("g");
|
TypeNameNoDebug("g");
|
||||||
|
|
||||||
|
|
||||||
//- Construct on Time with MUST_READ_IF_MODIFIED from "constant"
|
// Constructors
|
||||||
explicit gravity(const Time& runTime);
|
|
||||||
|
|
||||||
//- Return cached object or construct on Time
|
//- Construct with given name on Time from \c constant
|
||||||
|
//- (MUST_READ_IF_MODIFIED)
|
||||||
|
gravity(const word& name, const Time& runTime);
|
||||||
|
|
||||||
|
//- Construct "g" field on Time from \c constant
|
||||||
|
//- (MUST_READ_IF_MODIFIED)
|
||||||
|
explicit gravity(const Time& runTime)
|
||||||
|
:
|
||||||
|
gravity("g", runTime)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Return named gravity field cached or construct on Time
|
||||||
|
static const gravity& New(const word& name, const Time& runTime)
|
||||||
|
{
|
||||||
|
return MeshObject<Time, TopologicalMeshObject, gravity>::New
|
||||||
|
(
|
||||||
|
name,
|
||||||
|
runTime
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return gravity "g" field cached or construct on Time
|
||||||
static const gravity& New(const Time& runTime)
|
static const gravity& New(const Time& runTime)
|
||||||
{
|
{
|
||||||
return MeshObject<Time, TopologicalMeshObject, gravity>::New(runTime);
|
return MeshObject<Time, TopologicalMeshObject, gravity>::New
|
||||||
|
(
|
||||||
|
runTime
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~gravity() = default;
|
virtual ~gravity() = default;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user