AbstractParameterisedSystem.hpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2011
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 
00112     VECTOR GetStateVariables();
00113 
00119     double GetStateVariable(unsigned index) const;
00120 
00126     double GetStateVariable(const std::string& rName) const;
00127 
00134     void SetStateVariable(unsigned index, double newValue);
00135 
00142     void SetStateVariable(const std::string& rName, double newValue);
00143 
00147     const std::vector<std::string>& rGetStateVariableNames() const;
00148 
00152     const std::vector<std::string>& rGetStateVariableUnits() const;
00153 
00164     unsigned GetStateVariableIndex(const std::string& rName) const;
00165 
00174     bool HasStateVariable(const std::string& rName) const;
00175 
00183     std::string GetStateVariableUnits(unsigned index) const;
00184 
00185     //
00186     // Parameter methods
00187     //
00188 
00192     unsigned GetNumberOfParameters() const;
00193 
00199     double GetParameter(unsigned index) const;
00200 
00206     double GetParameter(const std::string& rName) const;
00207 
00214     void SetParameter(const std::string& rName, double value);
00215 
00222     void SetParameter(unsigned index, double value);
00223 
00227     const std::vector<std::string>& rGetParameterNames() const;
00228 
00232     const std::vector<std::string>& rGetParameterUnits() const;
00233 
00243     unsigned GetParameterIndex(const std::string& rName) const;
00244 
00253     bool HasParameter(const std::string& rName) const;
00254 
00262     std::string GetParameterUnits(unsigned index) const;
00263 
00264     //
00265     // "Any variable" methods
00266     //
00267 
00281     double GetAnyVariable(unsigned index, double time=0.0,
00282                           VECTOR* pDerivedQuantities=NULL);
00283 
00297     double GetAnyVariable(const std::string& rName, double time=0.0,
00298                           VECTOR* pDerivedQuantities=NULL);
00299 
00308     unsigned GetAnyVariableIndex(const std::string& rName) const;
00309 
00319     bool HasAnyVariable(const std::string& rName) const;
00320 
00328     void SetAnyVariable(unsigned index, double value);
00329 
00337     void SetAnyVariable(const std::string& rName, double value);
00338 
00346     std::string GetAnyVariableUnits(unsigned index) const;
00347 
00355     std::string GetAnyVariableUnits(const std::string& rName) const;
00356 
00357 
00358     //
00359     // Derived quantity methods
00360     //
00361 
00365     unsigned GetNumberOfDerivedQuantities() const;
00366 
00374     virtual VECTOR ComputeDerivedQuantities(double time,
00375                                             const VECTOR& rState);
00376 
00382     VECTOR ComputeDerivedQuantitiesFromCurrentState(double time);
00383 
00387     const std::vector<std::string>& rGetDerivedQuantityNames() const;
00388 
00392     const std::vector<std::string>& rGetDerivedQuantityUnits() const;
00393 
00399     unsigned GetDerivedQuantityIndex(const std::string& rName) const;
00400 
00409     bool HasDerivedQuantity(const std::string& rName) const;
00410 
00417     std::string GetDerivedQuantityUnits(unsigned index) const;
00418 
00419     //
00420     // Attribute methods
00421     //
00422 
00426     unsigned GetNumberOfAttributes() const;
00427 
00432     bool HasAttribute(const std::string& rName) const;
00433 
00438     double GetAttribute(const std::string& rName) const;
00439 };
00440 
00441 #endif /*ABSTRACTPARAMETERISEDSYSTEM_HPP_*/

Generated on Mon Apr 18 11:35:35 2011 for Chaste by  doxygen 1.5.5