source: XIOS/trunk/src/node/zoom_domain.cpp @ 631

Last change on this file since 631 was 631, checked in by mhnguyen, 9 years ago

Implementing zooming on a domain

+) Add algorithm to do zooming on a domain
+) Remove some redundant codes

Test
+) On Curie
+) test_complete and test_client are correct

File size: 2.0 KB
Line 
1#include "zoom_domain.hpp"
2#include "type.hpp"
3
4namespace xios {
5
6  /// ////////////////////// Définitions ////////////////////// ///
7
8  CZoomDomain::CZoomDomain(void)
9    : CObjectTemplate<CZoomDomain>(), CZoomDomainAttributes(), CTransformation<CDomain>()
10  { /* Ne rien faire de plus */ }
11
12  CZoomDomain::CZoomDomain(const StdString & id)
13    : CObjectTemplate<CZoomDomain>(id), CZoomDomainAttributes(), CTransformation<CDomain>()
14  { /* Ne rien faire de plus */ }
15
16  CZoomDomain::~CZoomDomain(void)
17  {}
18
19  //----------------------------------------------------------------
20
21  StdString CZoomDomain::GetName(void)    { return StdString("zoom_domain"); }
22  StdString CZoomDomain::GetDefName(void) { return StdString("zoom_domain"); }
23  ENodeType CZoomDomain::GetType(void)    { return eZoomDomain; }
24
25  void CZoomDomain::checkValid(CDomain* domainSrc)
26  {
27    int ni_glo = domainSrc->ni_glo.getValue();
28    int nj_glo = domainSrc->nj_glo.getValue();
29
30    // Résolution et vérification des données globales de zoom.
31    if (!this->zoom_ni.isEmpty() || !this->zoom_nj.isEmpty() ||
32        !this->zoom_ibegin.isEmpty() || !this->zoom_jbegin.isEmpty())
33    {
34       if (this->zoom_ni.isEmpty()     || this->zoom_nj.isEmpty() ||
35           this->zoom_ibegin.isEmpty() || this->zoom_jbegin.isEmpty())
36       {
37          ERROR("CZoomDomain::checkValid(void)",
38                <<"if one of zoom attributes is defined then all zoom attributes must be defined") ;
39       }
40       else
41       {
42          int zoom_iend = zoom_ibegin + zoom_ni - 1;
43          int zoom_jend = zoom_jbegin + zoom_nj - 1;
44
45          if (zoom_ibegin < 0  || zoom_jbegin < 0 || zoom_iend > (ni_glo-1) || zoom_jend > (nj_glo-1))
46             ERROR("CZoomDomain::checkValid(void)",
47                   << "Zoom is wrongly defined,"
48                   << " Check the values : zoom_ni, zoom_nj, zoom_ibegin, zoom_jbegin") ;
49       }
50    }
51    else
52    {
53       zoom_ni = ni_glo;
54       zoom_nj = nj_glo;
55       zoom_ibegin = 0;
56       zoom_jbegin = 0;
57    }
58  }
59
60}
Note: See TracBrowser for help on using the repository browser.