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 CARDIACELECTROMECHANICSPROBLEM_HPP_
00031 #define CARDIACELECTROMECHANICSPROBLEM_HPP_
00032
00033 #include <vector>
00034 #include <string>
00035 #include "UblasIncludes.hpp"
00036
00037 #include "AbstractCardiacCellFactory.hpp"
00038 #include "MonodomainProblem.hpp"
00039 #include "ImplicitCardiacMechanicsAssembler.hpp"
00040 #include "TetrahedralMesh.hpp"
00041 #include "QuadraticMesh.hpp"
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00060 template<unsigned DIM>
00061 struct ElementAndWeights
00062 {
00063 unsigned ElementNum;
00064 c_vector<double,DIM+1> Weights;
00065 };
00066
00067
00068
00098 template<unsigned DIM>
00099 class CardiacElectroMechanicsProblem
00100 {
00101
00102 friend class TestCardiacElectroMechanicsProblem;
00103
00104 protected :
00106 MonodomainProblem<DIM>* mpMonodomainProblem;
00108 ImplicitCardiacMechanicsAssembler<DIM>* mpCardiacMechAssembler;
00109
00111 double mEndTime;
00113 double mElectricsTimeStep;
00115 double mMechanicsTimeStep;
00117 unsigned mNumElecTimestepsPerMechTimestep;
00119 double mNhsOdeTimeStep;
00120
00122 TetrahedralMesh<DIM,DIM>* mpElectricsMesh;
00124 QuadraticMesh<DIM>* mpMechanicsMesh;
00125
00131 std::vector<ElementAndWeights<DIM> > mElementAndWeightsForQuadPoints;
00132
00134 std::string mOutputDirectory;
00136 std::string mDeformationOutputDirectory;
00138 bool mWriteOutput;
00140 bool mNoElectricsOutput;
00141
00143 const static int WRITE_EVERY_NTH_TIME = 1;
00144
00146 bool mIsWatchedLocation;
00148 c_vector<double,DIM> mWatchedLocation;
00150 unsigned mWatchedElectricsNodeIndex;
00152 unsigned mWatchedMechanicsNodeIndex;
00154 out_stream mpWatchedLocationFile;
00155
00157 std::vector<unsigned> mFixedNodes;
00158
00162 void DetermineWatchedNodes();
00163
00164
00169 void WriteWatchedLocationData(double time, Vec voltage);
00170
00171 public :
00175 CardiacElectroMechanicsProblem(TetrahedralMesh<DIM,DIM>* pElectricsMesh,
00176 QuadraticMesh<DIM>* pMechanicsMesh,
00177 std::vector<unsigned> fixedMechanicsNodes,
00178 AbstractCardiacCellFactory<DIM>* pCellFactory,
00179 double endTime,
00180 unsigned numElecTimeStepsPerMechTimestep,
00181 double nhsOdeTimeStep,
00182 std::string outputDirectory);
00183
00187 virtual ~CardiacElectroMechanicsProblem();
00188
00194 void Initialise();
00195
00199 void Solve();
00200
00201
00202 double Max(std::vector<double>& vec);
00203
00205 void SetNoElectricsOutput();
00206
00216 void SetWatchedPosition(c_vector<double,DIM> watchedLocation);
00217
00219 std::vector<c_vector<double,DIM> >& rGetDeformedPosition();
00220 };
00221
00222
00223
00224 #endif