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
00172 void WriteWatchedLocationData(double time, Vec voltage);
00173
00174 public :
00175
00189 CardiacElectroMechanicsProblem(TetrahedralMesh<DIM,DIM>* pElectricsMesh,
00190 QuadraticMesh<DIM>* pMechanicsMesh,
00191 std::vector<unsigned> fixedMechanicsNodes,
00192 AbstractCardiacCellFactory<DIM>* pCellFactory,
00193 double endTime,
00194 unsigned numElecTimeStepsPerMechTimestep,
00195 double nhsOdeTimeStep,
00196 std::string outputDirectory);
00197
00206 virtual ~CardiacElectroMechanicsProblem();
00207
00213 void Initialise();
00214
00218 void Solve();
00219
00226 double Max(std::vector<double>& vec);
00227
00229 void SetNoElectricsOutput();
00230
00241 void SetWatchedPosition(c_vector<double,DIM> watchedLocation);
00242
00244 std::vector<c_vector<double,DIM> >& rGetDeformedPosition();
00245 };
00246
00247
00248
00249 #endif