-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathChemicalSystem.cpp
More file actions
85 lines (64 loc) · 2.3 KB
/
ChemicalSystem.cpp
File metadata and controls
85 lines (64 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/***************************************************************************//**
* Project: Colony
*
* \file ChemicalSystem.cpp
* \author Marc Weber\n
* The SiMBioSys group (CosmoLab)\n
* Parc Científic de Barcelona\n
* Barcelona, Spain.\n
* http://www.thesimbiosys.com
* \version 1.0
* \date 11/2009
*
* Copyright 2009 by Marc Weber
******************************************************************************/
#include "ChemicalSystem.h"
//------------------------------------------------------------------------------
ChemicalSystem::ChemicalSystem()
: nSpecies_(0),
nChannels_(0),
stoichMatrix_(), //Rem: the Array is 0-initialized, its data cannot be accessed
computePropensitiesPtr_(0),
computePropensitiesTimeDependentPtr_(0)
{}
//------------------------------------------------------------------------------
ChemicalSystem::~ChemicalSystem()
{
stoichMatrix_.free();
}
//------------------------------------------------------------------------------
void ChemicalSystem::initialize(const ChemicalSystemInitParam& p)
{
nSpecies_ = p.nSpecies_;
nChannels_ = p.nChannels_;
stoichMatrix_.resize( p.stoichMatrix_.rows(), p.stoichMatrix_.cols() );
stoichMatrix_ = p.stoichMatrix_;
#ifndef TIME_DEPENDENT_PROPENSITIES
computePropensitiesPtr_ = p.computePropensitiesPtr_;
#else
computePropensitiesTimeDependentPtr_ = p.computePropensitiesTimeDependentPtr_;
#endif // TIME_DEPENDENT_PROPENSITIES
}
//------------------------------------------------------------------------------
void ChemicalSystem::copy(const ChemicalSystem& c2)
{
nSpecies_ = c2.nSpecies_;
nChannels_ = c2.nChannels_;
stoichMatrix_.resize( c2.stoichMatrix_.rows(), c2.stoichMatrix_.cols() );
stoichMatrix_ = c2.stoichMatrix_;
computePropensitiesPtr_ = c2.computePropensitiesPtr_;
computePropensitiesTimeDependentPtr_ = c2.computePropensitiesTimeDependentPtr_;
}
//------------------------------------------------------------------------------
ChemicalSystem& ChemicalSystem::operator = (const ChemicalSystem& c2)
{
// Test for self-assignment
if (&c2 == this)
{
// Do nothing and just return myself.
return *this;
}
copy(c2);
return *this;
}
//------------------------------------------------------------------------------