- Timestamp:
- 03/30/21 17:11:36 (3 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/array_new.cpp
r2118 r2120 4 4 { 5 5 6 #define macrotyperank(_TYPE_,_RANK_)\7 template<> int CArray<_TYPE_,_RANK_>::TV_ttf_display_type( const CArray<_TYPE_,_RANK_>* array ) \8 {\9 return show_TV_ttf_display_type (array) ;\10 }11 12 #define macrotype(_TYPE_)\13 macrotyperank(_TYPE_,1)\14 macrotyperank(_TYPE_,2)\15 macrotyperank(_TYPE_,3)\16 macrotyperank(_TYPE_,4)\17 macrotyperank(_TYPE_,5)\18 macrotyperank(_TYPE_,6)\19 macrotyperank(_TYPE_,7)20 21 macrotype(double)22 macrotype(int)23 macrotype(bool)24 macrotype(size_t)25 macrotype(float)26 macrotype(string)27 28 #undef macrotyperank29 #undef macrotype30 6 31 7 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/array_new.hpp
r2118 r2120 7 7 #include "buffer_out.hpp" 8 8 #include "message.hpp" 9 #include "tv_data_display.h"10 #ifdef __GNUC__11 #include <typeinfo>12 #include <cxxabi.h>13 #endif14 9 #include <cmath> 15 10 … … 22 17 class CArray ; 23 18 24 template <typename T_numtype,int N_rank>25 int TV_ttf_display_type ( const CArray<T_numtype, N_rank>* array ) ;26 19 } 27 28 template <typename T_numtype,int N_rank>29 int TV_ttf_display_type ( const xios::CArray<T_numtype, N_rank>* array ) ;30 20 31 21 namespace xios … … 36 26 private: 37 27 bool initialized; 38 void inc_symbol(void) 39 { 40 TV_ttf_display_type(this); 41 } 28 42 29 public: 43 30 typedef typename Array<T_numtype,N_rank>::T_default_storage T_default_storage; … … 46 33 template<typename T_expr> explicit CArray(_bz_ArrayExpr<T_expr> expr) 47 34 : Array<T_numtype,N_rank>(expr) 48 , initialized(true) 49 { bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol(); } 35 , initialized(true) { } 50 36 51 37 CArray(GeneralArrayStorage<N_rank> storage = T_default_storage()) 52 38 : Array<T_numtype,N_rank>(storage) 53 , initialized(false) 54 { bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 39 , initialized(false) { } 55 40 56 41 explicit CArray(int length0, GeneralArrayStorage<N_rank> storage = T_default_storage()) 57 42 : Array<T_numtype,N_rank>(length0, storage) 58 , initialized(true) 59 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 43 , initialized(true) { } 60 44 61 45 CArray(int length0, int length1, GeneralArrayStorage<N_rank> storage = T_default_storage()) 62 46 : Array<T_numtype,N_rank>(length0, length1, storage) 63 , initialized(true) 64 { bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 47 , initialized(true) { } 65 48 66 49 CArray(int length0, int length1, int length2, GeneralArrayStorage<N_rank> storage = T_default_storage()) 67 50 : Array<T_numtype,N_rank>(length0, length1, length2, storage) 68 , initialized(true) 69 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 51 , initialized(true) { } 70 52 71 53 CArray(int length0, int length1, int length2, int length3, GeneralArrayStorage<N_rank> storage = T_default_storage()) 72 54 : Array<T_numtype,N_rank>(length0, length1, length2, length3, storage) 73 , initialized(true) 74 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 55 , initialized(true) { } 75 56 76 57 CArray(int length0, int length1, int length2, int length3, int length4, GeneralArrayStorage<N_rank> storage = T_default_storage()) 77 58 : Array<T_numtype,N_rank>(length0,length1, length2, length3, length4, storage) 78 , initialized(true) 79 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 59 , initialized(true) { } 80 60 81 61 CArray(int length0, int length1, int length2, int length3, int length4, int length5, GeneralArrayStorage<N_rank> storage = T_default_storage()) 82 62 : Array<T_numtype,N_rank>(length0, length1, length2, length3, length4, length5, storage) 83 , initialized(true) 84 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 63 , initialized(true) { } 85 64 86 65 CArray(int length0, int length1, int length2, int length3, int length4, int length5, int length6, GeneralArrayStorage<N_rank> storage = T_default_storage()) 87 66 : Array<T_numtype,N_rank>(length0, length1, length2, length3, length4, length5, length6, storage) 88 , initialized(true) 89 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 67 , initialized(true) { } 90 68 91 69 CArray(int length0, int length1, int length2, int length3, int length4, int length5, int length6, int length7, 92 70 GeneralArrayStorage<N_rank> storage = T_default_storage()) 93 71 : Array<T_numtype,N_rank>(length0, length1, length2, length3, length4, length5, length6, length7, storage) 94 , initialized(true) 95 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 72 , initialized(true) { } 96 73 97 74 CArray(int length0, int length1, int length2, int length3, int length4, int length5, int length6, 98 75 int length7, int length8, GeneralArrayStorage<N_rank> storage = T_default_storage()) 99 76 : Array<T_numtype,N_rank>(length0, length1, length2, length3, length4, length5, length6, length7, length8, storage) 100 , initialized(true) 101 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 77 , initialized(true) { } 102 78 103 79 CArray(int length0, int length1, int length2, int length3, int length4, 104 80 int length5, int length6, int length7, int length8, int length9, GeneralArrayStorage<N_rank> storage = T_default_storage()) 105 81 : Array<T_numtype,N_rank>(length0, length1, length2, length3, length4, length5, length6, length7, length8, length9, storage) 106 , initialized(true) 107 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 82 , initialized(true) { } 108 83 109 84 CArray(int length0, int length1, int length2, int length3, int length4, int length5, int length6, 110 85 int length7, int length8, int length9, int length10, GeneralArrayStorage<N_rank> storage = T_default_storage()) 111 86 : Array<T_numtype,N_rank>(length0, length1, length2, length3, length4, length5, length6, length7, length8, length9, length10, storage) 112 , initialized(true) 113 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 87 , initialized(true) { } 114 88 115 89 CArray(T_numtype* restrict dataFirst, TinyVector<int, N_rank> shape, GeneralArrayStorage<N_rank> storage = T_default_storage()) 116 90 : Array<T_numtype,N_rank>(dataFirst, shape, storage) 117 , initialized(true) 118 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 91 , initialized(true) { } 119 92 120 93 CArray(T_numtype* restrict dataFirst, TinyVector<int, N_rank> shape, TinyVector<diffType, N_rank> stride, 121 94 GeneralArrayStorage<N_rank> storage = T_default_storage()) 122 95 : Array<T_numtype,N_rank>(dataFirst, shape, stride, storage) 123 , initialized(true) 124 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 96 , initialized(true) { } 125 97 126 98 CArray(T_numtype* restrict dataFirst, TinyVector<int, N_rank> shape, preexistingMemoryPolicy deletionPolicy, 127 99 GeneralArrayStorage<N_rank> storage = T_default_storage()) 128 100 : Array<T_numtype,N_rank>(dataFirst, shape, deletionPolicy, storage) 129 , initialized(true) 130 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 101 , initialized(true) { } 131 102 132 103 CArray(T_numtype* restrict dataFirst, TinyVector<int, N_rank> shape, TinyVector<diffType, N_rank> stride, 133 104 preexistingMemoryPolicy deletionPolicy, GeneralArrayStorage<N_rank> storage = T_default_storage()) 134 105 : Array<T_numtype,N_rank>(dataFirst, shape, stride, deletionPolicy, storage) 135 , initialized(true) 136 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 106 , initialized(true) { } 137 107 138 108 CArray(const TinyVector<int, N_rank>& extent, GeneralArrayStorage<N_rank> storage = T_default_storage()) 139 109 : Array<T_numtype,N_rank>(extent, storage) 140 , initialized(true) 141 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 110 , initialized(true) { } 142 111 143 112 CArray(const TinyVector<int, N_rank>& lbounds, const TinyVector<int, N_rank>& extent, 144 113 const GeneralArrayStorage<N_rank>& storage) 145 114 : Array<T_numtype,N_rank>(lbounds, extent, storage) 146 , initialized(true) 147 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 115 , initialized(true) { } 148 116 149 117 CArray(Range r0, GeneralArrayStorage<N_rank> storage = T_default_storage()) 150 118 : Array<T_numtype,N_rank>(r0, storage) 151 , initialized(true) 152 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 119 , initialized(true) { } 153 120 154 121 CArray(Range r0, Range r1, GeneralArrayStorage<N_rank> storage = T_default_storage()) 155 122 : Array<T_numtype,N_rank>(r0, r1, storage) 156 , initialized(true) 157 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 123 , initialized(true) { } 158 124 159 125 CArray(Range r0, Range r1, Range r2, GeneralArrayStorage<N_rank> storage = T_default_storage()) 160 126 : Array<T_numtype,N_rank>(r0, r1, r2, storage) 161 , initialized(true) 162 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 127 , initialized(true) { } 163 128 164 129 CArray(Range r0, Range r1, Range r2, Range r3, GeneralArrayStorage<N_rank> storage = T_default_storage()) 165 130 : Array<T_numtype,N_rank>(r0, r1, r2, r3, storage) 166 , initialized(true) 167 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 131 , initialized(true) { } 168 132 169 133 CArray(Range r0, Range r1, Range r2, Range r3, Range r4, GeneralArrayStorage<N_rank> storage = T_default_storage()) 170 134 : Array<T_numtype,N_rank>(r0, r1, r2, r3, r4, storage) 171 , initialized(true) 172 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 135 , initialized(true) { } 173 136 174 137 CArray(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, GeneralArrayStorage<N_rank> storage = T_default_storage()) 175 138 : Array<T_numtype,N_rank>(r0, r1, r2, r3, r4, r5, storage) 176 , initialized(true) 177 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 139 , initialized(true) { } 178 140 179 141 CArray(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, 180 142 GeneralArrayStorage<N_rank> storage = T_default_storage()) 181 143 : Array<T_numtype,N_rank>(r0, r1, r2, r3, r4, r5, r6, storage) 182 , initialized(true) 183 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 144 , initialized(true) { } 184 145 185 146 CArray(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, 186 147 GeneralArrayStorage<N_rank> storage = T_default_storage()) 187 148 : Array<T_numtype,N_rank>(r0, r1, r2, r3, r4, r5, r6, r7, storage) 188 , initialized(true) 189 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 149 , initialized(true) { } 190 150 191 151 CArray(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, 192 152 Range r6, Range r7, Range r8, GeneralArrayStorage<N_rank> storage = T_default_storage()) 193 153 : Array<T_numtype,N_rank>(r0, r1, r2, r3, r4, r5, r6, r7, r8, storage) 194 , initialized(true) 195 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 154 , initialized(true) { } 196 155 197 156 CArray(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, 198 157 Range r6, Range r7, Range r8, Range r9, GeneralArrayStorage<N_rank> storage = T_default_storage()) 199 158 : Array<T_numtype,N_rank>(r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, storage) 200 , initialized(true) 201 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 159 , initialized(true) { } 202 160 203 161 CArray(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, 204 162 Range r8, Range r9, Range r10, GeneralArrayStorage<N_rank> storage = T_default_storage()) 205 163 : Array<T_numtype,N_rank>(r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, storage) 206 , initialized(true) 207 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 164 , initialized(true) { } 208 165 209 166 CArray(const CArray<T_numtype, N_rank>& array) 210 167 : Array<T_numtype,N_rank>(array) 211 , initialized(array.initialized) 212 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 168 , initialized(array.initialized) { } 213 169 214 170 CArray(const Array<T_numtype, N_rank>& array) 215 171 : Array<T_numtype,N_rank>(array) 216 , initialized(true) 217 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 172 , initialized(true) { } 218 173 219 174 CArray(const TinyVector<int,N_rank-1>& shape, int lastExtent, const GeneralArrayStorage<N_rank>& storage) 220 175 : Array<T_numtype,N_rank>(shape, lastExtent, storage) 221 , initialized(true) 222 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 176 , initialized(true) { } 223 177 224 178 CArray(Array<T_numtype, N_rank>& array, Range r0) 225 179 : Array<T_numtype,N_rank>(array, r0) 226 , initialized(true) 227 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 180 , initialized(true) { } 228 181 229 182 CArray(Array<T_numtype, N_rank>& array, Range r0, Range r1) 230 183 : Array<T_numtype,N_rank>(array, r0, r1) 231 , initialized(true) 232 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 184 , initialized(true) { } 233 185 234 186 CArray(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2) 235 187 : Array<T_numtype,N_rank>( array, r0, r1, r2) 236 , initialized(true) 237 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 188 , initialized(true) { } 238 189 239 190 CArray(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3) 240 191 : Array<T_numtype,N_rank>(array, r0, r1, r2, r3) 241 , initialized(true) 242 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 192 , initialized(true) { } 243 193 244 194 CArray(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, 245 195 Range r3, Range r4) 246 196 : Array<T_numtype,N_rank>(array, r0, r1, r2, r3, r4) 247 , initialized(true) 248 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 197 , initialized(true) { } 249 198 250 199 CArray(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, 251 200 Range r3, Range r4, Range r5) 252 201 : Array<T_numtype,N_rank>( array, r0, r1, r2, r3, r4, r5) 253 , initialized(true) 254 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 202 , initialized(true) { } 255 203 256 204 CArray(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3, 257 205 Range r4, Range r5, Range r6) 258 206 : Array<T_numtype,N_rank>( array, r0, r1, r2, r3, r4, r5, r6) 259 , initialized(true) 260 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 207 , initialized(true) { } 261 208 262 209 CArray(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3, Range r4, 263 210 Range r5, Range r6, Range r7) 264 211 : Array<T_numtype,N_rank>(array, r0, r1, r2, r3, r4, r5, r6, r7) 265 , initialized(true) 266 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 212 , initialized(true) { } 267 213 268 214 CArray(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, 269 215 Range r6, Range r7, Range r8) 270 216 : Array<T_numtype,N_rank>(array, r0, r1, r2, r3, r4, r5, r6, r7, r8) 271 , initialized(true) 272 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 217 , initialized(true) { } 273 218 274 219 CArray(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, 275 220 Range r6, Range r7, Range r8, Range r9) 276 221 : Array<T_numtype,N_rank>(array, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9) 277 , initialized(true) 278 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 222 , initialized(true) { } 279 223 280 224 CArray(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, 281 225 Range r7, Range r8, Range r9, Range r10) 282 226 : Array<T_numtype,N_rank>(array, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10) 283 , initialized(true) 284 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 227 , initialized(true) { } 285 228 286 229 CArray(Array<T_numtype, N_rank>& array, const RectDomain<N_rank>& subdomain) 287 230 : Array<T_numtype,N_rank>(array, subdomain) 288 , initialized(true) 289 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 231 , initialized(true) { } 290 232 291 233 CArray(Array<T_numtype, N_rank>& array, const StridedDomain<N_rank>& subdomain) 292 234 : Array<T_numtype,N_rank>(array, subdomain) 293 , initialized(true) 294 {bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();} 235 , initialized(true) { } 295 236 296 237 template<int N_rank2, typename R0, typename R1, typename R2, typename R3, typename R4, typename R5, … … 299 240 : Array<T_numtype,N_rank>(array, r0,r1, r2, r3, r4, r5, r6, r7, r8, r9, r10) 300 241 , initialized(true) 301 { bool neverTrue ; neverTrue=false ; if(neverTrue) inc_symbol();}242 { } 302 243 303 244 virtual ~CArray() {} … … 569 510 virtual std::vector<T_numtype> getVector(void) { return vector<T_numtype>(this->dataFirst(),this->dataFirst()+this->numElements()) ;} 570 511 static size_t size(sizeType numElements) { return (N_rank + 1) * sizeof(int) + sizeof(size_t) + numElements * sizeof(T_numtype); } 571 572 static int show_TV_ttf_display_type ( const CArray<T_numtype,N_rank>* array ) 573 { 574 int status ; 575 if (array->isEmpty()) 576 { 577 status = TV_ttf_add_row("State", TV_ttf_type_ascii_string,"(empty)") ; 578 if (status != TV_ttf_ec_ok) return TV_ttf_format_raw ; 579 else return TV_ttf_format_ok_elide ; 580 } 581 else 582 { 583 char tname[128] ; 584 char bname[128] = "value_type" ; 585 #ifdef __GNUC__ 586 size_t size = sizeof(bname) ; 587 abi::__cxa_demangle(typeid(T_numtype).name(), bname, &size, &status) ; 588 if (status !=0) return TV_ttf_format_raw ; 589 #endif 590 int dim = array->dimensions() ; 591 if (dim==1) snprintf (tname, sizeof(tname), "%s[%d]", bname, array->extent(0)); 592 if (dim==2) snprintf (tname, sizeof(tname), "%s[%d][%d]", bname, array->extent(1), array->extent(0)); 593 if (dim==3) snprintf (tname, sizeof(tname), "%s[%d][%d][%d]", bname, array->extent(2), array->extent(1), array->extent(3)); 594 if (dim==4) snprintf (tname, sizeof(tname), "%s[%d][%d][%d][%d]", bname, array->extent(0), array->extent(1), array->extent(2), array->extent(3)); 595 if (dim==5) snprintf (tname, sizeof(tname), "%s[%d][%d][%d][%d][%d]", bname, array->extent(4), array->extent(3), array->extent(2), array->extent(1) 596 ,array->extent(0)); 597 if (dim==6) snprintf (tname, sizeof(tname), "%s[%d][%d][%d][%d][%d][%d]", bname, array->extent(5), array->extent(4), array->extent(3), array->extent(2) 598 ,array->extent(1),array->extent(0)); 599 if (dim==7) snprintf (tname, sizeof(tname), "%s[%d][%d][%d][%d][%d][%d][%d]", bname, array->extent(6), array->extent(5), array->extent(4), array->extent(3) 600 ,array->extent(2),array->extent(1),array->extent(0)); 601 status = TV_ttf_add_row("array_values", tname, array->dataFirst()) ; 602 if (status != TV_ttf_ec_ok) return TV_ttf_format_raw ; 603 else return TV_ttf_format_ok ; 604 } 605 } 606 607 608 static int TV_ttf_display_type ( const CArray<T_numtype,N_rank>* array ) 609 { 610 return show_TV_ttf_display_type (array) ; 611 } 612 512 613 513 virtual CBaseType* clone(void) const { return new CArray(*this); } 614 514 … … 642 542 643 543 }; 644 645 646 #define macrotyperank(_TYPE_,_RANK_)\647 template<> int CArray<_TYPE_,_RANK_>::TV_ttf_display_type( const CArray<_TYPE_,_RANK_>* array );648 649 #define macrotype(_TYPE_)\650 macrotyperank(_TYPE_,1)\651 macrotyperank(_TYPE_,2)\652 macrotyperank(_TYPE_,3)\653 macrotyperank(_TYPE_,4)\654 macrotyperank(_TYPE_,5)\655 macrotyperank(_TYPE_,6)\656 macrotyperank(_TYPE_,7)657 658 macrotype(double)659 macrotype(int)660 macrotype(bool)661 macrotype(size_t)662 macrotype(float)663 macrotype(string)664 665 #undef macrotyperank666 #undef macrotype667 544 668 545 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/attribute_array.hpp
r2118 r2120 65 65 virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ; 66 66 67 static int show_TV_ttf_display_type ( const CAttributeArray<T_numtype,N_rank>* array )68 {69 int status ;70 if (array->isEmpty())71 {72 status = TV_ttf_add_row("State", TV_ttf_type_ascii_string,"(empty)") ;73 if (status != TV_ttf_ec_ok) return TV_ttf_format_raw ;74 else return TV_ttf_format_ok_elide ;75 }76 else77 {78 char tname[128] ;79 char bname[128] = "value_type" ;80 #ifdef __GNUC__81 size_t size = sizeof(bname) ;82 abi::__cxa_demangle(typeid(T_numtype).name(), bname, &size, &status) ;83 if (status !=0) return TV_ttf_format_raw ;84 #endif85 int dim = array->dimensions() ;86 if (dim==1) snprintf (tname, sizeof(tname), "%s[%d]", bname, array->extent(0));87 if (dim==2) snprintf (tname, sizeof(tname), "%s[%d][%d]", bname, array->extent(1), array->extent(0));88 if (dim==3) snprintf (tname, sizeof(tname), "%s[%d][%d][%d]", bname, array->extent(2), array->extent(1), array->extent(3));89 if (dim==4) snprintf (tname, sizeof(tname), "%s[%d][%d][%d][%d]", bname, array->extent(0), array->extent(1), array->extent(2), array->extent(3));90 if (dim==5) snprintf (tname, sizeof(tname), "%s[%d][%d][%d][%d][%d]", bname, array->extent(4), array->extent(3), array->extent(2), array->extent(1)91 ,array->extent(0));92 if (dim==6) snprintf (tname, sizeof(tname), "%s[%d][%d][%d][%d][%d][%d]", bname, array->extent(5), array->extent(4), array->extent(3), array->extent(2)93 ,array->extent(1),array->extent(0));94 if (dim==7) snprintf (tname, sizeof(tname), "%s[%d][%d][%d][%d][%d][%d][%d]", bname, array->extent(6), array->extent(5), array->extent(4), array->extent(3)95 ,array->extent(2),array->extent(1),array->extent(0));96 status = TV_ttf_add_row("array_values", tname, array->dataFirst()) ;97 if (status != TV_ttf_ec_ok) return TV_ttf_format_raw ;98 else return TV_ttf_format_ok ;99 }100 }101 102 103 static int TV_ttf_display_type ( const CAttributeArray<T_numtype,N_rank>* array )104 {105 return CAttributeArray<T_numtype,N_rank>::show_TV_ttf_display_type (array) ;106 }107 108 67 private : 109 68 bool isEqual_(const CAttributeArray& attr); … … 117 76 118 77 119 #define macrotyperank(_TYPE_,_RANK_)\120 template<> int CAttributeArray<_TYPE_,_RANK_>::TV_ttf_display_type(const CAttributeArray<_TYPE_,_RANK_>* array );121 122 #define macrotype(_TYPE_)\123 macrotyperank(_TYPE_,1)\124 macrotyperank(_TYPE_,2)\125 macrotyperank(_TYPE_,3)\126 macrotyperank(_TYPE_,4)\127 macrotyperank(_TYPE_,5)\128 macrotyperank(_TYPE_,6)\129 macrotyperank(_TYPE_,7)130 131 macrotype(double)132 macrotype(int)133 macrotype(bool)134 macrotype(size_t)135 macrotype(float)136 macrotype(string)137 138 #undef macrotyperank139 #undef macrotype140 78 } // namespace xios 141 79 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/attribute_array_decl.cpp
r2118 r2120 20 20 template class CAttributeArray<StdString,2> ; 21 21 22 #define macrotyperank(_TYPE_,_RANK_) \23 template<> int CAttributeArray<_TYPE_,_RANK_>::TV_ttf_display_type(const CAttributeArray<_TYPE_,_RANK_>* array ) \24 {\25 return CAttributeArray<_TYPE_,_RANK_>::show_TV_ttf_display_type (array) ;\26 }27 28 #define macrotype(_TYPE_)\29 macrotyperank(_TYPE_,1)\30 macrotyperank(_TYPE_,2)\31 macrotyperank(_TYPE_,3)\32 macrotyperank(_TYPE_,4)\33 macrotyperank(_TYPE_,5)\34 macrotyperank(_TYPE_,6)\35 macrotyperank(_TYPE_,7)36 37 macrotype(double)38 macrotype(int)39 macrotype(bool)40 macrotype(size_t)41 macrotype(float)42 macrotype(string)43 44 #undef macrotyperank45 #undef macrotype46 47 22 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/attribute_array_impl.hpp
r1875 r2120 14 14 CAttributeArray<T_numtype, N_rank>::CAttributeArray(const StdString & id) 15 15 : CAttribute(id) 16 { bool alwaysFalse ; alwaysFalse=false ; if (alwaysFalse) TV_ttf_display_type(this);}16 { } 17 17 18 18 template <typename T_numtype, int N_rank> … … 20 20 : CAttribute(id) 21 21 { 22 bool alwaysFalse ; alwaysFalse=false ; if (alwaysFalse) TV_ttf_display_type(this);23 22 this->setValue(value); 24 23 } … … 28 27 : CAttribute(id) 29 28 { 30 bool alwaysFalse ; alwaysFalse=false ; if (alwaysFalse) TV_ttf_display_type(this);31 29 umap.insert(umap.end(), std::make_pair(id, this)); 32 30 } … … 37 35 : CAttribute(id) 38 36 { 39 bool alwaysFalse ; alwaysFalse=false ; if (alwaysFalse) TV_ttf_display_type(this);40 37 this->setValue(value); 41 38 umap.insert(umap.end(), std::make_pair(id, this)); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/attribute_template.hpp
r2118 r2120 12 12 #include "buffer_out.hpp" 13 13 #include "type.hpp" 14 #include "tv_data_display.h"15 16 #ifdef __GNUC__17 #include <typeinfo>18 #include <cxxabi.h>19 #endif20 14 21 15 namespace xios … … 97 91 // virtual void generateFortranInterfaceIsDefinedDeclaration(ostream& oss,const string& className) ; 98 92 99 static int show_TV_ttf_display_type ( const CAttributeTemplate<T>* attr)100 {101 int status ;102 if (attr->isEmpty())103 {104 status = TV_ttf_add_row("State", TV_ttf_type_ascii_string,"(empty)") ;105 if (status != TV_ttf_ec_ok) return TV_ttf_format_raw ;106 else return TV_ttf_format_ok_elide ;107 }108 else109 {110 char tname[128] ;111 char bname[128] = "ValueType" ;112 #ifdef __GNUC__113 size_t size = sizeof(bname) ;114 abi::__cxa_demangle(typeid(T).name(), bname, &size, &status) ;115 if (status !=0) return TV_ttf_format_raw ;116 #endif117 snprintf (tname, sizeof(tname), "%s", bname);118 if (typeid(T)==typeid(string))119 status = TV_ttf_add_row("values", TV_ttf_type_ascii_string, ((string*)(attr->ptrValue))->c_str() );120 else status = TV_ttf_add_row("values", tname, attr->ptrValue) ;121 if (status != TV_ttf_ec_ok) return TV_ttf_format_raw ;122 else return TV_ttf_format_ok_elide ;123 }124 }125 126 static int TV_ttf_display_type ( const CAttributeTemplate<T>* attr )127 {128 return show_TV_ttf_display_type (attr) ;129 }130 131 93 132 94 protected : … … 145 107 }; // class CAttribute 146 108 147 #define macrotype(_TYPE_)\148 template<> int CAttributeTemplate<_TYPE_>::TV_ttf_display_type( const CAttributeTemplate<_TYPE_>* attr );149 150 macrotype(double)151 macrotype(int)152 macrotype(bool)153 macrotype(string)154 //macrotype(CDate)155 //macrotype(CDuration)156 #undef macrotype157 109 158 110 template <class T> void FromBinary(StdIStream & is, T & obj); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/attribute_template_decl.cpp
r2118 r2120 13 13 template class CAttributeTemplate<CDuration> ; 14 14 15 #define macrotype(_TYPE_) \16 template<> int CAttributeTemplate<_TYPE_>::TV_ttf_display_type( const CAttributeTemplate<_TYPE_>* attr ) \17 {\18 return show_TV_ttf_display_type (attr) ;\19 }20 21 macrotype(double)22 macrotype(int)23 macrotype(bool)24 macrotype(string)25 //macrotype(CDate)26 //macrotype(CDuration)27 #undef macrotype28 29 15 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/declare_attribute.hpp
r1875 r2120 43 43 using CAttributeArray<T_num, T_rank>::operator = ; \ 44 44 bool alwaysFalse=false;\ 45 name##_attr(void) : CAttributeArray<T_num, T_rank> (#name, *CAttributeMap::Current) { if (alwaysFalse) TV_ttf_display_type(this);} \45 name##_attr(void) : CAttributeArray<T_num, T_rank> (#name, *CAttributeMap::Current) {} \ 46 46 virtual bool doSend() const { return helper(__VA_ARGS__); } \ 47 47 bool helper(bool returnTrue=true) const { return returnTrue; } \ 48 static int TV_ttf_display_type ( const name##_attr* array )\49 {\50 cout<<"TV_ttf_display_type"<<endl ;\51 return CArray<T_num,T_rank>::TV_ttf_display_type((const CArray<T_num,T_rank>*)array) ;\52 }\53 48 virtual ~name##_attr(void) {} \ 54 49 } name;
Note: See TracChangeset
for help on using the changeset viewer.