Changeset 1078 for XIOS/trunk/src


Ignore:
Timestamp:
03/17/17 16:02:40 (7 years ago)
Author:
mhnguyen
Message:

Adding rectilinear and curvilinear domain for expand_domain transformation
-) Rectilinear/curvilinear is expanded not only locally but also globally, its global size ni_glo, nj_glo become ni_glo+2 and nj_glo+2
-) Two attributes i_periodic, j_periodic are only used for rectilinear/curvilinear to process priodic condition

+) Do some minor modification

Test
+) Add test_connectivity_expand
+) On Curie
+) Work (but need more real tests)

Location:
XIOS/trunk/src
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/config/expand_domain_attribute.conf

    r941 r1078  
    22 
    33DECLARE_ENUM2(type,node,edge) 
     4 
     5// Flag to determine if domain expension should be periodic (and in which direction) 
     6DECLARE_ATTRIBUTE(bool,      i_periodic) 
     7DECLARE_ATTRIBUTE(bool,      j_periodic) 
  • XIOS/trunk/src/interface/c_attr/icexpand_domain_attr.cpp

    r981 r1078  
    1717{ 
    1818  typedef xios::CExpandDomain* expand_domain_Ptr; 
     19 
     20  void cxios_set_expand_domain_i_periodic(expand_domain_Ptr expand_domain_hdl, bool i_periodic) 
     21  { 
     22    CTimer::get("XIOS").resume(); 
     23    expand_domain_hdl->i_periodic.setValue(i_periodic); 
     24    CTimer::get("XIOS").suspend(); 
     25  } 
     26 
     27  void cxios_get_expand_domain_i_periodic(expand_domain_Ptr expand_domain_hdl, bool* i_periodic) 
     28  { 
     29    CTimer::get("XIOS").resume(); 
     30    *i_periodic = expand_domain_hdl->i_periodic.getInheritedValue(); 
     31    CTimer::get("XIOS").suspend(); 
     32  } 
     33 
     34  bool cxios_is_defined_expand_domain_i_periodic(expand_domain_Ptr expand_domain_hdl) 
     35  { 
     36     CTimer::get("XIOS").resume(); 
     37     bool isDefined = expand_domain_hdl->i_periodic.hasInheritedValue(); 
     38     CTimer::get("XIOS").suspend(); 
     39     return isDefined; 
     40  } 
     41 
     42 
     43  void cxios_set_expand_domain_j_periodic(expand_domain_Ptr expand_domain_hdl, bool j_periodic) 
     44  { 
     45    CTimer::get("XIOS").resume(); 
     46    expand_domain_hdl->j_periodic.setValue(j_periodic); 
     47    CTimer::get("XIOS").suspend(); 
     48  } 
     49 
     50  void cxios_get_expand_domain_j_periodic(expand_domain_Ptr expand_domain_hdl, bool* j_periodic) 
     51  { 
     52    CTimer::get("XIOS").resume(); 
     53    *j_periodic = expand_domain_hdl->j_periodic.getInheritedValue(); 
     54    CTimer::get("XIOS").suspend(); 
     55  } 
     56 
     57  bool cxios_is_defined_expand_domain_j_periodic(expand_domain_Ptr expand_domain_hdl) 
     58  { 
     59     CTimer::get("XIOS").resume(); 
     60     bool isDefined = expand_domain_hdl->j_periodic.hasInheritedValue(); 
     61     CTimer::get("XIOS").suspend(); 
     62     return isDefined; 
     63  } 
     64 
    1965 
    2066  void cxios_set_expand_domain_order(expand_domain_Ptr expand_domain_hdl, int order) 
  • XIOS/trunk/src/interface/fortran_attr/expand_domain_interface_attr.F90

    r981 r1078  
    99  INTERFACE 
    1010    ! Do not call directly / interface FORTRAN 2003 <-> C99 
     11 
     12    SUBROUTINE cxios_set_expand_domain_i_periodic(expand_domain_hdl, i_periodic) BIND(C) 
     13      USE ISO_C_BINDING 
     14      INTEGER (kind = C_INTPTR_T), VALUE :: expand_domain_hdl 
     15      LOGICAL (KIND=C_BOOL)      , VALUE :: i_periodic 
     16    END SUBROUTINE cxios_set_expand_domain_i_periodic 
     17 
     18    SUBROUTINE cxios_get_expand_domain_i_periodic(expand_domain_hdl, i_periodic) BIND(C) 
     19      USE ISO_C_BINDING 
     20      INTEGER (kind = C_INTPTR_T), VALUE :: expand_domain_hdl 
     21      LOGICAL (KIND=C_BOOL)             :: i_periodic 
     22    END SUBROUTINE cxios_get_expand_domain_i_periodic 
     23 
     24    FUNCTION cxios_is_defined_expand_domain_i_periodic(expand_domain_hdl) BIND(C) 
     25      USE ISO_C_BINDING 
     26      LOGICAL(kind=C_BOOL) :: cxios_is_defined_expand_domain_i_periodic 
     27      INTEGER (kind = C_INTPTR_T), VALUE :: expand_domain_hdl 
     28    END FUNCTION cxios_is_defined_expand_domain_i_periodic 
     29 
     30 
     31    SUBROUTINE cxios_set_expand_domain_j_periodic(expand_domain_hdl, j_periodic) BIND(C) 
     32      USE ISO_C_BINDING 
     33      INTEGER (kind = C_INTPTR_T), VALUE :: expand_domain_hdl 
     34      LOGICAL (KIND=C_BOOL)      , VALUE :: j_periodic 
     35    END SUBROUTINE cxios_set_expand_domain_j_periodic 
     36 
     37    SUBROUTINE cxios_get_expand_domain_j_periodic(expand_domain_hdl, j_periodic) BIND(C) 
     38      USE ISO_C_BINDING 
     39      INTEGER (kind = C_INTPTR_T), VALUE :: expand_domain_hdl 
     40      LOGICAL (KIND=C_BOOL)             :: j_periodic 
     41    END SUBROUTINE cxios_get_expand_domain_j_periodic 
     42 
     43    FUNCTION cxios_is_defined_expand_domain_j_periodic(expand_domain_hdl) BIND(C) 
     44      USE ISO_C_BINDING 
     45      LOGICAL(kind=C_BOOL) :: cxios_is_defined_expand_domain_j_periodic 
     46      INTEGER (kind = C_INTPTR_T), VALUE :: expand_domain_hdl 
     47    END FUNCTION cxios_is_defined_expand_domain_j_periodic 
     48 
    1149 
    1250    SUBROUTINE cxios_set_expand_domain_order(expand_domain_hdl, order) BIND(C) 
  • XIOS/trunk/src/interface/fortran_attr/iexpand_domain_attr.F90

    r981 r1078  
    1212 
    1313  SUBROUTINE xios(set_expand_domain_attr)  & 
    14     ( expand_domain_id, order, type ) 
     14    ( expand_domain_id, i_periodic, j_periodic, order, type ) 
    1515 
    1616    IMPLICIT NONE 
    1717      TYPE(txios(expand_domain))  :: expand_domain_hdl 
    1818      CHARACTER(LEN=*), INTENT(IN) ::expand_domain_id 
     19      LOGICAL  , OPTIONAL, INTENT(IN) :: i_periodic 
     20      LOGICAL (KIND=C_BOOL) :: i_periodic_tmp 
     21      LOGICAL  , OPTIONAL, INTENT(IN) :: j_periodic 
     22      LOGICAL (KIND=C_BOOL) :: j_periodic_tmp 
    1923      INTEGER  , OPTIONAL, INTENT(IN) :: order 
    2024      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type 
     
    2327      (expand_domain_id,expand_domain_hdl) 
    2428      CALL xios(set_expand_domain_attr_hdl_)   & 
    25       ( expand_domain_hdl, order, type ) 
     29      ( expand_domain_hdl, i_periodic, j_periodic, order, type ) 
    2630 
    2731  END SUBROUTINE xios(set_expand_domain_attr) 
    2832 
    2933  SUBROUTINE xios(set_expand_domain_attr_hdl)  & 
    30     ( expand_domain_hdl, order, type ) 
    31  
    32     IMPLICIT NONE 
    33       TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl 
     34    ( expand_domain_hdl, i_periodic, j_periodic, order, type ) 
     35 
     36    IMPLICIT NONE 
     37      TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl 
     38      LOGICAL  , OPTIONAL, INTENT(IN) :: i_periodic 
     39      LOGICAL (KIND=C_BOOL) :: i_periodic_tmp 
     40      LOGICAL  , OPTIONAL, INTENT(IN) :: j_periodic 
     41      LOGICAL (KIND=C_BOOL) :: j_periodic_tmp 
    3442      INTEGER  , OPTIONAL, INTENT(IN) :: order 
    3543      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type 
    3644 
    3745      CALL xios(set_expand_domain_attr_hdl_)  & 
    38       ( expand_domain_hdl, order, type ) 
     46      ( expand_domain_hdl, i_periodic, j_periodic, order, type ) 
    3947 
    4048  END SUBROUTINE xios(set_expand_domain_attr_hdl) 
    4149 
    4250  SUBROUTINE xios(set_expand_domain_attr_hdl_)   & 
    43     ( expand_domain_hdl, order_, type_ ) 
    44  
    45     IMPLICIT NONE 
    46       TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl 
     51    ( expand_domain_hdl, i_periodic_, j_periodic_, order_, type_ ) 
     52 
     53    IMPLICIT NONE 
     54      TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl 
     55      LOGICAL  , OPTIONAL, INTENT(IN) :: i_periodic_ 
     56      LOGICAL (KIND=C_BOOL) :: i_periodic__tmp 
     57      LOGICAL  , OPTIONAL, INTENT(IN) :: j_periodic_ 
     58      LOGICAL (KIND=C_BOOL) :: j_periodic__tmp 
    4759      INTEGER  , OPTIONAL, INTENT(IN) :: order_ 
    4860      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_ 
     61 
     62      IF (PRESENT(i_periodic_)) THEN 
     63        i_periodic__tmp = i_periodic_ 
     64        CALL cxios_set_expand_domain_i_periodic & 
     65      (expand_domain_hdl%daddr, i_periodic__tmp) 
     66      ENDIF 
     67 
     68      IF (PRESENT(j_periodic_)) THEN 
     69        j_periodic__tmp = j_periodic_ 
     70        CALL cxios_set_expand_domain_j_periodic & 
     71      (expand_domain_hdl%daddr, j_periodic__tmp) 
     72      ENDIF 
    4973 
    5074      IF (PRESENT(order_)) THEN 
     
    6185 
    6286  SUBROUTINE xios(get_expand_domain_attr)  & 
    63     ( expand_domain_id, order, type ) 
     87    ( expand_domain_id, i_periodic, j_periodic, order, type ) 
    6488 
    6589    IMPLICIT NONE 
    6690      TYPE(txios(expand_domain))  :: expand_domain_hdl 
    6791      CHARACTER(LEN=*), INTENT(IN) ::expand_domain_id 
     92      LOGICAL  , OPTIONAL, INTENT(OUT) :: i_periodic 
     93      LOGICAL (KIND=C_BOOL) :: i_periodic_tmp 
     94      LOGICAL  , OPTIONAL, INTENT(OUT) :: j_periodic 
     95      LOGICAL (KIND=C_BOOL) :: j_periodic_tmp 
    6896      INTEGER  , OPTIONAL, INTENT(OUT) :: order 
    6997      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type 
     
    72100      (expand_domain_id,expand_domain_hdl) 
    73101      CALL xios(get_expand_domain_attr_hdl_)   & 
    74       ( expand_domain_hdl, order, type ) 
     102      ( expand_domain_hdl, i_periodic, j_periodic, order, type ) 
    75103 
    76104  END SUBROUTINE xios(get_expand_domain_attr) 
    77105 
    78106  SUBROUTINE xios(get_expand_domain_attr_hdl)  & 
    79     ( expand_domain_hdl, order, type ) 
    80  
    81     IMPLICIT NONE 
    82       TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl 
     107    ( expand_domain_hdl, i_periodic, j_periodic, order, type ) 
     108 
     109    IMPLICIT NONE 
     110      TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl 
     111      LOGICAL  , OPTIONAL, INTENT(OUT) :: i_periodic 
     112      LOGICAL (KIND=C_BOOL) :: i_periodic_tmp 
     113      LOGICAL  , OPTIONAL, INTENT(OUT) :: j_periodic 
     114      LOGICAL (KIND=C_BOOL) :: j_periodic_tmp 
    83115      INTEGER  , OPTIONAL, INTENT(OUT) :: order 
    84116      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type 
    85117 
    86118      CALL xios(get_expand_domain_attr_hdl_)  & 
    87       ( expand_domain_hdl, order, type ) 
     119      ( expand_domain_hdl, i_periodic, j_periodic, order, type ) 
    88120 
    89121  END SUBROUTINE xios(get_expand_domain_attr_hdl) 
    90122 
    91123  SUBROUTINE xios(get_expand_domain_attr_hdl_)   & 
    92     ( expand_domain_hdl, order_, type_ ) 
    93  
    94     IMPLICIT NONE 
    95       TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl 
     124    ( expand_domain_hdl, i_periodic_, j_periodic_, order_, type_ ) 
     125 
     126    IMPLICIT NONE 
     127      TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl 
     128      LOGICAL  , OPTIONAL, INTENT(OUT) :: i_periodic_ 
     129      LOGICAL (KIND=C_BOOL) :: i_periodic__tmp 
     130      LOGICAL  , OPTIONAL, INTENT(OUT) :: j_periodic_ 
     131      LOGICAL (KIND=C_BOOL) :: j_periodic__tmp 
    96132      INTEGER  , OPTIONAL, INTENT(OUT) :: order_ 
    97133      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_ 
     134 
     135      IF (PRESENT(i_periodic_)) THEN 
     136        CALL cxios_get_expand_domain_i_periodic & 
     137      (expand_domain_hdl%daddr, i_periodic__tmp) 
     138        i_periodic_ = i_periodic__tmp 
     139      ENDIF 
     140 
     141      IF (PRESENT(j_periodic_)) THEN 
     142        CALL cxios_get_expand_domain_j_periodic & 
     143      (expand_domain_hdl%daddr, j_periodic__tmp) 
     144        j_periodic_ = j_periodic__tmp 
     145      ENDIF 
    98146 
    99147      IF (PRESENT(order_)) THEN 
     
    110158 
    111159  SUBROUTINE xios(is_defined_expand_domain_attr)  & 
    112     ( expand_domain_id, order, type ) 
     160    ( expand_domain_id, i_periodic, j_periodic, order, type ) 
    113161 
    114162    IMPLICIT NONE 
    115163      TYPE(txios(expand_domain))  :: expand_domain_hdl 
    116164      CHARACTER(LEN=*), INTENT(IN) ::expand_domain_id 
     165      LOGICAL, OPTIONAL, INTENT(OUT) :: i_periodic 
     166      LOGICAL(KIND=C_BOOL) :: i_periodic_tmp 
     167      LOGICAL, OPTIONAL, INTENT(OUT) :: j_periodic 
     168      LOGICAL(KIND=C_BOOL) :: j_periodic_tmp 
    117169      LOGICAL, OPTIONAL, INTENT(OUT) :: order 
    118170      LOGICAL(KIND=C_BOOL) :: order_tmp 
     
    123175      (expand_domain_id,expand_domain_hdl) 
    124176      CALL xios(is_defined_expand_domain_attr_hdl_)   & 
    125       ( expand_domain_hdl, order, type ) 
     177      ( expand_domain_hdl, i_periodic, j_periodic, order, type ) 
    126178 
    127179  END SUBROUTINE xios(is_defined_expand_domain_attr) 
    128180 
    129181  SUBROUTINE xios(is_defined_expand_domain_attr_hdl)  & 
    130     ( expand_domain_hdl, order, type ) 
    131  
    132     IMPLICIT NONE 
    133       TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl 
     182    ( expand_domain_hdl, i_periodic, j_periodic, order, type ) 
     183 
     184    IMPLICIT NONE 
     185      TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl 
     186      LOGICAL, OPTIONAL, INTENT(OUT) :: i_periodic 
     187      LOGICAL(KIND=C_BOOL) :: i_periodic_tmp 
     188      LOGICAL, OPTIONAL, INTENT(OUT) :: j_periodic 
     189      LOGICAL(KIND=C_BOOL) :: j_periodic_tmp 
    134190      LOGICAL, OPTIONAL, INTENT(OUT) :: order 
    135191      LOGICAL(KIND=C_BOOL) :: order_tmp 
     
    138194 
    139195      CALL xios(is_defined_expand_domain_attr_hdl_)  & 
    140       ( expand_domain_hdl, order, type ) 
     196      ( expand_domain_hdl, i_periodic, j_periodic, order, type ) 
    141197 
    142198  END SUBROUTINE xios(is_defined_expand_domain_attr_hdl) 
    143199 
    144200  SUBROUTINE xios(is_defined_expand_domain_attr_hdl_)   & 
    145     ( expand_domain_hdl, order_, type_ ) 
    146  
    147     IMPLICIT NONE 
    148       TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl 
     201    ( expand_domain_hdl, i_periodic_, j_periodic_, order_, type_ ) 
     202 
     203    IMPLICIT NONE 
     204      TYPE(txios(expand_domain)) , INTENT(IN) :: expand_domain_hdl 
     205      LOGICAL, OPTIONAL, INTENT(OUT) :: i_periodic_ 
     206      LOGICAL(KIND=C_BOOL) :: i_periodic__tmp 
     207      LOGICAL, OPTIONAL, INTENT(OUT) :: j_periodic_ 
     208      LOGICAL(KIND=C_BOOL) :: j_periodic__tmp 
    149209      LOGICAL, OPTIONAL, INTENT(OUT) :: order_ 
    150210      LOGICAL(KIND=C_BOOL) :: order__tmp 
     
    152212      LOGICAL(KIND=C_BOOL) :: type__tmp 
    153213 
     214      IF (PRESENT(i_periodic_)) THEN 
     215        i_periodic__tmp = cxios_is_defined_expand_domain_i_periodic & 
     216      (expand_domain_hdl%daddr) 
     217        i_periodic_ = i_periodic__tmp 
     218      ENDIF 
     219 
     220      IF (PRESENT(j_periodic_)) THEN 
     221        j_periodic__tmp = cxios_is_defined_expand_domain_j_periodic & 
     222      (expand_domain_hdl%daddr) 
     223        j_periodic_ = j_periodic__tmp 
     224      ENDIF 
     225 
    154226      IF (PRESENT(order_)) THEN 
    155227        order__tmp = cxios_is_defined_expand_domain_order & 
  • XIOS/trunk/src/node/domain.cpp

    r1064 r1078  
    3131      : CObjectTemplate<CDomain>(), CDomainAttributes() 
    3232      , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 
    33       , hasBounds(false), hasArea(false), isDistributed_(false), nGlobDomain_(), isCompressible_(false), isUnstructed_(false) 
     33      , hasBounds(false), hasArea(false), isDistributed_(false), isCompressible_(false), isUnstructed_(false) 
    3434      , isClientAfterTransformationChecked(false), hasLonLat(false) 
    3535      , lonvalue_client(), latvalue_client(), bounds_lon_client(), bounds_lat_client() 
     
    4141      : CObjectTemplate<CDomain>(id), CDomainAttributes() 
    4242      , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_() 
    43       , hasBounds(false), hasArea(false), isDistributed_(false), nGlobDomain_(), isCompressible_(false), isUnstructed_(false) 
     43      , hasBounds(false), hasArea(false), isDistributed_(false), isCompressible_(false), isUnstructed_(false) 
    4444      , isClientAfterTransformationChecked(false), hasLonLat(false) 
    4545      , lonvalue_client(), latvalue_client(), bounds_lon_client(), bounds_lat_client() 
     
    844844         for (int i = 0; i < ni; ++i) j_index(i+j*ni) = j+jbegin; 
    845845     } 
    846      computeNGlobDomain(); 
     846      
    847847     checkZoom(); 
    848848      
     
    15501550    int nbServer = client->serverSize; 
    15511551 
    1552     CServerDistributionDescription serverDescription(nGlobDomain_, nbServer); 
     1552    CServerDistributionDescription serverDescription(getNbGlob(), nbServer); 
    15531553    if (isUnstructed_) serverDescription.computeServerDistribution(false, 0); 
    15541554    else serverDescription.computeServerDistribution(false, 1); 
     
    15871587  } 
    15881588 
    1589   void CDomain::computeNGlobDomain() 
    1590   { 
    1591     nGlobDomain_.resize(2); 
    1592     nGlobDomain_[0] = ni_glo.getValue(); 
    1593     nGlobDomain_[1] = nj_glo.getValue(); 
     1589  std::vector<int> CDomain::getNbGlob() 
     1590  { 
     1591     std::vector<int> nbGlob(2); 
     1592     nbGlob[0] = ni_glo.getValue(); 
     1593     nbGlob[1] = nj_glo.getValue(); 
     1594 
     1595     return nbGlob; 
    15941596  } 
    15951597 
     
    16851687    size_t globalSizeIndex = 1, indexBegin, indexEnd; 
    16861688    int range, clientSize = client->clientSize; 
    1687     for (int i = 0; i < nGlobDomain_.size(); ++i) globalSizeIndex *= nGlobDomain_[i]; 
     1689    for (int i = 0; i < getNbGlob().size(); ++i) globalSizeIndex *= getNbGlob()[i]; 
    16881690    indexBegin = 0; 
    16891691    if (globalSizeIndex <= clientSize) 
     
    17041706    } 
    17051707 
    1706     CServerDistributionDescription serverDescription(nGlobDomain_, nbServer); 
     1708    CServerDistributionDescription serverDescription(getNbGlob(), nbServer); 
    17071709    if (isUnstructed_) serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t,size_t>(indexBegin, indexEnd), 0); 
    17081710    else serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t,size_t>(indexBegin, indexEnd), 1); 
  • XIOS/trunk/src/node/domain.hpp

    r1064 r1078  
    123123        vector< vector<int> > j_indSrv ; // for each server, j global index to send 
    124124 
     125         std::vector<int> getNbGlob(); 
    125126      public: 
    126127         /// Mutateur /// 
     
    210211         bool isCompressible_; 
    211212         bool isRedistributed_; 
    212          TransMapTypes transformationMap_; 
    213          std::vector<int> nGlobDomain_; 
     213         TransMapTypes transformationMap_;          
    214214         bool isUnstructed_; 
    215215        
  • XIOS/trunk/src/node/expand_domain.cpp

    r941 r1078  
    3838  void CExpandDomain::checkValid(CDomain* domainDst) 
    3939  { 
    40     if (CDomain::type_attr::unstructured != domainDst->type) 
    41     { 
    42       ERROR("CExpandDomain::checkValid(CDomain* domainDst)", 
    43             << "Domain extension is only supported for unstructured" << std::endl 
    44             << "Check type of domain destination, id = " << domainDst->getId()); 
    45     } 
     40    // if (CDomain::type_attr::unstructured != domainDst->type) 
     41    // { 
     42    //   ERROR("CExpandDomain::checkValid(CDomain* domainDst)", 
     43    //         << "Domain extension is only supported for unstructured" << std::endl 
     44    //         << "Check type of domain destination, id = " << domainDst->getId()); 
     45    // } 
    4646 
    4747    if (this->type.isEmpty()) this->type.setValue(CExpandDomain::type_attr::edge); 
  • XIOS/trunk/src/node/grid.cpp

    r1008 r1078  
    3131      , clientDistribution_(0), isIndexSent(false) , serverDistribution_(0), clientServerMap_(0) 
    3232      , writtenDataSize_(0), numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 
    33       , globalDim_(), connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 
     33      , connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 
    3434      , transformations_(0), isTransformed_(false) 
    35       , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false) 
     35      , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 
    3636      , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_() 
    3737   { 
     
    4949      , clientDistribution_(0), isIndexSent(false) , serverDistribution_(0), clientServerMap_(0) 
    5050      , writtenDataSize_(0), numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 
    51       , globalDim_(), connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 
     51      , connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 
    5252      , transformations_(0), isTransformed_(false) 
    53       , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false) 
     53      , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 
    5454      , gridSrc_(), hasTransform_(false), isGenerated_(false), order_(), globalIndexOnServer_() 
    5555   { 
     
    7474 
    7575 
    76    StdSize CGrid::getDimension(void) const 
    77    { 
    78       return globalDim_.size(); 
     76   StdSize CGrid::getDimension(void) 
     77   { 
     78      return getGlobalDimension().size(); 
    7979   } 
    8080 
     
    185185        for (int i = 0; i < axisListP.size(); ++i) 
    186186        { 
    187           axisListP[i]->checkAttributesOnClientAfterTransformation(globalDim_,axisPositionInGrid_[i]); 
     187          axisListP[i]->checkAttributesOnClientAfterTransformation(getGlobalDimension(),axisPositionInGrid_[i]); 
    188188        } 
    189189      } 
     
    232232     this->solveScalarRef(areAttributesChecked); 
    233233     this->solveAxisRef(areAttributesChecked); 
    234      this->solveDomainRef(areAttributesChecked); 
    235      computeGridGlobalDimension(getDomains(), getAxis(), getScalars(), axis_domain_order); 
     234     this->solveDomainRef(areAttributesChecked);      
    236235     this->isDomainAxisChecked = areAttributesChecked; 
    237236   } 
     
    463462        { 
    464463          if (sendAtt) 
    465             axisListP[i]->sendCheckedAttributes(globalDim_,axisPositionInGrid_[i]); 
     464            axisListP[i]->sendCheckedAttributes(getGlobalDimension(),axisPositionInGrid_[i]); 
    466465          else 
    467466            axisListP[i]->checkAttributesOnClient(); 
     
    533532     // Compute mapping between client and server 
    534533     std::vector<boost::unordered_map<size_t,std::vector<int> > > indexServerOnElement; 
    535      CServerDistributionDescription serverDistributionDescription(globalDim_, client->serverSize); 
     534     CServerDistributionDescription serverDistributionDescription(getGlobalDimension(), client->serverSize); 
    536535     serverDistributionDescription.computeServerGlobalByElement(indexServerOnElement, 
    537536                                                                client->clientRank, 
    538537                                                                client->clientSize, 
    539538                                                                axis_domain_order, 
    540                                                                 positionDimensionDistributed_); 
     539                                                                getDistributedDimension()); 
    541540     computeIndexByElement(indexServerOnElement, globalIndexOnServer_); 
    542541 
     
    13231322  } 
    13241323 
    1325   void CGrid::computeGridGlobalDimension(const std::vector<CDomain*>& domains, 
    1326                                          const std::vector<CAxis*>& axis, 
    1327                                          const std::vector<CScalar*>& scalars, 
    1328                                          const CArray<int,1>& axisDomainOrder) 
    1329   { 
    1330     globalDim_.resize(domains.size()*2+axis.size()+scalars.size()); 
     1324  /* 
     1325     Compute on the fly the global dimension of a grid with its elements 
     1326     \param[in/out] globalDim global dimension of grid 
     1327     \param[in] domains list of its domains 
     1328     \param[in] axiss list of its axis 
     1329     \param[in] scalars list of its scalars 
     1330     \param[in] axisDomainOrder the order of element in a grid (e.g: scalar then axis) 
     1331     \return The dimension of which we do distribution (often for server) 
     1332  */ 
     1333  int CGrid::computeGridGlobalDimension(std::vector<int>& globalDim, 
     1334                                        const std::vector<CDomain*> domains, 
     1335                                        const std::vector<CAxis*> axis, 
     1336                                        const std::vector<CScalar*> scalars, 
     1337                                        const CArray<int,1>& axisDomainOrder) 
     1338  { 
     1339    globalDim.resize(domains.size()*2+axis.size()+scalars.size()); 
     1340    int positionDimensionDistributed = 1; 
    13311341    int idx = 0, idxDomain = 0, idxAxis = 0, idxScalar = 0; 
    13321342    for (int i = 0; i < axisDomainOrder.numElements(); ++i) 
     
    13361346        if (!(domains[idxDomain]->type.isEmpty()) && (domains[idxDomain]->type==CDomain::type_attr::unstructured)) 
    13371347        { 
    1338           positionDimensionDistributed_ = idx; 
     1348          positionDimensionDistributed = idx; 
    13391349        } 
    13401350        else 
    13411351        { 
    1342           positionDimensionDistributed_ = idx +1; 
    1343         } 
    1344  
    1345         globalDim_[idx]   = domains[idxDomain]->ni_glo.getValue(); 
    1346         globalDim_[idx+1] = domains[idxDomain]->nj_glo.getValue(); 
     1352          positionDimensionDistributed = idx +1; 
     1353        } 
     1354 
     1355        globalDim[idx]   = domains[idxDomain]->ni_glo.getValue(); 
     1356        globalDim[idx+1] = domains[idxDomain]->nj_glo.getValue(); 
    13471357 
    13481358        ++idxDomain; 
     
    13511361      else if (1 == axisDomainOrder(i)) 
    13521362      { 
    1353         globalDim_[idx] = axis[idxAxis]->n_glo.getValue(); 
     1363        globalDim[idx] = axis[idxAxis]->n_glo.getValue(); 
    13541364        ++idxAxis; 
    13551365        ++idx; 
     
    13571367      else 
    13581368      { 
    1359         globalDim_[idx] = 1; 
     1369        globalDim[idx] = 1; 
    13601370        ++idxScalar; 
    13611371        ++idx; 
    13621372      } 
    13631373    } 
    1364   } 
    1365  
     1374 
     1375    return positionDimensionDistributed; 
     1376  } 
     1377 
     1378  // Retrieve the global dimension of grid 
    13661379  std::vector<int> CGrid::getGlobalDimension() 
    13671380  { 
    1368     return globalDim_; 
     1381    std::vector<int> globalDim; 
     1382    computeGridGlobalDimension(globalDim, getDomains(), getAxis(), getScalars(), axis_domain_order); 
     1383 
     1384    return globalDim; 
     1385  } 
     1386 
     1387  // Retrieve dimension on which we do distribution (Very often, it should be 2nd dimension) 
     1388  int CGrid::getDistributedDimension() 
     1389  { 
     1390    std::vector<int> globalDim; 
     1391    return computeGridGlobalDimension(globalDim, getDomains(), getAxis(), getScalars(), axis_domain_order);     
    13691392  } 
    13701393 
  • XIOS/trunk/src/node/grid.hpp

    r988 r1078  
    8787 
    8888         /// Accesseurs /// 
    89          StdSize getDimension(void) const; 
     89         StdSize getDimension(void); 
    9090 
    9191         StdSize  getDataSize(void) const; 
     
    229229         void modifyMask(const CArray<int,1>& indexToModify); 
    230230 
    231          void computeGridGlobalDimension(const std::vector<CDomain*>& domains, 
    232                                          const std::vector<CAxis*>& axis, 
    233                                          const std::vector<CScalar*>& scalars, 
    234                                          const CArray<int,1>& axisDomainOrder); 
    235  
    236231      private: 
    237232       template<int N> 
     
    261256                                   CClientServerMapping::GlobalIndexMap& globalIndexOnServer); 
    262257 
     258        int computeGridGlobalDimension(std::vector<int>& globalDim, 
     259                                       const std::vector<CDomain*> domains, 
     260                                       const std::vector<CAxis*> axis, 
     261                                       const std::vector<CScalar*> scalars, 
     262                                       const CArray<int,1>& axisDomainOrder); 
     263 
     264        int getDistributedDimension(); 
    263265      private: 
    264266        CDomainGroup* vDomainGroup_; 
     
    276278        std::vector<int> connectedServerRank_; 
    277279        bool isDataDistributed_; 
    278         int positionDimensionDistributed_; 
     280         
    279281         //! True if and only if the data defined on the grid can be outputted in a compressed way 
    280282        bool isCompressible_; 
     
    285287        std::vector<int> axisPositionInGrid_; 
    286288        CGridTransformation* transformations_; 
    287         bool hasDomainAxisBaseRef_; 
    288         std::vector<int> globalDim_; 
     289        bool hasDomainAxisBaseRef_;         
    289290        std::map<CGrid*, std::pair<bool,StdString> > gridSrc_; 
    290291        bool hasTransform_; 
  • XIOS/trunk/src/transformation/domain_algorithm_expand.cpp

    r978 r1078  
    4545                                               CDomain* domainSource, 
    4646                                               CExpandDomain* expandDomain) 
    47 : CDomainAlgorithmTransformation(domainDestination, domainSource) 
     47: CDomainAlgorithmTransformation(domainDestination, domainSource), 
     48  isXPeriodic_(false), isYPeriodic_(false) 
    4849{ 
    4950  if (domainDestination == domainSource) 
     
    5556  } 
    5657 
    57 //  if (!domainDestination->hasRefTo(domainSource)) 
    58 //  { 
    59 //    ERROR("CDomainAlgorithmExpand::CDomainAlgorithmExpand(CDomain* domainDestination,CDomain* domainSource, CExpandDomain* expandDomain)", 
    60 //           << "Domain domain destination must refer to domain source (directly or indirectly) by domain_ref " << std::endl 
    61 //           << "Domain source " <<domainSource->getId() << std::endl 
    62 //           << "Domain destination " <<domainDestination->getId() << std::endl); 
    63 //  } 
    64  
    6558  this->type_ = (ELEMENT_MODIFICATION_WITH_DATA); 
    6659  expandDomain->checkValid(domainDestination); 
     60  if (!expandDomain->i_periodic.isEmpty()) isXPeriodic_ = expandDomain->i_periodic; 
     61  if (!expandDomain->j_periodic.isEmpty()) isYPeriodic_ = expandDomain->j_periodic; 
    6762 
    6863  switch (expandDomain->type) 
     
    9287  CContextClient* client=context->client; 
    9388 
     89  int type = 1; // For edge 
     90  CMesh mesh; 
    9491  CArray<double,2>& bounds_lon_src = domainSource->bounds_lon_1d; 
    9592  CArray<double,2>& bounds_lat_src = domainSource->bounds_lat_1d; 
    9693  CArray<int,2> neighborsSrc; 
    97  
    98   int type = 1; // For edge 
    99   CMesh mesh; 
    100   mesh.getGlobalNghbFaces(type, client->intraComm, domainSource->i_index, bounds_lon_src, bounds_lat_src, neighborsSrc); 
    101   updateDomainAttributes(domainDestination, domainSource, neighborsSrc); 
     94  switch (domainSource->type) { 
     95   case CDomain::type_attr::unstructured:       
     96      mesh.getGlobalNghbFaces(type, client->intraComm, domainSource->i_index, bounds_lon_src, bounds_lat_src, neighborsSrc); 
     97      updateUnstructuredDomainAttributes(domainDestination, domainSource, neighborsSrc); 
     98      break; 
     99   default: 
     100      updateRectilinearDomainAttributes(domainDestination, domainSource, neighborsSrc); 
     101      break;       
     102  }   
    102103} 
    103104 
     
    113114  CContextClient* client=context->client; 
    114115 
     116  int type = 1; // For edge 
     117  CMesh mesh; 
    115118  CArray<double,2>& bounds_lon_src = domainSource->bounds_lon_1d; 
    116119  CArray<double,2>& bounds_lat_src = domainSource->bounds_lat_1d; 
    117120  CArray<int,2> neighborsSrc; 
    118  
    119   int type = 0; // For node 
    120   CMesh mesh; 
    121   mesh.getGlobalNghbFaces(type, client->intraComm, domainSource->i_index, bounds_lon_src, bounds_lat_src, neighborsSrc); 
    122   updateDomainAttributes(domainDestination, domainSource, neighborsSrc); 
     121  switch (domainSource->type) { 
     122   case CDomain::type_attr::unstructured:       
     123      mesh.getGlobalNghbFaces(type, client->intraComm, domainSource->i_index, bounds_lon_src, bounds_lat_src, neighborsSrc); 
     124      updateUnstructuredDomainAttributes(domainDestination, domainSource, neighborsSrc); 
     125      break; 
     126   default: 
     127      updateRectilinearDomainAttributes(domainDestination, domainSource, neighborsSrc); 
     128      break;       
     129  }   
     130} 
     131 
     132/*! 
     133 *  Extend rectilinear or curvilinear domain destination and update its attributes 
     134 *  Suppose that domain destination and domain source have the same values for all attributes (by inheritance) 
     135 *  \param [in/out] domainDestination domain destination 
     136 *  \param [in] domainSource domain source 
     137 *  \param [in] neighborsDomainSrc neighbor of domain source. For now, we don't need it for rectilinear 
     138 */ 
     139void CDomainAlgorithmExpand::updateRectilinearDomainAttributes(CDomain* domainDestination, 
     140                                                               CDomain* domainSource, 
     141                                                               CArray<int,2>& neighborsDomainSrc) 
     142{ 
     143  int index, globalIndex, idx; 
     144  int iindexDst, jindexDst, globIndexDst; 
     145  int iindexSrc, jindexSrc, globIndexSrc; 
     146  CContext* context = CContext::getCurrent(); 
     147  CContextClient* client=context->client; 
     148 
     149  // First of all, "copy" all attributes of domain source to domain destination 
     150  StdString domainDstRef = (!domainDestination->domain_ref.isEmpty()) ? domainDestination->domain_ref.getValue() 
     151                                                                      : ""; 
     152  if (domainDstRef != domainSource->getId()) 
     153  { 
     154    domainDestination->domain_ref.setValue(domainSource->getId()); 
     155    domainDestination->solveRefInheritance(true); 
     156  } 
     157 
     158  if (domainDstRef.empty()) domainDestination->domain_ref.reset(); 
     159  else domainDestination->domain_ref.setValue(domainDstRef); 
     160 
     161  // Here are attributes of source need tranfering 
     162  int niGloSrc = domainSource->ni_glo; 
     163  int njGloSrc = domainSource->nj_glo; 
     164  int niSrc = domainSource->ni, ibegin = domainSource->ibegin; 
     165  int njSrc = domainSource->nj, jbegin = domainSource->jbegin; 
     166  CArray<bool,1>& mask_1d_src = domainSource->mask_1d; 
     167  CArray<int,1>& i_index_src = domainSource->i_index; 
     168  CArray<int,1>& j_index_src = domainSource->j_index; 
     169  CArray<int,1>& data_i_index_src = domainSource->data_i_index; 
     170  CArray<int,1>& data_j_index_src = domainSource->data_j_index; 
     171  int data_i_begin_src = domainSource->data_ibegin; 
     172  int data_j_begin_src = domainSource->data_jbegin; 
     173  CArray<double,1>& lon_src = domainSource->lonvalue_client; 
     174  CArray<double,1>& lat_src = domainSource->latvalue_client; 
     175 
     176  // We need to generate boundary for longitude and latitude 
     177  if (domainSource->bounds_lon_1d.isEmpty() || domainSource->bounds_lat_1d.isEmpty()) 
     178  { 
     179    CArray<double,1> lon = lon_src(Range(0,niSrc-1)); 
     180    CArray<double,1> lat = lat_src(Range(0,lat_src.numElements()-1,niSrc)); 
     181    CArray<double,2>& bounds_lon_src = domainSource->bounds_lon_1d; 
     182    CArray<double,2>& bounds_lat_src = domainSource->bounds_lat_1d; 
     183    domainSource->fillInRectilinearBoundLonLat(lon_src, lat_src, bounds_lon_src, bounds_lat_src); 
     184  } 
     185 
     186 
     187  CArray<double,2>& bounds_lon_src = domainSource->bounds_lon_1d; 
     188  CArray<double,2>& bounds_lat_src = domainSource->bounds_lat_1d; 
     189 
     190  int nVertex       = bounds_lon_src.shape()[0]; 
     191  int oldNbLocal = i_index_src.numElements(); 
     192  int dataIindexBoundSrc = max(i_index_src) - min(i_index_src); 
     193  int dataJindexBoundSrc = max(j_index_src) - min(j_index_src); 
     194 
     195  // Uncompress data_i_index, data_j_index 
     196  CArray<int,1> data_i_index_src_full(oldNbLocal); 
     197  CArray<int,1> data_j_index_src_full(oldNbLocal); 
     198  int nbUnMaskedPointOnLocalDomain = 0; 
     199  data_i_index_src_full = -1; // Suppose all values are masked 
     200  data_j_index_src_full = -1; // Suppose all values are masked 
     201  for (idx = 0; idx < data_i_index_src.numElements(); ++idx) 
     202  { 
     203    int dataIidx = data_i_index_src(idx) + data_i_begin_src; 
     204    int dataJidx = data_j_index_src(idx) + data_j_begin_src; 
     205    if ((0 <= dataIidx) && (dataIidx <= dataIindexBoundSrc) && 
     206        (0 <= dataJidx) && (dataJidx <= dataJindexBoundSrc)) 
     207    { 
     208      data_i_index_src_full(nbUnMaskedPointOnLocalDomain) = dataIidx; 
     209      data_j_index_src_full(nbUnMaskedPointOnLocalDomain) = dataJidx; 
     210      ++nbUnMaskedPointOnLocalDomain; 
     211    } 
     212  } 
     213 
     214  // Expand domain destination, not only local but also global 
     215  int niGloDst = niGloSrc + 2; 
     216  int njGloDst = njGloSrc + 2; 
     217  int niDst = niSrc + 2; 
     218  int njDst = njSrc + 2; 
     219  domainDestination->ni_glo.setValue(niGloDst); 
     220  domainDestination->nj_glo.setValue(njGloDst); 
     221  domainDestination->ni.setValue(niDst); 
     222  domainDestination->nj.setValue(njDst); 
     223  domainDestination->global_zoom_ni.setValue(domainSource->global_zoom_ni+2); 
     224  domainDestination->global_zoom_nj.setValue(domainSource->global_zoom_nj+2); 
     225 
     226  CArray<bool,1>& mask_1d_dst = domainDestination->mask_1d; 
     227  CArray<int,1>& i_index_dst  = domainDestination->i_index; 
     228  CArray<int,1>& j_index_dst  = domainDestination->j_index;   
     229  CArray<int,1>& data_i_index_dst  = domainDestination->data_i_index; 
     230  CArray<int,1>& data_j_index_dst  = domainDestination->data_j_index; 
     231   
     232  // Make sure that we use only lonvalue_client, latvalue_client 
     233  if (!domainDestination->lonvalue_1d.isEmpty()) domainDestination->lonvalue_1d.reset(); 
     234  if (!domainDestination->latvalue_1d.isEmpty()) domainDestination->latvalue_1d.reset(); 
     235  if (!domainDestination->lonvalue_2d.isEmpty()) domainDestination->lonvalue_2d.reset(); 
     236  if (!domainDestination->latvalue_2d.isEmpty()) domainDestination->latvalue_2d.reset(); 
     237 
     238  // Recalculate i_index, j_index of extended domain 
     239  // Should be enough for common case, but if we have arbitrary distribution? 
     240  int newNbLocalDst = niDst * njDst;      
     241 
     242  mask_1d_dst.resize(newNbLocalDst); 
     243  i_index_dst.resize(newNbLocalDst); 
     244  j_index_dst.resize(newNbLocalDst); 
     245  CArray<int,1> data_i_index_dst_full(newNbLocalDst, -1); 
     246  CArray<int,1> data_j_index_dst_full(newNbLocalDst, -1); 
     247 
     248  domainDestination->lonvalue_client.resizeAndPreserve(newNbLocalDst);   
     249  domainDestination->latvalue_client.resizeAndPreserve(newNbLocalDst); 
     250  domainDestination->bounds_lon_1d.resizeAndPreserve(nVertex, newNbLocalDst); 
     251  domainDestination->bounds_lat_1d.resizeAndPreserve(nVertex, newNbLocalDst); 
     252  CArray<double,1>& lon_dst   = domainDestination->lonvalue_client; 
     253  CArray<double,1>& lat_dst   = domainDestination->latvalue_client; 
     254  CArray<double,2>& bounds_lon_dst = domainDestination->bounds_lon_1d; 
     255  CArray<double,2>& bounds_lat_dst = domainDestination->bounds_lat_1d; 
     256 
     257  // Update i_index, j_index 
     258  for (int j = 0; j < njDst; ++j) 
     259    for (int i = 0; i < niDst; ++i) 
     260    { 
     261      idx = j * niDst + i;  
     262      i_index_dst(idx) = i + ibegin; 
     263      j_index_dst(idx) = j + jbegin; 
     264    } 
     265 
     266  
     267 
     268  // 1. Fill in array relating to global index (i_index, j_index, transmap, etc, ...) 
     269  // Global index mapping between destination and source 
     270  this->transformationMapping_.resize(1); 
     271  this->transformationWeight_.resize(1); 
     272  TransformationIndexMap& transMap = this->transformationMapping_[0]; 
     273  TransformationWeightMap& transWeight = this->transformationWeight_[0]; 
     274 
     275  transMap.rehash(std::ceil(newNbLocalDst/transMap.max_load_factor())); 
     276  transWeight.rehash(std::ceil(newNbLocalDst/transWeight.max_load_factor())); 
     277   
     278  // Index mapping for local domain 
     279  // Mapping global index of expanded domain into original one  
     280  // (Representing global index of expanded domain in form of global index of original one) 
     281  CArray<size_t,1> globalIndexSrcOnDstDomain(newNbLocalDst);  
     282  for (idx = 0; idx < newNbLocalDst; ++idx) 
     283  { 
     284    iindexDst = i_index_dst(idx); 
     285    jindexDst = j_index_dst(idx); 
     286    globIndexDst = jindexDst * niGloDst + iindexDst; 
     287    globIndexSrc = (((jindexDst-1)+njGloSrc) % njGloSrc) * niGloSrc + (((iindexDst-1)+niGloSrc) % niGloSrc) ; 
     288    globalIndexSrcOnDstDomain(idx) = globIndexSrc; 
     289 
     290    transMap[globIndexDst].push_back(globIndexSrc); 
     291    transWeight[globIndexDst].push_back(1.0);  
     292  } 
     293 
     294  // 2. Exchange local info among domains (lon,lat,bounds,mask,etc,...) 
     295  CClientClientDHTDouble::Index2VectorInfoTypeMap localData; 
     296  localData.rehash(std::ceil(oldNbLocal/localData.max_load_factor())); 
     297 
     298  // Information exchanged among domains (attention to their order), number in parentheses presents size of data 
     299  // lon(1) + lat(1) + bounds_lon(nVertex) + bounds_lat(nVertex) + mask(1) + data_i_index(1) 
     300  int dataPackageSize =  1 + 1 + // lon + lat 
     301                         nVertex + nVertex + //bounds_lon + bounds_lat 
     302                         1 + // mask_1d_dst; 
     303                         1 + 1; // data_i_index + data_j_index 
     304  // Initialize database 
     305  for (int idx = 0; idx < oldNbLocal; ++idx) 
     306  { 
     307    index = i_index_src(idx) + j_index_src(idx) * niGloSrc; 
     308    localData[index].resize(dataPackageSize); 
     309    std::vector<double>& data = localData[index]; 
     310 
     311    //Pack data 
     312    int dataIdx = 0; 
     313    data[dataIdx] = lon_src(idx);++dataIdx; 
     314    data[dataIdx] = lat_src(idx);++dataIdx; 
     315    for (int i = 0; i < nVertex; ++i) 
     316    { 
     317      data[dataIdx] = bounds_lon_src(i,idx); ++dataIdx; 
     318    } 
     319    for (int i = 0; i < nVertex; ++i) 
     320    { 
     321      data[dataIdx] = bounds_lat_src(i,idx); ++dataIdx; 
     322    } 
     323    data[dataIdx] = mask_1d_src(idx) ? 1.0 : -1.0; ++dataIdx; 
     324    data[dataIdx] = data_i_index_src_full(idx);++dataIdx; 
     325    data[dataIdx] = data_j_index_src_full(idx); 
     326  } 
     327 
     328  CClientClientDHTDouble dhtData(localData,client->intraComm); 
     329  dhtData.computeIndexInfoMapping(globalIndexSrcOnDstDomain); 
     330  CClientClientDHTDouble::Index2VectorInfoTypeMap& neighborData = dhtData.getInfoIndexMap(); 
     331  CClientClientDHTDouble::Index2VectorInfoTypeMap::iterator ite = neighborData.end(), it; 
     332 
     333  // Ok get all data for destination 
     334  // If domain is not periodic, then we mask all extended part. 
     335  int nbUnMaskedPointOnExtendedPart = 0, remainder = 0, dataIIndex, dataJIndex; 
     336  size_t nIdx; 
     337  double maskValue = 1.0; 
     338  for (index = 0; index < newNbLocalDst; ++index) 
     339  { 
     340     nIdx = globalIndexSrcOnDstDomain(index); 
     341     it = neighborData.find(nIdx); 
     342     if (ite != it) 
     343     { 
     344        std::vector<double>& data = it->second; 
     345        // Unpack data 
     346        int dataIdx = 0; 
     347        lon_dst(index) = data[dataIdx]; ++dataIdx; 
     348        lat_dst(index) = data[dataIdx]; ++dataIdx; 
     349        for (int i = 0; i < nVertex; ++i) 
     350        { 
     351          bounds_lon_dst(i,index) = data[dataIdx]; ++dataIdx; 
     352        } 
     353        for (int i = 0; i < nVertex; ++i) 
     354        { 
     355          bounds_lat_dst(i,index) = data[dataIdx]; ++dataIdx; 
     356        } 
     357         
     358        // Check whether we have x periodic. If we don't, we should mask all point at 0 and niGloDst-1 
     359        maskValue = data[dataIdx]; 
     360        if (!isXPeriodic_)  
     361        { 
     362          remainder = i_index_dst(index) % (niGloDst-1); 
     363          if (0 == remainder)  
     364          { 
     365            maskValue = -1.0; 
     366          } 
     367        } 
     368 
     369        if (!isYPeriodic_)  
     370        { 
     371          remainder = j_index_dst(index) % (njGloDst-1); 
     372          if (0 == remainder)  
     373          { 
     374            maskValue = -1.0; 
     375          } 
     376        } 
     377 
     378        mask_1d_dst(index) = (1.0 == maskValue) ? true : false; ++dataIdx; 
     379 
     380        dataIIndex = (int) data[dataIdx]; 
     381        if (!isXPeriodic_)  
     382        { 
     383          remainder = i_index_dst(index) % (niGloDst-1); 
     384          if (0 == remainder)  
     385          { 
     386            dataIIndex = -1; 
     387          } 
     388        } 
     389        data_i_index_dst_full(index) = dataIIndex; ++dataIdx; 
     390         
     391        dataJIndex = (int) data[dataIdx]; 
     392        if (!isYPeriodic_)  
     393        { 
     394          remainder = j_index_dst(index) % (njGloDst-1); 
     395          if (0 == remainder)  
     396          { 
     397            dataJIndex = -1; 
     398          } 
     399        }         
     400        data_j_index_dst_full(index) = dataJIndex; 
     401 
     402        if ((0 <= data_i_index_dst_full(index)) && (0 <= data_j_index_dst_full(index))) 
     403        { 
     404          ++nbUnMaskedPointOnExtendedPart; 
     405        } 
     406     } 
     407  } 
     408 
     409   
     410  // Finally, update data_i_index, data_j_index 
     411  data_i_index_dst.resize(nbUnMaskedPointOnExtendedPart); 
     412  data_j_index_dst.resize(nbUnMaskedPointOnExtendedPart);  
     413  int count = 0;  
     414  for (idx = 0; idx < newNbLocalDst; ++idx) 
     415  { 
     416    dataIIndex = data_i_index_dst_full(idx); 
     417    dataJIndex = data_j_index_dst_full(idx); 
     418    if ((0 <= dataIIndex) && (0 <= dataJIndex)) 
     419    { 
     420      data_i_index_dst(count) = i_index_dst(idx) - i_index_dst(0); 
     421      data_j_index_dst(count) = j_index_dst(idx) - j_index_dst(0); 
     422      ++count; 
     423    } 
     424  } 
     425 
     426  // Update data_ni, data_nj 
     427  domainDestination->data_ni.setValue(niDst); 
     428  domainDestination->data_nj.setValue(njDst); 
     429  domainDestination->data_ibegin.setValue(0); 
     430  domainDestination->data_jbegin.setValue(0); 
     431 
     432 
     433  // Update longitude and latitude  
     434  if (niSrc == domainSource->lonvalue_1d.numElements() && njSrc == domainSource->latvalue_1d.numElements()) // Ok, we have rectilinear here 
     435  { 
     436     domainDestination->lonvalue_1d.resize(niDst); 
     437     domainDestination->lonvalue_1d = lon_dst(Range(0,niDst-1)); 
     438     domainDestination->latvalue_1d.resize(njDst); 
     439     domainDestination->latvalue_1d = lat_dst(Range(0,lat_dst.numElements()-1,niDst)); 
     440  } 
     441  else // It should be curvilinear 
     442  { 
     443     domainDestination->lonvalue_1d.resize(lon_dst.numElements()); 
     444     domainDestination->lonvalue_1d = lon_dst; 
     445     domainDestination->latvalue_1d.resize(lat_dst.numElements()); 
     446     domainDestination->latvalue_1d = (lat_dst); 
     447  } 
     448 
    123449} 
    124450 
     
    130456 *  \param [in] neighborsDomainSrc domain extended part 
    131457 */ 
    132 void CDomainAlgorithmExpand::updateDomainAttributes(CDomain* domainDestination, 
    133                                                     CDomain* domainSource, 
    134                                                     CArray<int,2>& neighborsDomainSrc) 
    135 { 
     458void CDomainAlgorithmExpand::updateUnstructuredDomainAttributes(CDomain* domainDestination, 
     459                                                                CDomain* domainSource, 
     460                                                                CArray<int,2>& neighborsDomainSrc) 
     461{ 
     462 
    136463  CContext* context = CContext::getCurrent(); 
    137464  CContextClient* client=context->client; 
     
    255582      data[dataIdx] = bounds_lat_src(i,idx); ++dataIdx; 
    256583    } 
    257     data[dataIdx] = mask_1d_src(idx) ? 1.0 : -1; ++dataIdx; 
     584    data[dataIdx] = mask_1d_src(idx) ? 1.0 : -1.0; ++dataIdx; 
    258585    data[dataIdx] = data_i_index_src_full(idx); 
    259586  } 
     
    308635  { 
    309636    dataIdx = data_i_index_dst_full(idx); 
    310     if ((0 <= dataIdx) && (dataIdx < newNbLocalDst)) 
     637    if ((0 <= dataIdx)) 
    311638    { 
    312639      ++count; 
     
    322649  { 
    323650    dataIdx = data_i_index_dst_full(idx); 
    324     if ((0 <= dataIdx) && (dataIdx < newNbLocalDst)) 
     651    if ((0 <= dataIdx)) 
    325652    { 
    326653      data_i_index_dst(count) = dataIdx; 
     
    331658  // Update ni 
    332659  domainDestination->ni.setValue(newNbLocalDst); 
    333  
    334660} 
    335661 
  • XIOS/trunk/src/transformation/domain_algorithm_expand.hpp

    r941 r1078  
    3030 
    3131protected: 
     32  bool isXPeriodic_; // Flag to determine the periodicity of expansion (only for rectilinear) 
     33  bool isYPeriodic_; // Flag to determine the periodicity of expansion (only for rectilinear) 
     34 
     35protected: 
    3236  void expandDomainEdgeConnectivity(CDomain* domainDestination, CDomain* domainSource); 
    3337  void expandDomainNodeConnectivity(CDomain* domainDestination, CDomain* domainSource); 
    34   void updateDomainAttributes(CDomain* domainDestination, 
    35                               CDomain* domainSource, 
    36                               CArray<int,2>& neighborsDomainSrc); 
     38  void updateRectilinearDomainAttributes(CDomain* domainDestination, 
     39                                         CDomain* domainSource, 
     40                                         CArray<int,2>& neighborsDomainSrc); 
     41 
     42  void updateUnstructuredDomainAttributes(CDomain* domainDestination, 
     43                                          CDomain* domainSource, 
     44                                          CArray<int,2>& neighborsDomainSrc); 
    3745 
    3846protected: 
  • XIOS/trunk/src/transformation/grid_transformation.cpp

    r978 r1078  
    236236  } 
    237237 
    238   tmpGridDestination_ = CGrid::createGrid(domainDst, axisDst, scalarDst, elementOrder); 
    239   tmpGridDestination_->computeGridGlobalDimension(domainDst, axisDst, scalarDst, elementOrder); 
     238  tmpGridDestination_ = CGrid::createGrid(domainDst, axisDst, scalarDst, elementOrder);   
    240239  tempGridDests_.push_back(tmpGridDestination_); 
    241240} 
     
    322321  } 
    323322 
    324   gridSource_ = CGrid::createGrid(domainSrc, axisSrc, scalarSrc, tmpGridDestination_->axis_domain_order); 
    325   gridSource_->computeGridGlobalDimension(domainSrc, axisSrc, scalarSrc, tmpGridDestination_->axis_domain_order); 
     323  gridSource_ = CGrid::createGrid(domainSrc, axisSrc, scalarSrc, tmpGridDestination_->axis_domain_order);   
    326324 
    327325  tempGridSrcs_.push_back(gridSource_); 
Note: See TracChangeset for help on using the changeset viewer.