Ignore:
Timestamp:
06/18/18 20:32:55 (6 years ago)
Author:
yushan
Message:

branch_openmp merged with trunk r1544

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/src/interface/c_attr/icscalar_attr.cpp

    r1052 r1545  
    44 
    55#include <boost/multi_array.hpp> 
    6 #include <boost/shared_ptr.hpp> 
     6#include <memory> 
    77#include "xios.hpp" 
    88#include "attribute_template.hpp" 
     
    1818  typedef xios::CScalar* scalar_Ptr; 
    1919 
     20  void cxios_set_scalar_axis_type(scalar_Ptr scalar_hdl, const char * axis_type, int axis_type_size) 
     21  { 
     22    std::string axis_type_str; 
     23    if (!cstr2string(axis_type, axis_type_size, axis_type_str)) return; 
     24    CTimer::get("XIOS").resume(); 
     25    scalar_hdl->axis_type.fromString(axis_type_str); 
     26    CTimer::get("XIOS").suspend(); 
     27  } 
     28 
     29  void cxios_get_scalar_axis_type(scalar_Ptr scalar_hdl, char * axis_type, int axis_type_size) 
     30  { 
     31    CTimer::get("XIOS").resume(); 
     32    if (!string_copy(scalar_hdl->axis_type.getInheritedStringValue(), axis_type, axis_type_size)) 
     33      ERROR("void cxios_get_scalar_axis_type(scalar_Ptr scalar_hdl, char * axis_type, int axis_type_size)", << "Input string is too short"); 
     34    CTimer::get("XIOS").suspend(); 
     35  } 
     36 
     37  bool cxios_is_defined_scalar_axis_type(scalar_Ptr scalar_hdl) 
     38  { 
     39     CTimer::get("XIOS").resume(); 
     40     bool isDefined = scalar_hdl->axis_type.hasInheritedValue(); 
     41     CTimer::get("XIOS").suspend(); 
     42     return isDefined; 
     43  } 
     44 
     45 
     46  void cxios_set_scalar_bounds(scalar_Ptr scalar_hdl, double* bounds, int* extent) 
     47  { 
     48    CTimer::get("XIOS").resume(); 
     49    CArray<double,1> tmp(bounds, shape(extent[0]), neverDeleteData); 
     50    scalar_hdl->bounds.reference(tmp.copy()); 
     51     CTimer::get("XIOS").suspend(); 
     52  } 
     53 
     54  void cxios_get_scalar_bounds(scalar_Ptr scalar_hdl, double* bounds, int* extent) 
     55  { 
     56    CTimer::get("XIOS").resume(); 
     57    CArray<double,1> tmp(bounds, shape(extent[0]), neverDeleteData); 
     58    tmp=scalar_hdl->bounds.getInheritedValue(); 
     59     CTimer::get("XIOS").suspend(); 
     60  } 
     61 
     62  bool cxios_is_defined_scalar_bounds(scalar_Ptr scalar_hdl) 
     63  { 
     64     CTimer::get("XIOS").resume(); 
     65     bool isDefined = scalar_hdl->bounds.hasInheritedValue(); 
     66     CTimer::get("XIOS").suspend(); 
     67     return isDefined; 
     68  } 
     69 
     70 
     71  void cxios_set_scalar_bounds_name(scalar_Ptr scalar_hdl, const char * bounds_name, int bounds_name_size) 
     72  { 
     73    std::string bounds_name_str; 
     74    if (!cstr2string(bounds_name, bounds_name_size, bounds_name_str)) return; 
     75    CTimer::get("XIOS").resume(); 
     76    scalar_hdl->bounds_name.setValue(bounds_name_str); 
     77    CTimer::get("XIOS").suspend(); 
     78  } 
     79 
     80  void cxios_get_scalar_bounds_name(scalar_Ptr scalar_hdl, char * bounds_name, int bounds_name_size) 
     81  { 
     82    CTimer::get("XIOS").resume(); 
     83    if (!string_copy(scalar_hdl->bounds_name.getInheritedValue(), bounds_name, bounds_name_size)) 
     84      ERROR("void cxios_get_scalar_bounds_name(scalar_Ptr scalar_hdl, char * bounds_name, int bounds_name_size)", << "Input string is too short"); 
     85    CTimer::get("XIOS").suspend(); 
     86  } 
     87 
     88  bool cxios_is_defined_scalar_bounds_name(scalar_Ptr scalar_hdl) 
     89  { 
     90     CTimer::get("XIOS").resume(); 
     91     bool isDefined = scalar_hdl->bounds_name.hasInheritedValue(); 
     92     CTimer::get("XIOS").suspend(); 
     93     return isDefined; 
     94  } 
     95 
     96 
     97  void cxios_set_scalar_comment(scalar_Ptr scalar_hdl, const char * comment, int comment_size) 
     98  { 
     99    std::string comment_str; 
     100    if (!cstr2string(comment, comment_size, comment_str)) return; 
     101    CTimer::get("XIOS").resume(); 
     102    scalar_hdl->comment.setValue(comment_str); 
     103    CTimer::get("XIOS").suspend(); 
     104  } 
     105 
     106  void cxios_get_scalar_comment(scalar_Ptr scalar_hdl, char * comment, int comment_size) 
     107  { 
     108    CTimer::get("XIOS").resume(); 
     109    if (!string_copy(scalar_hdl->comment.getInheritedValue(), comment, comment_size)) 
     110      ERROR("void cxios_get_scalar_comment(scalar_Ptr scalar_hdl, char * comment, int comment_size)", << "Input string is too short"); 
     111    CTimer::get("XIOS").suspend(); 
     112  } 
     113 
     114  bool cxios_is_defined_scalar_comment(scalar_Ptr scalar_hdl) 
     115  { 
     116     CTimer::get("XIOS").resume(); 
     117     bool isDefined = scalar_hdl->comment.hasInheritedValue(); 
     118     CTimer::get("XIOS").suspend(); 
     119     return isDefined; 
     120  } 
     121 
     122 
     123  void cxios_set_scalar_label(scalar_Ptr scalar_hdl, const char * label, int label_size) 
     124  { 
     125    std::string label_str; 
     126    if (!cstr2string(label, label_size, label_str)) return; 
     127    CTimer::get("XIOS").resume(); 
     128    scalar_hdl->label.setValue(label_str); 
     129    CTimer::get("XIOS").suspend(); 
     130  } 
     131 
     132  void cxios_get_scalar_label(scalar_Ptr scalar_hdl, char * label, int label_size) 
     133  { 
     134    CTimer::get("XIOS").resume(); 
     135    if (!string_copy(scalar_hdl->label.getInheritedValue(), label, label_size)) 
     136      ERROR("void cxios_get_scalar_label(scalar_Ptr scalar_hdl, char * label, int label_size)", << "Input string is too short"); 
     137    CTimer::get("XIOS").suspend(); 
     138  } 
     139 
     140  bool cxios_is_defined_scalar_label(scalar_Ptr scalar_hdl) 
     141  { 
     142     CTimer::get("XIOS").resume(); 
     143     bool isDefined = scalar_hdl->label.hasInheritedValue(); 
     144     CTimer::get("XIOS").suspend(); 
     145     return isDefined; 
     146  } 
     147 
     148 
    20149  void cxios_set_scalar_long_name(scalar_Ptr scalar_hdl, const char * long_name, int long_name_size) 
    21150  { 
     
    70199 
    71200 
     201  void cxios_set_scalar_positive(scalar_Ptr scalar_hdl, const char * positive, int positive_size) 
     202  { 
     203    std::string positive_str; 
     204    if (!cstr2string(positive, positive_size, positive_str)) return; 
     205    CTimer::get("XIOS").resume(); 
     206    scalar_hdl->positive.fromString(positive_str); 
     207    CTimer::get("XIOS").suspend(); 
     208  } 
     209 
     210  void cxios_get_scalar_positive(scalar_Ptr scalar_hdl, char * positive, int positive_size) 
     211  { 
     212    CTimer::get("XIOS").resume(); 
     213    if (!string_copy(scalar_hdl->positive.getInheritedStringValue(), positive, positive_size)) 
     214      ERROR("void cxios_get_scalar_positive(scalar_Ptr scalar_hdl, char * positive, int positive_size)", << "Input string is too short"); 
     215    CTimer::get("XIOS").suspend(); 
     216  } 
     217 
     218  bool cxios_is_defined_scalar_positive(scalar_Ptr scalar_hdl) 
     219  { 
     220     CTimer::get("XIOS").resume(); 
     221     bool isDefined = scalar_hdl->positive.hasInheritedValue(); 
     222     CTimer::get("XIOS").suspend(); 
     223     return isDefined; 
     224  } 
     225 
     226 
    72227  void cxios_set_scalar_prec(scalar_Ptr scalar_hdl, int prec) 
    73228  { 
Note: See TracChangeset for help on using the changeset viewer.