cgma
TDParallel.hpp
Go to the documentation of this file.
00001 //- Class: TDParallel
00002 //- Description: This tool data generates local and non-local bodies 
00003 //-              which the entity is part of
00004 
00005 #ifndef TD_PARALLEL
00006 #define TD_PARALLEL
00007 
00008 #include "ToolData.hpp"
00009 #include "MemoryManager.hpp"
00010 #include "CubitDefines.h"
00011 #include "DLIList.hpp"
00012 
00013 template <class X> class DLIList;
00014 class ToolDataUser;
00015 class RefEntity;
00016 
00017 class TDParallel : public ToolData
00018 {
00019 private:
00020 
00021   // bodies sharing this entity
00022   DLIList<int> m_sharedBodyList;
00023 
00024   // for body to processor mapping
00025   DLIList<int> m_bodyToProcList;
00026 
00027   // bodies sharing this entity in the same processor
00028   DLIList<int> m_localBodyList;
00029 
00030   // bodies sharing this entity in the remote processor
00031   DLIList<int> m_nonLocalBodyList;
00032 
00033   // processors sharing this entity
00034   // if this entity is surface, the first processor will mesh it
00035   DLIList<int> m_sharedProcList;
00036 
00037   DLIList<int> m_ghostProcList;
00038 
00039   // back pointer to the owning entity
00040   ToolDataUser *ownerEntity;
00041 
00042   // unique id
00043   int m_uniqueId;
00044 
00045   // if it is interface entity shared by processors
00046   int m_interface;
00047 
00048 public:
00049   
00050   TDParallel(ToolDataUser *owner = NULL, DLIList<int> *shared_bodies = NULL,
00051          DLIList<int> *shared_procs = NULL, DLIList<int> *ghost_procs = NULL,
00052              int unique_id = -1, int interface = 0);
00053   
00054   virtual ~TDParallel();
00055     //-constructor and destructor
00056 
00057   static int is_parallel(const ToolData* td);
00058   
00059   DLIList<int>* get_shared_body_list();
00060   CubitStatus set_shared_body_list();
00061 
00062   DLIList<int>* get_shared_proc_list();
00063   void set_shared_proc_list(DLIList<int> list);
00064 
00065   DLIList<int>* get_ghost_proc_list();
00066 
00067   DLIList<int>* get_local_body_list();
00068   DLIList<int>* get_non_local_body_list();
00069 
00070   ToolDataUser *owner_entity() {return ownerEntity;};
00071 
00072   void owner_entity(ToolDataUser *owner) {ownerEntity = owner;};
00073   
00074   //- get/set functions for ownerEntity
00075   unsigned int get_charge_proc();
00076   void set_charge_proc(unsigned int proc);
00077   
00078   unsigned int get_counter_proc();
00079   void set_counter_proc(unsigned int proc);
00080 
00081   unsigned int get_unique_id();
00082   void set_unique_id(unsigned int id);
00083 
00084   int is_interface();
00085 
00086   unsigned int get_n_shared_procs();
00087 
00088   void add_shared_proc(unsigned int proc);
00089 
00090   void add_ghost_proc(unsigned int proc);
00091 
00092   bool is_shared_proc(unsigned int proc);
00093 };
00094 
00095 inline int TDParallel::is_interface() {
00096   return m_interface;
00097 }
00098 
00099 inline DLIList<int>* TDParallel::get_local_body_list() {
00100   return &m_localBodyList;
00101 }
00102 
00103 inline DLIList<int>* TDParallel::get_non_local_body_list() {
00104   return &m_nonLocalBodyList;
00105 }
00106 
00107 inline DLIList<int>* TDParallel::get_shared_proc_list() {
00108   return &m_sharedProcList;
00109 }
00110 
00111 inline DLIList<int>* TDParallel::get_ghost_proc_list() {
00112   return &m_ghostProcList;
00113 }
00114 
00115 inline unsigned int TDParallel::get_charge_proc()
00116 {
00117   return m_sharedProcList[0];
00118 }
00119 
00120 inline void TDParallel::set_charge_proc(unsigned int proc)
00121 {
00122   m_sharedProcList.insert_first(proc);
00123 }
00124 
00125 inline unsigned int TDParallel::get_counter_proc()
00126 {
00127   return m_sharedProcList[1];
00128 }
00129 
00130 inline void TDParallel::set_counter_proc(unsigned int proc)
00131 {
00132   m_sharedProcList.append(proc);
00133 }
00134 
00135 inline unsigned int TDParallel::get_unique_id()
00136 {
00137   return m_uniqueId;
00138 }
00139 
00140 inline void TDParallel::set_unique_id(unsigned int id)
00141 {
00142    m_uniqueId = id;
00143 }
00144 
00145 inline unsigned int TDParallel::get_n_shared_procs()
00146 {
00147   return m_sharedProcList.size();
00148 }
00149 
00150 inline void TDParallel::add_shared_proc(unsigned int proc)
00151 {
00152   m_sharedProcList.append_unique(proc);
00153 }
00154 
00155 inline void TDParallel::add_ghost_proc(unsigned int proc)
00156 {
00157   if (proc != get_charge_proc()) {
00158     m_ghostProcList.append_unique(proc);
00159   }
00160 }
00161 
00162 inline bool TDParallel::is_shared_proc(unsigned int p)
00163 {
00164   return m_sharedProcList.is_in_list(p);
00165 }
00166 
00167 #endif 
00168 
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177 
00178 
00179 
00180 
00181 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines