Changeset 624


Ignore:
Timestamp:
06/22/15 13:36:37 (6 years ago)
Author:
mhnguyen
Message:

Final tests of zoom and inverse on axis

+) Modify test_client and test_complete to work with new grid definition
+) Correct some bugs causing memory leak
+) Clean abundant code
+) Add more comments to new files

Test
+) On Curie
+) test_client and test_complete pass with correct results

Location:
XIOS/trunk
Files:
1 added
2 deleted
15 edited
12 moved

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/inputs/COMPLETE/context_atmosphere.xml

    r586 r624  
    44 
    55  <field_definition level="1" enabled=".FALSE." default_value="9.96921e+36"> 
    6     <field id="field_A_atm"  name="field_A_atm" operation="average" freq_op="1ts" domain_ref="domain_atm"  axis_ref="axis_atm" /> 
     6    <field id="field_A_atm"  name="field_A_atm_origin" operation="average" freq_op="1ts" grid_ref="grid_A_atm" /> 
     7    <field id="field_A_atm_zoom"  name="field_A_atm" operation="average" freq_op="1ts" field_ref="field_A_atm" grid_ref="grid_A_atm_zoom" /> 
    78  </field_definition> 
    89 
    910  <file_definition type="multiple_file" par_access="collective" output_freq="6h" sync_freq="6h" output_level="10" enabled=".TRUE."> 
    1011    <file id="output_atmosphere" name="output_atmosphere"> 
    11       <field field_ref="field_A_atm" /> 
     12      <field field_ref="field_A_atm_zoom" /> 
    1213    </file> 
    1314    <file id="output_atmosphere_zoom" name="output_atmosphere_zoom"> 
    14       <field field_ref="field_A_atm" name="field_A_atm_zoom" domain_ref="domain_atm_zoom" /> 
     15      <field field_ref="field_A_atm" name="field_A_atm_zoom" /> 
    1516    </file> 
    1617  </file_definition> 
    1718 
    1819  <axis_definition> 
    19     <axis id="axis_atm" zoom_size="2" zoom_end="2" /> 
     20    <axis id="axis_atm"/> 
     21    <axis id="axis_atm_zoom" axis_ref="axis_atm"> 
     22      <zoom_axis zoom_size="2" zoom_end="2" /> 
     23    </axis> 
    2024  </axis_definition> 
    2125 
     
    2529  </domain_definition> 
    2630 
    27   <grid_definition /> 
     31  <grid_definition> 
     32   <grid id="grid_A_atm"> 
     33     <domain domain_ref="domain_atm" /> 
     34     <axis axis_ref="axis_atm" /> 
     35   </grid> 
     36   <grid id="grid_A_atm_zoom"> 
     37     <domain domain_ref="domain_atm" /> 
     38     <axis axis_ref="axis_atm_zoom" /> 
     39   </grid> 
     40  </grid_definition> 
     41 
    2842 
    2943</context> 
  • XIOS/trunk/inputs/Version2/iodef.xml

    r623 r624  
    66 
    77 
    8    <field_definition level="1" enabled=".FALSE."> 
     8   <field_definition level="1" enabled=".FALSE." default_value="9.96921e+36"> 
    99     <field id="field_AA"  operation="average" freq_op="3600s" domain_ref="domain_A"  axis_ref="axis_A" /> 
    1010     <field id="field_A"  operation="average" freq_op="3600s" grid_ref="grid_A" /> 
    1111     <field id="field_Axis"  operation="average" freq_op="3600s" grid_ref="grid_Axis" /> 
    1212     <field id="field_Two_Axis"  operation="average" freq_op="3600s" grid_ref="grid_Two_Axis" /> 
    13      <field id="field_Axis_transformed"  operation="average" freq_op="3600s" field_ref="field_Two_Axis" grid_ref="grid_Axis_tranformed" /> 
     13     <field id="field_Axis_transformed"  operation="average" freq_op="3600s" field_ref="field_A" grid_ref="grid_Axis_tranformed" /> 
    1414     <field id="field_All_Axis" operation="average" freq_op="3600s" grid_ref="grid_All_Axis" /> 
    1515     <field id="field_Scalar" operation="average" freq_op="3600s" grid_ref="ScalarGrid" /> 
     
    3535   </file_definition> 
    3636 
    37  
    3837   <axis_definition> 
    3938     <axis id="axis_A" /> 
     
    4140     <axis id="axis_C" /> 
    4241     <axis id="axis_D" /> 
    43      <axis id="axis_E" axis_ref="axis_B"> 
    44         <inverse_axis /> 
     42     <axis id="axis_E" axis_ref="axis_C"> 
     43<!--        <inverse_axis />--> 
    4544 
    46         <zoom_axis zoom_begin="0" zoom_size="4" /> 
     45        <zoom_axis zoom_begin="1" zoom_size="2" /> 
    4746<!--        <inverse_axis />--> 
    4847     </axis> 
    4948     <axis id="axis_F" axis_ref="axis_A"> 
    50 <!--       <inverse_axis />--> 
     49       <inverse_axis /> 
    5150     </axis> 
    5251   </axis_definition> 
     
    7170       </grid> 
    7271       <grid id="grid_Axis_tranformed"> 
    73 <!--         <domain domain_ref="domain_A" />--> 
    74          <axis axis_ref="axis_F" /> 
    75          <axis axis_ref="axis_E" /> 
     72         <domain domain_ref="domain_A" /> 
     73            <axis axis_ref="axis_E" /> 
     74<!--         <axis axis_ref="axis_F" />--> 
     75<!--         <axis axis_ref="axis_E" />--> 
    7676       </grid> 
    7777       <grid id="grid_All_Axis"> 
  • XIOS/trunk/inputs/iodef.xml

    r554 r624  
    77 
    88   <field_definition level="1" enabled=".FALSE."> 
    9      <field id="field_A"  operation="average" freq_op="3600s" domain_ref="domain_A"  axis_ref="axis_A" /> 
     9     <field id="field_A"  operation="average" freq_op="3600s" grid_ref="grid_A"/> 
     10     <field id="field_A_zoom"  operation="average" freq_op="3600s" field_ref="field_A" grid_ref="grid_A_zoom"/> 
    1011   </field_definition> 
    1112 
     
    1314   <file_definition type="multiple_file" par_access="collective" output_freq="6h" output_level="10" enabled=".TRUE."> 
    1415     <file id="output" name="output"> 
    15         <field field_ref="field_A" /> 
     16        <field field_ref="field_A_zoom" name="field_A" /> 
    1617     </file> 
    1718   </file_definition> 
     
    1920 
    2021   <axis_definition> 
    21      <axis id="axis_A" zoom_size="2" zoom_end="2" /> 
     22     <axis id="axis_A"/> 
     23     <axis id="axis_A_zoom" axis_ref="axis_A"> 
     24       <zoom_axis zoom_begin="1" zoom_size="2" /> 
     25     </axis> 
    2226   </axis_definition> 
    2327 
     
    2630   </domain_definition> 
    2731 
    28    <grid_definition /> 
    29  
     32   <grid_definition> 
     33     <grid id="grid_A"> 
     34       <domain domain_ref="domain_A" /> 
     35       <axis axis_ref="axis_A" /> 
     36     </grid> 
     37     <grid id="grid_A_zoom"> 
     38       <domain domain_ref="domain_A" /> 
     39       <axis axis_ref="axis_A_zoom" /> 
     40     </grid> 
     41   </grid_definition> 
    3042  </context> 
    3143 
  • XIOS/trunk/src/client_server_mapping_distributed.cpp

    r623 r624  
    3535   Compute mapping global index of server which client sends to. 
    3636   \param [in] globalIndexOnClient global index client has 
    37    \param [in] localIndexOnClient local index on client 
    3837*/ 
    3938void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient) 
     
    6160      int indexClient = std::distance(itbClientHash, itClientHash)-1; 
    6261 
    63       if (clientRank_ == indexClient) 
    64       { 
    65         (indexGlobalOnServer_[globalIndexToServerMapping_[globalIndexClient]]).push_back(globalIndexClient); 
    66         ++nbIndexAlreadyOnClient; 
    67       } 
    68       else 
    6962      { 
    7063        client2ClientIndexGlobal[indexClient].push_back(globalIndexClient); 
     
    8881 
    8982  int nbDemandingClient = recvBuff[clientRank_], nbIndexServerReceived = 0; 
     83 
    9084  // Receiving demand as well as the responds from other clients 
    9185  // The demand message contains global index; meanwhile the responds have server index information 
    9286  // Buffer to receive demand from other clients, it can be allocated or not depending whether it has demand(s) 
    9387  unsigned long* recvBuffIndexGlobal = 0; 
    94   int maxNbIndexDemandedFromOthers = (nbIndexAlreadyOnClient >= globalIndexToServerMapping_.size()) 
    95                                    ? 0 : (globalIndexToServerMapping_.size() - nbIndexAlreadyOnClient); 
    96   if (!isDataDistributed_) maxNbIndexDemandedFromOthers = nbDemandingClient * globalIndexToServerMapping_.size(); // Not very optimal but it's general 
     88//  int maxNbIndexDemandedFromOthers = (nbIndexAlreadyOnClient >= globalIndexToServerMapping_.size()) 
     89//                                   ? 0 : (globalIndexToServerMapping_.size() - nbIndexAlreadyOnClient); 
     90  int maxNbIndexDemandedFromOthers = (globalIndexToServerMapping_.size() > nbIndexSendToOthers) 
     91                                      ? globalIndexToServerMapping_.size() : nbIndexSendToOthers; 
     92 
     93  if (!isDataDistributed_) maxNbIndexDemandedFromOthers = nbDemandingClient * nbIndexSendToOthers; //globalIndexToServerMapping_.size(); // Not very optimal but it's general 
    9794 
    9895  if (0 != maxNbIndexDemandedFromOthers) 
     
    10299  int* recvBuffIndexServer = 0; 
    103100  int nbIndexReceivedFromOthers = nbIndexSendToOthers; 
    104 //  int nbIndexReceivedFromOthers = globalIndexToServerMapping_.size() - nbIndexAlreadyOnClient; 
    105101  if (0 != nbIndexReceivedFromOthers) 
    106102    recvBuffIndexServer = new int[nbIndexReceivedFromOthers]; 
     
    237233    { 
    238234      int indexClient = std::distance(itbClientHash, itClientHash)-1; 
    239       if (clientRank_ == indexClient) 
    240       { 
    241         globalIndexToServerMapping_.insert(std::make_pair<size_t,int>(it->first, it->second)); 
    242       } 
    243       else 
    244235      { 
    245236        sendBuff[indexClient] = 1; 
  • XIOS/trunk/src/distribution_client.cpp

    r623 r624  
    148148    axisMasks_[i].resize(axisList[i]->mask.numElements()); 
    149149    axisMasks_[i] = axisList[i]->mask; 
    150     std::cout << "axisMask " << axisMasks_[i] << std::endl; 
    151150  } 
    152151 
     
    201200      nBeginLocal_.at(indexMap_[idx]+1) = 0; 
    202201      nBeginGlobal_.at(indexMap_[idx]+1) = domList[domIndex]->jbegin; 
    203 //      nZoomBegin_.at((indexMap_[idx]+1)) = domList[domIndex]->zoom_jbegin; 
    204 //      nZoomEnd_.at((indexMap_[idx]+1))   = domList[domIndex]->zoom_jbegin + domList[domIndex]->zoom_nj-1; 
     202      nZoomBegin_.at((indexMap_[idx]+1)) = domList[domIndex]->zoom_jbegin; 
     203      nZoomEnd_.at((indexMap_[idx]+1))   = domList[domIndex]->zoom_jbegin + domList[domIndex]->zoom_nj-1; 
    205204 
    206205      dataBegin_.at(indexMap_[idx]+1) = (2 == domList[domIndex]->data_dim) ? domList[domIndex]->data_jbegin.getValue() : -1; 
     
    213212      nBeginLocal_.at(indexMap_[idx]) = 0; 
    214213      nBeginGlobal_.at(indexMap_[idx]) = domList[domIndex]->ibegin; 
    215 //      nZoomBegin_.at((indexMap_[idx])) = domList[domIndex]->zoom_ibegin; 
    216 //      nZoomEnd_.at((indexMap_[idx]))   = domList[domIndex]->zoom_ibegin + domList[domIndex]->zoom_ni-1; 
     214      nZoomBegin_.at((indexMap_[idx])) = domList[domIndex]->zoom_ibegin; 
     215      nZoomEnd_.at((indexMap_[idx]))   = domList[domIndex]->zoom_ibegin + domList[domIndex]->zoom_ni-1; 
    217216 
    218217      dataBegin_.at(indexMap_[idx]) = domList[domIndex]->data_ibegin.getValue(); 
  • XIOS/trunk/src/node/axis.cpp

    r623 r624  
    9595      } 
    9696      else this->ni.setValue(size); 
    97       std::cout <<  "value " <<  value <<  std::endl; 
     97 
    9898//      StdSize true_size = value.numElements(); 
    9999//      if (this->ni.getValue() != true_size) 
     
    135135   } 
    136136 
    137    void CAxis::checkZoom(void) 
    138    { 
    139       StdSize zoom_begin,zoom_end, zoom_size, axisSize; 
    140  
    141       zoom_begin = this->zoom_begin.isEmpty() ? 0 : this->zoom_begin.getValue(); 
    142       zoom_size  = this->zoom_size.isEmpty() ? size.getValue() : this->zoom_size.getValue(); 
    143       zoom_end   = this->zoom_end.isEmpty() ? (size.getValue() - 1) : this->zoom_end.getValue(); 
    144  
    145       if (this->zoom_begin.isEmpty()) zoom_begin = zoom_end - zoom_size + 1; 
    146       if (this->zoom_end.isEmpty()) zoom_end = zoom_begin + zoom_size - 1; 
    147       if (this->zoom_size.isEmpty()) zoom_size = zoom_end - zoom_begin + 1; 
    148       axisSize = size.getValue(); 
    149  
    150       if ( (zoom_begin < 0) || (zoom_begin > axisSize-1) || (zoom_end<0) || (zoom_end>axisSize-1) || (zoom_size<1) || (zoom_size>axisSize) || (zoom_begin>zoom_end)) 
    151         ERROR("CAxis::checkAttributes(void)", 
    152               << "One or more attributes among <zoom_begin>, <zoom_end>, <zoom_size> of axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); 
    153  
    154       this->zoom_begin.setValue(zoom_begin); 
    155       this->zoom_end.setValue(zoom_end); 
    156       this->zoom_size.setValue(zoom_size); 
    157    } 
     137//   void CAxis::checkZoom(void) 
     138//   { 
     139//      StdSize zoom_begin,zoom_end, zoom_size, axisSize; 
     140// 
     141//      zoom_begin = (this->zoom_begin.isEmpty()) ?  0 : this->zoom_begin.getValue() ; 
     142//      zoom_size  = (this->zoom_size.isEmpty()) ?  size.getValue() : this->zoom_size.getValue() ; 
     143//      zoom_end   = (this->zoom_end.isEmpty()) ?  (size.getValue() - 1) : this->zoom_end.getValue() ; 
     144// 
     145//      if (this->zoom_begin.isEmpty()) zoom_begin=zoom_end-zoom_size+1 ; 
     146//      if (this->zoom_end.isEmpty()) zoom_end=zoom_begin+zoom_size-1 ; 
     147//      if (this->zoom_size.isEmpty()) zoom_size=zoom_end-zoom_begin+1 ; 
     148//      axisSize = size.getValue(); 
     149// 
     150//      if ( (zoom_begin < 0) || (zoom_begin > axisSize-1) || (zoom_end<0) || (zoom_end>axisSize-1) || (zoom_size<1) || (zoom_size>axisSize) || (zoom_begin>zoom_end)) 
     151//        ERROR("CAxis::checkAttributes(void)", 
     152//              << "One or more attributes among <zoom_begin>, <zoom_end>, <zoom_size> of axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] are not well specified"); 
     153// 
     154//      this->zoom_begin.setValue(zoom_begin) ; 
     155//      this->zoom_end.setValue(zoom_end) ; 
     156//      this->zoom_size.setValue(zoom_size) ; 
     157//   } 
    158158 
    159159   void CAxis::checkMask() 
  • XIOS/trunk/src/node/axis.hpp

    r623 r624  
    107107         void checkData(); 
    108108         void checkMask(); 
    109          void checkZoom(); 
     109//         void checkZoom(); 
    110110         void checkTransformations(); 
    111111         void computeServerIndex(const std::vector<int>& globalDim, int orderPositionInGrid, 
  • XIOS/trunk/src/node/field.cpp

    r623 r624  
    1313#include "context_server.hpp" 
    1414#include <set> 
    15 #include "axis_filter.hpp" 
    16 #include "invert_algorithm.hpp" 
    1715 
    1816namespace xios{ 
     
    2927      , foperation(), hasInstantData(false), hasExpression(false) 
    3028      , active(false) , hasOutputFile(false),hasFieldOut(false), slotUpdateDate(NULL) 
    31       , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false), filter(0) 
     29      , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false) 
    3230      , isReadDataRequestPending(false) 
    33       , filterSources_(), algorithms_() 
     31      , filterSources_() 
    3432      { setVirtualVariableGroup(); } 
    3533 
     
    4341      , foperation(), hasInstantData(false), hasExpression(false) 
    4442      , active(false), hasOutputFile(false), hasFieldOut(false), slotUpdateDate(NULL) 
    45       , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false), filter(0) 
     43      , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false) 
    4644      , isReadDataRequestPending(false) 
    47       , filterSources_(), algorithms_() 
     45      , filterSources_() 
    4846   { setVirtualVariableGroup(); } 
    4947 
     
    5553      if (hasExpression) delete expression; 
    5654      if (slotUpdateDate != NULL) delete slotUpdateDate; 
    57       if (0 != filter) delete filter; 
    5855 
    5956   } 
     
    177174            int rank=(*it).first ; 
    178175            CArray<int,1>& index = *(it->second) ; 
    179                        std::cout << "rank " << index << std::endl; 
    180                        std::cout << "data " << data << std::endl; 
    181176            CArray<double,1> data_tmp(index.numElements()) ; 
    182177            for(int n=0;n<data_tmp.numElements();n++) data_tmp(n)=data(index(n)) ; 
     
    784779           fieldRef->addReference(this); 
    785780           fieldRef->solveGridDomainAxisRef(false); 
    786 //           fieldRef->solveCheckMaskIndex(false); 
    787781           break; 
    788782         } 
     
    798792         fieldRef->addReference(this); 
    799793         fieldRef->solveGridDomainAxisRef(false); 
    800 //         fieldRef->solveCheckMaskIndex(false); 
    801794       } 
    802795 
     
    826819          { 
    827820             const std::map<int, CArray<int,1>* >& localIndexToSend = (*itFilterSrc)->grid->getTransformations()->getLocalIndexToSendFromGridSource(); 
    828              const std::map<int, std::vector<CArray<int,1>* > > localIndexToReceive = (*itFilterSrc)->grid->getTransformations()->getLocalIndexToReceiveOnGridDest(); 
     821             const std::map<int, std::vector<CArray<int,1>* > >& localIndexToReceive = (*itFilterSrc)->grid->getTransformations()->getLocalIndexToReceiveOnGridDest(); 
    829822 
    830823             sendAndReceiveTransformedData(localIndexToSend, dataToSend, 
     
    857850       CArray<int,1>* localIndex_p = itSend->second; 
    858851       int countSize = localIndex_p->numElements(); 
    859        std::cout << "Data Source " <<  dataSrc <<  std::endl; 
    860852       for (int idx = 0; idx < countSize; ++idx) 
    861853       { 
     
    888880         } 
    889881       } 
    890        std::cout << "Data Destination " <<  dataDest <<  std::endl; 
    891882     } 
    892883 
  • XIOS/trunk/src/node/field.hpp

    r621 r624  
    1515#include "expr_node.hpp" 
    1616#include "declare_ref_func.hpp" 
    17 #include "generic_filter.hpp" 
    1817#include "transformation_enum.hpp" 
    1918 
     
    231230         bool isReadDataRequestPending; 
    232231         std::vector<CField*> filterSources_; 
    233          std::vector<CGenericAlgorithm*> algorithms_; 
    234232         DECLARE_REF_FUNC(Field,field) 
    235233 
  • XIOS/trunk/src/node/field_impl.hpp

    r621 r624  
    4949        { 
    5050          (*it)->setData(_data); 
    51           if (hasOutputFile || hasFieldOut) updateData(_data); 
    52         } 
    53       } 
    54  
     51        } 
     52      } 
     53      if (hasOutputFile || hasFieldOut) updateData(_data); 
    5554    } 
    5655  } 
  • XIOS/trunk/src/node/grid.cpp

    r623 r624  
    772772  bool CGrid::doGridHaveDataToWrite() 
    773773  { 
    774     size_t ssize = 0; 
    775     for (map<int, CArray<size_t, 1>* >::const_iterator it = outIndexFromClient.begin(); 
    776                                                        it != outIndexFromClient.end(); ++it) 
    777     { 
    778       ssize += (it->second)->numElements(); 
    779     } 
    780     return (0 != ssize); 
     774//    size_t ssize = 0; 
     775//    for (map<int, CArray<size_t, 1>* >::const_iterator it = outIndexFromClient.begin(); 
     776//                                                       it != outIndexFromClient.end(); ++it) 
     777//    { 
     778//      ssize += (it->second)->numElements(); 
     779//    } 
     780//    return (0 != ssize); 
     781     return (0 != writtenDataSize_); 
    781782  } 
    782783 
  • XIOS/trunk/src/output/nc4_data_output.cpp

    r623 r624  
    13621362           if (!field->prec.isEmpty() && field->prec==2) fieldData=round(fieldData) ; 
    13631363 
    1364            std::cout << "fieldData "<< fieldData << std::endl; 
    13651364           switch (SuperClass::type) 
    13661365           { 
  • XIOS/trunk/src/test/test_client.f90

    r554 r624  
    8888  CALL xios_get_handle("output",file_hdl) 
    8989  CALL xios_add_child(file_hdl,field_hdl) 
    90   CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_C") 
     90  CALL xios_set_attr(field_hdl,field_ref="field_A_zoom",name="field_C") 
    9191 
    9292  dtime%second = 3600 
  • XIOS/trunk/src/test/test_complete.f90

    r586 r624  
    9696  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) 
    9797  CALL xios_set_domain_attr("domain_atm_zoom",lonvalue=RESHAPE(lon,(/ni*nj/)),latvalue=RESHAPE(lat,(/ni*nj/))) 
    98   CALL xios_set_domain_attr("domain_atm_zoom",zoom_ibegin=39, zoom_ni=20, zoom_jbegin=39, zoom_nj=5) 
     98!  CALL xios_set_domain_attr("domain_atm_zoom",zoom_ibegin=39, zoom_ni=20, zoom_jbegin=39, zoom_nj=5) 
    9999 
    100100!!! Activation du groupe field_definition 
     
    109109!!! Heritage des attributs d un autre champ 
    110110 
    111   CALL xios_set_attr(field_hdl,field_ref="field_A_atm",name="field_B_atm") 
     111  CALL xios_set_attr(field_hdl,field_ref="field_A_atm_zoom",name="field_B_atm") 
    112112 
    113113!!! Affectation de ce nouveau champ au fichier avec un nouveau nom 
  • XIOS/trunk/src/test/test_new_features.f90

    r623 r624  
    1515  CHARACTER(len=15) :: calendar_type 
    1616  TYPE(xios_context) :: ctx_hdl 
    17   INTEGER,PARAMETER :: ni_glo=5 
    18   INTEGER,PARAMETER :: nj_glo=5 
    19   INTEGER,PARAMETER :: llm=2 
     17  INTEGER,PARAMETER :: ni_glo=100 
     18  INTEGER,PARAMETER :: nj_glo=100 
     19  INTEGER,PARAMETER :: llm=5 
    2020  DOUBLE PRECISION  :: lval(llm)=1, tsTemp 
    2121  TYPE(xios_field) :: field_hdl 
     
    6868  axisBegin = 0 
    6969  nAxis = llm 
    70   DO n=0, size -1 
    71     nAxis = llm/size 
    72     IF (n<MOD(llm,size)) nAxis=nAxis+1 
    73     IF (n==rank) exit 
    74     axisBegin=axisBegin+nAxis 
    75   ENDDO 
     70!  DO n=0, size -1 
     71!    nAxis = llm/size 
     72!    IF (n<MOD(llm,size)) nAxis=nAxis+1 
     73!    IF (n==rank) exit 
     74!    axisBegin=axisBegin+nAxis 
     75!  ENDDO 
    7676  axisEnd=axisBegin+nAxis-1 
    7777 
     
    117117  CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.) 
    118118 
    119 !  CALL xios_get_handle("field_definition",fieldgroup_hdl) 
    120 !  CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B") 
    121 !  CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B") 
    122 ! 
    123 !  CALL xios_get_handle("output",file_hdl) 
    124 !  CALL xios_add_child(file_hdl,field_hdl) 
    125 !  CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_C") 
     119  CALL xios_get_handle("field_definition",fieldgroup_hdl) 
     120  CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B") 
     121  CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B") 
     122 
     123  CALL xios_get_handle("output",file_hdl) 
     124  CALL xios_add_child(file_hdl,field_hdl) 
     125  CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_C") 
    126126! 
    127127!  CALL xios_get_handle("output_All_Axis",file_hdl) 
  • XIOS/trunk/src/transformation/axis_algorithm_inverse.cpp

    r623 r624  
     1/*! 
     2   \file axis_algorithm_inverse.hpp 
     3   \author Ha NGUYEN 
     4   \since 14 May 2015 
     5   \date 09 June 2015 
     6 
     7   \brief Algorithm for inversing an axis.. 
     8 */ 
    19#include "axis_algorithm_inverse.hpp" 
    210 
  • XIOS/trunk/src/transformation/axis_algorithm_inverse.hpp

    r623 r624  
     1/*! 
     2   \file axis_algorithm_inverse.hpp 
     3   \author Ha NGUYEN 
     4   \since 14 May 2015 
     5   \date 09 June 2015 
     6 
     7   \brief Algorithm for inversing an axis.. 
     8 */ 
    19#ifndef __XIOS_AXIS_ALGORITHM_INVERSE_HPP__ 
    210#define __XIOS_AXIS_ALGORITHM_INVERSE_HPP__ 
     
    614 
    715namespace xios { 
    8  
     16/*! 
     17  \class CAxisAlgorithmInverse 
     18  Inversing an axis 
     19*/ 
    920class CAxisAlgorithmInverse : public CAxisAlgorithmTransformation 
    1021{ 
  • XIOS/trunk/src/transformation/axis_algorithm_transformation.cpp

    r623 r624  
     1/*! 
     2   \file axis_algorithm_transformation.hpp 
     3   \author Ha NGUYEN 
     4   \since 14 May 2015 
     5   \date 09 June 2015 
     6 
     7   \brief Interface for all axis transformation algorithms. 
     8 */ 
     9 
    110#include "axis_algorithm_transformation.hpp" 
    2 #include "axis_inverse.hpp" 
    3 #include "axis_zoom.hpp" 
     11#include "axis_algorithm_inverse.hpp" 
     12#include "axis_algorithm_zoom.hpp" 
    413 
    514namespace xios { 
     
    817 : CGenericAlgorithmTransformation() 
    918{ 
    10 //  if (axisDestination->size.getValue() != axisSource->size.getValue()) 
    11 //  { 
    12 //    ERROR("CAxisZoom::CAxisZoom(CAxis* axisDestination, CAxis* axisSource)", 
    13 //           << "Two axis have different size" 
    14 //           << "Size of axis source " <<axisSource->getId() << " is " << axisSource->size.getValue()  << std::endl 
    15 //           << "Size of axis destionation " <<axisDestination->getId() << " is " << axisDestination->size.getValue()); 
    16 //  } 
    17 // 
    18 // 
    19 //  axisDestGlobalSize_ = axisDestination->size.getValue(); 
    20 //  int niDest = axisDestination->ni.getValue(); 
    21 //  int ibeginDest = axisDestination->ibegin.getValue(); 
    22 // 
    23 //  for (int idx = 0; idx < niDest; ++idx) axisDestGlobalIndex_.push_back(ibeginDest+idx); 
    2419} 
    2520 
    2621CAxisAlgorithmTransformation::~CAxisAlgorithmTransformation() 
    2722{ 
    28 //  for (int idx = 0; idx < algosOfAnAxis_.size(); ++idx) delete algosOfAnAxis_[idx]; 
    2923} 
    3024 
    3125void CAxisAlgorithmTransformation::computeIndexSourceMapping() 
    3226{ 
    33 //  if (!algosOfAnAxis_.empty()) 
    34 //  { 
    35 //    algosOfAnAxis_[0]->computeIndexSourceMapping(this->transformationMapping_); 
    36 //    for (int idx = 1; idx < algosOfAnAxis_.size(); ++idx) 
    37 //    { 
    38 //      algosOfAnAxis_[idx]->computeIndexSourceMapping(algosOfAnAxis_[idx-1]->getTransformationMapping()); 
    39 //    } 
    40 //    this->transformationMapping_ = algosOfAnAxis_[algosOfAnAxis_.size()-1]->getTransformationMapping(); 
    41 //  } 
    4227} 
    4328 
     
    162147  } 
    163148} 
    164  
    165  
    166149} 
  • XIOS/trunk/src/transformation/axis_algorithm_transformation.hpp

    r623 r624  
     1/*! 
     2   \file axis_algorithm_transformation.hpp 
     3   \author Ha NGUYEN 
     4   \since 14 May 2015 
     5   \date 09 June 2015 
     6 
     7   \brief Interface for all axis transformation algorithms. 
     8 */ 
    19#ifndef __XIOS_AXIS_ALGORITHM_TRANSFORMATION_HPP__ 
    210#define __XIOS_AXIS_ALGORITHM_TRANSFORMATION_HPP__ 
     
    412#include "generic_algorithm_transformation.hpp" 
    513#include "axis.hpp" 
    6 #include "concrete_algo.hpp" 
    714 
    815namespace xios { 
    916 
     17/*! 
     18  \class CAxisAlgorithmTransformation 
     19  Algorithms for axis. 
     20*/ 
    1021class CAxisAlgorithmTransformation : public virtual CGenericAlgorithmTransformation 
    1122{ 
     
    2435                                                        std::vector<CArray<size_t,1> >& globalIndexSrcGrid); 
    2536  void computeIndexSourceMapping(); 
     37 
    2638protected: 
     39  //! Global index of an axis on grid destination 
    2740  std::vector<int> axisDestGlobalIndex_; 
     41 
     42  //! Size of 
    2843  int axisDestGlobalSize_; 
    2944 
  • XIOS/trunk/src/transformation/axis_algorithm_zoom.cpp

    r623 r624  
     1/*! 
     2   \file axis_algorithm_zoom.cpp 
     3   \author Ha NGUYEN 
     4   \since 03 June 2015 
     5   \date 12 June 2015 
     6 
     7   \brief Algorithm for zooming on an axis. 
     8 */ 
    19#include "axis_algorithm_zoom.hpp" 
    210 
     
    2230} 
    2331 
     32/*! 
     33  Compute the index mapping between axis on grid source and one on grid destination 
     34*/ 
    2435void CAxisAlgorithmZoom::computeIndexSourceMapping() 
    2536{ 
     
    4354} 
    4455 
     56/*! 
     57  After a zoom on axis, it should be certain that (global) zoom begin and (global) zoom size are updated 
     58*/ 
    4559void CAxisAlgorithmZoom::updateZoom() 
    4660{ 
     
    4963} 
    5064 
     65/*! 
     66  Update mask on axis 
     67  Because only zoomed region on axis is not masked, the remaining must be masked to make sure 
     68correct index be extracted 
     69*/ 
    5170void CAxisAlgorithmZoom::updateAxisDestinationMask() 
    5271{ 
  • XIOS/trunk/src/transformation/axis_algorithm_zoom.hpp

    r623 r624  
     1/*! 
     2   \file axis_algorithm_zoom.hpp 
     3   \author Ha NGUYEN 
     4   \since 03 June 2015 
     5   \date 12 June 2015 
     6 
     7   \brief Algorithm for zooming on an axis. 
     8 */ 
    19#ifndef __XIOS_AXIS_ALGORITHM_ZOOM_HPP__ 
    210#define __XIOS_AXIS_ALGORITHM_ZOOM_HPP__ 
     
    715 
    816namespace xios { 
    9  
     17/*! 
     18  \class CAxisAlgorithmZoom 
     19  Implementing zoom on axis 
     20  A zoomed region can be considered as region that isnt masked. 
     21  Only this zoomed region is extracted to write on Netcdf. 
     22*/ 
    1023class CAxisAlgorithmZoom : public CAxisAlgorithmTransformation 
    1124{ 
     
    2033  void updateAxisDestinationMask(); 
    2134  void updateZoom(); 
     35 
    2236private: 
     37  //! Global zoom begin on axis 
    2338  StdSize zoomBegin_; 
     39 
     40  //! Global zoom end on axis 
    2441  StdSize zoomEnd_; 
     42 
     43  //! Global zoom size on axis 
    2544  StdSize zoomSize_; 
    2645 
    2746private: 
     47  //! Axis on grid destination 
    2848  CAxis* axisDest_; 
     49 
     50  //! Axis on grid source 
    2951  CAxis* axisSrc_; 
    3052}; 
  • XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp

    r623 r624  
     1/*! 
     2   \file generic_algorithm_transformation.hpp 
     3   \author Ha NGUYEN 
     4   \since 14 May 2015 
     5   \date 09 June 2015 
     6 
     7   \brief Interface for all transformation algorithms. 
     8 */ 
    19#include "generic_algorithm_transformation.hpp" 
    210 
     
    2634                                                   iteTransMap = transformationMapping_.end(); 
    2735  std::vector<int>::const_iterator itbVec, itVec, iteVec; 
    28   std::vector<CArray<size_t,1> > globalIndexSrcGrid((itTransMap->second).size()); 
     36  std::vector<CArray<size_t,1> > globalIndexSrcGrid; //((itTransMap->second).size()); 
    2937  CArray<size_t,1> globalIndexDestGrid; 
    30  
    3138  for (itTransMap = itbTransMap; itTransMap != iteTransMap; ++itTransMap) 
    3239  { 
     40 
    3341    this->computeGlobalIndexFromGlobalIndexElement(itTransMap->first, 
    3442                                                   itTransMap->second, 
  • XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp

    r623 r624  
     1/*! 
     2   \file generic_algorithm_transformation.hpp 
     3   \author Ha NGUYEN 
     4   \since 14 May 2015 
     5   \date 09 June 2015 
     6 
     7   \brief Interface for all transformation algorithms. 
     8 */ 
    19#ifndef __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__ 
    210#define __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__ 
     
    715 
    816namespace xios { 
    9  
     17  /*! 
     18  \class CGenericAlgorithmTransformation 
     19  This class defines the interface for all other inherted algorithms class 
     20  */ 
    1021class CGenericAlgorithmTransformation 
    1122{ 
  • XIOS/trunk/src/transformation/grid_transformation.cpp

    r623 r624  
    33   \author Ha NGUYEN 
    44   \since 14 May 2015 
    5    \date 09 June 2015 
     5   \date 18 June 2015 
    66 
    77   \brief Interface for all transformations. 
     
    6262} 
    6363 
     64/*! 
     65  Initialize the mapping between the first grid source and the original one 
     66  In a series of transformation, for each step, there is a need to "create" a new grid that plays a role of "temporary" source. 
     67Because at the end of the series, we need to know about the index mapping between the final grid destination and original grid source, 
     68for each transformation, we need to make sure that the current "temporary source" maps its global index correctly to the original one. 
     69*/ 
    6470void CGridTransformation::initializeMappingOfOriginalGridSource() 
    6571{ 
     
    100106} 
    101107 
     108/*! 
     109  Initialize the algorithms (transformations) 
     110*/ 
    102111void CGridTransformation::initializeAlgorithms() 
    103112{ 
     
    154163} 
    155164 
     165/*! 
     166  Select algorithm correspoding to its transformation type and its position in each element 
     167  \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 
     168                                             and position of axis is 2 
     169  \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 
     170  \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 
     171*/ 
    156172void CGridTransformation::selectAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 
    157173{ 
     
    159175} 
    160176 
     177/*! 
     178  Select algorithm of an axis correspoding to its transformation type and its position in each element 
     179  \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 
     180                                             and position of axis is 2 
     181  \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 
     182  \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 
     183*/ 
    161184void CGridTransformation::selectAxisAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 
    162185{ 
     
    188211} 
    189212 
     213/*! 
     214  Select algorithm of a domain correspoding to its transformation type and its position in each element 
     215  \param [in] elementPositionInGrid position of element in grid. e.g: a grid has 1 domain and 1 axis, then position of domain is 1 (because it contains 2 basic elements) 
     216                                             and position of axis is 2 
     217  \param [in] transType transformation type, for now we have Zoom_axis, inverse_axis 
     218  \param [in] transformationOrder position of the transformation in an element (an element can have several transformation) 
     219*/ 
    190220void CGridTransformation::selectDomainAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder) 
    191221{ 
    192  
    193 } 
    194  
     222} 
     223 
     224/*! 
     225  Assign the current grid destination to the grid source in the new transformation. 
     226The current grid destination plays the role of grid source in next transformation (if any). 
     227Only element on which the transformation is performed is modified 
     228  \param [in] elementPositionInGrid position of element in grid 
     229  \param [in] transType transformation type 
     230*/ 
    195231void CGridTransformation::setUpGrid(int elementPositionInGrid, ETranformationType transType) 
    196232{ 
     
    211247} 
    212248 
     249/*! 
     250  Perform all transformations 
     251  For each transformation, there are some things to do: 
     252  -) Chose the correct algorithm by transformation type and position of element 
     253  -) Calculate the mapping of global index between the current grid source and grid destination 
     254  -) Calculate the mapping of global index between current grid DESTINATION and ORIGINAL grid SOURCE 
     255  -) Make current grid destination become grid source in the next transformation 
     256*/ 
    213257void CGridTransformation::computeAll() 
    214258{ 
     
    234278    const CArray<size_t,1>& globalIndexGridDestSendToServer = distributionClientDest.getGlobalDataIndexSendToServer(); 
    235279 
    236    std::cout << "global index grid  dest send to server " << globalIndexGridDestSendToServer << std::endl; 
    237280    // ComputeTransformation of global index of each element 
    238281    std::vector<int> gridDestinationDimensionSize = gridDestination_->getGlobalDimension(); 
     
    250293  } 
    251294 
    252  std::cout << "global index destination 0 final " << *globalIndexOfCurrentGridSource_ << std::endl; 
    253  std::cout << "global index destination 1 final " << *globalIndexOfOriginalGridSource_ << std::endl; 
    254295  updateFinalGridDestination(); 
    255296  computeFinalTransformationMapping(); 
     
    269310  CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 
    270311  const CArray<int, 1>& localMaskIndexOnClientDest = distributionClientDest.getLocalMaskIndexOnClient(); 
    271   std::cout << "local mask " << localMaskIndexOnClientDest << std::endl; 
    272  
    273312  const CArray<size_t,1>& globalIndexOnClientDest = distributionClientDest.getGlobalDataIndexSendToServer(); 
    274   std::cout << "global index " << globalIndexOnClientDest <<  std::endl; 
     313 
    275314  CArray<size_t, 1>::const_iterator itbArr, itArr, iteArr; 
    276315  itbArr = globalIndexOnClientDest.begin(); 
     
    308347  } 
    309348 
    310   std::cout << "index to modify " << *maskIndexToModify << std::endl; 
    311349  gridDestination_->modifyMask(*maskIndexToModify); 
    312350 
     
    339377 int sendBuffSize = 0; 
    340378 for (itSend = itbSend; itSend != iteSend; ++itSend) sendBuffSize += (itSend->second).size(); 
    341  
    342  std::cout << "global index destination 0 before" << *globalIndexOfCurrentGridSource_ << std::endl; 
    343  std::cout << "global index destination 1 before" << *globalIndexOfOriginalGridSource_ << std::endl; 
    344379 
    345380 typedef unsigned long Scalar; 
     
    401436 if (globalIndexOfCurrentGridSource_->numElements()  != nbCurrentGridSource) 
    402437 { 
    403    if ((0 != nbCurrentGridSource) && (0 != globalIndexOfCurrentGridSource_)) 
    404    { 
    405      delete globalIndexOfCurrentGridSource_; 
    406      globalIndexOfCurrentGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 
    407    } 
     438   delete globalIndexOfCurrentGridSource_; 
     439   globalIndexOfCurrentGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 
    408440 } 
    409441 
    410442 if (globalIndexOfOriginalGridSource_->numElements() != nbCurrentGridSource) 
    411443 { 
    412    if ((0 != nbCurrentGridSource) && (0 != globalIndexOfOriginalGridSource_)) 
    413    { 
    414      delete globalIndexOfOriginalGridSource_; 
    415      globalIndexOfOriginalGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 
    416    } 
     444   delete globalIndexOfOriginalGridSource_; 
     445   globalIndexOfOriginalGridSource_ = new CArray<size_t,1>(nbCurrentGridSource); 
    417446 } 
    418447 
     
    434463 } 
    435464 
    436  std::cout << "global index destination 0 after " << *globalIndexOfCurrentGridSource_ << std::endl; 
    437  std::cout << "global index destination 1 after " << *globalIndexOfOriginalGridSource_ << std::endl; 
    438465 if (0 != sendBuffSize) delete [] sendBuff; 
    439466 if (0 != recvBuffSize) delete [] recvBuff; 
     
    475502  const CArray<size_t,1>& globalIndexOnClientDest = distributionClientDest.getGlobalDataIndexSendToServer(); //gridDestination_->getDistributionClient()->getGlobalDataIndexSendToServer(); 
    476503 
    477  std::cout << "dest: local index " << localIndexOnClientDest << std::endl; 
    478  std::cout << "dest: global index " << globalIndexOnClientDest << std::endl; 
    479504  const CArray<int, 1>& localIndexOnClientSrc = distributionClientSrc.getLocalDataIndexOnClient(); //gridSource_->getDistributionClient()->getLocalDataIndexOnClient(); 
    480505  const CArray<size_t,1>& globalIndexOnClientSrc = distributionClientSrc.getGlobalDataIndexSendToServer(); //gridSource_->getDistributionClient()->getGlobalDataIndexSendToServer(); 
    481  std::cout << "src: local index " << localIndexOnClientSrc << std::endl; 
    482  std::cout << "src: global index " << globalIndexOnClientSrc << std::endl; 
     506 
    483507  std::vector<size_t>::const_iterator itbVec, itVec, iteVec; 
    484508  CArray<size_t, 1>::const_iterator itbArr, itArr, iteArr; 
     
    506530        { 
    507531          int localIdx = std::distance(itbArr, itArr); 
    508           (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); // Local index of un-extracted data (only domain) 
    509 //          (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = (localIdx); // Local index of extracted data 
     532//          (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = localIndexOnClientDest(localIdx); // Local index of un-extracted data (only domain) 
     533          (*localIndexToReceiveOnGridDest_[sourceRank][i])(idx) = (localIdx); // Local index of extracted data 
    510534        } 
    511535      } 
    512536    } 
    513 //    std::cout << "local index to receive from source Rank = " << sourceRank << (*localIndexToReceiveOnGridDest_[sourceRank][i]) << std::endl; 
    514537  } 
    515538 
     
    536559      } 
    537560    } 
    538     std::cout << "local index to send to dest Rank = " << destRank << (*localIndexToSendFromGridSource_[destRank]) << std::endl; 
    539561  } 
    540562} 
     
    544566  \return local index of data 
    545567*/ 
    546 std::map<int, CArray<int,1>* > CGridTransformation::getLocalIndexToSendFromGridSource() 
     568const std::map<int, CArray<int,1>* >& CGridTransformation::getLocalIndexToSendFromGridSource() const 
    547569{ 
    548570  return localIndexToSendFromGridSource_; 
     
    553575  \return local index of data 
    554576*/ 
    555 std::map<int, std::vector<CArray<int,1>* > > CGridTransformation::getLocalIndexToReceiveOnGridDest() 
     577const std::map<int, std::vector<CArray<int,1>* > >& CGridTransformation::getLocalIndexToReceiveOnGridDest() const 
    556578{ 
    557579  return localIndexToReceiveOnGridDest_; 
  • XIOS/trunk/src/transformation/grid_transformation.hpp

    r623 r624  
    33   \author Ha NGUYEN 
    44   \since 14 May 2015 
    5    \date 09 June 2015 
     5   \date 18 June 2015 
    66 
    77   \brief Interface for all transformations. 
     
    4040  void computeAll(); 
    4141 
    42  
    43   std::map<int, CArray<int,1>* > getLocalIndexToSendFromGridSource(); 
    44   std::map<int, std::vector<CArray<int,1>* > > getLocalIndexToReceiveOnGridDest(); 
     42  const std::map<int, CArray<int,1>* >& getLocalIndexToSendFromGridSource() const; 
     43  const std::map<int, std::vector<CArray<int,1>* > >& getLocalIndexToReceiveOnGridDest() const; 
    4544 
    4645private: 
  • XIOS/trunk/src/transformation/transformation_mapping.cpp

    r623 r624  
    33   \author Ha NGUYEN 
    44   \since 14 May 2015 
    5    \date 09 June 2015 
     5   \date 18 June 2015 
    66 
    77   \brief Take charge of communication among clients to exchange transformed data. 
     
    3333  } 
    3434 
    35   std::cout << "global index grid src " << globalIndexGridSrc << std::endl; 
    3635  gridIndexClientClientMapping_ = new CClientServerMappingDistributed(globalIndexOfServer, 
    3736                                                                      client->intraComm, 
  • XIOS/trunk/src/transformation/transformation_mapping.hpp

    r623 r624  
    4747  //! Mapping of client rank of grid destination and global index to send from grid source 
    4848  std::map<int,std::vector<size_t> > globalIndexSendToGridDestMapping_; 
    49  
    5049}; 
    5150 
Note: See TracChangeset for help on using the changeset viewer.