MeshObject: extended to support movePoints and updateMesh as an alternative to call-backs

All MeshObjects are now handled generically in polyMesh and fvMesh
See MeshObject.H for details
This commit is contained in:
Henry
2013-02-26 22:19:28 +00:00
parent 0a5508e813
commit 0afb3ab1ac
49 changed files with 567 additions and 351 deletions

View File

@ -159,6 +159,10 @@ public:
template<class Type> template<class Type>
HashTable<const Type*> lookupClass(const bool strict = false) const; HashTable<const Type*> lookupClass(const bool strict = false) const;
//- Lookup and return all objects of the given Type
template<class Type>
HashTable<Type*> lookupClass(const bool strict = false);
//- Is the named Type found? //- Is the named Type found?
template<class Type> template<class Type>
bool foundObject(const word& name) const; bool foundObject(const word& name) const;

View File

@ -76,6 +76,34 @@ Foam::HashTable<const Type*> Foam::objectRegistry::lookupClass
} }
template<class Type>
Foam::HashTable<Type*> Foam::objectRegistry::lookupClass
(
const bool strict
)
{
HashTable<Type*> objectsOfClass(size());
forAllIter(HashTable<regIOobject*>, *this, iter)
{
if
(
(strict && isType<Type>(*iter()))
|| (!strict && isA<Type>(*iter()))
)
{
objectsOfClass.insert
(
iter()->name(),
dynamic_cast<Type*>(iter())
);
}
}
return objectsOfClass;
}
template<class Type> template<class Type>
bool Foam::objectRegistry::foundObject(const word& name) const bool Foam::objectRegistry::foundObject(const word& name) const
{ {

View File

@ -70,7 +70,7 @@ Foam::GAMGAgglomeration::GAMGAgglomeration
const dictionary& controlDict const dictionary& controlDict
) )
: :
MeshObject<lduMesh, GAMGAgglomeration>(mesh), MeshObject<lduMesh, Foam::TopologicalMeshObject, GAMGAgglomeration>(mesh),
maxLevels_(50), maxLevels_(50),

View File

