Changeset 424 for library/bdm

Show
Ignore:
Timestamp:
07/22/09 10:07:52 (15 years ago)
Author:
vbarta
Message:

moved datalink tests to testsuite, added default initialization to datalink classes

Files:
1 modified

Legend:

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

    r422 r424  
    461461  //! Remember how long val should be 
    462462  int downsize; 
     463 
    463464  //! Remember how long val of "Up" should be 
    464465  int upsize; 
    465   //! val-to-val link, indeces of the upper val 
     466 
     467  //! val-to-val link, indices of the upper val 
    466468  ivec v2v_up; 
     469 
    467470public: 
    468471  //! Constructor 
    469   datalink() {}; 
    470   datalink(const RV &rv, const RV &rv_up) {set_connection(rv, rv_up);}; 
     472  datalink():downsize(0), upsize(0) { } 
     473  datalink(const RV &rv, const RV &rv_up) { set_connection(rv, rv_up); } 
     474 
    471475  //! set connection, rv must be fully present in rv_up 
    472476  void set_connection(const RV &rv, const RV &rv_up) { 
    473477    downsize = rv._dsize(); 
    474478    upsize = rv_up._dsize(); 
    475     v2v_up = (rv.dataind(rv_up)); 
     479    v2v_up = rv.dataind(rv_up); 
    476480 
    477481    it_assert_debug(v2v_up.length() == downsize, "rv is not fully in rv_up"); 
    478482  } 
    479   //! set connection using indeces 
     483 
     484  //! set connection using indices 
    480485  void set_connection(int ds, int us, const ivec &upind) { 
    481486    downsize = ds; 
     
    485490    it_assert_debug(v2v_up.length() == downsize, "rv is not fully in rv_up"); 
    486491  } 
     492 
    487493  //! Get val for myself from val of "Up" 
    488494  vec pushdown(const vec &val_up) { 
     
    490496    return get_vec(val_up, v2v_up); 
    491497  } 
     498 
    492499  //! Fill val of "Up" by my pieces 
    493500  void pushup(vec &val_up, const vec &val) { 
     
    498505}; 
    499506 
    500 //! data link between 
     507//! Data link with a condition. 
    501508class datalink_m2e: public datalink 
    502509{ 
     
    504511  //! Remember how long cond should be 
    505512  int condsize; 
    506   //!upper_val-to-local_cond link, indeces of the upper val 
     513 
     514  //!upper_val-to-local_cond link, indices of the upper val 
    507515  ivec v2c_up; 
    508   //!upper_val-to-local_cond link, ideces of the local cond 
     516 
     517  //!upper_val-to-local_cond link, indices of the local cond 
    509518  ivec v2c_lo; 
    510519 
    511520public: 
    512   datalink_m2e() {}; 
    513521  //! Constructor 
    514   void set_connection(const RV &rv,  const RV &rvc, const RV &rv_up) { 
     522  datalink_m2e():condsize(0) { } 
     523 
     524  void set_connection(const RV &rv, const RV &rvc, const RV &rv_up) { 
    515525    datalink::set_connection(rv, rv_up); 
    516     condsize =  rvc._dsize(); 
     526    condsize = rvc._dsize(); 
    517527    //establish v2c connection 
    518528    rvc.dataind(rv_up, v2c_lo, v2c_up); 
    519529  } 
     530 
    520531  //!Construct condition 
    521532  vec get_cond(const vec &val_up) { 
     
    524535    return tmp; 
    525536  } 
     537 
    526538  void pushup_cond(vec &val_up, const vec &val, const vec &cond) { 
    527539    it_assert_debug(downsize == val.length(), "Wrong val"); 
     
    531543  } 
    532544}; 
     545 
    533546//!DataLink is a connection between mpdf and its superordinate (Up) 
    534547//! This class links 
     
    536549{ 
    537550protected: 
    538   //!cond-to-cond link, indeces of the upper cond 
     551  //!cond-to-cond link, indices of the upper cond 
    539552  ivec c2c_up; 
    540   //!cond-to-cond link, indeces of the local cond 
     553  //!cond-to-cond link, indices of the local cond 
    541554  ivec c2c_lo; 
     555 
    542556public: 
    543557  //! Constructor 
     
    549563    it_assert_debug(c2c_lo.length() + v2c_lo.length() == condsize, "cond is not fully given"); 
    550564  } 
     565 
    551566  //! Get cond for myself from val and cond of "Up" 
    552567  vec get_cond(const vec &val_up, const vec &cond_up) {