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);
117 catch(std::bad_alloc &r_bad_alloc)
119 std::cout <<
"Failed to allocate std::vector of size " << num_local_elements << std::endl;
127 std::vector<boost::shared_ptr<AbstractChasteRegion<SPACE_DIM> > > conductivities_heterogeneity_areas;
128 std::vector< c_vector<double,3> > intra_h_conductivities;
129 std::vector< c_vector<double,3> > extra_h_conductivities;
131 intra_h_conductivities,
132 extra_h_conductivities);
134 unsigned local_element_index = 0;
137 iter != (this->mpMesh)->GetElementIteratorEnd();
142 for (
unsigned region_index=0; region_index< conductivities_heterogeneity_areas.size(); region_index++)
145 if (conductivities_heterogeneity_areas[region_index]->DoesContain(element_centroid))
148 for (
unsigned i=0; i<SPACE_DIM; i++)
150 hetero_extra_conductivities[local_element_index][i] = extra_h_conductivities[region_index][i];
154 local_element_index++;
156 mpExtracellularConductivityTensors->SetNonConstantConductivities(&hetero_extra_conductivities);
160 mpExtracellularConductivityTensors->SetConstantConductivities(extra_conductivities);
163 mpExtracellularConductivityTensors->Init(this->mpMesh);
166 template <
unsigned SPACE_DIM>
169 if (mpExtracellularConductivityTensors)
171 delete mpExtracellularConductivityTensors;
176 template <
unsigned SPACE_DIM>
179 assert(mpExtracellularConductivityTensors);
180 if (this->mpConductivityModifier==NULL)
182 return (*mpExtracellularConductivityTensors)[elementIndex];
186 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)