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     void SetStateVariables(const VECTOR& rStateVariables);
00120 
00126     double GetStateVariable(unsigned index) const;
00127 
00133     double GetStateVariable(const std::string& rName) const;
00134 
00141     void SetStateVariable(unsigned index, double newValue);
00142 
00149     void SetStateVariable(const std::string& rName, double newValue);
00150 
00154     const std::vector<std::string>& rGetStateVariableNames() const;
00155 
00159     const std::vector<std::string>& rGetStateVariableUnits() const;
00160 
00171     unsigned GetStateVariableIndex(const std::string& rName) const;
00172 
00181     bool HasStateVariable(const std::string& rName) const;
00182 
00190     std::string GetStateVariableUnits(unsigned index) const;
00191 
00192     //
00193     // Initial condition methods
00194     //
00195 
00205     void SetDefaultInitialConditions(const VECTOR& rInitialConditions);
00206 
00217     void SetDefaultInitialCondition(unsigned index, double initialCondition);
00218 
00224     VECTOR GetInitialConditions() const;
00225 
00229     void ResetToInitialConditions();
00230 
00231     //
00232     // Parameter methods
00233     //
00234 
00238     unsigned GetNumberOfParameters() const;
00239 
00245     double GetParameter(unsigned index) const;
00246 
00252     double GetParameter(const std::string& rName) const;
00253 
00260     void SetParameter(const std::string& rName, double value);
00261 
00268     void SetParameter(unsigned index, double value);
00269 
00273     const std::vector<std::string>& rGetParameterNames() const;
00274 
00278     const std::vector<std::string>& rGetParameterUnits() const;
00279 
00289     unsigned GetParameterIndex(const std::string& rName) const;
00290 
00299     bool HasParameter(const std::string& rName) const;
00300 
00308     std::string GetParameterUnits(unsigned index) const;
00309 
00310     //
00311     // "Any variable" methods
00312     //
00313 
00327     double GetAnyVariable(unsigned index, double time=0.0,
00328                           VECTOR* pDerivedQuantities=NULL);
00329 
00343     double GetAnyVariable(const std::string& rName, double time=0.0,
00344                           VECTOR* pDerivedQuantities=NULL);
00345 
00354     unsigned GetAnyVariableIndex(const std::string& rName) const;
00355 
00365     bool HasAnyVariable(const std::string& rName) const;
00366 
00374     void SetAnyVariable(unsigned index, double value);
00375 
00383     void SetAnyVariable(const std::string& rName, double value);
00384 
00392     std::string GetAnyVariableUnits(unsigned index) const;
00393 
00401     std::string GetAnyVariableUnits(const std::string& rName) const;
00402 
00403 
00404     //
00405     // Derived quantity methods
00406     //
00407 
00411     unsigned GetNumberOfDerivedQuantities() const;
00412 
00420     virtual VECTOR ComputeDerivedQuantities(double time,
00421                                             const VECTOR& rState);
00422 
00428     VECTOR ComputeDerivedQuantitiesFromCurrentState(double time);
00429 
00433     const std::vector<std::string>& rGetDerivedQuantityNames() const;
00434 
00438     const std::vector<std::string>& rGetDerivedQuantityUnits() const;
00439 
00445     unsigned GetDerivedQuantityIndex(const std::string& rName) const;
00446 
00455     bool HasDerivedQuantity(const std::string& rName) const;
00456 
00463     std::string GetDerivedQuantityUnits(unsigned index) const;
00464 
00465     //
00466     // Attribute methods
00467     //
00468 
00472     unsigned GetNumberOfAttributes() const;
00473 
00478     bool HasAttribute(const std::string& rName) const;
00479 
00484     double GetAttribute(const std::string& rName) const;
00485 };
00486 
00487 #endif /*ABSTRACTPARAMETERISEDSYSTEM_HPP_*/

Generated on Tue May 31 14:31:48 2011 for Chaste by  doxygen 1.5.5