New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
icfield.cpp in vendors/XIOS/current/src/interface/c – NEMO

source: vendors/XIOS/current/src/interface/c/icfield.cpp @ 3408

Last change on this file since 3408 was 3408, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.6 KB
Line 
1/* ************************************************************************** *
2 *      Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011         *
3 * ************************************************************************** */
4
5#include <boost/multi_array.hpp>
6#include <boost/shared_ptr.hpp>
7
8#include "xmlioserver.hpp"
9
10#include "attribute_template_impl.hpp"
11#include "object_template_impl.hpp"
12#include "group_template_impl.hpp"
13
14#include "icutil.hpp"
15#include "timer.hpp"
16
17extern "C"
18{
19// /////////////////////////////// Définitions ////////////////////////////// //
20
21   // ----------------------- Redéfinition de types ----------------------------
22   
23   typedef xios::CField      * XFieldPtr;
24   typedef xios::CFieldGroup * XFieldGroupPtr;
25   
26// --------------------------------------------------------------------------   
27// ------------------------ Création des handle -----------------------------
28// --------------------------------------------------------------------------   
29   
30   void cxios_field_handle_create (XFieldPtr * _ret, const char * _id, int _id_len)
31   {
32      std::string id; 
33      if (!cstr2string(_id, _id_len, id)) return;
34      CTimer::get("XIOS").resume() ;
35      *_ret = CField::get(id);
36      CTimer::get("XIOS").suspend() ;
37   }
38   
39   void cxios_fieldgroup_handle_create (XFieldGroupPtr * _ret, const char * _id, int _id_len)
40   {
41      std::string id; 
42      if (!cstr2string(_id, _id_len, id)) return;
43      CTimer::get("XIOS").resume() ;
44      *_ret = CFieldGroup::get(id);
45      CTimer::get("XIOS").suspend() ;
46   }
47
48
49   // -------------------- Vérification des identifiants -----------------------
50
51   void cxios_field_valid_id (bool * _ret, const char * _id, int _id_len)
52   {
53      std::string id;
54      if (!cstr2string(_id, _id_len, id)) return;
55      CTimer::get("XIOS").resume() ;
56      *_ret = CField::has(id);
57      CTimer::get("XIOS").suspend() ;
58   }
59
60   void cxios_fieldgroup_valid_id (bool * _ret, const char * _id, int _id_len)
61   {
62      std::string id;
63      if (!cstr2string(_id, _id_len, id)) return;
64      CTimer::get("XIOS").resume() ;
65      *_ret = CFieldGroup::has(id);
66      CTimer::get("XIOS").suspend() ;
67   }
68
69// -----------------------------------------------------------------------------------------------------   
70// ------------------------- other function----------  --------------------------- ---------------------
71// -----------------------------------------------------------------------------------------------------   
72
73  void cxios_field_is_active (XFieldPtr field_hdl, bool* ret)
74  {
75    CTimer::get("XIOS").resume() ;
76    *ret = field_hdl->isActive();
77    CTimer::get("XIOS").suspend() ;
78  }
79   
80} // extern "C"
Note: See TracBrowser for help on using the repository browser.