mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: make gravity mesh object unmovable and properly registered (#1276)
- change from UpdateableMeshObject to TopologicalMeshObject - change inheritance order to have MeshObject be registered first and mark the IOobject descriptor as unregistered
This commit is contained in:
committed by
Andrew Heather
parent
805cc59543
commit
29f9a3db27
@ -32,7 +32,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
namespace meshObjects
|
namespace meshObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(gravity, 0);
|
defineTypeName(gravity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyrigravityht (C) 2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -19,13 +19,15 @@ License
|
|||||||
for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gravitynu.orgravity/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::meshObjects::gravity
|
Foam::meshObjects::gravity
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Gravitational acceleration vector
|
Gravitational acceleration vector
|
||||||
|
Although termed a \em MeshObject it is registered on Time only
|
||||||
|
and thus identical for all regions.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
gravityMeshObject.C
|
gravityMeshObject.C
|
||||||
@ -52,67 +54,49 @@ namespace meshObjects
|
|||||||
|
|
||||||
class gravity
|
class gravity
|
||||||
:
|
:
|
||||||
public uniformDimensionedVectorField,
|
|
||||||
public MeshObject
|
public MeshObject
|
||||||
<
|
<
|
||||||
Time,
|
Time,
|
||||||
Foam::UpdateableMeshObject,
|
TopologicalMeshObject,
|
||||||
gravity
|
gravity
|
||||||
>
|
>,
|
||||||
|
public uniformDimensionedVectorField
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Run-time type information
|
//- Run-time type information
|
||||||
TypeName("g");
|
TypeNameNoDebug("g");
|
||||||
|
|
||||||
|
|
||||||
//- Construct with objectRegistry and IOobject
|
//- Construct on Time
|
||||||
explicit gravity(const Time& runTime, const IOobject& io)
|
explicit gravity(const Time& runTime)
|
||||||
:
|
:
|
||||||
uniformDimensionedVectorField(io),
|
MeshObject<Time, TopologicalMeshObject, gravity>(runTime),
|
||||||
MeshObject
|
uniformDimensionedVectorField
|
||||||
<
|
|
||||||
Time,
|
|
||||||
Foam::UpdateableMeshObject,
|
|
||||||
gravity
|
|
||||||
>(runTime)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
//- Construct from Time
|
|
||||||
static const gravity& New(const Time& runTime)
|
|
||||||
{
|
|
||||||
return MeshObject<Time, Foam::UpdateableMeshObject, gravity>::New
|
|
||||||
(
|
(
|
||||||
runTime,
|
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"g",
|
"g", // Must be identical to typeName!
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE,
|
||||||
|
false // let MeshObject register it
|
||||||
)
|
)
|
||||||
);
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct on Time
|
||||||
|
static const gravity& New(const Time& runTime)
|
||||||
|
{
|
||||||
|
return MeshObject<Time, TopologicalMeshObject, gravity>::New(runTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~gravity() = default;
|
virtual ~gravity() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
//- Callback for gometry motion
|
|
||||||
virtual bool movePoints()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Callback for topology change
|
|
||||||
virtual void updateMesh(const mapPolyMesh& mpm)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user