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 TestBidomainWithBathProblem;
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:
00144
00145
00152 Electrodes(AbstractTetrahedralMesh<DIM,DIM>& rMesh);
00153
00159 boost::shared_ptr<BoundaryConditionsContainer<DIM,DIM,2> > GetBoundaryConditionsContainer();
00160
00168 bool SwitchOff(double time);
00169
00177 bool SwitchOn(double time);
00178
00180 double GetSwitchOnTime()
00181 {
00182 return mStartTime;
00183 }
00184
00186 double GetSwitchOffTime()
00187 {
00188 return mEndTime;
00189 }
00190
00192 bool HasGroundedElectrode()
00193 {
00194 return mGroundSecondElectrode;
00195 }
00196 };
00197
00198 #include "SerializationExportWrapper.hpp"
00199 EXPORT_TEMPLATE_CLASS_SAME_DIMS(Electrodes)
00200
00201 #endif