AbstractCardiacPde.hpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2009
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 
00030 #ifndef ABSTRACTCARDIACPDE_HPP_
00031 #define ABSTRACTCARDIACPDE_HPP_
00032 
00033 #include <vector>
00034 #include <boost/numeric/ublas/matrix.hpp>
00035 
00036 #include "AbstractCardiacCell.hpp"
00037 #include "AbstractCardiacCellFactory.hpp"
00038 #include "AbstractConductivityTensors.hpp"
00039 
00040 #include "ReplicatableVector.hpp"
00041 #include "HeartConfig.hpp"
00042 
00048 
00049 // IMPORTANT NOTE: the inheritance of AbstractPde has to be 'virtual'
00050 // ie "class AbstractCardiacPde : public virtual AbstractPde"
00051 // because AbstractPde will be the top class in a 'dreaded diamond':
00052 //      A
00053 //     / \     A = AbstractPde, B = AbstractCardiac, C = AbstractLinearParabolic (etc)
00054 //    B   C    D = MonodomainPde
00055 //     \ /
00056 //      D
00057 //
00058 // B and C must use virtual inheritence of A in order for D to only contain 1 instance
00059 // of the member variables in A
00060 
00061 template <unsigned SPACE_DIM>
00062 class AbstractCardiacPde
00063 {
00064 protected:
00065 
00066     AbstractConductivityTensors<SPACE_DIM> *mpIntracellularConductivityTensors;
00067 
00069     std::vector< AbstractCardiacCell* > mCellsDistributed;
00070 
00075     ReplicatableVector mIionicCacheReplicated;
00076     ReplicatableVector mIntracellularStimulusCacheReplicated;
00077 
00084     const unsigned mStride;
00085     
00086     HeartConfig* mpConfig;
00087 
00097     bool mDoCacheReplication;
00103     bool mDoOneCacheReplication;
00104 
00105 public:
00115     AbstractCardiacPde(AbstractCardiacCellFactory<SPACE_DIM>* pCellFactory, const unsigned stride=1);
00116 
00117     virtual ~AbstractCardiacPde();
00118     
00124     void SetCacheReplication(bool doCacheReplication);
00125 
00126     const c_matrix<double, SPACE_DIM, SPACE_DIM>& rGetIntracellularConductivityTensor(unsigned elementIndex);
00127 
00132     AbstractCardiacCell* GetCardiacCell( unsigned globalIndex );
00133 
00134 
00144     virtual void SolveCellSystems(Vec currentSolution, double currentTime, double nextTime);
00145 
00146     ReplicatableVector& rGetIionicCacheReplicated();
00147 
00148     ReplicatableVector& rGetIntracellularStimulusCacheReplicated();
00149 
00150 
00154     void UpdateCaches(unsigned globalIndex, unsigned localIndex, double nextTime);
00155 
00159     void ReplicateCaches();
00160 };
00161 
00162 #endif /*ABSTRACTCARDIACPDE_HPP_*/
00163 

Generated on Wed Mar 18 12:51:51 2009 for Chaste by  doxygen 1.5.5