Show
Ignore:
Timestamp:
09/13/09 23:14:24 (15 years ago)
Author:
smidl
Message:

rv returns name of a scalar at prespecified position

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/base/bdmbase.h

    r609 r610  
    181181                return NAMES ( ids ( at ) ); 
    182182        } 
     183        //! returns name of a scalar at position scalat, i.e. it can be in the middle of vector name, in that case it adds "_%d" to it 
     184        std::string scalarname ( int scalat ) const { 
     185                bdm_assert_debug(scalat<dsize,"Wrong input index"); 
     186                int id=0; 
     187                int scalid=0; 
     188                while (scalid+SIZES(ids(id))<=scalat)  { scalid+=SIZES(ids(id)); id++;}; 
     189                //now id is the id of variable of interest 
     190                if (size(id)==1) 
     191                        return  NAMES ( ids ( id ) ); 
     192                else 
     193                        return  NAMES ( ids ( id ) )+ "_" + num2str(scalat-scalid); 
     194 
     195        } 
    183196        void set_time ( int at, int time0 ) { 
    184197                times ( at ) = time0;