112 boost::shared_ptr<AbstractStimulusFunction> intracellularStimulus,
115 cp::ionic_model_selection_type ionic_model = mDefaultIonicModel;
117 for (
unsigned ionic_model_region_index = 0;
118 ionic_model_region_index < mIonicModelRegions.size();
119 ++ionic_model_region_index)
121 if (mIonicModelRegions[ionic_model_region_index]->DoesContain(this->GetMesh()->GetNode(nodeIndex)->GetPoint()))
123 ionic_model = mIonicModelsDefined[ionic_model_region_index];
130 if (ionic_model.Dynamic().present())
132#ifndef CHASTE_CAN_CHECKPOINT_DLLS
135 EXCEPTION(
"Checkpointing is not compatible with dynamically loaded cell models on Mac OS X.");
139 DynamicCellModelLoaderPtr p_loader = LoadDynamicModel(ionic_model,
false);
140 p_cell = p_loader->CreateCell(this->mpSolver, intracellularStimulus);
144 assert(ionic_model.Hardcoded().present());
145 switch(ionic_model.Hardcoded().get())
147 case(cp::ionic_models_available_type::LuoRudyI):
149 p_cell =
new CellLuoRudy1991FromCellML(this->mpSolver, intracellularStimulus);
153 case(cp::ionic_models_available_type::LuoRudyIBackwardEuler):
155 p_cell =
new CellLuoRudy1991FromCellMLBackwardEuler(this->mpSolver, intracellularStimulus);
159 case(cp::ionic_models_available_type::Fox2002):
161 p_cell =
new CellFoxModel2002FromCellML(this->mpSolver, intracellularStimulus);
165 case(cp::ionic_models_available_type::Fox2002BackwardEuler):
167 p_cell =
new CellFoxModel2002FromCellMLBackwardEuler(this->mpSolver, intracellularStimulus);
171 case(cp::ionic_models_available_type::DifrancescoNoble):
173 p_cell =
new CellDiFrancescoNoble1985FromCellML(this->mpSolver, intracellularStimulus);
177 case(cp::ionic_models_available_type::MahajanShiferaw):
179 p_cell =
new CellMahajan2008FromCellML(this->mpSolver, intracellularStimulus);
183 case(cp::ionic_models_available_type::MahajanShiferawBackwardEuler):
185 p_cell =
new CellMahajan2008FromCellMLBackwardEuler(this->mpSolver, intracellularStimulus);
189 case(cp::ionic_models_available_type::tenTusscher2006):
191 p_cell =
new CellTenTusscher2006EpiFromCellML(this->mpSolver, intracellularStimulus);
195 case(cp::ionic_models_available_type::tenTusscher2006BackwardEuler):
197 p_cell =
new CellTenTusscher2006EpiFromCellMLBackwardEuler(this->mpSolver, intracellularStimulus);
201 case(cp::ionic_models_available_type::Maleckar):
203 p_cell =
new CellMaleckar2008FromCellML(this->mpSolver, intracellularStimulus);
207 case(cp::ionic_models_available_type::HodgkinHuxley):
209 p_cell =
new CellHodgkinHuxley1952FromCellML(this->mpSolver, intracellularStimulus);
213 case(cp::ionic_models_available_type::FaberRudy2000):
215 p_cell =
new CellFaberRudy2000FromCellML(this->mpSolver, intracellularStimulus);
219 case(cp::ionic_models_available_type::FaberRudy2000Optimised):
221 p_cell =
new CellFaberRudy2000FromCellMLOpt(this->mpSolver, intracellularStimulus);
236 SetCellParameters(p_cell, nodeIndex);
254 for (
unsigned ht_index = 0;
255 ht_index < mCellHeterogeneityAreas.size();
258 if (mCellHeterogeneityAreas[ht_index]->DoesContain(this->GetMesh()->GetNode(nodeIndex)->GetPoint()))
262 pCell->
SetParameter(
"ScaleFactorGks", mScaleFactorGks[ht_index]);
263 pCell->
SetParameter(
"ScaleFactorGkr", mScaleFactorGkr[ht_index]);
264 pCell->
SetParameter(
"ScaleFactorIto", mScaleFactorIto[ht_index]);
278 for (std::map<std::string, std::pair<double, double> >::iterator it = ic50_values.begin();
279 it != ic50_values.end();
282 const std::string param_name = it->first +
"_conductance";
285 const double original_conductance = pCell->
GetParameter(param_name);
286 const double ic50 = it->second.first;
287 const double hill = it->second.second;
288 const double new_conductance = original_conductance/(1.0 + pow(drug_dose/ic50, hill));
293 WARNING(
"Cannot apply drug to cell at node " << nodeIndex <<
" as it has no parameter named '" << param_name <<
"'.");
299 for (
unsigned ht_index = 0;
300 ht_index < mCellHeterogeneityAreas.size();
303 if (mCellHeterogeneityAreas[ht_index]->DoesContain(this->GetMesh()->GetNode(nodeIndex)->GetPoint()))
305 for (std::map<std::string, double>::iterator param_it = mParameterSettings[ht_index].begin();
306 param_it != mParameterSettings[ht_index].end();
366 std::string epi_surface = mesh_file_name +
".epi";
367 std::string lv_surface = mesh_file_name +
".lv";
368 std::string rv_surface = mesh_file_name +
".rv";
380 info.DetermineLayerForEachNode(epi_fraction,endo_fraction);
382 std::vector<unsigned> heterogeneity_node_list;
383 for (
unsigned index=0; index<this->GetMesh()->GetNumNodes(); index++)
385 heterogeneity_node_list.push_back(info.rGetLayerForEachNode()[index]);
388 std::vector<Node<3u>*> epi_nodes;
389 std::vector<Node<3u>*> mid_nodes;
390 std::vector<Node<3u>*> endo_nodes;
393 for (
unsigned node_index = 0; node_index < this->GetMesh()->GetNumNodes(); node_index++)
395 if (this->GetMesh()->GetDistributedVectorFactory()->IsGlobalIndexLocal(node_index) )
397 switch (heterogeneity_node_list[node_index])
402 epi_nodes.push_back(this->GetMesh()->GetNode(node_index));
408 mid_nodes.push_back(this->GetMesh()->GetNode(node_index));
414 endo_nodes.push_back(this->GetMesh()->GetNode(node_index));
434 assert(user_supplied_epi_index<3);
435 assert(user_supplied_mid_index<3);
436 assert(user_supplied_endo_index<3);
439 std::vector<unsigned> user_supplied_indices;
440 user_supplied_indices.push_back(user_supplied_epi_index);
441 user_supplied_indices.push_back(user_supplied_mid_index);
442 user_supplied_indices.push_back(user_supplied_endo_index);
447 for (
unsigned layer_index=0; layer_index<3; layer_index++)
449 unsigned counter = 0;
451 for (
unsigned supplied_index = 0; supplied_index<user_supplied_indices.size(); supplied_index++)
453 if (user_supplied_indices[supplied_index] == layer_index)
475 assert(mCellHeterogeneityAreas.size()==3);
void GetCellHeterogeneities(std::vector< boost::shared_ptr< AbstractChasteRegion< DIM > > > &rCellHeterogeneityRegions, std::vector< double > &rScaleFactorGks, std::vector< double > &rScaleFactorIto, std::vector< double > &rScaleFactorGkr, std::vector< std::map< std::string, double > > *pParameterSettings)