Changeset 3269

Show
Ignore:
Timestamp:
11/03/09 10:05:07 (4 months ago)
Author:
kraftche
Message:

o Move vector of CGMParallelComm instances from member of CGMTagManager

to static member of CGMParallelComm

o Remove all dependencies on CGMTagManager from geom/parallel code

o Remove some unnecessary #includes and unused definitions

Location:
cgm/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • cgm/trunk/geom/parallel/CGMParallelComm.cpp

    r3267 r3269  
    11#include "CGMParallelComm.hpp" 
    2 //#include "CubitAttrib.hpp" 
    3 //#include "OCCQueryEngine.hpp" 
    42#include "TopologyEntity.hpp" 
    53#include "GeometryQueryEngine.hpp" 
    64#include "RefEntity.hpp" 
    7  
    8 //#include <iostream> 
    9 #include <sstream> 
    10 #include <algoritm> 
    11  
    12 #ifdef USE_MPI 
    13 #include "CGMmpi.h" 
    14 #endif 
     5#include "GeometryQueryTool.hpp" 
     6 
     7#include <algorithm> 
    158 
    169#define INITIAL_BUFF_SIZE 1024 
     
    2114    return result;} 
    2215 
    23 CGMParallelComm::CGMParallelComm(CGMTagManager *impl, 
    24                                  MPI_Comm comm, int* id ) 
    25   : cgmImpl(impl), procConfig(comm) 
     16std::vector<CGMParallelComm*> CGMParallelComm::instanceList; 
     17 
     18CGMParallelComm::CGMParallelComm(MPI_Comm comm, int* id ) 
     19  : procConfig(comm) 
    2620{ 
    2721  myBuffer.resize(INITIAL_BUFF_SIZE); 
     
    4640} 
    4741 
    48 CGMParallelComm::CGMParallelComm(CGMTagManager *impl, 
    49                                  std::vector<unsigned char> &tmp_buff,  
     42CGMParallelComm::CGMParallelComm(std::vector<unsigned char> &tmp_buff,  
    5043                                 MPI_Comm comm, 
    5144                                 int* id)  
    52   : cgmImpl(impl), procConfig(comm) 
     45  : procConfig(comm) 
    5346{ 
    5447  myBuffer.swap(tmp_buff); 
     
    8073int CGMParallelComm::add_pcomm(CGMParallelComm *pc)  
    8174{ 
    82   // add this pcomm to instance tag 
    83   std::vector<CGMParallelComm *> pc_array; 
    84   pc_array = cgmImpl->get_pc_array(); 
    85   pc_array.push_back(pc); 
    86  
    87   return pc_array.size() - 1; 
     75  instanceList.push_back(pc); 
     76  return instanceList.size() - 1; 
    8877} 
    8978 
    9079void CGMParallelComm::remove_pcomm(CGMParallelComm *pc)  
    9180{ 
    92   // remove this pcomm from instance tag 
    93   std::vector<CGMParallelComm *> pc_array; 
    94   pc_array = cgmImpl->get_pc_array(); 
    95  
    9681  std::vector<CGMParallelComm*>::iterator pc_it =  
    97     std::find(pc_array.begin(), pc_array.end(), pc); 
    98   assert(pc_it != pc_array.end()); 
    99   pc_array.erase(pc_it); 
     82    std::find(instanceList.begin(), instanceList.end(), pc); 
     83  assert(pc_it != instanceList.end()); 
     84  instanceList.erase(pc_it); 
    10085} 
    10186 
    10287//! get the indexed pcomm object from the interface 
    103 CGMParallelComm *CGMParallelComm::get_pcomm(CGMTagManager *impl, 
    104                                             const int index)  
     88CGMParallelComm *CGMParallelComm::get_pcomm(const int index)  
    10589 
    106   std::vector<CGMParallelComm *> pc_array; 
    107   pc_array = impl->get_pc_array(); 
    108  
    109   if (pc_array.size() < (unsigned int) (index + 1)) return NULL; 
    110   else return pc_array[index]; 
    111 } 
    112  
    113 CubitStatus CGMParallelComm::get_all_pcomm(CGMTagManager *impl, 
    114                                            std::vector<CGMParallelComm*>& list ) 
    115 { 
    116   list = impl->get_pc_array(); 
     90  if (instanceList.size() < (unsigned int) (index + 1)) return NULL; 
     91  else return instanceList[index]; 
     92} 
     93 
     94CubitStatus CGMParallelComm::get_all_pcomm(std::vector<CGMParallelComm*>& list ) 
     95{ 
     96  list = instanceList; 
    11797  return CUBIT_SUCCESS; 
    11898} 
     
    120100 
    121101//! get the indexed pcomm object from the interface 
    122 CGMParallelComm *CGMParallelComm::get_pcomm(CGMTagManager *impl, 
    123                                             //MBEntityHandle prtn, 
     102CGMParallelComm *CGMParallelComm::get_pcomm(//MBEntityHandle prtn, 
    124103                                            const MPI_Comm* comm )  
    125104{ 
     
    140119  //rval = impl->tag_get_data( prtn_tag, &prtn, 1, &pcomm_id ); 
    141120  //if (MB_SUCCESS == rval) { 
    142     result= get_pcomm(impl,  
    143                       pcomm_id ); 
     121    result= get_pcomm( pcomm_id ); 
    144122    //} 
    145123    /* 
  • cgm/trunk/geom/parallel/CGMParallelComm.hpp

    r3263 r3269  
    1111#define CGM_PARALLEL_COMM_HPP 
    1212 
    13 //#include "CGMForward.hpp" 
    14 #include "GeometryQueryTool.hpp" 
    15 //#include "CGMRange.hpp" 
    1613#include "CGMProcConfig.hpp" 
    17 #include "CATag.hpp" 
    18 #include <map> 
    19 #include <set> 
     14#include "CGMmpi.h" 
     15#include "DLIList.hpp" 
    2016#include <vector> 
    21 #include "math.h" 
    22 #include "CGMmpi.h" 
    2317 
    24  
    25 extern "C" { 
    26   struct tuple_list; 
    27 } 
    28  
    29 //class TagServer; 
    30 //class SequenceManager; 
    31 //template <typename KeyType, typename ValType, ValType NullVal> class RangeMap; 
    32 //typedef RangeMap<CGMEntityHandle, CGMEntityHandle, 0> HandleMap; 
    33  
    34 #define MAX_SHARING_PROCS 64 
     18class GeometryQueryTool; 
     19class RefEntity; 
    3520 
    3621class CGMParallelComm  
     
    3924 
    4025    //! constructor 
    41   CGMParallelComm(CGMTagManager *impl, 
    42                   MPI_Comm comm = MPI_COMM_WORLD, 
     26  CGMParallelComm(MPI_Comm comm = MPI_COMM_WORLD, 
    4327                  int* pcomm_id_out = 0); 
    4428   
    4529  //! constructor taking buffer, for testing 
    46   CGMParallelComm(CGMTagManager *impl, 
    47                   std::vector<unsigned char> &tmp_buff, 
     30  CGMParallelComm(std::vector<unsigned char> &tmp_buff, 
    4831                  MPI_Comm comm = MPI_COMM_WORLD, 
    4932                  int* pcomm_id_out = 0); 
     
    5336 
    5437    //! get the indexed pcomm object from the interface 
    55   static CGMParallelComm *get_pcomm(CGMTagManager *impl, 
    56                                     const int index); 
     38  static CGMParallelComm *get_pcomm(const int index); 
    5739   
    5840    //! Get CGMParallelComm instance associated with partition handle 
    5941    //! Will create CGMParallelComm instance if a) one does not already 
    6042    //! exist and b) a valid value for MPI_Comm is passed. 
    61   static CGMParallelComm *get_pcomm(CGMTagManager *impl, 
    62                                     //CGMEntityHandle partitioning, 
     43  static CGMParallelComm *get_pcomm(//CGMEntityHandle partitioning, 
    6344                                    const MPI_Comm* comm = 0 ); 
    6445 
    65   static CubitStatus get_all_pcomm(CGMTagManager *impl, 
    66                                    std::vector<CGMParallelComm*>& list ); 
     46  static CubitStatus get_all_pcomm(std::vector<CGMParallelComm*>& list ); 
    6747   
    6848  //! destructor 
     
    130110private:   
    131111 
     112  static std::vector<CGMParallelComm*> instanceList; 
     113 
    132114    //! add a pc to the iface instance tag PARALLEL_COMM 
    133   int add_pcomm(CGMParallelComm *pc); 
     115  static int add_pcomm(CGMParallelComm *pc); 
    134116   
    135117    //! remove a pc from the iface instance tag PARALLEL_COMM 
    136   void remove_pcomm(CGMParallelComm *pc); 
     118  static void remove_pcomm(CGMParallelComm *pc); 
    137119 
    138120  CubitStatus check_size(int& target_size, const CubitBoolean keep = CUBIT_FALSE); 
     
    141123  GeometryQueryTool *gqt; 
    142124 
    143     //! CGM tag manager interface associated with this writer 
    144   CGMTagManager *cgmImpl; 
    145  
    146125    //! Proc config object, keeps info on parallel stuff 
    147126  CGMProcConfig procConfig; 
    148  
    149     //! Tag server, so we can get more info about tags 
    150   //TagServer *tagServer; 
    151  
    152     //! Sequence manager, to get more efficient access to entities 
    153   //SequenceManager *sequenceManager; 
    154    
    155127   
    156128    //! data buffer used to communicate 
     
    162134   
    163135  int m_currentPosition; 
    164  
    165   //std::ofstream mOfstream; 
    166  
    167     //! more data buffers, proc-specific 
    168   //std::vector<unsigned char> ownerRBuffs[MAX_SHARING_PROCS], 
    169   //ownerSBuffs[MAX_SHARING_PROCS], ghostRBuffs[MAX_SHARING_PROCS], 
    170   // ghostSBuffs[MAX_SHARING_PROCS]; 
    171  
    172     //! request objects, may be used if store_remote_handles is used 
    173   //MPI_Request sendReqs[2*MAX_SHARING_PROCS]; 
    174  
    175     //! processor rank for each buffer index 
    176   //std::vector<int> buffProcs; 
    177  
    178     //! the partition, interface sets for this comm'n instance 
    179   //CGMRange partitionSets, interfaceSets; 
    180    
    181     //! local entities ghosted to other procs 
    182   //std::map<unsigned int, CGMRange> ghostedEnts; 
    183    
    184     //! tags used to save sharing procs and handles 
    185   //CGMTag sharedpTag, sharedpsTag, sharedhTag, sharedhsTag, pstatusTag,  
    186   //ifaceSetsTag, partitionTag; 
    187      
    188   //int globalPartCount; //!< Cache of global part count 
    189136   
    190137  //CGMEntityHandle partitioningSet; //!< entity set containing all parts 
  • cgm/trunk/geom/parallel/ParallelGeomTool.cpp

    r3108 r3269  
    1313#include "ParallelGeomTool.hpp" 
    1414#include "CGMParallelConventions.h" 
    15 #include "CATag.hpp" 
    1615#include "CGMParallelComm.hpp" 
    1716 
     
    4645//ParallelGeomTool *ParallelGeomTool::instance_ = NULL; 
    4746 
    48 ParallelGeomTool::ParallelGeomTool(CGMTagManager* impl, CGMParallelComm *pc) 
    49   : cgmImpl(impl), myPcomm(pc)  
     47ParallelGeomTool::ParallelGeomTool(CGMParallelComm *pc) 
     48  : myPcomm(pc)  
    5049{ 
    5150  if (!myPcomm) { 
    52     myPcomm = CGMParallelComm::get_pcomm(impl, 0); 
    53     if (NULL == myPcomm) myPcomm = new CGMParallelComm(cgmImpl); 
     51    myPcomm = CGMParallelComm::get_pcomm(0); 
     52    if (NULL == myPcomm) myPcomm = new CGMParallelComm(); 
    5453  } 
    5554  //gqt = GeometryQueryTool::instfance(); 
  • cgm/trunk/geom/parallel/ParallelGeomTool.hpp

    r3108 r3269  
    55#include "CubitDefines.h" 
    66#include "CGMParallelComm.hpp" 
    7 //#include "ProcData.hpp" 
    87#include "FileOptions.hpp" 
    9 //#include "CATag.hpp" 
    10 //#include "CGMParallelComm.hpp" 
    11  
    12 //class CGMTagManager; 
    13 //class CGMParallelComm; 
    148 
    159class ParallelGeomTool  
     
    1711public: 
    1812 
    19   ParallelGeomTool(CGMTagManager* impl = NULL, CGMParallelComm *pc = NULL); 
     13  ParallelGeomTool(CGMParallelComm *pc = NULL); 
    2014 
    2115  //static ParallelGeomTool *instance(); 
     
    7165  //static ParallelGeomTool *instance_; 
    7266 
    73   CGMTagManager *cgmImpl; 
    74  
    7567  // each reader can keep track of its own pcomm 
    7668  CGMParallelComm *myPcomm; 
  • cgm/trunk/itaps/CATag.hpp

    r3108 r3269  
    4343class RefGroup; 
    4444class CATag; 
    45 class CGMParallelComm; 
    4645 
    4746class CGMTagManager  
     
    118117  } 
    119118 
    120   inline std::vector<CGMParallelComm*>& get_pc_array() { return pc_array; } 
    121  
    122119private: 
    123120  CGMTagManager(); 
     
    132129  static const char *CATag_NAME_INTERNAL; 
    133130  RefGroup *interfaceGroup; 
    134  
    135   // list of parallel comm 
    136   std::vector<CGMParallelComm*> pc_array; 
    137131 
    138132  bool getPresetTagData(const RefEntity *entity, const long tag_num,