OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Mesh.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  *
7  * Visit http://people.web.psi.ch/adelmann/ for more details
8  *
9  ***************************************************************************/
10 
11 #ifndef MESH_H
12 #define MESH_H
13 
14 /***********************************************************************
15  *
16  * The Mesh base class. Right now, this mainly acts as a standard base
17  * class for all meshes so that other objects can register as users of
18  * the mesh and can be notified if the mesh changes (e.g., it is rescaled
19  * or restructured entirely).
20  *
21  ***********************************************************************/
22 
23 // include files
26 #include "Utility/UserList.h"
27 
28 // Enumeration used for specifying mesh boundary conditions. Mesh BC are used
29 // for things like figuring out how to return the mesh spacing for a cell
30 // beyond the edge of the physical mesh, as might arise in stencil operations
31 // on Field's on the mesh.
33 
34 template<unsigned Dim>
35 class Mesh : private UserList {
36 
37 public:
38  //# public typedefs
42 
43  //# public enumerations
44  enum { Dimension = Dim };
45 
46  // static data member
47  static std::string MeshBC_E_Names[3];
48 
49  // constructor
50  Mesh();
51 
52  // destructor
53  virtual ~Mesh();
54 
55  // Mesh geometry queries:
56  //-----------------------------------------------------------
57  // ....
58 
59  // Mesh subsetting functions:
60  //----------------------------------------
61  // ....
62  // Return appropriate SubSetType object for appropriate IndexType argument:
63  // virtual template<class SubSetType, class IndexType>
64  // SubSetType& getSubSet(IndexType& i);
65  // N.B.: maybe above is bad because maybe this:
66  // anything except *all* of the mesh can't be generalized to include
67  // here; the argument type would have to be appropriate for the Mesh...????
68 
69  // Mesh coordinate mapping data and functions:
70  //--------------------------------------------
71  // Follow Overature's Mapping class design as much as possible.
72  // All this is for future implementation, when we need something that is
73  // not genuine cartesian geometry.
74 
75  // UserList operations
76  // -------------------
77  // checkin should be called by any objects which want to be informed
78  // when the mesh is destroyed or when it is changed (the function
79  // 'Repartition' will be called when the mesh changes). checkout should
80  // be called when an object is destroyed or no longer needs to use the
81  // Mesh.
82 
83  // Return our ID, as generated by UserList.
84  ID_t get_Id() const { return getUserListID(); }
85 
86  // Tell the Mesh that a FieldLayoutUser has been declared on it.
87  // This is just a wrapper around UserList::checkinUser; it only allows
88  // FieldLayoutUser's to register.
90 
91  // Tell the Mesh that a FieldLayoutUser is no longer using it.
92  // This is different than the checkoutUser from UserList,
93  // for symmetry with checkin and to limit checkout's to FieldLayoutUser's.
95 
96  // Accessors for the users accessing this FieldLayout
97  size_type_if size_if() const { return getNumUsers(); }
99  iterator_if end_if() { return end_user(); }
100 
101  // notify all the registered FieldLayoutUser's that this Mesh has
102  // changed. This is done by calling the 'Repartition' virtual function
103  // in FieldLayoutUser.
104  void notifyOfChange();
105 
106 };
107 
108 #include "Meshes/Mesh.hpp"
109 
110 #endif // MESH_H
111 
112 /***************************************************************************
113  * $RCSfile: Mesh.h,v $ $Author: adelmann $
114  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:28 $
115  * IPPL_VERSION_ID: $Id: Mesh.h,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $
116  ***************************************************************************/
iterator_user end_user()
Definition: UserList.cpp:84
Definition: Mesh.h:35
MeshBC_E
Definition: Mesh.h:32
size_type_user size_type_if
Definition: Mesh.h:41
size_type_if size_if() const
Definition: Mesh.h:97
void checkout(FieldLayoutUser &f)
Definition: Mesh.h:94
ID_t getUserListID() const
Definition: UserList.cpp:54
UserList_t::size_type size_type_user
Definition: UserList.h:45
Definition: Mesh.h:32
virtual ~Mesh()
Definition: Mesh.hpp:43
void notifyOfChange()
Definition: Mesh.hpp:51
ID_t get_Id() const
Definition: Mesh.h:84
size_type_user getNumUsers() const
Definition: UserList.cpp:47
Mesh()
Definition: Mesh.hpp:37
iterator_if begin_if()
Definition: Mesh.h:98
UserList::ID_t ID_t
Definition: Mesh.h:39
iterator_if end_if()
Definition: Mesh.h:99
virtual void checkoutUser(Key key, bool informuser=false)
Definition: UserList.cpp:124
UserList_t::iterator iterator_user
Definition: UserList.h:43
void checkin(FieldLayoutUser &f)
Definition: Mesh.h:89
const unsigned Dim
virtual ID_t checkinUser(User &user)
Definition: UserList.cpp:109
iterator_user begin_user()
Definition: UserList.cpp:77
User::ID_t ID_t
Definition: UserList.h:46
Definition: Mesh.h:32
static std::string MeshBC_E_Names[3]
Definition: Mesh.h:47
iterator_user iterator_if
Definition: Mesh.h:40