AbstractCardiacProblem.hpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2009
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
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 /*ABSTRACTCARDIACPROBLEM_HPP_*/

Generated on Tue Aug 4 16:10:22 2009 for Chaste by  doxygen 1.5.5