1 | #include "zoom_domain.hpp" |
---|
2 | #include "type.hpp" |
---|
3 | |
---|
4 | namespace 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->ni.isEmpty() || !this->nj.isEmpty() || |
---|
32 | !this->ibegin.isEmpty() || !this->jbegin.isEmpty()) |
---|
33 | { |
---|
34 | if (this->ni.isEmpty() || this->nj.isEmpty() || |
---|
35 | this->ibegin.isEmpty() || this->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 iend = ibegin + ni - 1; |
---|
43 | int jend = jbegin + nj - 1; |
---|
44 | |
---|
45 | if (ibegin < 0 || jbegin < 0 || iend > ni_glo - 1 || jend > nj_glo - 1) |
---|
46 | ERROR("CZoomDomain::checkValid(CDomain* domainSrc)", |
---|
47 | << "Zoom is wrongly defined, " |
---|
48 | << "please check the values : 'ni' (" << ni.getValue() << "), 'nj' (" << nj.getValue() << "), " |
---|
49 | << "'ibegin' (" << ibegin.getValue() << "), 'jbegin' (" << jbegin.getValue() << ")"); |
---|
50 | } |
---|
51 | } |
---|
52 | else |
---|
53 | { |
---|
54 | ni = ni_glo; |
---|
55 | nj = nj_glo; |
---|
56 | ibegin = 0; |
---|
57 | jbegin = 0; |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | } |
---|