CardiacElectroMechanicsProblem.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
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 "TetrahedralMesh.hpp"
00040 #include "QuadraticMesh.hpp"
00041 #include "AbstractOdeBasedContractionModel.hpp"
00042 #include "AbstractCardiacMechanicsAssembler.hpp"
00043 #include "FineCoarseMeshPair.hpp"
00044
00045
00046
00047
00048
00078 template<unsigned DIM>
00079 class CardiacElectroMechanicsProblem
00080 {
00081
00082 friend class TestCardiacElectroMechanicsProblem;
00083
00084 protected :
00086 ContractionModel mContractionModel;
00088 MonodomainProblem<DIM>* mpMonodomainProblem;
00090 AbstractCardiacMechanicsAssembler<DIM>* mpCardiacMechAssembler;
00091
00093 double mEndTime;
00095 double mElectricsTimeStep;
00097 double mMechanicsTimeStep;
00099 unsigned mNumElecTimestepsPerMechTimestep;
00101 double mContractionModelOdeTimeStep;
00102
00104 TetrahedralMesh<DIM,DIM>* mpElectricsMesh;
00106 QuadraticMesh<DIM>* mpMechanicsMesh;
00107
00109 FineCoarseMeshPair<DIM>* mpMeshPair;
00110
00112 std::string mOutputDirectory;
00114 std::string mDeformationOutputDirectory;
00116 bool mWriteOutput;
00118 bool mNoElectricsOutput;
00119
00121 const static int WRITE_EVERY_NTH_TIME = 1;
00122
00124 bool mIsWatchedLocation;
00126 c_vector<double,DIM> mWatchedLocation;
00128 unsigned mWatchedElectricsNodeIndex;
00130 unsigned mWatchedMechanicsNodeIndex;
00132 out_stream mpWatchedLocationFile;
00133
00135 std::vector<unsigned> mFixedNodes;
00137 std::string mFibreSheetDirectionsFile;
00138
00142 void DetermineWatchedNodes();
00143
00144
00145
00153 void WriteWatchedLocationData(double time, Vec voltage);
00154
00155 public :
00156
00170 CardiacElectroMechanicsProblem(ContractionModel contractionModel,
00171 TetrahedralMesh<DIM,DIM>* pElectricsMesh,
00172 QuadraticMesh<DIM>* pMechanicsMesh,
00173 std::vector<unsigned> fixedMechanicsNodes,
00174 AbstractCardiacCellFactory<DIM>* pCellFactory,
00175 double endTime,
00176 double electricsPdeTimeStep,
00177 unsigned numElecTimeStepsPerMechTimestep,
00178 double contractionModelOdeTimeStep,
00179 std::string outputDirectory);
00180
00189 virtual ~CardiacElectroMechanicsProblem();
00190
00196 void Initialise();
00197
00201 void Solve();
00202
00207 double Max(std::vector<double>& vec);
00208
00210 void SetNoElectricsOutput();
00211
00222 void SetWatchedPosition(c_vector<double,DIM> watchedLocation);
00223
00230 void SetVariableFibreSheetDirectionsFile(std::string orthoFile);
00231
00233 std::vector<c_vector<double,DIM> >& rGetDeformedPosition();
00234 };
00235
00236
00237
00238 #endif