@ -58,7 +58,7 @@ class lduMatrix;
class GAMGAgglomeration class GAMGAgglomeration
: :
public MeshObject<lduMesh, GAMGAgglomeration> public MeshObject<lduMesh, TopologicalMeshObject, GAMGAgglomeration>
{ {
protected: protected:

View File

@ -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 | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -28,26 +28,18 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Mesh, class Type> template<class Mesh, template<class> class MeshObjectType, class Type>
Foam::MeshObject<Mesh, Type>::MeshObject(const Mesh& mesh) Foam::MeshObject<Mesh, MeshObjectType, Type>::MeshObject(const Mesh& mesh)
: :
regIOobject MeshObjectType<Mesh>(Type::typeName, mesh.thisDb()),
(
IOobject
(
Type::typeName,
mesh.thisDb().instance(),
mesh.thisDb()
)
),
mesh_(mesh) mesh_(mesh)
{} {}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
template<class Mesh, class Type> template<class Mesh, template<class> class MeshObjectType, class Type>
const Type& Foam::MeshObject<Mesh, Type>::New const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New
( (
const Mesh& mesh const Mesh& mesh
) )
@ -67,14 +59,14 @@ const Type& Foam::MeshObject<Mesh, Type>::New
} }
else else
{ {
return store(new Type(mesh)); return regIOobject::store(new Type(mesh));
} }
} }
template<class Mesh, class Type> template<class Mesh, template<class> class MeshObjectType, class Type>
template<class Data1> template<class Data1>
const Type& Foam::MeshObject<Mesh, Type>::New const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New
( (
const Mesh& mesh, const Mesh& mesh,
const Data1& d const Data1& d
@ -95,14 +87,14 @@ const Type& Foam::MeshObject<Mesh, Type>::New
} }
else else
{ {
return store(new Type(mesh, d)); return regIOobject::store(new Type(mesh, d));
} }
} }
template<class Mesh, class Type> template<class Mesh, template<class> class MeshObjectType, class Type>
template<class Data1, class Data2> template<class Data1, class Data2>
const Type& Foam::MeshObject<Mesh, Type>::New const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New
( (
const Mesh& mesh, const Mesh& mesh,
const Data1& d1, const Data1& d1,
@ -124,14 +116,14 @@ const Type& Foam::MeshObject<Mesh, Type>::New
} }
else else
{ {
return store(new Type(mesh, d1, d2)); return regIOobject::store(new Type(mesh, d1, d2));
} }
} }
template<class Mesh, class Type> template<class Mesh, template<class> class MeshObjectType, class Type>
template<class Data1, class Data2, class Data3> template<class Data1, class Data2, class Data3>
const Type& Foam::MeshObject<Mesh, Type>::New const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New
( (
const Mesh& mesh, const Mesh& mesh,
const Data1& d1, const Data1& d1,
@ -154,14 +146,14 @@ const Type& Foam::MeshObject<Mesh, Type>::New
} }
else else
{ {
return store(new Type(mesh, d1, d2, d3)); return regIOobject::store(new Type(mesh, d1, d2, d3));
} }
} }
template<class Mesh, class Type> template<class Mesh, template<class> class MeshObjectType, class Type>
template<class Data1, class Data2, class Data3, class Data4> template<class Data1, class Data2, class Data3, class Data4>
const Type& Foam::MeshObject<Mesh, Type>::New const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New
( (
const Mesh& mesh, const Mesh& mesh,
const Data1& d1, const Data1& d1,
@ -185,15 +177,15 @@ const Type& Foam::MeshObject<Mesh, Type>::New
} }
else else
{ {
return store(new Type(mesh, d1, d2, d3, d4)); return regIOobject::store(new Type(mesh, d1, d2, d3, d4));
} }
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Mesh, class Type> template<class Mesh, template<class> class MeshObjectType, class Type>
bool Foam::MeshObject<Mesh, Type>::Delete(const Mesh& mesh) bool Foam::MeshObject<Mesh, MeshObjectType, Type>::Delete(const Mesh& mesh)
{ {
if if
( (
@ -221,10 +213,79 @@ bool Foam::MeshObject<Mesh, Type>::Delete(const Mesh& mesh)
} }
template<class Mesh, class Type> template<class Mesh, template<class> class MeshObjectType, class Type>
Foam::MeshObject<Mesh, Type>::~MeshObject() Foam::MeshObject<Mesh, MeshObjectType, Type>::~MeshObject()
{ {
release(); MeshObjectType<Mesh>::release();
}
template<class Mesh>
void Foam::meshObject::movePoints(objectRegistry& obr)
{
HashTable<GeometricMeshObject<Mesh>*> meshObjects
(
obr.lookupClass<GeometricMeshObject<Mesh> >()
);
forAllIter
(
typename HashTable<GeometricMeshObject<Mesh>*>,
meshObjects,
iter
)
{
if (isA<MoveableMeshObject<Mesh> >(*iter()))
{
dynamic_cast<MoveableMeshObject<Mesh>*>(iter())->movePoints();
}
else
{
obr.checkOut(*iter());
}
}
}
template<class Mesh>
void Foam::meshObject::updateMesh(objectRegistry& obr, const mapPolyMesh& mpm)
{
HashTable<GeometricMeshObject<Mesh>*> meshObjects
(
obr.lookupClass<GeometricMeshObject<Mesh> >()
);
forAllIter
(
typename HashTable<GeometricMeshObject<Mesh>*>,
meshObjects,
iter
)
{
if (isA<UpdateableMeshObject<Mesh> >(*iter()))
{
dynamic_cast<UpdateableMeshObject<Mesh>*>(iter())->updateMesh(mpm);
}
else
{
obr.checkOut(*iter());
}
}
}
template<class Mesh, template<class> class MeshObjectType>
void Foam::meshObject::clear(objectRegistry& obr)
{
HashTable<MeshObjectType<Mesh>*> meshObjects
(
obr.lookupClass<MeshObjectType<Mesh> >()
);
forAllIter(typename HashTable<MeshObjectType<Mesh>*>, meshObjects, iter)
{
obr.checkOut(*iter());
}
} }

View File

@ -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 | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,9 +25,36 @@ Class
Foam::MeshObject Foam::MeshObject
Description Description
Templated abstract base-class for dynamic mesh objects used to automate Templated abstract base-class for optional mesh objects used to automate
their allocation to the mesh database and the mesh-modifier event-loop. their allocation to the mesh database and the mesh-modifier event-loop.
MeshObject is templated on the type of mesh it is allocated to, the type of
the mesh object (TopologicalMeshObject, GeometricMeshObject,
MoveableMeshObject, UpdateableMeshObject) and the type of the actual object
it is created for example:
class leastSquaresVectors
:
public MeshObject<fvMesh, MoveableMeshObject, leastSquaresVectors>
{
.
.
.
//- Delete the least square vectors when the mesh moves
virtual bool movePoints();
};
MeshObject types:
TopologicalMeshObject: mesh object to be deleted on topology change
GeometricMeshObject: mesh object to be deleted on geometry change
MoveableMeshObject: mesh object to be updated in movePoints
UpdateableMeshObject: mesh object to be updated in updateMesh or movePoints
Note that movePoints must be provided for MeshObjects of type
MoveableMeshObject and both movePoints and updateMesh functions must exist
provided for MeshObjects of type UpdateableMeshObject.
SourceFiles SourceFiles
MeshObject.C MeshObject.C
@ -37,21 +64,24 @@ SourceFiles
#define MeshObject_H #define MeshObject_H
#include "regIOobject.H" #include "regIOobject.H"
#include "objectRegistry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
// Forward declarations
class mapPolyMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class MeshObject Declaration Class MeshObject Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Mesh, template<class> class MeshObjectType, class Type>
template<class Mesh, class Type>
class MeshObject class MeshObject
: :
public regIOobject public MeshObjectType<Mesh>
{ {
protected: protected:
@ -124,6 +154,121 @@ public:
}; };
/*---------------------------------------------------------------------------*\
Class meshObject Declaration
\*---------------------------------------------------------------------------*/
class meshObject
:
public regIOobject
{
public:
// Constructors
meshObject(const word& typeName, const objectRegistry& obr)
:
regIOobject
(
IOobject
(
typeName,
obr.instance(),
obr
)
)
{}
// Static member functions
template<class Mesh>
static void movePoints(objectRegistry&);
template<class Mesh>
static void updateMesh(objectRegistry&, const mapPolyMesh&);
template<class Mesh, template<class> class MeshObjectType>
static void clear(objectRegistry&);
};
/*---------------------------------------------------------------------------*\
Class TopologicalMeshObject Declaration
\*---------------------------------------------------------------------------*/
template<class Mesh>
class TopologicalMeshObject
:
public meshObject
{
public:
TopologicalMeshObject(const word& typeName, const objectRegistry& obr)
:
meshObject(typeName, obr)
{}
};
/*---------------------------------------------------------------------------*\
Class GeometricMeshObject Declaration
\*---------------------------------------------------------------------------*/
template<class Mesh>
class GeometricMeshObject
:
public TopologicalMeshObject<Mesh>
{
public:
GeometricMeshObject(const word& typeName, const objectRegistry& obr)
:
TopologicalMeshObject<Mesh>(typeName, obr)
{}
};
/*---------------------------------------------------------------------------*\
Class MoveableMeshObject Declaration
\*---------------------------------------------------------------------------*/
template<class Mesh>
class MoveableMeshObject
:
public GeometricMeshObject<Mesh>
{
public:
MoveableMeshObject(const word& typeName, const objectRegistry& obr)
:
GeometricMeshObject<Mesh>(typeName, obr)
{}
virtual bool movePoints() = 0;
};
/*---------------------------------------------------------------------------*\
Class UpdateableMeshObject Declaration
\*---------------------------------------------------------------------------*/
template<class Mesh>
class UpdateableMeshObject
:
public MoveableMeshObject<Mesh>
{
public:
UpdateableMeshObject(const word& typeName, const objectRegistry& obr)
:
MoveableMeshObject<Mesh>(typeName, obr)
{}
virtual void updateMesh(const mapPolyMesh& mpm) = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -72,7 +72,7 @@ void Foam::pointMesh::mapFields(const mapPolyMesh& mpm)
Foam::pointMesh::pointMesh(const polyMesh& pMesh) Foam::pointMesh::pointMesh(const polyMesh& pMesh)
: :
MeshObject<polyMesh, pointMesh>(pMesh), MeshObject<polyMesh, Foam::UpdateableMeshObject, pointMesh>(pMesh),
GeoMesh<polyMesh>(pMesh), GeoMesh<polyMesh>(pMesh),
boundary_(*this, pMesh.boundaryMesh()) boundary_(*this, pMesh.boundaryMesh())
{ {
@ -88,7 +88,7 @@ Foam::pointMesh::pointMesh(const polyMesh& pMesh)
} }
void Foam::pointMesh::movePoints(const pointField& newPoints) bool Foam::pointMesh::movePoints()
{ {
if (debug) if (debug)
{ {
@ -96,7 +96,9 @@ void Foam::pointMesh::movePoints(const pointField& newPoints)
<< "Moving points." << endl; << "Moving points." << endl;
} }
boundary_.movePoints(newPoints); boundary_.movePoints(GeoMesh<polyMesh>::mesh_.points());
return true;
} }

View File

@ -48,7 +48,7 @@ namespace Foam
class pointMesh class pointMesh
: :
public MeshObject<polyMesh, pointMesh>, public MeshObject<polyMesh, UpdateableMeshObject, pointMesh>,
public GeoMesh<polyMesh> public GeoMesh<polyMesh>
{ {
// Permanent data // Permanent data
@ -121,7 +121,7 @@ public:
// Mesh motion // Mesh motion
//- Move points, returns volumes swept by faces in motion //- Move points, returns volumes swept by faces in motion
void movePoints(const pointField&); bool movePoints();
//- Update the mesh corresponding to given map //- Update the mesh corresponding to given map
void updateMesh(const mapPolyMesh& mpm); void updateMesh(const mapPolyMesh& mpm);

View File

@ -26,30 +26,24 @@ License
#include "polyMesh.H" #include "polyMesh.H"
#include "Time.H" #include "Time.H"
#include "cellIOList.H" #include "cellIOList.H"
#include "SubList.H"
#include "wedgePolyPatch.H" #include "wedgePolyPatch.H"
#include "emptyPolyPatch.H" #include "emptyPolyPatch.H"
#include "globalMeshData.H" #include "globalMeshData.H"
#include "processorPolyPatch.H" #include "processorPolyPatch.H"
#include "OSspecific.H"
#include "polyMeshTetDecomposition.H" #include "polyMeshTetDecomposition.H"
#include "indexedOctree.H" #include "indexedOctree.H"
#include "treeDataCell.H" #include "treeDataCell.H"
#include "SubField.H" #include "MeshObject.H"
#include "pointMesh.H"
#include "Istream.H"
#include "Ostream.H"
#include "simpleRegIOobject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(polyMesh, 0); defineTypeNameAndDebug(polyMesh, 0);
word polyMesh::defaultRegion = "region0"; word polyMesh::defaultRegion = "region0";
word polyMesh::meshSubDir = "polyMesh"; word polyMesh::meshSubDir = "polyMesh";
} }
@ -1162,21 +1156,7 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
geometricD_ = Vector<label>::zero; geometricD_ = Vector<label>::zero;
solutionD_ = Vector<label>::zero; solutionD_ = Vector<label>::zero;
meshObject::movePoints<polyMesh>(*this);
// Hack until proper callbacks. Below are all the polyMeh MeshObjects with a
// movePoints function.
// pointMesh
if (thisDb().foundObject<pointMesh>(pointMesh::typeName))
{
const_cast<pointMesh&>
(
thisDb().lookupObject<pointMesh>
(
pointMesh::typeName
)
).movePoints(points_);
}
const_cast<Time&>(time()).functionObjects().movePoints(*this); const_cast<Time&>(time()).functionObjects().movePoints(*this);

View File

@ -26,8 +26,7 @@ License
#include "polyMesh.H" #include "polyMesh.H"
#include "primitiveMesh.H" #include "primitiveMesh.H"
#include "globalMeshData.H" #include "globalMeshData.H"
#include "pointMesh.H" #include "MeshObject.H"
#include "Time.H"
#include "indexedOctree.H" #include "indexedOctree.H"
#include "treeDataCell.H" #include "treeDataCell.H"
@ -61,6 +60,8 @@ void Foam::polyMesh::clearGeom()
<< endl; << endl;
} }
meshObject::clear<polyMesh, GeometricMeshObject>(*this);
primitiveMesh::clearGeom(); primitiveMesh::clearGeom();
boundary_.clearGeom(); boundary_.clearGeom();
@ -101,6 +102,8 @@ void Foam::polyMesh::clearAddressing()
<< endl; << endl;
} }
meshObject::clear<polyMesh, TopologicalMeshObject>(*this);
primitiveMesh::clearAddressing(); primitiveMesh::clearAddressing();
// parallelData depends on the processorPatch ordering so force // parallelData depends on the processorPatch ordering so force
@ -118,6 +121,7 @@ void Foam::polyMesh::clearAddressing()
// Remove the stored tet base points // Remove the stored tet base points
tetBasePtIsPtr_.clear(); tetBasePtIsPtr_.clear();
// Remove the cell tree // Remove the cell tree
cellTreePtr_.clear(); cellTreePtr_.clear();
} }
@ -132,8 +136,6 @@ void Foam::polyMesh::clearPrimitives()
owner_.setSize(0); owner_.setSize(0);
neighbour_.setSize(0); neighbour_.setSize(0);
pointMesh::Delete(*this);
clearedPrimitives_ = true; clearedPrimitives_ = true;
} }
@ -142,8 +144,6 @@ void Foam::polyMesh::clearOut()
{ {
clearGeom(); clearGeom();
clearAddressing(); clearAddressing();
pointMesh::Delete(*this);
} }

