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 "AbstractTetrahedralMesh.hpp"
00040
00041 #include "BoundaryConditionsContainer.hpp"
00042 #include "Hdf5DataReader.hpp"
00043 #include "Hdf5DataWriter.hpp"
00044
00050 template<unsigned ELEM_DIM, 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
00067 bool mUseMatrixBasedRhsAssembly;
00069 bool mAllocatedMemoryForMesh;
00071 bool mWriteInfo;
00073 bool mPrintOutput;
00075 bool mCallChaste2Meshalyzer;
00076
00078 std::vector<unsigned> mNodesToOutput;
00079
00081 unsigned mVoltageColumnId;
00083 unsigned mTimeColumnId;
00085 unsigned mNodeColumnId;
00086
00088 AbstractCardiacPde<ELEM_DIM,SPACE_DIM>* mpCardiacPde;
00089
00091 BoundaryConditionsContainer<ELEM_DIM, SPACE_DIM, PROBLEM_DIM>* mpBoundaryConditionsContainer;
00093 BoundaryConditionsContainer<ELEM_DIM, SPACE_DIM, PROBLEM_DIM>* mpDefaultBoundaryConditionsContainer;
00095 AbstractDynamicAssemblerMixin<ELEM_DIM, SPACE_DIM, PROBLEM_DIM>* mpAssembler;
00097 AbstractCardiacCellFactory<ELEM_DIM,SPACE_DIM>* mpCellFactory;
00099 AbstractTetrahedralMesh<ELEM_DIM,SPACE_DIM>* mpMesh;
00100
00103 Vec mSolution;
00104
00106 bool mArchiveKSP;
00107
00113 virtual AbstractCardiacPde<ELEM_DIM,SPACE_DIM>* CreateCardiacPde() =0;
00114
00120 virtual AbstractDynamicAssemblerMixin<ELEM_DIM, SPACE_DIM, PROBLEM_DIM>* CreateAssembler() =0;
00121
00122 public:
00132 Hdf5DataWriter* mpWriter;
00133
00134 public:
00140 AbstractCardiacProblem(AbstractCardiacCellFactory<ELEM_DIM,SPACE_DIM>* pCellFactory);
00141
00145 virtual ~AbstractCardiacProblem();
00146
00150 void Initialise();
00151
00157 void SetNodesPerProcessorFilename(const std::string& rFilename);
00158
00163 void SetBoundaryConditionsContainer(BoundaryConditionsContainer<ELEM_DIM, SPACE_DIM, PROBLEM_DIM> *pbcc);
00164
00172 virtual void PreSolveChecks();
00173
00179 virtual Vec CreateInitialCondition();
00180
00189 void ConvertOutputToMeshalyzerFormat(bool call = true);
00190
00196 void SetMesh(AbstractTetrahedralMesh<ELEM_DIM,SPACE_DIM>* pMesh);
00197
00203 void PrintOutput(bool rPrintOutput);
00204
00210 void SetWriteInfo(bool writeInfo = true);
00211
00222 Vec GetSolution();
00223
00229 DistributedVector GetSolutionDistributedVector();
00230
00234 AbstractTetrahedralMesh<ELEM_DIM,SPACE_DIM> & rGetMesh();
00235
00239 AbstractCardiacPde<ELEM_DIM,SPACE_DIM>* GetPde();
00240
00248 void Solve();
00249
00255 void CloseFilesAndPostProcess();
00256
00264 virtual void WriteInfo(double time)=0;
00265
00269 virtual void DefineWriterColumns();
00270
00277 virtual void WriteOneStep(double time, Vec voltageVec);
00278
00284 void InitialiseWriter();
00285
00293 void SetOutputNodes(std::vector<unsigned> & rNodesToOutput);
00294
00298 Hdf5DataReader GetDataReader();
00299
00305 void UseMatrixBasedRhsAssembly(bool usematrix=true);
00306
00314 virtual void OnEndOfTimestep(double time)
00315 {}
00316
00322 void SetArchiveLinearSystemObject(bool archive=true);
00323
00324 };
00325 #endif