40#include "AbstractChasteRegion.hpp"
41#include "ArchiveLocationInfo.hpp"
42#include "ChastePoint.hpp"
44#include "HeartConfig.hpp"
45#include "HeartFileFinder.hpp"
46#include "OutputFileHandler.hpp"
48#include "Warnings.hpp"
50#include "HeartRegionCodes.hpp"
52#include "RegularStimulus.hpp"
53#include "SimpleStimulus.hpp"
61#include <xsd/cxx/tree/exceptions.hxx>
62#include "XmlTools.hpp"
63using namespace xsd::cxx::tree;
66#if (XSD_INT_VERSION >= 3000000L)
67#define XSD_SEQUENCE_TYPE(base) base##_sequence
68#define XSD_ITERATOR_TYPE(base) base##_iterator
69#define XSD_NESTED_TYPE(t) t##_type
70#define XSD_ANON_TYPE(t1, t2) \
73#define XSD_SEQUENCE_TYPE(base) base::container
74#define XSD_ITERATOR_TYPE(base) base::iterator
75#define XSD_NESTED_TYPE(t) t::type
76#define XSD_ANON_TYPE(t1, t2) \
77 t1::t2::_xsd_##t2##_::t2
81#define XSD_ANON_SEQUENCE_TYPE(t1, t2, t3) \
82 XSD_SEQUENCE_TYPE(XSD_ANON_TYPE(t1, t2)::t3)
83#define XSD_ANON_ITERATOR_TYPE(t1, t2, t3) \
84 XSD_ITERATOR_TYPE(XSD_ANON_TYPE(t1, t2)::t3)
87#if (XSD_INT_VERSION >= 3020000L)
88#define XSD_CREATE_WITH_FIXED_ATTR(type, name, attr) \
90#define XSD_CREATE_WITH_FIXED_ATTR1(type, name, arg1, attr) \
92#define XSD_CREATE_WITH_FIXED_ATTR2(type, name, arg1, arg2, attr) \
94#define XSD_CREATE_WITH_FIXED_ATTR3(type, name, arg1, arg2, arg3, attr) \
95 type name(arg1, arg2, arg3)
97#define XSD_CREATE_WITH_FIXED_ATTR(type, name, attr) \
99#define XSD_CREATE_WITH_FIXED_ATTR1(type, name, arg1, attr) \
100 type name(arg1, attr)
101#define XSD_CREATE_WITH_FIXED_ATTR2(type, name, arg1, arg2, attr) \
102 type name(arg1, arg2, attr)
103#define XSD_CREATE_WITH_FIXED_ATTR3(type, name, arg1, arg2, arg3, attr) \
104 type name(arg1, arg2, arg3, attr)
110#define ENSURE_SECTION_PRESENT(location, type) \
111 if (!location.present()) \
114 location.set(empty_item); \
117#include <boost/current_function.hpp>
125#define CHECK_EXISTS(test, path) \
130 EXCEPTION("No XML element " << path << " found in parameters when calling '" \
131 << BOOST_CURRENT_FUNCTION << "'"); \
150 xercesc::DOMElement* pRootElement);
161 xercesc::DOMElement* pRootElement);
171 xercesc::DOMElement* pRootElement);
181 xercesc::DOMElement* pRootElement);
191 xercesc::DOMElement* pRootElement);
218 : mUseMassLumping(false),
219 mUseMassLumpingForPrecond(false),
220 mUseFixedNumberIterations(false),
221 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)
331 boost::shared_ptr<cp::chaste_parameters_type> p_new_parameters =
mpParameters;
347 if (
FileFinder(defaults_filename_xml).Exists())
349 boost::shared_ptr<cp::chaste_parameters_type> p_defaults =
ReadFile(defaults_filename_xml);
356 if (p_new_parameters->ResumeSimulation().present())
370 std::string schema_name(
"ChasteParameters_2017_1.xsd");
372 if (!schema_location.
Exists())
376 if (!schema_location.
Exists())
379 std::string message(
"Unable to locate schema file " + schema_name +
". You will need to ensure it is available when resuming from the checkpoint.");
380 WARN_ONCE_ONLY(message);
383 if (schema_location.
Exists())
386 schema_location.
CopyTo(output_directory);
398 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/2_0"] = root_dir +
"ChasteParameters_2_0.xsd";
399 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/2_1"] = root_dir +
"ChasteParameters_2_1.xsd";
400 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/2_2"] = root_dir +
"ChasteParameters_2_2.xsd";
401 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/2_3"] = root_dir +
"ChasteParameters_2_3.xsd";
402 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_0"] = root_dir +
"ChasteParameters_3_0.xsd";
403 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_1"] = root_dir +
"ChasteParameters_3_1.xsd";
404 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_3"] = root_dir +
"ChasteParameters_3_3.xsd";
405 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_4"] = root_dir +
"ChasteParameters_3_4.xsd";
406 mSchemaLocations[
"https://chaste.comlab.ox.ac.uk/nss/parameters/2017_1"] = root_dir +
"ChasteParameters_2017_1.xsd";
411 unsigned version_major = 0;
412 unsigned version_minor = 0;
413 if (rNamespaceUri ==
"")
420 std::string uri_base(
"https://chaste.comlab.ox.ac.uk/nss/parameters/");
421 if (rNamespaceUri.substr(0, uri_base.length()) == uri_base)
423 std::istringstream version_string(rNamespaceUri.substr(uri_base.length()));
424 version_string >> version_major;
425 version_string.ignore(1);
426 version_string >> version_minor;
427 if (version_string.fail())
435 unsigned version = version_major * 1000 + version_minor;
438 EXCEPTION(rNamespaceUri +
" is not a recognised Chaste parameters namespace.");
457 ::xml_schema::properties props;
484 xercesc::DOMElement* p_root_elt = p_doc->getDocumentElement();
485 std::string namespace_uri(X2C(p_root_elt->getNamespaceURI()));
508 if (version < 2017001)
513 boost::shared_ptr<cp::chaste_parameters_type> p_params(cp::ChasteParameters(*p_doc, ::xml_schema::flags::dont_initialize, props));
517 return boost::shared_ptr<cp::chaste_parameters_type>(p_params);
519 catch (
const xml_schema::exception& e)
521 std::cerr << e << std::endl;
524 EXCEPTION(
"XML parsing error in configuration file: " + rFileName);
557 EXCEPTION(
"Problem type and space dimension should match when restarting a simulation.");
564 if (pResumeParameters->ResumeSimulation()->Stimuli().present())
566 mpParameters->Simulation()->Stimuli().set(pResumeParameters->ResumeSimulation()->Stimuli().get());
571 if (pResumeParameters->ResumeSimulation()->CellHeterogeneities().present())
573 if (!
mpParameters->Simulation()->CellHeterogeneities().present())
576 mpParameters->Simulation()->CellHeterogeneities().set(pResumeParameters->ResumeSimulation()->CellHeterogeneities().get());
581 XSD_SEQUENCE_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity)& new_seq = pResumeParameters->ResumeSimulation()->CellHeterogeneities()->CellHeterogeneity();
582 XSD_SEQUENCE_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity)& orig_seq =
mpParameters->Simulation()->CellHeterogeneities()->CellHeterogeneity();
583 for (XSD_ITERATOR_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity) i = new_seq.begin();
587 orig_seq.push_back(*i);
593 if (pResumeParameters->ResumeSimulation()->CheckpointSimulation().present())
596 pResumeParameters->ResumeSimulation()->CheckpointSimulation()->timestep(),
597 pResumeParameters->ResumeSimulation()->CheckpointSimulation()->max_checkpoints_on_disk());
601 if (pResumeParameters->ResumeSimulation()->OutputVisualizer().present())
611 cp::numerical_type& r_resume = pResumeParameters->Numerical();
613 if (r_resume.TimeSteps().present())
615 r_user.TimeSteps().set(r_resume.TimeSteps().get());
617 if (r_resume.KSPTolerances().present())
619 r_user.KSPTolerances().set(r_resume.KSPTolerances().get());
621 if (r_resume.KSPSolver().present())
623 r_user.KSPSolver().set(r_resume.KSPSolver().get());
625 if (r_resume.KSPPreconditioner().present())
627 r_user.KSPPreconditioner().set(r_resume.KSPPreconditioner().get());
629 if (r_resume.AdaptivityParameters().present())
631 r_user.AdaptivityParameters().set(r_resume.AdaptivityParameters().get());
636 if (pResumeParameters->PostProcessing().present())
639 cp::postprocessing_type& r_resume = pResumeParameters->PostProcessing().get();
640 cp::postprocessing_type& r_user =
mpParameters->PostProcessing().get();
641 if (!r_resume.ActionPotentialDurationMap().empty())
643 r_user.ActionPotentialDurationMap() = r_resume.ActionPotentialDurationMap();
645 if (!r_resume.UpstrokeTimeMap().empty())
647 r_user.UpstrokeTimeMap() = r_resume.UpstrokeTimeMap();
649 if (!r_resume.MaxUpstrokeVelocityMap().empty())
651 r_user.MaxUpstrokeVelocityMap() = r_resume.MaxUpstrokeVelocityMap();
653 if (!r_resume.ConductionVelocityMap().empty())
655 r_user.ConductionVelocityMap() = r_resume.ConductionVelocityMap();
657 if (!r_resume.PseudoEcgElectrodePosition().empty())
659 r_user.PseudoEcgElectrodePosition() = r_resume.PseudoEcgElectrodePosition();
686 EXCEPTION(callingMethod +
" information is not available in a resumed simulation.");
694 EXCEPTION(callingMethod +
" information is not available in a standard (non-resumed) simulation.");
702 CHECK_EXISTS(
mpParameters->Simulation()->SpaceDimension().present(),
"Simulation/SpaceDimension");
703 return mpParameters->Simulation()->SpaceDimension().get();
707 return mpParameters->ResumeSimulation()->SpaceDimension();
715 CHECK_EXISTS(
mpParameters->Simulation()->SimulationDuration().present(),
"Simulation/SimulationDuration");
716 return mpParameters->Simulation()->SimulationDuration().get();
720 return mpParameters->ResumeSimulation()->SimulationDuration();
728 CHECK_EXISTS(
mpParameters->Simulation()->Domain().present(),
"Simulation/Domain");
741 return mpParameters->Simulation()->IonicModels()->Default();
744template <
unsigned DIM>
746 std::vector<cp::ionic_model_selection_type>& ionicModels)
const
749 definedRegions.clear();
752 XSD_SEQUENCE_TYPE(cp::ionic_models_type::Region)& regions =
mpParameters->Simulation()->IonicModels()->Region();
754 for (XSD_ITERATOR_TYPE(cp::ionic_models_type::Region) i = regions.begin();
758 cp::ionic_model_region_type ionic_model_region(*i);
760 if (ionic_model_region.Location().Cuboid().present() || ionic_model_region.Location().Ellipsoid().present())
762 if (ionic_model_region.Location().Cuboid().present())
764 cp::point_type point_a = ionic_model_region.Location().Cuboid()->LowerCoordinates();
765 cp::point_type point_b = ionic_model_region.Location().Cuboid()->UpperCoordinates();
795 else if (ionic_model_region.Location().Ellipsoid().present())
797 cp::point_type centre = ionic_model_region.Location().Ellipsoid()->Centre();
798 cp::point_type radii = ionic_model_region.Location().Ellipsoid()->Radii();
834 ionicModels.push_back(ionic_model_region.IonicModel());
836 else if (ionic_model_region.Location().EpiLayer().present() || ionic_model_region.Location().MidLayer().present() || ionic_model_region.Location().EndoLayer().present())
839 EXCEPTION(
"Definition of transmural layers is not yet supported for defining different ionic models, please use cuboids instead");
843 EXCEPTION(
"Invalid region type for ionic model definition");
859 return (
mesh.Slab().present() ||
mesh.Sheet().present() ||
mesh.Fibre().present());
867 return (
mesh.Slab().present());
875 return (
mesh.Sheet().present());
883 return (
mesh.Fibre().present());
890 return (
mpParameters->Simulation()->Mesh()->LoadMesh().present());
899 EXCEPTION(
"Tissue slabs can only be defined in 3D");
902 optional<cp::slab_type, false> slab_dimensions =
mpParameters->Simulation()->Mesh()->Slab();
904 slabDimensions[0] = slab_dimensions->x();
905 slabDimensions[1] = slab_dimensions->y();
906 slabDimensions[2] = slab_dimensions->z();
915 EXCEPTION(
"Tissue sheets can only be defined in 2D");
918 optional<cp::sheet_type, false> sheet_dimensions =
mpParameters->Simulation()->Mesh()->Sheet();
920 sheetDimensions[0] = sheet_dimensions->x();
921 sheetDimensions[1] = sheet_dimensions->y();
930 EXCEPTION(
"Tissue fibres can only be defined in 1D");
933 optional<cp::fibre_type, false> fibre_length =
mpParameters->Simulation()->Mesh()->Fibre();
935 fibreLength[0] = fibre_length->x();
946 return mpParameters->Simulation()->Mesh()->Slab()->inter_node_space();
950 return mpParameters->Simulation()->Mesh()->Sheet()->inter_node_space();
954 return mpParameters->Simulation()->Mesh()->Fibre()->inter_node_space();
969 return mpParameters->Simulation()->Mesh()->LoadMesh()->name();
977 return mpParameters->Simulation()->Mesh()->LoadMesh()->conductivity_media();
980template <
unsigned DIM>
993 XSD_SEQUENCE_TYPE(cp::stimuli_type::Stimulus)
994 stimuli =
mpParameters->Simulation()->Stimuli()->Stimulus();
996 for (XSD_ITERATOR_TYPE(cp::stimuli_type::Stimulus) i = stimuli.begin();
1000 cp::stimulus_type stimulus(*i);
1001 if (stimulus.Location().Cuboid().present() || stimulus.Location().Ellipsoid().present())
1003 boost::shared_ptr<AbstractChasteRegion<DIM> > area_ptr;
1004 if (stimulus.Location().Cuboid().present())
1006 cp::point_type point_a = stimulus.Location().Cuboid()->LowerCoordinates();
1007 cp::point_type point_b = stimulus.Location().Cuboid()->UpperCoordinates();
1036 else if (stimulus.Location().Ellipsoid().present())
1038 cp::point_type centre = stimulus.Location().Ellipsoid()->Centre();
1039 cp::point_type radii = stimulus.Location().Ellipsoid()->Radii();
1070 rStimulatedAreas.push_back(area_ptr);
1072 boost::shared_ptr<AbstractStimulusFunction> stim;
1074 if (stimulus.Period().present())
1076 if (stimulus.StopTime().present())
1079 stimulus.Duration(),
1080 stimulus.Period().get(),
1082 stimulus.StopTime().get()));
1087 stimulus.Duration(),
1088 stimulus.Period().get(),
1094 if (stimulus.StopTime().present())
1096 EXCEPTION(
"Stop time can not be defined for SimpleStimulus. Use Duration instead.");
1100 stimulus.Duration(),
1103 rStimuliApplied.push_back(stim);
1105 else if (stimulus.Location().EpiLayer().present() || stimulus.Location().MidLayer().present() || stimulus.Location().EndoLayer().present())
1107 EXCEPTION(
"Definition of transmural layers is not yet supported for specifying stimulated areas, please use cuboids instead");
1111 EXCEPTION(
"Invalid region type for stimulus definition");
1116template <
unsigned DIM>
1118 std::vector<double>& rScaleFactorGks,
1119 std::vector<double>& rScaleFactorIto,
1120 std::vector<double>& rScaleFactorGkr,
1121 std::vector<std::map<std::string, double> >* pParameterSettings)
1125 if (!
mpParameters->Simulation()->CellHeterogeneities().present())
1130 XSD_SEQUENCE_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity)
1132 =
mpParameters->Simulation()->CellHeterogeneities()->CellHeterogeneity();
1134 bool user_supplied_negative_value =
false;
1136 bool user_asked_for_cuboids_or_ellipsoids =
false;
1137 unsigned counter_of_heterogeneities = 0;
1139 for (XSD_ITERATOR_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity) i = cell_heterogeneity.begin();
1140 i != cell_heterogeneity.end();
1143 cp::cell_heterogeneity_type ht(*i);
1145 if (ht.Location().Cuboid().present())
1147 user_asked_for_cuboids_or_ellipsoids =
true;
1148 cp::point_type point_a = ht.Location().Cuboid()->LowerCoordinates();
1149 cp::point_type point_b = ht.Location().Cuboid()->UpperCoordinates();
1156 else if (ht.Location().Ellipsoid().present())
1158 user_asked_for_cuboids_or_ellipsoids =
true;
1159 cp::point_type centre = ht.Location().Ellipsoid()->Centre();
1160 cp::point_type radii = ht.Location().Ellipsoid()->Radii();
1166 else if (ht.Location().EpiLayer().present())
1173 user_supplied_negative_value =
true;
1177 else if (ht.Location().EndoLayer().present())
1184 user_supplied_negative_value =
true;
1188 else if (ht.Location().MidLayer().present())
1195 user_supplied_negative_value =
true;
1201 EXCEPTION(
"Invalid region type for cell heterogeneity definition");
1205 rScaleFactorGks.push_back(ht.ScaleFactorGks().present() ? (
double)ht.ScaleFactorGks().get() : 1.0);
1206 rScaleFactorIto.push_back(ht.ScaleFactorIto().present() ? (
double)ht.ScaleFactorIto().get() : 1.0);
1207 rScaleFactorGkr.push_back(ht.ScaleFactorGkr().present() ? (
double)ht.ScaleFactorGkr().get() : 1.0);
1210 if (pParameterSettings)
1212 std::map<std::string, double> param_settings;
1213 XSD_SEQUENCE_TYPE(cp::cell_heterogeneity_type::SetParameter)& params = ht.SetParameter();
1214 for (XSD_ITERATOR_TYPE(cp::cell_heterogeneity_type::SetParameter) param_it = params.begin();
1215 param_it != params.end();
1218 cp::set_parameter_type param(*param_it);
1219 param_settings[param.name()] = param.value();
1221 pParameterSettings->push_back(param_settings);
1224 counter_of_heterogeneities++;
1230 if (user_asked_for_cuboids_or_ellipsoids)
1232 EXCEPTION(
"Specification of cellular heterogeneities by cuboids/ellipsoids and layers at the same time is not yet supported");
1240 EXCEPTION(
"Three specifications of layers must be supplied");
1244 EXCEPTION(
"Summation of epicardial, midmyocardial and endocardial fractions should be 1");
1246 if (user_supplied_negative_value)
1248 EXCEPTION(
"Fractions must be positive");
1291 return mpParameters->Physiological().ConductivityHeterogeneities().present();
1294template <
unsigned DIM>
1297 std::vector<c_vector<double, 3> >& rIntraConductivities,
1298 std::vector<c_vector<double, 3> >& rExtraConductivities)
const
1302 XSD_ANON_SEQUENCE_TYPE(cp::physiological_type, ConductivityHeterogeneities, ConductivityHeterogeneity)& conductivity_heterogeneity =
mpParameters->Physiological().ConductivityHeterogeneities()->ConductivityHeterogeneity();
1304 for (XSD_ANON_ITERATOR_TYPE(cp::physiological_type, ConductivityHeterogeneities, ConductivityHeterogeneity) i = conductivity_heterogeneity.begin();
1305 i != conductivity_heterogeneity.end();
1308 cp::conductivity_heterogeneity_type ht(*i);
1310 if (ht.Location().Cuboid().present())
1312 cp::point_type point_a = ht.Location().Cuboid()->LowerCoordinates();
1313 cp::point_type point_b = ht.Location().Cuboid()->UpperCoordinates();
1318 else if (ht.Location().Ellipsoid().present())
1320 cp::point_type centre = ht.Location().Ellipsoid()->Centre();
1321 cp::point_type radii = ht.Location().Ellipsoid()->Radii();
1326 else if (ht.Location().EpiLayer().present() || ht.Location().MidLayer().present() || ht.Location().EndoLayer().present())
1329 EXCEPTION(
"Definition of transmural layers is not allowed for conductivities heterogeneities, you may use fibre orientation support instead");
1333 EXCEPTION(
"Invalid region type for conductivity definition");
1336 if (ht.IntracellularConductivities().present())
1338 double intra_x = ht.IntracellularConductivities()->longi();
1339 double intra_y = ht.IntracellularConductivities()->trans();
1340 double intra_z = ht.IntracellularConductivities()->normal();
1342 rIntraConductivities.push_back(Create_c_vector(intra_x, intra_y, intra_z));
1346 c_vector<double, 3> intra_conductivities;
1348 rIntraConductivities.push_back(intra_conductivities);
1351 if (ht.ExtracellularConductivities().present())
1353 double extra_x = ht.ExtracellularConductivities()->longi();
1354 double extra_y = ht.ExtracellularConductivities()->trans();
1355 double extra_z = ht.ExtracellularConductivities()->normal();
1357 rExtraConductivities.push_back(Create_c_vector(extra_x, extra_y, extra_z));
1361 c_vector<double, 3> extra_conductivities;
1363 rExtraConductivities.push_back(extra_conductivities);
1371 CHECK_EXISTS(
mpParameters->Simulation()->OutputDirectory().present(),
"Simulation/OutputDirectory");
1372 return mpParameters->Simulation()->OutputDirectory().get();
1378 CHECK_EXISTS(
mpParameters->Simulation()->OutputFilenamePrefix().present(),
"Simulation/OutputFilenamePrefix");
1379 return mpParameters->Simulation()->OutputFilenamePrefix().get();
1385 return mpParameters->Simulation()->OutputVariables().present();
1391 XSD_SEQUENCE_TYPE(cp::output_variables_type::Var)& output_variables =
mpParameters->Simulation()->OutputVariables()->Var();
1392 rOutputVariables.clear();
1394 for (XSD_ITERATOR_TYPE(cp::output_variables_type::Var) i = output_variables.begin();
1395 i != output_variables.end();
1398 cp::var_type& r_var(*i);
1401 rOutputVariables.push_back(r_var.name());
1408 bool result =
false;
1409 if (
mpParameters->Simulation()->OutputUsingOriginalNodeOrdering().present())
1411 result = (
mpParameters->Simulation()->OutputUsingOriginalNodeOrdering().get() == cp::yesno_type::yes);
1424 return mpParameters->Simulation()->CheckpointSimulation()->timestep();
1430 return mpParameters->Simulation()->CheckpointSimulation()->max_checkpoints_on_disk();
1442 CHECK_EXISTS(
mpParameters->Physiological().IntracellularConductivities().present(),
"Physiological/IntracellularConductivities");
1443 cp::conductivities_type intra_conductivities
1444 =
mpParameters->Physiological().IntracellularConductivities().get();
1445 double intra_x_cond = intra_conductivities.longi();
1446 double intra_y_cond = intra_conductivities.trans();
1447 double intra_z_cond = intra_conductivities.normal();
1450 assert(intra_y_cond != DBL_MAX);
1451 assert(intra_z_cond != DBL_MAX);
1453 rIntraConductivities[0] = intra_x_cond;
1454 rIntraConductivities[1] = intra_y_cond;
1455 rIntraConductivities[2] = intra_z_cond;
1460 CHECK_EXISTS(
mpParameters->Physiological().IntracellularConductivities().present(),
"Physiological/IntracellularConductivities");
1461 cp::conductivities_type intra_conductivities
1462 =
mpParameters->Physiological().IntracellularConductivities().get();
1463 double intra_x_cond = intra_conductivities.longi();
1464 double intra_y_cond = intra_conductivities.trans();
1466 assert(intra_y_cond != DBL_MAX);
1468 rIntraConductivities[0] = intra_x_cond;
1469 rIntraConductivities[1] = intra_y_cond;
1474 CHECK_EXISTS(
mpParameters->Physiological().IntracellularConductivities().present(),
"Physiological/IntracellularConductivities");
1475 cp::conductivities_type intra_conductivities
1476 =
mpParameters->Physiological().IntracellularConductivities().get();
1477 double intra_x_cond = intra_conductivities.longi();
1479 rIntraConductivities[0] = intra_x_cond;
1484 CHECK_EXISTS(
mpParameters->Physiological().ExtracellularConductivities().present(),
"Physiological/ExtracellularConductivities");
1485 cp::conductivities_type extra_conductivities
1486 =
mpParameters->Physiological().ExtracellularConductivities().get();
1487 double extra_x_cond = extra_conductivities.longi();
1488 double extra_y_cond = extra_conductivities.trans();
1489 double extra_z_cond = extra_conductivities.normal();
1492 assert(extra_y_cond != DBL_MAX);
1493 assert(extra_z_cond != DBL_MAX);
1495 rExtraConductivities[0] = extra_x_cond;
1496 rExtraConductivities[1] = extra_y_cond;
1497 rExtraConductivities[2] = extra_z_cond;
1502 CHECK_EXISTS(
mpParameters->Physiological().ExtracellularConductivities().present(),
"Physiological/ExtracellularConductivities");
1503 cp::conductivities_type extra_conductivities
1504 =
mpParameters->Physiological().ExtracellularConductivities().get();
1505 double extra_x_cond = extra_conductivities.longi();
1506 double extra_y_cond = extra_conductivities.trans();
1508 assert(extra_y_cond != DBL_MAX);
1510 rExtraConductivities[0] = extra_x_cond;
1511 rExtraConductivities[1] = extra_y_cond;
1516 CHECK_EXISTS(
mpParameters->Physiological().ExtracellularConductivities().present(),
"Physiological/ExtracellularConductivities");
1517 cp::conductivities_type extra_conductivities
1518 =
mpParameters->Physiological().ExtracellularConductivities().get();
1519 double extra_x_cond = extra_conductivities.longi();
1521 rExtraConductivities[0] = extra_x_cond;
1535 if (bathRegion == UINT_MAX)
1538 CHECK_EXISTS(
mpParameters->Physiological().BathConductivity().present(),
"Physiological/BathConductivity");
1539 return mpParameters->Physiological().BathConductivity().get();
1545 std::map<unsigned, double>::const_iterator map_entry =
mBathConductivities.find(bathRegion);
1549 return map_entry->second;
1554 CHECK_EXISTS(
mpParameters->Physiological().BathConductivity().present(),
"Physiological/BathConductivity");
1555 return mpParameters->Physiological().BathConductivity().get();
1571 CHECK_EXISTS(
mpParameters->Physiological().SurfaceAreaToVolumeRatio().present(),
"Physiological/SurfaceAreaToVolumeRatio");
1572 return mpParameters->Physiological().SurfaceAreaToVolumeRatio().get();
1577 CHECK_EXISTS(
mpParameters->Physiological().Capacitance().present(),
"Physiological/Capacitance");
1578 return mpParameters->Physiological().Capacitance().get();
1583 CHECK_EXISTS(
mpParameters->Numerical().TimeSteps().present(),
"Numerical/TimeSteps");
1589 CHECK_EXISTS(
mpParameters->Numerical().TimeSteps().present(),
"Numerical/TimeSteps");
1595 CHECK_EXISTS(
mpParameters->Numerical().TimeSteps().present(),
"Numerical/TimeSteps");
1596 return mpParameters->Numerical().TimeSteps()->printing();
1601 CHECK_EXISTS(
mpParameters->Numerical().KSPTolerances().present(),
"Numerical/KSPTolerances");
1602 return mpParameters->Numerical().KSPTolerances()->KSPAbsolute().present();
1607 CHECK_EXISTS(
mpParameters->Numerical().KSPTolerances().present(),
"Numerical/KSPTolerances");
1610 EXCEPTION(
"Absolute tolerance is not set in Chaste parameters");
1612 return mpParameters->Numerical().KSPTolerances()->KSPAbsolute().get();
1617 CHECK_EXISTS(
mpParameters->Numerical().KSPTolerances().present(),
"Numerical/KSPTolerances");
1618 return mpParameters->Numerical().KSPTolerances()->KSPRelative().present();
1623 CHECK_EXISTS(
mpParameters->Numerical().KSPTolerances().present(),
"Numerical/KSPTolerances");
1626 EXCEPTION(
"Relative tolerance is not set in Chaste parameters");
1628 return mpParameters->Numerical().KSPTolerances()->KSPRelative().get();
1633 CHECK_EXISTS(
mpParameters->Numerical().KSPSolver().present(),
"Numerical/KSPSolver");
1636 case cp::ksp_solver_type::gmres:
1638 case cp::ksp_solver_type::cg:
1640 case cp::ksp_solver_type::symmlq:
1642 case cp::ksp_solver_type::chebychev:
1652 CHECK_EXISTS(
mpParameters->Numerical().KSPPreconditioner().present(),
"Numerical/KSPPreconditioner");
1653 switch (
mpParameters->Numerical().KSPPreconditioner().get())
1655 case cp::ksp_preconditioner_type::jacobi:
1657 case cp::ksp_preconditioner_type::bjacobi:
1659 case cp::ksp_preconditioner_type::hypre:
1661 case cp::ksp_preconditioner_type::ml:
1663 case cp::ksp_preconditioner_type::spai:
1665 case cp::ksp_preconditioner_type::blockdiagonal:
1666 return "blockdiagonal";
1667 case cp::ksp_preconditioner_type::ldufactorisation:
1668 return "ldufactorisation";
1669 case cp::ksp_preconditioner_type::twolevelsblockdiagonal:
1670 return "twolevelsblockdiagonal";
1671 case cp::ksp_preconditioner_type::none:
1675 EXCEPTION(
"Unknown ksp preconditioner");
1681 CHECK_EXISTS(
mpParameters->Numerical().MeshPartitioning().present(),
"Numerical/MeshPartitioning");
1682 switch (
mpParameters->Numerical().MeshPartitioning().get())
1684 case cp::mesh_partitioning_type::dumb:
1685 return DistributedTetrahedralMeshPartitionType::DUMB;
1686 case cp::mesh_partitioning_type::metis:
1687 return DistributedTetrahedralMeshPartitionType::METIS_LIBRARY;
1688 case cp::mesh_partitioning_type::parmetis:
1689 return DistributedTetrahedralMeshPartitionType::PARMETIS_LIBRARY;
1690 case cp::mesh_partitioning_type::petsc:
1691 return DistributedTetrahedralMeshPartitionType::PETSC_MAT_PARTITION;
1694 EXCEPTION(
"Unknown mesh partitioning type");
1703 WARNING(
"Use of the Adaptivity library is deprecated");
1719 ENSURE_SECTION_PRESENT(
mpParameters->PostProcessing(), cp::postprocessing_type);
1735 bool result =
false;
1738 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ActionPotentialDurationMap)& apd_maps =
mpParameters->PostProcessing()->ActionPotentialDurationMap();
1739 result = (apd_maps.begin() != apd_maps.end());
1749 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ActionPotentialDurationMap)& apd_maps_sequence =
mpParameters->PostProcessing()->ActionPotentialDurationMap();
1751 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::ActionPotentialDurationMap) i = apd_maps_sequence.begin();
1752 i != apd_maps_sequence.end();
1755 std::pair<double, double> map(i->repolarisation_percentage(), i->threshold());
1757 apd_maps.push_back(map);
1763 bool result =
false;
1766 XSD_SEQUENCE_TYPE(cp::postprocessing_type::UpstrokeTimeMap)& upstroke_map =
mpParameters->PostProcessing()->UpstrokeTimeMap();
1767 result = (upstroke_map.begin() != upstroke_map.end());
1774 assert(upstroke_time_maps.size() == 0);
1776 XSD_SEQUENCE_TYPE(cp::postprocessing_type::UpstrokeTimeMap)& upstroke_maps_sequence =
mpParameters->PostProcessing()->UpstrokeTimeMap();
1778 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::UpstrokeTimeMap) i = upstroke_maps_sequence.begin();
1779 i != upstroke_maps_sequence.end();
1782 upstroke_time_maps.push_back(i->threshold());
1788 bool result =
false;
1791 XSD_SEQUENCE_TYPE(cp::postprocessing_type::MaxUpstrokeVelocityMap)& max_upstroke_velocity_map =
mpParameters->PostProcessing()->MaxUpstrokeVelocityMap();
1792 result = (max_upstroke_velocity_map.begin() != max_upstroke_velocity_map.end());
1800 assert(upstroke_velocity_maps.size() == 0);
1802 XSD_SEQUENCE_TYPE(cp::postprocessing_type::MaxUpstrokeVelocityMap)& max_upstroke_velocity_maps_sequence =
mpParameters->PostProcessing()->MaxUpstrokeVelocityMap();
1804 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::MaxUpstrokeVelocityMap) i = max_upstroke_velocity_maps_sequence.begin();
1805 i != max_upstroke_velocity_maps_sequence.end();
1808 upstroke_velocity_maps.push_back(i->threshold());
1814 bool result =
false;
1817 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ConductionVelocityMap)& cond_vel_maps =
mpParameters->PostProcessing()->ConductionVelocityMap();
1818 result = (cond_vel_maps.begin() != cond_vel_maps.end());
1826 assert(conduction_velocity_maps.size() == 0);
1828 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ConductionVelocityMap)& cond_vel_maps_sequence =
mpParameters->PostProcessing()->ConductionVelocityMap();
1830 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::ConductionVelocityMap) i = cond_vel_maps_sequence.begin();
1831 i != cond_vel_maps_sequence.end();
1834 conduction_velocity_maps.push_back(i->origin_node());
1840 bool result =
false;
1843 XSD_SEQUENCE_TYPE(cp::postprocessing_type::TimeTraceAtNode)& requested_nodes =
mpParameters->PostProcessing()->TimeTraceAtNode();
1844 result = (requested_nodes.begin() != requested_nodes.end());
1852 assert(rRequestedNodes.size() == 0);
1854 XSD_SEQUENCE_TYPE(cp::postprocessing_type::TimeTraceAtNode)& req_nodes =
mpParameters->PostProcessing()->TimeTraceAtNode();
1856 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::TimeTraceAtNode) i = req_nodes.begin();
1857 i != req_nodes.end();
1860 rRequestedNodes.push_back(i->node_number());
1866 bool result =
false;
1869 XSD_SEQUENCE_TYPE(cp::postprocessing_type::PseudoEcgElectrodePosition)& electrodes =
mpParameters->PostProcessing()->PseudoEcgElectrodePosition();
1870 result = (electrodes.begin() != electrodes.end());
1875template <
unsigned SPACE_DIM>
1878 rPseudoEcgElectrodePositions.clear();
1879 XSD_SEQUENCE_TYPE(cp::postprocessing_type::PseudoEcgElectrodePosition)& electrodes =
mpParameters->PostProcessing()->PseudoEcgElectrodePosition();
1880 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::PseudoEcgElectrodePosition) i = electrodes.begin();
1881 i != electrodes.end();
1896 return mpParameters->Simulation()->OutputVisualizer().present();
1907 return mpParameters->Simulation()->OutputVisualizer()->meshalyzer() == cp::yesno_type::yes;
1919 return mpParameters->Simulation()->OutputVisualizer()->cmgui() == cp::yesno_type::yes;
1931 return mpParameters->Simulation()->OutputVisualizer()->parallel_vtk() == cp::yesno_type::yes;
1943 return mpParameters->Simulation()->OutputVisualizer()->vtk() == cp::yesno_type::yes;
1955 return mpParameters->Simulation()->OutputVisualizer()->precision();
1961 return mpParameters->Simulation()->Electrodes().present();
1969 mpParameters->Simulation()->SpaceDimension().set(spaceDimension);
1974 XSD_CREATE_WITH_FIXED_ATTR1(cp::time_type, time, simulationDuration,
"ms");
1975 mpParameters->Simulation()->SimulationDuration().set(time);
1985 cp::ionic_model_selection_type ionic_model;
1986 ionic_model.Hardcoded(rIonicModel);
1987 cp::ionic_models_type container(ionic_model);
1988 mpParameters->Simulation()->IonicModels().set(container);
1995 XSD_CREATE_WITH_FIXED_ATTR(cp::mesh_type, mesh_to_load,
"cm");
1999 cp::slab_type slab_definition(x, y, z, inter_node_space);
2000 mpParameters->Simulation()->Mesh()->Slab().set(slab_definition);
2007 XSD_CREATE_WITH_FIXED_ATTR(cp::mesh_type, mesh_to_load,
"cm");
2011 cp::sheet_type sheet_definition(x, y, inter_node_space);
2012 mpParameters->Simulation()->Mesh()->Sheet().set(sheet_definition);
2019 XSD_CREATE_WITH_FIXED_ATTR(cp::mesh_type, mesh_to_load,
"cm");
2023 cp::fibre_type fibre_definition(x, inter_node_space);
2024 mpParameters->Simulation()->Mesh()->Fibre().set(fibre_definition);
2031 XSD_CREATE_WITH_FIXED_ATTR(cp::mesh_type, mesh_to_load,
"cm");
2035 XSD_NESTED_TYPE(cp::mesh_type::LoadMesh)
2036 mesh_prefix(meshPrefix, fibreDefinition);
2037 mpParameters->Simulation()->Mesh()->LoadMesh().set(mesh_prefix);
2041 std::vector<cp::ionic_model_selection_type>& rIonicModels)
const
2043 assert(rDefinedRegions.size() == rIonicModels.size());
2045 assert(
mpParameters->Simulation()->IonicModels().present());
2046 XSD_SEQUENCE_TYPE(cp::ionic_models_type::Region)& regions =
mpParameters->Simulation()->IonicModels()->Region();
2048 for (
unsigned region_index = 0; region_index < rDefinedRegions.size(); region_index++)
2050 cp::point_type point_a(rDefinedRegions[region_index].rGetLowerCorner()[0],
2051 rDefinedRegions[region_index].rGetLowerCorner()[1],
2052 rDefinedRegions[region_index].rGetLowerCorner()[2]);
2054 cp::point_type point_b(rDefinedRegions[region_index].rGetUpperCorner()[0],
2055 rDefinedRegions[region_index].rGetUpperCorner()[1],
2056 rDefinedRegions[region_index].rGetUpperCorner()[2]);
2058 XSD_CREATE_WITH_FIXED_ATTR(cp::location_type, locn,
"cm");
2059 locn.Cuboid().set(cp::box_type(point_a, point_b));
2061 cp::ionic_model_region_type region(rIonicModels[region_index], locn);
2062 regions.push_back(region);
2067 std::vector<c_vector<double, 3> >& rIntraConductivities,
2068 std::vector<c_vector<double, 3> >& rExtraConductivities)
2070 assert(rConductivityAreas.size() == rIntraConductivities.size());
2071 assert(rIntraConductivities.size() == rExtraConductivities.size());
2073 XSD_ANON_SEQUENCE_TYPE(cp::physiological_type, ConductivityHeterogeneities, ConductivityHeterogeneity)
2074 heterogeneities_container;
2076 for (
unsigned region_index = 0; region_index < rConductivityAreas.size(); region_index++)
2078 cp::point_type point_a(rConductivityAreas[region_index].rGetLowerCorner()[0],
2079 rConductivityAreas[region_index].rGetLowerCorner()[1],
2080 rConductivityAreas[region_index].rGetLowerCorner()[2]);
2082 cp::point_type point_b(rConductivityAreas[region_index].rGetUpperCorner()[0],
2083 rConductivityAreas[region_index].rGetUpperCorner()[1],
2084 rConductivityAreas[region_index].rGetUpperCorner()[2]);
2086 XSD_CREATE_WITH_FIXED_ATTR(cp::location_type, locn,
"cm");
2087 locn.Cuboid().set(cp::box_type(point_a, point_b));
2088 cp::conductivity_heterogeneity_type ht(locn);
2090 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2091 rIntraConductivities[region_index][0],
2092 rIntraConductivities[region_index][1],
2093 rIntraConductivities[region_index][2],
2096 ht.IntracellularConductivities(intra);
2098 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2099 rExtraConductivities[region_index][0],
2100 rExtraConductivities[region_index][1],
2101 rExtraConductivities[region_index][2],
2104 ht.ExtracellularConductivities(extra);
2106 heterogeneities_container.push_back(ht);
2109 XSD_ANON_TYPE(cp::physiological_type, ConductivityHeterogeneities)
2110 heterogeneities_object;
2111 heterogeneities_object.ConductivityHeterogeneity(heterogeneities_container);
2113 mpParameters->Physiological().ConductivityHeterogeneities().set(heterogeneities_object);
2117 std::vector<c_vector<double, 3> >& rIntraConductivities,
2118 std::vector<c_vector<double, 3> >& rExtraConductivities)
2120 assert(rConductivityAreas.size() == rIntraConductivities.size());
2121 assert(rIntraConductivities.size() == rExtraConductivities.size());
2123 XSD_ANON_SEQUENCE_TYPE(cp::physiological_type, ConductivityHeterogeneities, ConductivityHeterogeneity)
2124 heterogeneities_container;
2126 for (
unsigned region_index = 0; region_index < rConductivityAreas.size(); region_index++)
2128 cp::point_type centre(rConductivityAreas[region_index].rGetCentre()[0],
2129 rConductivityAreas[region_index].rGetCentre()[1],
2130 rConductivityAreas[region_index].rGetCentre()[2]);
2132 cp::point_type radii(rConductivityAreas[region_index].rGetRadii()[0],
2133 rConductivityAreas[region_index].rGetRadii()[1],
2134 rConductivityAreas[region_index].rGetRadii()[2]);
2136 XSD_CREATE_WITH_FIXED_ATTR(cp::location_type, locn,
"cm");
2137 locn.Ellipsoid().set(cp::ellipsoid_type(centre, radii));
2138 cp::conductivity_heterogeneity_type ht(locn);
2140 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2141 rIntraConductivities[region_index][0],
2142 rIntraConductivities[region_index][1],
2143 rIntraConductivities[region_index][2],
2146 ht.IntracellularConductivities(intra);
2148 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2149 rExtraConductivities[region_index][0],
2150 rExtraConductivities[region_index][1],
2151 rExtraConductivities[region_index][2],
2154 ht.ExtracellularConductivities(extra);
2156 heterogeneities_container.push_back(ht);
2159 XSD_ANON_TYPE(cp::physiological_type, ConductivityHeterogeneities)
2160 heterogeneities_object;
2161 heterogeneities_object.ConductivityHeterogeneity(heterogeneities_container);
2163 mpParameters->Physiological().ConductivityHeterogeneities().set(heterogeneities_object);
2168 mpParameters->Simulation()->OutputDirectory().set(rOutputDirectory);
2173 mpParameters->Simulation()->OutputFilenamePrefix().set(rOutputFilenamePrefix);
2178 if (!
mpParameters->Simulation()->OutputVariables().present())
2180 cp::output_variables_type variables_requested;
2181 mpParameters->Simulation()->OutputVariables().set(variables_requested);
2184 XSD_SEQUENCE_TYPE(cp::output_variables_type::Var)& var_type_sequence =
mpParameters->Simulation()->OutputVariables()->Var();
2186 var_type_sequence.clear();
2188 for (
unsigned i = 0; i < rOutputVariables.size(); i++)
2190 cp::var_type temp(rOutputVariables[i]);
2191 var_type_sequence.push_back(temp);
2198 mpParameters->Simulation()->OutputUsingOriginalNodeOrdering().set(useOriginal ? cp::yesno_type::yes : cp::yesno_type::no);
2206 assert(checkpointTimestep != -1.0 && maxCheckpointsOnDisk != UINT_MAX);
2208 XSD_CREATE_WITH_FIXED_ATTR2(cp::simulation_type::XSD_NESTED_TYPE(CheckpointSimulation),
2211 maxCheckpointsOnDisk,
2213 mpParameters->Simulation()->CheckpointSimulation().set(cs);
2217 mpParameters->Simulation()->CheckpointSimulation().reset();
2227 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2228 rIntraConductivities[0],
2229 rIntraConductivities[1],
2230 rIntraConductivities[2],
2233 mpParameters->Physiological().IntracellularConductivities().set(intra);
2238 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2239 rIntraConductivities[0],
2240 rIntraConductivities[1],
2243 mpParameters->Physiological().IntracellularConductivities().set(intra);
2248 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2249 rIntraConductivities[0],
2252 mpParameters->Physiological().IntracellularConductivities().set(intra);
2257 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2258 rExtraConductivities[0],
2259 rExtraConductivities[1],
2260 rExtraConductivities[2],
2263 mpParameters->Physiological().ExtracellularConductivities().set(extra);
2268 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2269 rExtraConductivities[0],
2270 rExtraConductivities[1],
2273 mpParameters->Physiological().ExtracellularConductivities().set(extra);
2278 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2279 rExtraConductivities[0],
2282 mpParameters->Physiological().ExtracellularConductivities().set(extra);
2287 XSD_CREATE_WITH_FIXED_ATTR1(cp::conductivity_type, cond, bathConductivity,
"mS/cm");
2288 mpParameters->Physiological().BathConductivity().set(cond);
2305 if (tissueIds.empty() || bathIds.empty())
2307 EXCEPTION(
"Identifying set must be non-empty");
2309 std::set<unsigned> shared_identifiers;
2310 std::set_intersection(tissueIds.begin(),
2314 std::inserter(shared_identifiers, shared_identifiers.begin()));
2316 if (!shared_identifiers.empty())
2318 EXCEPTION(
"Tissue identifiers and bath identifiers overlap");
2326 XSD_CREATE_WITH_FIXED_ATTR1(cp::inverse_length_type, ratio_object, ratio,
"1/cm");
2327 mpParameters->Physiological().SurfaceAreaToVolumeRatio().set(ratio_object);
2332 XSD_CREATE_WITH_FIXED_ATTR1(cp::capacitance_type, capacitance_object, capacitance,
"uF/cm^2");
2333 mpParameters->Physiological().Capacitance().set(capacitance_object);
2339 XSD_CREATE_WITH_FIXED_ATTR3(cp::time_steps_type, time_steps,
2340 odeTimeStep, pdeTimeStep, printingTimeStep,
"ms");
2364 EXCEPTION(
"Ode time-step should be positive");
2368 EXCEPTION(
"Pde time-step should be positive");
2372 EXCEPTION(
"Printing time-step should be positive");
2377 EXCEPTION(
"Printing time-step should not be smaller than PDE time-step");
2382 EXCEPTION(
"Printing time-step should be a multiple of PDE time step");
2387 EXCEPTION(
"Ode time-step should not be greater than PDE time-step");
2394 EXCEPTION(
"Checkpoint time-step should be positive");
2399 EXCEPTION(
"Checkpoint time-step should be a multiple of printing time-step");
2406 ENSURE_SECTION_PRESENT(
mpParameters->Numerical().KSPTolerances(), cp::ksp_tolerances_type);
2408 mpParameters->Numerical().KSPTolerances()->KSPAbsolute().reset();
2409 mpParameters->Numerical().KSPTolerances()->KSPRelative().set(relativeTolerance);
2414 ENSURE_SECTION_PRESENT(
mpParameters->Numerical().KSPTolerances(), cp::ksp_tolerances_type);
2416 mpParameters->Numerical().KSPTolerances()->KSPRelative().reset();
2417 mpParameters->Numerical().KSPTolerances()->KSPAbsolute().set(absoluteTolerance);
2422 if (warnOfChange && strcmp(
GetKSPSolver(), kspSolver) != 0)
2425 WARNING(
"Code has changed the KSP solver type from " <<
GetKSPSolver() <<
" to " << kspSolver);
2429 if (strcmp(kspSolver,
"gmres") == 0)
2431 mpParameters->Numerical().KSPSolver().set(cp::ksp_solver_type::gmres);
2434 if (strcmp(kspSolver,
"cg") == 0)
2436 mpParameters->Numerical().KSPSolver().set(cp::ksp_solver_type::cg);
2439 if (strcmp(kspSolver,
"symmlq") == 0)
2441 mpParameters->Numerical().KSPSolver().set(cp::ksp_solver_type::symmlq);
2444 if (strcmp(kspSolver,
"chebychev") == 0)
2446 mpParameters->Numerical().KSPSolver().set(cp::ksp_solver_type::chebychev);
2450 EXCEPTION(
"Unknown solver type provided");
2456 if (strcmp(kspPreconditioner,
"jacobi") == 0)
2458 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::jacobi);
2461 if (strcmp(kspPreconditioner,
"bjacobi") == 0)
2463 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::bjacobi);
2466 if (strcmp(kspPreconditioner,
"hypre") == 0)
2468 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::hypre);
2471 if (strcmp(kspPreconditioner,
"ml") == 0)
2473 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::ml);
2476 if (strcmp(kspPreconditioner,
"spai") == 0)
2478 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::spai);
2481 if (strcmp(kspPreconditioner,
"twolevelsblockdiagonal") == 0)
2483 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::twolevelsblockdiagonal);
2486 if (strcmp(kspPreconditioner,
"blockdiagonal") == 0)
2488 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::blockdiagonal);
2491 if (strcmp(kspPreconditioner,
"ldufactorisation") == 0)
2493 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::ldufactorisation);
2496 if (strcmp(kspPreconditioner,
"none") == 0)
2498 mpParameters->Numerical().KSPPreconditioner().set(cp::ksp_preconditioner_type::none);
2502 EXCEPTION(
"Unknown preconditioner type provided");
2508 if (strcmp(meshPartioningMethod,
"dumb") == 0)
2510 mpParameters->Numerical().MeshPartitioning().set(cp::mesh_partitioning_type::dumb);
2513 if (strcmp(meshPartioningMethod,
"metis") == 0)
2515 mpParameters->Numerical().MeshPartitioning().set(cp::mesh_partitioning_type::metis);
2518 if (strcmp(meshPartioningMethod,
"parmetis") == 0)
2520 mpParameters->Numerical().MeshPartitioning().set(cp::mesh_partitioning_type::parmetis);
2523 if (strcmp(meshPartioningMethod,
"petsc") == 0)
2525 mpParameters->Numerical().MeshPartitioning().set(cp::mesh_partitioning_type::petsc);
2529 EXCEPTION(
"Unknown mesh partitioning method provided");
2535 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ActionPotentialDurationMap)& apd_maps_sequence
2536 =
mpParameters->PostProcessing()->ActionPotentialDurationMap();
2538 apd_maps_sequence.clear();
2540 for (
unsigned i = 0; i < apdMaps.size(); i++)
2542 XSD_CREATE_WITH_FIXED_ATTR2(cp::apd_map_type, temp,
2543 apdMaps[i].first, apdMaps[i].second,
2545 apd_maps_sequence.push_back(temp);
2552 XSD_SEQUENCE_TYPE(cp::postprocessing_type::UpstrokeTimeMap)& var_type_sequence
2556 var_type_sequence.clear();
2558 for (
unsigned i = 0; i < upstrokeTimeMaps.size(); i++)
2560 XSD_CREATE_WITH_FIXED_ATTR1(cp::upstrokes_map_type, temp,
2561 upstrokeTimeMaps[i],
2563 var_type_sequence.push_back(temp);
2570 XSD_SEQUENCE_TYPE(cp::postprocessing_type::MaxUpstrokeVelocityMap)& max_upstroke_velocity_maps_sequence
2571 =
mpParameters->PostProcessing()->MaxUpstrokeVelocityMap();
2574 max_upstroke_velocity_maps_sequence.clear();
2576 for (
unsigned i = 0; i < maxUpstrokeVelocityMaps.size(); i++)
2578 XSD_CREATE_WITH_FIXED_ATTR1(cp::max_upstrokes_velocity_map_type, temp,
2579 maxUpstrokeVelocityMaps[i],
2582 max_upstroke_velocity_maps_sequence.push_back(temp);
2589 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ConductionVelocityMap)& conduction_velocity_maps_sequence
2590 =
mpParameters->PostProcessing()->ConductionVelocityMap();
2593 conduction_velocity_maps_sequence.clear();
2595 for (
unsigned i = 0; i < conductionVelocityMaps.size(); i++)
2597 cp::conduction_velocity_map_type temp(conductionVelocityMaps[i]);
2598 conduction_velocity_maps_sequence.push_back(temp);
2605 XSD_SEQUENCE_TYPE(cp::postprocessing_type::TimeTraceAtNode)& requested_nodes_sequence
2609 requested_nodes_sequence.clear();
2611 for (
unsigned i = 0; i < requestedNodes.size(); i++)
2613 cp::node_number_type temp(requestedNodes[i]);
2614 requested_nodes_sequence.push_back(temp);
2618template <
unsigned SPACE_DIM>
2622 XSD_SEQUENCE_TYPE(cp::postprocessing_type::PseudoEcgElectrodePosition)& electrodes_sequence
2623 =
mpParameters->PostProcessing()->PseudoEcgElectrodePosition();
2626 electrodes_sequence.clear();
2628 for (
unsigned i = 0; i < rPseudoEcgElectrodePositions.size(); i++)
2630 cp::point_type temp(rPseudoEcgElectrodePositions[i].GetWithDefault(0),
2631 rPseudoEcgElectrodePositions[i].GetWithDefault(1),
2632 rPseudoEcgElectrodePositions[i].GetWithDefault(2));
2633 electrodes_sequence.push_back(temp);
2643 ENSURE_SECTION_PRESENT(
mpParameters->Simulation()->OutputVisualizer(), cp::output_visualizer_type);
2650 mpParameters->Simulation()->OutputVisualizer()->meshalyzer(
2651 useMeshalyzer ? cp::yesno_type::yes : cp::yesno_type::no);
2659 useCmgui ? cp::yesno_type::yes : cp::yesno_type::no);
2667 useVtk ? cp::yesno_type::yes : cp::yesno_type::no);
2674 mpParameters->Simulation()->OutputVisualizer()->parallel_vtk(
2675 useParallelVtk ? cp::yesno_type::yes : cp::yesno_type::no);
2682 mpParameters->Simulation()->OutputVisualizer()->precision(numberOfDigits);
2686 unsigned index,
double magnitude,
2687 double startTime,
double duration)
2691 cp::axis_type axis = cp::axis_type::x;
2694 axis = cp::axis_type::y;
2696 else if (index == 2)
2698 axis = cp::axis_type::z;
2701 XSD_CREATE_WITH_FIXED_ATTR1(cp::surface_stimulus_strength_type, strength, magnitude,
"uA/cm^2");
2702 XSD_CREATE_WITH_FIXED_ATTR1(cp::time_type, start_time, startTime,
"ms");
2703 XSD_CREATE_WITH_FIXED_ATTR1(cp::time_type, duration_time, duration,
"ms");
2707 cp::electrodes_type element(groundSecondElectrode ? cp::yesno_type::yes : cp::yesno_type::no,
2716 mpParameters->Simulation()->Electrodes()->GroundSecondElectrode(groundSecondElectrode ? cp::yesno_type::yes : cp::yesno_type::no);
2717 mpParameters->Simulation()->Electrodes()->PerpendicularToAxis(axis);
2718 mpParameters->Simulation()->Electrodes()->Strength(strength);
2719 mpParameters->Simulation()->Electrodes()->StartTime(start_time);
2720 mpParameters->Simulation()->Electrodes()->Duration(duration_time);
2725 unsigned& rIndex,
double& rMagnitude,
2726 double& rStartTime,
double& rDuration)
2730 EXCEPTION(
"Attempted to get electrodes that have not been defined.");
2734 rGroundSecondElectrode = (
mpParameters->Simulation()->Electrodes()->GroundSecondElectrode() == cp::yesno_type::yes);
2736 cp::axis_type axis =
mpParameters->Simulation()->Electrodes()->PerpendicularToAxis();
2737 if (axis == cp::axis_type::x)
2741 else if (axis == cp::axis_type::y)
2750 rMagnitude =
mpParameters->Simulation()->Electrodes()->Strength();
2751 rStartTime =
mpParameters->Simulation()->Electrodes()->StartTime();
2752 rDuration =
mpParameters->Simulation()->Electrodes()->Duration();
2759 bool result =
false;
2760 if (
mpParameters->Numerical().UseStateVariableInterpolation().present())
2762 result =
mpParameters->Numerical().UseStateVariableInterpolation().get() == cp::yesno_type::yes;
2769 if (useStateVariableInterpolation)
2771 mpParameters->Numerical().UseStateVariableInterpolation().set(cp::yesno_type::yes);
2775 mpParameters->Numerical().UseStateVariableInterpolation().set(cp::yesno_type::no);
2781 return mpParameters->Physiological().ApplyDrug().present();
2786 CHECK_EXISTS(
HasDrugDose(),
"Physiological/ApplyDrug");
2787 return mpParameters->Physiological().ApplyDrug()->concentration();
2792 if (!
mpParameters->Physiological().ApplyDrug().present())
2794 cp::apply_drug_type drug(drugDose);
2799 mpParameters->Physiological().ApplyDrug()->concentration(drugDose);
2805 CHECK_EXISTS(
HasDrugDose(),
"Physiological/ApplyDrug");
2806 std::map<std::string, std::pair<double, double> > ic50s;
2808 XSD_SEQUENCE_TYPE(cp::apply_drug_type::IC50)& ic50_seq =
mpParameters->Physiological().ApplyDrug()->IC50();
2810 for (XSD_ITERATOR_TYPE(cp::apply_drug_type::IC50) i = ic50_seq.begin();
2811 i != ic50_seq.end();
2814 std::pair<double, double> ic50_hill(*i, i->hill());
2815 std::string current = i->current();
2816 ic50s[current] = ic50_hill;
2824 if (!
mpParameters->Physiological().ApplyDrug().present())
2828 XSD_SEQUENCE_TYPE(cp::apply_drug_type::IC50)& ic50_seq =
mpParameters->Physiological().ApplyDrug()->IC50();
2829 if (ic50_seq.empty())
2834 bool entry_exists =
false;
2835 cp::ic50_type ic50_elt(ic50, rCurrentName);
2836 ic50_elt.hill(hill);
2837 for (XSD_ITERATOR_TYPE(cp::apply_drug_type::IC50) i = ic50_seq.begin();
2838 i != ic50_seq.end();
2841 if (i->current() == rCurrentName)
2843 entry_exists =
true;
2850 ic50_seq.push_back(ic50_elt);
2907 return mpParameters->Simulation()->Purkinje().present();
2912 CHECK_EXISTS(
mpParameters->Physiological().Purkinje().present(),
"Physiological/Purkinje");
2913 CHECK_EXISTS(
mpParameters->Physiological().Purkinje()->Capacitance().present(),
2914 "Physiological/Purkinje/Capacitance");
2915 return mpParameters->Physiological().Purkinje()->Capacitance().get();
2920 ENSURE_SECTION_PRESENT(
mpParameters->Physiological().Purkinje(), cp::purkinje_physiological_type);
2921 XSD_CREATE_WITH_FIXED_ATTR1(cp::capacitance_type, purk_Cm, capacitance,
"uF/cm^2");
2922 mpParameters->Physiological().Purkinje()->Capacitance().set(purk_Cm);
2927 CHECK_EXISTS(
mpParameters->Physiological().Purkinje().present(),
"Physiological/Purkinje");
2928 CHECK_EXISTS(
mpParameters->Physiological().Purkinje()->SurfaceAreaToVolumeRatio().present(),
2929 "Physiological/Purkinje/SurfaceAreaToVolumeRatio");
2930 return mpParameters->Physiological().Purkinje()->SurfaceAreaToVolumeRatio().get();
2935 ENSURE_SECTION_PRESENT(
mpParameters->Physiological().Purkinje(), cp::purkinje_physiological_type);
2936 XSD_CREATE_WITH_FIXED_ATTR1(cp::inverse_length_type, purk_Am, ratio,
"1/cm");
2937 mpParameters->Physiological().Purkinje()->SurfaceAreaToVolumeRatio().set(purk_Am);
2942 CHECK_EXISTS(
mpParameters->Physiological().Purkinje().present(),
"Physiological/Purkinje");
2943 CHECK_EXISTS(
mpParameters->Physiological().Purkinje()->Conductivity().present(),
2944 "Physiological/Purkinje/Conductivity");
2945 return mpParameters->Physiological().Purkinje()->Conductivity().get();
2950 ENSURE_SECTION_PRESENT(
mpParameters->Physiological().Purkinje(), cp::purkinje_physiological_type);
2951 XSD_CREATE_WITH_FIXED_ATTR1(cp::conductivity_type, purkinje_conductivity, conductivity,
"mS/cm");
2952 mpParameters->Physiological().Purkinje()->Conductivity().set(purkinje_conductivity);
2964 xercesc::DOMElement* pRootElement)
2966 using namespace xercesc;
2969 "ResumeSimulation/ArchiveDirectory");
2970 if (elts.size() > 0)
2973 DOMElement* p_dir_elt = elts[0];
2974 p_dir_elt->setAttribute(X(
"relative_to"), X(
"chaste_test_output"));
2979 xercesc::DOMElement* pRootElement)
2984 "Simulation/IonicModels/Default");
2985 if (p_elt_list.size() > 0)
2987 assert(p_elt_list.size() == 1);
2991 for (
unsigned i = 0; i < p_elt_list.size(); i++)
2999 xercesc::DOMElement* pRootElement)
3003 "Numerical/KSPPreconditioner");
3004 if (p_elt_list.size() > 0)
3006 assert(p_elt_list.size() == 1);
3007 std::string text_value = X2C(p_elt_list[0]->getTextContent());
3008 if (text_value ==
"ilu")
3010 EXCEPTION(
"PETSc does not have a parallel implementation of ilu, so we no longer allow it as an option. Use bjacobi instead.");
3016 xercesc::DOMElement* pRootElement)
3020 "Simulation/ConductivityHeterogeneities");
3021 if (p_elt_list.size() > 0)
3023 assert(p_elt_list.size() == 1);
3024 xercesc::DOMNode* p_parent = p_elt_list[0]->getParentNode();
3025 xercesc::DOMNode* p_child = p_parent->removeChild(p_elt_list[0]);
3027 assert(p_phys_list.size() == 1);
3028 p_phys_list[0]->appendChild(p_child);
3033 xercesc::DOMElement* pRootElement)
3036 if (p_sim_list.size() > 0)
3038 std::vector<xercesc::DOMElement*> p_viz_list =
XmlTools::FindElements(p_sim_list[0],
"OutputVisualizer");
3039 if (p_viz_list.empty())
3042 xercesc::DOMElement* p_viz_elt = pDocument->createElementNS(X(
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_3"), X(
"OutputVisualizer"));
3043 p_sim_list[0]->appendChild(p_viz_elt);
3044 p_viz_elt->setAttribute(X(
"meshalyzer"), X(
"yes"));
3057template void HeartConfig::GetIonicModelRegions<3u>(std::vector<boost::shared_ptr<
AbstractChasteRegion<3u> > >&, std::vector<cp::ionic_model_selection_type>&)
const;
3058template void HeartConfig::GetStimuli<3u>(std::vector<boost::shared_ptr<AbstractStimulusFunction> >&, std::vector<boost::shared_ptr<
AbstractChasteRegion<3u> > >&)
const;
3059template 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> >*);
3060template void HeartConfig::GetConductivityHeterogeneities<3u>(std::vector<boost::shared_ptr<
AbstractChasteRegion<3u> > >&, std::vector<c_vector<double, 3> >&, std::vector<c_vector<double, 3> >&)
const;
3062template void HeartConfig::GetIonicModelRegions<2u>(std::vector<boost::shared_ptr<
AbstractChasteRegion<2u> > >&, std::vector<cp::ionic_model_selection_type>&)
const;
3063template void HeartConfig::GetStimuli<2u>(std::vector<boost::shared_ptr<AbstractStimulusFunction> >&, std::vector<boost::shared_ptr<
AbstractChasteRegion<2u> > >&)
const;
3064template 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> >*);
3065template void HeartConfig::GetConductivityHeterogeneities<2u>(std::vector<boost::shared_ptr<
AbstractChasteRegion<2u> > >&, std::vector<c_vector<double, 3> >&, std::vector<c_vector<double, 3> >&)
const;
3067template void HeartConfig::GetIonicModelRegions<1u>(std::vector<boost::shared_ptr<
AbstractChasteRegion<1u> > >&, std::vector<cp::ionic_model_selection_type>&)
const;
3068template void HeartConfig::GetStimuli<1u>(std::vector<boost::shared_ptr<AbstractStimulusFunction> >&, std::vector<boost::shared_ptr<
AbstractChasteRegion<1u> > >&)
const;
3069template 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> >*);
3070template void HeartConfig::GetConductivityHeterogeneities<1u>(std::vector<boost::shared_ptr<
AbstractChasteRegion<1u> > >&, std::vector<c_vector<double, 3> >&, std::vector<c_vector<double, 3> >&)
const;
#define EXCEPTION(message)
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()
#define CHASTE_CLASS_EXPORT(T)
static std::string GetArchiveDirectory()
static const char * GetRootDir()
virtual void SetPath(const std::string &rPath, RelativeTo::Value relativeTo)
FileFinder CopyTo(const FileFinder &rDest) const
SchemaLocationsMap mSchemaLocations
void SetRequestedNodalTimeTraces(std::vector< unsigned > &requestedNodes)
void GetStimuli(std::vector< boost::shared_ptr< AbstractStimulusFunction > > &rStimuliApplied, std::vector< boost::shared_ptr< AbstractChasteRegion< DIM > > > &rStimulatedAreas) const
DistributedTetrahedralMeshPartitionType::type GetMeshPartitioning() const
bool AreCellularTransmuralHeterogeneitiesRequested()
unsigned GetMaxCheckpointsOnDisk() const
std::map< std::string, std::string > SchemaLocationsMap
bool IsSimulationDefined() const
void SetUseMassLumpingForPrecond(bool useMassLumping=true)
void SetIntracellularConductivities(const c_vector< double, 3 > &rIntraConductivities)
void GetSheetDimensions(c_vector< double, 2 > &sheetDimensions) const
void SetTissueAndBathIdentifiers(const std::set< unsigned > &rTissueIds, const std::set< unsigned > &rBathIds)
std::string GetMeshName() const
cp::media_type GetConductivityMedia() const
double GetCapacitance() const
std::set< unsigned > mBathIdentifiers
void SetMaxUpstrokeVelocityMaps(std::vector< double > &rMaxUpstrokeVelocityMaps)
void SetConductivityHeterogeneitiesEllipsoid(std::vector< ChasteEllipsoid< 3 > > &rConductivityAreas, std::vector< c_vector< double, 3 > > &rIntraConductivities, std::vector< c_vector< double, 3 > > &rExtraConductivities)
double GetAbsoluteTolerance() const
void SetUseFixedNumberIterationsLinearSolver(bool useFixedNumberIterations=true, unsigned evaluateNumItsEveryNSolves=UINT_MAX)
void SetBathMultipleConductivities(std::map< unsigned, double > bathConductivities)
double GetPurkinjeSurfaceAreaToVolumeRatio()
HeartFileFinder GetArchivedSimulationDir() const
static boost::shared_ptr< HeartConfig > mpInstance
double GetPdeTimeStep() const
bool mUseFixedNumberIterations
double GetDrugDose() const
bool GetCreateFibre() const
double GetPrintingTimeStep() const
void SetDefaultIonicModel(const cp::ionic_models_available_type &rIonicModel)
void CheckResumeSimulationIsDefined(std::string callingMethod="") const
bool GetUseFixedNumberIterationsLinearSolver()
void CopySchema(const std::string &rToDirectory)
void SetElectrodeParameters(bool groundSecondElectrode, unsigned index, double magnitude, double startTime, double duration)
void GetOutputVariables(std::vector< std::string > &rOutputVariables) const
void SetSheetDimensions(double x, double y, double inter_node_space)
bool mUseFixedSchemaLocation
void SetPrintingTimeStep(double printingTimeStep)
boost::shared_ptr< cp::chaste_parameters_type > mpParameters
double GetMidLayerFraction()
void SetFibreLength(double x, double inter_node_space)
unsigned GetVisualizerOutputPrecision()
void SetPurkinjeCapacitance(double capacitance)
bool IsOutputVisualizerPresent() const
void SetUpstrokeTimeMaps(std::vector< double > &rUpstrokeTimeMaps)
void SetApdMaps(const std::vector< std::pair< double, double > > &rApdMaps)
double GetSurfaceAreaToVolumeRatio() const
double GetSimulationDuration() const
void SetDrugDose(double drugDose)
double GetOdeTimeStep() const
FileFinder mParametersFilePath
bool IsPostProcessingSectionPresent() const
bool IsMaxUpstrokeVelocityMapRequested() const
void SetKSPSolver(const char *kspSolver, bool warnOfChange=false)
bool IsPostProcessingRequested() const
void SetUseFixedSchemaLocation(bool useFixedSchemaLocation)
void SetOutputUsingOriginalNodeOrdering(bool useOriginal)
bool GetVisualizeWithParallelVtk() const
unsigned GetSpaceDimension() const
bool GetCreateMesh() const
void SetIc50Value(const std::string &rCurrentName, double ic50, double hill=1.0)
bool IsAnyNodalTimeTraceRequested() const
void SetOutputDirectory(const std::string &rOutputDirectory)
std::map< unsigned, double > mBathConductivities
FileFinder GetParametersFilePath()
void EnsurePostProcessingSectionPresent()
void SetUseReactionDiffusionOperatorSplitting(bool useOperatorSplitting=true)
void CheckTimeSteps() 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 SetDomain(const cp::domain_type &rDomain)
const char * GetKSPPreconditioner() const
bool GetUseAbsoluteTolerance() const
bool IsSimulationResumed() const
void SetFixedSchemaLocations(const SchemaLocationsMap &rSchemaLocations)
bool mUserAskedForCellularTransmuralHeterogeneities
bool GetVisualizeWithCmgui() const
void EnsureOutputVisualizerExists(void)
void SetUseStateVariableInterpolation(bool useStateVariableInterpolation=true)
bool GetOutputUsingOriginalNodeOrdering()
bool IsElectrodesPresent() const
void SetMeshPartitioning(const char *meshPartioningMethod)
bool IsApdMapsRequested() const
bool IsConductionVelocityMapsRequested() const
double GetRelativeTolerance() const
void GetNodalTimeTraceRequested(std::vector< unsigned > &rRequestedNodes) const
unsigned GetMidLayerIndex()
void SetUseRelativeTolerance(double relativeTolerance)
const std::set< unsigned > & rGetBathIdentifiers()
void SetVisualizeWithMeshalyzer(bool useMeshalyzer=true)
void SetPdeTimeStep(double pdeTimeStep)
cp::ionic_model_selection_type GetDefaultIonicModel() const
void SetSlabDimensions(double x, double y, double z, double inter_node_space)
void SetSpaceDimension(unsigned spaceDimension)
unsigned GetEvaluateNumItsEveryNSolves()
boost::shared_ptr< cp::chaste_parameters_type > ReadFile(const std::string &rFileName)
unsigned mEvaluateNumItsEveryNSolves
void GetApdMaps(std::vector< std::pair< double, double > > &rApdMaps) const
void SetSurfaceAreaToVolumeRatio(double ratio)
void GetIonicModelRegions(std::vector< boost::shared_ptr< AbstractChasteRegion< DIM > > > &rDefinedRegions, std::vector< cp::ionic_model_selection_type > &rIonicModels) const
void SetUseAbsoluteTolerance(double absoluteTolerance)
bool GetUseRelativeTolerance() const
void SetPurkinjeSurfaceAreaToVolumeRatio(double ratio)
void SetKSPPreconditioner(const char *kspPreconditioner)
void GetConductionVelocityMaps(std::vector< unsigned > &rConductionVelocityMaps) const
void SetDefaultSchemaLocations()
void SetOdeTimeStep(double odeTimeStep)
bool GetCreateSlab() const
double GetPurkinjeCapacitance()
unsigned GetEpiLayerIndex()
void SetBathConductivity(double bathConductivity)
double GetPurkinjeConductivity()
void SetIonicModelRegions(std::vector< ChasteCuboid< 3 > > &rDefinedRegions, std::vector< cp::ionic_model_selection_type > &rIonicModels) const
bool GetUseReactionDiffusionOperatorSplitting()
void SetVisualizeWithVtk(bool useVtk=true)
void SetExtracellularConductivities(const c_vector< double, 3 > &rExtraConductivities)
std::string GetOutputFilenamePrefix() const
bool GetVisualizeWithMeshalyzer() const
void SetSimulationDuration(double simulationDuration)
void SetCapacitance(double capacitance)
void SetConductionVelocityMaps(std::vector< unsigned > &rConductionVelocityMaps)
double GetEndoLayerFraction()
void SetConductivityHeterogeneities(std::vector< ChasteCuboid< 3 > > &rConductivityAreas, std::vector< c_vector< double, 3 > > &rIntraConductivities, std::vector< c_vector< double, 3 > > &rExtraConductivities)
bool GetConductivityHeterogeneitiesProvided() const
void SetOutputVariables(const std::vector< std::string > &rOutputVariables)
void GetSlabDimensions(c_vector< double, 3 > &slabDimensions) const
void GetPseudoEcgElectrodePositions(std::vector< ChastePoint< SPACE_DIM > > &rPseudoEcgElectrodePositions) const
void GetElectrodeParameters(bool &rGroundSecondElectrode, unsigned &rIndex, double &rMagnitude, double &rStartTime, double &rDuration)
void LoadFromCheckpoint()
void Write(bool useArchiveLocationInfo=false, std::string subfolderName="output")
std::map< std::string, std::pair< double, double > > GetIc50Values()
std::set< unsigned > mTissueIdentifiers
double GetEpiLayerFraction()
unsigned GetEndoLayerIndex()
bool mUseMassLumpingForPrecond
double GetCheckpointTimestep() const
bool IsMeshProvided() const
bool GetVisualizeWithVtk() const
void SetOutputFilenamePrefix(const std::string &rOutputFilenamePrefix)
void SetCheckpointSimulation(bool checkpointSimulation, double checkpointTimestep=-1.0, unsigned maxCheckpointsOnDisk=UINT_MAX)
void SetPurkinjeConductivity(double conductivity)
void GetIntracellularConductivities(c_vector< double, 3 > &rIntraConductivities) const
bool GetUseMassLumpingForPrecond()
void SetMeshFileName(std::string meshPrefix, cp::media_type fibreDefinition=cp::media_type::NoFibreOrientation)
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 GetUpstrokeTimeMaps(std::vector< double > &rUpstrokeTimeMaps) const
bool GetUseStateVariableInterpolation() const
const std::set< unsigned > & rGetTissueIdentifiers()
unsigned GetVersionFromNamespace(const std::string &rNamespaceUri)
bool mUseReactionDiffusionOperatorSplitting
void GetMaxUpstrokeVelocityMaps(std::vector< double > &rUpstrokeVelocityMaps) const
double GetInterNodeSpace() const
cp::domain_type GetDomain() const
bool GetOutputVariablesProvided() const
std::string GetOutputDirectory() const
double GetBathConductivity(unsigned bathRegion=UINT_MAX) const
void SetUseMassLumping(bool useMassLumping=true)
bool IsPseudoEcgCalculationRequested() const
void CheckSimulationIsDefined(std::string callingMethod="") const
bool IsUpstrokeTimeMapsRequested() const
void SetVisualizeWithCmgui(bool useCmgui=true)
void GetExtracellularConductivities(c_vector< double, 3 > &rExtraConductivities) const
bool GetCheckpointSimulation() const
void SetVisualizeWithParallelVtk(bool useParallelVtk=true)
void UpdateParametersFromResumeSimulation(boost::shared_ptr< cp::chaste_parameters_type > pResumeParameters)
void SetParametersFile(const std::string &rFileName)
void GetFibreLength(c_vector< double, 1 > &fibreLength) const
static HeartConfig * Instance()
const char * GetKSPSolver() const
void SetVisualizerOutputPrecision(unsigned numberOfDigits)
void SetOdePdeAndPrintingTimeSteps(double odeTimeStep, double pdeTimeStep, double printingTimeStep)
void SetPseudoEcgElectrodePositions(const std::vector< ChastePoint< SPACE_DIM > > &rPseudoEcgElectrodePositions)
bool IsAdaptivityParametersPresent() const
bool GetCreateSheet() const
static bool IsRegionBath(HeartRegionType regionId)
std::string GetOutputDirectoryFullPath() const