Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
AbstractParameterisedSystem.hpp
1/*
2
3Copyright (c) 2005-2024, 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#ifndef ABSTRACTPARAMETERISEDSYSTEM_HPP_
37#define ABSTRACTPARAMETERISEDSYSTEM_HPP_
38
39#include <vector>
40#include <string>
41#include <boost/shared_ptr.hpp>
42
43#include "AbstractUntemplatedParameterisedSystem.hpp"
44
45
54template<typename VECTOR>
56{
57friend class TestAbstractCvodeSystem;
58
59private:
67 std::string GetStateMessage(const std::string& rMessage, VECTOR Y);
68
69protected:
72
75
84 std::string DumpState(const std::string& rMessage);
85
95 std::string DumpState(const std::string& rMessage,
96 VECTOR Y);
97
109 std::string DumpState(const std::string& rMessage,
110 VECTOR Y,
111 double time);
112
122 void CheckParametersOnLoad(const std::vector<double>& rParameters,
123 const std::vector<std::string>& rParameterNames);
124
125public:
131 AbstractParameterisedSystem(unsigned numberOfStateVariables);
132
133 //
134 // State variable methods
135 //
136
140 VECTOR& rGetStateVariables();
141
146 VECTOR GetStateVariables();
147
154 void SetStateVariables(const VECTOR& rStateVariables);
155
161 double GetStateVariable(unsigned index) const;
162
168 double GetStateVariable(const std::string& rName) const;
169
176 void SetStateVariable(unsigned index, double newValue);
177
184 void SetStateVariable(const std::string& rName, double newValue);
185
198 virtual void VerifyStateVariables()
199 {}
200
201 //
202 // Initial condition methods
203 //
204
214 void SetDefaultInitialConditions(const VECTOR& rInitialConditions);
215
226 void SetDefaultInitialCondition(unsigned index, double initialCondition);
227
233 VECTOR GetInitialConditions() const;
234
239
240 //
241 // Parameter methods
242 //
243
249 double GetParameter(unsigned index) const;
250
256 double GetParameter(const std::string& rName) const;
257
264 void SetParameter(const std::string& rName, double value);
265
272 void SetParameter(unsigned index, double value);
273
274 //
275 // "Any variable" methods
276 //
277
291 double GetAnyVariable(unsigned index, double time=0.0,
292 VECTOR* pDerivedQuantities=NULL);
293
307 double GetAnyVariable(const std::string& rName, double time=0.0,
308 VECTOR* pDerivedQuantities=NULL);
309
317 void SetAnyVariable(unsigned index, double value);
318
326 void SetAnyVariable(const std::string& rName, double value);
327
328 //
329 // Derived quantity methods
330 //
331
340 virtual VECTOR ComputeDerivedQuantities(double time,
341 const VECTOR& rState);
342
350};
351
352#endif /*ABSTRACTPARAMETERISEDSYSTEM_HPP_*/
virtual VECTOR ComputeDerivedQuantities(double time, const VECTOR &rState)
double GetStateVariable(unsigned index) const
void SetStateVariables(const VECTOR &rStateVariables)
double GetAnyVariable(unsigned index, double time=0.0, VECTOR *pDerivedQuantities=NULL)
double GetParameter(unsigned index) const
void SetStateVariable(unsigned index, double newValue)
void SetAnyVariable(unsigned index, double value)
VECTOR ComputeDerivedQuantitiesFromCurrentState(double time)
void CheckParametersOnLoad(const std::vector< double > &rParameters, const std::vector< std::string > &rParameterNames)
std::string GetStateMessage(const std::string &rMessage, VECTOR Y)
void SetParameter(const std::string &rName, double value)
std::string DumpState(const std::string &rMessage)
void SetDefaultInitialCondition(unsigned index, double initialCondition)
void SetDefaultInitialConditions(const VECTOR &rInitialConditions)