00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "BasicMonodomainSolver.hpp"
00030
00031
00032
00033 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00034 void BasicMonodomainSolver<ELEMENT_DIM,SPACE_DIM>::SetupLinearSystem(Vec currentSolution, bool computeMatrix)
00035 {
00036 assert(this->mpLinearSystem->rGetLhsMatrix() != NULL);
00037 assert(this->mpLinearSystem->rGetRhsVector() != NULL);
00038 assert(currentSolution != NULL);
00039
00040
00041 if(!this->mpMonodomainAssembler)
00042 {
00043 this->mpMonodomainAssembler = new MonodomainAssembler<ELEMENT_DIM,SPACE_DIM>(this->mpMesh,this->mpMonodomainTissue,this->mDt,this->mNumQuadPoints);
00044 }
00045
00046
00047
00048 this->mpMonodomainAssembler->SetMatrixToAssemble(this->mpLinearSystem->rGetLhsMatrix());
00049 this->mpMonodomainAssembler->SetVectorToAssemble(this->mpLinearSystem->rGetRhsVector(), true);
00050 this->mpMonodomainAssembler->SetApplyNeummanBoundaryConditionsToVector(this->mpBoundaryConditions);
00051 this->mpMonodomainAssembler->SetCurrentSolution(currentSolution);
00052
00053 if(computeMatrix)
00054 {
00055 this->mpMonodomainAssembler->Assemble();
00056 }
00057 else
00058 {
00059 this->mpMonodomainAssembler->AssembleVector();
00060 }
00061
00062 this->mpLinearSystem->AssembleRhsVector();
00063 this->mpLinearSystem->AssembleFinalLhsMatrix();
00064 }
00065
00066
00067
00068
00069 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00070 BasicMonodomainSolver<ELEMENT_DIM,SPACE_DIM>::BasicMonodomainSolver(
00071 AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00072 MonodomainTissue<ELEMENT_DIM,SPACE_DIM>* pTissue,
00073 BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,1>* pBoundaryConditions,
00074 unsigned numQuadPoints)
00075 : AbstractMonodomainSolver<ELEMENT_DIM,SPACE_DIM>(pMesh,pTissue,pBoundaryConditions,numQuadPoints)
00076 {
00077
00078 pTissue->SetCacheReplication(true);
00079 }
00080
00081
00082
00083
00084
00085
00087
00089
00090 template class BasicMonodomainSolver<1,1>;
00091 template class BasicMonodomainSolver<1,2>;
00092 template class BasicMonodomainSolver<1,3>;
00093 template class BasicMonodomainSolver<2,2>;
00094 template class BasicMonodomainSolver<3,3>;
00095