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 "AbstractCardiacMechanicsSolver.hpp"
00043 #include "AbstractCardiacMechanicsSolverInterface.hpp"
00044 #include "FineCoarseMeshPair.hpp"
00045 #include "AbstractConductivityModifier.hpp"
00046 #include "ElectroMechanicsProblemDefinition.hpp"
00047
00073 template<unsigned DIM>
00074 class CardiacElectroMechanicsProblem
00075 : public AbstractConductivityModifier<DIM,DIM>
00076
00077 {
00078
00079 friend class TestCardiacElectroMechanicsProblem;
00080 friend class TestCardiacElectroMechanicsFurtherFunctionality;
00081
00082 protected :
00084 CompressibilityType mCompressibilityType;
00085
00087 MonodomainProblem<DIM>* mpMonodomainProblem;
00088
00091 AbstractCardiacMechanicsSolverInterface<DIM>* mpCardiacMechSolver;
00094 AbstractNonlinearElasticitySolver<DIM>* mpMechanicsSolver;
00095
00097 unsigned mNumElecTimestepsPerMechTimestep;
00098
00099
00101 TetrahedralMesh<DIM,DIM>* mpElectricsMesh;
00103 QuadraticMesh<DIM>* mpMechanicsMesh;
00104
00106 ElectroMechanicsProblemDefinition<DIM>* mpProblemDefinition;
00107
00108
00110 FineCoarseMeshPair<DIM>* mpMeshPair;
00111
00113 std::string mOutputDirectory;
00115 std::string mDeformationOutputDirectory;
00117 bool mWriteOutput;
00119 bool mNoElectricsOutput;
00120
00122 static const int WRITE_EVERY_NTH_TIME = 1;
00123
00125 bool mIsWatchedLocation;
00127 c_vector<double,DIM> mWatchedLocation;
00129 unsigned mWatchedElectricsNodeIndex;
00131 unsigned mWatchedMechanicsNodeIndex;
00133 out_stream mpWatchedLocationFile;
00134
00136 std::vector<double> mStretchesForEachMechanicsElement;
00138 std::vector<c_matrix<double,DIM,DIM> > mDeformationGradientsForEachMechanicsElement;
00139
00143 std::pair<unsigned, c_matrix<double,DIM,DIM> > mLastModifiedConductivity;
00144
00145
00149 void DetermineWatchedNodes();
00150
00151
00158 void WriteWatchedLocationData(double time, Vec voltage);
00159
00160
00162
00163
00164
00165
00166 public :
00167
00177 CardiacElectroMechanicsProblem(CompressibilityType compressibilityType,
00178 TetrahedralMesh<DIM,DIM>* pElectricsMesh,
00179 QuadraticMesh<DIM>* pMechanicsMesh,
00180 AbstractCardiacCellFactory<DIM>* pCellFactory,
00181 ElectroMechanicsProblemDefinition<DIM>* pProblemDefinition,
00182 std::string outputDirectory);
00183
00192 virtual ~CardiacElectroMechanicsProblem();
00193
00198 void Initialise();
00199
00203 void Solve();
00204
00209 double Max(std::vector<double>& vec);
00210
00212 void SetNoElectricsOutput();
00213
00224 void SetWatchedPosition(c_vector<double,DIM> watchedLocation);
00225
00227 std::vector<c_vector<double,DIM> >& rGetDeformedPosition();
00228
00229
00237 c_matrix<double,DIM,DIM>& rGetModifiedConductivityTensor(unsigned elementIndex, const c_matrix<double,DIM,DIM>& rOriginalConductivity);
00238
00240
00241
00245 virtual void PrepareForSolve(){}
00246
00251 virtual void OnEndOfTimeStep(unsigned counter)
00252 {
00253 }
00254 };
00255
00256
00257
00258 #endif