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

Last change on this file since 747 was 680, checked in by rlacroix, 9 years ago

Rephrase some error messages so that they are clearer.

File size: 2.2 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(CDomain* domainSrc)",
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(CDomain* domainSrc)",
47                  << "Zoom is wrongly defined, "
48                  << "please check the values : 'zoom_ni' (" << zoom_ni.getValue() << "), 'zoom_nj' (" << zoom_nj.getValue() << "), "
49                  << "'zoom_ibegin' (" << zoom_ibegin.getValue() << "), 'zoom_jbegin' (" << zoom_jbegin.getValue() << ")");
50       }
51    }
52    else
53    {
54       zoom_ni = ni_glo;
55       zoom_nj = nj_glo;
56       zoom_ibegin = 0;
57       zoom_jbegin = 0;
58    }
59  }
60
61}
Note: See TracBrowser for help on using the repository browser.