Ignore:
Timestamp:
05/12/20 11:52:13 (4 years ago)
Author:
ymipsl
Message:

XIOS coupling branch
Some updates.

First coupling test is beginning to work...

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/attribute_array.hpp

    r1622 r1875  
    2121      { 
    2222        public : 
    23  
    24            using CArray<T_numtype,N_rank>::operator = ; 
     23            using CArray<T_numtype,N_rank>::operator = ; 
    2524 
    2625            /// Constructeurs /// 
     
    6564            virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) ; 
    6665            virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ; 
     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        else  
     77        { 
     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#endif 
     85          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           } 
    67107 
    68108         private : 
     
    75115          bool _fromBuffer(CBufferIn& buffer) ; 
    76116      }; // class CAttributeEnum 
     117 
     118 
     119#define macrotyperank(_TYPE_,_RANK_)\ 
     120  template<> int CAttributeArray<_TYPE_,_RANK_>::TV_ttf_display_type(const CAttributeArray<_TYPE_,_RANK_>* array ) \ 
     121  {\ 
     122    return CAttributeArray<_TYPE_,_RANK_>::show_TV_ttf_display_type (array) ;\ 
     123  } 
     124 
     125#define macrotype(_TYPE_)\ 
     126macrotyperank(_TYPE_,1)\ 
     127macrotyperank(_TYPE_,2)\ 
     128macrotyperank(_TYPE_,3)\ 
     129macrotyperank(_TYPE_,4)\ 
     130macrotyperank(_TYPE_,5)\ 
     131macrotyperank(_TYPE_,6)\ 
     132macrotyperank(_TYPE_,7) 
     133 
     134macrotype(double) 
     135macrotype(int) 
     136macrotype(bool) 
     137macrotype(size_t) 
     138macrotype(float) 
     139macrotype(string) 
     140 
     141#undef macrotyperank 
     142#undef macrotype 
    77143} // namespace xios 
    78144 
Note: See TracChangeset for help on using the changeset viewer.