AbstractCvodeCell.hpp

00001 /*
00002 
00003 Copyright (c) 2005-2015, University of Oxford.
00004 All rights reserved.
00005 
00006 University of Oxford means the Chancellor, Masters and Scholars of the
00007 University of Oxford, having an administrative office at Wellington
00008 Square, Oxford OX1 2JD, UK.
00009 
00010 This file is part of Chaste.
00011 
00012 Redistribution and use in source and binary forms, with or without
00013 modification, are permitted provided that the following conditions are met:
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019  * Neither the name of the University of Oxford nor the names of its
00020    contributors may be used to endorse or promote products derived from this
00021    software without specific prior written permission.
00022 
00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00026 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00027 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00028 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00029 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00030 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00032 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 
00034 */
00035 
00036 #ifdef CHASTE_CVODE
00037 #ifndef _ABSTRACTCVODECELL_HPP_
00038 #define _ABSTRACTCVODECELL_HPP_
00039 
00040 // Serialization headers
00041 #include "ChasteSerialization.hpp"
00042 #include "ClassIsAbstract.hpp"
00043 #include <boost/serialization/base_object.hpp>
00044 #include <boost/shared_ptr.hpp>
00045 #include <boost/serialization/shared_ptr.hpp>
00046 
00047 // Chaste headers
00048 #include "AbstractOdeSystemInformation.hpp"
00049 #include "AbstractStimulusFunction.hpp"
00050 #include "AbstractIvpOdeSolver.hpp"
00051 #include "AbstractCvodeSystem.hpp"
00052 #include "AbstractCardiacCellInterface.hpp"
00053 #include "VectorHelperFunctions.hpp"
00054 
00055 
00078 class AbstractCvodeCell : public AbstractCardiacCellInterface, public AbstractCvodeSystem
00079 {
00080 private:
00082     friend class boost::serialization::access;
00089     template<class Archive>
00090     void serialize(Archive & archive, const unsigned int version)
00091     {
00092         // This calls serialize on the base classes.
00093         archive & boost::serialization::base_object<AbstractCvodeSystem>(*this);
00094         archive & boost::serialization::base_object<AbstractCardiacCellInterface>(*this);
00095         archive & mMaxDt;
00096     }
00097 
00098 protected:
00100     double mMaxDt;
00101 
00102 public:
00113     AbstractCvodeCell(boost::shared_ptr<AbstractIvpOdeSolver> pSolver,
00114                       unsigned numberOfStateVariables,
00115                       unsigned voltageIndex,
00116                       boost::shared_ptr<AbstractStimulusFunction> pIntracellularStimulus);
00117 
00121     virtual ~AbstractCvodeCell();
00122 
00127     double GetVoltage();
00128 
00133     void SetVoltage(double voltage);
00134 
00140     void SetMaxTimestep(double maxDt);
00141 
00151     void SetTimestep(double maxDt);
00152 
00156     double GetTimestep();
00157 
00168     virtual void SolveAndUpdateState(double tStart, double tEnd);
00169 
00183     OdeSolution Compute(double tStart, double tEnd, double tSamp=0.0);
00184 
00192     void ComputeExceptVoltage(double tStart, double tEnd);
00193 
00199     void SetVoltageDerivativeToZero(bool clamp=true);
00200 
00210     unsigned GetNumberOfStateVariables() const;
00211 
00221     unsigned GetNumberOfParameters() const;
00222 
00232     std::vector<double> GetStdVecStateVariables();
00233 
00243     const std::vector<std::string>& rGetStateVariableNames() const;
00244 
00254     void SetStateVariables(const std::vector<double>& rVariables);
00255 
00260     void SetStateVariables(const N_Vector& rVariables);
00261 
00272     void SetStateVariable(unsigned index, double newValue);
00273 
00284     void SetStateVariable(const std::string& rName, double newValue);
00285 
00297     double GetAnyVariable(const std::string& rName, double time=0.0);
00298 
00309     double GetParameter(const std::string& rParameterName);
00310 
00319     double GetParameter(unsigned parameterIndex);
00320 
00331     void SetParameter(const std::string& rParameterName, double value);
00332 
00333 };
00334 
00335 CLASS_IS_ABSTRACT(AbstractCvodeCell)
00336 
00337 #endif // _ABSTRACTCVODECELL_HPP_
00338 #endif // CHASTE_CVODE

Generated by  doxygen 1.6.2