Changeset 689


Ignore:
Timestamp:
09/15/15 17:31:13 (9 years ago)
Author:
mhnguyen
Message:

Modifying the interface of interpolation domain

+) Change node name from interpolate_from_file_domain to interpolate_domain and add some new atrributes
+) Add more tests into test_remap

Test
+) On Curie
+) test_remap works for direct weight calculation and reading weight calculation from file

Location:
XIOS/trunk
Files:
2 added
2 deleted
14 edited
3 moved

Legend:

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

    r688 r689  
    99     <field id="src_field"  operation="instant" grid_ref="src_grid"/> 
    1010     <field id="dst_field"  operation="instant" field_ref="src_field" grid_ref="dst_grid"/> 
     11     <field id="dst_field_regular"  operation="instant" field_ref="src_field" grid_ref="dst_grid_regular"/> 
    1112   </field_definition> 
    1213 
     
    1415   <file_definition type="multiple_file" par_access="collective" output_freq="1ts" output_level="10" enabled=".TRUE."> 
    1516     <file id="output" name="output"> 
    16 <!--        <field field_ref="src_field" name="field" />--> 
     17        <field field_ref="src_field" name="field" /> 
    1718     </file> 
    1819     <file id="output_dst" name="output_dst"> 
    1920        <field field_ref="dst_field" name="field" /> 
     21     </file> 
     22     <file id="output_dst_regular" name="output_dst_regular"> 
     23        <field field_ref="dst_field_regular" name="field" /> 
    2024     </file> 
    2125   </file_definition> 
     
    2832     <domain id="src_domain" /> 
    2933     <domain id="dst_domain" domain_src="src_domain"> 
     34       <interpolate_domain file="weight.nc"/> 
     35     </domain> 
     36     <domain id="dst_domain_regular" domain_src="src_domain"> 
    3037       <generate_rectilinear_domain /> 
    31        <interpolate_from_file_domain file="weight.nc" /> 
     38       <interpolate_domain/> 
    3239     </domain> 
    3340   </domain_definition> 
     
    3643     <grid id="dst_grid"> 
    3744       <domain domain_ref="dst_domain" /> 
     45     </grid> 
     46     <grid id="dst_grid_regular"> 
     47       <domain domain_ref="dst_domain_regular" /> 
    3848     </grid> 
    3949     <grid id="src_grid"> 
  • XIOS/trunk/src/config/interpolate_domain_attribute.conf

    r688 r689  
    11/* GLOBAL */ 
    22DECLARE_ATTRIBUTE(StdString, file) 
     3DECLARE_ATTRIBUTE(int, order) 
  • XIOS/trunk/src/config/node_type.conf

    r687 r689  
    4747#endif //__XIOS_CZoomDomain__ 
    4848 
    49 #ifdef __XIOS_CInterpolateFromFileDomain__ 
    50    DECLARE_NODE(InterpolateFromFileDomain, interpolate_from_file_domain) 
    51 #endif //__XIOS_CInterpolateFromFileDomain__ 
     49#ifdef __XIOS_CInterpolateDomain__ 
     50   DECLARE_NODE(InterpolateDomain, interpolate_domain) 
     51#endif //__XIOS_CInterpolateDomain__ 
    5252 
    5353#ifdef __XIOS_CGenerateRectilinearDomain__ 
  • XIOS/trunk/src/group_factory_decl.cpp

    r687 r689  
    2929  macro(CInterpolateAxisGroup) 
    3030  macro(CZoomDomainGroup) 
    31   macro(CInterpolateFromFileDomainGroup) 
     31  macro(CInterpolateDomainGroup) 
    3232  macro(CGenerateRectilinearDomainGroup) 
    3333} 
  • XIOS/trunk/src/group_template_decl.cpp

    r687 r689  
    1818  macro(InterpolateAxis) 
    1919  macro(ZoomDomain) 
    20   macro(InterpolateFromFileDomain) 
     20  macro(InterpolateDomain) 
    2121  macro(GenerateRectilinearDomain) 
    2222 
  • XIOS/trunk/src/node/domain.cpp

    r688 r689  
    1919#include "client_server_mapping_distributed.hpp" 
    2020#include "zoom_domain.hpp" 
    21 #include "interpolate_from_file_domain.hpp" 
     21#include "interpolate_domain.hpp" 
    2222#include "generate_rectilinear_domain.hpp" 
    2323 
     
    17821782      StdString zoomDomainDefRoot("zoom_domain_definition"); 
    17831783      StdString zoom("zoom_domain"); 
    1784       StdString interpFromFileDomainDefRoot("interpolate_from_file_domain_definition"); 
    1785       StdString interpFromFile("interpolate_from_file_domain"); 
     1784      StdString interpDomainDefRoot("interpolate_domain_definition"); 
     1785      StdString interpFromFile("interpolate_domain"); 
    17861786      StdString generateRectilinearDefRoot("generate_rectilinear_domain_definition"); 
    17871787      StdString generateRectilinear("generate_rectilinear_domain"); 
     
    17951795        else if (node.getElementName() == interpFromFile) 
    17961796        { 
    1797           CInterpolateFromFileDomain* tmp = (CInterpolateFromFileDomainGroup::get(interpFromFileDomainDefRoot))->createChild(); 
     1797          CInterpolateDomain* tmp = (CInterpolateDomainGroup::get(interpDomainDefRoot))->createChild(); 
    17981798          tmp->parse(node); 
    1799           transformationMap_.push_back(std::make_pair(TRANS_INTERPOLATE_DOMAIN_FROM_FILE,tmp)); 
     1799          transformationMap_.push_back(std::make_pair(TRANS_INTERPOLATE_DOMAIN,tmp)); 
    18001800        } 
    18011801        else if (node.getElementName() == generateRectilinear) 
  • XIOS/trunk/src/node/interpolate_domain.hpp

    r688 r689  
    1 #ifndef __XIOS_CInterpolateFromFileDomain__ 
    2 #define __XIOS_CInterpolateFromFileDomain__ 
     1#ifndef __XIOS_CInterpolateDomain__ 
     2#define __XIOS_CInterpolateDomain__ 
    33 
    44/// xios headers /// 
     
    1616namespace xios { 
    1717  /// ////////////////////// Déclarations ////////////////////// /// 
    18   class CInterpolateFromFileDomainGroup; 
    19   class CInterpolateFromFileDomainAttributes; 
    20   class CInterpolateFromFileDomain; 
     18  class CInterpolateDomainGroup; 
     19  class CInterpolateDomainAttributes; 
     20  class CInterpolateDomain; 
    2121  class CDomain; 
    2222 
     
    2424 
    2525  // Declare/Define CFileAttribute 
    26   BEGIN_DECLARE_ATTRIBUTE_MAP(CInterpolateFromFileDomain) 
    27 #include "interpolate_from_file_domain_attribute.conf" 
    28   END_DECLARE_ATTRIBUTE_MAP(CInterpolateFromFileDomain) 
     26  BEGIN_DECLARE_ATTRIBUTE_MAP(CInterpolateDomain) 
     27#include "interpolate_domain_attribute.conf" 
     28  END_DECLARE_ATTRIBUTE_MAP(CInterpolateDomain) 
    2929 
    3030  ///-------------------------------------------------------------- 
    3131  /*! 
    32     \class CInterpolateFromFileDomain 
     32    \class CInterpolateDomain 
    3333    This class describes interpolate_from_file_domain in xml file. 
    3434  */ 
    35   class CInterpolateFromFileDomain 
    36     : public CObjectTemplate<CInterpolateFromFileDomain> 
    37     , public CInterpolateFromFileDomainAttributes 
     35  class CInterpolateDomain 
     36    : public CObjectTemplate<CInterpolateDomain> 
     37    , public CInterpolateDomainAttributes 
    3838    , public CTransformation<CDomain> 
    3939  { 
    4040    public : 
    41       typedef CObjectTemplate<CInterpolateFromFileDomain> SuperClass; 
    42       typedef CInterpolateFromFileDomainAttributes SuperClassAttribute; 
     41      typedef CObjectTemplate<CInterpolateDomain> SuperClass; 
     42      typedef CInterpolateDomainAttributes SuperClassAttribute; 
    4343 
    4444    public : 
    4545      /// Constructeurs /// 
    46       CInterpolateFromFileDomain(void); 
    47       explicit CInterpolateFromFileDomain(const StdString& id); 
     46      CInterpolateDomain(void); 
     47      explicit CInterpolateDomain(const StdString& id); 
    4848 
    4949      /// Destructeur /// 
    50       virtual ~CInterpolateFromFileDomain(void); 
     50      virtual ~CInterpolateDomain(void); 
    5151 
    5252      virtual void checkValid(CDomain* axisDest); 
     
    5858    private: 
    5959 
    60   }; // class CInterpolateFromFileDomain 
     60  }; // class CInterpolateDomain 
    6161 
    62   DECLARE_GROUP(CInterpolateFromFileDomain); 
     62  DECLARE_GROUP(CInterpolateDomain); 
    6363} // namespace xios 
    6464 
    65 #endif // __XIOS_CInterpolateFromFileDomain__ 
     65#endif // __XIOS_CInterpolateDomain__ 
  • XIOS/trunk/src/node/node_enum.hpp

    r687 r689  
    2424         eInterpolateAxis, 
    2525         eZoomDomain, 
    26          eInterpolateFromFileDomain, 
     26         eInterpolateDomain, 
    2727         eGenerateRectilinearDomain 
    2828 
  • XIOS/trunk/src/node/node_type.hpp

    r687 r689  
    1414#include "interpolate_axis.hpp" 
    1515#include "zoom_domain.hpp" 
    16 #include "interpolate_from_file_domain.hpp" 
     16#include "interpolate_domain.hpp" 
    1717#include "generate_rectilinear_domain.hpp" 
    1818 
  • XIOS/trunk/src/node/transformation_enum.hpp

    r687 r689  
    1111        TRANS_INTERPOLATE_AXIS, 
    1212        TRANS_ZOOM_DOMAIN, 
    13         TRANS_INTERPOLATE_DOMAIN_FROM_FILE, 
     13        TRANS_INTERPOLATE_DOMAIN, 
    1414        TRANS_GENERATE_RECTILINEAR_DOMAIN 
    1515      } ETranformationType; 
  • XIOS/trunk/src/object_factory_decl.cpp

    r687 r689  
    2828  macro(CInterpolateAxis) 
    2929  macro(CZoomDomain) 
    30   macro(CInterpolateFromFileDomain) 
     30  macro(CInterpolateDomain) 
    3131  macro(CGenerateRectilinearDomain) 
    3232 
     
    4242  macro(CInterpolateAxisGroup) 
    4343  macro(CZoomDomainGroup) 
    44   macro(CInterpolateFromFileDomainGroup) 
     44  macro(CInterpolateDomainGroup) 
    4545  macro(CGenerateRectilinearDomainGroup) 
    4646} 
  • XIOS/trunk/src/object_template_decl.cpp

    r687 r689  
    1717  template class CObjectTemplate<CInterpolateAxis>; 
    1818  template class CObjectTemplate<CZoomDomain>; 
    19   template class CObjectTemplate<CInterpolateFromFileDomain>; 
     19  template class CObjectTemplate<CInterpolateDomain>; 
    2020  template class CObjectTemplate<CGenerateRectilinearDomain>; 
    2121 
     
    3131  template class CObjectTemplate<CInterpolateAxisGroup>; 
    3232  template class CObjectTemplate<CZoomDomainGroup>; 
    33   template class CObjectTemplate<CInterpolateFromFileDomainGroup>; 
     33  template class CObjectTemplate<CInterpolateDomainGroup>; 
    3434  template class CObjectTemplate<CGenerateRectilinearDomainGroup>; 
    3535} 
  • XIOS/trunk/src/test/test_remap.f90

    r688 r689  
    115115                            bounds_lon_1D=src_boundslon, bounds_lat_1D=src_boundslat, nvertex=src_nvertex) 
    116116 
    117 !  CALL xios_set_domain_attr("dst_domain", ni_glo=dst_ni_glo, ibegin=dst_ibegin, ni=dst_ni, type="unstructured") 
     117  CALL xios_set_domain_attr("dst_domain", ni_glo=dst_ni_glo, ibegin=dst_ibegin, ni=dst_ni, type="unstructured") 
    118118  CALL xios_set_domain_attr("dst_domain", lonvalue_1D=dst_lon, latvalue_1D=dst_lat, & 
    119119                            bounds_lon_1D=dst_boundslon, bounds_lat_1D=dst_boundslat, nvertex=dst_nvertex) 
    120120 
     121  CALL xios_set_domain_attr("dst_domain_regular", ni_glo=180, nj_glo=90, type="rectilinear") 
    121122 
    122123  dtime%second = 3600 
  • XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp

    r688 r689  
    33   \author Ha NGUYEN 
    44   \since 09 Jul 2015 
    5    \date 11 Sep 2015 
     5   \date 15 Sep 2015 
    66 
    77   \brief Algorithm for interpolation on a domain. 
    88 */ 
    9 #include "domain_algorithm_interpolate_from_file.hpp" 
     9#include "domain_algorithm_interpolate.hpp" 
    1010#include <boost/unordered_map.hpp> 
    1111#include "context.hpp" 
     
    1818namespace xios { 
    1919 
    20 CDomainAlgorithmInterpolateFromFile::CDomainAlgorithmInterpolateFromFile(CDomain* domainDestination, CDomain* domainSource, CInterpolateFromFileDomain* interpDomain) 
     20CDomainAlgorithmInterpolate::CDomainAlgorithmInterpolate(CDomain* domainDestination, CDomain* domainSource, CInterpolateDomain* interpDomain) 
    2121: CDomainAlgorithmTransformation(domainDestination, domainSource), interpDomain_(interpDomain) 
    2222{ 
     
    2525} 
    2626 
    27 void CDomainAlgorithmInterpolateFromFile::computeRemap() 
     27/*! 
     28  Compute remap with integrated remap calculation module 
     29*/ 
     30void CDomainAlgorithmInterpolate::computeRemap() 
    2831{ 
    2932  using namespace sphereRemap; 
     
    3336  int clientRank = client->clientRank; 
    3437  int i, j, k, idx; 
    35         double srcPole[] = {0, 0, 0}; 
    36         double dstPole[] = {0, 0, 1}; 
    37         int orderInterp = 2; 
     38  std::vector<double> srcPole(3,0), dstPole(3,0); 
     39        int orderInterp = interpDomain_->order.getValue(); 
    3840 
    3941  int constNVertex = 4; // Value by default number of vertex for rectangular domain 
     
    4951  CArray<double,2> boundsLatSrc(nVertexSrc,localDomainSrcSize); 
    5052 
     53  if (CDomain::type_attr::rectilinear == domainSrc_->type) srcPole[2] = 1; 
    5154  if (hasBoundSrc)  // Suppose that domain source is curvilinear or unstructured 
    5255  { 
     
    8285  CArray<double,2> boundsLatDest(nVertexDest,localDomainDestSize); 
    8386 
     87  if (CDomain::type_attr::rectilinear == domainDest_->type) dstPole[2] = 1; 
    8488  if (hasBoundDest) 
    8589  { 
     
    107111    // Ok, fill in boundary values for rectangular domain 
    108112    domainDest_->fillInRectilinearBoundLonLat(boundsLonDest, boundsLatDest); 
    109     nVertexDest = 4; 
     113    nVertexDest = constNVertex; 
    110114  } 
    111115 
     
    115119  Mapper mapper(client->intraComm); 
    116120  mapper.setVerbosity(PROGRESS) ; 
    117   mapper.setSourceMesh(boundsLonSrc.dataFirst(), boundsLatSrc.dataFirst(), nVertexSrc, nSrcLocal, srcPole); 
    118   mapper.setTargetMesh(boundsLonDest.dataFirst(), boundsLatDest.dataFirst(), nVertexDest, nDstLocal, dstPole); 
     121  mapper.setSourceMesh(boundsLonSrc.dataFirst(), boundsLatSrc.dataFirst(), nVertexSrc, nSrcLocal, &srcPole[0]); 
     122  mapper.setTargetMesh(boundsLonDest.dataFirst(), boundsLatDest.dataFirst(), nVertexDest, nDstLocal, &dstPole[0]); 
    119123  std::vector<double> timings = mapper.computeWeights(orderInterp); 
    120124 
     
    126130} 
    127131 
    128 void CDomainAlgorithmInterpolateFromFile::computeIndexSourceMapping() 
    129 { 
    130   computeRemap(); 
    131 } 
    132  
    133  
    134132/*! 
    135133  Compute the index mapping between domain on grid source and one on grid destination 
    136134*/ 
    137 void CDomainAlgorithmInterpolateFromFile::readRemapInfo() 
     135void CDomainAlgorithmInterpolate::computeIndexSourceMapping() 
     136{ 
     137  if (!interpDomain_->file.isEmpty()) 
     138    readRemapInfo(); 
     139  else 
     140    computeRemap(); 
     141} 
     142 
     143/*! 
     144  Read remap information from file then distribute it among clients 
     145*/ 
     146void CDomainAlgorithmInterpolate::readRemapInfo() 
    138147{ 
    139148  CContext* context = CContext::getCurrent(); 
     
    312321         corresponding global index of domain and associated weight value on grid source 
    313322*/ 
    314 void CDomainAlgorithmInterpolateFromFile::readInterpolationInfo(std::string& filename, 
     323void CDomainAlgorithmInterpolate::readInterpolationInfo(std::string& filename, 
    315324                                                                std::map<int,std::vector<std::pair<int,double> > >& interpMapValue) 
    316325{ 
  • XIOS/trunk/src/transformation/grid_transformation.cpp

    r688 r689  
    1212#include "axis_algorithm_interpolate.hpp" 
    1313#include "domain_algorithm_zoom.hpp" 
    14 #include "domain_algorithm_interpolate_from_file.hpp" 
     14#include "domain_algorithm_interpolate.hpp" 
    1515#include "context.hpp" 
    1616#include "context_client.hpp" 
     
    276276 
    277277  CZoomDomain* zoomDomain = 0; 
    278   CInterpolateFromFileDomain* interpFileDomain = 0; 
     278  CInterpolateDomain* interpFileDomain = 0; 
    279279  CGenericAlgorithmTransformation* algo = 0; 
    280280  switch (transType) 
    281281  { 
    282     case TRANS_INTERPOLATE_DOMAIN_FROM_FILE: 
    283       interpFileDomain = dynamic_cast<CInterpolateFromFileDomain*> (it->second); 
    284       algo = new CDomainAlgorithmInterpolateFromFile(domainListDestP[domainIndex], domainListSrcP[domainIndex],interpFileDomain); 
     282    case TRANS_INTERPOLATE_DOMAIN: 
     283      interpFileDomain = dynamic_cast<CInterpolateDomain*> (it->second); 
     284      algo = new CDomainAlgorithmInterpolate(domainListDestP[domainIndex], domainListSrcP[domainIndex],interpFileDomain); 
    285285      break; 
    286286    case TRANS_ZOOM_DOMAIN: 
     
    312312  switch (transType) 
    313313  { 
    314     case TRANS_INTERPOLATE_DOMAIN_FROM_FILE: 
     314    case TRANS_INTERPOLATE_DOMAIN: 
    315315    case TRANS_ZOOM_DOMAIN: 
    316316      domainIndex = elementPosition2DomainPositionInGrid_[elementPositionInGrid]; 
     
    494494     if (searchCurrentSrc.search(itbIndex, iteIndex, globalIndexOfCurrentGridSourceToSend[idx], itIndex)) 
    495495     { 
    496 //       int index = std::distance(itbArr, itArr); 
    497        sendBuff[idx+currentBuffPosition] = globalIndexOfOriginalGridSource_[*itIndex]; //[index]; 
     496       sendBuff[idx+currentBuffPosition] = globalIndexOfOriginalGridSource_[*itIndex]; 
    498497     } 
    499498   } 
  • XIOS/trunk/src/type/type_util.hpp

    r687 r689  
    2828    class CZoomDomain; 
    2929    class CZoomDomainGroup; 
    30     class CInterpolateFromFileDomain; 
    31     class CInterpolateFromFileDomainGroup; 
     30    class CInterpolateDomain; 
     31    class CInterpolateDomainGroup; 
    3232    class CGenerateRectilinearDomain; 
    3333    class CGenerateRectilinearDomainGroup; 
     
    7676  macro(CZoomDomain) 
    7777  macro(CZoomDomainGroup) 
    78   macro(CInterpolateFromFileDomain) 
    79   macro(CInterpolateFromFileDomainGroup) 
     78  macro(CInterpolateDomain) 
     79  macro(CInterpolateDomainGroup) 
    8080  macro(CGenerateRectilinearDomain) 
    8181  macro(CGenerateRectilinearDomainGroup) 
  • XIOS/trunk/src/xml_parser_decl.cpp

    r687 r689  
    2323    macro( InterpolateAxis ) 
    2424    macro( ZoomDomain ) 
    25     macro( InterpolateFromFileDomain ) 
     25    macro( InterpolateDomain ) 
    2626    macro( GenerateRectilinearDomain ) 
    2727  } 
Note: See TracChangeset for help on using the changeset viewer.