[631] | 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. |
---|
[787] | 31 | if (!this->ni.isEmpty() || !this->nj.isEmpty() || |
---|
| 32 | !this->ibegin.isEmpty() || !this->jbegin.isEmpty()) |
---|
[631] | 33 | { |
---|
[787] | 34 | if (this->ni.isEmpty() || this->nj.isEmpty() || |
---|
| 35 | this->ibegin.isEmpty() || this->jbegin.isEmpty()) |
---|
[631] | 36 | { |
---|
[680] | 37 | ERROR("CZoomDomain::checkValid(CDomain* domainSrc)", |
---|
| 38 | << "If one of zoom attributes is defined then all zoom attributes must be defined.") ; |
---|
[631] | 39 | } |
---|
| 40 | else |
---|
| 41 | { |
---|
[787] | 42 | int iend = ibegin + ni - 1; |
---|
| 43 | int jend = jbegin + nj - 1; |
---|
[631] | 44 | |
---|
[787] | 45 | if (ibegin < 0 || jbegin < 0 || iend > ni_glo - 1 || jend > nj_glo - 1) |
---|
[680] | 46 | ERROR("CZoomDomain::checkValid(CDomain* domainSrc)", |
---|
| 47 | << "Zoom is wrongly defined, " |
---|
[787] | 48 | << "please check the values : 'ni' (" << ni.getValue() << "), 'nj' (" << nj.getValue() << "), " |
---|
| 49 | << "'ibegin' (" << ibegin.getValue() << "), 'jbegin' (" << jbegin.getValue() << ")"); |
---|
[631] | 50 | } |
---|
| 51 | } |
---|
| 52 | else |
---|
| 53 | { |
---|
[787] | 54 | ni = ni_glo; |
---|
| 55 | nj = nj_glo; |
---|
| 56 | ibegin = 0; |
---|
| 57 | jbegin = 0; |
---|
[631] | 58 | } |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | } |
---|