Electrodes.hpp
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 #ifndef ELECTRODES_HPP_
00030 #define ELECTRODES_HPP_
00031
00032 #include <boost/shared_ptr.hpp>
00033 #include "ChasteSerialization.hpp"
00034 #include <boost/serialization/split_member.hpp>
00035 #include <boost/serialization/shared_ptr.hpp>
00036
00037 #include "AbstractTetrahedralMesh.hpp"
00038 #include "DistributedVector.hpp"
00039 #include "BoundaryConditionsContainer.hpp"
00040 #include "ConstBoundaryCondition.hpp"
00041
00057 template<unsigned DIM>
00058 class Electrodes
00059 {
00060 friend class TestBidomainWithBathAssembler;
00061 friend class TestElectrodes;
00062
00063 private:
00065 bool mGroundSecondElectrode;
00067 boost::shared_ptr<BoundaryConditionsContainer<DIM,DIM,2> > mpBoundaryConditionsContainer;
00069 double mStartTime;
00071 double mEndTime;
00073 bool mAreActive;
00079 AbstractTetrahedralMesh<DIM,DIM>* mpMesh;
00080
00082 double mLeftElectrodeArea;
00083
00085 double mRightElectrodeArea;
00086
00096 void ComputeElectrodesAreasAndCheckEquality(unsigned index, double lowerValue, double upperValue);
00097
00099 friend class boost::serialization::access;
00106 template<class Archive>
00107 void save(Archive & archive, const unsigned int version) const
00108 {
00109 archive & mGroundSecondElectrode;
00110 archive & mStartTime;
00111 archive & mEndTime;
00112 archive & mAreActive;
00113 archive & mpMesh;
00114 (*ProcessSpecificArchive<Archive>::Get()) & mpBoundaryConditionsContainer;
00115 }
00122 template<class Archive>
00123 void load(Archive & archive, const unsigned int version)
00124 {
00125 archive & mGroundSecondElectrode;
00126 archive & mStartTime;
00127 archive & mEndTime;
00128 archive & mAreActive;
00129 archive & mpMesh;
00130
00131 (*ProcessSpecificArchive<Archive>::Get()) & mpBoundaryConditionsContainer;
00132 assert(mpBoundaryConditionsContainer);
00133
00134 mpBoundaryConditionsContainer->LoadFromArchive(*ProcessSpecificArchive<Archive>::Get(), mpMesh);
00135 }
00136 BOOST_SERIALIZATION_SPLIT_MEMBER()
00137
00138
00141 Electrodes(){};
00142
00143 public:
00156 Electrodes(AbstractTetrahedralMesh<DIM,DIM>& rMesh,
00157 bool groundSecondElectrode,
00158 unsigned index, double lowerValue, double upperValue,
00159 double magnitude, double startTime, double duration);
00160
00166 boost::shared_ptr<BoundaryConditionsContainer<DIM,DIM,2> > GetBoundaryConditionsContainer();
00167
00175 bool SwitchOff(double time);
00176
00184 bool SwitchOn(double time);
00185
00187 double GetSwitchOnTime()
00188 {
00189 return mStartTime;
00190 }
00191
00193 double GetSwitchOffTime()
00194 {
00195 return mEndTime;
00196 }
00197
00199 bool HasGroundedElectrode()
00200 {
00201 return mGroundSecondElectrode;
00202 }
00203 };
00204
00205 #include "SerializationExportWrapper.hpp"
00206 EXPORT_TEMPLATE_CLASS_SAME_DIMS(Electrodes);
00207
00208 #endif