BidomainMatrixBasedAssembler.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 
00030 //
00031 //
00032 //
00033 //
00034 //   NOTE: The main class in this file, BidomainMatrixBasedAssembler, is defined at the
00035 //   bottom, after BidomainRhsMatrixAssembler
00036 //
00037 //
00038 //
00039 //
00040 //
00042 
00043 #ifndef _BIDOMAINMATRIXBASEDASSEMBLER_HPP_
00044 #define _BIDOMAINMATRIXBASEDASSEMBLER_HPP_
00045 
00046 #include "BidomainDg0Assembler.hpp"
00047 
00065 template<unsigned DIM>
00066 class BidomainRhsMatrixAssembler
00067     : public AbstractLinearAssembler<DIM, DIM, 2, false, BidomainRhsMatrixAssembler<DIM> >
00068 {
00069 public:
00070     static const unsigned E_DIM = DIM; 
00071     static const unsigned S_DIM = DIM; 
00072     static const unsigned P_DIM = 2u; 
00084     virtual c_matrix<double,2*(DIM+1),2*(DIM+1)> ComputeMatrixTerm(
00085         c_vector<double, DIM+1> &rPhi,
00086         c_matrix<double, DIM, DIM+1> &rGradPhi,
00087         ChastePoint<DIM> &rX,
00088         c_vector<double,2> &rU,
00089         c_matrix<double,2,DIM> &rGradU /* not used */,
00090         Element<DIM,DIM>* pElement);
00091 
00103     virtual c_vector<double,2*(DIM+1)> ComputeVectorTerm(
00104         c_vector<double, DIM+1> &rPhi,
00105         c_matrix<double, DIM, DIM+1> &rGradPhi,
00106         ChastePoint<DIM> &rX,
00107         c_vector<double,2> &u,
00108         c_matrix<double, 2, DIM> &rGradU /* not used */,
00109         Element<DIM,DIM>* pElement);
00110 
00120     virtual c_vector<double, 2*DIM> ComputeVectorSurfaceTerm(
00121         const BoundaryElement<DIM-1,DIM> &rSurfaceElement,
00122         c_vector<double, DIM> &rPhi,
00123         ChastePoint<DIM> &rX);
00124 
00129     BidomainRhsMatrixAssembler(AbstractTetrahedralMesh<DIM,DIM>* pMesh);
00130 
00134     ~BidomainRhsMatrixAssembler();
00135 
00139     Mat* GetMatrix();
00140 };
00141 
00142 
00148 template<unsigned DIM>
00149 struct AssemblerTraits<BidomainRhsMatrixAssembler<DIM> >
00150 {
00152     typedef BidomainRhsMatrixAssembler<DIM> CVT_CLASS;
00154     typedef BidomainRhsMatrixAssembler<DIM> CMT_CLASS;
00156     typedef AbstractAssembler<DIM, DIM, 2> INTERPOLATE_CLASS;
00157 };
00158 
00159 
00160 
00182 // IMPORTANT NOTE: the inheritance of BidomainMatrixBasedAssembler has to be 'virtual'
00183 // because BidomainDg0Assembler will be the top class in a 'dreaded diamond':
00184 //      A
00185 //     / \     A = BidomainDg0Assembler, B = BidomainWithBathAssembler,
00186 //    B   C    C = BidomainMatrixBasedAssembler, D = BidomainWithBathMatrixBasedAssembler
00187 //     \ /
00188 //      D
00189 //
00190 // B and C must use virtual inheritence of A in order for D to only contain 1 instance
00191 // of the member variables in A
00192 
00193 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00194 class BidomainMatrixBasedAssembler
00195     : public virtual BidomainDg0Assembler<ELEMENT_DIM, SPACE_DIM>
00196 {
00197 protected:
00199     BidomainRhsMatrixAssembler<SPACE_DIM>* mpBidomainRhsMatrixAssembler;
00200 
00201 public:
00202 
00211     BidomainMatrixBasedAssembler(AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00212                                  BidomainPde<SPACE_DIM>* pPde,
00213                                  BoundaryConditionsContainer<ELEMENT_DIM, SPACE_DIM, 2>* pBcc,
00214                                  unsigned numQuadPoints = 2);
00215 
00219     ~BidomainMatrixBasedAssembler();
00220 
00227     virtual void ConstructVectorForMatrixBasedRhsAssembly(Vec existingSolution);
00228 };
00229 
00236 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00237 struct AssemblerTraits<BidomainMatrixBasedAssembler<ELEMENT_DIM, SPACE_DIM> >
00238 {
00240     typedef BidomainDg0Assembler<ELEMENT_DIM, SPACE_DIM> CVT_CLASS;
00242     typedef BidomainDg0Assembler<ELEMENT_DIM, SPACE_DIM> CMT_CLASS;
00244     typedef BidomainDg0Assembler<ELEMENT_DIM, SPACE_DIM> INTERPOLATE_CLASS;
00245 };
00246 
00247 #endif //_BIDOMAINMATRIXBASEDASSEMBLER_HPP_

Generated by  doxygen 1.6.2