AbstractBidomainSolver.hpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2011
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 #ifndef ABSTRACTBIDOMAINSOLVER_HPP_
00030 #define ABSTRACTBIDOMAINSOLVER_HPP_
00031 
00032 #include "AbstractDynamicLinearPdeSolver.hpp"
00033 #include "BidomainTissue.hpp"
00034 #include "HeartConfig.hpp"
00035 
00041 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00042 class AbstractBidomainSolver : public AbstractDynamicLinearPdeSolver<ELEMENT_DIM,SPACE_DIM,2>
00043 {
00044 protected:
00046     bool mBathSimulation;
00047 
00049     BidomainTissue<SPACE_DIM>* mpBidomainTissue;
00050 
00052     BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,2>* mpBoundaryConditions;
00053 
00058     unsigned mNumQuadPoints;
00059 
00061     bool mNullSpaceCreated;
00062 
00064     HeartConfig* mpConfig;
00065 
00069     std::vector<unsigned> mFixedExtracellularPotentialNodes;
00070 
00076     unsigned mRowForAverageOfPhiZeroed;
00077 
00084     void InitialiseForSolve(Vec initialSolution);
00085 
00097     virtual void CheckCompatibilityCondition();
00098 
00106     void PrepareForSetupLinearSystem(Vec existingSolution);
00107 
00124     virtual void FinaliseLinearSystem(Vec existingSolution);
00125 
00132     virtual Vec GenerateNullBasis() const;
00133 
00147     void FinaliseForBath(bool computeMatrix, bool computeVector);
00148 
00149 public:
00159     AbstractBidomainSolver(bool bathSimulation,
00160                            AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00161                            BidomainTissue<SPACE_DIM>* pTissue,
00162                            BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,2>* pBoundaryConditions,
00163                            unsigned numQuadPoints = 2);
00164 
00168     virtual ~AbstractBidomainSolver();
00169 
00180     void SetFixedExtracellularPotentialNodes(std::vector<unsigned> fixedExtracellularPotentialNodes);
00181 
00188      void SetRowForAverageOfPhiZeroed(unsigned rowMeanPhiEZero);
00189 
00193     BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,2>* GetBoundaryConditions()
00194     {
00195         return mpBoundaryConditions;
00196     }
00197 
00203     void ResetBoundaryConditionsContainer(BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,2>* pBcc)
00204     {
00205         assert(pBcc);
00206         mpBoundaryConditions = pBcc;
00207         // Note, in SetupLinearSystem()
00208         //   neumann_assembler->ResetBoundaryConditionsContainer(mpBcc)
00209         // MUST be called every timestep, in case the bcc was reset.
00210     }
00211 };
00212 
00213 
00214 
00215 
00216 #endif /*ABSTRACTBIDOMAINSOLVER_HPP_*/
Generated on Thu Dec 22 13:00:06 2011 for Chaste by  doxygen 1.6.3