Changeset 313 for XIOS/trunk/src/fortran/icutil.hpp
- Timestamp:
- 02/18/12 22:43:24 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/fortran/icutil.hpp
r274 r313 8 8 9 9 #include <string> 10 10 #include <string.h> 11 11 // ///////////////////////// Définitions/Déclarations /////////////////////// // 12 12 … … 29 29 } 30 30 31 inline bool string_copy(const string& str, char* cstr,int cstr_size) 32 { 33 34 if (str.size()>cstr_size) return false ; 35 else 36 { 37 std::memset (cstr,' ',cstr_size); 38 str.copy(cstr,cstr_size) ; 39 return true ; 40 } 41 } 42 template<class T> 43 inline bool array_copy(ARRAY(T,1) array_in, T* array_out, size_t extent1) 44 { 45 if (array_in->num_elements() != extent1) return false ; 46 std::copy(array_in->data(), array_in->data() + array_in->num_elements(), array_out); 47 return true ; 48 } 49 50 template<class T> 51 inline bool array_copy(ARRAY(T,2) array_in, T* array_out, size_t extent1, size_t extent2) 52 { 53 if (array_in->num_elements() != extent1*extent2) return false ; 54 std::copy(array_in->data(), array_in->data() + array_in->num_elements(), array_out); 55 return true ; 56 } 57 58 template<class T> 59 inline bool array_copy(ARRAY(T,3) array_in, T* array_out, size_t extent1, size_t extent2, size_t extent3) 60 { 61 if (array_in->num_elements() != extent1*extent2*extent3) return false ; 62 std::copy(array_in->data(), array_in->data() + array_in->num_elements(), array_out); 63 return true ; 64 } 65 66 31 67 #endif // __ICUTIL_HPP__
Note: See TracChangeset
for help on using the changeset viewer.