Changeset 667


Ignore:
Timestamp:
08/24/15 14:53:33 (9 years ago)
Author:
mhnguyen
Message:

Clearing some redundant codes and add some comments

Test
No

Location:
XIOS/trunk/src/node
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/axis.cpp

    r666 r667  
    251251    int nbServer = client->serverSize; 
    252252    int range, clientSize = client->clientSize; 
     253 
    253254    size_t ni = this->n.getValue(); 
    254255    size_t ibegin = this->begin.getValue(); 
     256    size_t zoom_end = global_zoom_begin+global_zoom_size-1; 
     257    size_t nZoomCount = 0; 
     258    for (size_t idx = 0; idx < ni; ++idx) 
     259    { 
     260      size_t globalIndex = ibegin + idx; 
     261 
     262      if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) ++nZoomCount; 
     263    } 
    255264 
    256265    CArray<size_t,1> globalIndexAxis(ni); 
    257     int zoom_end = global_zoom_begin+global_zoom_size-1; 
    258     std::vector<size_t> globalAxisZoom; 
     266    std::vector<size_t> globalAxisZoom(nZoomCount); 
     267    nZoomCount = 0; 
    259268    for (size_t idx = 0; idx < ni; ++idx) 
    260269    { 
    261270      size_t globalIndex = ibegin + idx; 
    262271      globalIndexAxis(idx) = globalIndex; 
    263       if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) globalAxisZoom.push_back(globalIndex); 
     272      if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) 
     273      { 
     274        globalAxisZoom[nZoomCount]; 
     275        ++nZoomCount; 
     276      } 
    264277    } 
    265278 
  • XIOS/trunk/src/node/domain.cpp

    r666 r667  
    169169      else if (!i_index.isEmpty()) 
    170170      { 
    171         ibegin = i_index(0); 
     171        if (ibegin.isEmpty()) ibegin = i_index(0); 
    172172      } 
    173173 
     
    192192     else if (!j_index.isEmpty()) 
    193193     { 
    194        jbegin = j_index(0); 
     194       if (jbegin.isEmpty()) jbegin = j_index(0); 
    195195     } 
    196196 
     
    208208   void CDomain::checkMask(void) 
    209209   { 
    210       using namespace std; 
    211  
    212       int ibegin_mask = 0, 
    213           jbegin_mask = 0, 
    214           iend_mask = ibegin.getValue() + ni.getValue() - 1, 
    215           jend_mask = jbegin.getValue() + nj.getValue() - 1; 
    216  
    217210      if (!mask_1d.isEmpty() && !mask_2d.isEmpty()) 
    218211        ERROR("CDomain::checkMask(void)", 
     
    644637 
    645638   //---------------------------------------------------------------- 
    646    // Divide function checkAttributes into 2 seperate onescheckBounds 
     639   // Divide function checkAttributes into 2 seperate ones 
    647640   // This function only checks all attributes of current domain 
    648641   void CDomain::checkAttributesOnClient() 
     
    682675       if (hasLonLat || hasArea) sendLonLatArea(); 
    683676     } 
    684  
    685677     this->isChecked = true; 
    686678   } 
     
    877869  } 
    878870 
     871  /*! 
     872    Send index from client to server(s) 
     873  */ 
    879874  void CDomain::sendIndex() 
    880875  { 
     
    923918  } 
    924919 
     920  /*! 
     921    Send area from client to server(s) 
     922  */ 
    925923  void CDomain::sendArea() 
    926924  { 
     
    965963  } 
    966964 
     965  /*! 
     966    Send longitude and latitude from client to servers 
     967    Each client send long and lat information to corresponding connected server(s). 
     968    Because longitude and latitude are optional, this function only called if latitude and longitude exist 
     969  */ 
    967970  void CDomain::sendLonLat() 
    968971  { 
     
    10421045  } 
    10431046 
    1044  
     1047  /*! 
     1048    Send some optional information to server(s) 
     1049    In the future, this function can be extended with more optional information to send 
     1050  */ 
    10451051  void CDomain::sendLonLatArea(void) 
    10461052  { 
     
    10851091  } 
    10861092 
     1093  /*! 
     1094    Receive attributes event from clients(s) 
     1095    \param[in] event event contain info about rank and associated attributes 
     1096  */ 
    10871097  void CDomain::recvServerAttribut(CEventServer& event) 
    10881098  { 
     
    10931103  } 
    10941104 
     1105  /*! 
     1106    Receive attributes from client(s): zoom info and begin and n of each server 
     1107    \param[in] rank rank of client source 
     1108    \param[in] buffer message containing attributes info 
     1109  */ 
    10951110  void CDomain::recvServerAttribut(CBufferIn& buffer) 
    10961111  { 
     
    11301145  } 
    11311146 
     1147  /*! 
     1148    Receive index event from clients(s) 
     1149    \param[in] event event contain info about rank and associated index 
     1150  */ 
    11321151  void CDomain::recvIndex(CEventServer& event) 
    11331152  { 
     
    11421161  } 
    11431162 
     1163  /*! 
     1164    Receive index information from client(s) 
     1165    \param[in] rank rank of client source 
     1166    \param[in] buffer message containing index info 
     1167  */ 
    11441168  void CDomain::recvIndex(int rank, CBufferIn& buffer) 
    11451169  { 
     
    11491173  } 
    11501174 
     1175  /*! 
     1176    Receive longitude event from clients(s) 
     1177    \param[in] event event contain info about rank and associated longitude 
     1178  */ 
    11511179  void CDomain::recvLon(CEventServer& event) 
    11521180  { 
     
    11611189  } 
    11621190 
     1191  /*! 
     1192    Receive longitude information from client(s) 
     1193    \param[in] rank rank of client source 
     1194    \param[in] buffer message containing longitude info 
     1195  */ 
    11631196  void CDomain::recvLon(int rank, CBufferIn& buffer) 
    11641197  { 
     
    11841217  } 
    11851218 
     1219  /*! 
     1220    Receive latitude event from clients(s) 
     1221    \param[in] event event contain info about rank and associated latitude 
     1222  */ 
    11861223  void CDomain::recvLat(CEventServer& event) 
    11871224  { 
     
    11961233  } 
    11971234 
     1235  /*! 
     1236    Receive latitude information from client(s) 
     1237    \param[in] rank rank of client source 
     1238    \param[in] buffer message containing latitude info 
     1239  */ 
    11981240  void CDomain::recvLat(int rank, CBufferIn& buffer) 
    11991241  { 
     
    12191261  } 
    12201262 
     1263  /*! 
     1264    Receive area event from clients(s) 
     1265    \param[in] event event contain info about rank and associated area 
     1266  */ 
    12211267  void CDomain::recvArea(CEventServer& event) 
    12221268  { 
     
    12311277  } 
    12321278 
     1279  /*! 
     1280    Receive area information from client(s) 
     1281    \param[in] rank rank of client source 
     1282    \param[in] buffer message containing area info 
     1283  */ 
    12331284  void CDomain::recvArea(int rank, CBufferIn& buffer) 
    12341285  { 
     
    12471298  } 
    12481299 
     1300  /*! 
     1301    Check whether a domain has transformation 
     1302    \return true if domain has transformation 
     1303  */ 
    12491304  bool CDomain::hasTransformation() 
    12501305  { 
     
    12521307  } 
    12531308 
     1309  /*! 
     1310    Set transformation for current domain. It's the method to move transformation in hierarchy 
     1311    \param [in] domTrans transformation on domain 
     1312  */ 
    12541313  void CDomain::setTransformations(const TransMapTypes& domTrans) 
    12551314  { 
     
    12571316  } 
    12581317 
     1318  /*! 
     1319    Get all transformation current domain has 
     1320    \return all transformation 
     1321  */ 
    12591322  CDomain::TransMapTypes CDomain::getAllTransformations(void) 
    12601323  { 
     
    12761339  } 
    12771340 
     1341  /*! 
     1342    A current domain will go up the hierarchy to find out the domain from which it has transformation 
     1343  */ 
    12781344  void CDomain::solveInheritanceTransformation() 
    12791345  { 
     
    12961362  } 
    12971363 
     1364  /*! 
     1365    Parse children nodes of a domain in xml file. 
     1366    Whenver there is a new transformation, its type and name should be added into this function 
     1367    \param node child node to process 
     1368  */ 
    12981369  void CDomain::parse(xml::CXMLNode & node) 
    12991370  { 
  • XIOS/trunk/src/node/domain.hpp

    r666 r667  
    7676         TransMapTypes getAllTransformations(); 
    7777 
    78       private : 
    79          void checkDomain(void); 
    80          void checkLocalIDomain(void); 
    81          void checkLocalJDomain(void); 
    82  
    83          void checkMask(void); 
    84          void checkDomainData(void); 
    85          void checkCompression(void); 
    86  
    87          void checkBounds(void); 
    88          void checkArea(void); 
    89          void checkLonLat(); 
    90  
    9178      public : 
    92  
    93          /// Autres /// 
    94  
    9579         const std::set<StdString> & getRelFiles(void) const; 
    96  
    97  
    98          /// Test /// 
    9980         bool IsWritten(const StdString & filename) const; 
    100 //         bool hasZoom(void) const; 
    10181         bool isEmpty(void) const; 
    10282         bool isDistributed(void) const; 
    10383 
    10484 
    105 //         int ni_client,ibegin_client,iend_client ; 
    106 //         int zoom_ni_client,zoom_ibegin_client,zoom_iend_client ; 
    107 // 
    108 //         int nj_client,jbegin_client,jend_client ; 
    109 //         int zoom_nj_client,zoom_jbegin_client,zoom_jend_client ; 
     85         int global_zoom_ibegin, global_zoom_ni; 
     86         int global_zoom_jbegin, global_zoom_nj; 
    11087 
    11188         int ni_srv,ibegin_srv,iend_srv ; 
     
    12198         CArray<double, 1> area_srv; 
    12299 
    123  
    124100        vector<int> connectedServer ; // list of connected server 
    125101        vector<int> nbSenders ; // for each communication with a server, number of communicating client 
     
    127103        vector< vector<int> > i_indSrv ; // for each server, i global index to send 
    128104        vector< vector<int> > j_indSrv ; // for each server, j global index to send 
    129  
    130  
    131 //        CArray<int,2> mapConnectedServer ;  // (ni,nj) => mapped to connected server number, -1 if no server is target 
    132  
    133         int global_zoom_ibegin, global_zoom_ni; 
    134         int global_zoom_jbegin, global_zoom_nj; 
    135105 
    136106      public : 
     
    169139         bool hasLonLat; 
    170140      private: 
     141         void checkDomain(void); 
     142         void checkLocalIDomain(void); 
     143         void checkLocalJDomain(void); 
     144 
     145         void checkMask(void); 
     146         void checkDomainData(void); 
     147         void checkCompression(void); 
     148 
     149         void checkBounds(void); 
     150         void checkArea(void); 
     151         void checkLonLat(); 
     152 
    171153         void checkTransformations(); 
    172154         void setTransformations(const TransMapTypes&); 
     
    191173         bool isUnstructed_; 
    192174 
    193  
    194  
    195175         DECLARE_REF_FUNC(Domain,domain) 
    196176 
Note: See TracChangeset for help on using the changeset viewer.