COPASI API  4.16.103
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
CTableauMatrix Class Reference

#include <CTableauMatrix.h>

Collaboration diagram for CTableauMatrix:
Collaboration graph
[legend]

Public Member Functions

void addLine (const CTableauLine *src, const bool &check=true)
 
std::list< const CTableauLine * >
::iterator 
begin ()
 
std::list< const CTableauLine * >
::const_iterator 
begin () const
 
 CTableauMatrix ()
 
 CTableauMatrix (const std::vector< std::vector< double > > &stoi, const size_t &reversibleNumber)
 
std::list< const CTableauLine * >
::iterator 
end ()
 
std::list< const CTableauLine * >
::const_iterator 
end () const
 
void removeLine (const std::list< const CTableauLine * >::iterator line)
 
size_t size () const
 
 ~CTableauMatrix ()
 

Private Member Functions

bool isValid (const CTableauLine *src)
 

Private Attributes

std::list< const CTableauLine * >
::iterator 
mFirstIrreversible
 
std::list< const CTableauLine * > mLine
 

Friends

std::ostream & operator<< (std::ostream &, const CTableauMatrix &)
 

Detailed Description

CTableauMatrix class. Used to calculate elementary flux modes

Created for Copasi by Stefan Hoops 2002-05-08 (C) Stefan Hoops 2002

Definition at line 37 of file CTableauMatrix.h.

Constructor & Destructor Documentation

CTableauMatrix::CTableauMatrix ( )

Default constructor

CTableauMatrix class. Used to calculate elementary flux modes

Created for Copasi by Stefan Hoops 2002-05-08 (C) Stefan Hoops 2002

Definition at line 36 of file CTableauMatrix.cpp.

36  :
37  mLine(),
39 {}
std::list< const CTableauLine * >::iterator mFirstIrreversible
std::list< const CTableauLine * > mLine
CTableauMatrix::CTableauMatrix ( const std::vector< std::vector< double > > &  stoi,
const size_t &  reversibleNumber 
)

Specific constructor The first reversibleNumber lines of stoi must be reversible reactions. Note: stoi is actually the transpose of the stoichiometry matrix

Parameters
conststd::vector < std::vector < double > > & stoi
constsize_t & reversibleNumber
CTableauMatrix::~CTableauMatrix ( )

Destructor

Definition at line 65 of file CTableauMatrix.cpp.

References mLine, and pdelete.

66 {
67  for (std::list< const CTableauLine * >::iterator i = mLine.begin();
68  i != mLine.end(); i++)
69  pdelete(*i);
70 }
#define pdelete(p)
Definition: copasi.h:215
std::list< const CTableauLine * > mLine

Member Function Documentation

void CTableauMatrix::addLine ( const CTableauLine src,
const bool &  check = true 
)

Add a line to the matrix

Parameters
constCTableauLine * src
constbool & check (Default: true)

Definition at line 95 of file CTableauMatrix.cpp.

References CTableauLine::isReversible(), isValid(), mFirstIrreversible, mLine, and pdelete.

Referenced by CEFMAlgorithm::calculateNextTableau().

97 {
98  /* First we check whether we have a valid new flux mode */
99  if (!check || isValid(src))
100  {
101  if (src->isReversible())
102  {
105  }
106  else if (mFirstIrreversible == mLine.end())
107  {
109  }
110  else
111  {
112  mLine.push_back(src);
113  }
114  }
115  else
116  pdelete(src);
117 }
#define pdelete(p)
Definition: copasi.h:215
bool isReversible() const
std::list< const CTableauLine * >::iterator mFirstIrreversible
bool isValid(const CTableauLine *src)
std::list< const CTableauLine * > mLine
std::list< const CTableauLine * >::iterator CTableauMatrix::begin ( )

Retrieves the first line from the matrix

Returns
list< const CTableauLine * >::iterator begin

Definition at line 75 of file CTableauMatrix.cpp.

References mLine.

Referenced by CEFMAlgorithm::buildFluxModes(), CEFMAlgorithm::calculateCombinations(), CEFMAlgorithm::calculateNextTableau(), and CEFMAlgorithm::CSpeciesOrderNode::update().

76 {
77  return mLine.begin();
78 }
std::list< const CTableauLine * > mLine
std::list< const CTableauLine * >::const_iterator CTableauMatrix::begin ( ) const

Retrieves the first line from the matrix

Returns
list< const CTableauLine * >::const_iterator begin

Definition at line 80 of file CTableauMatrix.cpp.

References mLine.

