source: XIOS/dev/dev_olga/src/interface/c/icreduce_to_scalar.cpp @ 1612

Last change on this file since 1612 was 1612, checked in by oabramkina, 5 years ago

Dev: adding exception handling.

To activate it, compilation flag -DXIOS_EXCEPTION should be added.

File size: 2.4 KB
RevLine 
[891]1/* ************************************************************************** *
2 *      Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011         *
3 * ************************************************************************** */
4
5#include <boost/multi_array.hpp>
6
7#include "xios.hpp"
8
9#include "object_template.hpp"
10#include "group_template.hpp"
11#include "attribute_template.hpp"
12
13#include "icutil.hpp"
14#include "timer.hpp"
15#include "reduce_axis_to_scalar.hpp"
[981]16#include "reduce_domain_to_scalar.hpp"
[891]17
18extern "C"
19{
20// /////////////////////////////// Définitions ////////////////////////////// //
21
22   // ----------------------- Redéfinition de types ----------------------------
23
24   typedef xios::CReduceAxisToScalar      * XReduceAxisToScalarPtr;
[981]25   typedef xios::CReduceDomainToScalar    * XReduceDomainToScalarPtr;
[891]26
27   // ------------------------ Création des handle -----------------------------
28   void cxios_reduce_axis_to_scalar_handle_create(XReduceAxisToScalarPtr * _ret, const char * _id, int _id_len)
[1612]29   TRY
[891]30   {
31      std::string id;
32      if (!cstr2string(_id, _id_len, id)) return;
33      CTimer::get("XIOS").resume() ;
34      *_ret = xios::CReduceAxisToScalar::get(id);
35      CTimer::get("XIOS").suspend() ;
36   }
[1612]37   CATCH_DUMP_STACK
[891]38
39   // -------------------- Vérification des identifiants -----------------------
40   void cxios_reduce_axis_to_scalar_valid_id(bool * _ret, const char * _id, int _id_len)
[1612]41   TRY
[891]42   {
43      std::string id;
44      if (!cstr2string(_id, _id_len, id)) return;
45
46      CTimer::get("XIOS").resume() ;
47      *_ret = xios::CReduceAxisToScalar::has(id);
48      CTimer::get("XIOS").suspend() ;
49   }
[1612]50   CATCH_DUMP_STACK
[981]51
52   void cxios_reduce_domain_to_scalar_handle_create(XReduceDomainToScalarPtr * _ret, const char * _id, int _id_len)
[1612]53   TRY
[981]54   {
55      std::string id;
56      if (!cstr2string(_id, _id_len, id)) return;
57      CTimer::get("XIOS").resume() ;
58      *_ret = xios::CReduceDomainToScalar::get(id);
59      CTimer::get("XIOS").suspend() ;
60   }
[1612]61   CATCH_DUMP_STACK
[981]62
63   // -------------------- Vérification des identifiants -----------------------
64   void cxios_reduce_domain_to_scalar_valid_id(bool * _ret, const char * _id, int _id_len)
[1612]65   TRY
[981]66   {
67      std::string id;
68      if (!cstr2string(_id, _id_len, id)) return;
69
70      CTimer::get("XIOS").resume() ;
71      *_ret = xios::CReduceDomainToScalar::has(id);
72      CTimer::get("XIOS").suspend() ;
73   }
[1612]74   CATCH_DUMP_STACK
[981]75
[891]76} // extern "C"
Note: See TracBrowser for help on using the repository browser.