Ignore:
Timestamp:
05/26/15 16:13:45 (9 years ago)
Author:
rlacroix
Message:

Change the definition of non distributed axis and domain.

Axis and domain were considered non distributed if the local domain matched the full domain. Instead allow the local domain definition to be ommited and consider the axis or domain to be non distributed in this case.

File:
1 edited

Legend:

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

    r591 r594  
    2424      : CObjectTemplate<CDomain>(), CDomainAttributes() 
    2525      , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 
     26      , isDistributed_(false) 
    2627   { /* Ne rien faire de plus */ } 
    2728 
     
    2930      : CObjectTemplate<CDomain>(id), CDomainAttributes() 
    3031      , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 
     32      , isDistributed_(false) 
    3133         { /* Ne rien faire de plus */ } 
    3234 
     
    6365   { 
    6466      return (this->relFiles.find(filename) != this->relFiles.end()); 
     67   } 
     68 
     69   //---------------------------------------------------------------- 
     70 
     71   bool CDomain::isDistributed(void) const 
     72   { 
     73      return isDistributed_; 
    6574   } 
    6675 
     
    123132               << " check the \'ni_glo\' et \'nj_glo\' values !") 
    124133      } 
    125       checkLocalIDomain() ; 
    126       checkLocalJDomain() ; 
    127  
    128      if (i_index.isEmpty()) 
    129      { 
    130        i_index.resize(ni,nj) ; 
    131        for(int j=0;j<nj;j++) 
    132          for(int i=0;i<ni;i++) i_index(i,j)=i ; 
    133      } 
    134  
    135      if (j_index.isEmpty()) 
    136      { 
    137         j_index.resize(ni,nj) ; 
    138         for(int j=0;j<nj;j++) 
    139          for(int i=0;i<ni;i++) j_index(i,j)=j ; 
    140      } 
    141  
     134 
     135      isDistributed_ = !ibegin.isEmpty() || !iend.isEmpty() || !ni.isEmpty() || !jbegin.isEmpty() || !jend.isEmpty() || !nj.isEmpty(); 
     136 
     137      checkLocalIDomain(); 
     138      checkLocalJDomain(); 
     139 
     140      ibegin_client = ibegin; iend_client = iend; ni_client = ni; 
     141      jbegin_client = jbegin; jend_client = jend; nj_client = nj; 
     142 
     143      if (i_index.isEmpty()) 
     144      { 
     145        i_index.resize(ni,nj); 
     146        for (int j = 0; j < nj; j++) 
     147          for (int i = 0; i < ni; i++) i_index(i,j) = i; 
     148      } 
     149 
     150      if (j_index.isEmpty()) 
     151      { 
     152        j_index.resize(ni,nj); 
     153        for (int j = 0; j < nj; j++) 
     154          for (int i = 0; i < ni; i++) j_index(i,j) = j; 
     155      } 
    142156   } 
    143157 
     
    147161   { 
    148162      if (!ni.isEmpty() && !ibegin.isEmpty() && iend.isEmpty()) 
    149          iend.setValue(ibegin.getValue() + ni.getValue() - 1) ; 
    150  
    151       else if (!ni.isEmpty() && !iend.isEmpty()   && ibegin.isEmpty()) 
    152          ibegin.setValue( - ni.getValue() + iend.getValue() + 1) ; 
    153  
     163        iend.setValue(ibegin.getValue() + ni.getValue() - 1); 
     164      else if (!ni.isEmpty() && !iend.isEmpty() && ibegin.isEmpty()) 
     165        ibegin.setValue(iend.getValue() - ni.getValue()  + 1); 
    154166      else if (!ibegin.isEmpty() && !iend.isEmpty() && ni.isEmpty()) 
    155          ni.setValue(iend.getValue() - ibegin.getValue() + 1) ; 
    156  
    157       else if (!ibegin.isEmpty() && !iend.isEmpty() && !ni.isEmpty() ) 
    158       { 
    159          if (iend.getValue() != ibegin.getValue() + ni.getValue() - 1) 
    160            ERROR("CDomain::checkAttributes(void)", 
    161                  << "The domain si wrong defined," 
    162                  << " iend is different of (ibegin + ni - 1) !") ; 
     167        ni.setValue(iend.getValue() - ibegin.getValue() + 1); 
     168      else if (!ibegin.isEmpty() && !iend.isEmpty() && !ni.isEmpty()) 
     169      { 
     170        if (iend.getValue() != ibegin.getValue() + ni.getValue() - 1) 
     171          ERROR("CDomain::checkLocalIDomain(void)", 
     172                << "[ Id = " << this->getId() << " ] " 
     173                << "The local domain is wrongly defined," 
     174                << " iend is different from (ibegin + ni - 1)"); 
     175      } 
     176      else if (ibegin.isEmpty() && iend.isEmpty() && ni.isEmpty()) 
     177      { 
     178        ibegin = 0; 
     179        iend = ni_glo - 1; 
     180        ni = ni_glo; 
    163181      } 
    164182      else 
    165183      { 
    166          ERROR("CDomain::checkAttributes(void)", 
    167                << "The domain is wrong defined," 
    168                << " 2 value from \'iend\', \'ibegin\', \'ni\'  must be defined !") ; 
    169       } 
    170  
     184        ERROR("CDomain::checkLocalIDomain(void)", 
     185              << "[ Id = " << this->getId() << " ] " 
     186              << "The local domain is wrongly defined," 
     187              << " defining just one attribute among 'ibegin', 'iend' or 'ni' is invalid"); 
     188      } 
    171189 
    172190      if (ni.getValue() < 0 || ibegin.getValue() > iend.getValue() || 
    173           ibegin.getValue() < 0 || iend.getValue() > (ni_glo.getValue()-1)) 
    174           { 
    175  
    176          ERROR("CDomain::checkAttributes(void)", 
    177                << "[ Id = " << this->getId() << " ] " 
    178                << "Local domain is wrong defined," 
    179                << " Check the value : ni, ni_glo, ibegin, iend") ; 
    180         } 
     191          ibegin.getValue() < 0 || iend.getValue() > (ni_glo.getValue() - 1)) 
     192      { 
     193        ERROR("CDomain::checkLocalIDomain(void)", 
     194              << "[ Id = " << this->getId() << " ] " 
     195              << "The local domain is wrongly defined," 
     196              << " check the attributes 'ni_glo', 'ni', 'ibegin' and 'iend'"); 
     197      } 
    181198   } 
    182199 
     
    186203   { 
    187204      if (!nj.isEmpty() && !jbegin.isEmpty() && jend.isEmpty()) 
    188          jend.setValue(jbegin.getValue() + nj.getValue() - 1) ; 
    189  
     205        jend.setValue(jbegin.getValue() + nj.getValue() - 1); 
    190206      else if (!nj.isEmpty() && !jend.isEmpty() && jbegin.isEmpty()) 
    191          jbegin.setValue( - nj.getValue() + jend.getValue() + 1) ; 
    192  
     207        jbegin.setValue(jend.getValue() - nj.getValue() + 1); 
    193208      else if (!jbegin.isEmpty() && !jend.isEmpty() && nj.isEmpty()) 
    194          nj.setValue(jend.getValue() - jbegin.getValue() + 1) ; 
    195  
    196       else if (!jbegin.isEmpty() && !jend.isEmpty() && !nj.isEmpty() ) 
    197       { 
    198           if  (jend.getValue() != jbegin.getValue() + nj.getValue() - 1) 
    199              ERROR("CDomain::checkAttributes(void)", 
    200                  << "The domain is wrong defined," 
    201                  << " iend is different of (jbegin + nj - 1) !") ; 
     209        nj.setValue(jend.getValue() - jbegin.getValue() + 1); 
     210      else if (!jbegin.isEmpty() && !jend.isEmpty() && !nj.isEmpty()) 
     211      { 
     212        if (jend.getValue() != jbegin.getValue() + nj.getValue() - 1) 
     213          ERROR("CDomain::checkLocalJDomain(void)", 
     214                << "[ Id = " << this->getId() << " ] " 
     215                << "The local domain is wrongly defined," 
     216                << " jend is different from (jbegin + nj - 1)"); 
     217      } 
     218      else if (jbegin.isEmpty() && jend.isEmpty() && nj.isEmpty()) 
     219      { 
     220        jbegin = 0; 
     221        jend = nj_glo - 1; 
     222        nj = nj_glo; 
    202223      } 
    203224      else 
    204225      { 
    205          ERROR("CDomain::checkAttributes(void)", 
    206                << "The domain is wrong defined," 
    207                << " 2 values from  jend, jbegin, nj  must be defined !") ; 
     226        ERROR("CDomain::checkLocalJDomain(void)", 
     227              << "[ Id = " << this->getId() << " ] " 
     228              << "The local domain is wrongly defined," 
     229              << " defining just one attribute among 'jbegin', 'jend' or 'nj' is invalid"); 
    208230      } 
    209231 
    210232      if (nj.getValue() < 0 || jbegin.getValue() > jend.getValue() || 
    211           jbegin.getValue() < 0 || jend.getValue() > (nj_glo.getValue()-1)) 
    212          ERROR("CDomain::checkAttributes(void)", 
    213                << "Domain is wrong defined," 
    214                << " Check the values : nj, nj_glo, jbegin, jend") ; 
    215  
    216      ibegin_client=ibegin ; iend_client=iend ; ni_client=ni ; 
    217      jbegin_client=jbegin ; jend_client=jend ; nj_client=nj ; 
     233          jbegin.getValue() < 0 || jend.getValue() > (nj_glo.getValue() - 1)) 
     234      { 
     235        ERROR("CDomain::checkLocalJDomain(void)", 
     236              << "[ Id = " << this->getId() << " ] " 
     237              << "The local domain is wrongly defined," 
     238              << " check the attributes 'nj_glo', 'nj', 'jbegin' and 'jend'"); 
     239      } 
    218240   } 
    219241 
     
    497519            if (zoom_ibegin < 0  || zoom_jbegin < 0 || zoom_iend > (ni_glo-1) || zoom_jend > (nj_glo-1)) 
    498520               ERROR("CDomain::checkZoom(void)", 
    499                      << "Zoom is wrong defined," 
     521                     << "Zoom is wrongly defined," 
    500522                     << " Check the values : zoom_ni, zoom_nj, zoom_ibegin, zoom_jbegin") ; 
    501523         } 
Note: See TracChangeset for help on using the changeset viewer.