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
|
||||
{
|
||||
defineTypeNameAndDebug(gravity, 0);
|
||||
defineTypeName(gravity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyrigravityht (C) 2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -19,13 +19,15 @@ License
|
||||
for more details.
|
||||
|
||||
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
|
||||
Foam::meshObjects::gravity
|
||||
|
||||
Description
|
||||
Gravitational acceleration vector
|
||||
Although termed a \em MeshObject it is registered on Time only
|
||||
and thus identical for all regions.
|
||||
|
||||
SourceFiles
|
||||
gravityMeshObject.C
|
||||
@ -52,67 +54,49 @@ namespace meshObjects
|
||||
|
||||
class gravity
|
||||
:
|
||||
public uniformDimensionedVectorField,
|
||||
public MeshObject
|
||||
<
|
||||
Time,
|
||||
Foam::UpdateableMeshObject,
|
||||
TopologicalMeshObject,
|
||||
gravity
|
||||
>
|
||||
>,
|
||||
public uniformDimensionedVectorField
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Run-time type information
|
||||
TypeName("g");
|
||||
TypeNameNoDebug("g");
|
||||
|
||||
|
||||
//- Construct with objectRegistry and IOobject
|
||||
explicit gravity(const Time& runTime, const IOobject& io)
|
||||
//- Construct on Time
|
||||
explicit gravity(const Time& runTime)
|
||||
:
|
||||
uniformDimensionedVectorField(io),
|
||||
MeshObject
|
||||
<
|
||||
Time,
|
||||
Foam::UpdateableMeshObject,
|
||||
gravity
|
||||
>(runTime)
|
||||
{}
|
||||
|
||||
|
||||
//- Construct from Time
|
||||
static const gravity& New(const Time& runTime)
|
||||
{
|
||||
return MeshObject<Time, Foam::UpdateableMeshObject, gravity>::New
|
||||
MeshObject<Time, TopologicalMeshObject, gravity>(runTime),
|
||||
uniformDimensionedVectorField
|
||||
(
|
||||
runTime,
|
||||
IOobject
|
||||
(
|
||||
"g",
|
||||
"g", // Must be identical to typeName!
|
||||
runTime.constant(),
|
||||
runTime,
|
||||
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
|
||||
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