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 ABSTRACTCARDIACPROBLEM_HPP_
00031 #define ABSTRACTCARDIACPROBLEM_HPP_
00032
00033 #include <string>
00034 #include <vector>
00035
00036 #include "AbstractCardiacCellFactory.hpp"
00037 #include "AbstractCardiacPde.hpp"
00038 #include "AbstractDynamicAssemblerMixin.hpp"
00039 #include "AbstractMesh.hpp"
00040
00041 #include "BoundaryConditionsContainer.hpp"
00042 #include "Hdf5DataReader.hpp"
00043 #include "Hdf5DataWriter.hpp"
00044
00050 template<unsigned SPACE_DIM, unsigned PROBLEM_DIM>
00051 class AbstractCardiacProblem
00052 {
00053 friend class TestBidomainWithBathAssembler;
00054
00055 protected:
00058 std::string mMeshFilename;
00059
00061 std::string mNodesPerProcessorFilename;
00062
00064 std::string mOutputDirectory, mOutputFilenamePrefix;
00065
00070 bool mUseMatrixBasedRhsAssembly;
00072 bool mAllocatedMemoryForMesh;
00074 bool mWriteInfo;
00076 bool mPrintOutput;
00078 bool mCallChaste2Meshalyzer;
00079
00081 std::vector<unsigned> mNodesToOutput;
00082
00084 unsigned mVoltageColumnId;
00086 unsigned mTimeColumnId;
00088 unsigned mNodeColumnId;
00089
00091 AbstractCardiacPde<SPACE_DIM>* mpCardiacPde;
00092
00094 BoundaryConditionsContainer<SPACE_DIM, SPACE_DIM, PROBLEM_DIM>* mpBoundaryConditionsContainer;
00096 BoundaryConditionsContainer<SPACE_DIM, SPACE_DIM, PROBLEM_DIM>* mpDefaultBoundaryConditionsContainer;
00098 AbstractDynamicAssemblerMixin<SPACE_DIM, SPACE_DIM, PROBLEM_DIM>* mpAssembler;
00100 AbstractCardiacCellFactory<SPACE_DIM>* mpCellFactory;
00102 AbstractMesh<SPACE_DIM,SPACE_DIM>* mpMesh;
00103
00106 Vec mSolution;
00107
00113 virtual AbstractCardiacPde<SPACE_DIM>* CreateCardiacPde() =0;
00114
00120 virtual AbstractDynamicAssemblerMixin<SPACE_DIM, SPACE_DIM, PROBLEM_DIM>* CreateAssembler() =0;
00121
00122 public:
00123
00124
00125
00126
00127 Hdf5DataWriter* mpWriter;
00128
00129 public:
00135 AbstractCardiacProblem(AbstractCardiacCellFactory<SPACE_DIM>* pCellFactory);
00136
00137 virtual ~AbstractCardiacProblem();
00138
00139
00140
00141
00142 void Initialise();
00143
00147 void SetNodesPerProcessorFilename(const std::string& filename);
00148
00153 void SetBoundaryConditionsContainer(BoundaryConditionsContainer<SPACE_DIM, SPACE_DIM, PROBLEM_DIM> *bcc);
00154
00162 virtual void PreSolveChecks();
00163
00169 virtual Vec CreateInitialCondition();
00170
00177 void ConvertOutputToMeshalyzerFormat(bool call = true);
00178
00180 void SetMesh(AbstractMesh<SPACE_DIM,SPACE_DIM>* pMesh);
00181
00185 void PrintOutput(bool rPrintOutput);
00186
00190 void SetWriteInfo(bool writeInfo = true);
00191
00202 Vec GetSolution();
00203
00204 AbstractMesh<SPACE_DIM,SPACE_DIM> & rGetMesh();
00205
00206 AbstractCardiacPde<SPACE_DIM>* GetPde();
00207
00215 void Solve();
00216
00222 void CloseFilesAndPostProcess();
00223
00224
00225 virtual void WriteInfo(double time)=0;
00226
00227 virtual void DefineWriterColumns();
00228
00229 virtual void WriteOneStep(double time, Vec voltageVec);
00230
00236 void InitialiseWriter();
00237
00244 void SetOutputNodes(std::vector<unsigned> &nodesToOutput);
00245
00246 Hdf5DataReader GetDataReader();
00247
00251 void UseMatrixBasedRhsAssembly(bool usematrix=true);
00252
00258 virtual void OnEndOfTimestep(double time)
00259 {}
00260
00261 };
00262 #endif