Changeset 1109


Ignore:
Timestamp:
05/02/17 16:20:47 (4 years ago)
Author:
yushan
Message:

test_omp OK

Location:
XIOS/dev/branch_yushan
Files:
1 added
15 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan/bld.cfg

    r1081 r1109  
    3636#bld::target test_remap.exe 
    3737#bld::target test_new_features.exe test_unstruct_complete.exe  
    38 bld::target test_omp.exe test_client.exe #test_complete.exe  
     38bld::target test_omp.exe test_client.exe test_complete.exe test_complete_omp.exe 
    3939bld::exe_dep 
    4040 
  • XIOS/dev/branch_yushan/src/interface/c/icdata.cpp

    r1095 r1109  
    131131      
    132132     CContext* context = CContext::getCurrent(); 
    133      printf("Check : CContext::getCurrent() = %p\n", CContext::getCurrent()); 
     133     //printf("Check : CContext::getCurrent() = %p\n", CContext::getCurrent()); 
    134134     context->finalize(); 
    135135           
  • XIOS/dev/branch_yushan/src/node/axis.cpp

    r1103 r1109  
    4444   { /* Ne rien faire de plus */ } 
    4545 
    46    std::map<StdString, ETranformationType> CAxis::transformationMapList_ = std::map<StdString, ETranformationType>(); 
    47     
    48    std::map<StdString, ETranformationType> *CAxis::transformationMapList_ptr = new std::map<StdString, ETranformationType>(); 
    49     
    50    bool CAxis::dummyTransformationMapList_ = CAxis::initializeTransformationMap(CAxis::transformationMapList_); 
    51    //bool CAxis::dummyTransformationMapList_ = CAxis::initializeTransformationMap(*CAxis::transformationMapList_ptr); 
     46   //std::map<StdString, ETranformationType> CAxis::transformationMapList_ = std::map<StdString, ETranformationType>(); 
     47   //bool CAxis::dummyTransformationMapList_ = CAxis::initializeTransformationMap(CAxis::transformationMapList_); 
     48 
     49   std::map<StdString, ETranformationType> *CAxis::transformationMapList_ptr = 0; //new std::map<StdString, ETranformationType>();   
     50   //bool CAxis::dummyTransformationMapList_ = CAxis::initializeTransformationMap(CAxis::transformationMapList_ptr); 
    5251 
    5352   bool CAxis::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 
     
    5857     m["reduce_domain"] = TRANS_REDUCE_DOMAIN_TO_AXIS; 
    5958     m["extract_domain"] = TRANS_EXTRACT_DOMAIN_TO_AXIS; 
    60       
    61      // m.insert(m.end(), make_pair("zoom_axis", TRANS_ZOOM_AXIS)); printf("zoom_axis insert\n"); 
    62      // m.insert(m.end(), make_pair("interpolate_axis", TRANS_INTERPOLATE_AXIS)); printf("interpolate_axis insert\n"); 
    63      // m.insert(m.end(), make_pair("inverse_axis", TRANS_INVERSE_AXIS)); printf("inverse_axis insert\n"); 
    64      // m.insert(m.end(), make_pair("reduce_domain", TRANS_REDUCE_DOMAIN_TO_AXIS)); printf("reduce_domain insert\n"); 
    65      // m.insert(m.end(), make_pair("extract_domain", TRANS_EXTRACT_DOMAIN_TO_AXIS)); printf("extract_domain insert\n"); 
    66    } 
     59   } 
     60 
     61 
     62   bool CAxis::initializeTransformationMap() 
     63   { 
     64     if(CAxis::transformationMapList_ptr == 0) CAxis::transformationMapList_ptr = new std::map<StdString, ETranformationType>(); 
     65     (*CAxis::transformationMapList_ptr)["zoom_axis"]        = TRANS_ZOOM_AXIS; 
     66     (*CAxis::transformationMapList_ptr)["interpolate_axis"] = TRANS_INTERPOLATE_AXIS; 
     67     (*CAxis::transformationMapList_ptr)["inverse_axis"]     = TRANS_INVERSE_AXIS; 
     68     (*CAxis::transformationMapList_ptr)["reduce_domain"]    = TRANS_REDUCE_DOMAIN_TO_AXIS; 
     69     (*CAxis::transformationMapList_ptr)["extract_domain"]   = TRANS_EXTRACT_DOMAIN_TO_AXIS; 
     70   } 
     71 
    6772 
    6873   ///--------------------------------------------------------------- 
     
    10151020 
    10161021        nodeElementName = node.getElementName(); 
    1017         std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_.end(), it; 
    1018         it = transformationMapList_.find(nodeElementName); 
     1022 
     1023        if(transformationMapList_ptr == 0) initializeTransformationMap(); 
     1024        //transformationMapList_ptr = new std::map<StdString, ETranformationType>(); 
     1025 
     1026        std::map<StdString, ETranformationType>::const_iterator ite = (*CAxis::transformationMapList_ptr).end(), it; 
     1027        it = (*CAxis::transformationMapList_ptr).find(nodeElementName); 
    10191028        if (ite != it) 
    10201029        { 
     
    10381047 
    10391048} // namespace xios 
     1049 
  • XIOS/dev/branch_yushan/src/node/axis.hpp

    r1103 r1109  
    166166       private: 
    167167         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 
    168           
    169          static std::map<StdString, ETranformationType> transformationMapList_; 
     168         //static bool initializeTransformationMap(std::map<StdString, ETranformationType>* m); 
     169         static bool initializeTransformationMap(); 
     170 
     171         //static std::map<StdString, ETranformationType> transformationMapList_; 
    170172          
    171173         static std::map<StdString, ETranformationType> *transformationMapList_ptr; 
    172174         #pragma omp threadprivate(transformationMapList_ptr) 
    173175 
    174          static bool dummyTransformationMapList_; 
    175          #pragma omp threadprivate(dummyTransformationMapList_) 
     176         //static bool dummyTransformationMapList_; 
     177         //#pragma omp threadprivate(dummyTransformationMapList_) 
    176178 
    177179         DECLARE_REF_FUNC(Axis,axis) 
     
    185187 
    186188#endif // __XIOS_CAxis__ 
     189 
  • XIOS/dev/branch_yushan/src/node/domain.cpp

    r1095 r1109  
    6565   } 
    6666 
    67    std::map<StdString, ETranformationType> CDomain::transformationMapList_ = std::map<StdString, ETranformationType>(); 
    68    bool CDomain::_dummyTransformationMapList = CDomain::initializeTransformationMap(CDomain::transformationMapList_); 
     67   //std::map<StdString, ETranformationType> CDomain::transformationMapList_ = std::map<StdString, ETranformationType>(); 
     68   //bool CDomain::_dummyTransformationMapList = CDomain::initializeTransformationMap(CDomain::transformationMapList_); 
     69 
     70   std::map<StdString, ETranformationType> *CDomain::transformationMapList_ptr = 0; 
    6971 
    7072   bool CDomain::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 
     
    7678     m["expand_domain"] = TRANS_EXPAND_DOMAIN; 
    7779   } 
     80 
     81   bool CDomain::initializeTransformationMap() 
     82   { 
     83     CDomain::transformationMapList_ptr = new std::map<StdString, ETranformationType>(); 
     84     (*CDomain::transformationMapList_ptr)["zoom_domain"] = TRANS_ZOOM_DOMAIN; 
     85     (*CDomain::transformationMapList_ptr)["interpolate_domain"] = TRANS_INTERPOLATE_DOMAIN; 
     86     (*CDomain::transformationMapList_ptr)["generate_rectilinear_domain"] = TRANS_GENERATE_RECTILINEAR_DOMAIN; 
     87     (*CDomain::transformationMapList_ptr)["compute_connectivity_domain"] = TRANS_COMPUTE_CONNECTIVITY_DOMAIN; 
     88     (*CDomain::transformationMapList_ptr)["expand_domain"] = TRANS_EXPAND_DOMAIN; 
     89   } 
     90 
    7891 
    7992   const std::set<StdString> & CDomain::getRelFiles(void) const 
     
    21892202 
    21902203        nodeElementName = node.getElementName(); 
    2191         std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_.end(), it; 
    2192         it = transformationMapList_.find(nodeElementName); 
     2204        if(transformationMapList_ptr == 0) initializeTransformationMap(); 
     2205        std::map<StdString, ETranformationType>::const_iterator ite = (*transformationMapList_ptr).end(), it; 
     2206        it = (*transformationMapList_ptr).find(nodeElementName); 
    21932207        if (ite != it) 
    21942208        { 
  • XIOS/dev/branch_yushan/src/node/domain.hpp

    r1095 r1109  
    211211       private: 
    212212         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 
    213          static std::map<StdString, ETranformationType> transformationMapList_; 
    214          static bool _dummyTransformationMapList; 
     213         static bool initializeTransformationMap(); 
     214         //static std::map<StdString, ETranformationType> transformationMapList_; 
     215  
     216         static std::map<StdString, ETranformationType> *transformationMapList_ptr; 
     217         #pragma omp threadprivate(transformationMapList_ptr) 
     218 
     219         //static bool _dummyTransformationMapList; 
    215220         //#pragma omp threadprivate(_dummyTransformationMapList) 
    216221 
  • XIOS/dev/branch_yushan/src/node/mesh.cpp

    r1053 r1109  
    3434  std::map <StdString, vector<int> > CMesh::domainList = std::map <StdString, vector<int> >(); 
    3535 
     36  std::map <StdString, CMesh> *CMesh::meshList_ptr = 0; 
     37  std::map <StdString, vector<int> > *CMesh::domainList_ptr = 0; 
     38 
     39 
    3640///--------------------------------------------------------------- 
    3741/*! 
     
    4145 * \param [in] nvertex Number of verteces (1 for nodes, 2 for edges, 3 and up for faces). 
    4246 */ 
     47 
     48/* bkp 
    4349  CMesh* CMesh::getMesh (StdString meshName, int nvertex) 
    4450  { 
     
    6470      CMesh::meshList.insert( make_pair(meshName, newMesh) ); 
    6571      return &meshList[meshName]; 
     72    } 
     73  } 
     74*/ 
     75 
     76  CMesh* CMesh::getMesh (StdString meshName, int nvertex) 
     77  { 
     78    if(CMesh::domainList_ptr == NULL) CMesh::domainList_ptr = new std::map <StdString, vector<int> >(); 
     79    if(CMesh::meshList_ptr == NULL)   CMesh::meshList_ptr   = new std::map <StdString, CMesh>(); 
     80 
     81    (*CMesh::domainList_ptr)[meshName].push_back(nvertex); 
     82 
     83    if ( (*CMesh::meshList_ptr).begin() != (*CMesh::meshList_ptr).end() ) 
     84    { 
     85      for (std::map<StdString, CMesh>::iterator it=(*CMesh::meshList_ptr).begin(); it!=(*CMesh::meshList_ptr).end(); ++it) 
     86      { 
     87        if (it->first == meshName) 
     88          return &((*CMesh::meshList_ptr)[meshName]); 
     89        else 
     90        { 
     91          CMesh newMesh; 
     92          (*CMesh::meshList_ptr).insert( make_pair(meshName, newMesh) ); 
     93          return &((*CMesh::meshList_ptr)[meshName]); 
     94        } 
     95      } 
     96    } 
     97    else 
     98    { 
     99      CMesh newMesh; 
     100      (*CMesh::meshList_ptr).insert( make_pair(meshName, newMesh) ); 
     101      return &((*CMesh::meshList_ptr)[meshName]); 
    66102    } 
    67103  } 
  • XIOS/dev/branch_yushan/src/node/mesh.hpp

    r1053 r1109  
    8282      static std::map <StdString, CMesh> meshList; 
    8383      static std::map <StdString, vector<int> > domainList; 
     84 
     85      static std::map <StdString, CMesh> *meshList_ptr; 
     86      static std::map <StdString, vector<int> > *domainList_ptr; 
     87      #pragma omp threadprivate(meshList_ptr, domainList_ptr) 
     88    
    8489      CClientClientDHTSizet* pNodeGlobalIndex;                    // pointer to a map <nodeHash, nodeIdxGlo> 
    8590      CClientClientDHTSizet* pEdgeGlobalIndex;                    // pointer to a map <edgeHash, edgeIdxGlo> 
  • XIOS/dev/branch_yushan/src/node/scalar.cpp

    r976 r1109  
    2727   { /* Ne rien faire de plus */ } 
    2828 
    29    std::map<StdString, ETranformationType> CScalar::transformationMapList_ = std::map<StdString, ETranformationType>(); 
    30    bool CScalar::dummyTransformationMapList_ = CScalar::initializeTransformationMap(CScalar::transformationMapList_); 
     29   //std::map<StdString, ETranformationType> CScalar::transformationMapList_ = std::map<StdString, ETranformationType>(); 
     30   //bool CScalar::dummyTransformationMapList_ = CScalar::initializeTransformationMap(CScalar::transformationMapList_); 
     31 
     32   std::map<StdString, ETranformationType> *CScalar::transformationMapList_ptr = 0; 
     33    
    3134   bool CScalar::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 
    3235   { 
     
    3437     m["extract_axis"]  = TRANS_EXTRACT_AXIS_TO_SCALAR; 
    3538     m["reduce_domain"] = TRANS_REDUCE_DOMAIN_TO_SCALAR; 
     39   } 
     40 
     41   bool CScalar::initializeTransformationMap() 
     42   { 
     43     CScalar::transformationMapList_ptr = new std::map<StdString, ETranformationType>(); 
     44     (*CScalar::transformationMapList_ptr)["reduce_axis"]   = TRANS_REDUCE_AXIS_TO_SCALAR; 
     45     (*CScalar::transformationMapList_ptr)["extract_axis"]  = TRANS_EXTRACT_AXIS_TO_SCALAR; 
     46     (*CScalar::transformationMapList_ptr)["reduce_domain"] = TRANS_REDUCE_DOMAIN_TO_SCALAR; 
    3647   } 
    3748 
     
    147158 
    148159        nodeElementName = node.getElementName(); 
    149         std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_.end(), it; 
    150         it = transformationMapList_.find(nodeElementName); 
     160        if(CScalar::transformationMapList_ptr == 0) initializeTransformationMap(); 
     161        std::map<StdString, ETranformationType>::const_iterator ite = (*CScalar::transformationMapList_ptr).end(), it; 
     162        it = (*CScalar::transformationMapList_ptr).find(nodeElementName); 
    151163        if (ite != it) 
    152164        { 
  • XIOS/dev/branch_yushan/src/node/scalar.hpp

    r1072 r1109  
    8787       private: 
    8888           static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 
    89            static std::map<StdString, ETranformationType> transformationMapList_; 
    90            static bool dummyTransformationMapList_; 
    91            //#pragma omp threadprivate(dummyTransformationMapList_) 
     89           static bool initializeTransformationMap(); 
     90            
     91           //static std::map<StdString, ETranformationType> transformationMapList_; 
     92           //static bool dummyTransformationMapList_; 
     93 
     94           static std::map<StdString, ETranformationType> *transformationMapList_ptr; 
     95           #pragma omp threadprivate(transformationMapList_ptr) 
    9296 
    9397 
  • XIOS/dev/branch_yushan/src/node/transformation.hpp

    r1072 r1109  
    5151  { 
    5252    int transTypeInt = transType; 
     53 
    5354    typename CallBackMap::const_iterator it = (*transformationCreationCallBacks_).find(transType); 
    5455    if ((*transformationCreationCallBacks_).end() == it) 
  • XIOS/dev/branch_yushan/src/test/test_complete.f90

    r1069 r1109  
    55  IMPLICIT NONE 
    66  INCLUDE "mpif.h" 
    7   INTEGER :: rank 
     7  INTEGER :: rank, size 
    88  INTEGER :: size_loc 
    99  INTEGER :: ierr 
     
    2828  INTEGER, ALLOCATABLE :: kindex(:) 
    2929  INTEGER :: ni,ibegin,iend,nj,jbegin,jend 
    30   INTEGER :: i,j,l,ts,n, nb_pt 
     30  INTEGER :: i,j,l,ts,n, nb_pt, provided 
    3131 
    3232!!! MPI Initialization 
    3333 
    34   CALL MPI_INIT(ierr) 
    35  
    36   CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr)   
     34  CALL MPI_INIT_THREAD(3, provided, ierr) 
     35    if(provided .NE. 3) then 
     36      print*, "provided thread level = ", provided 
     37      call MPI_Abort() 
     38    endif  
    3739 
    3840   
     
    4042  CALL init_wait 
    4143 
    42   if (rank <2) then 
     44  CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr) 
     45  CALL MPI_COMM_SIZE(MPI_COMM_WORLD,size,ierr) 
     46  if(rank < size-1) then 
    4347 
    4448!!! XIOS Initialization (get the local communicator) 
     
    8690 
    8791  CALL xios_context_initialize("atmosphere",comm) 
    88 !   print*, "init context atmosphere comm = ", comm 
    8992 
    9093  CALL xios_get_handle("atmosphere",ctx_hdl) 
     
    9699 
    97100  CALL xios_set_axis_attr("axis_atm",n_glo=llm ,value=lval) ; 
    98 !  CALL xios_set_zoom_axis_attr("axis_atm_zoom",n=2); 
    99101 
    100102  CALL xios_set_domain_attr("domain_atm",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj, type='curvilinear') 
     
    105107  CALL xios_set_domain_attr("domain_atm_zoom",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4) 
    106108  CALL xios_set_domain_attr("domain_atm_zoom",lonvalue_2D=lon,latvalue_2D=lat) 
    107 !  CALL xios_set_zoom_domain_attr("domain_atm_zoom",ibegin=39, ni=20, jbegin=39, nj=5) 
     109 
    108110 
    109111!!! Activation du groupe field_definition 
     
    143145  CALL xios_close_context_definition() 
    144146 
    145 !   print *, "xios_close_context_definition(atmosphere)" 
     147   print *, "xios_close_context_definition(atmosphere)" 
    146148 
    147149!!! Test des valeurs des champs/fichiers 
     
    180182 
    181183  CALL xios_context_initialize("surface",comm) 
    182 !   print*, "init context surface comm = ", comm 
     184 
    183185 
    184186  CALL xios_get_handle("surface",ctx_hdl) 
     
    227229  CALL xios_close_context_definition() 
    228230 
    229 !  print *, "xios_close_context_definition(surface)"  
     231  print *, "xios_close_context_definition(surface)"  
    230232 
    231233 
     
    266268    ENDDO 
    267269 
    268 !     print *, "end temporal loop" 
     270     print *, "end temporal loop" 
    269271 
    270272!#################################################################################### 
     
    274276!!! Fin des contextes 
    275277 
    276     !print *, "start : xios_context_finalize(surface)" 
    277278 
    278279    CALL xios_get_handle("surface",ctx_hdl)  
    279     !print *, "xios_get_handle (surface) OK" 
     280 
    280281    CALL xios_set_current_context(ctx_hdl) 
    281     !print *, "xios_set_current_context (surface) OK" 
     282 
    282283    CALL xios_context_finalize() 
    283284 
    284 !     print *, "xios_context_finalize(surface)"  
     285    print *, "xios_context_finalize(surface)"  
    285286 
    286287     CALL xios_get_handle("atmosphere",ctx_hdl) 
    287 !     !print *, "xios_get_handle (atmosphere) OK" 
     288 
    288289     CALL xios_set_current_context(ctx_hdl) 
    289 !     !print *, "xios_set_current_context (atmosphere) OK" 
     290 
    290291     CALL xios_context_finalize() 
    291292 
    292 !     print *, "xios_context_finalize(atmosphere)" 
     293     print *, "xios_context_finalize(atmosphere)" 
     294 
     295     
     296 
     297!!! Fin de XIOS 
     298 
     299     
     300 
     301    CALL xios_finalize() 
    293302 
    294303    DEALLOCATE(lon, lat, field_A_atm, lonvalue) 
    295    ! DEALLOCATE(kindex, field_A_srf) 
    296  
    297 !!! Fin de XIOS 
     304    DEALLOCATE(kindex, field_A_srf) 
     305 
     306     print *, "Client : xios_finalize " 
    298307 
    299308    CALL MPI_COMM_FREE(comm, ierr) 
    300309 
    301     CALL xios_finalize() 
    302  
    303      print *, "Client : xios_finalize " 
    304  
    305   else  
     310  else 
     311 
    306312    CALL xios_init_server 
    307  
    308313    print *, "Server : xios_finalize " 
    309   endif 
     314   
     315    endif 
     316 
    310317 
    311318    CALL MPI_FINALIZE(ierr) 
  • XIOS/dev/branch_yushan/src/test/test_omp.f90

    r1102 r1109  
    4444 
    4545    CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr) 
    46     if(rank < 2) then 
     46    CALL MPI_COMM_SIZE(MPI_COMM_WORLD,size,ierr) 
     47    if(rank < size-1) then 
    4748 
    4849    !$omp parallel default(private) 
     
    100101    CALL xios_set_domain_attr("domain_A",lonvalue_2D=lon,latvalue_2D=lat) 
    101102    CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.) 
    102 !     print*, "test block OK", rank, size 
     103     print*, "test block OK", rank, size 
    103104 
    104 !   CALL xios_get_handle("field_definition",fieldgroup_hdl) 
    105 !   CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B") 
    106 !   CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B") 
     105    CALL xios_get_handle("field_definition",fieldgroup_hdl) 
     106    CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B") 
     107    CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B") 
    107108 
    108 !   CALL xios_get_handle("output",file_hdl) 
    109 !   CALL xios_add_child(file_hdl,field_hdl) 
    110 !   CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_C") 
     109    CALL xios_get_handle("output",file_hdl) 
     110    CALL xios_add_child(file_hdl,field_hdl) 
     111    CALL xios_set_attr(field_hdl,field_ref="field_A_zoom",name="field_C") 
    111112 
    112113    dtime%second = 3600 
     
    158159    print*, "xios_context_finalize OK", rank, size 
    159160 
     161    CALL xios_finalize() 
     162    print*, "xios finalize OK", rank, size 
     163 
     164    DEALLOCATE(lon, lat, field_A, lonvalue) 
    160165    !$omp master  
    161166    !call MPI_Barrier(comm) 
     
    167172     print*, "MPI_COMM_FREE OK", rank, size 
    168173 
    169     CALL xios_finalize() 
    170     print*, "xios finalize OK", rank, size 
    171  
    172     DEALLOCATE(lon, lat, field_A, lonvalue) 
    173174 
    174175 
  • XIOS/dev/branch_yushan/src/transformation/Functions/reduction.cpp

    r1103 r1109  
    1212std::map<StdString,EReductionType> *CReductionAlgorithm::ReductionOperations_ptr = 0;  
    1313 
    14 // bool CReductionAlgorithm::initReductionOperation(std::map<StdString,EReductionType>& m) 
    15 // { 
    16 //   // So so stupid way to intialize operation but it works ... 
    17 //   m["sum"] = TRANS_REDUCE_SUM; 
    18 //   CSumReductionAlgorithm::registerTrans(); 
    19  
    20 //   m["min"] = TRANS_REDUCE_MIN; 
    21 //   CMinReductionAlgorithm::registerTrans(); 
    22  
    23 //   m["max"] = TRANS_REDUCE_MAX; 
    24 //   CMaxReductionAlgorithm::registerTrans(); 
    25  
    26 //   m["extract"] = TRANS_REDUCE_EXTRACT; 
    27 //   CExtractReductionAlgorithm::registerTrans(); 
    28  
    29 //   m["average"] = TRANS_REDUCE_AVERAGE; 
    30 //   CAverageReductionAlgorithm::registerTrans(); 
    31 // } 
    32  
    33 bool CReductionAlgorithm::initReductionOperation(std::map<StdString,EReductionType>* m) 
     14bool CReductionAlgorithm::initReductionOperation(std::map<StdString,EReductionType>& m) 
    3415{ 
    35   if(m==NULL) m=new std::map<StdString,EReductionType>(); 
    3616  // So so stupid way to intialize operation but it works ... 
    37   (*m)["sum"] = TRANS_REDUCE_SUM; 
     17  m["sum"] = TRANS_REDUCE_SUM; 
    3818  CSumReductionAlgorithm::registerTrans(); 
    3919 
    40   (*m)["min"] = TRANS_REDUCE_MIN; 
     20  m["min"] = TRANS_REDUCE_MIN; 
    4121  CMinReductionAlgorithm::registerTrans(); 
    4222 
    43   (*m)["max"] = TRANS_REDUCE_MAX; 
     23  m["max"] = TRANS_REDUCE_MAX; 
    4424  CMaxReductionAlgorithm::registerTrans(); 
    4525 
    46   (*m)["extract"] = TRANS_REDUCE_EXTRACT; 
     26  m["extract"] = TRANS_REDUCE_EXTRACT; 
    4727  CExtractReductionAlgorithm::registerTrans(); 
    4828 
    49   (*m)["average"] = TRANS_REDUCE_AVERAGE; 
     29  m["average"] = TRANS_REDUCE_AVERAGE; 
     30  CAverageReductionAlgorithm::registerTrans(); 
     31} 
     32 
     33 
     34bool CReductionAlgorithm::initReductionOperation() 
     35{ 
     36  if(CReductionAlgorithm::ReductionOperations_ptr == NULL) CReductionAlgorithm::ReductionOperations_ptr = new std::map<StdString,EReductionType>(); 
     37  // So so stupid way to intialize operation but it works ... 
     38  (*CReductionAlgorithm::ReductionOperations_ptr)["sum"] = TRANS_REDUCE_SUM; 
     39  CSumReductionAlgorithm::registerTrans(); 
     40 
     41  (*CReductionAlgorithm::ReductionOperations_ptr)["min"] = TRANS_REDUCE_MIN; 
     42  CMinReductionAlgorithm::registerTrans(); 
     43 
     44  (*CReductionAlgorithm::ReductionOperations_ptr)["max"] = TRANS_REDUCE_MAX; 
     45  CMaxReductionAlgorithm::registerTrans(); 
     46 
     47  (*CReductionAlgorithm::ReductionOperations_ptr)["extract"] = TRANS_REDUCE_EXTRACT; 
     48  CExtractReductionAlgorithm::registerTrans(); 
     49 
     50  (*CReductionAlgorithm::ReductionOperations_ptr)["average"] = TRANS_REDUCE_AVERAGE; 
    5051  CAverageReductionAlgorithm::registerTrans(); 
    5152} 
    5253 
    5354//bool CReductionAlgorithm::_dummyInit = CReductionAlgorithm::initReductionOperation(CReductionAlgorithm::ReductionOperations); 
    54 bool CReductionAlgorithm::_dummyInit = CReductionAlgorithm::initReductionOperation(CReductionAlgorithm::ReductionOperations_ptr); 
     55bool CReductionAlgorithm::_dummyInit = CReductionAlgorithm::initReductionOperation(); 
    5556 
    5657CReductionAlgorithm* CReductionAlgorithm::createOperation(EReductionType reduceType) 
    5758{ 
    5859  int reduceTypeInt = reduceType; 
    59   if (0 == reductionCreationCallBacks_) 
    60     reductionCreationCallBacks_ = new CallBackMap(); 
     60  //if (0 == reductionCreationCallBacks_) 
     61  //  reductionCreationCallBacks_ = new CallBackMap(); 
    6162 
    6263  CallBackMap::const_iterator it = (*reductionCreationCallBacks_).find(reduceType); 
  • XIOS/dev/branch_yushan/src/transformation/Functions/reduction.hpp

    r1103 r1109  
    6767 
    6868protected: 
    69   //static bool initReductionOperation(std::map<StdString,EReductionType>& m); 
    70   static bool initReductionOperation(std::map<StdString,EReductionType>* m); 
     69  static bool initReductionOperation(std::map<StdString,EReductionType>& m); 
     70  static bool initReductionOperation(); 
    7171  static bool _dummyInit; 
    7272  #pragma omp threadprivate(_dummyInit) 
Note: See TracChangeset for help on using the changeset viewer.