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
00029
00030 #ifndef GENERALPLANESTIMULUSCELLFACTORY_HPP_
00031 #define GENERALPLANESTIMULUSCELLFACTORY_HPP_
00032
00033 #include "AbstractCardiacCellFactory.hpp"
00034
00035 template <class CELL, unsigned DIM>
00036 class GeneralPlaneStimulusCellFactory : public AbstractCardiacCellFactory<DIM>
00037 {
00038 private:
00039
00040 SimpleStimulus* mpStimulus;
00041
00042 public:
00043 GeneralPlaneStimulusCellFactory(unsigned numEleAcross, double meshWidth, bool useMeshWidthAsMag=false) : AbstractCardiacCellFactory<DIM>()
00044 {
00049 if (useMeshWidthAsMag)
00050 {
00051 #define COVERAGE_IGNORE
00052 mpStimulus = new SimpleStimulus(meshWidth, 0.5);
00053 #undef COVERAGE_IGNORE
00054 }
00055 else
00056 {
00057 double stimulus_magnitude=-1e7;
00058 switch(DIM)
00059 {
00060 case 1:
00061 {
00062 stimulus_magnitude*=numEleAcross/(64.0);
00063
00064 stimulus_magnitude*=meshWidth/(0.2);
00065 break;
00066 }
00067 case 2:
00068 {
00069 stimulus_magnitude*=numEleAcross/(64.0);
00070
00071 stimulus_magnitude*=meshWidth/(0.2);
00072 break;
00073 }
00074 default:
00075 {
00076 stimulus_magnitude*=numEleAcross/(64.0);
00077
00078 stimulus_magnitude*=meshWidth/(0.2);
00079 break;
00080 }
00081 }
00082
00083 mpStimulus = new SimpleStimulus(stimulus_magnitude, 0.5);
00084 }
00085 }
00086
00087 AbstractCardiacCell* CreateCardiacCellForTissueNode(unsigned node)
00088 {
00089 double x = this->mpMesh->GetNode(node)->GetPoint()[0];
00090 if (x*x<=1e-10)
00091 {
00092 return new CELL(this->mpSolver, this->mpStimulus);
00093 }
00094 else
00095 {
00096 return new CELL(this->mpSolver, this->mpZeroStimulus);
00097 }
00098 }
00099
00100 ~GeneralPlaneStimulusCellFactory(void)
00101 {
00102 delete mpStimulus;
00103 }
00104 };
00105
00106 #endif