00001 #ifndef _BASE_MESH_H_ 00002 #define _BASE_MESH_H_ 00003 00004 #include <string> 00005 00006 #include "BaseHandle.h" 00007 #include "fv_compiler.h" 00008 00009 namespace FemViewer { 00010 00011 00012 class BaseMesh : public BaseHandle 00013 { 00014 protected: 00015 /* Pointers to appropriate routines. 00016 * When this application is complied and linked as a static module, 00017 * routines should be known at once. In other case (standalone program), 00018 * it is possible switch between internal and external routines. 00019 **/ 00020 static intfint Get_nmel; 00021 static intfint Get_nmno; 00022 static intf2int Get_next_act_fa; 00023 static intf2int Get_next_act_el; 00024 static intf2int Get_face_bc; 00025 static voidf2int4intp2doublep Get_face_neig; 00026 static intf2int Get_el_status; 00027 static intf2int2intp Get_el_faces; 00028 static intf2intintp Get_el_struct; 00029 static intf2intintpdoublep Get_el_node_coor; 00030 static intf2intintp Get_face_struct; 00031 static intf2intintpdoublep Get_fa_node_coor; 00032 static intfint Get_nmed; 00033 static intfint Get_nmfa; 00034 static intf2intintp Get_edge_nodes; 00035 static intf2int Get_edge_status; 00036 static intf2intdoublep Get_node_coor; 00037 static intf2int Get_node_status; 00038 static intfcharp module_introduce; 00039 static intfintcharpfilep init_mesh; 00040 static intfint free_mesh; 00041 00042 /* Mesh counter 00043 **/ 00044 static int _meshCounter; 00045 /* Mesh name or path to input file 00046 **/ 00047 std::string _name; 00048 00049 public: // Member routines 00050 static int GetMeshModuleType(); 00051 /* Constructors 00052 **/ 00053 explicit BaseMesh(const std::string& name_= "MESH_memory_pool") 00054 : BaseHandle(), _name(name_) { ; } 00055 00056 /* Destructor 00057 **/ 00058 virtual ~BaseMesh() { } 00059 00060 /* Initialization methods 00061 **/ 00062 virtual int Init(const char* name_); 00063 00064 /* Free mesh 00065 **/ 00066 virtual int Free(); 00067 00068 /* Reload again mesh 00069 **/ 00070 virtual int Reload(){ 00071 Reset(); 00072 return Init(_name.c_str()); 00073 } 00074 00075 /* Update internal data 00076 **/ 00077 virtual int Update(){ return 0;} 00078 00079 /* Reset to defaults 00080 **/ 00081 virtual void Reset() { 00082 //printf("Basemesh::Reset\n"); 00083 Free(); 00084 BaseHandle::Reset(); 00085 } 00086 00087 00088 /* Get the Id of the mesh 00089 **/ 00090 int& Id() { return this->idx(); } 00091 const int& Id() const { return this->idx(); } 00092 00093 std::string& Name() { return _name; } 00094 const std::string& Name() const { return _name; } 00095 00096 /* Specify if mesh is initialized 00097 **/ 00098 bool IsInit() const { return ((_meshCounter > 0) && (this->idx() > 0)); } 00099 }; 00100 } 00101 00102 00103 #endif /* _BASE_MESH_H_ 00104 */