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 "AbstractCardiacMechanicsSolver.hpp"
00043 #include "FineCoarseMeshPair.hpp"
00044
00045
00075 template<unsigned DIM>
00076 class CardiacElectroMechanicsProblem
00077 {
00078
00079 friend class TestCardiacElectroMechanicsProblem;
00080
00081 protected :
00083 ContractionModel mContractionModel;
00085 MonodomainProblem<DIM>* mpMonodomainProblem;
00087 AbstractCardiacMechanicsSolver<DIM>* mpCardiacMechSolver;
00088
00090 double mEndTime;
00092 double mElectricsTimeStep;
00094 double mMechanicsTimeStep;
00096 unsigned mNumElecTimestepsPerMechTimestep;
00098 double mContractionModelOdeTimeStep;
00099
00101 TetrahedralMesh<DIM,DIM>* mpElectricsMesh;
00103 QuadraticMesh<DIM>* mpMechanicsMesh;
00104
00106 FineCoarseMeshPair<DIM>* mpMeshPair;
00107
00109 std::string mOutputDirectory;
00111 std::string mDeformationOutputDirectory;
00113 bool mWriteOutput;
00115 bool mNoElectricsOutput;
00116
00118 static const int WRITE_EVERY_NTH_TIME = 1;
00119
00121 bool mIsWatchedLocation;
00123 c_vector<double,DIM> mWatchedLocation;
00125 unsigned mWatchedElectricsNodeIndex;
00127 unsigned mWatchedMechanicsNodeIndex;
00129 out_stream mpWatchedLocationFile;
00130
00132 std::vector<unsigned> mFixedNodes;
00134 std::string mFibreSheetDirectionsFile;
00136 bool mFibreSheetDirectionsDefinedPerQuadraturePoint;
00137
00139 std::vector<double> mStretchesForEachMechanicsElement;
00141 std::vector<c_matrix<double,DIM,DIM> > mDeformationGradientsForEachMechanicsElement;
00142
00147 bool mNoMechanoElectricFeedback;
00148
00152 void DetermineWatchedNodes();
00153
00154
00161 void WriteWatchedLocationData(double time, Vec voltage);
00162
00163
00165
00166
00167
00168
00169 public :
00170
00184 CardiacElectroMechanicsProblem(ContractionModel contractionModel,
00185 TetrahedralMesh<DIM,DIM>* pElectricsMesh,
00186 QuadraticMesh<DIM>* pMechanicsMesh,
00187 std::vector<unsigned> fixedMechanicsNodes,
00188 AbstractCardiacCellFactory<DIM>* pCellFactory,
00189 double endTime,
00190 double electricsPdeTimeStep,
00191 unsigned numElecTimeStepsPerMechTimestep,
00192 double contractionModelOdeTimeStep,
00193 std::string outputDirectory);
00194
00203 virtual ~CardiacElectroMechanicsProblem();
00204
00209 void Initialise();
00210
00214 void Solve();
00215
00220 double Max(std::vector<double>& vec);
00221
00223 void SetNoElectricsOutput();
00224
00235 void SetWatchedPosition(c_vector<double,DIM> watchedLocation);
00236
00248 void SetVariableFibreSheetDirectionsFile(std::string orthoFile, bool definedPerQuadPoint);
00249
00251 std::vector<c_vector<double,DIM> >& rGetDeformedPosition();
00252
00267 void UseMechanoElectricFeedback()
00268 {
00269 mNoMechanoElectricFeedback = false;
00270 }
00271
00273
00274
00275 };
00276
00277
00278
00279 #endif