00001 /* 00002 00003 Copyright (C) University of Oxford, 2005-2010 00004 00005 University of Oxford means the Chancellor, Masters and Scholars of the 00006 University of Oxford, having an administrative office at Wellington 00007 Square, Oxford OX1 2JD, UK. 00008 00009 This file is part of Chaste. 00010 00011 Chaste is free software: you can redistribute it and/or modify it 00012 under the terms of the GNU Lesser General Public License as published 00013 by the Free Software Foundation, either version 2.1 of the License, or 00014 (at your option) any later version. 00015 00016 Chaste is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00019 License for more details. The offer of Chaste under the terms of the 00020 License is subject to the License being interpreted in accordance with 00021 English Law and subject to any action against the University of Oxford 00022 being under the jurisdiction of the English Courts. 00023 00024 You should have received a copy of the GNU Lesser General Public License 00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>. 00026 00027 */ 00028 00029 #ifndef ABSTRACTPARAMETERISEDSYSTEM_HPP_ 00030 #define ABSTRACTPARAMETERISEDSYSTEM_HPP_ 00031 00032 #include <vector> 00033 #include <string> 00034 #include <boost/shared_ptr.hpp> 00035 00036 #include "AbstractOdeSystemInformation.hpp" 00037 00048 template<typename VECTOR> 00049 class AbstractParameterisedSystem 00050 { 00051 protected: 00053 unsigned mNumberOfStateVariables; 00054 00056 VECTOR mStateVariables; 00057 00059 VECTOR mParameters; 00060 00067 boost::shared_ptr<AbstractOdeSystemInformation> mpSystemInfo; 00068 00069 public: 00075 AbstractParameterisedSystem(unsigned numberOfStateVariables); 00076 00080 virtual ~AbstractParameterisedSystem(); 00081 00085 boost::shared_ptr<const AbstractOdeSystemInformation> GetSystemInformation() const; 00086 00090 std::string GetSystemName() const; 00091 00092 // 00093 // State variable methods 00094 // 00095 00101 unsigned GetNumberOfStateVariables() const; 00102 00106 VECTOR& rGetStateVariables(); 00107 00113 double GetStateVariable(unsigned index) const; 00114 00121 void SetStateVariable(unsigned index, double newValue); 00122 00126 const std::vector<std::string>& rGetStateVariableNames() const; 00127 00131 const std::vector<std::string>& rGetStateVariableUnits() const; 00132 00143 unsigned GetStateVariableIndex(const std::string& rName) const; 00144 00152 std::string GetStateVariableUnits(unsigned index) const; 00153 00154 // 00155 // Parameter methods 00156 // 00157 00161 unsigned GetNumberOfParameters() const; 00162 00168 double GetParameter(unsigned index) const; 00169 00176 void SetParameter(const std::string& rName, double value); 00177 00184 void SetParameter(unsigned index, double value); 00185 00189 const std::vector<std::string>& rGetParameterNames() const; 00190 00194 const std::vector<std::string>& rGetParameterUnits() const; 00195 00205 unsigned GetParameterIndex(const std::string& rName) const; 00206 00214 std::string GetParameterUnits(unsigned index) const; 00215 00216 // 00217 // "Any variable" methods 00218 // 00219 00233 double GetAnyVariable(unsigned index, double time=0.0, 00234 VECTOR* pDerivedQuantities=NULL); 00235 00244 unsigned GetAnyVariableIndex(const std::string& rName) const; 00245 00253 std::string GetAnyVariableUnits(unsigned index) const; 00254 00255 // 00256 // Derived quantity methods 00257 // 00258 00262 unsigned GetNumberOfDerivedQuantities() const; 00263 00271 virtual VECTOR ComputeDerivedQuantities(double time, 00272 const VECTOR& rState); 00273 00279 VECTOR ComputeDerivedQuantitiesFromCurrentState(double time); 00280 00284 const std::vector<std::string>& rGetDerivedQuantityNames() const; 00285 00289 const std::vector<std::string>& rGetDerivedQuantityUnits() const; 00290 00296 unsigned GetDerivedQuantityIndex(const std::string& rName) const; 00297 00304 std::string GetDerivedQuantityUnits(unsigned index) const; 00305 }; 00306 00307 #endif /*ABSTRACTPARAMETERISEDSYSTEM_HPP_*/