/[ascend]/trunk/pygtk/interface/incidencematrix.cpp
ViewVC logotype

Diff of /trunk/pygtk/interface/incidencematrix.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 253 by johnpye, Mon Jan 30 09:35:34 2006 UTC revision 254 by johnpye, Thu Feb 2 06:27:17 2006 UTC
# Line 124  IncidenceMatrix::getIncidenceData(){ Line 124  IncidenceMatrix::getIncidenceData(){
124  const Variable  const Variable
125  IncidenceMatrix::getVariable(const int &col) const{  IncidenceMatrix::getVariable(const int &col) const{
126      if(!is_built)throw runtime_error("Not built");      if(!is_built)throw runtime_error("Not built");
127      if(col < 0 || col >= getNumCols())throw runtime_error("Column out of range");      if(col < 0 || col >= getNumCols())throw range_error("Column out of range");
128      int vindex = i.pc2v[col];      int vindex = i.pc2v[col];
129      struct var_variable *var = i.vlist[vindex];      struct var_variable *var = i.vlist[vindex];
130    
# Line 134  IncidenceMatrix::getVariable(const int & Line 134  IncidenceMatrix::getVariable(const int &
134  const Relation  const Relation
135  IncidenceMatrix::getRelation(const int &row) const{  IncidenceMatrix::getRelation(const int &row) const{
136      if(!is_built)throw runtime_error("Not built");      if(!is_built)throw runtime_error("Not built");
137      if(row < 0 || row >= getNumRows())throw runtime_error("Row out of range");      if(row < 0 || row >= getNumRows())throw range_error("Row out of range");
138      int rindex = i.pr2e[row];      int rindex = i.pr2e[row];
139      struct rel_relation *rel = i.rlist[rindex];      struct rel_relation *rel = i.rlist[rindex];
140      return Relation(&sim, rel);      return Relation(&sim, rel);
# Line 143  IncidenceMatrix::getRelation(const int & Line 143  IncidenceMatrix::getRelation(const int &
143  const int  const int
144  IncidenceMatrix::getBlockRow(const int &row) const{  IncidenceMatrix::getBlockRow(const int &row) const{
145      if(!is_built)throw runtime_error("Not built");      if(!is_built)throw runtime_error("Not built");
146      if(row < 0 || row >= getNumRows())throw runtime_error("Row out of range");      if(row < 0 || row >= getNumRows())throw range_error("Row out of range");
147      const mtx_block_t *bb = slv_get_solvers_blocks(sim.getSystem());      const mtx_block_t *bb = slv_get_solvers_blocks(sim.getSystem());
148      for(int i=0; i < bb->nblocks; ++i){      for(int i=0; i < bb->nblocks; ++i){
149          if(row >= bb->block[i].row.low && row <= bb->block[i].row.high){          if(row >= bb->block[i].row.low && row <= bb->block[i].row.high){
# Line 153  IncidenceMatrix::getBlockRow(const int & Line 153  IncidenceMatrix::getBlockRow(const int &
153      return -1;      return -1;
154  }  }
155                    
156    const vector<Variable>
157    IncidenceMatrix::getBlockVars(const int &block){
158        if(!is_built){
159            buildPlotData();
160        }
161        const mtx_block_t *bb = slv_get_solvers_blocks(sim.getSystem());
162        if(block < 0 || block >= bb->nblocks)throw range_error("Block out of range");
163        int low = bb->block[block].col.low;
164        int high = bb->block[block].row.high;
165        vector<Variable> v;
166        for(int j=low; j<=high; ++j){
167            v.push_back(getVariable(j));
168        }
169        return v;
170    }
171    
172    

Legend:
Removed from v.253  
changed lines
  Added in v.254

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22