XIOS  1.0
Xml I/O Server
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Définitions de type Énumérations Valeurs énumérées Amis Macros
reduce_domain_to_axis.cpp
Aller à la documentation de ce fichier.
2 #include "type.hpp"
3 #include "axis.hpp"
4 #include "domain.hpp"
5 
6 namespace xios {
7 
9 
11  : CObjectTemplate<CReduceDomainToAxis>(), CReduceDomainToAxisAttributes(), CTransformation<CAxis>()
12  { /* Ne rien faire de plus */ }
13 
15  : CObjectTemplate<CReduceDomainToAxis>(id), CReduceDomainToAxisAttributes(), CTransformation<CAxis>()
16  { /* Ne rien faire de plus */ }
17 
19  {}
20 
22  {
23  CReduceDomainToAxis* reduceDomain = CReduceDomainToAxisGroup::get("reduce_domain_to_axis_definition")->createChild(id);
24  if (node) reduceDomain->parse(*node);
25  return static_cast<CTransformation<CAxis>*>(reduceDomain);
26  }
27 
29  {
31  }
32 
34 
35  //----------------------------------------------------------------
36 
37  StdString CReduceDomainToAxis::GetName(void) { return StdString("reduce_domain_to_axis"); }
38  StdString CReduceDomainToAxis::GetDefName(void) { return StdString("reduce_domain_to_axis"); }
40 
41  void CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)
42  {
43  if (CDomain::type_attr::unstructured == domainSrc->type)
44  ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)",
45  << "Domain reduction is only supported for rectilinear or curvillinear grid."
46  << "Domain source " <<domainSrc->getId() << std::endl
47  << "Axis destination " << axisDst->getId());
48 
49  int axis_n_glo = axisDst->n_glo;
50  int domain_ni_glo = domainSrc->ni_glo;
51  int domain_nj_glo = domainSrc->nj_glo;
52 
53  if (this->operation.isEmpty())
54  ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)",
55  << "An operation must be defined."
56  << "Domain source " <<domainSrc->getId() << std::endl
57  << "Axis destination " << axisDst->getId());
58 
59  if (this->direction.isEmpty())
60  ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)",
61  << "A direction to apply the operation must be defined. It should be: 'iDir' or 'jDir'"
62  << "Domain source " <<domainSrc->getId() << std::endl
63  << "Axis destination " << axisDst->getId());
64  if (this->local.isEmpty()) local=false ;
65 
66  switch (direction)
67  {
68  case direction_attr::jDir:
69  if (axis_n_glo != domain_ni_glo)
70  ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)",
71  << "Extract domain along j, axis destination should have n_glo equal to ni_glo of domain source"
72  << "Domain source " <<domainSrc->getId() << " has nj_glo " << domain_ni_glo << std::endl
73  << "Axis destination " << axisDst->getId() << " has n_glo " << axis_n_glo);
74  break;
75 
76  case direction_attr::iDir:
77  if (axis_n_glo != domain_nj_glo)
78  ERROR("CReduceDomainToAxis::checkValid(CAxis* axisDst, CDomain* domainSrc)",
79  << "Extract domain along i, axis destination should have n_glo equal to nj_glo of domain source"
80  << "Domain source " <<domainSrc->getId() << " has nj_glo " << domain_nj_glo << std::endl
81  << "Axis destination " << axisDst->getId() << " has n_glo " << axis_n_glo);
82  break;
83 
84  default:
85  break;
86  }
87  }
88 
89 }
static StdString GetDefName(void)
static ENodeType GetType(void)
virtual void checkValid(CAxis *axisDst, CDomain *domainSrc)
std::string StdString
Definition: xios_spl.hpp:48
#define xios(arg)
const StdString & getId(void) const
Accesseurs ///.
Definition: object.cpp:26
CATCH CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar *scalarDestination, CScalar *scalarSource, CReduceScalarToScalar *algo ERROR)("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)",<< "Operation must be defined."<< "Scalar source "<< scalarSource->getId()<< std::endl<< "Scalar destination "<< scalarDestination->getId())
////////////////////// Déclarations ////////////////////// ///
static StdString GetName(void)
Accesseurs statiques ///.
CReduceDomainToAxis(void)
Constructeurs ///.
static CTransformation< CAxis > * create(const StdString &id, xml::CXMLNode *node)
virtual void parse(xml::CXMLNode &node)
virtual ~CReduceDomainToAxis(void)
Destructeur ///.
enum xios::_node_type ENodeType
////////////////////// Définitions ////////////////////// ///
static bool registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn)