FreeFOAM The Cross-Platform CFD Toolkit
MeshObject.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::MeshObject
26 
27 Description
28  Templated abstract base-class for dynamic mesh objects used to automate
29  their allocation to the mesh database and the mesh-modifier event-loop.
30 
31 SourceFiles
32  MeshObject.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef MeshObject_H
37 #define MeshObject_H
38 
39 #include <OpenFOAM/regIOobject.H>
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class MeshObject Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 
51 template<class Mesh, class Type>
53 :
54  public regIOobject
55 {
56 
57 protected:
58 
59  // Reference to Mesh
60  const Mesh& mesh_;
61 
62 
63 public:
64 
65  // Constructors
66 
67  explicit MeshObject(const Mesh& mesh);
68 
69  static const Type& New(const Mesh& mesh);
70 
71  template<class Data1>
72  static const Type& New
73  (
74  const Mesh& mesh,
75  const Data1& d
76  );
77 
78  template<class Data1, class Data2>
79  static const Type& New
80  (
81  const Mesh& mesh,
82  const Data1&,
83  const Data2&
84  );
85 
86  template<class Data1, class Data2, class Data3>
87  static const Type& New
88  (
89  const Mesh& mesh,
90  const Data1&,
91  const Data2&,
92  const Data3&
93  );
94 
95  template<class Data1, class Data2, class Data3, class Data4>
96  static const Type& New
97  (
98  const Mesh& mesh,
99  const Data1&,
100  const Data2&,
101  const Data3&,
102  const Data4&
103  );
104 
105 
106  // Destructors
107 
108  virtual ~MeshObject();
109 
110  static bool Delete(const Mesh& mesh);
111 
112 
113  // Member Functions
114 
115  const Mesh& mesh() const
116  {
117  return mesh_;
118  }
119 
120  virtual bool writeData(Foam::Ostream&) const
121  {
122  return true;
123  }
124 };
125 
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace Foam
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #ifdef NoRepository
134 # include <OpenFOAM/MeshObject.C>
135 #endif
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #endif
140 
141 // ************************ vim: set sw=4 sts=4 et: ************************ //