Changeset 624

Show
Ignore:
Timestamp:
09/18/09 00:17:02 (15 years ago)
Author:
smidl
Message:

RV accepts size=-1 as 'already existing size'

Location:
library/bdm/base
Files:
2 modified

Legend:

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

    r620 r624  
    4949                NAMES ( id ) = name; 
    5050                SIZES ( id ) = size; 
     51                bdm_assert(size>0, "RV "+ name +" does not exists. Default size (-1) can not be assigned "); 
    5152        } else { 
    5253                id = iter->second; 
    53                 bdm_assert_debug ( SIZES ( id ) == size, "RV " + name + " of different size already exists" ); 
     54                if (size>0){ 
     55                        bdm_assert ( SIZES ( id ) == size, "RV " + name + " of different size already exists" ); 
     56                } 
    5457        } 
    5558        return id; 
  • library/bdm/base/bdmbase.h

    r620 r624  
    273273 
    274274        \code 
    275         rv = { 
    276             class = "RV"; // class name 
    277           // UNIQUE IDENTIFIER same names = same variable 
    278           names = ( "a", "b", "c", ...);   // which will be used e.g. in loggers 
    279  
    280           //optional arguments 
    281           sizes = [1, 2, 3, ...];         // (optional) default = ones() 
    282           times = [-1, -2, 0, ...];       // time shifts with respect to current time (optional) default = zeros() 
    283         } 
     275        class = 'RV';                    
     276        names = {'a', 'b', 'c', ...};   // UNIQUE IDENTIFIER same names = same variable 
     277                                                                        // names are also used when storing results  
     278        --- optional --- 
     279        sizes = [1, 2, 3, ...];         // size of each name. default = ones() 
     280                                                                        // if size = -1, it is found out from previous instances of the same name 
     281        times = [-1, -2, 0, ...];       // time shifts with respect to current time, default = zeros() 
    284282        \endcode 
    285283        */ 
     
    737735                ivec valid_ids = rv.findself_ids ( rv_up ); 
    738736                RV rv_hist = rv.subselect ( find ( valid_ids >= 0 ) ); // select only rvs that are in rv_up 
    739           RV rv_hist0 =rv_hist.remove_time();  // these RVs will form history at time =0 
    740           v2h_up = rv_hist0.dataind(rv_up); // indeces of elements of rv_up to be copied 
    741           // now we need to know what is needed from Up 
     737                RV rv_hist0 =rv_hist.remove_time();  // these RVs will form history at time =0 
     738                // now we need to know what is needed from Up 
    742739                rv_hist = rv_hist.expand_delayes(); // full regressor - including time 0 
    743           Hrv=rv_hist.subt(rv_hist0);   // remove time 0 
     740                Hrv=rv_hist.subt(rv_hist0);   // remove time 0 
    744741                history = zeros ( Hrv._dsize() ); 
    745742 
     743                // decide if we need to copy val to history 
     744                if (Hrv._dsize() >0) { 
     745                        v2h_up = rv_hist0.dataind(rv_up); // indeces of elements of rv_up to be copied 
     746                } // else v2h_up is empty 
     747                 
    746748                Hrv.dataind ( rv, h2v_hist, h2v_down ); 
    747749