COPASI API  4.16.103
CSSAMethod.h
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/elementaryFluxModes/CSSAMethod.h,v $
3 // $Revision: 1.2 $
4 // $Name: $
5 // $Author: tjohann $
6 // $Date: 2008/07/02 08:51:35 $
7 // End CVS Header
8 
9 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
11 // and The University of Manchester.
12 // All rights reserved.
13 
14 #ifndef COPASI_SSAMethod
15 #define COPASI_SSAMethod
16 
17 #include <string>
18 
20 //#include "utilities/CMatrix.h"
21 
24 
25 class CSSAProblem;
26 class CFluxMode;
27 
28 class CSSAMethod : public CEFMAlgorithm
29  {
31 
32  public:
33  CSSAMethod(const CSSAMethod & src,
34  const CCopasiContainer * pParent = NULL);
35 
36  CSSAMethod(const CCopasiContainer * pParent = NULL);
37 
38  bool process(CProcessReport * handler);
39 
40  bool calculate();
41 
42  bool initialize();
43 
44  bool isReactionReversed(int index) const;
45 
46  TriLogic isMixingStable(int indexEC);
47 
48  protected:
49 
50  // attributes
51 
52  //
54 
55  // the Stoichiometric Matrix in which we will have only irreversible reactions
57 
58  // representation of mStoichiometry in vector<vector<>> form for the CEFMAlgorithm:
59  std::vector< std::vector<C_FLOAT64> > mStoiRows;
60 
61  // bitfield telling which of the reactions are duplicated from a reversible reaction
62  std::vector< bool > mIsBackwardReaction;
63 
64  // number of all reactions, including reversible -> size of mIsBackwardReaction.
66 
67  // the rate constants corresponding to the reactions represented by the columns of mStoichiometry:
68  // std::vector< std::string > mRateConstants;
69 
71 
72  std::vector< CMatrix<C_FLOAT64> > mTransformedSubJacobians;
73 
74  std::vector< CVector<C_FLOAT64> > mExtremeCurrents;
75 
76  // vector holding the index of non-mixing stable ECs in mExtremeCurrents:
77  // using TriUnspecified for unknown stability type if EC contains complex
78  // kinetics.
79  std::vector< TriLogic > mIsMixingStable;
80 
81  // gets the reactions to be duplicated in the matrix rows/columns
82  //void buildBackwardReactionVector();
83 
84  // retrieves the jacobian from input:
85  bool buildJacobian();
86  // retrieves mExtremeFluxes via (positive) elementary modes:
87  bool buildExtremeCurrents();
88  // retrieves and expands the mStoichiometry:
89  bool buildStoichiometry();
90 
91  // retrieves mTransposedKineticMatrix:
92  bool buildKineticMatrix();
93 
94  // decompose jacobian in reaction coordinates
95  bool decomposeJacobian();
96 
97  // test if there is a non-mixing stable EC
98  // return true if all ECs are mixing stable,
99  // false otherwise.
100  bool testForMixingStability();
101 
102  // build diagonal square matrices from vectors:
103  template <class CType> CMatrix<CType> diag(CVector<CType> vector)
104  {
105  CMatrix<CType> matrix;
106 
107  matrix.resize(vector.size(), vector.size());
108  memset(matrix.array(), 0, matrix.size()*sizeof(CType));
109 
110  for (unsigned int i = 0; i < vector.size(); ++i)
111  matrix(i, i) = vector[i];
112 
113  return matrix;
114  }
115  };
116 
117 #endif // COPASI_CSSAMethod
bool process(CProcessReport *handler)
Definition: CSSAMethod.cpp:146
bool buildJacobian()
std::vector< bool > mIsBackwardReaction
Definition: CSSAMethod.h:62
static CEFMMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::EFMAlgorithm)
Definition: CEFMMethod.cpp:47
bool decomposeJacobian()
Definition: CSSAMethod.cpp:313
std::vector< TriLogic > mIsMixingStable
Definition: CSSAMethod.h:79
bool isReactionReversed(int index) const
Definition: CSSAMethod.cpp:199
TriLogic
Definition: copasi.h:125
std::vector< std::vector< C_FLOAT64 > > mStoiRows
Definition: CSSAMethod.h:59
#define C_INT32
Definition: copasi.h:90
std::vector< CVector< C_FLOAT64 > > mExtremeCurrents
Definition: CSSAMethod.h:74
bool testForMixingStability()
Definition: CSSAMethod.cpp:203
CMatrix< C_FLOAT64 > mTransposedKineticMatrix
Definition: CSSAMethod.h:70
bool buildKineticMatrix()
Definition: CSSAMethod.cpp:379
TriLogic isMixingStable(int indexEC)
Definition: CSSAMethod.cpp:195
bool calculate()
Definition: CSSAMethod.cpp:152
bool initialize()
Definition: CSSAMethod.cpp:46
bool buildExtremeCurrents()
Definition: CSSAMethod.cpp:418
CCopasiVectorNS< CReaction > mReactions
Definition: CSSAMethod.h:53
virtual void resize(size_t rows, size_t cols, const bool &copy=false)
Definition: CMatrix.h:151
std::vector< CMatrix< C_FLOAT64 > > mTransformedSubJacobians
Definition: CSSAMethod.h:72
bool buildStoichiometry()
Definition: CSSAMethod.cpp:358
CMatrix< CType > diag(CVector< CType > vector)
Definition: CSSAMethod.h:103
size_t size() const
Definition: CVector.h:100
Header file of class CArrayAnnotation.
CMatrix< C_FLOAT64 > mStoichiometry
Definition: CSSAMethod.h:56
virtual size_t size() const
Definition: CMatrix.h:132
C_INT32 mNumReactions
Definition: CSSAMethod.h:65
CSSAMethod(const CSSAMethod &src, const CCopasiContainer *pParent=NULL)
Definition: CSSAMethod.cpp:35
virtual CType * array()
Definition: CMatrix.h:337