AbstractBidomainSolver.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 #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 
00059     BidomainAssembler<ELEMENT_DIM,SPACE_DIM>* mpBidomainAssembler;
00060     
00065     unsigned mNumQuadPoints;
00066 
00068     bool mNullSpaceCreated;
00069 
00071     HeartConfig* mpConfig;
00072 
00076     std::vector<unsigned> mFixedExtracellularPotentialNodes;
00077 
00083     unsigned mRowForAverageOfPhiZeroed;
00084 
00091     void InitialiseForSolve(Vec initialSolution);
00092 
00104     virtual void CheckCompatibilityCondition();
00105 
00113     void PrepareForSetupLinearSystem(Vec existingSolution);
00114 
00131     virtual void FinaliseLinearSystem(Vec existingSolution);
00132 
00139     virtual Vec GenerateNullBasis() const;
00140 
00150     void FinaliseForBath(bool computeMatrix, bool computeVector);
00151 
00152 public:    
00162     AbstractBidomainSolver(bool bathSimulation,
00163                            AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00164                            BidomainTissue<SPACE_DIM>* pTissue,
00165                            BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,2>* pBoundaryConditions,
00166                            unsigned numQuadPoints = 2);
00167                        
00171     virtual ~AbstractBidomainSolver();
00172 
00183     void SetFixedExtracellularPotentialNodes(std::vector<unsigned> fixedExtracellularPotentialNodes);
00184 
00191      void SetRowForAverageOfPhiZeroed(unsigned rowMeanPhiEZero);
00192 
00196     BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,2>* GetBoundaryConditions()
00197     {
00198         return mpBoundaryConditions;
00199     }
00200 
00206     void ResetBoundaryConditionsContainer(BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,2>* pBcc)
00207     {
00208         assert(pBcc);
00209         mpBoundaryConditions = pBcc;
00210         // Note, we can't reset the bcc on the assembler (even if this
00211         // method was implemented in the concrete classes), as the assembler 
00212         // might not be created (eg when grounded electrodes are switched off).
00213         // Therefore we just reset our own copy. This means that
00214         // in SetupLinearSystem() 
00215         //   mpAssembler->SetApplyNeumannBcs(mpBcc) 
00216         // MUST be called every timestep, in case the bcc was reset. 
00217     }
00218 };
00219 
00220 
00221 
00222 
00223 #endif /*ABSTRACTBIDOMAINSOLVER_HPP_*/

Generated on Mon Nov 1 12:35:17 2010 for Chaste by  doxygen 1.5.5