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
00030 #include "BidomainWithBathAssembler.hpp"
00031
00032 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00033 c_matrix<double,2*(ELEMENT_DIM+1),2*(ELEMENT_DIM+1)>
00034 BidomainWithBathAssembler<ELEMENT_DIM,SPACE_DIM>::ComputeMatrixTerm(
00035 c_vector<double, ELEMENT_DIM+1> &rPhi,
00036 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> &rGradPhi,
00037 ChastePoint<SPACE_DIM> &rX,
00038 c_vector<double,2> &rU,
00039 c_matrix<double, 2, SPACE_DIM> &rGradU ,
00040 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00041 {
00042 if (pElement->GetRegion() != HeartRegionCode::BATH)
00043 {
00044 return BidomainAssembler<ELEMENT_DIM,SPACE_DIM>::ComputeMatrixTerm(rPhi,rGradPhi,rX,rU,rGradU,pElement);
00045 }
00046 else
00047 {
00048 double bath_cond=HeartConfig::Instance()->GetBathConductivity();
00049
00050 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> grad_phi_sigma_b_grad_phi =
00051 bath_cond * prod(trans(rGradPhi), rGradPhi);
00052
00053 c_matrix<double,2*(ELEMENT_DIM+1),2*(ELEMENT_DIM+1)> ret = zero_matrix<double>(2*(ELEMENT_DIM+1));
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 matrix_slice<c_matrix<double, 2*ELEMENT_DIM+2, 2*ELEMENT_DIM+2> >
00072 slice11(ret, slice (1, 2, ELEMENT_DIM+1), slice (1, 2, ELEMENT_DIM+1));
00073 slice11 = grad_phi_sigma_b_grad_phi;
00074
00075 return ret;
00076 }
00077 }
00078
00079
00080 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00081 c_vector<double,2*(ELEMENT_DIM+1)>
00082 BidomainWithBathAssembler<ELEMENT_DIM,SPACE_DIM>::ComputeVectorTerm(
00083 c_vector<double, ELEMENT_DIM+1> &rPhi,
00084 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> &rGradPhi,
00085 ChastePoint<SPACE_DIM> &rX,
00086 c_vector<double,2> &rU,
00087 c_matrix<double, 2, SPACE_DIM> &rGradU ,
00088 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00089 {
00090 if (pElement->GetRegion() != HeartRegionCode::BATH)
00091 {
00092 return BidomainAssembler<ELEMENT_DIM,SPACE_DIM>::ComputeVectorTerm(rPhi,rGradPhi,rX,rU,rGradU,pElement);
00093 }
00094 else
00095 {
00096 return zero_vector<double>(2*(ELEMENT_DIM+1));
00097 }
00098 }
00099
00100
00102
00104
00105 template class BidomainWithBathAssembler<1,1>;
00106 template class BidomainWithBathAssembler<2,2>;
00107 template class BidomainWithBathAssembler<3,3>;