View File

@ -91,25 +91,12 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
} }
} }
meshObject::updateMesh<polyMesh>(*this, mpm);
// Reset valid directions (could change by faces put into empty patches) // Reset valid directions (could change by faces put into empty patches)
geometricD_ = Vector<label>::zero; geometricD_ = Vector<label>::zero;
solutionD_ = Vector<label>::zero; solutionD_ = Vector<label>::zero;
// Hack until proper callbacks. Below are all the polyMesh-MeshObjects.
// pointMesh
if (thisDb().foundObject<pointMesh>(pointMesh::typeName))
{
const_cast<pointMesh&>
(
thisDb().lookupObject<pointMesh>
(
pointMesh::typeName
)
).updateMesh(mpm);
}
const_cast<Time&>(time()).functionObjects().updateMesh(mpm); const_cast<Time&>(time()).functionObjects().updateMesh(mpm);
} }

View File

@ -302,11 +302,11 @@ Foam::dynamicRefineFvMesh::refine
Pout<< "Found " << masterFaces.size() << " split faces " << endl; Pout<< "Found " << masterFaces.size() << " split faces " << endl;
} }
HashTable<const surfaceScalarField*> fluxes HashTable<surfaceScalarField*> fluxes
( (
lookupClass<surfaceScalarField>() lookupClass<surfaceScalarField>()
); );
forAllConstIter(HashTable<const surfaceScalarField*>, fluxes, iter) forAllIter(HashTable<surfaceScalarField*>, fluxes, iter)
{ {
if (!correctFluxes_.found(iter.key())) if (!correctFluxes_.found(iter.key()))
{ {
@ -336,7 +336,7 @@ Foam::dynamicRefineFvMesh::refine
<< endl; << endl;
} }
surfaceScalarField& phi = const_cast<surfaceScalarField&>(*iter()); surfaceScalarField& phi = *iter();
const surfaceScalarField phiU const surfaceScalarField phiU
( (
fvc::interpolate fvc::interpolate
@ -519,11 +519,11 @@ Foam::dynamicRefineFvMesh::unrefine
const labelList& reversePointMap = map().reversePointMap(); const labelList& reversePointMap = map().reversePointMap();
const labelList& reverseFaceMap = map().reverseFaceMap(); const labelList& reverseFaceMap = map().reverseFaceMap();
HashTable<const surfaceScalarField*> fluxes HashTable<surfaceScalarField*> fluxes
( (
lookupClass<surfaceScalarField>() lookupClass<surfaceScalarField>()
); );
forAllConstIter(HashTable<const surfaceScalarField*>, fluxes, iter) forAllIter(HashTable<surfaceScalarField*>, fluxes, iter)
{ {
if (!correctFluxes_.found(iter.key())) if (!correctFluxes_.found(iter.key()))
{ {
@ -553,7 +553,7 @@ Foam::dynamicRefineFvMesh::unrefine
<< endl; << endl;
} }
surfaceScalarField& phi = const_cast<surfaceScalarField&>(*iter()); surfaceScalarField& phi = *iter();
surfaceScalarField::GeometricBoundaryField& bphi = surfaceScalarField::GeometricBoundaryField& bphi =
phi.boundaryField(); phi.boundaryField();

View File

@ -66,7 +66,7 @@ void Foam::fvMeshDistribute::saveBoundaryFields
HashTable<const fldType*> flds HashTable<const fldType*> flds
( (
mesh_.objectRegistry::lookupClass<fldType>() static_cast<const fvMesh&>(mesh_).objectRegistry::lookupClass<fldType>()
); );
bflds.setSize(flds.size()); bflds.setSize(flds.size());
@ -97,7 +97,7 @@ void Foam::fvMeshDistribute::mapBoundaryFields
typedef GeometricField<T, fvsPatchField, Mesh> fldType; typedef GeometricField<T, fvsPatchField, Mesh> fldType;
HashTable<const fldType*> flds HashTable<fldType*> flds
( (
mesh_.objectRegistry::lookupClass<fldType>() mesh_.objectRegistry::lookupClass<fldType>()
); );
@ -110,15 +110,11 @@ void Foam::fvMeshDistribute::mapBoundaryFields
label fieldI = 0; label fieldI = 0;
forAllConstIter(typename HashTable<const fldType*>, flds, iter) forAllIter(typename HashTable<fldType*>, flds, iter)
{ {
const fldType& fld = *iter(); fldType& fld = *iter();
typename fldType::GeometricBoundaryField& bfld = typename fldType::GeometricBoundaryField& bfld =
const_cast<typename fldType::GeometricBoundaryField&> fld.boundaryField();
(
fld.boundaryField()
);
const FieldField<fvsPatchField, T>& oldBfld = oldBflds[fieldI++]; const FieldField<fvsPatchField, T>& oldBfld = oldBflds[fieldI++];
@ -156,20 +152,17 @@ void Foam::fvMeshDistribute::initPatchFields
const typename GeoField::value_type& initVal const typename GeoField::value_type& initVal
) )
{ {
HashTable<const GeoField*> flds HashTable<GeoField*> flds
( (
mesh_.objectRegistry::lookupClass<GeoField>() mesh_.objectRegistry::lookupClass<GeoField>()
); );
forAllConstIter(typename HashTable<const GeoField*>, flds, iter) forAllIter(typename HashTable<GeoField*>, flds, iter)
{ {
const GeoField& fld = *iter(); GeoField& fld = *iter();
typename GeoField::GeometricBoundaryField& bfld = typename GeoField::GeometricBoundaryField& bfld =
const_cast<typename GeoField::GeometricBoundaryField&> fld.boundaryField();
(
fld.boundaryField()
);
forAll(bfld, patchI) forAll(bfld, patchI)
{ {
@ -186,16 +179,15 @@ void Foam::fvMeshDistribute::initPatchFields
template<class GeoField> template<class GeoField>
void Foam::fvMeshDistribute::correctBoundaryConditions() void Foam::fvMeshDistribute::correctBoundaryConditions()
{ {
HashTable<const GeoField*> flds HashTable<GeoField*> flds
( (
mesh_.objectRegistry::lookupClass<GeoField>() mesh_.objectRegistry::lookupClass<GeoField>()
); );
forAllConstIter(typename HashTable<const GeoField*>, flds, iter) forAllIter(typename HashTable<GeoField*>, flds, iter)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
fld.correctBoundaryConditions();
const_cast<GeoField&>(fld).correctBoundaryConditions();
} }
} }

View File

@ -38,20 +38,17 @@ void Foam::fvMeshTools::addPatchFields
const typename GeoField::value_type& defaultPatchValue const typename GeoField::value_type& defaultPatchValue
) )
{ {
HashTable<const GeoField*> flds HashTable<GeoField*> flds
( (
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
forAllConstIter(typename HashTable<const GeoField*>, flds, iter) forAllIter(typename HashTable<GeoField*>, flds, iter)
{ {
const GeoField& fld = *iter(); GeoField& fld = *iter();
typename GeoField::GeometricBoundaryField& bfld = typename GeoField::GeometricBoundaryField& bfld =
const_cast<typename GeoField::GeometricBoundaryField&> fld.boundaryField();
(
fld.boundaryField()
);
label sz = bfld.size(); label sz = bfld.size();
bfld.setSize(sz+1); bfld.setSize(sz+1);
@ -95,20 +92,17 @@ void Foam::fvMeshTools::setPatchFields
const dictionary& patchFieldDict const dictionary& patchFieldDict
) )
{ {
HashTable<const GeoField*> flds HashTable<GeoField*> flds
( (
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
forAllConstIter(typename HashTable<const GeoField*>, flds, iter) forAllIter(typename HashTable<GeoField*>, flds, iter)
{ {
const GeoField& fld = *iter(); GeoField& fld = *iter();
typename GeoField::GeometricBoundaryField& bfld = typename GeoField::GeometricBoundaryField& bfld =
const_cast<typename GeoField::GeometricBoundaryField&> fld.boundaryField();
(
fld.boundaryField()
);
if (patchFieldDict.found(fld.name())) if (patchFieldDict.found(fld.name()))
{ {
@ -137,20 +131,17 @@ void Foam::fvMeshTools::setPatchFields
const typename GeoField::value_type& value const typename GeoField::value_type& value
) )
{ {
HashTable<const GeoField*> flds HashTable<GeoField*> flds
( (
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
forAllConstIter(typename HashTable<const GeoField*>, flds, iter) forAllIter(typename HashTable<GeoField*>, flds, iter)
{ {
const GeoField& fld = *iter(); GeoField& fld = *iter();
typename GeoField::GeometricBoundaryField& bfld = typename GeoField::GeometricBoundaryField& bfld =
const_cast<typename GeoField::GeometricBoundaryField&> fld.boundaryField();
(
fld.boundaryField()
);
bfld[patchI] == value; bfld[patchI] == value;
} }
@ -161,19 +152,15 @@ void Foam::fvMeshTools::setPatchFields
template<class GeoField> template<class GeoField>
void Foam::fvMeshTools::trimPatchFields(fvMesh& mesh, const label nPatches) void Foam::fvMeshTools::trimPatchFields(fvMesh& mesh, const label nPatches)
{ {
HashTable<const GeoField*> flds HashTable<GeoField*> flds
( (
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
forAllConstIter(typename HashTable<const GeoField*>, flds, iter) forAllIter(typename HashTable<GeoField*>, flds, iter)
{ {
const GeoField& fld = *iter(); GeoField& fld = *iter();
fld.boundaryField().setSize(nPatches);
const_cast<typename GeoField::GeometricBoundaryField&>
(
fld.boundaryField()
).setSize(nPatches);
} }
} }
@ -186,20 +173,18 @@ void Foam::fvMeshTools::reorderPatchFields
const labelList& oldToNew const labelList& oldToNew
) )
{ {
HashTable<const GeoField*> flds HashTable<GeoField*> flds
( (
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
forAllConstIter(typename HashTable<const GeoField*>, flds, iter) forAllIter(typename HashTable<GeoField*>, flds, iter)
{ {
const GeoField& fld = *iter(); GeoField& fld = *iter();
typename GeoField::GeometricBoundaryField& bfld = typename GeoField::GeometricBoundaryField& bfld =
const_cast<typename GeoField::GeometricBoundaryField&> fld.boundaryField();
(
fld.boundaryField()
);
bfld.reorder(oldToNew); bfld.reorder(oldToNew);
} }
} }

View File

@ -34,12 +34,12 @@ void Foam::solutionControl::storePrevIter() const
{ {
typedef GeometricField<Type, fvPatchField, volMesh> GeoField; typedef GeometricField<Type, fvPatchField, volMesh> GeoField;
HashTable<const GeoField*> HashTable<GeoField*>
flds(mesh_.objectRegistry::lookupClass<GeoField>()); flds(mesh_.objectRegistry::lookupClass<GeoField>());
forAllConstIter(typename HashTable<const GeoField*>, flds, iter) forAllIter(typename HashTable<GeoField*>, flds, iter)
{ {
GeoField& fld = const_cast<GeoField&>(*iter()); GeoField& fld = *iter();
const word& fName = fld.name(); const word& fName = fld.name();

View File

@ -33,7 +33,7 @@ Foam::fv::LeastSquaresVectors<Stencil>::LeastSquaresVectors
const fvMesh& mesh const fvMesh& mesh
) )
: :
MeshObject<fvMesh, LeastSquaresVectors>(mesh), MeshObject<fvMesh, Foam::MoveableMeshObject, LeastSquaresVectors>(mesh),
vectors_(mesh.nCells()) vectors_(mesh.nCells())
{ {
calcLeastSquaresVectors(); calcLeastSquaresVectors();

View File

@ -58,7 +58,7 @@ namespace fv
template<class Stencil> template<class Stencil>
class LeastSquaresVectors class LeastSquaresVectors
: :
public MeshObject<fvMesh, LeastSquaresVectors<Stencil> > public MeshObject<fvMesh, MoveableMeshObject, LeastSquaresVectors<Stencil> >
{ {
// Private data // Private data
@ -105,7 +105,7 @@ public:
return vectors_; return vectors_;
} }
//- Delete the least square vectors when the mesh moves //- Update the least square vectors when the mesh moves
virtual bool movePoints(); virtual bool movePoints();
}; };

View File

@ -38,7 +38,7 @@ namespace Foam
Foam::leastSquaresVectors::leastSquaresVectors(const fvMesh& mesh) Foam::leastSquaresVectors::leastSquaresVectors(const fvMesh& mesh)
: :
MeshObject<fvMesh, leastSquaresVectors>(mesh), MeshObject<fvMesh, Foam::MoveableMeshObject, leastSquaresVectors>(mesh),
pVectors_ pVectors_
( (
IOobject IOobject

View File

@ -50,7 +50,7 @@ namespace Foam
class leastSquaresVectors class leastSquaresVectors
: :
public MeshObject<fvMesh, leastSquaresVectors> public MeshObject<fvMesh, MoveableMeshObject, leastSquaresVectors>
{ {
// Private data // Private data

View File

@ -48,7 +48,12 @@ namespace Foam
class centredCECCellToCellStencilObject class centredCECCellToCellStencilObject
: :
public MeshObject<fvMesh, centredCECCellToCellStencilObject>, public MeshObject
<
fvMesh,
TopologicalMeshObject,
centredCECCellToCellStencilObject
>,
public extendedCentredCellToCellStencil public extendedCentredCellToCellStencil
{ {
@ -64,7 +69,12 @@ public:
const fvMesh& mesh const fvMesh& mesh
) )
: :
MeshObject<fvMesh, centredCECCellToCellStencilObject>(mesh), MeshObject
<
fvMesh,
Foam::TopologicalMeshObject,
centredCECCellToCellStencilObject
>(mesh),
extendedCentredCellToCellStencil(CECCellToCellStencil(mesh)) extendedCentredCellToCellStencil(CECCellToCellStencil(mesh))
{} {}

View File

@ -48,7 +48,12 @@ namespace Foam
class centredCFCCellToCellStencilObject class centredCFCCellToCellStencilObject
: :
public MeshObject<fvMesh, centredCFCCellToCellStencilObject>, public MeshObject
<
fvMesh,
TopologicalMeshObject,
centredCFCCellToCellStencilObject
>,
public extendedCentredCellToCellStencil public extendedCentredCellToCellStencil
{ {
@ -64,7 +69,12 @@ public:
const fvMesh& mesh const fvMesh& mesh
) )
: :
MeshObject<fvMesh, centredCFCCellToCellStencilObject>(mesh), MeshObject
<
fvMesh,
Foam::TopologicalMeshObject,
centredCFCCellToCellStencilObject
>(mesh),
extendedCentredCellToCellStencil(CFCCellToCellStencil(mesh)) extendedCentredCellToCellStencil(CFCCellToCellStencil(mesh))
{} {}

View File

@ -48,7 +48,12 @@ namespace Foam
class centredCPCCellToCellStencilObject class centredCPCCellToCellStencilObject
: :
public MeshObject<fvMesh, centredCPCCellToCellStencilObject>, public MeshObject
<
fvMesh,
TopologicalMeshObject,
centredCPCCellToCellStencilObject
>,
public extendedCentredCellToCellStencil public extendedCentredCellToCellStencil
{ {
@ -64,7 +69,12 @@ public:
const fvMesh& mesh const fvMesh& mesh
) )
: :
MeshObject<fvMesh, centredCPCCellToCellStencilObject>(mesh), MeshObject
<
fvMesh,
Foam::TopologicalMeshObject,
centredCPCCellToCellStencilObject
>(mesh),
extendedCentredCellToCellStencil(CPCCellToCellStencil(mesh)) extendedCentredCellToCellStencil(CPCCellToCellStencil(mesh))
{} {}

View File

@ -48,7 +48,12 @@ namespace Foam
class centredCECCellToFaceStencilObject class centredCECCellToFaceStencilObject
: :
public MeshObject<fvMesh, centredCECCellToFaceStencilObject>, public MeshObject
<
fvMesh,
TopologicalMeshObject,
centredCECCellToFaceStencilObject
>,
public extendedCentredCellToFaceStencil public extendedCentredCellToFaceStencil
{ {
@ -64,7 +69,12 @@ public:
const fvMesh& mesh const fvMesh& mesh
) )
: :
MeshObject<fvMesh, centredCECCellToFaceStencilObject>(mesh), MeshObject
<
fvMesh,
Foam::TopologicalMeshObject,
centredCECCellToFaceStencilObject
>(mesh),
extendedCentredCellToFaceStencil(CECCellToFaceStencil(mesh)) extendedCentredCellToFaceStencil(CECCellToFaceStencil(mesh))
{ {
if (extendedCellToFaceStencil::debug) if (extendedCellToFaceStencil::debug)

View File

@ -48,7 +48,12 @@ namespace Foam
class centredCFCCellToFaceStencilObject class centredCFCCellToFaceStencilObject
: :
public MeshObject<fvMesh, centredCFCCellToFaceStencilObject>, public MeshObject
<
fvMesh,
TopologicalMeshObject,
centredCFCCellToFaceStencilObject
>,
public extendedCentredCellToFaceStencil public extendedCentredCellToFaceStencil
{ {
@ -64,7 +69,12 @@ public:
const fvMesh& mesh const fvMesh& mesh
) )
: :
MeshObject<fvMesh, centredCFCCellToFaceStencilObject>(mesh), MeshObject
<
fvMesh,
Foam::TopologicalMeshObject,
centredCFCCellToFaceStencilObject
>(mesh),
extendedCentredCellToFaceStencil(CFCCellToFaceStencil(mesh)) extendedCentredCellToFaceStencil(CFCCellToFaceStencil(mesh))
{ {
if (extendedCellToFaceStencil::debug) if (extendedCellToFaceStencil::debug)

View File

@ -48,7 +48,12 @@ namespace Foam
class centredCPCCellToFaceStencilObject class centredCPCCellToFaceStencilObject
: :
public MeshObject<fvMesh, centredCPCCellToFaceStencilObject>, public MeshObject
<
fvMesh,
TopologicalMeshObject,
centredCPCCellToFaceStencilObject
>,
public extendedCentredCellToFaceStencil public extendedCentredCellToFaceStencil
{ {
@ -64,7 +69,12 @@ public:
const fvMesh& mesh const fvMesh& mesh
) )
: :
MeshObject<fvMesh, centredCPCCellToFaceStencilObject>(mesh), MeshObject
<
fvMesh,
Foam::TopologicalMeshObject,
centredCPCCellToFaceStencilObject
>(mesh),
extendedCentredCellToFaceStencil(CPCCellToFaceStencil(mesh)) extendedCentredCellToFaceStencil(CPCCellToFaceStencil(mesh))
{ {
if (extendedCellToFaceStencil::debug) if (extendedCellToFaceStencil::debug)

View File

@ -48,7 +48,12 @@ namespace Foam
class centredFECCellToFaceStencilObject class centredFECCellToFaceStencilObject
: :
public MeshObject<fvMesh, centredFECCellToFaceStencilObject>, public MeshObject
<
fvMesh,
TopologicalMeshObject,
centredFECCellToFaceStencilObject
>,
public extendedCentredCellToFaceStencil public extendedCentredCellToFaceStencil
{ {
@ -64,7 +69,12 @@ public:
const fvMesh& mesh const fvMesh& mesh
) )
: :
MeshObject<fvMesh, centredFECCellToFaceStencilObject>(mesh), MeshObject
<
fvMesh,
Foam::TopologicalMeshObject,
centredFECCellToFaceStencilObject
>(mesh),
extendedCentredCellToFaceStencil(FECCellToFaceStencil(mesh)) extendedCentredCellToFaceStencil(FECCellToFaceStencil(mesh))
{ {
if (extendedCellToFaceStencil::debug) if (extendedCellToFaceStencil::debug)

View File

@ -48,7 +48,12 @@ namespace Foam
class pureUpwindCFCCellToFaceStencilObject class pureUpwindCFCCellToFaceStencilObject
: :
public MeshObject<fvMesh, pureUpwindCFCCellToFaceStencilObject>, public MeshObject
<
fvMesh,
TopologicalMeshObject,
pureUpwindCFCCellToFaceStencilObject
>,
public extendedUpwindCellToFaceStencil public extendedUpwindCellToFaceStencil
{ {
@ -64,7 +69,12 @@ public:
const fvMesh& mesh const fvMesh& mesh
) )
: :
MeshObject<fvMesh, pureUpwindCFCCellToFaceStencilObject>(mesh), MeshObject
<
fvMesh,
Foam::TopologicalMeshObject,
pureUpwindCFCCellToFaceStencilObject
>(mesh),
extendedUpwindCellToFaceStencil(CFCCellToFaceStencil(mesh)) extendedUpwindCellToFaceStencil(CFCCellToFaceStencil(mesh))
{ {
if (extendedCellToFaceStencil::debug) if (extendedCellToFaceStencil::debug)

View File

@ -48,7 +48,12 @@ namespace Foam
class upwindCECCellToFaceStencilObject class upwindCECCellToFaceStencilObject
: :
public MeshObject<fvMesh, upwindCECCellToFaceStencilObject>, public MeshObject
<
fvMesh,
TopologicalMeshObject,
upwindCECCellToFaceStencilObject
>,
public extendedUpwindCellToFaceStencil public extendedUpwindCellToFaceStencil
{ {
@ -66,7 +71,12 @@ public:
const scalar minOpposedness const scalar minOpposedness
) )
: :
MeshObject<fvMesh, upwindCECCellToFaceStencilObject>(mesh), MeshObject
<
fvMesh,
Foam::TopologicalMeshObject,
upwindCECCellToFaceStencilObject
>(mesh),
extendedUpwindCellToFaceStencil extendedUpwindCellToFaceStencil
( (
CECCellToFaceStencil(mesh), CECCellToFaceStencil(mesh),

View File

@ -48,7 +48,12 @@ namespace Foam
class upwindCFCCellToFaceStencilObject class upwindCFCCellToFaceStencilObject
: :
public MeshObject<fvMesh, upwindCFCCellToFaceStencilObject>, public MeshObject
<
fvMesh,
TopologicalMeshObject,
upwindCFCCellToFaceStencilObject
>,
public extendedUpwindCellToFaceStencil public extendedUpwindCellToFaceStencil
{ {
@ -66,7 +71,12 @@ public:
const scalar minOpposedness const scalar minOpposedness
) )
: :
MeshObject<fvMesh, upwindCFCCellToFaceStencilObject>(mesh), MeshObject
<
fvMesh,
Foam::TopologicalMeshObject,
upwindCFCCellToFaceStencilObject
>(mesh),
extendedUpwindCellToFaceStencil extendedUpwindCellToFaceStencil
( (
CFCCellToFaceStencil(mesh), CFCCellToFaceStencil(mesh),

View File

@ -48,7 +48,12 @@ namespace Foam
class upwindCPCCellToFaceStencilObject class upwindCPCCellToFaceStencilObject
: :
public MeshObject<fvMesh, upwindCPCCellToFaceStencilObject>, public MeshObject
<
fvMesh,
TopologicalMeshObject,
upwindCPCCellToFaceStencilObject
>,
public extendedUpwindCellToFaceStencil public extendedUpwindCellToFaceStencil
{ {
@ -66,7 +71,12 @@ public:
const scalar minOpposedness const scalar minOpposedness
) )
: :
MeshObject<fvMesh, upwindCPCCellToFaceStencilObject>(mesh), MeshObject
<
fvMesh,
Foam::TopologicalMeshObject,
upwindCPCCellToFaceStencilObject
>(mesh),
extendedUpwindCellToFaceStencil extendedUpwindCellToFaceStencil
( (
CPCCellToFaceStencil(mesh), CPCCellToFaceStencil(mesh),

View File

@ -48,7 +48,12 @@ namespace Foam
class upwindFECCellToFaceStencilObject class upwindFECCellToFaceStencilObject
: :
public MeshObject<fvMesh, upwindFECCellToFaceStencilObject>, public MeshObject
<
fvMesh,
TopologicalMeshObject,
upwindFECCellToFaceStencilObject
>,
public extendedUpwindCellToFaceStencil public extendedUpwindCellToFaceStencil
{ {
@ -66,7 +71,12 @@ public:
const scalar minOpposedness const scalar minOpposedness
) )
: :
MeshObject<fvMesh, upwindFECCellToFaceStencilObject>(mesh), MeshObject
<
fvMesh,
Foam::TopologicalMeshObject,
upwindFECCellToFaceStencilObject
>(mesh),
extendedUpwindCellToFaceStencil extendedUpwindCellToFaceStencil
( (
FECCellToFaceStencil(mesh), FECCellToFaceStencil(mesh),

View File

@ -48,7 +48,12 @@ namespace Foam
class centredCFCFaceToCellStencilObject class centredCFCFaceToCellStencilObject
: :
public MeshObject<fvMesh, centredCFCFaceToCellStencilObject>, public MeshObject
<
fvMesh,
TopologicalMeshObject,
centredCFCFaceToCellStencilObject
>,
public extendedCentredFaceToCellStencil public extendedCentredFaceToCellStencil
{ {
@ -64,7 +69,12 @@ public:
const fvMesh& mesh const fvMesh& mesh
) )
: :
MeshObject<fvMesh, centredCFCFaceToCellStencilObject>(mesh), MeshObject
<
fvMesh,
Foam::TopologicalMeshObject,
centredCFCFaceToCellStencilObject
>(mesh),
extendedCentredFaceToCellStencil(CFCFaceToCellStencil(mesh)) extendedCentredFaceToCellStencil(CFCFaceToCellStencil(mesh))
{} {}

View File

@ -31,39 +31,17 @@ License
#include "SubField.H" #include "SubField.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"
#include "fvMeshLduAddressing.H" #include "fvMeshLduAddressing.H"
#include "emptyPolyPatch.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "MapFvFields.H" #include "MapFvFields.H"
#include "fvMeshMapper.H" #include "fvMeshMapper.H"
#include "mapClouds.H" #include "mapClouds.H"
#include "MeshObject.H"
#include "volPointInterpolation.H"
#include "leastSquaresVectors.H"
#include "CentredFitData.H"
#include "linearFitPolynomial.H"
#include "quadraticFitPolynomial.H"
#include "quadraticLinearFitPolynomial.H"
#include "skewCorrectionVectors.H"
#include "centredCECCellToFaceStencilObject.H"
#include "centredCFCCellToFaceStencilObject.H"
#include "centredCPCCellToFaceStencilObject.H"
#include "centredFECCellToFaceStencilObject.H"
#include "upwindCECCellToFaceStencilObject.H"
#include "upwindCFCCellToFaceStencilObject.H"
#include "upwindCPCCellToFaceStencilObject.H"
#include "upwindFECCellToFaceStencilObject.H"
#include "centredCFCFaceToCellStencilObject.H"
#include "meshSearchMeshObject.H"
#include "meshSearchFACECENTRETETSMeshObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(fvMesh, 0); defineTypeNameAndDebug(fvMesh, 0);
} }
@ -71,6 +49,8 @@ defineTypeNameAndDebug(fvMesh, 0);
void Foam::fvMesh::clearGeomNotOldVol() void Foam::fvMesh::clearGeomNotOldVol()
{ {
meshObject::clear<fvMesh, GeometricMeshObject>(*this);
slicedVolScalarField::DimensionedInternalField* VPtr = slicedVolScalarField::DimensionedInternalField* VPtr =
static_cast<slicedVolScalarField::DimensionedInternalField*>(VPtr_); static_cast<slicedVolScalarField::DimensionedInternalField*>(VPtr_);
deleteDemandDrivenData(VPtr); deleteDemandDrivenData(VPtr);
@ -126,51 +106,13 @@ void Foam::fvMesh::clearGeom()
// Mesh motion flux cannot be deleted here because the old-time flux // Mesh motion flux cannot be deleted here because the old-time flux
// needs to be saved. // needs to be saved.
// Things geometry dependent that are not updated.
volPointInterpolation::Delete(*this);
leastSquaresVectors::Delete(*this);
CentredFitData<linearFitPolynomial>::Delete(*this);
CentredFitData<quadraticFitPolynomial>::Delete(*this);
CentredFitData<quadraticLinearFitPolynomial>::Delete(*this);
skewCorrectionVectors::Delete(*this);
// Note: should be in polyMesh::clearGeom but meshSearch not in OpenFOAM
// library
meshSearchMeshObject::Delete(*this);
meshSearchFACECENTRETETSMeshObject::Delete(*this);
} }
void Foam::fvMesh::clearAddressing() void Foam::fvMesh::clearAddressing()
{ {
meshObject::clear<fvMesh, TopologicalMeshObject>(*this);
deleteDemandDrivenData(lduPtr_); deleteDemandDrivenData(lduPtr_);
// Hack until proper callbacks. Below are all the fvMesh-MeshObjects.
volPointInterpolation::Delete(*this);
leastSquaresVectors::Delete(*this);
CentredFitData<linearFitPolynomial>::Delete(*this);
CentredFitData<quadraticFitPolynomial>::Delete(*this);
CentredFitData<quadraticLinearFitPolynomial>::Delete(*this);
skewCorrectionVectors::Delete(*this);
centredCECCellToFaceStencilObject::Delete(*this);
centredCFCCellToFaceStencilObject::Delete(*this);
centredCPCCellToFaceStencilObject::Delete(*this);
centredFECCellToFaceStencilObject::Delete(*this);
// Is this geometry related - cells distorting to upwind direction?
upwindCECCellToFaceStencilObject::Delete(*this);
upwindCFCCellToFaceStencilObject::Delete(*this);
upwindCPCCellToFaceStencilObject::Delete(*this);
upwindFECCellToFaceStencilObject::Delete(*this);
centredCFCFaceToCellStencilObject::Delete(*this);
// Note: should be in polyMesh::clearGeom but meshSearch not in OpenFOAM
// library
meshSearchMeshObject::Delete(*this);
meshSearchFACECENTRETETSMeshObject::Delete(*this);
} }
@ -596,24 +538,6 @@ void Foam::fvMesh::mapFields(const mapPolyMesh& meshMap)
} }
// Temporary helper function to call move points on
// MeshObjects
template<class Type>
void MeshObjectMovePoints(const Foam::fvMesh& mesh)
{
if (mesh.thisDb().foundObject<Type>(Type::typeName))
{
const_cast<Type&>
(
mesh.thisDb().lookupObject<Type>
(
Type::typeName
)
).movePoints();
}
}
Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p) Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
{ {
// Grab old time volumes if the time has been incremented // Grab old time volumes if the time has been incremented
@ -707,15 +631,7 @@ Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
boundary_.movePoints(); boundary_.movePoints();
surfaceInterpolation::movePoints(); surfaceInterpolation::movePoints();
meshObject::movePoints<fvMesh>(*this);
// Hack until proper callbacks. Below are all the fvMesh MeshObjects with a
// movePoints function.
MeshObjectMovePoints<volPointInterpolation>(*this);
MeshObjectMovePoints<leastSquaresVectors>(*this);
MeshObjectMovePoints<CentredFitData<linearFitPolynomial> >(*this);
MeshObjectMovePoints<CentredFitData<quadraticFitPolynomial> >(*this);
MeshObjectMovePoints<CentredFitData<quadraticLinearFitPolynomial> >(*this);
MeshObjectMovePoints<skewCorrectionVectors>(*this);
return tsweptVols; return tsweptVols;
} }
@ -737,9 +653,7 @@ void Foam::fvMesh::updateMesh(const mapPolyMesh& mpm)
clearAddressing(); clearAddressing();
// handleMorph() should also clear out the surfaceInterpolation. meshObject::updateMesh<fvMesh>(*this, mpm);
// This is a temporary solution
surfaceInterpolation::movePoints();
} }

View File

@ -40,7 +40,7 @@ Foam::FitData<Form, ExtendedStencil, Polynomial>::FitData
const scalar centralWeight const scalar centralWeight
) )
: :
MeshObject<fvMesh, Form>(mesh), MeshObject<fvMesh, Foam::MoveableMeshObject, Form>(mesh),
stencil_(stencil), stencil_(stencil),
linearCorrection_(linearCorrection), linearCorrection_(linearCorrection),
linearLimitFactor_(linearLimitFactor), linearLimitFactor_(linearLimitFactor),

View File

@ -54,7 +54,7 @@ namespace Foam
template<class FitDataType, class ExtendedStencil, class Polynomial> template<class FitDataType, class ExtendedStencil, class Polynomial>
class FitData class FitData
: :
public MeshObject<fvMesh, FitDataType> public MeshObject<fvMesh, MoveableMeshObject, FitDataType>
{ {
// Private data // Private data

View File

@ -38,7 +38,7 @@ namespace Foam
Foam::skewCorrectionVectors::skewCorrectionVectors(const fvMesh& mesh) Foam::skewCorrectionVectors::skewCorrectionVectors(const fvMesh& mesh)
: :
MeshObject<fvMesh, skewCorrectionVectors>(mesh), MeshObject<fvMesh, Foam::MoveableMeshObject, skewCorrectionVectors>(mesh),
skew_(false), skew_(false),
skewCorrectionVectors_ skewCorrectionVectors_
( (

View File

@ -52,7 +52,7 @@ class fvMesh;
class skewCorrectionVectors class skewCorrectionVectors
: :
public MeshObject<fvMesh, skewCorrectionVectors> public MeshObject<fvMesh, MoveableMeshObject, skewCorrectionVectors>
{ {
// Private data // Private data

View File

@ -612,9 +612,10 @@ void volPointInterpolation::makePatchPatchAddressing()
volPointInterpolation::volPointInterpolation(const fvMesh& vm) volPointInterpolation::volPointInterpolation(const fvMesh& vm)
: :
MeshObject<fvMesh, volPointInterpolation>(vm) MeshObject<fvMesh, Foam::UpdateableMeshObject, volPointInterpolation>(vm)
{ {
updateMesh(); makeWeights();
makePatchPatchAddressing();
} }
@ -626,7 +627,7 @@ volPointInterpolation::~volPointInterpolation()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void volPointInterpolation::updateMesh() void volPointInterpolation::updateMesh(const mapPolyMesh&)
{ {
makeWeights(); makeWeights();
makePatchPatchAddressing(); makePatchPatchAddressing();

View File

@ -56,7 +56,7 @@ class pointMesh;
class volPointInterpolation class volPointInterpolation
: :
public MeshObject<fvMesh, volPointInterpolation> public MeshObject<fvMesh, UpdateableMeshObject, volPointInterpolation>
{ {
// Private data // Private data
@ -174,7 +174,7 @@ public:
// Edit // Edit
//- Update mesh topology using the morph engine //- Update mesh topology using the morph engine
void updateMesh(); void updateMesh(const mapPolyMesh&);
//- Correct weighting factors for moving mesh. //- Correct weighting factors for moving mesh.
bool movePoints(); bool movePoints();

View File

@ -120,20 +120,15 @@ void meshRefinement::testSyncBoundaryFaceList
template<class GeoField> template<class GeoField>
void meshRefinement::addPatchFields(fvMesh& mesh, const word& patchFieldType) void meshRefinement::addPatchFields(fvMesh& mesh, const word& patchFieldType)
{ {
HashTable<const GeoField*> flds HashTable<GeoField*> flds
( (
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
forAllConstIter(typename HashTable<const GeoField*>, flds, iter) forAllIter(typename HashTable<GeoField*>, flds, iter)
{ {
const GeoField& fld = *iter(); GeoField& fld = *iter();
typename GeoField::GeometricBoundaryField& bfld = fld.boundaryField();
typename GeoField::GeometricBoundaryField& bfld =
const_cast<typename GeoField::GeometricBoundaryField&>
(
fld.boundaryField()
);
label sz = bfld.size(); label sz = bfld.size();
bfld.setSize(sz+1); bfld.setSize(sz+1);
@ -155,28 +150,21 @@ void meshRefinement::addPatchFields(fvMesh& mesh, const word& patchFieldType)
template<class GeoField> template<class GeoField>
void meshRefinement::reorderPatchFields(fvMesh& mesh, const labelList& oldToNew) void meshRefinement::reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
{ {
HashTable<const GeoField*> flds HashTable<GeoField*> flds
( (
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
forAllConstIter(typename HashTable<const GeoField*>, flds, iter) forAllIter(typename HashTable<GeoField*>, flds, iter)
{ {
const GeoField& fld = *iter(); GeoField& fld = *iter();
typename GeoField::GeometricBoundaryField& bfld = fld.boundaryField();
typename GeoField::GeometricBoundaryField& bfld =
const_cast<typename GeoField::GeometricBoundaryField&>
(
fld.boundaryField()
);
bfld.reorder(oldToNew); bfld.reorder(oldToNew);
} }
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -40,7 +40,12 @@ Foam::meshSearchFACECENTRETETSMeshObject::meshSearchFACECENTRETETSMeshObject
const polyMesh& mesh const polyMesh& mesh
) )
: :
MeshObject<polyMesh, meshSearchFACECENTRETETSMeshObject>(mesh), MeshObject
<
polyMesh,
Foam::GeometricMeshObject,
meshSearchFACECENTRETETSMeshObject
>(mesh),
meshSearch(mesh, polyMesh::FACECENTRETETS) meshSearch(mesh, polyMesh::FACECENTRETETS)
{} {}

View File

@ -48,7 +48,12 @@ namespace Foam
class meshSearchFACECENTRETETSMeshObject class meshSearchFACECENTRETETSMeshObject
: :
public MeshObject<polyMesh, meshSearchFACECENTRETETSMeshObject>, public MeshObject
<
polyMesh,
GeometricMeshObject,
meshSearchFACECENTRETETSMeshObject
>,
public meshSearch public meshSearch
{ {
@ -66,18 +71,6 @@ public:
//- Destructor //- Destructor
virtual ~meshSearchFACECENTRETETSMeshObject() virtual ~meshSearchFACECENTRETETSMeshObject()
{} {}
//
// // Member functions
//
// // Edit
//
// //- Update mesh topology using the morph engine
// void updateMesh();
//
// //- Correct weighting factors for moving mesh.
// bool movePoints();
//
}; };

View File

@ -37,7 +37,7 @@ namespace Foam
Foam::meshSearchMeshObject::meshSearchMeshObject(const polyMesh& mesh) Foam::meshSearchMeshObject::meshSearchMeshObject(const polyMesh& mesh)
: :
MeshObject<polyMesh, meshSearchMeshObject>(mesh), MeshObject<polyMesh, Foam::GeometricMeshObject, meshSearchMeshObject>(mesh),
meshSearch(mesh) meshSearch(mesh)
{} {}

View File

@ -48,7 +48,7 @@ namespace Foam
class meshSearchMeshObject class meshSearchMeshObject
: :
public MeshObject<polyMesh, meshSearchMeshObject>, public MeshObject<polyMesh, GeometricMeshObject, meshSearchMeshObject>,
public meshSearch public meshSearch
{ {
@ -66,18 +66,6 @@ public:
//- Destructor //- Destructor
virtual ~meshSearchMeshObject() virtual ~meshSearchMeshObject()
{} {}
//
// // Member functions
//
// // Edit
//
// //- Update mesh topology using the morph engine
// void updateMesh();
//
// //- Correct weighting factors for moving mesh.
// bool movePoints();
//
}; };

View File

@ -692,7 +692,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
Foam::regionSplit::regionSplit(const polyMesh& mesh) Foam::regionSplit::regionSplit(const polyMesh& mesh)
: :
MeshObject<polyMesh, regionSplit>(mesh), MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
labelList(mesh.nCells(), -1) labelList(mesh.nCells(), -1)
{ {
globalNumberingPtr_ = calcRegionSplit globalNumberingPtr_ = calcRegionSplit
@ -710,7 +710,7 @@ Foam::regionSplit::regionSplit
const boolList& blockedFace const boolList& blockedFace
) )
: :
MeshObject<polyMesh, regionSplit>(mesh), MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
labelList(mesh.nCells(), -1) labelList(mesh.nCells(), -1)
{ {
globalNumberingPtr_ = calcRegionSplit globalNumberingPtr_ = calcRegionSplit
@ -729,7 +729,7 @@ Foam::regionSplit::regionSplit
const List<labelPair>& explicitConnections const List<labelPair>& explicitConnections
) )
: :
MeshObject<polyMesh, regionSplit>(mesh), MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
labelList(mesh.nCells(), -1) labelList(mesh.nCells(), -1)
{ {
globalNumberingPtr_ = calcRegionSplit globalNumberingPtr_ = calcRegionSplit

View File

@ -113,7 +113,7 @@ class polyMesh;
class regionSplit class regionSplit
: :
public MeshObject<polyMesh, regionSplit>, public MeshObject<polyMesh, TopologicalMeshObject, regionSplit>,
public labelList public labelList
{ {
// Private data // Private data

View File

@ -88,22 +88,20 @@ void Foam::distributedTriSurfaceMesh::distributeFields
{ {
typedef DimensionedField<Type, triSurfaceGeoMesh> DimensionedSurfField; typedef DimensionedField<Type, triSurfaceGeoMesh> DimensionedSurfField;
HashTable<const DimensionedSurfField*> fields HashTable<DimensionedSurfField*> fields
( (
objectRegistry::lookupClass objectRegistry::lookupClass<DimensionedSurfField>()
<DimensionedSurfField >()
); );
for for
( (
typename HashTable<const DimensionedSurfField*>::iterator fieldIter = typename HashTable<DimensionedSurfField*>::iterator fieldIter =
fields.begin(); fields.begin();
fieldIter != fields.end(); fieldIter != fields.end();
++fieldIter ++fieldIter
) )
{ {
DimensionedSurfField& field = DimensionedSurfField& field = *fieldIter();
const_cast<DimensionedSurfField&>(*fieldIter());
label oldSize = field.size(); label oldSize = field.size();

View File

@ -37,7 +37,15 @@ namespace Foam
Foam::SLGThermo::SLGThermo(const fvMesh& mesh, fluidThermo& thermo) Foam::SLGThermo::SLGThermo(const fvMesh& mesh, fluidThermo& thermo)
: :
MeshObject<fvMesh, SLGThermo>(mesh), regIOobject
(
IOobject
(
SLGThermo::typeName,
mesh.polyMesh::instance(),
mesh
)
),
thermo_(thermo), thermo_(thermo),
carrier_(NULL), carrier_(NULL),
liquids_(NULL), liquids_(NULL),
@ -246,4 +254,3 @@ bool Foam::SLGThermo::hasSolids() const
// ************************************************************************* // // ************************************************************************* //

View File

@ -45,7 +45,7 @@ SourceFiles
#ifndef SLGThermo_H #ifndef SLGThermo_H
#define SLGThermo_H #define SLGThermo_H
#include "MeshObject.H" #include "regIOobject.H"
#include "fluidThermo.H" #include "fluidThermo.H"
#include "basicMultiComponentMixture.H" #include "basicMultiComponentMixture.H"
#include "liquidMixtureProperties.H" #include "liquidMixtureProperties.H"
@ -62,7 +62,7 @@ namespace Foam
class SLGThermo class SLGThermo
: :
public MeshObject<fvMesh, SLGThermo> public regIOobject
{ {
// Private data // Private data
@ -145,6 +145,14 @@ public:
//- Thermo database has solid components flag //- Thermo database has solid components flag
bool hasSolids() const; bool hasSolids() const;
// IO
bool writeData(Foam::Ostream&) const
{
return true;
}
}; };