1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Abstract base-class for dynamic mesh objects used to automate
29 their allocation to the mesh database and mesh-related updates
34 \*---------------------------------------------------------------------------*/
36 #ifndef meshObjectBase_H
37 #define meshObjectBase_H
40 #include "HashTable.H"
41 #include "objectRegistry.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 // Class forward declarations
51 /*---------------------------------------------------------------------------*\
52 Class meshObjectBase Declaration
53 \*---------------------------------------------------------------------------*/
59 //- Runtime type information
60 TypeName("meshObject");
65 //- Update topology on all mesh objects
67 static void allUpdateTopology(const Mesh& mesh, const mapPolyMesh& mpm)
69 HashTable<const meshObjectBase*> tbl =
70 mesh.objectRegistry::template lookupClass<meshObjectBase>();
76 "static void meshObjectBase::"
77 "allUpdateTopology(const Mesh& mesh, "
78 "const mapPolyMesh& mpm)"
79 ) << "Mesh objects to update: " << tbl.toc() << endl;
84 HashTable<const meshObjectBase*>::iterator iter =
90 const meshObjectBase& obj = *(iter());
94 Info << "Updating object " << obj.type() << endl;
102 Info << "Done update topology" << endl;
107 //- Move points on all mesh objects
109 static void allMovePoints(const Mesh& mesh)
113 HashTable<const meshObjectBase*> tbl =
114 mesh.objectRegistry::template lookupClass<meshObjectBase>();
120 "static void meshObjectBase::"
121 "allMovePoints(const Mesh& mesh)"
122 ) << "Mesh objects to move: " << tbl.toc() << endl;
127 HashTable<const meshObjectBase*>::iterator iter =
133 const meshObjectBase& obj = *(iter());
137 Info<< "Moving object "
138 << " of type " << obj.type() << endl;
146 Info << "Done moving" << endl;
151 //- Move points on all mesh objects
153 static void allDelete(const Mesh& mesh)
155 HashTable<const meshObjectBase*> tbl =
156 mesh.objectRegistry::template lookupClass<meshObjectBase>();
160 HashTable<const meshObjectBase*>::iterator iter =
166 const meshObjectBase& obj = *(iter());
170 Info << "Deleting object " << obj.type() << endl;
180 virtual ~meshObjectBase()
186 //- Update after mesh motion
187 virtual bool movePoints() const = 0;
189 //- Update after topology change
190 virtual bool updateMesh(const mapPolyMesh&) const = 0;
192 //- Delete object from database
193 virtual bool deleteObject() const = 0;
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 } // End namespace Foam
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 // ************************************************************************* //