Chaste Commit::9dfedaa0870fc7cfa8911a7ba21eba441bdba6b4
AbstractUntemplatedParameterisedSystem.cpp
1/*
2
3Copyright (c) 2005-2026, University of Oxford.
4All rights reserved.
5
6University of Oxford means the Chancellor, Masters and Scholars of the
7University of Oxford, having an administrative office at Wellington
8Square, Oxford OX1 2JD, UK.
9
10This file is part of Chaste.
11
12Redistribution and use in source and binary forms, with or without
13modification, are permitted provided that the following conditions are met:
14 * Redistributions of source code must retain the above copyright notice,
15 this list of conditions and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19 * Neither the name of the University of Oxford nor the names of its
20 contributors may be used to endorse or promote products derived from this
21 software without specific prior written permission.
22
23THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34*/
35
36#include "AbstractUntemplatedParameterisedSystem.hpp"
37
38
39#include "Exception.hpp"
41
42
44 : mNumberOfStateVariables(numberOfStateVariables)
45{
47 {
48 EXCEPTION("A system of equations must have some unknowns/state variables.");
49 }
50}
51
55
56boost::shared_ptr<const AbstractOdeSystemInformation> AbstractUntemplatedParameterisedSystem::GetSystemInformation() const
57{
58 assert(mpSystemInfo);
59 return mpSystemInfo;
60}
61
62
64{
65 return GetSystemInformation()->GetSystemName();
66}
67
68//
69// State variable methods
70//
71
76
78{
79 return GetSystemInformation()->rGetStateVariableNames();
80}
81
83{
84 return GetSystemInformation()->rGetStateVariableUnits();
85}
86
88{
89 return GetSystemInformation()->GetStateVariableIndex(rName);
90}
91
93{
94 return GetSystemInformation()->HasStateVariable(rName);
95}
96
98{
99 return GetSystemInformation()->GetStateVariableUnits(index);
100}
101
102//
103// Parameter methods
104//
105
107{
108 return GetSystemInformation()->rGetParameterNames().size();
109}
110
112{
113 return GetSystemInformation()->rGetParameterNames();
114}
115
117{
118 return GetSystemInformation()->rGetParameterUnits();
119}
120
121unsigned AbstractUntemplatedParameterisedSystem::GetParameterIndex(const std::string& rName) const
122{
123 return GetSystemInformation()->GetParameterIndex(rName);
124}
125
127{
128 return GetSystemInformation()->HasParameter(rName);
129}
130
132{
133 return GetSystemInformation()->GetParameterUnits(index);
134}
135
136//
137// "Any variable" methods
138//
139
141{
142 return GetSystemInformation()->GetAnyVariableIndex(rName);
143}
144
146{
147 return GetSystemInformation()->HasAnyVariable(rName);
148}
149
151{
152 return GetSystemInformation()->GetAnyVariableUnits(index);
153}
154
155std::string AbstractUntemplatedParameterisedSystem::GetAnyVariableUnits(const std::string& rName) const
156{
158}
159
160//
161// "Derived quantities" methods
162//
163
165{
166 return GetSystemInformation()->rGetDerivedQuantityNames().size();
167}
168
170{
171 return GetSystemInformation()->rGetDerivedQuantityNames();
172}
173
175{
176 return GetSystemInformation()->rGetDerivedQuantityUnits();
177}
178
180{
181 return GetSystemInformation()->GetDerivedQuantityIndex(rName);
182}
183
185{
186 return GetSystemInformation()->HasDerivedQuantity(rName);
187}
188
190{
191 return GetSystemInformation()->GetDerivedQuantityUnits(index);
192}
193
194
196{
197 return GetSystemInformation()->GetNumberOfAttributes();
198}
199
201{
202 return GetSystemInformation()->HasAttribute(rName);
203}
204
205double AbstractUntemplatedParameterisedSystem::GetAttribute(const std::string& rName) const
206{
207 return GetSystemInformation()->GetAttribute(rName);
208}
#define EXCEPTION(message)
const std::vector< std::string > & rGetDerivedQuantityNames() const
const std::vector< std::string > & rGetParameterNames() const
boost::shared_ptr< const AbstractOdeSystemInformation > GetSystemInformation() const
boost::shared_ptr< AbstractOdeSystemInformation > mpSystemInfo
unsigned GetDerivedQuantityIndex(const std::string &rName) const
const std::vector< std::string > & rGetStateVariableNames() const
unsigned GetStateVariableIndex(const std::string &rName) const
const std::vector< std::string > & rGetStateVariableUnits() const
unsigned GetAnyVariableIndex(const std::string &rName) const
unsigned GetParameterIndex(const std::string &rName) const
const std::vector< std::string > & rGetDerivedQuantityUnits() const
AbstractUntemplatedParameterisedSystem(unsigned numberOfStateVariables)
const std::vector< std::string > & rGetParameterUnits() const