CardiacElectroMechanicsProblem.hpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2010
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 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 "AbstractCardiacMechanicsAssembler.hpp"
00043 #include "FineCoarseMeshPair.hpp"
00044 
00045 // if including Cinv in monobidomain equations
00046 //#include "NodewiseData.hpp"
00047 
00048 
00078 template<unsigned DIM>
00079 class CardiacElectroMechanicsProblem
00080 {
00081 
00082 friend class TestCardiacElectroMechanicsProblem;
00083 
00084 protected :
00086     ContractionModel mContractionModel;
00088     MonodomainProblem<DIM>* mpMonodomainProblem;
00090     AbstractCardiacMechanicsAssembler<DIM>* mpCardiacMechAssembler;
00091 
00093     double mEndTime;
00095     double mElectricsTimeStep;
00097     double mMechanicsTimeStep;
00099     unsigned mNumElecTimestepsPerMechTimestep;
00101     double mContractionModelOdeTimeStep;
00102 
00104     TetrahedralMesh<DIM,DIM>* mpElectricsMesh;
00106     QuadraticMesh<DIM>* mpMechanicsMesh;
00107 
00109     FineCoarseMeshPair<DIM>* mpMeshPair;
00110 
00112     std::string mOutputDirectory;
00114     std::string mDeformationOutputDirectory;
00116     bool mWriteOutput;
00118     bool mNoElectricsOutput;
00119 
00121     const static int WRITE_EVERY_NTH_TIME = 1; //hardcoded for the time being ///\todo, allow user to set this
00122 
00124     bool mIsWatchedLocation;
00126     c_vector<double,DIM> mWatchedLocation;
00128     unsigned mWatchedElectricsNodeIndex;
00130     unsigned mWatchedMechanicsNodeIndex;
00132     out_stream mpWatchedLocationFile;
00133 
00135     std::vector<unsigned> mFixedNodes;
00137     std::string mFibreSheetDirectionsFile;
00138 
00142     void DetermineWatchedNodes();
00143 
00144 
00145 //EMTODO
00153     void WriteWatchedLocationData(double time, Vec voltage);
00154 
00155 public :
00156 
00170     CardiacElectroMechanicsProblem(ContractionModel contractionModel,
00171                                    TetrahedralMesh<DIM,DIM>* pElectricsMesh,
00172                                    QuadraticMesh<DIM>* pMechanicsMesh,
00173                                    std::vector<unsigned> fixedMechanicsNodes,
00174                                    AbstractCardiacCellFactory<DIM>* pCellFactory,
00175                                    double endTime,
00176                                    double electricsPdeTimeStep,
00177                                    unsigned numElecTimeStepsPerMechTimestep,
00178                                    double contractionModelOdeTimeStep,
00179                                    std::string outputDirectory);
00180 
00189     virtual ~CardiacElectroMechanicsProblem();
00190 
00196     void Initialise();
00197 
00201     void Solve();
00202 
00207     double Max(std::vector<double>& vec);
00208 
00210     void SetNoElectricsOutput();
00211 
00222     void SetWatchedPosition(c_vector<double,DIM> watchedLocation);
00223 
00230     void SetVariableFibreSheetDirectionsFile(std::string orthoFile);
00231 
00233     std::vector<c_vector<double,DIM> >& rGetDeformedPosition();
00234 };
00235 
00236 
00237 
00238 #endif /*CARDIACELECTROMECHANICSPROBLEM_HPP_*/

Generated by  doxygen 1.6.2