81 {
82  return mLine.begin();
83 }
std::list< const CTableauLine * > mLine
std::list< const CTableauLine * >::iterator CTableauMatrix::end ( )

Retrieves the last line from the matrix

Returns
list< const CTableauLine * >::iterator end

Definition at line 85 of file CTableauMatrix.cpp.

References mLine.

Referenced by CEFMAlgorithm::buildFluxModes(), CEFMAlgorithm::calculateCombinations(), CEFMAlgorithm::calculateNextTableau(), and CEFMAlgorithm::CSpeciesOrderNode::update().

86 {
87  return mLine.end();
88 }
std::list< const CTableauLine * > mLine
std::list< const CTableauLine * >::const_iterator CTableauMatrix::end ( ) const

Retrieves the last line from the matrix

Returns
list< const CTableauLine * >::const_iterator end

Definition at line 90 of file CTableauMatrix.cpp.

References mLine.

91 {
92  return mLine.end();
93 }
std::list< const CTableauLine * > mLine
bool CTableauMatrix::isValid ( const CTableauLine src)
private

Check whether the new line fullfills the constraints

Parameters
const CTableauLine *src

Definition at line 138 of file CTableauMatrix.cpp.

References CTableauLine::getScore(), mLine, and removeLine().

Referenced by addLine().

139 {
140  std::list< const CTableauLine * >::iterator i;
141  std::list< const CTableauLine * >::iterator tmp;
142 
143  /* Check whether we have already better lines */
144  for (i = mLine.begin(); i != mLine.end(); i++)
145  if ((*i)->getScore() < src->getScore())
146  return false;
147 
148  i = mLine.begin();
149 
150  /* Check whether the new line scores better than existing lines */
151 
152  /* If so the existing lines are removed */
153  for (i = mLine.begin(); i != mLine.end();)
154  if (src->getScore() < (*i)->getScore())
155  {
156  if (i == mLine.begin())
157  {
158  removeLine(i);
159  i = mLine.begin();
160  }
161  else
162  {
163  tmp = i;
164  tmp--;
165  removeLine(i);
166  i = tmp;
167  i++;
168  }
169  }
170  else
171  i++;
172 
173  return true;
174 }
const CFluxScore & getScore() const
void removeLine(const std::list< const CTableauLine * >::iterator line)
std::list< const CTableauLine * > mLine
void CTableauMatrix::removeLine ( const std::list< const CTableauLine * >::iterator  line)

Remove the indexed line of the matrix

Parameters
list< const CTableauLine * >::const_iteratorline

Definition at line 119 of file CTableauMatrix.cpp.

References mFirstIrreversible, and mLine.

Referenced by CEFMAlgorithm::calculateNextTableau(), and isValid().

120 {
121  if (line == mFirstIrreversible && mFirstIrreversible == mLine.begin())
122  {
123  mLine.pop_front();
124  mFirstIrreversible = mLine.begin();
125  }
126  else if (line == mFirstIrreversible)
127  {
129  mLine.erase(line);
131  }
132  else
133  {
134  mLine.erase(line);
135  }
136 }
std::list< const CTableauLine * >::iterator mFirstIrreversible
std::list< const CTableauLine * > mLine
size_t CTableauMatrix::size ( ) const

Retrieve the number of tableau lines

Returns
size_t size

Definition at line 72 of file CTableauMatrix.cpp.

References mLine.

Referenced by CEFMAlgorithm::calculateNextTableau().

73 {return mLine.size();}
std::list< const CTableauLine * > mLine

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CTableauMatrix m 
)
friend

Definition at line 176 of file CTableauMatrix.cpp.

177 {
178  os << "Tableau Matrix: Number of Lines = " << m.mLine.size() << std::endl;
179  std::list< const CTableauLine * >::const_iterator i;
180 
181  for (i = m.mLine.begin(); i != m.mLine.end(); i++)
182  {
183  os << (**i);
184  }
185 
186  return os;
187 }
std::list< const CTableauLine * > mLine

Member Data Documentation

std::list< const CTableauLine * >::iterator CTableauMatrix::mFirstIrreversible
private

Iterator pointing to the first irreversible reaction

Definition at line 53 of file CTableauMatrix.h.

Referenced by addLine(), and removeLine().

std::list< const CTableauLine * > CTableauMatrix::mLine
private

Vector containing the lines of the Matrix <{CTableauLine}> 0..*

Definition at line 48 of file CTableauMatrix.h.

Referenced by addLine(), begin(), end(), isValid(), operator<<(), removeLine(), size(), and ~CTableauMatrix().


The documentation for this class was generated from the following files: