Changeset 871


Ignore:
Timestamp:
06/09/16 11:33:37 (5 years ago)
Author:
mhnguyen
Message:

Correcting a bug which sometimes make transformations between different size grids incorrect

+) Correct inputs of some functions
+) Add some auxilliary functions.
+) Add new test cases for test_remap

Test
+) Basic test pass
+) Single horizontal and vertical interpolation are correct
+) Chained interpolation are not correct

Location:
XIOS/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/inputs/REMAP/iodef.xml

    r837 r871  
    44 <context id="test"> 
    55   <calendar type="Gregorian" start_date="2012-03-01 15:00:00" time_origin="2012-02-28 15:00:00 + 1d" /> 
    6  
    7  
    86   <field_definition level="1" > 
    97     <field id="src_field" operation="instant" domain_ref="src_domain"/> 
     8     <field id="src_field_3D" operation="instant" domain_ref="src_domain" axis_ref="src_axis"/> 
     9     <field id="src_field_3D_interp" operation="instant" field_ref="src_field_3D" axis_ref="dst_axis"/> 
     10     <field id="src_field_3D_pression" operation="instant" grid_ref="src_grid_3D"/> 
    1011     <field id="src_field_clone" operation="instant" field_ref="src_field" domain_ref="src_domain_clone"/> 
    1112     <field id="dst_field" operation="instant" field_ref="src_field" domain_ref="dst_domain"/> 
    12      <field id="tmp_field" operation="instant" domain_ref="src_domain_regular_tmp"/> 
    13      <field id="tmp_field_clone" field_ref="tmp_field"/> 
    14      <field id="tmp_field_1" operation="instant" grid_ref="src_grid_curvilinear" /> 
    15      <field id="tmp_field_2" operation="instant" grid_ref="src_grid_unstructured" /> 
    16      <field id="dst_field_regular" operation="instant" field_ref="tmp_field_2" grid_ref="dst_grid_regular" read_access="true"/> 
    1713     <field id="dst_field_regular_pole" operation="instant" field_ref="src_field" domain_ref="dst_domain_regular_pole"/> 
    18      <field id="dst_field_regular_pole_1" operation="instant" field_ref="tmp_field" domain_ref="dst_domain_regular_pole"/> 
    19      <field id="dst_field_regular_pole_2" operation="instant" field_ref="tmp_field_clone" domain_ref="dst_domain_regular_pole"/> 
     14<!--     <field id="tmp_field" operation="instant" domain_ref="src_domain_regular_tmp"/>--> 
     15<!--     <field id="tmp_field_clone" field_ref="tmp_field"/>--> 
     16<!--     <field id="tmp_field_1" operation="instant" grid_ref="src_grid_curvilinear" />--> 
     17<!--     <field id="tmp_field_2" operation="instant" grid_ref="src_grid_unstructured" />--> 
     18<!--     <field id="dst_field_regular" operation="instant" field_ref="tmp_field_2" grid_ref="dst_grid_regular" read_access="true"/>--> 
     19<!--     <field id="dst_field_3D" operation="instant" field_ref="src_field_3D" grid_ref="dst_grid_3D"/>--> 
     20<!--     <field id="dst_field_regular_pole_1" operation="instant" field_ref="tmp_field" domain_ref="dst_domain_regular_pole"/>--> 
     21<!--     <field id="dst_field_regular_pole_2" operation="instant" field_ref="tmp_field_clone" domain_ref="dst_domain_regular_pole"/>--> 
    2022   </field_definition> 
    2123 
    2224   <file_definition type="one_file" par_access="collective" output_freq="1ts" output_level="10" enabled=".TRUE."> 
    2325     <file id="output" name="output"> 
    24         <field field_ref="src_field" name="field" /> 
     26<!--        <field field_ref="src_field" name="field" />--> 
     27     </file> 
     28     <file id="output_3D" name="output_3D"> 
     29        <field field_ref="src_field_3D" name="field" /> 
     30     </file> 
     31    <file id="output_3D_pression" name="output_3D_pression"> 
     32        <field field_ref="src_field_3D_pression" name="field" /> 
    2533     </file> 
    2634     <file id="output_clone" name="output_clone"> 
    27         <field field_ref="src_field_clone" name="field" /> 
     35<!--        <field field_ref="src_field_clone" name="field" />--> 
    2836     </file> 
    2937     <file id="output_dst" name="output_dst" type="one_file"> 
    30         <field field_ref="dst_field" name="field" /> 
     38<!--        <field field_ref="dst_field" name="field" />--> 
    3139     </file> 
    3240     <file id="out_dst_regular_pole" name="out_dst_regular_pole" type="one_file"> 
    33         <field field_ref="dst_field_regular_pole" name="field" /> 
     41<!--        <field field_ref="dst_field_regular_pole" name="field" />--> 
    3442     </file> 
    35      <file id="out_dst_regular_pole_1" name="out_dst_regular_pole_1" type="one_file"> 
    36         <field field_ref="dst_field_regular_pole_1" name="field" /> 
     43     <file id="regular_field_3D" name="regular_field_3D" type="one_file"> 
     44        <field field_ref="src_field_3D_interp" name="field" domain_ref="dst_domain_regular_pole" /> 
    3745     </file> 
    38      <file id="out_dst_regular_pole_2" name="out_dst_regular_pole_2" type="one_file"> 
    39         <field field_ref="dst_field_regular_pole_2" name="field" /> 
     46    <file id="regular_field_3D_interp" name="regular_field_3D_interp" type="one_file"> 
     47        <field field_ref="src_field_3D_interp" name="field" /> 
    4048     </file> 
    41      <file id="output_dst_regular" name="output_dst_regular" type="one_file"> 
    42         <field field_ref="dst_field_regular" name="field" /> 
    43      </file> 
    44      <file id="output_dst_curvilinear" name="output_dst_curvilinear" type="one_file"> 
    45         <field field_ref="tmp_field_1" operation="instant"/> 
    46      </file> 
    47      <file id="output_dst_unstructured" name="output_dst_unstructured" type="one_file"> 
    48         <field field_ref="tmp_field_2" operation="instant"/> 
    49      </file> 
    50      <file id="output_src_regular_tmp" name="output_src_regular_tmp" mode="read" type="one_file"> 
    51         <field id="src_field_regular_tmp" name="field" domain_ref="src_domain_regular_tmp" operation="instant"/> 
    52      </file> 
    53      <file id="output_src_curvilinear" name="output_src_curvilinear" mode="read" type="one_file"> 
    54         <field id="src_field_curvilinear" name="field_A" grid_ref="src_grid_curvilinear" operation="instant"/> 
    55      </file> 
    56      <file id="output_unstructured" name="output_unstructured" mode="read" type="one_file"> 
    57         <field id="field_src_unstructred" name="field" grid_ref="src_grid_unstructured" operation="instant"/> 
    58      </file> 
     49<!--     <file id="out_dst_regular_pole_1" name="out_dst_regular_pole_1" type="one_file">--> 
     50<!--        <field field_ref="dst_field_regular_pole_1" name="field" />--> 
     51<!--     </file>--> 
     52<!--     <file id="out_dst_regular_pole_2" name="out_dst_regular_pole_2" type="one_file">--> 
     53<!--        <field field_ref="dst_field_regular_pole_2" name="field" />--> 
     54<!--     </file>--> 
     55<!--     <file id="output_dst_regular" name="output_dst_regular" type="one_file">--> 
     56<!--        <field field_ref="dst_field_regular" name="field" />--> 
     57<!--     </file>--> 
     58<!--     <file id="output_dst_curvilinear" name="output_dst_curvilinear" type="one_file">--> 
     59<!--        <field field_ref="tmp_field_1" operation="instant"/>--> 
     60<!--     </file>--> 
     61<!--     <file id="output_dst_unstructured" name="output_dst_unstructured" type="one_file">--> 
     62<!--        <field field_ref="tmp_field_2" operation="instant"/>--> 
     63<!--     </file>--> 
     64<!--     <file id="output_src_regular_tmp" name="output_src_regular_tmp" mode="read" type="one_file">--> 
     65<!--        <field id="src_field_regular_tmp" name="field" domain_ref="src_domain_regular_tmp" operation="instant"/>--> 
     66<!--     </file>--> 
     67<!--     <file id="output_src_curvilinear" name="output_src_curvilinear" mode="read" type="one_file">--> 
     68<!--        <field id="src_field_curvilinear" name="field_A" grid_ref="src_grid_curvilinear" operation="instant"/>--> 
     69<!--     </file>--> 
     70<!--     <file id="output_unstructured" name="output_unstructured" mode="read" type="one_file">--> 
     71<!--        <field id="field_src_unstructred" name="field" grid_ref="src_grid_unstructured" operation="instant"/>--> 
     72<!--     </file>--> 
    5973   </file_definition> 
    6074 
    6175 
    6276   <axis_definition> 
     77     <axis id="dst_axis" positive="down" n_glo="2" value="(0,1)[120 220]"> 
     78        <interpolate_axis type="polynomial" order="1" coordinate="src_field_3D_pression"/> 
     79<!--        <interpolate_axis type="polynomial" order="1" />--> 
     80     </axis> 
     81     <axis id="src_axis" positive="down" /> 
    6382     <axis id="src_axis_curvilinear" /> 
    64    </axis_definition> 
    65    <axis_definition> 
    66      <axis id="axis_surface_curvi" /> 
    6783   </axis_definition> 
    6884 
     
    7389       <interpolate_domain/> 
    7490     </domain> 
    75      <domain id="dst_domain_regular_pole" ni_glo="180" nj_glo="90" type="rectilinear"> 
     91     <domain id="dst_domain_regular_pole" ni_glo="90" nj_glo="45" type="rectilinear"> 
    7692       <generate_rectilinear_domain id="domain_regular_pole"/> 
    7793       <interpolate_domain/> 
    78        <zoom_domain id="zoom_0" ibegin="0" ni="90" jbegin="0" nj="90"/> 
    7994     </domain> 
    8095     <domain id="dst_domain_regular" ni_glo="90" nj_glo="45" type="rectilinear"> 
     
    104119      <domain domain_ref="dst_domain_regular"/> 
    105120    </grid> 
     121    <grid id="src_grid_3D"> 
     122      <domain domain_ref="src_domain"/> 
     123      <axis axis_ref="src_axis"/> 
     124    </grid> 
     125    <grid id="dst_grid_3D"> 
     126<!--      <domain domain_ref="src_domain"/>--> 
     127      <domain domain_ref="dst_domain_regular_pole"/> 
     128<!--      <axis axis_ref="src_axis"/>--> 
     129      <axis axis_ref="dst_axis"/> 
     130    </grid> 
    106131  </grid_definition> 
    107132  </context> 
  • XIOS/trunk/src/test/test_remap.f90

    r824 r871  
    2020  DOUBLE PRECISION,ALLOCATABLE :: src_boundslon(:,:), dst_boundslon(:,:) 
    2121  DOUBLE PRECISION,ALLOCATABLE :: src_boundslat(:,:), dst_boundslat(:,:) 
    22   DOUBLE PRECISION,ALLOCATABLE :: src_field(:), tmp_field(:), tmp_field_1(:), tmp_field_2(:) 
     22  DOUBLE PRECISION,ALLOCATABLE :: src_field(:), tmp_field(:), tmp_field_1(:), tmp_field_2(:), src_field_3D(:,:), lval(:), lval1(:), src_field_pression(:,:) 
    2323  INTEGER :: src_ni_glo, dst_ni_glo; 
    2424  INTEGER :: src_nvertex, dst_nvertex; 
     
    3434  INTEGER :: ts 
    3535  INTEGER :: i 
     36  INTEGER,PARAMETER :: llm=5, interpolatedLlm = 4 
    3637 
    3738  CALL MPI_INIT(ierr) 
     
    6566  ALLOCATE(src_boundslat(src_nvertex,src_ni)) 
    6667  ALLOCATE(src_field(src_ni)) 
     68  ALLOCATE(src_field_3D(src_ni,llm)) 
     69  ALLOCATE(src_field_pression(src_ni,llm)) 
     70  ALLOCATE(lval(llm)) 
     71  ALLOCATE(lval1(interpolatedLlm)) 
    6772 
    6873  ierr=NF90_INQ_VARID(ncid,"lon",varid) 
     
    7681  ierr=NF90_INQ_VARID(ncid,"val",varid) 
    7782  ierr=NF90_GET_VAR(ncid,varid, src_field, start=(/src_ibegin+1/),count=(/src_ni/)) 
     83  DO i=1,src_ni 
     84    src_field_3D(i,:) = src_field(i) 
     85  ENDDO 
    7886 
     87  DO i=1,llm 
     88    lval(i) = i*100 
     89    src_field_pression(:,i) = i * 100 
     90    src_field_3D(:,i) = src_field_3D(:,i) + i * 10 
     91  ENDDO 
     92 
     93  DO i=1,interpolatedLlm 
     94    lval1(i) = i*10 + 2 
     95  ENDDO 
    7996 
    8097  ierr=NF90_OPEN(dst_file, NF90_NOWRITE, ncid) 
     
    108125  ierr=NF90_GET_VAR(ncid,varid, dst_boundslat, start=(/1,dst_ibegin+1/),count=(/dst_nvertex,dst_ni/)) 
    109126 
     127 
    110128  CALL xios_context_initialize("test",comm) 
    111129  CALL xios_get_handle("test",ctx_hdl) 
     
    120138                            bounds_lon_1D=src_boundslon, bounds_lat_1D=src_boundslat, nvertex=src_nvertex) 
    121139 
     140  CALL xios_set_axis_attr("src_axis", n_glo=llm, value=lval) 
     141 
    122142  CALL xios_set_domain_attr("dst_domain", ni_glo=dst_ni_glo, ibegin=dst_ibegin, ni=dst_ni, type="unstructured") 
    123143  CALL xios_set_domain_attr("dst_domain", lonvalue_1D=dst_lon, latvalue_1D=dst_lat, & 
     
    128148 
    129149  CALL xios_close_context_definition() 
    130   CALL xios_get_domain_attr("src_domain_regular_tmp", ni=src_tmp_ni, nj=src_tmp_nj) 
    131   ALLOCATE(tmp_field(src_tmp_ni*src_tmp_nj)) 
     150!  CALL xios_get_domain_attr("src_domain_regular_tmp", ni=src_tmp_ni, nj=src_tmp_nj) 
     151!  ALLOCATE(tmp_field(src_tmp_ni*src_tmp_nj)) 
     152! 
     153!  CALL xios_get_axis_attr("src_axis_curvilinear", n=src_tmp_n) 
     154!  CALL xios_get_domain_attr("src_domain_curvilinear", ni=src_tmp_ni, nj=src_tmp_nj) 
     155!  ALLOCATE(tmp_field_1(src_tmp_ni*src_tmp_nj*src_tmp_n)) 
    132156 
    133   CALL xios_get_axis_attr("src_axis_curvilinear", n=src_tmp_n) 
    134   CALL xios_get_domain_attr("src_domain_curvilinear", ni=src_tmp_ni, nj=src_tmp_nj) 
    135   ALLOCATE(tmp_field_1(src_tmp_ni*src_tmp_nj*src_tmp_n)) 
     157!  CALL xios_get_domain_attr("src_domain_unstructured", ni=src_tmp_ni, nj=src_tmp_nj) 
     158!  ALLOCATE(tmp_field_2(src_tmp_ni*src_tmp_nj)) 
    136159 
    137   CALL xios_get_domain_attr("src_domain_unstructured", ni=src_tmp_ni, nj=src_tmp_nj) 
    138   ALLOCATE(tmp_field_2(src_tmp_ni*src_tmp_nj)) 
     160  DO ts=1,5 
    139161 
    140   DO ts=1,1 
    141  
    142     CALL xios_recv_field("src_field_regular_tmp", tmp_field) 
    143     CALL xios_recv_field("src_field_curvilinear", tmp_field_1) 
    144     CALL xios_recv_field("field_src_unstructred", tmp_field_2) 
     162!    CALL xios_recv_field("src_field_regular_tmp", tmp_field) 
     163!    CALL xios_recv_field("src_field_curvilinear", tmp_field_1) 
     164!    CALL xios_recv_field("field_src_unstructred", tmp_field_2) 
    145165    CALL xios_update_calendar(ts) 
    146166    CALL xios_send_field("src_field",src_field) 
    147     CALL xios_send_field("tmp_field",tmp_field) 
    148     CALL xios_send_field("tmp_field_1",tmp_field_1) 
    149     CALL xios_send_field("tmp_field_2",tmp_field_2) 
     167    CALL xios_send_field("src_field_3D",src_field_3D) 
     168    CALL xios_send_field("src_field_3D_pression",src_field_pression) 
     169!    CALL xios_send_field("tmp_field",tmp_field) 
     170!    CALL xios_send_field("tmp_field_1",tmp_field_1) 
     171!    CALL xios_send_field("tmp_field_2",tmp_field_2) 
    150172    CALL wait_us(5000) ; 
    151173  ENDDO 
     
    155177  DEALLOCATE(src_lon, src_lat, src_boundslon,src_boundslat, src_field) 
    156178  DEALLOCATE(dst_lon, dst_lat, dst_boundslon,dst_boundslat) 
    157   DEALLOCATE(tmp_field, tmp_field_1, tmp_field_2) 
     179!  DEALLOCATE(tmp_field, tmp_field_1, tmp_field_2) 
    158180 
    159181  CALL MPI_COMM_FREE(comm, ierr) 
  • XIOS/trunk/src/transformation/generic_algorithm_transformation.cpp

    r868 r871  
    201201                                  srcRank, 
    202202                                  src2DstMap, 
     203                                  gridSrc, 
    203204                                  gridDst, 
    204                                   gridSrc, 
    205205                                  globalElementIndexOnProc, 
    206206                                  globaIndexWeightFromSrcToDst); 
  • XIOS/trunk/src/transformation/grid_transformation.cpp

    r867 r871  
    2323namespace xios { 
    2424CGridTransformation::CGridTransformation(CGrid* destination, CGrid* source) 
    25 : gridSource_(source), gridDestination_(destination), originalGridSource_(source), 
    26   algoTypes_(), nbAlgos_(0), tempGrids_(), 
     25: gridSource_(source), gridDestination_(destination), tmpGridDestination_(destination), 
     26  originalGridSource_(source), algoTypes_(), nbAlgos_(0), tempGridSrcs_(), tempGridDests_(), 
    2727  auxInputs_(), dynamicalTransformation_(false), timeStamp_() 
    2828 
     
    279279 
    280280/*! 
     281  If there are more than one transformation, a new temporary grid will be created and it will play the role of grid destination. 
     282This new created one keeps a pointer to the real transformed element of grid destination and generate new copies of other elements from grid source. 
     283  \param [in] elementPositionInGrid position of element in grid 
     284  \param [in] transType transformation type 
     285*/ 
     286void CGridTransformation::setUpGridDestination(int elementPositionInGrid, ETranformationType transType, int nbTransformation) 
     287{ 
     288  if (isSpecialTransformation(transType)) return; 
     289 
     290  if (!tempGridDests_.empty() && (getNbAlgo() == tempGridDests_.size())) 
     291  { 
     292    tempGridDests_.resize(0); 
     293//    tmpGridDestination_ = tempGridDests_[nbTransformation]; 
     294//    return; 
     295  } 
     296  std::vector<CAxis*> axisListDestP = gridDestination_->getAxis(); 
     297  std::vector<CAxis*> axisListSrcP = gridSource_->getAxis(), axisDst; 
     298 
     299  std::vector<CDomain*> domListDestP = gridDestination_->getDomains(); 
     300  std::vector<CDomain*> domListSrcP = gridSource_->getDomains(), domainDst; 
     301 
     302  int axisIndex = -1, domainIndex = -1; 
     303  switch (transType) 
     304  { 
     305    case TRANS_INTERPOLATE_DOMAIN: 
     306    case TRANS_ZOOM_DOMAIN: 
     307      domainIndex = elementPosition2DomainPositionInGrid_[elementPositionInGrid]; 
     308      break; 
     309 
     310    case TRANS_INTERPOLATE_AXIS: 
     311    case TRANS_ZOOM_AXIS: 
     312    case TRANS_INVERSE_AXIS: 
     313      axisIndex =  elementPosition2AxisPositionInGrid_[elementPositionInGrid]; 
     314      break; 
     315    default: 
     316      break; 
     317  } 
     318 
     319  for (int idx = 0; idx < axisListSrcP.size(); ++idx) 
     320  { 
     321    CAxis* axis = (axisIndex != idx) ? axisListSrcP[idx] : axisListDestP[idx]; 
     322    axisDst.push_back(axis); 
     323  } 
     324 
     325  for (int idx = 0; idx < domListSrcP.size(); ++idx) 
     326  { 
     327    CDomain* domain = (domainIndex != idx) ? domListSrcP[idx] : domListDestP[idx]; 
     328    domainDst.push_back(domain); 
     329  } 
     330 
     331  tmpGridDestination_ = CGrid::createGrid(domainDst, axisDst, gridDestination_->axis_domain_order); 
     332  tmpGridDestination_->computeGridGlobalDimension(domainDst, axisDst, gridDestination_->axis_domain_order); 
     333  tempGridDests_.push_back(tmpGridDestination_); 
     334} 
     335 
     336/*! 
    281337  Assign the current grid destination to the grid source in the new transformation. 
    282338The current grid destination plays the role of grid source in next transformation (if any). 
     
    285341  \param [in] transType transformation type 
    286342*/ 
    287 void CGridTransformation::setUpGrid(int elementPositionInGrid, ETranformationType transType, int nbTransformation) 
    288 { 
    289   if (!tempGrids_.empty() && (getNbAlgo()-1) == tempGrids_.size()) 
    290   { 
    291     gridSource_ = tempGrids_[nbTransformation]; 
    292     return; 
    293   } 
    294  
    295   std::vector<CAxis*> axisListDestP = gridDestination_->getAxis(); 
     343void CGridTransformation::setUpGridSource(int elementPositionInGrid, ETranformationType transType, int nbTransformation) 
     344{ 
     345  if (!tempGridSrcs_.empty() && (getNbAlgo()-1) == tempGridSrcs_.size()) 
     346  { 
     347    tempGridSrcs_.resize(0); 
     348//    gridSource_ = tempGridSrcs_[nbTransformation]; 
     349//    return; 
     350  } 
     351 
     352  std::vector<CAxis*> axisListDestP = tmpGridDestination_->getAxis(); 
    296353  std::vector<CAxis*> axisListSrcP = gridSource_->getAxis(), axisSrc; 
    297354 
    298   std::vector<CDomain*> domListDestP = gridDestination_->getDomains(); 
     355  std::vector<CDomain*> domListDestP = tmpGridDestination_->getDomains(); 
    299356  std::vector<CDomain*> domListSrcP = gridSource_->getDomains(), domainSrc; 
    300357 
     
    318375  for (int idx = 0; idx < axisListSrcP.size(); ++idx) 
    319376  { 
    320     CAxis* axis = CAxis::createAxis(); 
    321     if (axisIndex != idx) axis->axis_ref.setValue(axisListSrcP[idx]->getId()); 
    322     else axis->axis_ref.setValue(axisListDestP[idx]->getId()); 
    323     axis->solveRefInheritance(true); 
    324     axis->checkAttributesOnClient(); 
    325     axisSrc.push_back(axis); 
     377    if (axisIndex != idx) 
     378    { 
     379      CAxis* axis = axisListDestP[idx]; 
     380      axisSrc.push_back(axis); 
     381    } 
     382    else 
     383    { 
     384      CAxis* axis = CAxis::createAxis(); 
     385      axis->axis_ref.setValue(axisListDestP[idx]->getId()); 
     386      axis->solveRefInheritance(true); 
     387      axis->checkAttributesOnClient(); 
     388      axisSrc.push_back(axis); 
     389    } 
    326390  } 
    327391 
    328392  for (int idx = 0; idx < domListSrcP.size(); ++idx) 
    329393  { 
    330     CDomain* domain = CDomain::createDomain(); 
    331     if (domainIndex != idx) domain->domain_ref.setValue(domListSrcP[idx]->getId()); 
    332     else domain->domain_ref.setValue(domListDestP[idx]->getId()); 
    333     domain->solveRefInheritance(true); 
    334     domain->checkAttributesOnClient(); 
    335     domainSrc.push_back(domain); 
    336   } 
    337  
    338   gridSource_ = CGrid::createGrid(domainSrc, axisSrc, gridDestination_->axis_domain_order); 
    339   gridSource_->computeGridGlobalDimension(domainSrc, axisSrc, gridDestination_->axis_domain_order); 
    340  
    341   tempGrids_.push_back(gridSource_); 
     394    if (domainIndex != idx) 
     395    { 
     396      CDomain* domain = domListDestP[idx]; 
     397      domainSrc.push_back(domain); 
     398    } 
     399    else 
     400    { 
     401      CDomain* domain = CDomain::createDomain(); 
     402      domain->domain_ref.setValue(domListDestP[idx]->getId()); 
     403      domain->solveRefInheritance(true); 
     404      domain->checkAttributesOnClient(); 
     405      domainSrc.push_back(domain); 
     406    } 
     407  } 
     408 
     409//  for (int idx = 0; idx < axisListSrcP.size(); ++idx) 
     410//  { 
     411//    CAxis* axis = CAxis::createAxis(); 
     412//    if (axisIndex != idx) axis->axis_ref.setValue(axisListSrcP[idx]->getId()); 
     413//    else axis->axis_ref.setValue(axisListDestP[idx]->getId()); 
     414//    axis->solveRefInheritance(true); 
     415//    axis->checkAttributesOnClient(); 
     416//    axisSrc.push_back(axis); 
     417//  } 
     418// 
     419//  for (int idx = 0; idx < domListSrcP.size(); ++idx) 
     420//  { 
     421//    CDomain* domain = CDomain::createDomain(); 
     422//    if (domainIndex != idx) domain->domain_ref.setValue(domListSrcP[idx]->getId()); 
     423//    else domain->domain_ref.setValue(domListDestP[idx]->getId()); 
     424//    domain->solveRefInheritance(true); 
     425//    domain->checkAttributesOnClient(); 
     426//    domainSrc.push_back(domain); 
     427//  } 
     428 
     429  gridSource_ = CGrid::createGrid(domainSrc, axisSrc, tmpGridDestination_->axis_domain_order); 
     430  gridSource_->computeGridGlobalDimension(domainSrc, axisSrc, tmpGridDestination_->axis_domain_order); 
     431 
     432  tempGridSrcs_.push_back(gridSource_); 
    342433} 
    343434 
     
    381472    SourceDestinationIndexMap globaIndexWeightFromSrcToDst; 
    382473 
     474//    if (1 < nbAlgos_) 
     475//    { 
     476//      // Create a temporary grid destination which contains transformed element of grid destination and 
     477//      // non-transformed elements fo grid source 
     478////      if (nbAgloTransformation != (nbAlgos_-1)) setUpGridDestination(elementPositionInGrid, transType, nbAgloTransformation); 
     479//    } 
     480    setUpGridDestination(elementPositionInGrid, transType, nbAgloTransformation); 
     481 
    383482    // First of all, select an algorithm 
    384483    if (!dynamicalTransformation_ || (algoTransformation_.size() < listAlgos_.size())) 
     
    398497      algo->computeGlobalSourceIndex(elementPosition, 
    399498                                     gridSource_, 
    400                                      gridDestination_, 
     499                                     tmpGridDestination_, 
    401500                                     globaIndexWeightFromSrcToDst); 
    402501 
     
    407506      { 
    408507        // Now grid destination becomes grid source in a new transformation 
    409         if (nbAgloTransformation != (nbAlgos_-1)) setUpGrid(elementPositionInGrid, transType, nbAgloTransformation); 
     508        if (nbAgloTransformation != (nbAlgos_-1)) setUpGridSource(elementPositionInGrid, transType, nbAgloTransformation); 
    410509      } 
    411510      ++nbAgloTransformation; 
     
    426525 
    427526  // Recalculate the distribution of grid destination 
    428   CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 
     527  CDistributionClient distributionClientDest(client->clientRank, tmpGridDestination_); 
     528//  CDistributionClient distributionClientDest(client->clientRank, gridDestination_); 
    429529  CDistributionClient::GlobalLocalDataMap& globalLocalIndexGridDestSendToServer = distributionClientDest.getGlobalLocalDataSendToServer(); 
     530  const std::vector<int>& localMask = distributionClientDest.getLocalMaskIndexOnClient(); 
     531 
    430532  // Update number of local index on each transformation 
    431   nbLocalIndexOnGridDest_.push_back(globalLocalIndexGridDestSendToServer.size()); 
     533  size_t nbLocalIndex = globalLocalIndexGridDestSendToServer.size(); 
     534  nbLocalIndexOnGridDest_.push_back(nbLocalIndex); 
     535  localMaskOnGridDest_.push_back(std::vector<bool>()); 
     536  std::vector<bool>& tmpMask = localMaskOnGridDest_.back(); 
     537  tmpMask.resize(nbLocalIndex,false); 
     538//  for (int idx = 0; idx < nbLocalIndex; ++idx) 
     539//  { 
     540//    tmpMask[localMask[idx]] = true; 
     541//  } 
    432542 
    433543  // Find out number of index sent from grid source and number of index received on grid destination 
     
    671781} 
    672782 
     783/*! 
     784 Number of index will be received on the grid destination 
     785  \return number of index of data 
     786*/ 
    673787const std::list<size_t>& CGridTransformation::getNbLocalIndexToReceiveOnGridDest() const 
    674788{ 
     
    676790} 
    677791 
    678 } 
     792/*! 
     793  Local mask of data which will be received on the grid destination 
     794  \return local mask of data 
     795*/ 
     796const std::list<std::vector<bool> >& CGridTransformation::getLocalMaskIndexOnGridDest() const 
     797{ 
     798  return localMaskOnGridDest_; 
     799} 
     800 
     801} 
  • XIOS/trunk/src/transformation/grid_transformation.hpp

    r867 r871  
    4949  const std::list<RecvIndexGridDestinationMap>& getLocalIndexToReceiveOnGridDest() const; 
    5050  const std::list<size_t>& getNbLocalIndexToReceiveOnGridDest() const; 
     51  const std::list<std::vector<bool> >& getLocalMaskIndexOnGridDest() const; 
    5152 
    5253  CGrid* getGridSource() { return originalGridSource_; } 
     
    6667  void selectDomainAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder); 
    6768  void selectAlgo(int elementPositionInGrid, ETranformationType transType, int transformationOrder, bool isDomainAlgo); 
    68   void setUpGrid(int elementPositionInGrid, ETranformationType transType, int nbTransformation); 
     69  void setUpGridSource(int elementPositionInGrid, ETranformationType transType, int nbTransformation); 
     70  void setUpGridDestination(int elementPositionInGrid, ETranformationType transType, int nbTransformation); 
    6971  void computeTransformationMapping(const SourceDestinationIndexMap& globalIndexWeightFromSrcToDest); 
    7072  bool isSpecialTransformation(ETranformationType transType); 
     
    7577 
    7678  //! Grid destination on transformation 
    77   CGrid* gridDestination_; 
     79  CGrid* gridDestination_, *tmpGridDestination_; 
    7880 
    7981  //! The grid source of the first transformation (original grid source) 
     
    104106  //! Number of local index of data to receive on grid destination 
    105107  std::list<size_t> nbLocalIndexOnGridDest_; 
     108  std::list<std::vector<bool> > localMaskOnGridDest_; 
    106109 
    107110  //! Position of axis and domain in grid 
    108111  std::map<int, int> elementPosition2AxisPositionInGrid_, elementPosition2DomainPositionInGrid_; 
    109112 
    110   std::vector<CGrid*> tempGrids_; 
     113  std::vector<CGrid*> tempGridSrcs_, tempGridDests_; 
    111114  std::vector<StdString> auxInputs_; 
    112115  bool dynamicalTransformation_; 
Note: See TracChangeset for help on using the changeset viewer.