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

Last change on this file since 1852 was 1852, checked in by ymipsl, 4 years ago

Compiler fix : solve the problem of crash occured with recent version of GCC, only in optimised mode > O1
It seems to be due to non return value from a non void function in case of early initialization (static initialization).
Thanks to A. Durocher who find the tip.

YM

File size: 2.5 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  CTransformation<CDomain>* CZoomDomain::create(const StdString& id, xml::CXMLNode* node)
20  {
21    CZoomDomain* zoomDomain = CZoomDomainGroup::get("zoom_domain_definition")->createChild(id);
22    if (node) zoomDomain->parse(*node);
23    return static_cast<CTransformation<CDomain>*>(zoomDomain);
24  }
25
26  bool CZoomDomain::_dummyRegistered = CZoomDomain::registerTrans();
27  bool CZoomDomain::registerTrans()
28  {
29    return registerTransformation(TRANS_ZOOM_DOMAIN, CZoomDomain::create);
30  }
31
32  //----------------------------------------------------------------
33
34  StdString CZoomDomain::GetName(void)    { return StdString("zoom_domain"); }
35  StdString CZoomDomain::GetDefName(void) { return StdString("zoom_domain"); }
36  ENodeType CZoomDomain::GetType(void)    { return eZoomDomain; }
37
38  void CZoomDomain::checkValid(CDomain* domainSrc)
39  {
40    int ni_glo = domainSrc->ni_glo.getValue();
41    int nj_glo = domainSrc->nj_glo.getValue();
42
43    // Résolution et vérification des données globales de zoom.
44    if (!this->ni.isEmpty() || !this->nj.isEmpty() ||
45        !this->ibegin.isEmpty() || !this->jbegin.isEmpty())
46    {
47       if (this->ni.isEmpty()     || this->nj.isEmpty() ||
48           this->ibegin.isEmpty() || this->jbegin.isEmpty())
49       {
50         ERROR("CZoomDomain::checkValid(CDomain* domainSrc)",
51               << "If one of zoom attributes is defined then all zoom attributes must be defined.") ;
52       }
53       else
54       {
55          int iend = ibegin + ni - 1;
56          int jend = jbegin + nj - 1;
57
58          if (ibegin < 0  || jbegin < 0 || iend > ni_glo - 1 || jend > nj_glo - 1)
59            ERROR("CZoomDomain::checkValid(CDomain* domainSrc)",
60                  << "Zoom is wrongly defined, "
61                  << "please check the values : 'ni' (" << ni.getValue() << "), 'nj' (" << nj.getValue() << "), "
62                  << "'ibegin' (" << ibegin.getValue() << "), 'jbegin' (" << jbegin.getValue() << ")");
63       }
64    }
65    else
66    {
67       ni = ni_glo;
68       nj = nj_glo;
69       ibegin = 0;
70       jbegin = 0;
71    }
72  }
73
74}
Note: See TracBrowser for help on using the repository browser.