ZeroNetChargeElectrodes.cpp
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
00031
00032
00033
00034
00035
00036 #include "ZeroNetChargeElectrodes.hpp"
00037 #include "ElectrodesStimulusFactory.hpp"
00038 #include "RegularStimulusZeroNetCharge.hpp"
00039 #include "DistributedTetrahedralMesh.hpp"
00040 #include "IsNan.hpp"
00041 #include "HeartConfig.hpp"
00042
00043 template<unsigned DIM>
00044 ZeroNetChargeElectrodes<DIM>::ZeroNetChargeElectrodes(std::vector<std::pair<AbstractChasteRegion<DIM>*, AbstractChasteRegion<DIM>*> >& rElectrodePairs,
00045 std::vector<double>& rStimulusMagnitudes,
00046 std::vector<double>& rDurations,
00047 std::vector<double>& rPeriods,
00048 std::vector<double>& rStarts,
00049 std::vector<double>& rEnds)
00050 : ElectrodesStimulusFactory<DIM>(rElectrodePairs, rStimulusMagnitudes, rDurations, rPeriods, rStarts, rEnds)
00051 {
00052
00053 }
00054
00055 template<unsigned DIM>
00056 ZeroNetChargeElectrodes<DIM>::~ZeroNetChargeElectrodes()
00057 {
00058 }
00059
00060
00061 template<unsigned DIM>
00062 boost::shared_ptr<AbstractStimulusFunction> ZeroNetChargeElectrodes<DIM>::CreateStimulusForNode(Node<DIM>* pNode)
00063 {
00064 boost::shared_ptr<RegularStimulusZeroNetCharge> p_stimulus;
00065 for (unsigned pair_index = 0; pair_index < this->mrElectrodePairs.size(); pair_index++)
00066 {
00067 if (this->mrElectrodePairs[pair_index].first->DoesContain(pNode->GetPoint()) )
00068 {
00069 p_stimulus.reset ( new RegularStimulusZeroNetCharge(this->mMagnitudesElectrode1[pair_index], this->mrDurations[pair_index], this->mrPeriods[pair_index], this->mrStarts[pair_index], this->mrEnds[pair_index]));
00070 }
00071 else if (this->mrElectrodePairs[pair_index].second->DoesContain(pNode->GetPoint()) )
00072 {
00073 p_stimulus.reset ( new RegularStimulusZeroNetCharge(this->mMagnitudesElectrode2[pair_index], this->mrDurations[pair_index], this->mrPeriods[pair_index], this->mrStarts[pair_index], this->mrEnds[pair_index]));
00074 }
00075 else
00076 {
00077 p_stimulus.reset ( new RegularStimulusZeroNetCharge(0.0, this->mrDurations[pair_index], this->mrPeriods[pair_index], this->mrStarts[pair_index], this->mrEnds[pair_index]) );
00078 }
00079 }
00080 return p_stimulus;
00081 }
00082
00083
00085
00087
00088 template class ZeroNetChargeElectrodes<1>;
00089 template class ZeroNetChargeElectrodes<2>;
00090 template class ZeroNetChargeElectrodes<3>;
00091