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 #include "BidomainAssembler.hpp"
00036 
00042 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00043 class AbstractBidomainSolver : public AbstractDynamicLinearPdeSolver<ELEMENT_DIM,SPACE_DIM,2>
00044 {
00045 protected:    
00047     bool mBathSimulation;
00048 
00050     BidomainTissue<SPACE_DIM>* mpBidomainTissue;
00051 
00053     BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,2>* mpBoundaryConditions;
00054 
00060     BidomainAssembler<ELEMENT_DIM,SPACE_DIM>* mpBidomainAssembler;
00061     
00066     unsigned mNumQuadPoints;
00067 
00069     bool mNullSpaceCreated;
00070 
00072     HeartConfig* mpConfig;
00073 
00077     std::vector<unsigned> mFixedExtracellularPotentialNodes;
00078 
00084     unsigned mRowForAverageOfPhiZeroed;
00085 
00092     void InitialiseForSolve(Vec initialSolution);
00093 
00105     virtual void CheckCompatibilityCondition();
00106 
00114     void PrepareForSetupLinearSystem(Vec existingSolution);
00115 
00132     virtual void FinaliseLinearSystem(Vec existingSolution);
00133 
00140     virtual Vec GenerateNullBasis() const;
00141 
00155     void FinaliseForBath(bool computeMatrix, bool computeVector);
00156 
00157 public:    
00167     AbstractBidomainSolver(bool bathSimulation,
00168                            AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00169                            BidomainTissue<SPACE_DIM>* pTissue,
00170                            BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,2>* pBoundaryConditions,
00171                            unsigned numQuadPoints = 2);
00172                        
00176     virtual ~AbstractBidomainSolver();
00177 
00188     void SetFixedExtracellularPotentialNodes(std::vector<unsigned> fixedExtracellularPotentialNodes);
00189 
00196      void SetRowForAverageOfPhiZeroed(unsigned rowMeanPhiEZero);
00197 
00201     BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,2>* GetBoundaryConditions()
00202     {
00203         return mpBoundaryConditions;
00204     }
00205 
00211     void ResetBoundaryConditionsContainer(BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,2>* pBcc)
00212     {
00213         assert(pBcc);
00214         mpBoundaryConditions = pBcc;
00215         // Note, we can't reset the bcc on the assembler (even if this
00216         // method was implemented in the concrete classes), as the assembler 
00217         // might not be created (eg when grounded electrodes are switched off).
00218         // Therefore we just reset our own copy. This means that
00219         // in SetupLinearSystem() 
00220         //   mpAssembler->SetApplyNeumannBcs(mpBcc) 
00221         // MUST be called every timestep, in case the bcc was reset. 
00222     }
00223 };
00224 
00225 
00226 
00227 
00228 #endif /*ABSTRACTBIDOMAINSOLVER_HPP_*/

Generated on Mon Apr 18 11:35:28 2011 for Chaste by  doxygen 1.5.5