00001 // -*- C++ -*- 00002 /*************************************************************************** 00003 * 00004 * The IPPL Framework 00005 * 00006 * 00007 * Visit http://people.web.psi.ch/adelmann/ for more details 00008 * 00009 ***************************************************************************/ 00010 00011 #ifndef MESH_H 00012 #define MESH_H 00013 00014 /*********************************************************************** 00015 * 00016 * The Mesh base class. Right now, this mainly acts as a standard base 00017 * class for all meshes so that other objects can register as users of 00018 * the mesh and can be notified if the mesh changes (e.g., it is rescaled 00019 * or restructured entirely). 00020 * 00021 ***********************************************************************/ 00022 00023 // include files 00024 #include "FieldLayout/FieldLayout.h" 00025 #include "FieldLayout/FieldLayoutUser.h" 00026 00027 00028 // Enumeration used for specifying mesh boundary conditions. Mesh BC are used 00029 // for things like figuring out how to return the mesh spacing for a cell 00030 // beyond the edge of the physical mesh, as might arise in stencil operations 00031 // on Field's on the mesh. 00032 enum MeshBC_E { Reflective, Periodic, NoBC }; 00033 00034 template<unsigned Dim> 00035 class Mesh : private UserList { 00036 00037 public: 00038 //# public typedefs 00039 typedef UserList::ID_t ID_t; 00040 typedef iterator_user iterator_if; 00041 typedef size_type_user size_type_if; 00042 00043 //# public enumerations 00044 enum { Dimension = Dim }; 00045 00046 // static data member 00047 static char* MeshBC_E_Names[3]; 00048 00049 // constructor 00050 Mesh(); 00051 00052 // destructor 00053 virtual ~Mesh(); 00054 00055 // Mesh geometry queries: 00056 //----------------------------------------------------------- 00057 // .... 00058 00059 // Mesh subsetting functions: 00060 //---------------------------------------- 00061 // .... 00062 // Return appropriate SubSetType object for appropriate IndexType argument: 00063 // virtual template<class SubSetType, class IndexType> 00064 // SubSetType& getSubSet(IndexType& i); 00065 // N.B.: maybe above is bad because maybe this: 00066 // anything except *all* of the mesh can't be generalized to include 00067 // here; the argument type would have to be appropriate for the Mesh...???? 00068 00069 // Mesh coordinate mapping data and functions: 00070 //-------------------------------------------- 00071 // Follow Overature's Mapping class design as much as possible. 00072 // All this is for future implementation, when we need something that is 00073 // not genuine cartesian geometry. 00074 00075 // UserList operations 00076 // ------------------- 00077 // checkin should be called by any objects which want to be informed 00078 // when the mesh is destroyed or when it is changed (the function 00079 // 'Repartition' will be called when the mesh changes). checkout should 00080 // be called when an object is destroyed or no longer needs to use the 00081 // Mesh. 00082 00083 // Return our ID, as generated by UserList. 00084 ID_t get_Id() const { return getUserListID(); } 00085 00086 // Tell the Mesh that a FieldLayoutUser has been declared on it. 00087 // This is just a wrapper around UserList::checkinUser; it only allows 00088 // FieldLayoutUser's to register. 00089 void checkin(FieldLayoutUser& f) { checkinUser(f); } 00090 00091 // Tell the Mesh that a FieldLayoutUser is no longer using it. 00092 // This is different than the checkoutUser from UserList, 00093 // for symmetry with checkin and to limit checkout's to FieldLayoutUser's. 00094 void checkout(FieldLayoutUser& f) { checkoutUser(f); } 00095 00096 // Accessors for the users accessing this FieldLayout 00097 size_type_if size_if() const { return getNumUsers(); } 00098 iterator_if begin_if() { return begin_user(); } 00099 iterator_if end_if() { return end_user(); } 00100 00101 // notify all the registered FieldLayoutUser's that this Mesh has 00102 // changed. This is done by calling the 'Repartition' virtual function 00103 // in FieldLayoutUser. 00104 void notifyOfChange(); 00105 00106 }; 00107 00108 #include "Meshes/Mesh.cpp" 00109 00110 #endif // MESH_H 00111 00112 /*************************************************************************** 00113 * $RCSfile: Mesh.h,v $ $Author: adelmann $ 00114 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:28 $ 00115 * IPPL_VERSION_ID: $Id: Mesh.h,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $ 00116 ***************************************************************************/