Electrodes.hpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2010
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
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         // Allow the new object to load itself from the archive.
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); // implemented in cpp
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 /*ELECTRODES_HPP_*/

Generated by  doxygen 1.6.2