COPASI API  4.16.103
CFluxMode.cpp
Go to the documentation of this file.
1 /* Begin CVS Header
2  $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/elementaryFluxModes/CFluxMode.cpp,v $
3  $Revision: 1.17 $
4  $Name: $
5  $Author: shoops $
6  $Date: 2011/03/07 19:27:36 $
7  End CVS Header */
8 
9 // Copyright (C) 2011 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
20 // Properties, Inc. and EML Research, gGmbH.
21 // All rights reserved.
22 
23 /**
24  * CFluxMode class.
25  * Used to return the flux modes in human readable form
26  *
27  * Created for Copasi by Stefan Hoops 2002-05-10
28  * (C) Stefan Hoops 2002
29  */
30 
31 #include "copasi.h"
32 #include "CFluxMode.h"
33 #include "CTableauLine.h"
34 #include "model/CModel.h"
35 //#include "model/CChemEqInterface.h"
36 
38 
40  mReactions(src.mReactions),
41  mReversible(src.mReversible)
42 {}
43 
44 CFluxMode::CFluxMode(const std::map< size_t, C_FLOAT64 > & reactions,
45  const bool & reversible) :
46  mReactions(reactions),
47  mReversible(reversible)
48 {}
49 
51 {
52  const std::vector< C_FLOAT64 > & FluxMode = line->getFluxMode();
53  size_t i, imax = FluxMode.size();
54 
55  std::pair< size_t, C_FLOAT64 > Entry;
56 
57  for (i = 0; i < imax; i++)
58  if (FluxMode[i])
59  {
60  mReactions[i] = FluxMode[i];
61  }
62 
63  mReversible = line->isReversible();
64 }
65 
67 {}
68 
70 {
71  return mReactions.begin();
72 }
73 
75 {
76  return mReactions.end();
77 }
78 
80 {
81  return mReversible;
82 }
83 
84 size_t CFluxMode::size() const
85 {
86  return mReactions.size();
87 }
88 
90 {
91  if (mode.size() != mReactions.size())
92  {
93  return false;
94  }
95 
96  const_iterator itThis = mReactions.begin();
97  const_iterator endThis = mReactions.end();
98  const_iterator itMode = mode.mReactions.begin();
99 
100  for (; itThis != endThis; ++itThis, ++itMode)
101  {
102  if (itThis->first != itMode->first)
103  {
104  return false;
105  }
106  }
107 
108  return true;
109 }
110 
111 C_FLOAT64 CFluxMode::getMultiplier(const size_t & index) const
112 {
113  const_iterator it = mReactions.find(index);
114 
115  if (it != mReactions.end())
116  return it->second;
117 
118  return 0.0;
119 }
bool mReversible
Definition: CFluxMode.h:56
const std::vector< C_FLOAT64 > & getFluxMode() const
size_t size() const
Definition: CFluxMode.cpp:84
C_FLOAT64 getMultiplier(const size_t &index) const
Definition: CFluxMode.cpp:111
bool isReversed(const CFluxMode &mode)
Definition: CFluxMode.cpp:89
bool isReversible() const
const_iterator begin() const
Definition: CFluxMode.cpp:69
#define C_FLOAT64
Definition: copasi.h:92
std::map< size_t, C_FLOAT64 >::const_iterator const_iterator
Definition: CFluxMode.h:43
std::map< size_t, C_FLOAT64 > mReactions
Definition: CFluxMode.h:51
bool isReversible() const
Definition: CFluxMode.cpp:79
const_iterator end() const
Definition: CFluxMode.cpp:74
#define CONSTRUCTOR_TRACE
Definition: copasi.h:202