36 #include "BidomainTissue.hpp"
38 #include "DistributedVector.hpp"
39 #include "AxisymmetricConductivityTensors.hpp"
40 #include "OrthotropicConductivityTensors.hpp"
41 #include "ChastePoint.hpp"
42 #include "AbstractChasteRegion.hpp"
44 template <
unsigned SPACE_DIM>
53 template <
unsigned SPACE_DIM>
60 template <
unsigned SPACE_DIM>
63 if (this->mpConfig->IsMeshProvided() && this->mpConfig->GetLoadMesh())
65 assert(this->mFibreFilePathNoExtension !=
"");
67 switch (this->mpConfig->GetConductivityMedia())
69 case cp::media_type::Orthotropic:
73 assert(ortho_file.
Exists());
74 mpExtracellularConductivityTensors->SetFibreOrientationFile(ortho_file);
78 case cp::media_type::Axisymmetric:
83 mpExtracellularConductivityTensors->SetFibreOrientationFile(axi_file);
87 case cp::media_type::NoFibreOrientation:
100 c_vector<double, SPACE_DIM> extra_conductivities;
101 this->mpConfig->GetExtracellularConductivities(extra_conductivities);
105 unsigned num_local_elements = this->mpMesh->GetNumLocalElements();
106 std::vector<c_vector<double, SPACE_DIM> > hetero_extra_conductivities;
108 if (this->mpConfig->GetConductivityHeterogeneitiesProvided())
112 assert(hetero_extra_conductivities.size()==0);
114 hetero_extra_conductivities.resize(num_local_elements, extra_conductivities);
116 catch(std::bad_alloc &r_bad_alloc)
118 #define COVERAGE_IGNORE
119 std::cout <<
"Failed to allocate std::vector of size " << num_local_elements << std::endl;
122 #undef COVERAGE_IGNORE
126 std::vector<boost::shared_ptr<AbstractChasteRegion<SPACE_DIM> > > conductivities_heterogeneity_areas;
127 std::vector< c_vector<double,3> > intra_h_conductivities;
128 std::vector< c_vector<double,3> > extra_h_conductivities;
130 intra_h_conductivities,
131 extra_h_conductivities);
133 unsigned local_element_index = 0;
136 iter != (this->mpMesh)->GetElementIteratorEnd();
141 for (
unsigned region_index=0; region_index< conductivities_heterogeneity_areas.size(); region_index++)
144 if ( conductivities_heterogeneity_areas[region_index]->DoesContain( element_centroid ) )
147 for (
unsigned i=0; i<SPACE_DIM; i++)
149 hetero_extra_conductivities[local_element_index][i] = extra_h_conductivities[region_index][i];
153 local_element_index++;
155 mpExtracellularConductivityTensors->SetNonConstantConductivities(&hetero_extra_conductivities);
159 mpExtracellularConductivityTensors->SetConstantConductivities(extra_conductivities);
162 mpExtracellularConductivityTensors->Init(this->mpMesh);
165 template <
unsigned SPACE_DIM>
168 if (mpExtracellularConductivityTensors)
170 delete mpExtracellularConductivityTensors;
175 template <
unsigned SPACE_DIM>
178 assert(mpExtracellularConductivityTensors);
179 if(this->mpConductivityModifier==NULL)
181 return (*mpExtracellularConductivityTensors)[elementIndex];
185 return this->mpConductivityModifier->rGetModifiedConductivityTensor(elementIndex, (*mpExtracellularConductivityTensors)[elementIndex], 1u);
BidomainTissue(AbstractCardiacCellFactory< SPACE_DIM > *pCellFactory, bool exchangeHalos=false)
void CreateExtracellularConductivityTensors()
void GetConductivityHeterogeneities(std::vector< boost::shared_ptr< AbstractChasteRegion< DIM > > > &conductivitiesHeterogeneityAreas, std::vector< c_vector< double, 3 > > &intraConductivities, std::vector< c_vector< double, 3 > > &extraConductivities) const
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
static HeartConfig * Instance()
const c_matrix< double, SPACE_DIM, SPACE_DIM > & rGetExtracellularConductivityTensor(unsigned elementIndex)