BidomainMatrixBasedAssembler.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 // NOTE: BidomainMatrixBasedAssembler is defined after BidomainRhsMatrixAssembler
00030 
00031 
00032 #ifndef _BIDOMAINMATRIXBASEDASSEMBLER_HPP_
00033 #define _BIDOMAINMATRIXBASEDASSEMBLER_HPP_
00034 
00035 #include "BidomainDg0Assembler.hpp"
00036 
00054 template<unsigned DIM>
00055 class BidomainRhsMatrixAssembler
00056     : public AbstractLinearAssembler<DIM, DIM, 2, false, BidomainRhsMatrixAssembler<DIM> >
00057 {
00058 public:
00059     static const unsigned E_DIM = DIM;
00060     static const unsigned S_DIM = DIM;
00061     static const unsigned P_DIM = 2u;
00062 
00063 public: 
00067     virtual c_matrix<double,2*(DIM+1),2*(DIM+1)> ComputeMatrixTerm(
00068         c_vector<double, DIM+1> &rPhi,
00069         c_matrix<double, DIM, DIM+1> &rGradPhi,
00070         ChastePoint<DIM> &rX,
00071         c_vector<double,2> &u,
00072         c_matrix<double,2,DIM> &rGradU /* not used */,
00073         Element<DIM,DIM>* pElement);
00074 
00079     virtual c_vector<double,2*(DIM+1)> ComputeVectorTerm(
00080         c_vector<double, DIM+1> &rPhi,
00081         c_matrix<double, DIM, DIM+1> &rGradPhi,
00082         ChastePoint<DIM> &rX,
00083         c_vector<double,2> &u,
00084         c_matrix<double, 2, DIM> &rGradU /* not used */,
00085         Element<DIM,DIM>* pElement);
00086 
00092     virtual c_vector<double, 2*DIM> ComputeVectorSurfaceTerm(
00093         const BoundaryElement<DIM-1,DIM> &rSurfaceElement,
00094         c_vector<double, DIM> &rPhi,
00095         ChastePoint<DIM> &rX );
00096 
00097 public:
00101     BidomainRhsMatrixAssembler(AbstractMesh<DIM,DIM>* pMesh);
00102 
00103     ~BidomainRhsMatrixAssembler();
00104     
00108     Mat* GetMatrix();
00109 };
00110 
00111 
00117 template<unsigned DIM>
00118 struct AssemblerTraits<BidomainRhsMatrixAssembler<DIM> >
00119 {
00120     typedef BidomainRhsMatrixAssembler<DIM> CVT_CLS;
00121     typedef BidomainRhsMatrixAssembler<DIM> CMT_CLS;
00122     typedef AbstractAssembler<DIM, DIM, 2> INTERPOLATE_CLS;
00123 };
00124 
00125 
00126 
00148 // IMPORTANT NOTE: the inheritance of BidomainMatrixBasedAssembler has to be 'virtual'
00149 // because BidomainDg0Assembler will be the top class in a 'dreaded diamond':
00150 //      A
00151 //     / \     A = BidomainDg0Assembler, B = BidomainWithBathAssembler,
00152 //    B   C    C = BidomainMatrixBasedAssembler, D = BidomainWithBathMatrixBasedAssembler
00153 //     \ /
00154 //      D
00155 //
00156 // B and C must use virtual inheritence of A in order for D to only contain 1 instance
00157 // of the member variables in A
00158  
00159 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00160 class BidomainMatrixBasedAssembler
00161     : public virtual BidomainDg0Assembler<ELEMENT_DIM, SPACE_DIM>
00162 {
00163 protected:
00164     BidomainRhsMatrixAssembler<SPACE_DIM>* mpBidomainRhsMatrixAssembler;
00165     
00166 public:
00170     BidomainMatrixBasedAssembler(AbstractMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00171                                  BidomainPde<SPACE_DIM>* pPde,
00172                                  BoundaryConditionsContainer<ELEMENT_DIM, SPACE_DIM, 2>* pBcc,
00173                                  unsigned numQuadPoints = 2);
00174 
00175     ~BidomainMatrixBasedAssembler();
00176     
00177 
00182     virtual void ConstructVectorForMatrixBasedRhsAssembly(Vec currentSolution);
00183 };
00184 
00191 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00192 struct AssemblerTraits<BidomainMatrixBasedAssembler<ELEMENT_DIM, SPACE_DIM> >
00193 {
00195     typedef BidomainDg0Assembler<ELEMENT_DIM, SPACE_DIM> CVT_CLS;
00197     typedef BidomainDg0Assembler<ELEMENT_DIM, SPACE_DIM> CMT_CLS;
00199     typedef BidomainDg0Assembler<ELEMENT_DIM, SPACE_DIM> INTERPOLATE_CLS;
00200 };
00201 
00202 #endif //_BIDOMAINMATRIXBASEDASSEMBLER_HPP_

Generated on Wed Mar 18 12:51:52 2009 for Chaste by  doxygen 1.5.5