41 #include "HeartConfig.hpp" 42 #include "ArchiveLocationInfo.hpp" 43 #include "OutputFileHandler.hpp" 45 #include "ChastePoint.hpp" 46 #include "Version.hpp" 47 #include "AbstractChasteRegion.hpp" 48 #include "HeartFileFinder.hpp" 49 #include "Warnings.hpp" 51 #include "HeartRegionCodes.hpp" 53 #include "SimpleStimulus.hpp" 54 #include "RegularStimulus.hpp" 62 #include "XmlTools.hpp" 63 #include <xsd/cxx/tree/exceptions.hxx> 67 #if (XSD_INT_VERSION >= 3000000L) 68 #define XSD_SEQUENCE_TYPE(base) base##_sequence 69 #define XSD_ITERATOR_TYPE(base) base##_iterator 70 #define XSD_NESTED_TYPE(t) t##_type 71 #define XSD_ANON_TYPE(t1, t2) \ 74 #define XSD_SEQUENCE_TYPE(base) base::container 75 #define XSD_ITERATOR_TYPE(base) base::iterator 76 #define XSD_NESTED_TYPE(t) t::type 77 #define XSD_ANON_TYPE(t1, t2) \ 78 t1::t2::_xsd_##t2##_::t2 82 #define XSD_ANON_SEQUENCE_TYPE(t1, t2, t3) \ 83 XSD_SEQUENCE_TYPE(XSD_ANON_TYPE(t1, t2)::t3) 84 #define XSD_ANON_ITERATOR_TYPE(t1, t2, t3) \ 85 XSD_ITERATOR_TYPE(XSD_ANON_TYPE(t1, t2)::t3) 88 #if (XSD_INT_VERSION >= 3020000L) 89 #define XSD_CREATE_WITH_FIXED_ATTR(type, name, attr) \ 91 #define XSD_CREATE_WITH_FIXED_ATTR1(type, name, arg1, attr) \ 93 #define XSD_CREATE_WITH_FIXED_ATTR2(type, name, arg1, arg2, attr) \ 95 #define XSD_CREATE_WITH_FIXED_ATTR3(type, name, arg1, arg2, arg3, attr) \ 96 type name(arg1, arg2, arg3) 98 #define XSD_CREATE_WITH_FIXED_ATTR(type, name, attr) \ 100 #define XSD_CREATE_WITH_FIXED_ATTR1(type, name, arg1, attr) \ 101 type name(arg1, attr) 102 #define XSD_CREATE_WITH_FIXED_ATTR2(type, name, arg1, arg2, attr) \ 103 type name(arg1, arg2, attr) 104 #define XSD_CREATE_WITH_FIXED_ATTR3(type, name, arg1, arg2, arg3, attr) \ 105 type name(arg1, arg2, arg3, attr) 111 #define ENSURE_SECTION_PRESENT(location, type) \ 112 if (!location.present()) \ 115 location.set(empty_item); \ 118 #include <boost/current_function.hpp> 126 #define CHECK_EXISTS(test, path) \ 129 EXCEPTION("No XML element " << path << " found in parameters when calling '" \ 130 << BOOST_CURRENT_FUNCTION << "'"); \ 148 static void TransformIonicModelDefinitions(xercesc::DOMDocument* pDocument,
149 xercesc::DOMElement* pRootElement);
159 static void TransformArchiveDirectory(xercesc::DOMDocument* pDocument,
160 xercesc::DOMElement* pRootElement);
169 static void CheckForIluPreconditioner(xercesc::DOMDocument* pDocument,
170 xercesc::DOMElement* pRootElement);
179 static void MoveConductivityHeterogeneities(xercesc::DOMDocument* pDocument,
180 xercesc::DOMElement* pRootElement);
189 static void SetDefaultVisualizer(xercesc::DOMDocument* pDocument,
190 xercesc::DOMElement* pRootElement);
209 if (mpInstance.get() == NULL)
213 return mpInstance.get();
217 : mUseMassLumping(false),
218 mUseMassLumpingForPrecond(false),
219 mUseFixedNumberIterations(false),
220 mEvaluateNumItsEveryNSolves(UINT_MAX)
256 std::string output_dirname;
257 if (useArchiveLocationInfo)
276 out_stream p_parameters_file(
new std::ofstream( (output_dirname+
"ChasteParameters.xml").c_str() ) );
278 if (!p_parameters_file->is_open())
280 EXCEPTION(
"Could not open XML file in HeartConfig");
285 ::xml_schema::namespace_infomap map;
287 map[
""].schema =
"ChasteParameters_1_1.xsd";
289 map[
"cp20"].name =
"https://chaste.comlab.ox.ac.uk/nss/parameters/2_0";
290 map[
"cp20"].schema =
"ChasteParameters_2_0.xsd";
291 map[
"cp21"].name =
"https://chaste.comlab.ox.ac.uk/nss/parameters/2_1";
292 map[
"cp21"].schema =
"ChasteParameters_2_1.xsd";
293 map[
"cp22"].name =
"https://chaste.comlab.ox.ac.uk/nss/parameters/2_2";
294 map[
"cp22"].schema =
"ChasteParameters_2_2.xsd";
295 map[
"cp23"].name =
"https://chaste.comlab.ox.ac.uk/nss/parameters/2_3";
296 map[
"cp23"].schema =
"ChasteParameters_2_3.xsd";
297 map[
"cp30"].name =
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_0";
298 map[
"cp30"].schema =
"ChasteParameters_3_0.xsd";
299 map[
"cp31"].name =
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_1";
300 map[
"cp31"].schema =
"ChasteParameters_3_1.xsd";
301 map[
"cp33"].name =
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_3";
302 map[
"cp33"].schema =
"ChasteParameters_3_3.xsd";
303 map[
"cp34"].name =
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_4";
304 map[
"cp34"].schema =
"ChasteParameters_3_4.xsd";
307 map[
"cp"].name =
"https://chaste.comlab.ox.ac.uk/nss/parameters/2017_1";
308 map[
"cp"].schema =
"ChasteParameters_2017_1.xsd";
310 cp::ChasteParameters(*p_parameters_file, *
mpParameters, map);
313 if (useArchiveLocationInfo)
332 boost::shared_ptr<cp::chaste_parameters_type> p_new_parameters =
mpParameters;
348 if (
FileFinder(defaults_filename_xml).Exists())
350 boost::shared_ptr<cp::chaste_parameters_type> p_defaults =
ReadFile(defaults_filename_xml);
357 if (p_new_parameters->ResumeSimulation().present())
371 std::string schema_name(
"ChasteParameters_2017_1.xsd");
373 if (!schema_location.
Exists())
377 if (!schema_location.
Exists())
380 std::string message(
"Unable to locate schema file " + schema_name +
381 ". You will need to ensure it is available when resuming from the checkpoint.");
382 WARN_ONCE_ONLY(message);
385 if (schema_location.
Exists())
388 schema_location.
CopyTo(output_directory);
400 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/2_0"] = root_dir +
"ChasteParameters_2_0.xsd";
401 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/2_1"] = root_dir +
"ChasteParameters_2_1.xsd";
402 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/2_2"] = root_dir +
"ChasteParameters_2_2.xsd";
403 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/2_3"] = root_dir +
"ChasteParameters_2_3.xsd";
404 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_0"] = root_dir +
"ChasteParameters_3_0.xsd";
405 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_1"] = root_dir +
"ChasteParameters_3_1.xsd";
406 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_3"] = root_dir +
"ChasteParameters_3_3.xsd";
407 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_4"] = root_dir +
"ChasteParameters_3_4.xsd";
408 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/2017_1"] = root_dir +
"ChasteParameters_2017_1.xsd";
413 unsigned version_major = 0;
414 unsigned version_minor = 0;
415 if (rNamespaceUri ==
"")
422 std::string uri_base(
"https://chaste.comlab.ox.ac.uk/nss/parameters/");
423 if (rNamespaceUri.substr(0, uri_base.length()) == uri_base)
425 std::istringstream version_string(rNamespaceUri.substr(uri_base.length()));
426 version_string >> version_major;
427 version_string.ignore(1);
428 version_string >> version_minor;
429 if (version_string.fail())
437 unsigned version = version_major * 1000 + version_minor;
440 EXCEPTION(rNamespaceUri +
" is not a recognised Chaste parameters namespace.");
459 ::xml_schema::properties props;
486 xercesc::DOMElement* p_root_elt = p_doc->getDocumentElement();
487 std::string namespace_uri(X2C(p_root_elt->getNamespaceURI()));
510 if (version < 2017001)
515 boost::shared_ptr<cp::chaste_parameters_type> p_params(cp::ChasteParameters(*p_doc, ::xml_schema::flags::dont_initialize, props));
519 return boost::shared_ptr<cp::chaste_parameters_type>(p_params);
521 catch (
const xml_schema::exception& e)
523 std::cerr << e << std::endl;
526 EXCEPTION(
"XML parsing error in configuration file: " + rFileName);
559 EXCEPTION(
"Problem type and space dimension should match when restarting a simulation.");
566 if (pResumeParameters->ResumeSimulation()->Stimuli().present())
568 mpParameters->Simulation()->Stimuli().set(pResumeParameters->ResumeSimulation()->Stimuli().get());
573 if (pResumeParameters->ResumeSimulation()->CellHeterogeneities().present())
575 if (!
mpParameters->Simulation()->CellHeterogeneities().present())
578 mpParameters->Simulation()->CellHeterogeneities().set(pResumeParameters->ResumeSimulation()->CellHeterogeneities().get());
583 XSD_SEQUENCE_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity)&
584 new_seq = pResumeParameters->ResumeSimulation()->CellHeterogeneities()->CellHeterogeneity();
585 XSD_SEQUENCE_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity)&
586 orig_seq =
mpParameters->Simulation()->CellHeterogeneities()->CellHeterogeneity();
587 for (XSD_ITERATOR_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity) i = new_seq.begin();
591 orig_seq.push_back(*i);
597 if (pResumeParameters->ResumeSimulation()->CheckpointSimulation().present())
600 pResumeParameters->ResumeSimulation()->CheckpointSimulation()->timestep(),
601 pResumeParameters->ResumeSimulation()->CheckpointSimulation()->max_checkpoints_on_disk());
605 if (pResumeParameters->ResumeSimulation()->OutputVisualizer().present())
615 cp::numerical_type& r_resume = pResumeParameters->Numerical();
617 if (r_resume.TimeSteps().present())
619 r_user.TimeSteps().set(r_resume.TimeSteps().get());
621 if (r_resume.KSPTolerances().present())
623 r_user.KSPTolerances().set(r_resume.KSPTolerances().get());
625 if (r_resume.KSPSolver().present())
627 r_user.KSPSolver().set(r_resume.KSPSolver().get());
629 if (r_resume.KSPPreconditioner().present())
631 r_user.KSPPreconditioner().set(r_resume.KSPPreconditioner().get());
633 if (r_resume.AdaptivityParameters().present())
635 r_user.AdaptivityParameters().set(r_resume.AdaptivityParameters().get());
640 if (pResumeParameters->PostProcessing().present())
643 cp::postprocessing_type& r_resume = pResumeParameters->PostProcessing().get();
644 cp::postprocessing_type& r_user =
mpParameters->PostProcessing().get();
645 if (!r_resume.ActionPotentialDurationMap().empty())
647 r_user.ActionPotentialDurationMap() = r_resume.ActionPotentialDurationMap();
649 if (!r_resume.UpstrokeTimeMap().empty())
651 r_user.UpstrokeTimeMap() = r_resume.UpstrokeTimeMap();
653 if (!r_resume.MaxUpstrokeVelocityMap().empty())
655 r_user.MaxUpstrokeVelocityMap() = r_resume.MaxUpstrokeVelocityMap();
657 if (!r_resume.ConductionVelocityMap().empty())
659 r_user.ConductionVelocityMap() = r_resume.ConductionVelocityMap();
688 EXCEPTION(callingMethod +
" information is not available in a resumed simulation.");
696 EXCEPTION(callingMethod +
" information is not available in a standard (non-resumed) simulation.");
704 CHECK_EXISTS(
mpParameters->Simulation()->SpaceDimension().present(),
"Simulation/SpaceDimension");
705 return mpParameters->Simulation()->SpaceDimension().get();
709 return mpParameters->ResumeSimulation()->SpaceDimension();
717 CHECK_EXISTS(
mpParameters->Simulation()->SimulationDuration().present(),
"Simulation/SimulationDuration");
718 return mpParameters->Simulation()->SimulationDuration().get();
722 return mpParameters->ResumeSimulation()->SimulationDuration();
730 CHECK_EXISTS(
mpParameters->Simulation()->Domain().present(),
"Simulation/Domain");
743 return mpParameters->Simulation()->IonicModels()->Default();
746 template<
unsigned DIM>
748 std::vector<cp::ionic_model_selection_type>& ionicModels)
const 751 definedRegions.clear();
754 XSD_SEQUENCE_TYPE(cp::ionic_models_type::Region)&
755 regions =
mpParameters->Simulation()->IonicModels()->Region();
757 for (XSD_ITERATOR_TYPE(cp::ionic_models_type::Region) i = regions.begin();
761 cp::ionic_model_region_type ionic_model_region(*i);
763 if (ionic_model_region.Location().Cuboid().present() || ionic_model_region.Location().Ellipsoid().present())
765 if (ionic_model_region.Location().Cuboid().present())
767 cp::point_type point_a = ionic_model_region.Location().Cuboid()->LowerCoordinates();
768 cp::point_type point_b = ionic_model_region.Location().Cuboid()->UpperCoordinates();
798 else if (ionic_model_region.Location().Ellipsoid().present())
800 cp::point_type centre = ionic_model_region.Location().Ellipsoid()->Centre();
801 cp::point_type radii = ionic_model_region.Location().Ellipsoid()->Radii();
837 ionicModels.push_back(ionic_model_region.IonicModel());
839 else if (ionic_model_region.Location().EpiLayer().present() || ionic_model_region.Location().MidLayer().present() || ionic_model_region.Location().EndoLayer().present() )
842 EXCEPTION(
"Definition of transmural layers is not yet supported for defining different ionic models, please use cuboids instead");
846 EXCEPTION(
"Invalid region type for ionic model definition");
862 return (mesh.Slab().present() || mesh.Sheet().present() || mesh.Fibre().present());
870 return (mesh.Slab().present());
878 return (mesh.Sheet().present());
886 return (mesh.Fibre().present());
894 return (
mpParameters->Simulation()->Mesh()->LoadMesh().present());
903 EXCEPTION(
"Tissue slabs can only be defined in 3D");
906 optional<cp::slab_type, false> slab_dimensions =
mpParameters->Simulation()->Mesh()->Slab();
908 slabDimensions[0] = slab_dimensions->x();
909 slabDimensions[1] = slab_dimensions->y();
910 slabDimensions[2] = slab_dimensions->z();
919 EXCEPTION(
"Tissue sheets can only be defined in 2D");
922 optional<cp::sheet_type, false> sheet_dimensions =
mpParameters->Simulation()->Mesh()->Sheet();
924 sheetDimensions[0] = sheet_dimensions->x();
925 sheetDimensions[1] = sheet_dimensions->y();
934 EXCEPTION(
"Tissue fibres can only be defined in 1D");
937 optional<cp::fibre_type, false> fibre_length =
mpParameters->Simulation()->Mesh()->Fibre();
939 fibreLength[0] = fibre_length->x();
950 return mpParameters->Simulation()->Mesh()->Slab()->inter_node_space();
954 return mpParameters->Simulation()->Mesh()->Sheet()->inter_node_space();
958 return mpParameters->Simulation()->Mesh()->Fibre()->inter_node_space();
973 return mpParameters->Simulation()->Mesh()->LoadMesh()->name();
981 return mpParameters->Simulation()->Mesh()->LoadMesh()->conductivity_media();
984 template <
unsigned DIM>
997 XSD_SEQUENCE_TYPE(cp::stimuli_type::Stimulus) stimuli =
mpParameters->Simulation()->Stimuli()->Stimulus();
999 for (XSD_ITERATOR_TYPE(cp::stimuli_type::Stimulus) i = stimuli.begin();
1003 cp::stimulus_type stimulus(*i);
1004 if (stimulus.Location().Cuboid().present() || stimulus.Location().Ellipsoid().present())
1006 boost::shared_ptr<AbstractChasteRegion<DIM> > area_ptr;
1007 if (stimulus.Location().Cuboid().present() )
1009 cp::point_type point_a = stimulus.Location().Cuboid()->LowerCoordinates();
1010 cp::point_type point_b = stimulus.Location().Cuboid()->UpperCoordinates();
1039 else if (stimulus.Location().Ellipsoid().present())
1041 cp::point_type centre = stimulus.Location().Ellipsoid()->Centre();
1042 cp::point_type radii = stimulus.Location().Ellipsoid()->Radii();
1073 rStimulatedAreas.push_back(area_ptr);
1075 boost::shared_ptr<AbstractStimulusFunction> stim;
1077 if (stimulus.Period().present())
1079 if (stimulus.StopTime().present())
1082 stimulus.Duration(),
1083 stimulus.Period().get(),
1085 stimulus.StopTime().get()));
1090 stimulus.Duration(),
1091 stimulus.Period().get(),
1098 if (stimulus.StopTime().present())
1100 EXCEPTION(
"Stop time can not be defined for SimpleStimulus. Use Duration instead.");
1104 stimulus.Duration(),
1107 rStimuliApplied.push_back( stim );
1109 else if (stimulus.Location().EpiLayer().present() || stimulus.Location().MidLayer().present() || stimulus.Location().EndoLayer().present() )
1111 EXCEPTION(
"Definition of transmural layers is not yet supported for specifying stimulated areas, please use cuboids instead");
1115 EXCEPTION(
"Invalid region type for stimulus definition");
1120 template<
unsigned DIM>
1122 std::vector<double>& rScaleFactorGks,
1123 std::vector<double>& rScaleFactorIto,
1124 std::vector<double>& rScaleFactorGkr,
1125 std::vector<std::map<std::string, double> >* pParameterSettings)
1129 if (!
mpParameters->Simulation()->CellHeterogeneities().present())
1134 XSD_SEQUENCE_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity) cell_heterogeneity
1135 =
mpParameters->Simulation()->CellHeterogeneities()->CellHeterogeneity();
1137 bool user_supplied_negative_value =
false;
1139 bool user_asked_for_cuboids_or_ellipsoids =
false;
1140 unsigned counter_of_heterogeneities = 0;
1142 for (XSD_ITERATOR_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity) i = cell_heterogeneity.begin();
1143 i != cell_heterogeneity.end();
1146 cp::cell_heterogeneity_type ht(*i);
1148 if (ht.Location().Cuboid().present())
1150 user_asked_for_cuboids_or_ellipsoids =
true;
1151 cp::point_type point_a = ht.Location().Cuboid()->LowerCoordinates();
1152 cp::point_type point_b = ht.Location().Cuboid()->UpperCoordinates();
1159 else if (ht.Location().Ellipsoid().present())
1161 user_asked_for_cuboids_or_ellipsoids =
true;
1162 cp::point_type centre = ht.Location().Ellipsoid()->Centre();
1163 cp::point_type radii = ht.Location().Ellipsoid()->Radii();
1169 else if (ht.Location().EpiLayer().present())
1176 user_supplied_negative_value=
true;
1180 else if (ht.Location().EndoLayer().present())
1187 user_supplied_negative_value=
true;
1191 else if (ht.Location().MidLayer().present())
1198 user_supplied_negative_value=
true;
1204 EXCEPTION(
"Invalid region type for cell heterogeneity definition");
1208 rScaleFactorGks.push_back(ht.ScaleFactorGks().present() ? (
double)ht.ScaleFactorGks().get() : 1.0);
1209 rScaleFactorIto.push_back(ht.ScaleFactorIto().present() ? (
double)ht.ScaleFactorIto().get() : 1.0);
1210 rScaleFactorGkr.push_back(ht.ScaleFactorGkr().present() ? (
double)ht.ScaleFactorGkr().get() : 1.0);
1213 if (pParameterSettings)
1215 std::map<std::string, double> param_settings;
1216 XSD_SEQUENCE_TYPE(cp::cell_heterogeneity_type::SetParameter)& params = ht.SetParameter();
1217 for (XSD_ITERATOR_TYPE(cp::cell_heterogeneity_type::SetParameter) param_it = params.begin();
1218 param_it != params.end();
1221 cp::set_parameter_type param(*param_it);
1222 param_settings[param.name()] = param.value();
1224 pParameterSettings->push_back(param_settings);
1227 counter_of_heterogeneities++;
1233 if (user_asked_for_cuboids_or_ellipsoids )
1235 EXCEPTION (
"Specification of cellular heterogeneities by cuboids/ellipsoids and layers at the same time is not yet supported");
1243 EXCEPTION (
"Three specifications of layers must be supplied");
1247 EXCEPTION (
"Summation of epicardial, midmyocardial and endocardial fractions should be 1");
1249 if (user_supplied_negative_value)
1251 EXCEPTION (
"Fractions must be positive");
1294 return mpParameters->Physiological().ConductivityHeterogeneities().present();
1297 template<
unsigned DIM>
1300 std::vector< c_vector<double,3> >& rIntraConductivities,
1301 std::vector< c_vector<double,3> >& rExtraConductivities)
const 1305 XSD_ANON_SEQUENCE_TYPE(cp::physiological_type, ConductivityHeterogeneities, ConductivityHeterogeneity)&
1306 conductivity_heterogeneity =
mpParameters->Physiological().ConductivityHeterogeneities()->ConductivityHeterogeneity();
1308 for (XSD_ANON_ITERATOR_TYPE(cp::physiological_type, ConductivityHeterogeneities, ConductivityHeterogeneity) i = conductivity_heterogeneity.begin();
1309 i != conductivity_heterogeneity.end();
1312 cp::conductivity_heterogeneity_type ht(*i);
1314 if (ht.Location().Cuboid().present())
1316 cp::point_type point_a = ht.Location().Cuboid()->LowerCoordinates();
1317 cp::point_type point_b = ht.Location().Cuboid()->UpperCoordinates();
1322 else if (ht.Location().Ellipsoid().present())
1324 cp::point_type centre = ht.Location().Ellipsoid()->Centre();
1325 cp::point_type radii = ht.Location().Ellipsoid()->Radii();
1330 else if (ht.Location().EpiLayer().present() || ht.Location().MidLayer().present() || ht.Location().EndoLayer().present() )
1333 EXCEPTION(
"Definition of transmural layers is not allowed for conductivities heterogeneities, you may use fibre orientation support instead");
1337 EXCEPTION(
"Invalid region type for conductivity definition");
1340 if (ht.IntracellularConductivities().present())
1342 double intra_x = ht.IntracellularConductivities()->longi();
1343 double intra_y = ht.IntracellularConductivities()->trans();
1344 double intra_z = ht.IntracellularConductivities()->normal();
1346 rIntraConductivities.push_back(
Create_c_vector(intra_x, intra_y, intra_z) );
1350 c_vector<double, 3> intra_conductivities;
1352 rIntraConductivities.push_back(intra_conductivities);
1355 if (ht.ExtracellularConductivities().present())
1357 double extra_x = ht.ExtracellularConductivities()->longi();
1358 double extra_y = ht.ExtracellularConductivities()->trans();
1359 double extra_z = ht.ExtracellularConductivities()->normal();
1361 rExtraConductivities.push_back(
Create_c_vector(extra_x, extra_y, extra_z) );
1365 c_vector<double, 3> extra_conductivities;
1367 rExtraConductivities.push_back(extra_conductivities);
1375 CHECK_EXISTS(
mpParameters->Simulation()->OutputDirectory().present(),
"Simulation/OutputDirectory");
1376 return mpParameters->Simulation()->OutputDirectory().get();
1382 CHECK_EXISTS(
mpParameters->Simulation()->OutputFilenamePrefix().present(),
"Simulation/OutputFilenamePrefix");
1383 return mpParameters->Simulation()->OutputFilenamePrefix().get();
1389 return mpParameters->Simulation()->OutputVariables().present();
1395 XSD_SEQUENCE_TYPE(cp::output_variables_type::Var)&
1396 output_variables =
mpParameters->Simulation()->OutputVariables()->Var();
1397 rOutputVariables.clear();
1399 for (XSD_ITERATOR_TYPE(cp::output_variables_type::Var) i = output_variables.begin();
1400 i != output_variables.end();
1403 cp::var_type& r_var(*i);
1406 rOutputVariables.push_back(r_var.name());
1413 bool result =
false;
1414 if (
mpParameters->Simulation()->OutputUsingOriginalNodeOrdering().present())
1416 result = (
mpParameters->Simulation()->OutputUsingOriginalNodeOrdering().get() == cp::yesno_type::yes);
1429 return mpParameters->Simulation()->CheckpointSimulation()->timestep();
1435 return mpParameters->Simulation()->CheckpointSimulation()->max_checkpoints_on_disk();
1449 CHECK_EXISTS(
mpParameters->Physiological().IntracellularConductivities().present(),
"Physiological/IntracellularConductivities");
1450 cp::conductivities_type intra_conductivities
1451 =
mpParameters->Physiological().IntracellularConductivities().get();
1452 double intra_x_cond = intra_conductivities.longi();
1453 double intra_y_cond = intra_conductivities.trans();
1454 double intra_z_cond = intra_conductivities.normal();;
1456 assert(intra_y_cond != DBL_MAX);
1457 assert(intra_z_cond != DBL_MAX);
1459 rIntraConductivities[0] = intra_x_cond;
1460 rIntraConductivities[1] = intra_y_cond;
1461 rIntraConductivities[2] = intra_z_cond;
1466 CHECK_EXISTS(
mpParameters->Physiological().IntracellularConductivities().present(),
"Physiological/IntracellularConductivities");
1467 cp::conductivities_type intra_conductivities
1468 =
mpParameters->Physiological().IntracellularConductivities().get();
1469 double intra_x_cond = intra_conductivities.longi();
1470 double intra_y_cond = intra_conductivities.trans();
1472 assert(intra_y_cond != DBL_MAX);
1474 rIntraConductivities[0] = intra_x_cond;
1475 rIntraConductivities[1] = intra_y_cond;
1480 CHECK_EXISTS(
mpParameters->Physiological().IntracellularConductivities().present(),
"Physiological/IntracellularConductivities");
1481 cp::conductivities_type intra_conductivities
1482 =
mpParameters->Physiological().IntracellularConductivities().get();
1483 double intra_x_cond = intra_conductivities.longi();
1485 rIntraConductivities[0] = intra_x_cond;
1490 CHECK_EXISTS(
mpParameters->Physiological().ExtracellularConductivities().present(),
"Physiological/ExtracellularConductivities");
1491 cp::conductivities_type extra_conductivities
1492 =
mpParameters->Physiological().ExtracellularConductivities().get();
1493 double extra_x_cond = extra_conductivities.longi();
1494 double extra_y_cond = extra_conductivities.trans();
1495 double extra_z_cond = extra_conductivities.normal();;
1497 assert(extra_y_cond != DBL_MAX);
1498 assert(extra_z_cond != DBL_MAX);
1500 rExtraConductivities[0] = extra_x_cond;
1501 rExtraConductivities[1] = extra_y_cond;
1502 rExtraConductivities[2] = extra_z_cond;
1507 CHECK_EXISTS(
mpParameters->Physiological().ExtracellularConductivities().present(),
"Physiological/ExtracellularConductivities");
1508 cp::conductivities_type extra_conductivities
1509 =
mpParameters->Physiological().ExtracellularConductivities().get();
1510 double extra_x_cond = extra_conductivities.longi();
1511 double extra_y_cond = extra_conductivities.trans();
1513 assert(extra_y_cond != DBL_MAX);
1515 rExtraConductivities[0] = extra_x_cond;
1516 rExtraConductivities[1] = extra_y_cond;
1521 CHECK_EXISTS(
mpParameters->Physiological().ExtracellularConductivities().present(),
"Physiological/ExtracellularConductivities");
1522 cp::conductivities_type extra_conductivities
1523 =
mpParameters->Physiological().ExtracellularConductivities().get();
1524 double extra_x_cond = extra_conductivities.longi();
1526 rExtraConductivities[0] = extra_x_cond;
1540 if (bathRegion == UINT_MAX)
1543 CHECK_EXISTS(
mpParameters->Physiological().BathConductivity().present(),
"Physiological/BathConductivity");
1544 return mpParameters->Physiological().BathConductivity().get();
1550 std::map<unsigned, double>::const_iterator map_entry =
mBathConductivities.find(bathRegion);
1554 return map_entry->second;
1559 CHECK_EXISTS(
mpParameters->Physiological().BathConductivity().present(),
"Physiological/BathConductivity");
1560 return mpParameters->Physiological().BathConductivity().get();
1576 CHECK_EXISTS(
mpParameters->Physiological().SurfaceAreaToVolumeRatio().present(),
"Physiological/SurfaceAreaToVolumeRatio");
1577 return mpParameters->Physiological().SurfaceAreaToVolumeRatio().get();
1582 CHECK_EXISTS(
mpParameters->Physiological().Capacitance().present(),
"Physiological/Capacitance");
1583 return mpParameters->Physiological().Capacitance().get();
1588 CHECK_EXISTS(
mpParameters->Numerical().TimeSteps().present(),
"Numerical/TimeSteps");
1594 CHECK_EXISTS(
mpParameters->Numerical().TimeSteps().present(),
"Numerical/TimeSteps");
1600 CHECK_EXISTS(
mpParameters->Numerical().TimeSteps().present(),
"Numerical/TimeSteps");
1601 return mpParameters->Numerical().TimeSteps()->printing();
1606 CHECK_EXISTS(
mpParameters->Numerical().KSPTolerances().present(),
"Numerical/KSPTolerances");
1607 return mpParameters->Numerical().KSPTolerances()->KSPAbsolute().present();
1612 CHECK_EXISTS(
mpParameters->Numerical().KSPTolerances().present(),
"Numerical/KSPTolerances");
1615 EXCEPTION(
"Absolute tolerance is not set in Chaste parameters");
1617 return mpParameters->Numerical().KSPTolerances()->KSPAbsolute().get();
1622 CHECK_EXISTS(
mpParameters->Numerical().KSPTolerances().present(),
"Numerical/KSPTolerances");
1623 return mpParameters->Numerical().KSPTolerances()->KSPRelative().present();
1628 CHECK_EXISTS(
mpParameters->Numerical().KSPTolerances().present(),
"Numerical/KSPTolerances");
1631 EXCEPTION(
"Relative tolerance is not set in Chaste parameters");
1633 return mpParameters->Numerical().KSPTolerances()->KSPRelative().get();
1638 CHECK_EXISTS(
mpParameters->Numerical().KSPSolver().present(),
"Numerical/KSPSolver");
1641 case cp::ksp_solver_type::gmres :
1643 case cp::ksp_solver_type::cg :
1645 case cp::ksp_solver_type::symmlq :
1647 case cp::ksp_solver_type::chebychev :
1657 CHECK_EXISTS(
mpParameters->Numerical().KSPPreconditioner().present(),
"Numerical/KSPPreconditioner");
1658 switch (
mpParameters->Numerical().KSPPreconditioner().get() )
1660 case cp::ksp_preconditioner_type::jacobi :
1662 case cp::ksp_preconditioner_type::bjacobi :
1664 case cp::ksp_preconditioner_type::hypre :
1666 case cp::ksp_preconditioner_type::ml :
1668 case cp::ksp_preconditioner_type::spai :
1670 case cp::ksp_preconditioner_type::blockdiagonal :
1671 return "blockdiagonal";
1672 case cp::ksp_preconditioner_type::ldufactorisation :
1673 return "ldufactorisation";
1674 case cp::ksp_preconditioner_type::twolevelsblockdiagonal :
1675 return "twolevelsblockdiagonal";
1676 case cp::ksp_preconditioner_type::none :
1681 EXCEPTION(
"Unknown ksp preconditioner");
1687 CHECK_EXISTS(
mpParameters->Numerical().MeshPartitioning().present(),
"Numerical/MeshPartitioning");
1688 switch (
mpParameters->Numerical().MeshPartitioning().get() )
1690 case cp::mesh_partitioning_type::dumb :
1691 return DistributedTetrahedralMeshPartitionType::DUMB;
1692 case cp::mesh_partitioning_type::metis :
1693 return DistributedTetrahedralMeshPartitionType::METIS_LIBRARY;
1694 case cp::mesh_partitioning_type::parmetis :
1695 return DistributedTetrahedralMeshPartitionType::PARMETIS_LIBRARY;
1696 case cp::mesh_partitioning_type::petsc :
1697 return DistributedTetrahedralMeshPartitionType::PETSC_MAT_PARTITION;
1700 EXCEPTION(
"Unknown mesh partitioning type");
1707 if (IsAdaptivityParametersPresent)
1709 WARNING(
"Use of the Adaptivity library is deprecated");
1725 ENSURE_SECTION_PRESENT(
mpParameters->PostProcessing(), cp::postprocessing_type);
1746 bool result =
false;
1749 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ActionPotentialDurationMap)&
1750 apd_maps =
mpParameters->PostProcessing()->ActionPotentialDurationMap();
1751 result = (apd_maps.begin() != apd_maps.end());
1761 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ActionPotentialDurationMap)&
1762 apd_maps_sequence =
mpParameters->PostProcessing()->ActionPotentialDurationMap();
1764 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::ActionPotentialDurationMap) i = apd_maps_sequence.begin();
1765 i != apd_maps_sequence.end();
1768 std::pair<double,double> map(i->repolarisation_percentage(),i->threshold());
1770 apd_maps.push_back(map);
1776 bool result =
false;
1779 XSD_SEQUENCE_TYPE(cp::postprocessing_type::UpstrokeTimeMap)&
1780 upstroke_map =
mpParameters->PostProcessing()->UpstrokeTimeMap();
1781 result = (upstroke_map.begin() != upstroke_map.end());
1788 assert(upstroke_time_maps.size() == 0);
1790 XSD_SEQUENCE_TYPE(cp::postprocessing_type::UpstrokeTimeMap)&
1791 upstroke_maps_sequence =
mpParameters->PostProcessing()->UpstrokeTimeMap();
1793 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::UpstrokeTimeMap) i = upstroke_maps_sequence.begin();
1794 i != upstroke_maps_sequence.end();
1797 upstroke_time_maps.push_back(i->threshold());
1803 bool result =
false;
1806 XSD_SEQUENCE_TYPE(cp::postprocessing_type::MaxUpstrokeVelocityMap)&
1807 max_upstroke_velocity_map =
mpParameters->PostProcessing()->MaxUpstrokeVelocityMap();
1808 result = (max_upstroke_velocity_map.begin() != max_upstroke_velocity_map.end());
1816 assert(upstroke_velocity_maps.size() == 0);
1818 XSD_SEQUENCE_TYPE(cp::postprocessing_type::MaxUpstrokeVelocityMap)&
1819 max_upstroke_velocity_maps_sequence =
mpParameters->PostProcessing()->MaxUpstrokeVelocityMap();
1821 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::MaxUpstrokeVelocityMap) i = max_upstroke_velocity_maps_sequence.begin();
1822 i != max_upstroke_velocity_maps_sequence.end();
1825 upstroke_velocity_maps.push_back(i->threshold());
1831 bool result =
false;
1834 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ConductionVelocityMap)&
1835 cond_vel_maps =
mpParameters->PostProcessing()->ConductionVelocityMap();
1836 result = (cond_vel_maps.begin() != cond_vel_maps.end());
1844 assert(conduction_velocity_maps.size() == 0);
1846 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ConductionVelocityMap)&
1847 cond_vel_maps_sequence =
mpParameters->PostProcessing()->ConductionVelocityMap();
1849 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::ConductionVelocityMap) i = cond_vel_maps_sequence.begin();
1850 i != cond_vel_maps_sequence.end();
1853 conduction_velocity_maps.push_back(i->origin_node());
1859 bool result =
false;
1862 XSD_SEQUENCE_TYPE(cp::postprocessing_type::TimeTraceAtNode)&
1863 requested_nodes =
mpParameters->PostProcessing()->TimeTraceAtNode();
1864 result = (requested_nodes.begin() != requested_nodes.end());
1872 assert(rRequestedNodes.size() == 0);
1874 XSD_SEQUENCE_TYPE(cp::postprocessing_type::TimeTraceAtNode)&
1875 req_nodes =
mpParameters->PostProcessing()->TimeTraceAtNode();
1877 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::TimeTraceAtNode) i = req_nodes.begin();
1878 i != req_nodes.end();
1881 rRequestedNodes.push_back(i->node_number());
1888 bool result =
false;
1891 XSD_SEQUENCE_TYPE(cp::postprocessing_type::PseudoEcgElectrodePosition)&
1892 electrodes =
mpParameters->PostProcessing()->PseudoEcgElectrodePosition();
1893 result = (electrodes.begin() != electrodes.end());
1898 template<
unsigned SPACE_DIM>
1901 rPseudoEcgElectrodePositions.clear();
1902 XSD_SEQUENCE_TYPE(cp::postprocessing_type::PseudoEcgElectrodePosition)&
1903 electrodes =
mpParameters->PostProcessing()->PseudoEcgElectrodePosition();
1904 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::PseudoEcgElectrodePosition) i = electrodes.begin();
1905 i != electrodes.end();
1921 return mpParameters->Simulation()->OutputVisualizer().present();
1932 return mpParameters->Simulation()->OutputVisualizer()->meshalyzer() == cp::yesno_type::yes;
1944 return mpParameters->Simulation()->OutputVisualizer()->cmgui() == cp::yesno_type::yes;
1956 return mpParameters->Simulation()->OutputVisualizer()->parallel_vtk() == cp::yesno_type::yes;
1968 return mpParameters->Simulation()->OutputVisualizer()->vtk() == cp::yesno_type::yes;
1980 return mpParameters->Simulation()->OutputVisualizer()->precision();
1987 return mpParameters->Simulation()->Electrodes().present();
1995 mpParameters->Simulation()->SpaceDimension().set(spaceDimension);
2000 XSD_CREATE_WITH_FIXED_ATTR1(cp::time_type, time, simulationDuration,
"ms");
2001 mpParameters->Simulation()->SimulationDuration().set(time);
2011 cp::ionic_model_selection_type ionic_model;
2012 ionic_model.Hardcoded(rIonicModel);
2013 cp::ionic_models_type container(ionic_model);
2014 mpParameters->Simulation()->IonicModels().set(container);
2021 XSD_CREATE_WITH_FIXED_ATTR(cp::mesh_type, mesh_to_load,
"cm");
2025 cp::slab_type slab_definition(x, y, z, inter_node_space);
2026 mpParameters->Simulation()->Mesh()->Slab().set(slab_definition);
2033 XSD_CREATE_WITH_FIXED_ATTR(cp::mesh_type, mesh_to_load,
"cm");
2037 cp::sheet_type sheet_definition(x, y, inter_node_space);
2038 mpParameters->Simulation()->Mesh()->Sheet().set(sheet_definition);
2045 XSD_CREATE_WITH_FIXED_ATTR(cp::mesh_type, mesh_to_load,
"cm");
2049 cp::fibre_type fibre_definition(x, inter_node_space);
2050 mpParameters->Simulation()->Mesh()->Fibre().set(fibre_definition);
2057 XSD_CREATE_WITH_FIXED_ATTR(cp::mesh_type, mesh_to_load,
"cm");
2061 XSD_NESTED_TYPE(cp::mesh_type::LoadMesh) mesh_prefix(meshPrefix, fibreDefinition);
2062 mpParameters->Simulation()->Mesh()->LoadMesh().set(mesh_prefix);
2066 std::vector<cp::ionic_model_selection_type>& rIonicModels)
const 2068 assert(rDefinedRegions.size() == rIonicModels.size());
2070 assert(
mpParameters->Simulation()->IonicModels().present());
2071 XSD_SEQUENCE_TYPE(cp::ionic_models_type::Region)&
2072 regions =
mpParameters->Simulation()->IonicModels()->Region();
2074 for (
unsigned region_index=0; region_index<rDefinedRegions.size(); region_index++)
2076 cp::point_type point_a(rDefinedRegions[region_index].rGetLowerCorner()[0],
2077 rDefinedRegions[region_index].rGetLowerCorner()[1],
2078 rDefinedRegions[region_index].rGetLowerCorner()[2]);
2080 cp::point_type point_b(rDefinedRegions[region_index].rGetUpperCorner()[0],
2081 rDefinedRegions[region_index].rGetUpperCorner()[1],
2082 rDefinedRegions[region_index].rGetUpperCorner()[2]);
2084 XSD_CREATE_WITH_FIXED_ATTR(cp::location_type, locn,
"cm");
2085 locn.Cuboid().set(cp::box_type(point_a, point_b));
2087 cp::ionic_model_region_type region(rIonicModels[region_index], locn);
2088 regions.push_back(region);
2093 std::vector< c_vector<double,3> >& rIntraConductivities,
2094 std::vector< c_vector<double,3> >& rExtraConductivities)
2096 assert ( rConductivityAreas.size() == rIntraConductivities.size() );
2097 assert ( rIntraConductivities.size() == rExtraConductivities.size());
2099 XSD_ANON_SEQUENCE_TYPE(cp::physiological_type, ConductivityHeterogeneities, ConductivityHeterogeneity) heterogeneities_container;
2101 for (
unsigned region_index=0; region_index<rConductivityAreas.size(); region_index++)
2103 cp::point_type point_a(rConductivityAreas[region_index].rGetLowerCorner()[0],
2104 rConductivityAreas[region_index].rGetLowerCorner()[1],
2105 rConductivityAreas[region_index].rGetLowerCorner()[2]);
2107 cp::point_type point_b(rConductivityAreas[region_index].rGetUpperCorner()[0],
2108 rConductivityAreas[region_index].rGetUpperCorner()[1],
2109 rConductivityAreas[region_index].rGetUpperCorner()[2]);
2111 XSD_CREATE_WITH_FIXED_ATTR(cp::location_type, locn,
"cm");
2112 locn.Cuboid().set(cp::box_type(point_a, point_b));
2113 cp::conductivity_heterogeneity_type ht(locn);
2115 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2116 rIntraConductivities[region_index][0],
2117 rIntraConductivities[region_index][1],
2118 rIntraConductivities[region_index][2],
2121 ht.IntracellularConductivities(intra);
2123 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2124 rExtraConductivities[region_index][0],
2125 rExtraConductivities[region_index][1],
2126 rExtraConductivities[region_index][2],
2129 ht.ExtracellularConductivities(extra);
2131 heterogeneities_container.push_back(ht);
2134 XSD_ANON_TYPE(cp::physiological_type, ConductivityHeterogeneities) heterogeneities_object;
2135 heterogeneities_object.ConductivityHeterogeneity(heterogeneities_container);
2137 mpParameters->Physiological().ConductivityHeterogeneities().set(heterogeneities_object);
2141 std::vector< c_vector<double,3> >& rIntraConductivities,
2142 std::vector< c_vector<double,3> >& rExtraConductivities)
2144 assert ( rConductivityAreas.size() == rIntraConductivities.size() );
2145 assert ( rIntraConductivities.size() == rExtraConductivities.size());
2147 XSD_ANON_SEQUENCE_TYPE(cp::physiological_type, ConductivityHeterogeneities, ConductivityHeterogeneity) heterogeneities_container;
2149 for (
unsigned region_index=0; region_index<rConductivityAreas.size(); region_index++)
2151 cp::point_type centre(rConductivityAreas[region_index].rGetCentre()[0],
2152 rConductivityAreas[region_index].rGetCentre()[1],
2153 rConductivityAreas[region_index].rGetCentre()[2]);
2155 cp::point_type radii(rConductivityAreas[region_index].rGetRadii()[0],
2156 rConductivityAreas[region_index].rGetRadii()[1],
2157 rConductivityAreas[region_index].rGetRadii()[2]);
2159 XSD_CREATE_WITH_FIXED_ATTR(cp::location_type, locn,
"cm");
2160 locn.Ellipsoid().set(cp::ellipsoid_type(centre, radii));
2161 cp::conductivity_heterogeneity_type ht(locn);
2163 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2164 rIntraConductivities[region_index][0],
2165 rIntraConductivities[region_index][1],
2166 rIntraConductivities[region_index][2],
2169 ht.IntracellularConductivities(intra);
2171 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2172 rExtraConductivities[region_index][0],
2173 rExtraConductivities[region_index][1],
2174 rExtraConductivities[region_index][2],
2177 ht.ExtracellularConductivities(extra);
2179 heterogeneities_container.push_back(ht);
2182 XSD_ANON_TYPE(cp::physiological_type, ConductivityHeterogeneities) heterogeneities_object;
2183 heterogeneities_object.ConductivityHeterogeneity(heterogeneities_container);
2185 mpParameters->Physiological().ConductivityHeterogeneities().set(heterogeneities_object);
2190 mpParameters->Simulation()->OutputDirectory().set(rOutputDirectory);
2195 mpParameters->Simulation()->OutputFilenamePrefix().set(rOutputFilenamePrefix);
2200 if (!
mpParameters->Simulation()->OutputVariables().present())
2202 cp::output_variables_type variables_requested;
2203 mpParameters->Simulation()->OutputVariables().set(variables_requested);
2206 XSD_SEQUENCE_TYPE(cp::output_variables_type::Var)&
2207 var_type_sequence =
mpParameters->Simulation()->OutputVariables()->Var();
2209 var_type_sequence.clear();
2211 for (
unsigned i=0; i<rOutputVariables.size(); i++)
2213 cp::var_type temp(rOutputVariables[i]);
2214 var_type_sequence.push_back(temp);
2221 mpParameters->Simulation()->OutputUsingOriginalNodeOrdering().set(useOriginal? cp::yesno_type::yes : cp::yesno_type::no);
2229 assert(checkpointTimestep!=-1.0 && maxCheckpointsOnDisk!=UINT_MAX);
2231 XSD_CREATE_WITH_FIXED_ATTR2(cp::simulation_type::XSD_NESTED_TYPE(CheckpointSimulation),
2234 maxCheckpointsOnDisk,
2236 mpParameters->Simulation()->CheckpointSimulation().set(cs);
2240 mpParameters->Simulation()->CheckpointSimulation().reset();
2250 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2251 rIntraConductivities[0],
2252 rIntraConductivities[1],
2253 rIntraConductivities[2],
2256 mpParameters->Physiological().IntracellularConductivities().set(intra);
2261 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2262 rIntraConductivities[0],
2263 rIntraConductivities[1],
2266 mpParameters->Physiological().IntracellularConductivities().set(intra);
2271 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2272 rIntraConductivities[0],
2275 mpParameters->Physiological().IntracellularConductivities().set(intra);
2280 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2281 rExtraConductivities[0],
2282 rExtraConductivities[1],
2283 rExtraConductivities[2],
2286 mpParameters->Physiological().ExtracellularConductivities().set(extra);
2291 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2292 rExtraConductivities[0],
2293 rExtraConductivities[1],
2296 mpParameters->Physiological().ExtracellularConductivities().set(extra);
2301 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2302 rExtraConductivities[0],
2305 mpParameters->Physiological().ExtracellularConductivities().set(extra);
2310 XSD_CREATE_WITH_FIXED_ATTR1(cp::conductivity_type, cond, bathConductivity,
"mS/cm");
2311 mpParameters->Physiological().BathConductivity().set(cond);
2328 if (tissueIds.empty() || bathIds.empty() )
2330 EXCEPTION(
"Identifying set must be non-empty");
2332 std::set<unsigned> shared_identifiers;
2333 std::set_intersection(tissueIds.begin(),
2337 std::inserter(shared_identifiers, shared_identifiers.begin()));
2339 if (!shared_identifiers.empty())
2341 EXCEPTION(
"Tissue identifiers and bath identifiers overlap");
2349 XSD_CREATE_WITH_FIXED_ATTR1(cp::inverse_length_type, ratio_object, ratio,
"1/cm");
2350 mpParameters->Physiological().SurfaceAreaToVolumeRatio().set(ratio_object);
2355 XSD_CREATE_WITH_FIXED_ATTR1(cp::capacitance_type, capacitance_object, capacitance,
"uF/cm^2");
2356 mpParameters->Physiological().Capacitance().set(capacitance_object);
2363 XSD_CREATE_WITH_FIXED_ATTR3(cp::time_steps_type, time_steps,
2364 odeTimeStep, pdeTimeStep, printingTimeStep,
"ms");
2388 EXCEPTION(
"Ode time-step should be positive");
2392 EXCEPTION(
"Pde time-step should be positive");
2396 EXCEPTION(
"Printing time-step should be positive");
2401 EXCEPTION(
"Printing time-step should not be smaller than PDE time-step");
2406 EXCEPTION(
"Printing time-step should be a multiple of PDE time step");
2411 EXCEPTION(
"Ode time-step should not be greater than PDE time-step");
2418 EXCEPTION(
"Checkpoint time-step should be positive");
2423 EXCEPTION(
"Checkpoint time-step should be a multiple of printing time-step");
2430 ENSURE_SECTION_PRESENT(
mpParameters->Numerical().KSPTolerances(), cp::ksp_tolerances_type);
2432 mpParameters->Numerical().KSPTolerances()->KSPAbsolute().reset();
2433 mpParameters->Numerical().KSPTolerances()->KSPRelative().set(relativeTolerance);
2438 ENSURE_SECTION_PRESENT(
mpParameters->Numerical().KSPTolerances(), cp::ksp_tolerances_type);
2440 mpParameters->Numerical().KSPTolerances()->KSPRelative().reset();
2441 mpParameters->Numerical().KSPTolerances()->KSPAbsolute().set(absoluteTolerance);
2446 if (warnOfChange && strcmp(
GetKSPSolver(), kspSolver) != 0)
2449 WARNING(
"Code has changed the KSP solver type from "<<
GetKSPSolver()<<
" to "<< kspSolver);
2453 if (strcmp(kspSolver,
"gmres") == 0)
2455 mpParameters->Numerical().KSPSolver().set(cp::ksp_solver_type::gmres);
2458 if (strcmp(kspSolver,
"cg") == 0)
2460 mpParameters->Numerical().KSPSolver().set(cp::ksp_solver_type::cg);
2463 if (strcmp(kspSolver,
"symmlq") == 0)
2465 mpParameters->Numerical().KSPSolver().set(cp::ksp_solver_type::symmlq);
2468 if (strcmp(kspSolver,
"chebychev") == 0)
2470 mpParameters->Numerical().KSPSolver().set(cp::ksp_solver_type::chebychev);
2474 EXCEPTION(
"Unknown solver type provided");
2480 if (strcmp(kspPreconditioner,
"jacobi") == 0)
2482 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::jacobi);
2485 if (strcmp(kspPreconditioner,
"bjacobi") == 0)
2487 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::bjacobi);
2490 if (strcmp(kspPreconditioner,
"hypre") == 0)
2492 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::hypre);
2495 if (strcmp(kspPreconditioner,
"ml") == 0)
2497 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::ml);
2500 if (strcmp(kspPreconditioner,
"spai") == 0)
2502 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::spai);
2505 if (strcmp(kspPreconditioner,
"twolevelsblockdiagonal") == 0)
2507 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::twolevelsblockdiagonal);
2510 if (strcmp(kspPreconditioner,
"blockdiagonal") == 0)
2512 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::blockdiagonal);
2515 if (strcmp(kspPreconditioner,
"ldufactorisation") == 0)
2517 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::ldufactorisation);
2520 if (strcmp(kspPreconditioner,
"none") == 0)
2522 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::none);
2526 EXCEPTION(
"Unknown preconditioner type provided");
2532 if (strcmp(meshPartioningMethod,
"dumb") == 0)
2534 mpParameters->Numerical().MeshPartitioning().set(cp::mesh_partitioning_type::dumb);
2537 if (strcmp(meshPartioningMethod,
"metis") == 0)
2539 mpParameters->Numerical().MeshPartitioning().set(cp::mesh_partitioning_type::metis);
2542 if (strcmp(meshPartioningMethod,
"parmetis") == 0)
2544 mpParameters->Numerical().MeshPartitioning().set(cp::mesh_partitioning_type::parmetis);
2547 if (strcmp(meshPartioningMethod,
"petsc") == 0)
2549 mpParameters->Numerical().MeshPartitioning().set(cp::mesh_partitioning_type::petsc);
2553 EXCEPTION(
"Unknown mesh partitioning method provided");
2560 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ActionPotentialDurationMap)& apd_maps_sequence
2561 =
mpParameters->PostProcessing()->ActionPotentialDurationMap();
2563 apd_maps_sequence.clear();
2565 for (
unsigned i=0; i<apdMaps.size(); i++)
2567 XSD_CREATE_WITH_FIXED_ATTR2(cp::apd_map_type, temp,
2568 apdMaps[i].first, apdMaps[i].second,
2570 apd_maps_sequence.push_back( temp);
2578 XSD_SEQUENCE_TYPE(cp::postprocessing_type::UpstrokeTimeMap)& var_type_sequence
2582 var_type_sequence.clear();
2584 for (
unsigned i=0; i<upstrokeTimeMaps.size(); i++)
2586 XSD_CREATE_WITH_FIXED_ATTR1(cp::upstrokes_map_type, temp,
2587 upstrokeTimeMaps[i],
2589 var_type_sequence.push_back(temp);
2596 XSD_SEQUENCE_TYPE(cp::postprocessing_type::MaxUpstrokeVelocityMap)& max_upstroke_velocity_maps_sequence
2597 =
mpParameters->PostProcessing()->MaxUpstrokeVelocityMap();
2600 max_upstroke_velocity_maps_sequence.clear();
2602 for (
unsigned i=0; i<maxUpstrokeVelocityMaps.size(); i++)
2604 XSD_CREATE_WITH_FIXED_ATTR1(cp::max_upstrokes_velocity_map_type, temp,
2605 maxUpstrokeVelocityMaps[i],
2609 max_upstroke_velocity_maps_sequence.push_back(temp);
2617 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ConductionVelocityMap)& conduction_velocity_maps_sequence
2618 =
mpParameters->PostProcessing()->ConductionVelocityMap();
2621 conduction_velocity_maps_sequence.clear();
2623 for (
unsigned i=0; i<conductionVelocityMaps.size(); i++)
2625 cp::conduction_velocity_map_type temp(conductionVelocityMaps[i]);
2626 conduction_velocity_maps_sequence.push_back(temp);
2633 XSD_SEQUENCE_TYPE(cp::postprocessing_type::TimeTraceAtNode)& requested_nodes_sequence
2637 requested_nodes_sequence.clear();
2639 for (
unsigned i=0; i<requestedNodes.size(); i++)
2641 cp::node_number_type temp(requestedNodes[i]);
2642 requested_nodes_sequence.push_back(temp);
2646 template<
unsigned SPACE_DIM>
2650 XSD_SEQUENCE_TYPE(cp::postprocessing_type::PseudoEcgElectrodePosition)& electrodes_sequence
2651 =
mpParameters->PostProcessing()->PseudoEcgElectrodePosition();
2654 electrodes_sequence.clear();
2656 for (
unsigned i=0; i<rPseudoEcgElectrodePositions.size(); i++)
2658 cp::point_type temp(rPseudoEcgElectrodePositions[i].GetWithDefault(0),
2659 rPseudoEcgElectrodePositions[i].GetWithDefault(1),
2660 rPseudoEcgElectrodePositions[i].GetWithDefault(2));
2661 electrodes_sequence.push_back(temp);
2672 ENSURE_SECTION_PRESENT(
mpParameters->Simulation()->OutputVisualizer(), cp::output_visualizer_type);
2679 mpParameters->Simulation()->OutputVisualizer()->meshalyzer(
2680 useMeshalyzer ? cp::yesno_type::yes : cp::yesno_type::no);
2688 useCmgui ? cp::yesno_type::yes : cp::yesno_type::no);
2696 useVtk ? cp::yesno_type::yes : cp::yesno_type::no);
2703 mpParameters->Simulation()->OutputVisualizer()->parallel_vtk(
2704 useParallelVtk ? cp::yesno_type::yes : cp::yesno_type::no);
2711 mpParameters->Simulation()->OutputVisualizer()->precision(numberOfDigits);
2716 unsigned index,
double magnitude,
2717 double startTime,
double duration )
2721 cp::axis_type axis = cp::axis_type::x;
2724 axis = cp::axis_type::y;
2728 axis = cp::axis_type::z;
2731 XSD_CREATE_WITH_FIXED_ATTR1(cp::surface_stimulus_strength_type, strength, magnitude,
"uA/cm^2");
2732 XSD_CREATE_WITH_FIXED_ATTR1(cp::time_type, start_time, startTime,
"ms");
2733 XSD_CREATE_WITH_FIXED_ATTR1(cp::time_type, duration_time, duration,
"ms");
2737 cp::electrodes_type element( groundSecondElectrode ? cp::yesno_type::yes : cp::yesno_type::no,
2746 mpParameters->Simulation()->Electrodes()->GroundSecondElectrode(groundSecondElectrode ? cp::yesno_type::yes : cp::yesno_type::no);
2747 mpParameters->Simulation()->Electrodes()->PerpendicularToAxis(axis);
2748 mpParameters->Simulation()->Electrodes()->Strength(strength);
2749 mpParameters->Simulation()->Electrodes()->StartTime(start_time);
2750 mpParameters->Simulation()->Electrodes()->Duration(duration_time);
2755 unsigned& rIndex,
double& rMagnitude,
2756 double& rStartTime,
double& rDuration )
2760 EXCEPTION(
"Attempted to get electrodes that have not been defined.");
2764 rGroundSecondElectrode = (
mpParameters->Simulation()->Electrodes()->GroundSecondElectrode()==cp::yesno_type::yes);
2766 cp::axis_type axis =
mpParameters->Simulation()->Electrodes()->PerpendicularToAxis();
2767 if (axis==cp::axis_type::x)
2771 else if (axis==cp::axis_type::y)
2780 rMagnitude =
mpParameters->Simulation()->Electrodes()->Strength();
2781 rStartTime =
mpParameters->Simulation()->Electrodes()->StartTime();
2782 rDuration =
mpParameters->Simulation()->Electrodes()->Duration();
2790 bool result =
false;
2791 if (
mpParameters->Numerical().UseStateVariableInterpolation().present())
2793 result =
mpParameters->Numerical().UseStateVariableInterpolation().get() == cp::yesno_type::yes;
2800 if (useStateVariableInterpolation)
2802 mpParameters->Numerical().UseStateVariableInterpolation().set(cp::yesno_type::yes);
2806 mpParameters->Numerical().UseStateVariableInterpolation().set(cp::yesno_type::no);
2812 return mpParameters->Physiological().ApplyDrug().present();
2817 CHECK_EXISTS(
HasDrugDose(),
"Physiological/ApplyDrug");
2818 return mpParameters->Physiological().ApplyDrug()->concentration();
2823 if (!
mpParameters->Physiological().ApplyDrug().present())
2825 cp::apply_drug_type drug(drugDose);
2830 mpParameters->Physiological().ApplyDrug()->concentration(drugDose);
2836 CHECK_EXISTS(
HasDrugDose(),
"Physiological/ApplyDrug");
2837 std::map<std::string, std::pair<double, double> > ic50s;
2839 XSD_SEQUENCE_TYPE(cp::apply_drug_type::IC50)&
2840 ic50_seq =
mpParameters->Physiological().ApplyDrug()->IC50();
2842 for (XSD_ITERATOR_TYPE(cp::apply_drug_type::IC50) i = ic50_seq.begin();
2843 i != ic50_seq.end();
2846 std::pair<double, double> ic50_hill(*i, i->hill());
2847 std::string current = i->current();
2848 ic50s[current] = ic50_hill;
2856 if (!
mpParameters->Physiological().ApplyDrug().present())
2860 XSD_SEQUENCE_TYPE(cp::apply_drug_type::IC50)& ic50_seq =
mpParameters->Physiological().ApplyDrug()->IC50();
2861 if (ic50_seq.empty())
2866 bool entry_exists =
false;
2867 cp::ic50_type ic50_elt(ic50, rCurrentName);
2868 ic50_elt.hill(hill);
2869 for (XSD_ITERATOR_TYPE(cp::apply_drug_type::IC50) i = ic50_seq.begin();
2870 i != ic50_seq.end();
2873 if (i->current() == rCurrentName)
2875 entry_exists =
true;
2882 ic50_seq.push_back(ic50_elt);
2939 return mpParameters->Simulation()->Purkinje().present();
2944 CHECK_EXISTS(
mpParameters->Physiological().Purkinje().present(),
"Physiological/Purkinje");
2945 CHECK_EXISTS(
mpParameters->Physiological().Purkinje()->Capacitance().present(),
2946 "Physiological/Purkinje/Capacitance");
2947 return mpParameters->Physiological().Purkinje()->Capacitance().get();
2952 ENSURE_SECTION_PRESENT(
mpParameters->Physiological().Purkinje(), cp::purkinje_physiological_type);
2953 XSD_CREATE_WITH_FIXED_ATTR1(cp::capacitance_type, purk_Cm, capacitance,
"uF/cm^2");
2954 mpParameters->Physiological().Purkinje()->Capacitance().set(purk_Cm);
2960 CHECK_EXISTS(
mpParameters->Physiological().Purkinje().present(),
"Physiological/Purkinje");
2961 CHECK_EXISTS(
mpParameters->Physiological().Purkinje()->SurfaceAreaToVolumeRatio().present(),
2962 "Physiological/Purkinje/SurfaceAreaToVolumeRatio");
2963 return mpParameters->Physiological().Purkinje()->SurfaceAreaToVolumeRatio().get();
2968 ENSURE_SECTION_PRESENT(
mpParameters->Physiological().Purkinje(), cp::purkinje_physiological_type);
2969 XSD_CREATE_WITH_FIXED_ATTR1(cp::inverse_length_type, purk_Am, ratio,
"1/cm");
2970 mpParameters->Physiological().Purkinje()->SurfaceAreaToVolumeRatio().set(purk_Am);
2975 CHECK_EXISTS(
mpParameters->Physiological().Purkinje().present(),
"Physiological/Purkinje");
2976 CHECK_EXISTS(
mpParameters->Physiological().Purkinje()->Conductivity().present(),
2977 "Physiological/Purkinje/Conductivity");
2978 return mpParameters->Physiological().Purkinje()->Conductivity().get();
2983 ENSURE_SECTION_PRESENT(
mpParameters->Physiological().Purkinje(), cp::purkinje_physiological_type);
2984 XSD_CREATE_WITH_FIXED_ATTR1(cp::conductivity_type, purkinje_conductivity, conductivity,
"mS/cm");
2985 mpParameters->Physiological().Purkinje()->Conductivity().set(purkinje_conductivity);
2998 xercesc::DOMElement* pRootElement)
3000 using namespace xercesc;
3003 "ResumeSimulation/ArchiveDirectory");
3004 if (elts.size() > 0)
3007 DOMElement* p_dir_elt = elts[0];
3008 p_dir_elt->setAttribute(X(
"relative_to"), X(
"chaste_test_output"));
3013 xercesc::DOMElement* pRootElement)
3018 "Simulation/IonicModels/Default");
3019 if (p_elt_list.size() > 0)
3021 assert(p_elt_list.size() == 1);
3025 for (
unsigned i=0; i<p_elt_list.size(); i++)
3033 xercesc::DOMElement* pRootElement)
3037 "Numerical/KSPPreconditioner");
3038 if (p_elt_list.size() > 0)
3040 assert(p_elt_list.size() == 1);
3041 std::string text_value = X2C(p_elt_list[0]->getTextContent());
3042 if (text_value ==
"ilu")
3044 EXCEPTION(
"PETSc does not have a parallel implementation of ilu, so we no longer allow it as an option. Use bjacobi instead.");
3050 xercesc::DOMElement* pRootElement)
3054 "Simulation/ConductivityHeterogeneities");
3055 if (p_elt_list.size() > 0)
3057 assert(p_elt_list.size() == 1);
3058 xercesc::DOMNode* p_parent = p_elt_list[0]->getParentNode();
3059 xercesc::DOMNode* p_child = p_parent->removeChild(p_elt_list[0]);
3061 assert(p_phys_list.size() == 1);
3062 p_phys_list[0]->appendChild(p_child);
3067 xercesc::DOMElement* pRootElement)
3070 if (p_sim_list.size() > 0)
3072 std::vector<xercesc::DOMElement*> p_viz_list =
XmlTools::FindElements(p_sim_list[0],
"OutputVisualizer");
3073 if (p_viz_list.empty())
3076 xercesc::DOMElement* p_viz_elt = pDocument->createElementNS(X(
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_3"), X(
"OutputVisualizer"));
3077 p_sim_list[0]->appendChild(p_viz_elt);
3078 p_viz_elt->setAttribute(X(
"meshalyzer"), X(
"yes"));
3091 template void HeartConfig::GetIonicModelRegions<3u>(std::vector<boost::shared_ptr<AbstractChasteRegion<3u> > >& , std::vector<cp::ionic_model_selection_type>&)
const;
3092 template void HeartConfig::GetStimuli<3u>(std::vector<boost::shared_ptr<AbstractStimulusFunction> >& , std::vector<boost::shared_ptr<AbstractChasteRegion<3u> > >& )
const;
3093 template void HeartConfig::GetCellHeterogeneities<3u>(std::vector<boost::shared_ptr<AbstractChasteRegion<3u> > >& ,std::vector<double>& ,std::vector<double>& ,std::vector<double>& ,std::vector<std::map<std::string, double> >*);
3094 template void HeartConfig::GetConductivityHeterogeneities<3u>(std::vector<boost::shared_ptr<AbstractChasteRegion<3u> > >& ,std::vector< c_vector<double,3> >& ,std::vector< c_vector<double,3> >& )
const;
3096 template void HeartConfig::GetIonicModelRegions<2u>(std::vector<boost::shared_ptr<AbstractChasteRegion<2u> > >& , std::vector<cp::ionic_model_selection_type>&)
const;
3097 template void HeartConfig::GetStimuli<2u>(std::vector<boost::shared_ptr<AbstractStimulusFunction> >& , std::vector<boost::shared_ptr<AbstractChasteRegion<2u> > >& )
const;
3098 template void HeartConfig::GetCellHeterogeneities<2u>(std::vector<boost::shared_ptr<AbstractChasteRegion<2u> > >& ,std::vector<double>& ,std::vector<double>& ,std::vector<double>& ,std::vector<std::map<std::string, double> >*);
3099 template void HeartConfig::GetConductivityHeterogeneities<2u>(std::vector<boost::shared_ptr<AbstractChasteRegion<2u> > >& ,std::vector< c_vector<double,3> >& ,std::vector< c_vector<double,3> >& )
const;
3101 template void HeartConfig::GetIonicModelRegions<1u>(std::vector<boost::shared_ptr<AbstractChasteRegion<1u> > >& , std::vector<cp::ionic_model_selection_type>&)
const;
3102 template void HeartConfig::GetStimuli<1u>(std::vector<boost::shared_ptr<AbstractStimulusFunction> >& , std::vector<boost::shared_ptr<AbstractChasteRegion<1u> > >& )
const;
3103 template void HeartConfig::GetCellHeterogeneities<1u>(std::vector<boost::shared_ptr<AbstractChasteRegion<1u> > >& ,std::vector<double>& ,std::vector<double>& ,std::vector<double>& ,std::vector<std::map<std::string, double> >*);
3104 template void HeartConfig::GetConductivityHeterogeneities<1u>(std::vector<boost::shared_ptr<AbstractChasteRegion<1u> > >& ,std::vector< c_vector<double,3> >& ,std::vector< c_vector<double,3> >& )
const;
void UpdateParametersFromResumeSimulation(boost::shared_ptr< cp::chaste_parameters_type > pResumeParameters)
double GetBathConductivity(unsigned bathRegion=UINT_MAX) const
void EnsureOutputVisualizerExists(void)
void SetIc50Value(const std::string &rCurrentName, double ic50, double hill=1.0)
void SetMeshFileName(std::string meshPrefix, cp::media_type fibreDefinition=cp::media_type::NoFibreOrientation)
void SetApdMaps(const std::vector< std::pair< double, double > > &rApdMaps)
void SetUseRelativeTolerance(double relativeTolerance)
std::map< std::string, std::string > SchemaLocationsMap
std::string GetOutputFilenamePrefix() const
bool GetUseAbsoluteTolerance() const
SchemaLocationsMap mSchemaLocations
void SetDomain(const cp::domain_type &rDomain)
double GetPurkinjeSurfaceAreaToVolumeRatio()
cp::media_type GetConductivityMedia() const
unsigned mEvaluateNumItsEveryNSolves
void SetRequestedNodalTimeTraces(std::vector< unsigned > &requestedNodes)
double GetSimulationDuration() const
void SetSpaceDimension(unsigned spaceDimension)
static bool IsRegionBath(HeartRegionType regionId)
bool GetCreateSheet() const
void GetIonicModelRegions(std::vector< boost::shared_ptr< AbstractChasteRegion< DIM > > > &rDefinedRegions, std::vector< cp::ionic_model_selection_type > &rIonicModels) const
const std::set< unsigned > & rGetTissueIdentifiers()
bool GetVisualizeWithVtk() const
bool IsAnyNodalTimeTraceRequested() const
void SetVisualizeWithMeshalyzer(bool useMeshalyzer=true)
void SetOutputDirectory(const std::string &rOutputDirectory)
void SetUseFixedNumberIterationsLinearSolver(bool useFixedNumberIterations=true, unsigned evaluateNumItsEveryNSolves=UINT_MAX)
bool IsConductionVelocityMapsRequested() const
void SetPseudoEcgElectrodePositions(const std::vector< ChastePoint< SPACE_DIM > > &rPseudoEcgElectrodePositions)
void SetSlabDimensions(double x, double y, double z, double inter_node_space)
unsigned GetVersionFromNamespace(const std::string &rNamespaceUri)
void SetBathMultipleConductivities(std::map< unsigned, double > bathConductivities)
unsigned GetEvaluateNumItsEveryNSolves()
void SetSheetDimensions(double x, double y, double inter_node_space)
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)
void SetDefaultIonicModel(const cp::ionic_models_available_type &rIonicModel)
void GetIntracellularConductivities(c_vector< double, 3 > &rIntraConductivities) const
void GetExtracellularConductivities(c_vector< double, 3 > &rExtraConductivities) const
void CheckResumeSimulationIsDefined(std::string callingMethod="") const
void CheckSimulationIsDefined(std::string callingMethod="") const
bool GetUseMassLumpingForPrecond()
void GetConductionVelocityMaps(std::vector< unsigned > &rConductionVelocityMaps) const
void Write(bool useArchiveLocationInfo=false, std::string subfolderName="output")
void GetSlabDimensions(c_vector< double, 3 > &slabDimensions) const
void SetPdeTimeStep(double pdeTimeStep)
double GetCheckpointTimestep() const
bool mUseMassLumpingForPrecond
#define EXCEPTION(message)
boost::shared_ptr< cp::chaste_parameters_type > mpParameters
std::map< unsigned, double > mBathConductivities
bool mUseFixedSchemaLocation
void SetTissueAndBathIdentifiers(const std::set< unsigned > &rTissueIds, const std::set< unsigned > &rBathIds)
void EnsurePostProcessingSectionPresent()
bool Divides(double smallerNumber, double largerNumber)
bool IsSimulationDefined() const
void SetVisualizeWithCmgui(bool useCmgui=true)
void SetUseMassLumpingForPrecond(bool useMassLumping=true)
void SetUseStateVariableInterpolation(bool useStateVariableInterpolation=true)
bool GetOutputUsingOriginalNodeOrdering()
void SetKSPPreconditioner(const char *kspPreconditioner)
FileFinder CopyTo(const FileFinder &rDest) const
bool IsPseudoEcgCalculationRequested() const
unsigned GetEndoLayerIndex()
void SetElectrodeParameters(bool groundSecondElectrode, unsigned index, double magnitude, double startTime, double duration)
bool IsMaxUpstrokeVelocityMapRequested() const
void SetOutputUsingOriginalNodeOrdering(bool useOriginal)
bool GetVisualizeWithCmgui() const
void GetOutputVariables(std::vector< std::string > &rOutputVariables) const
DistributedTetrahedralMeshPartitionType::type GetMeshPartitioning() const
bool GetCreateFibre() const
double GetPrintingTimeStep() const
void SetVisualizeWithParallelVtk(bool useParallelVtk=true)
std::set< unsigned > mTissueIdentifiers
void SetPurkinjeSurfaceAreaToVolumeRatio(double ratio)
bool GetOutputVariablesProvided() const
void SetUseReactionDiffusionOperatorSplitting(bool useOperatorSplitting=true)
double GetAbsoluteTolerance() const
void SetDrugDose(double drugDose)
void SetCheckpointSimulation(bool checkpointSimulation, double checkpointTimestep=-1.0, unsigned maxCheckpointsOnDisk=UINT_MAX)
void SetUseFixedSchemaLocation(bool useFixedSchemaLocation)
std::string GetOutputDirectoryFullPath() const
double GetPdeTimeStep() const
void GetUpstrokeTimeMaps(std::vector< double > &rUpstrokeTimeMaps) const
bool IsApdMapsRequested() const
bool IsPostProcessingSectionPresent() const
void SetSurfaceAreaToVolumeRatio(double ratio)
double GetRelativeTolerance() const
bool mUseReactionDiffusionOperatorSplitting
std::string GetMeshName() const
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
void GetFibreLength(c_vector< double, 1 > &fibreLength) const
bool GetUseFixedNumberIterationsLinearSolver()
bool IsAdaptivityParametersPresent() const
void MergeDefaults(boost::shared_ptr< cp::chaste_parameters_type > pParams, boost::shared_ptr< cp::chaste_parameters_type > pDefaults)
boost::shared_ptr< cp::chaste_parameters_type > CreateDefaultParameters()
void SetSimulationDuration(double simulationDuration)
void SetOdeTimeStep(double odeTimeStep)
cp::domain_type GetDomain() const
double GetEpiLayerFraction()
void SetExtracellularConductivities(const c_vector< double, 3 > &rExtraConductivities)
bool GetCreateSlab() const
bool mUserAskedForCellularTransmuralHeterogeneities
double GetDrugDose() const
void GetNodalTimeTraceRequested(std::vector< unsigned > &rRequestedNodes) const
void GetSheetDimensions(c_vector< double, 2 > &sheetDimensions) const
void SetConductivityHeterogeneities(std::vector< ChasteCuboid< 3 > > &rConductivityAreas, std::vector< c_vector< double, 3 > > &rIntraConductivities, std::vector< c_vector< double, 3 > > &rExtraConductivities)
double GetMidLayerFraction()
void SetUseMassLumping(bool useMassLumping=true)
bool GetUseStateVariableInterpolation() const
std::set< unsigned > mBathIdentifiers
bool IsPostProcessingRequested() const
unsigned GetVisualizerOutputPrecision()
void LoadFromCheckpoint()
void SetConductionVelocityMaps(std::vector< unsigned > &rConductionVelocityMaps)
void SetFibreLength(double x, double inter_node_space)
void CheckTimeSteps() const
void SetCapacitance(double capacitance)
double GetOdeTimeStep() const
unsigned GetSpaceDimension() const
void GetElectrodeParameters(bool &rGroundSecondElectrode, unsigned &rIndex, double &rMagnitude, double &rStartTime, double &rDuration)
unsigned GetEpiLayerIndex()
void GetPseudoEcgElectrodePositions(std::vector< ChastePoint< SPACE_DIM > > &rPseudoEcgElectrodePositions) const
bool GetUseReactionDiffusionOperatorSplitting()
void SetDefaultSchemaLocations()
bool IsElectrodesPresent() const
FileFinder GetParametersFilePath()
void SetMaxUpstrokeVelocityMaps(std::vector< double > &rMaxUpstrokeVelocityMaps)
c_vector< double, 1 > Create_c_vector(double x)
cp::ionic_model_selection_type GetDefaultIonicModel() const
void SetUpstrokeTimeMaps(std::vector< double > &rUpstrokeTimeMaps)
void SetMeshPartitioning(const char *meshPartioningMethod)
bool IsMeshProvided() const
unsigned GetMaxCheckpointsOnDisk() const
boost::shared_ptr< cp::chaste_parameters_type > ReadFile(const std::string &rFileName)
void SetFixedSchemaLocations(const SchemaLocationsMap &rSchemaLocations)
double GetInterNodeSpace() const
double GetPurkinjeConductivity()
double GetEndoLayerFraction()
unsigned GetMidLayerIndex()
void GetApdMaps(std::vector< std::pair< double, double > > &rApdMaps) const
void SetParametersFile(const std::string &rFileName)
bool GetCreateMesh() const
void SetIonicModelRegions(std::vector< ChasteCuboid< 3 > > &rDefinedRegions, std::vector< cp::ionic_model_selection_type > &rIonicModels) const
bool GetCheckpointSimulation() const
bool GetVisualizeWithParallelVtk() const
double GetPurkinjeCapacitance()
void SetKSPSolver(const char *kspSolver, bool warnOfChange=false)
bool mUseFixedNumberIterations
const std::set< unsigned > & rGetBathIdentifiers()
double GetCapacitance() const
bool IsOutputVisualizerPresent() const
#define CHASTE_CLASS_EXPORT(T)
void SetIntracellularConductivities(const c_vector< double, 3 > &rIntraConductivities)
bool GetVisualizeWithMeshalyzer() const
FileFinder mParametersFilePath
void SetPurkinjeCapacitance(double capacitance)
double GetSurfaceAreaToVolumeRatio() const
std::string GetOutputDirectory() const
void SetOutputVariables(const std::vector< std::string > &rOutputVariables)
const char * GetKSPPreconditioner() const
bool IsSimulationResumed() const
virtual void SetPath(const std::string &rPath, RelativeTo::Value relativeTo)
void GetMaxUpstrokeVelocityMaps(std::vector< double > &rUpstrokeVelocityMaps) const
void SetVisualizerOutputPrecision(unsigned numberOfDigits)
static std::string GetArchiveDirectory()
HeartFileFinder GetArchivedSimulationDir() const
void SetPrintingTimeStep(double printingTimeStep)
void SetPurkinjeConductivity(double conductivity)
bool AreCellularTransmuralHeterogeneitiesRequested()
void GetStimuli(std::vector< boost::shared_ptr< AbstractStimulusFunction > > &rStimuliApplied, std::vector< boost::shared_ptr< AbstractChasteRegion< DIM > > > &rStimulatedAreas) const
void SetUseAbsoluteTolerance(double absoluteTolerance)
void SetOutputFilenamePrefix(const std::string &rOutputFilenamePrefix)
static HeartConfig * Instance()
static boost::shared_ptr< HeartConfig > mpInstance
static const char * GetRootDir()
bool GetUseRelativeTolerance() const
void SetBathConductivity(double bathConductivity)
bool IsUpstrokeTimeMapsRequested() const
void SetVisualizeWithVtk(bool useVtk=true)
const char * GetKSPSolver() const
bool GetConductivityHeterogeneitiesProvided() const
void CopySchema(const std::string &rToDirectory)
void SetOdePdeAndPrintingTimeSteps(double odeTimeStep, double pdeTimeStep, double printingTimeStep)
void SetConductivityHeterogeneitiesEllipsoid(std::vector< ChasteEllipsoid< 3 > > &rConductivityAreas, std::vector< c_vector< double, 3 > > &rIntraConductivities, std::vector< c_vector< double, 3 > > &rExtraConductivities)
std::map< std::string, std::pair< double, double > > GetIc50Values()