source: XIOS/trunk/src/interface/c/icfield.cpp @ 1542

Last change on this file since 1542 was 1542, checked in by oabramkina, 6 years ago

Replacing Boost's unordered_map and shared_pointer by its STL counterparts.

Two notes for Curie:

  • one can see the content of unordered_map with ddt only if XIOS has been compiled with gnu
  • XIOS will not compile any more with pgi (all available versions use old STL which are not up to the c++11 norms)
  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
  • Property svn:eol-style set to native
File size: 3.7 KB
Line 
1/* ************************************************************************** *
2 *      Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011         *
3 * ************************************************************************** */
4
5#include <boost/multi_array.hpp>
6
7#include <memory>
8
9#include "xios.hpp"
10
11#include "attribute_template.hpp"
12#include "object_template.hpp"
13#include "group_template.hpp"
14
15#include "icutil.hpp"
16#include "timer.hpp"
17#include "field.hpp"
18
19extern "C"
20{
21// /////////////////////////////// Définitions ////////////////////////////// //
22
23   // ----------------------- Redéfinition de types ----------------------------
24   
25   typedef xios::CField      * XFieldPtr;
26   typedef xios::CFieldGroup * XFieldGroupPtr;
27   
28   typedef xios::CDomain     * XDomainPtr;
29   typedef xios::CAxis       * XAxisPtr;
30   typedef xios::CScalar     * XScalarPtr;
31
32// --------------------------------------------------------------------------   
33// ------------------------ Création des handle -----------------------------
34// --------------------------------------------------------------------------   
35   
36   void cxios_field_handle_create (XFieldPtr * _ret, const char * _id, int _id_len)
37   {
38      std::string id; 
39      if (!cstr2string(_id, _id_len, id)) return;
40      CTimer::get("XIOS").resume() ;
41      *_ret = CField::get(id);
42      CTimer::get("XIOS").suspend() ;
43   }
44   
45   void cxios_fieldgroup_handle_create (XFieldGroupPtr * _ret, const char * _id, int _id_len)
46   {
47      std::string id; 
48      if (!cstr2string(_id, _id_len, id)) return;
49      CTimer::get("XIOS").resume() ;
50      *_ret = CFieldGroup::get(id);
51      CTimer::get("XIOS").suspend() ;
52   }
53
54
55   // -------------------- Vérification des identifiants -----------------------
56
57   void cxios_field_valid_id (bool * _ret, const char * _id, int _id_len)
58   {
59      std::string id;
60      if (!cstr2string(_id, _id_len, id)) return;
61      CTimer::get("XIOS").resume() ;
62      *_ret = CField::has(id);
63      CTimer::get("XIOS").suspend() ;
64   }
65
66   void cxios_fieldgroup_valid_id (bool * _ret, const char * _id, int _id_len)
67   {
68      std::string id;
69      if (!cstr2string(_id, _id_len, id)) return;
70      CTimer::get("XIOS").resume() ;
71      *_ret = CFieldGroup::has(id);
72      CTimer::get("XIOS").suspend() ;
73   }
74
75// -----------------------------------------------------------------------------------------------------   
76// ------------------------- Other functions
77// -----------------------------------------------------------------------------------------------------   
78
79  void cxios_field_is_active (XFieldPtr field_hdl, bool at_current_timestep, bool* ret)
80  {
81    CTimer::get("XIOS").resume() ;
82    *ret = field_hdl->isActive(at_current_timestep);
83    CTimer::get("XIOS").suspend() ;
84  }
85
86// -----------------------------------------------------------------------------------------------------
87// ------------------------- Retrieving information of grid associated to field
88// -----------------------------------------------------------------------------------------------------
89  void cxios_field_get_domain_handle(XDomainPtr * domain_hdl_ret, XFieldPtr field_hdl, int domainIndex)
90  {
91     CTimer::get("XIOS").resume() ;
92     *domain_hdl_ret = field_hdl->grid->getDomain(domainIndex);
93     CTimer::get("XIOS").suspend();
94  }
95
96  void cxios_field_get_axis_handle(XAxisPtr * axis_hdl_ret, XFieldPtr field_hdl, int axisIndex)
97  {
98     CTimer::get("XIOS").resume() ;
99     *axis_hdl_ret = field_hdl->grid->getAxis(axisIndex);
100     CTimer::get("XIOS").suspend();
101  }
102
103  void cxios_field_get_scalar_handle(XScalarPtr * scalar_hdl_ret, XFieldPtr field_hdl, int scalarIndex)
104  {
105     CTimer::get("XIOS").resume() ;
106     *scalar_hdl_ret = field_hdl->grid->getScalar(scalarIndex);
107     CTimer::get("XIOS").suspend();
108  }
109} // extern "C"
Note: See TracBrowser for help on using the repository browser.