00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ABSTRACTCARDIACPDE_HPP_
00029 #define ABSTRACTCARDIACPDE_HPP_
00030
00031 #include <vector>
00032 #include <climits>
00033 #include <boost/serialization/access.hpp>
00034 #include <boost/serialization/is_abstract.hpp>
00035 #include <boost/serialization/base_object.hpp>
00036 #include <boost/shared_ptr.hpp>
00037 #include <boost/serialization/shared_ptr.hpp>
00038 #include <boost/serialization/vector.hpp>
00039
00040 #include <boost/numeric/ublas/matrix.hpp>
00041
00042 #include "AbstractCardiacCell.hpp"
00043 #include "AbstractCardiacCellFactory.hpp"
00044 #include "AbstractConductivityTensors.hpp"
00045
00046 #include "ReplicatableVector.hpp"
00047 #include "HeartConfig.hpp"
00048 #include "ArchiveLocationInfo.hpp"
00049
00050
00051 #include "TemplatedExport.hpp"
00052
00053
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00076 template <unsigned ELEM_DIM, unsigned SPACE_DIM = ELEM_DIM>
00077 class AbstractCardiacPde
00078 {
00079 private:
00080
00082 friend class boost::serialization::access;
00089 template<class Archive>
00090 void serialize(Archive & archive, const unsigned int version)
00091 {
00092
00093
00094
00095
00097
00098 archive & mpDistributedVectorFactory;
00099 }
00100
00101 protected:
00102
00104 AbstractConductivityTensors<SPACE_DIM> *mpIntracellularConductivityTensors;
00105
00107 std::vector< AbstractCardiacCell* > mCellsDistributed;
00108
00113 ReplicatableVector mIionicCacheReplicated;
00114
00119 ReplicatableVector mIntracellularStimulusCacheReplicated;
00120
00127 const unsigned mStride;
00128
00130 HeartConfig* mpConfig;
00131
00141 bool mDoCacheReplication;
00142
00148 bool mDoOneCacheReplication;
00149
00155 DistributedVectorFactory* mpDistributedVectorFactory;
00156
00160 bool mpFactoryWasUnarchived;
00161 public:
00171 AbstractCardiacPde(AbstractCardiacCellFactory<ELEM_DIM,SPACE_DIM>* pCellFactory,
00172 const unsigned stride=1);
00173
00180 AbstractCardiacPde(std::vector<AbstractCardiacCell*> & rCellsDistributed,
00181 const unsigned stride = 1);
00182
00184 virtual ~AbstractCardiacPde();
00185
00192 void SetCacheReplication(bool doCacheReplication);
00193
00197 const c_matrix<double, SPACE_DIM, SPACE_DIM>& rGetIntracellularConductivityTensor(unsigned elementIndex);
00198
00207 AbstractCardiacCell* GetCardiacCell( unsigned globalIndex );
00208
00223 virtual void SolveCellSystems(Vec existingSolution, double time, double nextTime);
00224
00226 ReplicatableVector& rGetIionicCacheReplicated();
00227
00229 ReplicatableVector& rGetIntracellularStimulusCacheReplicated();
00230
00231
00239 void UpdateCaches(unsigned globalIndex, unsigned localIndex, double nextTime);
00240
00244 void ReplicateCaches();
00245
00249 const std::vector<AbstractCardiacCell*>& GetCellsDistributed() const;
00250
00251 };
00252
00253
00254 EXPORT_ABSTRACT_TEMPLATE_CLASS_ALL_DIMS(AbstractCardiacPde);
00255
00256 #endif
00257