From 0afb3ab1ac9226244935e96c6b9c3d47724e815d Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Tue, 26 Feb 2013 22:19:28 +0000 Subject: [PATCH] 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 --- .../db/objectRegistry/objectRegistry.H | 4 + .../objectRegistry/objectRegistryTemplates.C | 28 ++++ .../GAMGAgglomeration/GAMGAgglomeration.C | 2 +- .../GAMGAgglomeration/GAMGAgglomeration.H | 2 +- src/OpenFOAM/meshes/MeshObject/MeshObject.C | 125 ++++++++++---- src/OpenFOAM/meshes/MeshObject/MeshObject.H | 157 +++++++++++++++++- src/OpenFOAM/meshes/pointMesh/pointMesh.C | 8 +- src/OpenFOAM/meshes/pointMesh/pointMesh.H | 4 +- src/OpenFOAM/meshes/polyMesh/polyMesh.C | 30 +--- src/OpenFOAM/meshes/polyMesh/polyMeshClear.C | 12 +- src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C | 17 +- .../dynamicRefineFvMesh/dynamicRefineFvMesh.C | 12 +- .../fvMeshDistributeTemplates.C | 32 ++-- .../fvMeshTools/fvMeshToolsTemplates.C | 57 +++---- .../solutionControlTemplates.C | 6 +- .../LeastSquaresGrad/LeastSquaresVectors.C | 2 +- .../LeastSquaresGrad/LeastSquaresVectors.H | 4 +- .../leastSquaresGrad/leastSquaresVectors.C | 2 +- .../leastSquaresGrad/leastSquaresVectors.H | 2 +- .../centredCECCellToCellStencilObject.H | 14 +- .../centredCFCCellToCellStencilObject.H | 14 +- .../centredCPCCellToCellStencilObject.H | 14 +- .../centredCECCellToFaceStencilObject.H | 14 +- .../centredCFCCellToFaceStencilObject.H | 14 +- .../centredCPCCellToFaceStencilObject.H | 14 +- .../centredFECCellToFaceStencilObject.H | 14 +- .../pureUpwindCFCCellToFaceStencilObject.H | 14 +- .../upwindCECCellToFaceStencilObject.H | 14 +- .../upwindCFCCellToFaceStencilObject.H | 14 +- .../upwindCPCCellToFaceStencilObject.H | 14 +- .../upwindFECCellToFaceStencilObject.H | 14 +- .../centredCFCFaceToCellStencilObject.H | 14 +- src/finiteVolume/fvMesh/fvMesh.C | 100 +---------- .../schemes/FitData/FitData.C | 2 +- .../schemes/FitData/FitData.H | 2 +- .../skewCorrected/skewCorrectionVectors.C | 2 +- .../skewCorrected/skewCorrectionVectors.H | 2 +- .../volPointInterpolation.C | 7 +- .../volPointInterpolation.H | 4 +- .../meshRefinement/meshRefinementTemplates.C | 28 +--- .../meshSearchFACECENTRETETSMeshObject.C | 7 +- .../meshSearchFACECENTRETETSMeshObject.H | 19 +-- .../meshSearch/meshSearchMeshObject.C | 2 +- .../meshSearch/meshSearchMeshObject.H | 14 +- src/meshTools/regionSplit/regionSplit.C | 6 +- src/meshTools/regionSplit/regionSplit.H | 2 +- .../distributedTriSurfaceMeshTemplates.C | 10 +- .../SLGThermo/SLGThermo/SLGThermo.C | 11 +- .../SLGThermo/SLGThermo/SLGThermo.H | 12 +- 49 files changed, 567 insertions(+), 351 deletions(-) diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.H b/src/OpenFOAM/db/objectRegistry/objectRegistry.H index 84b295c4d74..d1973aab598 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.H +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.H @@ -159,6 +159,10 @@ public: template<class Type> 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? template<class Type> bool foundObject(const word& name) const; diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C index 960605e049d..6a1e4a9a242 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C @@ -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> bool Foam::objectRegistry::foundObject(const word& name) const { diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C index 51421910c27..de2b6ffd3bb 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C @@ -70,7 +70,7 @@ Foam::GAMGAgglomeration::GAMGAgglomeration const dictionary& controlDict ) : - MeshObject<lduMesh, GAMGAgglomeration>(mesh), + MeshObject<lduMesh, Foam::TopologicalMeshObject, GAMGAgglomeration>(mesh), maxLevels_(50), diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H index e35cdd379f5..b3081246105 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H @@ -58,7 +58,7 @@ class lduMatrix; class GAMGAgglomeration : - public MeshObject<lduMesh, GAMGAgglomeration> + public MeshObject<lduMesh, TopologicalMeshObject, GAMGAgglomeration> { protected: diff --git a/src/OpenFOAM/meshes/MeshObject/MeshObject.C b/src/OpenFOAM/meshes/MeshObject/MeshObject.C index eed1d7aad8d..8f25049242a 100644 --- a/src/OpenFOAM/meshes/MeshObject/MeshObject.C +++ b/src/OpenFOAM/meshes/MeshObject/MeshObject.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,26 +28,18 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template<class Mesh, class Type> -Foam::MeshObject<Mesh, Type>::MeshObject(const Mesh& mesh) +template<class Mesh, template<class> class MeshObjectType, class Type> +Foam::MeshObject<Mesh, MeshObjectType, Type>::MeshObject(const Mesh& mesh) : - regIOobject - ( - IOobject - ( - Type::typeName, - mesh.thisDb().instance(), - mesh.thisDb() - ) - ), + MeshObjectType<Mesh>(Type::typeName, mesh.thisDb()), mesh_(mesh) {} // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // -template<class Mesh, class Type> -const Type& Foam::MeshObject<Mesh, Type>::New +template<class Mesh, template<class> class MeshObjectType, class Type> +const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New ( const Mesh& mesh ) @@ -67,14 +59,14 @@ const Type& Foam::MeshObject<Mesh, Type>::New } 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> -const Type& Foam::MeshObject<Mesh, Type>::New +const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New ( const Mesh& mesh, const Data1& d @@ -95,14 +87,14 @@ const Type& Foam::MeshObject<Mesh, Type>::New } 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> -const Type& Foam::MeshObject<Mesh, Type>::New +const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New ( const Mesh& mesh, const Data1& d1, @@ -124,14 +116,14 @@ const Type& Foam::MeshObject<Mesh, Type>::New } 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> -const Type& Foam::MeshObject<Mesh, Type>::New +const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New ( const Mesh& mesh, const Data1& d1, @@ -154,14 +146,14 @@ const Type& Foam::MeshObject<Mesh, Type>::New } 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> -const Type& Foam::MeshObject<Mesh, Type>::New +const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New ( const Mesh& mesh, const Data1& d1, @@ -185,15 +177,15 @@ const Type& Foam::MeshObject<Mesh, Type>::New } else { - return store(new Type(mesh, d1, d2, d3, d4)); + return regIOobject::store(new Type(mesh, d1, d2, d3, d4)); } } // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // -template<class Mesh, class Type> -bool Foam::MeshObject<Mesh, Type>::Delete(const Mesh& mesh) +template<class Mesh, template<class> class MeshObjectType, class Type> +bool Foam::MeshObject<Mesh, MeshObjectType, Type>::Delete(const Mesh& mesh) { if ( @@ -221,10 +213,79 @@ bool Foam::MeshObject<Mesh, Type>::Delete(const Mesh& mesh) } -template<class Mesh, class Type> -Foam::MeshObject<Mesh, Type>::~MeshObject() +template<class Mesh, template<class> class MeshObjectType, class Type> +Foam::MeshObject<Mesh, MeshObjectType, Type>::~MeshObject() +{ + MeshObjectType<Mesh>::release(); +} + + +template<class Mesh> +void Foam::meshObject::movePoints(objectRegistry& obr) { - release(); + 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()); + } } diff --git a/src/OpenFOAM/meshes/MeshObject/MeshObject.H b/src/OpenFOAM/meshes/MeshObject/MeshObject.H index 95cf9daf2ce..8efa89f944e 100644 --- a/src/OpenFOAM/meshes/MeshObject/MeshObject.H +++ b/src/OpenFOAM/meshes/MeshObject/MeshObject.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,9 +25,36 @@ Class Foam::MeshObject 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. + 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 MeshObject.C @@ -37,21 +64,24 @@ SourceFiles #define MeshObject_H #include "regIOobject.H" +#include "objectRegistry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +// Forward declarations +class mapPolyMesh; + /*---------------------------------------------------------------------------*\ - Class MeshObject Declaration + Class MeshObject Declaration \*---------------------------------------------------------------------------*/ - -template<class Mesh, class Type> +template<class Mesh, template<class> class MeshObjectType, class Type> class MeshObject : - public regIOobject + public MeshObjectType<Mesh> { 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 diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.C b/src/OpenFOAM/meshes/pointMesh/pointMesh.C index f378a5d7802..b92d5f85522 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMesh.C +++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.C @@ -72,7 +72,7 @@ void Foam::pointMesh::mapFields(const mapPolyMesh& mpm) Foam::pointMesh::pointMesh(const polyMesh& pMesh) : - MeshObject<polyMesh, pointMesh>(pMesh), + MeshObject<polyMesh, Foam::UpdateableMeshObject, pointMesh>(pMesh), GeoMesh<polyMesh>(pMesh), 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) { @@ -96,7 +96,9 @@ void Foam::pointMesh::movePoints(const pointField& newPoints) << "Moving points." << endl; } - boundary_.movePoints(newPoints); + boundary_.movePoints(GeoMesh<polyMesh>::mesh_.points()); + + return true; } diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.H b/src/OpenFOAM/meshes/pointMesh/pointMesh.H index 25e8af95304..80ed113140a 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMesh.H +++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.H @@ -48,7 +48,7 @@ namespace Foam class pointMesh : - public MeshObject<polyMesh, pointMesh>, + public MeshObject<polyMesh, UpdateableMeshObject, pointMesh>, public GeoMesh<polyMesh> { // Permanent data @@ -121,7 +121,7 @@ public: // Mesh motion //- Move points, returns volumes swept by faces in motion - void movePoints(const pointField&); + bool movePoints(); //- Update the mesh corresponding to given map void updateMesh(const mapPolyMesh& mpm); diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index 8201254e0b3..c0d74d954f6 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -26,30 +26,24 @@ License #include "polyMesh.H" #include "Time.H" #include "cellIOList.H" -#include "SubList.H" #include "wedgePolyPatch.H" #include "emptyPolyPatch.H" #include "globalMeshData.H" #include "processorPolyPatch.H" -#include "OSspecific.H" #include "polyMeshTetDecomposition.H" #include "indexedOctree.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 * * * * * * * * * * * * * // namespace Foam { -defineTypeNameAndDebug(polyMesh, 0); + defineTypeNameAndDebug(polyMesh, 0); -word polyMesh::defaultRegion = "region0"; -word polyMesh::meshSubDir = "polyMesh"; + word polyMesh::defaultRegion = "region0"; + word polyMesh::meshSubDir = "polyMesh"; } @@ -1162,21 +1156,7 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints geometricD_ = Vector<label>::zero; solutionD_ = Vector<label>::zero; - - // 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_); - } + meshObject::movePoints<polyMesh>(*this); const_cast<Time&>(time()).functionObjects().movePoints(*this); diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C b/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C index 95474da4050..d93b0fca9b3 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C @@ -26,8 +26,7 @@ License #include "polyMesh.H" #include "primitiveMesh.H" #include "globalMeshData.H" -#include "pointMesh.H" -#include "Time.H" +#include "MeshObject.H" #include "indexedOctree.H" #include "treeDataCell.H" @@ -61,6 +60,8 @@ void Foam::polyMesh::clearGeom() << endl; } + meshObject::clear<polyMesh, GeometricMeshObject>(*this); + primitiveMesh::clearGeom(); boundary_.clearGeom(); @@ -101,6 +102,8 @@ void Foam::polyMesh::clearAddressing() << endl; } + meshObject::clear<polyMesh, TopologicalMeshObject>(*this); + primitiveMesh::clearAddressing(); // parallelData depends on the processorPatch ordering so force @@ -118,6 +121,7 @@ void Foam::polyMesh::clearAddressing() // Remove the stored tet base points tetBasePtIsPtr_.clear(); + // Remove the cell tree cellTreePtr_.clear(); } @@ -132,8 +136,6 @@ void Foam::polyMesh::clearPrimitives() owner_.setSize(0); neighbour_.setSize(0); - pointMesh::Delete(*this); - clearedPrimitives_ = true; } @@ -142,8 +144,6 @@ void Foam::polyMesh::clearOut() { clearGeom(); clearAddressing(); - - pointMesh::Delete(*this); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C index aa4d2bb4b5b..b4bbbf188bd 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C @@ -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) geometricD_ = 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); } diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index c8819904ea4..15395343740 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C @@ -302,11 +302,11 @@ Foam::dynamicRefineFvMesh::refine Pout<< "Found " << masterFaces.size() << " split faces " << endl; } - HashTable<const surfaceScalarField*> fluxes + HashTable<surfaceScalarField*> fluxes ( lookupClass<surfaceScalarField>() ); - forAllConstIter(HashTable<const surfaceScalarField*>, fluxes, iter) + forAllIter(HashTable<surfaceScalarField*>, fluxes, iter) { if (!correctFluxes_.found(iter.key())) { @@ -336,7 +336,7 @@ Foam::dynamicRefineFvMesh::refine << endl; } - surfaceScalarField& phi = const_cast<surfaceScalarField&>(*iter()); + surfaceScalarField& phi = *iter(); const surfaceScalarField phiU ( fvc::interpolate @@ -519,11 +519,11 @@ Foam::dynamicRefineFvMesh::unrefine const labelList& reversePointMap = map().reversePointMap(); const labelList& reverseFaceMap = map().reverseFaceMap(); - HashTable<const surfaceScalarField*> fluxes + HashTable<surfaceScalarField*> fluxes ( lookupClass<surfaceScalarField>() ); - forAllConstIter(HashTable<const surfaceScalarField*>, fluxes, iter) + forAllIter(HashTable<surfaceScalarField*>, fluxes, iter) { if (!correctFluxes_.found(iter.key())) { @@ -553,7 +553,7 @@ Foam::dynamicRefineFvMesh::unrefine << endl; } - surfaceScalarField& phi = const_cast<surfaceScalarField&>(*iter()); + surfaceScalarField& phi = *iter(); surfaceScalarField::GeometricBoundaryField& bphi = phi.boundaryField(); diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C index 2c92a072fa3..fbc436ba410 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C @@ -66,7 +66,7 @@ void Foam::fvMeshDistribute::saveBoundaryFields HashTable<const fldType*> flds ( - mesh_.objectRegistry::lookupClass<fldType>() + static_cast<const fvMesh&>(mesh_).objectRegistry::lookupClass<fldType>() ); bflds.setSize(flds.size()); @@ -97,7 +97,7 @@ void Foam::fvMeshDistribute::mapBoundaryFields typedef GeometricField<T, fvsPatchField, Mesh> fldType; - HashTable<const fldType*> flds + HashTable<fldType*> flds ( mesh_.objectRegistry::lookupClass<fldType>() ); @@ -110,15 +110,11 @@ void Foam::fvMeshDistribute::mapBoundaryFields 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 = - const_cast<typename fldType::GeometricBoundaryField&> - ( - fld.boundaryField() - ); - + fld.boundaryField(); const FieldField<fvsPatchField, T>& oldBfld = oldBflds[fieldI++]; @@ -156,20 +152,17 @@ void Foam::fvMeshDistribute::initPatchFields const typename GeoField::value_type& initVal ) { - HashTable<const GeoField*> flds + HashTable<GeoField*> flds ( 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 = - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ); + fld.boundaryField(); forAll(bfld, patchI) { @@ -186,16 +179,15 @@ void Foam::fvMeshDistribute::initPatchFields template<class GeoField> void Foam::fvMeshDistribute::correctBoundaryConditions() { - HashTable<const GeoField*> flds + HashTable<GeoField*> flds ( mesh_.objectRegistry::lookupClass<GeoField>() ); - forAllConstIter(typename HashTable<const GeoField*>, flds, iter) + forAllIter(typename HashTable<GeoField*>, flds, iter) { const GeoField& fld = *iter(); - - const_cast<GeoField&>(fld).correctBoundaryConditions(); + fld.correctBoundaryConditions(); } } diff --git a/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C b/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C index 3e9ca9d0887..29c60905945 100644 --- a/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C +++ b/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C @@ -38,20 +38,17 @@ void Foam::fvMeshTools::addPatchFields const typename GeoField::value_type& defaultPatchValue ) { - HashTable<const GeoField*> flds + HashTable<GeoField*> flds ( 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 = - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ); + fld.boundaryField(); label sz = bfld.size(); bfld.setSize(sz+1); @@ -95,20 +92,17 @@ void Foam::fvMeshTools::setPatchFields const dictionary& patchFieldDict ) { - HashTable<const GeoField*> flds + HashTable<GeoField*> flds ( 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 = - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ); + fld.boundaryField(); if (patchFieldDict.found(fld.name())) { @@ -137,20 +131,17 @@ void Foam::fvMeshTools::setPatchFields const typename GeoField::value_type& value ) { - HashTable<const GeoField*> flds + HashTable<GeoField*> flds ( 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 = - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ); + fld.boundaryField(); bfld[patchI] == value; } @@ -161,19 +152,15 @@ void Foam::fvMeshTools::setPatchFields template<class GeoField> void Foam::fvMeshTools::trimPatchFields(fvMesh& mesh, const label nPatches) { - HashTable<const GeoField*> flds + HashTable<GeoField*> flds ( mesh.objectRegistry::lookupClass<GeoField>() ); - forAllConstIter(typename HashTable<const GeoField*>, flds, iter) + forAllIter(typename HashTable<GeoField*>, flds, iter) { - const GeoField& fld = *iter(); - - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ).setSize(nPatches); + GeoField& fld = *iter(); + fld.boundaryField().setSize(nPatches); } } @@ -186,20 +173,18 @@ void Foam::fvMeshTools::reorderPatchFields const labelList& oldToNew ) { - HashTable<const GeoField*> flds + HashTable<GeoField*> flds ( 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 = - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ); + fld.boundaryField(); + bfld.reorder(oldToNew); } } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlTemplates.C b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlTemplates.C index 2b20a75ae22..69bdfedf0b6 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlTemplates.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlTemplates.C @@ -34,12 +34,12 @@ void Foam::solutionControl::storePrevIter() const { typedef GeometricField<Type, fvPatchField, volMesh> GeoField; - HashTable<const GeoField*> + HashTable<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(); diff --git a/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.C index c575b23c285..ea30ffa3dbf 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.C @@ -33,7 +33,7 @@ Foam::fv::LeastSquaresVectors<Stencil>::LeastSquaresVectors const fvMesh& mesh ) : - MeshObject<fvMesh, LeastSquaresVectors>(mesh), + MeshObject<fvMesh, Foam::MoveableMeshObject, LeastSquaresVectors>(mesh), vectors_(mesh.nCells()) { calcLeastSquaresVectors(); diff --git a/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.H b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.H index ccfe5fd2826..d454e8cb3f4 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.H @@ -58,7 +58,7 @@ namespace fv template<class Stencil> class LeastSquaresVectors : - public MeshObject<fvMesh, LeastSquaresVectors<Stencil> > + public MeshObject<fvMesh, MoveableMeshObject, LeastSquaresVectors<Stencil> > { // Private data @@ -105,7 +105,7 @@ public: return vectors_; } - //- Delete the least square vectors when the mesh moves + //- Update the least square vectors when the mesh moves virtual bool movePoints(); }; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C index 82f83d6bda9..48c4c8a2569 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C @@ -38,7 +38,7 @@ namespace Foam Foam::leastSquaresVectors::leastSquaresVectors(const fvMesh& mesh) : - MeshObject<fvMesh, leastSquaresVectors>(mesh), + MeshObject<fvMesh, Foam::MoveableMeshObject, leastSquaresVectors>(mesh), pVectors_ ( IOobject diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.H b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.H index 0c8c602f9c6..d603759e9e8 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.H @@ -50,7 +50,7 @@ namespace Foam class leastSquaresVectors : - public MeshObject<fvMesh, leastSquaresVectors> + public MeshObject<fvMesh, MoveableMeshObject, leastSquaresVectors> { // Private data diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCECCellToCellStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCECCellToCellStencilObject.H index a8e6aac93aa..7c95877769d 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCECCellToCellStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCECCellToCellStencilObject.H @@ -48,7 +48,12 @@ namespace Foam class centredCECCellToCellStencilObject : - public MeshObject<fvMesh, centredCECCellToCellStencilObject>, + public MeshObject + < + fvMesh, + TopologicalMeshObject, + centredCECCellToCellStencilObject + >, public extendedCentredCellToCellStencil { @@ -64,7 +69,12 @@ public: const fvMesh& mesh ) : - MeshObject<fvMesh, centredCECCellToCellStencilObject>(mesh), + MeshObject + < + fvMesh, + Foam::TopologicalMeshObject, + centredCECCellToCellStencilObject + >(mesh), extendedCentredCellToCellStencil(CECCellToCellStencil(mesh)) {} diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCFCCellToCellStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCFCCellToCellStencilObject.H index ccc559d242c..c3dbb3bf275 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCFCCellToCellStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCFCCellToCellStencilObject.H @@ -48,7 +48,12 @@ namespace Foam class centredCFCCellToCellStencilObject : - public MeshObject<fvMesh, centredCFCCellToCellStencilObject>, + public MeshObject + < + fvMesh, + TopologicalMeshObject, + centredCFCCellToCellStencilObject + >, public extendedCentredCellToCellStencil { @@ -64,7 +69,12 @@ public: const fvMesh& mesh ) : - MeshObject<fvMesh, centredCFCCellToCellStencilObject>(mesh), + MeshObject + < + fvMesh, + Foam::TopologicalMeshObject, + centredCFCCellToCellStencilObject + >(mesh), extendedCentredCellToCellStencil(CFCCellToCellStencil(mesh)) {} diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCPCCellToCellStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCPCCellToCellStencilObject.H index e2799a468c3..c436844e7bc 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCPCCellToCellStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCPCCellToCellStencilObject.H @@ -48,7 +48,12 @@ namespace Foam class centredCPCCellToCellStencilObject : - public MeshObject<fvMesh, centredCPCCellToCellStencilObject>, + public MeshObject + < + fvMesh, + TopologicalMeshObject, + centredCPCCellToCellStencilObject + >, public extendedCentredCellToCellStencil { @@ -64,7 +69,12 @@ public: const fvMesh& mesh ) : - MeshObject<fvMesh, centredCPCCellToCellStencilObject>(mesh), + MeshObject + < + fvMesh, + Foam::TopologicalMeshObject, + centredCPCCellToCellStencilObject + >(mesh), extendedCentredCellToCellStencil(CPCCellToCellStencil(mesh)) {} diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCECCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCECCellToFaceStencilObject.H index eb80912208e..553f749ffe0 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCECCellToFaceStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCECCellToFaceStencilObject.H @@ -48,7 +48,12 @@ namespace Foam class centredCECCellToFaceStencilObject : - public MeshObject<fvMesh, centredCECCellToFaceStencilObject>, + public MeshObject + < + fvMesh, + TopologicalMeshObject, + centredCECCellToFaceStencilObject + >, public extendedCentredCellToFaceStencil { @@ -64,7 +69,12 @@ public: const fvMesh& mesh ) : - MeshObject<fvMesh, centredCECCellToFaceStencilObject>(mesh), + MeshObject + < + fvMesh, + Foam::TopologicalMeshObject, + centredCECCellToFaceStencilObject + >(mesh), extendedCentredCellToFaceStencil(CECCellToFaceStencil(mesh)) { if (extendedCellToFaceStencil::debug) diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCFCCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCFCCellToFaceStencilObject.H index d5d300c3d44..112ea234b9e 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCFCCellToFaceStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCFCCellToFaceStencilObject.H @@ -48,7 +48,12 @@ namespace Foam class centredCFCCellToFaceStencilObject : - public MeshObject<fvMesh, centredCFCCellToFaceStencilObject>, + public MeshObject + < + fvMesh, + TopologicalMeshObject, + centredCFCCellToFaceStencilObject + >, public extendedCentredCellToFaceStencil { @@ -64,7 +69,12 @@ public: const fvMesh& mesh ) : - MeshObject<fvMesh, centredCFCCellToFaceStencilObject>(mesh), + MeshObject + < + fvMesh, + Foam::TopologicalMeshObject, + centredCFCCellToFaceStencilObject + >(mesh), extendedCentredCellToFaceStencil(CFCCellToFaceStencil(mesh)) { if (extendedCellToFaceStencil::debug) diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCPCCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCPCCellToFaceStencilObject.H index e4e49b2466c..06a831893d8 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCPCCellToFaceStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCPCCellToFaceStencilObject.H @@ -48,7 +48,12 @@ namespace Foam class centredCPCCellToFaceStencilObject : - public MeshObject<fvMesh, centredCPCCellToFaceStencilObject>, + public MeshObject + < + fvMesh, + TopologicalMeshObject, + centredCPCCellToFaceStencilObject + >, public extendedCentredCellToFaceStencil { @@ -64,7 +69,12 @@ public: const fvMesh& mesh ) : - MeshObject<fvMesh, centredCPCCellToFaceStencilObject>(mesh), + MeshObject + < + fvMesh, + Foam::TopologicalMeshObject, + centredCPCCellToFaceStencilObject + >(mesh), extendedCentredCellToFaceStencil(CPCCellToFaceStencil(mesh)) { if (extendedCellToFaceStencil::debug) diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredFECCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredFECCellToFaceStencilObject.H index a4847074a01..c6baa387675 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredFECCellToFaceStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredFECCellToFaceStencilObject.H @@ -48,7 +48,12 @@ namespace Foam class centredFECCellToFaceStencilObject : - public MeshObject<fvMesh, centredFECCellToFaceStencilObject>, + public MeshObject + < + fvMesh, + TopologicalMeshObject, + centredFECCellToFaceStencilObject + >, public extendedCentredCellToFaceStencil { @@ -64,7 +69,12 @@ public: const fvMesh& mesh ) : - MeshObject<fvMesh, centredFECCellToFaceStencilObject>(mesh), + MeshObject + < + fvMesh, + Foam::TopologicalMeshObject, + centredFECCellToFaceStencilObject + >(mesh), extendedCentredCellToFaceStencil(FECCellToFaceStencil(mesh)) { if (extendedCellToFaceStencil::debug) diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/pureUpwindCFCCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/pureUpwindCFCCellToFaceStencilObject.H index 32da6fbf463..607b9075fc6 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/pureUpwindCFCCellToFaceStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/pureUpwindCFCCellToFaceStencilObject.H @@ -48,7 +48,12 @@ namespace Foam class pureUpwindCFCCellToFaceStencilObject : - public MeshObject<fvMesh, pureUpwindCFCCellToFaceStencilObject>, + public MeshObject + < + fvMesh, + TopologicalMeshObject, + pureUpwindCFCCellToFaceStencilObject + >, public extendedUpwindCellToFaceStencil { @@ -64,7 +69,12 @@ public: const fvMesh& mesh ) : - MeshObject<fvMesh, pureUpwindCFCCellToFaceStencilObject>(mesh), + MeshObject + < + fvMesh, + Foam::TopologicalMeshObject, + pureUpwindCFCCellToFaceStencilObject + >(mesh), extendedUpwindCellToFaceStencil(CFCCellToFaceStencil(mesh)) { if (extendedCellToFaceStencil::debug) diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCECCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCECCellToFaceStencilObject.H index cb699db8fe4..15e94c9571d 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCECCellToFaceStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCECCellToFaceStencilObject.H @@ -48,7 +48,12 @@ namespace Foam class upwindCECCellToFaceStencilObject : - public MeshObject<fvMesh, upwindCECCellToFaceStencilObject>, + public MeshObject + < + fvMesh, + TopologicalMeshObject, + upwindCECCellToFaceStencilObject + >, public extendedUpwindCellToFaceStencil { @@ -66,7 +71,12 @@ public: const scalar minOpposedness ) : - MeshObject<fvMesh, upwindCECCellToFaceStencilObject>(mesh), + MeshObject + < + fvMesh, + Foam::TopologicalMeshObject, + upwindCECCellToFaceStencilObject + >(mesh), extendedUpwindCellToFaceStencil ( CECCellToFaceStencil(mesh), diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCFCCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCFCCellToFaceStencilObject.H index b6db59a4159..89d5965d783 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCFCCellToFaceStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCFCCellToFaceStencilObject.H @@ -48,7 +48,12 @@ namespace Foam class upwindCFCCellToFaceStencilObject : - public MeshObject<fvMesh, upwindCFCCellToFaceStencilObject>, + public MeshObject + < + fvMesh, + TopologicalMeshObject, + upwindCFCCellToFaceStencilObject + >, public extendedUpwindCellToFaceStencil { @@ -66,7 +71,12 @@ public: const scalar minOpposedness ) : - MeshObject<fvMesh, upwindCFCCellToFaceStencilObject>(mesh), + MeshObject + < + fvMesh, + Foam::TopologicalMeshObject, + upwindCFCCellToFaceStencilObject + >(mesh), extendedUpwindCellToFaceStencil ( CFCCellToFaceStencil(mesh), diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCPCCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCPCCellToFaceStencilObject.H index 17c3913453f..9f9ed6caa51 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCPCCellToFaceStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCPCCellToFaceStencilObject.H @@ -48,7 +48,12 @@ namespace Foam class upwindCPCCellToFaceStencilObject : - public MeshObject<fvMesh, upwindCPCCellToFaceStencilObject>, + public MeshObject + < + fvMesh, + TopologicalMeshObject, + upwindCPCCellToFaceStencilObject + >, public extendedUpwindCellToFaceStencil { @@ -66,7 +71,12 @@ public: const scalar minOpposedness ) : - MeshObject<fvMesh, upwindCPCCellToFaceStencilObject>(mesh), + MeshObject + < + fvMesh, + Foam::TopologicalMeshObject, + upwindCPCCellToFaceStencilObject + >(mesh), extendedUpwindCellToFaceStencil ( CPCCellToFaceStencil(mesh), diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindFECCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindFECCellToFaceStencilObject.H index 261da27db39..0a894efc4f3 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindFECCellToFaceStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindFECCellToFaceStencilObject.H @@ -48,7 +48,12 @@ namespace Foam class upwindFECCellToFaceStencilObject : - public MeshObject<fvMesh, upwindFECCellToFaceStencilObject>, + public MeshObject + < + fvMesh, + TopologicalMeshObject, + upwindFECCellToFaceStencilObject + >, public extendedUpwindCellToFaceStencil { @@ -66,7 +71,12 @@ public: const scalar minOpposedness ) : - MeshObject<fvMesh, upwindFECCellToFaceStencilObject>(mesh), + MeshObject + < + fvMesh, + Foam::TopologicalMeshObject, + upwindFECCellToFaceStencilObject + >(mesh), extendedUpwindCellToFaceStencil ( FECCellToFaceStencil(mesh), diff --git a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/MeshObjects/centredCFCFaceToCellStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/MeshObjects/centredCFCFaceToCellStencilObject.H index 7763c9fb157..868c0134dd7 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/MeshObjects/centredCFCFaceToCellStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/MeshObjects/centredCFCFaceToCellStencilObject.H @@ -48,7 +48,12 @@ namespace Foam class centredCFCFaceToCellStencilObject : - public MeshObject<fvMesh, centredCFCFaceToCellStencilObject>, + public MeshObject + < + fvMesh, + TopologicalMeshObject, + centredCFCFaceToCellStencilObject + >, public extendedCentredFaceToCellStencil { @@ -64,7 +69,12 @@ public: const fvMesh& mesh ) : - MeshObject<fvMesh, centredCFCFaceToCellStencilObject>(mesh), + MeshObject + < + fvMesh, + Foam::TopologicalMeshObject, + centredCFCFaceToCellStencilObject + >(mesh), extendedCentredFaceToCellStencil(CFCFaceToCellStencil(mesh)) {} diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 4c63ceff94d..ca37a793af5 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -31,39 +31,17 @@ License #include "SubField.H" #include "demandDrivenData.H" #include "fvMeshLduAddressing.H" -#include "emptyPolyPatch.H" #include "mapPolyMesh.H" #include "MapFvFields.H" #include "fvMeshMapper.H" #include "mapClouds.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" +#include "MeshObject.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -defineTypeNameAndDebug(fvMesh, 0); + defineTypeNameAndDebug(fvMesh, 0); } @@ -71,6 +49,8 @@ defineTypeNameAndDebug(fvMesh, 0); void Foam::fvMesh::clearGeomNotOldVol() { + meshObject::clear<fvMesh, GeometricMeshObject>(*this); + slicedVolScalarField::DimensionedInternalField* VPtr = static_cast<slicedVolScalarField::DimensionedInternalField*>(VPtr_); deleteDemandDrivenData(VPtr); @@ -126,51 +106,13 @@ void Foam::fvMesh::clearGeom() // Mesh motion flux cannot be deleted here because the old-time flux // 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() { + meshObject::clear<fvMesh, TopologicalMeshObject>(*this); 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) { // 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(); surfaceInterpolation::movePoints(); - - // 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); + meshObject::movePoints<fvMesh>(*this); return tsweptVols; } @@ -737,9 +653,7 @@ void Foam::fvMesh::updateMesh(const mapPolyMesh& mpm) clearAddressing(); - // handleMorph() should also clear out the surfaceInterpolation. - // This is a temporary solution - surfaceInterpolation::movePoints(); + meshObject::updateMesh<fvMesh>(*this, mpm); } diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C index a4bd976668e..50a6a95aa63 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C @@ -40,7 +40,7 @@ Foam::FitData<Form, ExtendedStencil, Polynomial>::FitData const scalar centralWeight ) : - MeshObject<fvMesh, Form>(mesh), + MeshObject<fvMesh, Foam::MoveableMeshObject, Form>(mesh), stencil_(stencil), linearCorrection_(linearCorrection), linearLimitFactor_(linearLimitFactor), diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.H index 4c6a71b4f99..e46fba3db3a 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.H @@ -54,7 +54,7 @@ namespace Foam template<class FitDataType, class ExtendedStencil, class Polynomial> class FitData : - public MeshObject<fvMesh, FitDataType> + public MeshObject<fvMesh, MoveableMeshObject, FitDataType> { // Private data diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C index 80d0170d5ec..2874eb82caf 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C @@ -38,7 +38,7 @@ namespace Foam Foam::skewCorrectionVectors::skewCorrectionVectors(const fvMesh& mesh) : - MeshObject<fvMesh, skewCorrectionVectors>(mesh), + MeshObject<fvMesh, Foam::MoveableMeshObject, skewCorrectionVectors>(mesh), skew_(false), skewCorrectionVectors_ ( diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.H index c6e21a5c88d..7e5c99261e2 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.H @@ -52,7 +52,7 @@ class fvMesh; class skewCorrectionVectors : - public MeshObject<fvMesh, skewCorrectionVectors> + public MeshObject<fvMesh, MoveableMeshObject, skewCorrectionVectors> { // Private data diff --git a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C index 87305f2fa80..61896a195aa 100644 --- a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C +++ b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C @@ -612,9 +612,10 @@ void volPointInterpolation::makePatchPatchAddressing() 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 * * * * * * * * * * * * * // -void volPointInterpolation::updateMesh() +void volPointInterpolation::updateMesh(const mapPolyMesh&) { makeWeights(); makePatchPatchAddressing(); diff --git a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.H b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.H index d5a1a2eab46..930c1cc1cdf 100644 --- a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.H +++ b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.H @@ -56,7 +56,7 @@ class pointMesh; class volPointInterpolation : - public MeshObject<fvMesh, volPointInterpolation> + public MeshObject<fvMesh, UpdateableMeshObject, volPointInterpolation> { // Private data @@ -174,7 +174,7 @@ public: // Edit //- Update mesh topology using the morph engine - void updateMesh(); + void updateMesh(const mapPolyMesh&); //- Correct weighting factors for moving mesh. bool movePoints(); diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C index 4d4f0e12b15..beeb47ca3cb 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C @@ -120,20 +120,15 @@ void meshRefinement::testSyncBoundaryFaceList template<class GeoField> void meshRefinement::addPatchFields(fvMesh& mesh, const word& patchFieldType) { - HashTable<const GeoField*> flds + HashTable<GeoField*> flds ( mesh.objectRegistry::lookupClass<GeoField>() ); - forAllConstIter(typename HashTable<const GeoField*>, flds, iter) + forAllIter(typename HashTable<GeoField*>, flds, iter) { - const GeoField& fld = *iter(); - - typename GeoField::GeometricBoundaryField& bfld = - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ); + GeoField& fld = *iter(); + typename GeoField::GeometricBoundaryField& bfld = fld.boundaryField(); label sz = bfld.size(); bfld.setSize(sz+1); @@ -155,28 +150,21 @@ void meshRefinement::addPatchFields(fvMesh& mesh, const word& patchFieldType) template<class GeoField> void meshRefinement::reorderPatchFields(fvMesh& mesh, const labelList& oldToNew) { - HashTable<const GeoField*> flds + HashTable<GeoField*> flds ( mesh.objectRegistry::lookupClass<GeoField>() ); - forAllConstIter(typename HashTable<const GeoField*>, flds, iter) + forAllIter(typename HashTable<GeoField*>, flds, iter) { - const GeoField& fld = *iter(); - - typename GeoField::GeometricBoundaryField& bfld = - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ); + GeoField& fld = *iter(); + typename GeoField::GeometricBoundaryField& bfld = fld.boundaryField(); bfld.reorder(oldToNew); } } - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.C b/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.C index ab023bfdc29..158061a9aa4 100644 --- a/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.C +++ b/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.C @@ -40,7 +40,12 @@ Foam::meshSearchFACECENTRETETSMeshObject::meshSearchFACECENTRETETSMeshObject const polyMesh& mesh ) : - MeshObject<polyMesh, meshSearchFACECENTRETETSMeshObject>(mesh), + MeshObject + < + polyMesh, + Foam::GeometricMeshObject, + meshSearchFACECENTRETETSMeshObject + >(mesh), meshSearch(mesh, polyMesh::FACECENTRETETS) {} diff --git a/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.H b/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.H index 2ddaf9d4fa3..67d2ead191a 100644 --- a/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.H +++ b/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.H @@ -48,7 +48,12 @@ namespace Foam class meshSearchFACECENTRETETSMeshObject : - public MeshObject<polyMesh, meshSearchFACECENTRETETSMeshObject>, + public MeshObject + < + polyMesh, + GeometricMeshObject, + meshSearchFACECENTRETETSMeshObject + >, public meshSearch { @@ -66,18 +71,6 @@ public: //- Destructor virtual ~meshSearchFACECENTRETETSMeshObject() {} - -// -// // Member functions -// -// // Edit -// -// //- Update mesh topology using the morph engine -// void updateMesh(); -// -// //- Correct weighting factors for moving mesh. -// bool movePoints(); -// }; diff --git a/src/meshTools/meshSearch/meshSearchMeshObject.C b/src/meshTools/meshSearch/meshSearchMeshObject.C index 12211345a17..62b1d7930bb 100644 --- a/src/meshTools/meshSearch/meshSearchMeshObject.C +++ b/src/meshTools/meshSearch/meshSearchMeshObject.C @@ -37,7 +37,7 @@ namespace Foam Foam::meshSearchMeshObject::meshSearchMeshObject(const polyMesh& mesh) : - MeshObject<polyMesh, meshSearchMeshObject>(mesh), + MeshObject<polyMesh, Foam::GeometricMeshObject, meshSearchMeshObject>(mesh), meshSearch(mesh) {} diff --git a/src/meshTools/meshSearch/meshSearchMeshObject.H b/src/meshTools/meshSearch/meshSearchMeshObject.H index 838aa80c705..a20d027ab21 100644 --- a/src/meshTools/meshSearch/meshSearchMeshObject.H +++ b/src/meshTools/meshSearch/meshSearchMeshObject.H @@ -48,7 +48,7 @@ namespace Foam class meshSearchMeshObject : - public MeshObject<polyMesh, meshSearchMeshObject>, + public MeshObject<polyMesh, GeometricMeshObject, meshSearchMeshObject>, public meshSearch { @@ -66,18 +66,6 @@ public: //- Destructor virtual ~meshSearchMeshObject() {} - -// -// // Member functions -// -// // Edit -// -// //- Update mesh topology using the morph engine -// void updateMesh(); -// -// //- Correct weighting factors for moving mesh. -// bool movePoints(); -// }; diff --git a/src/meshTools/regionSplit/regionSplit.C b/src/meshTools/regionSplit/regionSplit.C index 70b0759c711..b91b0017efc 100644 --- a/src/meshTools/regionSplit/regionSplit.C +++ b/src/meshTools/regionSplit/regionSplit.C @@ -692,7 +692,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit Foam::regionSplit::regionSplit(const polyMesh& mesh) : - MeshObject<polyMesh, regionSplit>(mesh), + MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh), labelList(mesh.nCells(), -1) { globalNumberingPtr_ = calcRegionSplit @@ -710,7 +710,7 @@ Foam::regionSplit::regionSplit const boolList& blockedFace ) : - MeshObject<polyMesh, regionSplit>(mesh), + MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh), labelList(mesh.nCells(), -1) { globalNumberingPtr_ = calcRegionSplit @@ -729,7 +729,7 @@ Foam::regionSplit::regionSplit const List<labelPair>& explicitConnections ) : - MeshObject<polyMesh, regionSplit>(mesh), + MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh), labelList(mesh.nCells(), -1) { globalNumberingPtr_ = calcRegionSplit diff --git a/src/meshTools/regionSplit/regionSplit.H b/src/meshTools/regionSplit/regionSplit.H index 6c41d1fb838..992a70b3828 100644 --- a/src/meshTools/regionSplit/regionSplit.H +++ b/src/meshTools/regionSplit/regionSplit.H @@ -113,7 +113,7 @@ class polyMesh; class regionSplit : - public MeshObject<polyMesh, regionSplit>, + public MeshObject<polyMesh, TopologicalMeshObject, regionSplit>, public labelList { // Private data diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMeshTemplates.C b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMeshTemplates.C index e68fb735e70..eafb4d5afa5 100644 --- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMeshTemplates.C +++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMeshTemplates.C @@ -88,22 +88,20 @@ void Foam::distributedTriSurfaceMesh::distributeFields { typedef DimensionedField<Type, triSurfaceGeoMesh> DimensionedSurfField; - HashTable<const DimensionedSurfField*> fields + HashTable<DimensionedSurfField*> fields ( - objectRegistry::lookupClass - <DimensionedSurfField >() + objectRegistry::lookupClass<DimensionedSurfField>() ); for ( - typename HashTable<const DimensionedSurfField*>::iterator fieldIter = + typename HashTable<DimensionedSurfField*>::iterator fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) { - DimensionedSurfField& field = - const_cast<DimensionedSurfField&>(*fieldIter()); + DimensionedSurfField& field = *fieldIter(); label oldSize = field.size(); diff --git a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C index 86cbb9f5093..e1ec1a591b5 100644 --- a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C +++ b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C @@ -37,7 +37,15 @@ namespace Foam Foam::SLGThermo::SLGThermo(const fvMesh& mesh, fluidThermo& thermo) : - MeshObject<fvMesh, SLGThermo>(mesh), + regIOobject + ( + IOobject + ( + SLGThermo::typeName, + mesh.polyMesh::instance(), + mesh + ) + ), thermo_(thermo), carrier_(NULL), liquids_(NULL), @@ -246,4 +254,3 @@ bool Foam::SLGThermo::hasSolids() const // ************************************************************************* // - diff --git a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H index 22508c38444..b5e2b5caf72 100644 --- a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H +++ b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H @@ -45,7 +45,7 @@ SourceFiles #ifndef SLGThermo_H #define SLGThermo_H -#include "MeshObject.H" +#include "regIOobject.H" #include "fluidThermo.H" #include "basicMultiComponentMixture.H" #include "liquidMixtureProperties.H" @@ -62,7 +62,7 @@ namespace Foam class SLGThermo : - public MeshObject<fvMesh, SLGThermo> + public regIOobject { // Private data @@ -145,6 +145,14 @@ public: //- Thermo database has solid components flag bool hasSolids() const; + + + // IO + + bool writeData(Foam::Ostream&) const + { + return true; + } }; -- GitLab