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
RevLine 
[325]1/* ************************************************************************** *
[335]2 *      Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011         *
[325]3 * ************************************************************************** */
4
5#include <boost/multi_array.hpp>
6
[1542]7#include <memory>
8
[591]9#include "xios.hpp"
[325]10
[352]11#include "attribute_template.hpp"
12#include "object_template.hpp"
13#include "group_template.hpp"
[325]14
15#include "icutil.hpp"
[347]16#include "timer.hpp"
[352]17#include "field.hpp"
[325]18
19extern "C"
20{
21// /////////////////////////////// Définitions ////////////////////////////// //
22
23   // ----------------------- Redéfinition de types ----------------------------
24   
[345]25   typedef xios::CField      * XFieldPtr;
26   typedef xios::CFieldGroup * XFieldGroupPtr;
[325]27   
[943]28   typedef xios::CDomain     * XDomainPtr;
29   typedef xios::CAxis       * XAxisPtr;
30   typedef xios::CScalar     * XScalarPtr;
31
[325]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;
[347]40      CTimer::get("XIOS").resume() ;
41      *_ret = CField::get(id);
42      CTimer::get("XIOS").suspend() ;
[325]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;
[347]49      CTimer::get("XIOS").resume() ;
50      *_ret = CFieldGroup::get(id);
51      CTimer::get("XIOS").suspend() ;
[325]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;
[347]61      CTimer::get("XIOS").resume() ;
[346]62      *_ret = CField::has(id);
[347]63      CTimer::get("XIOS").suspend() ;
[325]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;
[347]70      CTimer::get("XIOS").resume() ;
[346]71      *_ret = CFieldGroup::has(id);
[347]72      CTimer::get("XIOS").suspend() ;
[325]73   }
74
75// -----------------------------------------------------------------------------------------------------   
[943]76// ------------------------- Other functions
[325]77// -----------------------------------------------------------------------------------------------------   
78
[1158]79  void cxios_field_is_active (XFieldPtr field_hdl, bool at_current_timestep, bool* ret)
[325]80  {
[347]81    CTimer::get("XIOS").resume() ;
[1158]82    *ret = field_hdl->isActive(at_current_timestep);
[347]83    CTimer::get("XIOS").suspend() ;
[325]84  }
[943]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  }
[325]109} // extern "C"
Note: See TracBrowser for help on using the repository browser.