Changeset 976


Ignore:
Timestamp:
10/18/16 11:08:11 (8 years ago)
Author:
mhnguyen
Message:

Ticket 110: Implementing domain reduction to scalar

+) Add xml node for this new transformation
+) Add algorithm for this new transformation

Test
+) On Curie
+) Work

Location:
XIOS/trunk/src
Files:
5 added
15 edited

Legend:

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

    r960 r976  
    8383#endif //__XIOS_CExtractAxisToScalar__ 
    8484 
     85#ifdef __XIOS_CReduceDomainToScalar__ 
     86   DECLARE_NODE(ReduceDomainToScalar, reduce_domain_to_scalar) 
     87#endif //__XIOS_CReduceDomainToScalar__ 
     88 
    8589#ifdef __XIOS_CContext__ 
    8690   DECLARE_NODE_PAR(Context, context) 
  • XIOS/trunk/src/group_factory_decl.cpp

    r960 r976  
    3838  macro(CExpandDomainGroup) 
    3939  macro(CExtractAxisToScalarGroup) 
     40  macro(CReduceDomainToScalarGroup) 
    4041} 
  • XIOS/trunk/src/group_template_decl.cpp

    r960 r976  
    2727  macro(ExpandDomain) 
    2828  macro(ExtractAxisToScalar) 
     29  macro(ReduceDomainToScalar) 
    2930 
    3031} 
  • XIOS/trunk/src/node/grid.hpp

    r957 r976  
    346346        ++idx; ++idxAxis; 
    347347      } 
    348       else ++idx; 
     348      else {}; 
    349349    } 
    350350 
  • XIOS/trunk/src/node/node_enum.hpp

    r960 r976  
    3232         eComputeConnectivityDomain, 
    3333         eExpandDomain, 
    34          eExtractAxisToScalar 
     34         eExtractAxisToScalar, 
     35         eReduceDomainToScalar 
    3536 
    3637      } ENodeType; 
  • XIOS/trunk/src/node/node_type.hpp

    r960 r976  
    2323#include "expand_domain.hpp" 
    2424#include "extract_axis_to_scalar.hpp" 
     25#include "reduce_domain_to_scalar.hpp" 
     26 
    2527 
    2628 
  • XIOS/trunk/src/node/scalar.cpp

    r968 r976  
    3131   bool CScalar::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 
    3232   { 
    33      m["reduce_axis"] = TRANS_REDUCE_AXIS_TO_SCALAR; 
    34      m["extract_axis"] = TRANS_EXTRACT_AXIS_TO_SCALAR; 
     33     m["reduce_axis"]   = TRANS_REDUCE_AXIS_TO_SCALAR; 
     34     m["extract_axis"]  = TRANS_EXTRACT_AXIS_TO_SCALAR; 
     35     m["reduce_domain"] = TRANS_REDUCE_DOMAIN_TO_SCALAR; 
    3536   } 
    3637 
  • XIOS/trunk/src/node/transformation_enum.hpp

    r960 r976  
    1919        TRANS_EXPAND_DOMAIN = 10, 
    2020        TRANS_EXTRACT_AXIS_TO_SCALAR = 11, 
     21        TRANS_REDUCE_DOMAIN_TO_SCALAR = 12, 
    2122      } ETranformationType; 
    2223 
  • XIOS/trunk/src/object_factory_decl.cpp

    r960 r976  
    3939  macro(CExpandDomain) 
    4040  macro(CExtractAxisToScalar) 
     41  macro(CReduceDomainToScalar) 
    4142 
    4243  macro(CFieldGroup) 
     
    6061  macro(CExpandDomainGroup) 
    6162  macro(CExtractAxisToScalarGroup) 
     63  macro(CReduceDomainToScalarGroup) 
    6264} 
  • XIOS/trunk/src/object_template_decl.cpp

    r960 r976  
    2626  template class CObjectTemplate<CExpandDomain>; 
    2727  template class CObjectTemplate<CExtractAxisToScalar>; 
     28  template class CObjectTemplate<CReduceDomainToScalar>; 
    2829 
    2930  template class CObjectTemplate<CContextGroup>; 
     
    4748  template class CObjectTemplate<CExpandDomainGroup>; 
    4849  template class CObjectTemplate<CExtractAxisToScalarGroup>; 
     50  template class CObjectTemplate<CReduceDomainToScalarGroup>; 
    4951} 
  • XIOS/trunk/src/transformation/algo_types.hpp

    r960 r976  
    1010#define __XIOS_ALGORITHM_TRANSFORMATION_TYPES_HPP__ 
    1111 
     12#include "scalar_algorithm_reduce_axis.hpp" 
     13#include "scalar_algorithm_extract_axis.hpp" 
     14#include "scalar_algorithm_reduce_domain.hpp" 
    1215 
    13 #include "reduce_axis_to_scalar.hpp" 
    14 #include "scalar_algorithm_reduce_axis.hpp" 
    1516#include "axis_algorithm_inverse.hpp" 
    1617#include "axis_algorithm_zoom.hpp" 
    1718#include "axis_algorithm_interpolate.hpp" 
    18 #include "domain_algorithm_zoom.hpp" 
    19 #include "domain_algorithm_interpolate.hpp" 
    20 #include "reduce_domain_to_axis.hpp" 
    2119#include "axis_algorithm_reduce_domain.hpp" 
    2220#include "axis_algorithm_transformation.hpp" 
    2321#include "axis_algorithm_extract_domain.hpp" 
    24 #include "extract_domain_to_axis.hpp" 
     22 
     23#include "domain_algorithm_zoom.hpp" 
     24#include "domain_algorithm_interpolate.hpp" 
    2525#include "domain_algorithm_compute_connectivity.hpp" 
    26 #include "compute_connectivity_domain.hpp" 
    27 #include "expand_domain.hpp" 
    2826#include "domain_algorithm_expand.hpp" 
    29 #include "extract_axis_to_scalar.hpp" 
    30 #include "scalar_algorithm_extract_axis.hpp" 
     27 
     28 
     29 
     30 
    3131 
    3232#endif // __XIOS_ALGORITHM_TRANSFORMATION_TYPES_HPP__ 
  • XIOS/trunk/src/transformation/grid_transformation_selector.cpp

    r960 r976  
    2121  CScalarAlgorithmReduceScalar::registerTrans(); 
    2222  CScalarAlgorithmExtractScalar::registerTrans(); 
     23  CScalarAlgorithmReduceDomain::registerTrans(); 
    2324 
    2425  //! Axis 
  • XIOS/trunk/src/transformation/scalar_algorithm_transformation.cpp

    r888 r976  
    33   \author Ha NGUYEN 
    44   \since 23 June 2016 
    5    \date 23 June 2016 
     5   \date 23 Oct 2016 
    66 
    77   \brief Interface for all scalar transformation algorithms. 
     
    4848 
    4949/*! 
    50   Compute global index of scalar on different processes 
    51   \param [in] globalScalarIndex global index of scalar source 
    52   \param [out] globalScalarIndexOnProc processes which contain the corresponding global index of scalar source 
     50  Compute global index of element source on different processes on knowing the global index source of transformation 
     51 
     52  \param [in] globalIndexElementSource global index source of transformation (represented in the transformation mapping) 
     53  \param [in] elementSourceType type of element source 
     54  \param [out] globalIndexElementSourceOnProc processes which contain the corresponding global index of scalar source 
    5355*/ 
    54 void CScalarAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalScalarIndex, 
    55                                                                 int elementType, 
    56                                                                 CClientClientDHTInt::Index2VectorInfoTypeMap& globalScalarIndexOnProc) 
     56void CScalarAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalIndexElementSource, 
     57                                                                int elementSourceType, 
     58                                                                CClientClientDHTInt::Index2VectorInfoTypeMap& globalIndexElementSourceOnProc) 
    5759{ 
    5860  CContext* context = CContext::getCurrent(); 
     
    6163  int clientSize = client->clientSize; 
    6264 
    63   if (1 == elementType) 
     65  if (2 == elementSourceType) // Source is a domain 
     66  { 
     67    size_t globalIndex; 
     68    int nIndexSize = domainSrc_->i_index.numElements(); 
     69    CArray<int,1>& iIndex = domainSrc_->i_index; 
     70    CArray<int,1>& jIndex = domainSrc_->j_index; 
     71    int niGlo = domainSrc_->ni_glo; 
     72 
     73    CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank; 
     74    globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor())); 
     75    for (int idx = 0; idx < nIndexSize; ++idx) 
     76    { 
     77      globalIndex = jIndex(idx) * niGlo + iIndex(idx); 
     78      globalIndex2ProcRank[globalIndex].resize(1); 
     79      globalIndex2ProcRank[globalIndex][0] = clientRank; 
     80    } 
     81 
     82    CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
     83    dhtIndexProcRank.computeIndexInfoMapping(globalIndexElementSource); 
     84    globalIndexElementSourceOnProc = dhtIndexProcRank.getInfoIndexMap(); 
     85  } 
     86  else if (1 == elementSourceType) // Source is an axis 
    6487  { 
    6588    size_t globalIndex; 
     
    7598 
    7699    CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
    77     dhtIndexProcRank.computeIndexInfoMapping(globalScalarIndex); 
    78     globalScalarIndexOnProc = dhtIndexProcRank.getInfoIndexMap(); 
     100    dhtIndexProcRank.computeIndexInfoMapping(globalIndexElementSource); 
     101    globalIndexElementSourceOnProc = dhtIndexProcRank.getInfoIndexMap(); 
     102  } 
     103  else // scalar 
     104  { 
     105    size_t globalIndex = 0;     
     106    CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank; 
     107    globalIndex2ProcRank[globalIndex].resize(1); 
     108    globalIndex2ProcRank[globalIndex][0] = clientRank; 
     109 
     110    CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); 
     111    dhtIndexProcRank.computeIndexInfoMapping(globalIndexElementSource); 
     112    globalIndexElementSourceOnProc = dhtIndexProcRank.getInfoIndexMap(); 
    79113  } 
    80114} 
  • XIOS/trunk/src/type/type_util.hpp

    r960 r976  
    4646    class CExtractAxisToScalar; 
    4747    class CExtractAxisToScalarGroup; 
     48    class CReduceDomainToScalar; 
     49    class CReduceDomainToScalarGroup; 
    4850 
    4951  template <typename T> inline string getStrType(void); 
     
    108110  macro(CExtractAxisToScalar) 
    109111  macro(CExtractAxisToScalarGroup) 
    110  
     112  macro(CReduceDomainToScalar) 
     113  macro(CReduceDomainToScalarGroup) 
     114   
    111115#undef macro 
    112116} 
  • XIOS/trunk/src/xml_parser_decl.cpp

    r960 r976  
    3232    macro( ExpandDomain ) 
    3333    macro( ExtractAxisToScalar ) 
     34    macro( ReduceDomainToScalar ) 
    3435  } 
    3536} 
Note: See TracChangeset for help on using the changeset viewer.