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>
64 using namespace xsd::cxx::tree;
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";
305 map[
"cp"].name =
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_4";
306 map[
"cp"].schema =
"ChasteParameters_3_4.xsd";
308 cp::ChasteParameters(*p_parameters_file, *
mpParameters, map);
311 if (useArchiveLocationInfo)
330 boost::shared_ptr<cp::chaste_parameters_type> p_new_parameters =
mpParameters;
346 if (
FileFinder(defaults_filename_xml).Exists())
348 boost::shared_ptr<cp::chaste_parameters_type> p_defaults =
ReadFile(defaults_filename_xml);
355 if (p_new_parameters->ResumeSimulation().present())
369 std::string schema_name(
"ChasteParameters_3_4.xsd");
371 if (!schema_location.
Exists())
375 if (!schema_location.
Exists())
378 std::string message(
"Unable to locate schema file " + schema_name +
379 ". 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";
410 unsigned version_major = 0;
411 unsigned version_minor = 0;
412 if (rNamespaceUri ==
"")
419 std::string uri_base(
"https://chaste.comlab.ox.ac.uk/nss/parameters/");
420 if (rNamespaceUri.substr(0, uri_base.length()) == uri_base)
422 std::istringstream version_string(rNamespaceUri.substr(uri_base.length()));
423 version_string >> version_major;
424 version_string.ignore(1);
425 version_string >> version_minor;
426 if (version_string.fail())
434 unsigned version = version_major * 1000 + version_minor;
437 EXCEPTION(rNamespaceUri +
" is not a recognised Chaste parameters namespace.");
456 ::xml_schema::properties props;
483 xercesc::DOMElement* p_root_elt = p_doc->getDocumentElement();
484 std::string namespace_uri(X2C(p_root_elt->getNamespaceURI()));
508 std::auto_ptr<cp::chaste_parameters_type> p_params(cp::ChasteParameters(*p_doc, ::xml_schema::flags::dont_initialize, props));
512 return boost::shared_ptr<cp::chaste_parameters_type>(p_params);
514 catch (
const xml_schema::exception& e)
516 std::cerr << e << std::endl;
519 EXCEPTION(
"XML parsing error in configuration file: " + rFileName);
552 EXCEPTION(
"Problem type and space dimension should match when restarting a simulation.");
559 if (pResumeParameters->ResumeSimulation()->Stimuli().present())
561 mpParameters->Simulation()->Stimuli().set(pResumeParameters->ResumeSimulation()->Stimuli().get());
566 if (pResumeParameters->ResumeSimulation()->CellHeterogeneities().present())
568 if (!
mpParameters->Simulation()->CellHeterogeneities().present())
571 mpParameters->Simulation()->CellHeterogeneities().set(pResumeParameters->ResumeSimulation()->CellHeterogeneities().get());
576 XSD_SEQUENCE_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity)&
577 new_seq = pResumeParameters->ResumeSimulation()->CellHeterogeneities()->CellHeterogeneity();
578 XSD_SEQUENCE_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity)&
579 orig_seq =
mpParameters->Simulation()->CellHeterogeneities()->CellHeterogeneity();
580 for (XSD_ITERATOR_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity) i = new_seq.begin();
584 orig_seq.push_back(*i);
590 if (pResumeParameters->ResumeSimulation()->CheckpointSimulation().present())
593 pResumeParameters->ResumeSimulation()->CheckpointSimulation()->timestep(),
594 pResumeParameters->ResumeSimulation()->CheckpointSimulation()->max_checkpoints_on_disk());
598 if (pResumeParameters->ResumeSimulation()->OutputVisualizer().present())
608 cp::numerical_type& r_resume = pResumeParameters->Numerical();
610 if (r_resume.TimeSteps().present())
612 r_user.TimeSteps().set(r_resume.TimeSteps().get());
614 if (r_resume.KSPTolerances().present())
616 r_user.KSPTolerances().set(r_resume.KSPTolerances().get());
618 if (r_resume.KSPSolver().present())
620 r_user.KSPSolver().set(r_resume.KSPSolver().get());
622 if (r_resume.KSPPreconditioner().present())
624 r_user.KSPPreconditioner().set(r_resume.KSPPreconditioner().get());
626 if (r_resume.AdaptivityParameters().present())
628 r_user.AdaptivityParameters().set(r_resume.AdaptivityParameters().get());
633 if (pResumeParameters->PostProcessing().present())
636 cp::postprocessing_type& r_resume = pResumeParameters->PostProcessing().get();
637 cp::postprocessing_type& r_user =
mpParameters->PostProcessing().get();
638 if (!r_resume.ActionPotentialDurationMap().empty())
640 r_user.ActionPotentialDurationMap() = r_resume.ActionPotentialDurationMap();
642 if (!r_resume.UpstrokeTimeMap().empty())
644 r_user.UpstrokeTimeMap() = r_resume.UpstrokeTimeMap();
646 if (!r_resume.MaxUpstrokeVelocityMap().empty())
648 r_user.MaxUpstrokeVelocityMap() = r_resume.MaxUpstrokeVelocityMap();
650 if (!r_resume.ConductionVelocityMap().empty())
652 r_user.ConductionVelocityMap() = r_resume.ConductionVelocityMap();
681 EXCEPTION(callingMethod +
" information is not available in a resumed simulation.");
689 EXCEPTION(callingMethod +
" information is not available in a standard (non-resumed) simulation.");
697 CHECK_EXISTS(
mpParameters->Simulation()->SpaceDimension().present(),
"Simulation/SpaceDimension");
698 return mpParameters->Simulation()->SpaceDimension().get();
702 return mpParameters->ResumeSimulation()->SpaceDimension();
710 CHECK_EXISTS(
mpParameters->Simulation()->SimulationDuration().present(),
"Simulation/SimulationDuration");
711 return mpParameters->Simulation()->SimulationDuration().get();
715 return mpParameters->ResumeSimulation()->SimulationDuration();
723 CHECK_EXISTS(
mpParameters->Simulation()->Domain().present(),
"Simulation/Domain");
736 return mpParameters->Simulation()->IonicModels()->Default();
739 template<
unsigned DIM>
741 std::vector<cp::ionic_model_selection_type>& ionicModels)
const
744 definedRegions.clear();
747 XSD_SEQUENCE_TYPE(cp::ionic_models_type::Region)&
748 regions =
mpParameters->Simulation()->IonicModels()->Region();
750 for (XSD_ITERATOR_TYPE(cp::ionic_models_type::Region) i = regions.begin();
754 cp::ionic_model_region_type ionic_model_region(*i);
756 if (ionic_model_region.Location().Cuboid().present() || ionic_model_region.Location().Ellipsoid().present())
758 if (ionic_model_region.Location().Cuboid().present())
760 cp::point_type point_a = ionic_model_region.Location().Cuboid()->LowerCoordinates();
761 cp::point_type point_b = ionic_model_region.Location().Cuboid()->UpperCoordinates();
791 else if (ionic_model_region.Location().Ellipsoid().present())
793 cp::point_type centre = ionic_model_region.Location().Ellipsoid()->Centre();
794 cp::point_type radii = ionic_model_region.Location().Ellipsoid()->Radii();
830 ionicModels.push_back(ionic_model_region.IonicModel());
832 else if(ionic_model_region.Location().EpiLayer().present() || ionic_model_region.Location().MidLayer().present() || ionic_model_region.Location().EndoLayer().present() )
835 EXCEPTION(
"Definition of transmural layers is not yet supported for defining different ionic models, please use cuboids instead");
839 EXCEPTION(
"Invalid region type for ionic model definition");
856 return (mesh.Slab().present() || mesh.Sheet().present() || mesh.Fibre().present());
864 return (mesh.Slab().present());
872 return (mesh.Sheet().present());
880 return (mesh.Fibre().present());
888 return (
mpParameters->Simulation()->Mesh()->LoadMesh().present());
897 EXCEPTION(
"Tissue slabs can only be defined in 3D");
900 optional<cp::slab_type, false> slab_dimensions =
mpParameters->Simulation()->Mesh()->Slab();
902 slabDimensions[0] = slab_dimensions->x();
903 slabDimensions[1] = slab_dimensions->y();
904 slabDimensions[2] = slab_dimensions->z();
913 EXCEPTION(
"Tissue sheets can only be defined in 2D");
916 optional<cp::sheet_type, false> sheet_dimensions =
mpParameters->Simulation()->Mesh()->Sheet();
918 sheetDimensions[0] = sheet_dimensions->x();
919 sheetDimensions[1] = sheet_dimensions->y();
928 EXCEPTION(
"Tissue fibres can only be defined in 1D");
931 optional<cp::fibre_type, false> fibre_length =
mpParameters->Simulation()->Mesh()->Fibre();
933 fibreLength[0] = fibre_length->x();
944 return mpParameters->Simulation()->Mesh()->Slab()->inter_node_space();
948 return mpParameters->Simulation()->Mesh()->Sheet()->inter_node_space();
952 return mpParameters->Simulation()->Mesh()->Fibre()->inter_node_space();
956 #define COVERAGE_IGNORE
958 #undef COVERAGE_IGNORE
967 return mpParameters->Simulation()->Mesh()->LoadMesh()->name();
975 return mpParameters->Simulation()->Mesh()->LoadMesh()->conductivity_media();
978 template <
unsigned DIM>
991 XSD_SEQUENCE_TYPE(cp::stimuli_type::Stimulus) stimuli =
mpParameters->Simulation()->Stimuli()->Stimulus();
993 for (XSD_ITERATOR_TYPE(cp::stimuli_type::Stimulus) i = stimuli.begin();
997 cp::stimulus_type stimulus(*i);
998 if (stimulus.Location().Cuboid().present() || stimulus.Location().Ellipsoid().present())
1000 boost::shared_ptr<AbstractChasteRegion<DIM> > area_ptr;
1001 if (stimulus.Location().Cuboid().present() )
1003 cp::point_type point_a = stimulus.Location().Cuboid()->LowerCoordinates();
1004 cp::point_type point_b = stimulus.Location().Cuboid()->UpperCoordinates();
1033 else if (stimulus.Location().Ellipsoid().present())
1035 cp::point_type centre = stimulus.Location().Ellipsoid()->Centre();
1036 cp::point_type radii = stimulus.Location().Ellipsoid()->Radii();
1067 rStimulatedAreas.push_back(area_ptr);
1069 boost::shared_ptr<AbstractStimulusFunction> stim;
1071 if (stimulus.Period().present())
1073 if (stimulus.StopTime().present())
1076 stimulus.Duration(),
1077 stimulus.Period().get(),
1079 stimulus.StopTime().get()));
1084 stimulus.Duration(),
1085 stimulus.Period().get(),
1092 if (stimulus.StopTime().present())
1094 EXCEPTION(
"Stop time can not be defined for SimpleStimulus. Use Duration instead.");
1098 stimulus.Duration(),
1101 rStimuliApplied.push_back( stim );
1103 else if(stimulus.Location().EpiLayer().present() || stimulus.Location().MidLayer().present() || stimulus.Location().EndoLayer().present() )
1105 EXCEPTION(
"Definition of transmural layers is not yet supported for specifying stimulated areas, please use cuboids instead");
1109 EXCEPTION(
"Invalid region type for stimulus definition");
1115 template<
unsigned DIM>
1117 std::vector<double>& rScaleFactorGks,
1118 std::vector<double>& rScaleFactorIto,
1119 std::vector<double>& rScaleFactorGkr,
1120 std::vector<std::map<std::string, double> >* pParameterSettings)
1124 if (!
mpParameters->Simulation()->CellHeterogeneities().present())
1129 XSD_SEQUENCE_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity) cell_heterogeneity
1130 =
mpParameters->Simulation()->CellHeterogeneities()->CellHeterogeneity();
1132 bool user_supplied_negative_value =
false;
1133 bool user_asking_for_transmural_layers =
false;
1134 bool user_asked_for_cuboids_or_ellipsoids =
false;
1135 unsigned counter_of_heterogeneities = 0;
1137 for (XSD_ITERATOR_TYPE(cp::cell_heterogeneities_type::CellHeterogeneity) i = cell_heterogeneity.begin();
1138 i != cell_heterogeneity.end();
1141 cp::cell_heterogeneity_type ht(*i);
1143 if (ht.Location().Cuboid().present())
1145 user_asked_for_cuboids_or_ellipsoids =
true;
1146 cp::point_type point_a = ht.Location().Cuboid()->LowerCoordinates();
1147 cp::point_type point_b = ht.Location().Cuboid()->UpperCoordinates();
1154 else if (ht.Location().Ellipsoid().present())
1156 user_asked_for_cuboids_or_ellipsoids =
true;
1157 cp::point_type centre = ht.Location().Ellipsoid()->Centre();
1158 cp::point_type radii = ht.Location().Ellipsoid()->Radii();
1164 else if (ht.Location().EpiLayer().present())
1168 user_asking_for_transmural_layers =
true;
1171 user_supplied_negative_value=
true;
1175 else if (ht.Location().EndoLayer().present())
1179 user_asking_for_transmural_layers =
true;
1182 user_supplied_negative_value=
true;
1186 else if (ht.Location().MidLayer().present())
1190 user_asking_for_transmural_layers =
true;
1193 user_supplied_negative_value=
true;
1199 EXCEPTION(
"Invalid region type for cell heterogeneity definition");
1203 rScaleFactorGks.push_back(ht.ScaleFactorGks().present() ? (
double)ht.ScaleFactorGks().get() : 1.0);
1204 rScaleFactorIto.push_back(ht.ScaleFactorIto().present() ? (
double)ht.ScaleFactorIto().get() : 1.0);
1205 rScaleFactorGkr.push_back(ht.ScaleFactorGkr().present() ? (
double)ht.ScaleFactorGkr().get() : 1.0);
1208 if (pParameterSettings)
1210 std::map<std::string, double> param_settings;
1211 XSD_SEQUENCE_TYPE(cp::cell_heterogeneity_type::SetParameter)& params = ht.SetParameter();
1212 for (XSD_ITERATOR_TYPE(cp::cell_heterogeneity_type::SetParameter) param_it = params.begin();
1213 param_it != params.end();
1216 cp::set_parameter_type param(*param_it);
1217 param_settings[param.name()] = param.value();
1219 pParameterSettings->push_back(param_settings);
1222 counter_of_heterogeneities++;
1231 if (user_asked_for_cuboids_or_ellipsoids )
1233 EXCEPTION (
"Specification of cellular heterogeneities by cuboids/ellipsoids and layers at the same time is not yet supported");
1241 EXCEPTION (
"Three specifications of layers must be supplied");
1245 EXCEPTION (
"Summation of epicardial, midmyocardial and endocardial fractions should be 1");
1247 if (user_supplied_negative_value)
1249 EXCEPTION (
"Fractions must be positive");
1292 return mpParameters->Physiological().ConductivityHeterogeneities().present();
1295 template<
unsigned DIM>
1298 std::vector< c_vector<double,3> >& rIntraConductivities,
1299 std::vector< c_vector<double,3> >& rExtraConductivities)
const
1303 XSD_ANON_SEQUENCE_TYPE(cp::physiological_type, ConductivityHeterogeneities, ConductivityHeterogeneity)&
1304 conductivity_heterogeneity =
mpParameters->Physiological().ConductivityHeterogeneities()->ConductivityHeterogeneity();
1306 for (XSD_ANON_ITERATOR_TYPE(cp::physiological_type, ConductivityHeterogeneities, ConductivityHeterogeneity) i = conductivity_heterogeneity.begin();
1307 i != conductivity_heterogeneity.end();
1310 cp::conductivity_heterogeneity_type ht(*i);
1312 if (ht.Location().Cuboid().present())
1314 cp::point_type point_a = ht.Location().Cuboid()->LowerCoordinates();
1315 cp::point_type point_b = ht.Location().Cuboid()->UpperCoordinates();
1320 else if (ht.Location().Ellipsoid().present())
1322 cp::point_type centre = ht.Location().Ellipsoid()->Centre();
1323 cp::point_type radii = ht.Location().Ellipsoid()->Radii();
1328 else if (ht.Location().EpiLayer().present() || ht.Location().MidLayer().present() || ht.Location().EndoLayer().present() )
1331 EXCEPTION(
"Definition of transmural layers is not allowed for conductivities heterogeneities, you may use fibre orientation support instead");
1335 EXCEPTION(
"Invalid region type for conductivity definition");
1338 if (ht.IntracellularConductivities().present())
1340 double intra_x = ht.IntracellularConductivities()->longi();
1341 double intra_y = ht.IntracellularConductivities()->trans();
1342 double intra_z = ht.IntracellularConductivities()->normal();
1344 rIntraConductivities.push_back(
Create_c_vector(intra_x, intra_y, intra_z) );
1348 c_vector<double, 3> intra_conductivities;
1350 rIntraConductivities.push_back(intra_conductivities);
1353 if (ht.ExtracellularConductivities().present())
1355 double extra_x = ht.ExtracellularConductivities()->longi();
1356 double extra_y = ht.ExtracellularConductivities()->trans();
1357 double extra_z = ht.ExtracellularConductivities()->normal();
1359 rExtraConductivities.push_back(
Create_c_vector(extra_x, extra_y, extra_z) );
1363 c_vector<double, 3> extra_conductivities;
1365 rExtraConductivities.push_back(extra_conductivities);
1374 CHECK_EXISTS(
mpParameters->Simulation()->OutputDirectory().present(),
"Simulation/OutputDirectory");
1375 return mpParameters->Simulation()->OutputDirectory().get();
1381 CHECK_EXISTS(
mpParameters->Simulation()->OutputFilenamePrefix().present(),
"Simulation/OutputFilenamePrefix");
1382 return mpParameters->Simulation()->OutputFilenamePrefix().get();
1388 return mpParameters->Simulation()->OutputVariables().present();
1394 XSD_SEQUENCE_TYPE(cp::output_variables_type::Var)&
1395 output_variables =
mpParameters->Simulation()->OutputVariables()->Var();
1396 rOutputVariables.clear();
1398 for (XSD_ITERATOR_TYPE(cp::output_variables_type::Var) i = output_variables.begin();
1399 i != output_variables.end();
1402 cp::var_type& r_var(*i);
1405 rOutputVariables.push_back(r_var.name());
1412 bool result =
false;
1413 if (
mpParameters->Simulation()->OutputUsingOriginalNodeOrdering().present())
1415 result = (
mpParameters->Simulation()->OutputUsingOriginalNodeOrdering().get() == cp::yesno_type::yes);
1428 return mpParameters->Simulation()->CheckpointSimulation()->timestep();
1434 return mpParameters->Simulation()->CheckpointSimulation()->max_checkpoints_on_disk();
1448 CHECK_EXISTS(
mpParameters->Physiological().IntracellularConductivities().present(),
"Physiological/IntracellularConductivities");
1449 cp::conductivities_type intra_conductivities
1450 =
mpParameters->Physiological().IntracellularConductivities().get();
1451 double intra_x_cond = intra_conductivities.longi();
1452 double intra_y_cond = intra_conductivities.trans();
1453 double intra_z_cond = intra_conductivities.normal();;
1455 assert(intra_y_cond != DBL_MAX);
1456 assert(intra_z_cond != DBL_MAX);
1458 rIntraConductivities[0] = intra_x_cond;
1459 rIntraConductivities[1] = intra_y_cond;
1460 rIntraConductivities[2] = intra_z_cond;
1465 CHECK_EXISTS(
mpParameters->Physiological().IntracellularConductivities().present(),
"Physiological/IntracellularConductivities");
1466 cp::conductivities_type intra_conductivities
1467 =
mpParameters->Physiological().IntracellularConductivities().get();
1468 double intra_x_cond = intra_conductivities.longi();
1469 double intra_y_cond = intra_conductivities.trans();
1471 assert(intra_y_cond != DBL_MAX);
1473 rIntraConductivities[0] = intra_x_cond;
1474 rIntraConductivities[1] = intra_y_cond;
1479 CHECK_EXISTS(
mpParameters->Physiological().IntracellularConductivities().present(),
"Physiological/IntracellularConductivities");
1480 cp::conductivities_type intra_conductivities
1481 =
mpParameters->Physiological().IntracellularConductivities().get();
1482 double intra_x_cond = intra_conductivities.longi();
1484 rIntraConductivities[0] = intra_x_cond;
1489 CHECK_EXISTS(
mpParameters->Physiological().ExtracellularConductivities().present(),
"Physiological/ExtracellularConductivities");
1490 cp::conductivities_type extra_conductivities
1491 =
mpParameters->Physiological().ExtracellularConductivities().get();
1492 double extra_x_cond = extra_conductivities.longi();
1493 double extra_y_cond = extra_conductivities.trans();
1494 double extra_z_cond = extra_conductivities.normal();;
1496 assert(extra_y_cond != DBL_MAX);
1497 assert(extra_z_cond != DBL_MAX);
1499 rExtraConductivities[0] = extra_x_cond;
1500 rExtraConductivities[1] = extra_y_cond;
1501 rExtraConductivities[2] = extra_z_cond;
1506 CHECK_EXISTS(
mpParameters->Physiological().ExtracellularConductivities().present(),
"Physiological/ExtracellularConductivities");
1507 cp::conductivities_type extra_conductivities
1508 =
mpParameters->Physiological().ExtracellularConductivities().get();
1509 double extra_x_cond = extra_conductivities.longi();
1510 double extra_y_cond = extra_conductivities.trans();
1512 assert(extra_y_cond != DBL_MAX);
1514 rExtraConductivities[0] = extra_x_cond;
1515 rExtraConductivities[1] = extra_y_cond;
1520 CHECK_EXISTS(
mpParameters->Physiological().ExtracellularConductivities().present(),
"Physiological/ExtracellularConductivities");
1521 cp::conductivities_type extra_conductivities
1522 =
mpParameters->Physiological().ExtracellularConductivities().get();
1523 double extra_x_cond = extra_conductivities.longi();
1525 rExtraConductivities[0] = extra_x_cond;
1539 if (bathRegion == UINT_MAX)
1542 CHECK_EXISTS(
mpParameters->Physiological().BathConductivity().present(),
"Physiological/BathConductivity");
1543 return mpParameters->Physiological().BathConductivity().get();
1549 std::map<unsigned, double>::const_iterator map_entry =
mBathConductivities.find(bathRegion);
1553 return map_entry->second;
1558 CHECK_EXISTS(
mpParameters->Physiological().BathConductivity().present(),
"Physiological/BathConductivity");
1559 return mpParameters->Physiological().BathConductivity().get();
1575 CHECK_EXISTS(
mpParameters->Physiological().SurfaceAreaToVolumeRatio().present(),
"Physiological/SurfaceAreaToVolumeRatio");
1576 return mpParameters->Physiological().SurfaceAreaToVolumeRatio().get();
1581 CHECK_EXISTS(
mpParameters->Physiological().Capacitance().present(),
"Physiological/Capacitance");
1582 return mpParameters->Physiological().Capacitance().get();
1587 CHECK_EXISTS(
mpParameters->Numerical().TimeSteps().present(),
"Numerical/TimeSteps");
1593 CHECK_EXISTS(
mpParameters->Numerical().TimeSteps().present(),
"Numerical/TimeSteps");
1599 CHECK_EXISTS(
mpParameters->Numerical().TimeSteps().present(),
"Numerical/TimeSteps");
1600 return mpParameters->Numerical().TimeSteps()->printing();
1605 CHECK_EXISTS(
mpParameters->Numerical().KSPTolerances().present(),
"Numerical/KSPTolerances");
1606 return mpParameters->Numerical().KSPTolerances()->KSPAbsolute().present();
1611 CHECK_EXISTS(
mpParameters->Numerical().KSPTolerances().present(),
"Numerical/KSPTolerances");
1614 EXCEPTION(
"Absolute tolerance is not set in Chaste parameters");
1616 return mpParameters->Numerical().KSPTolerances()->KSPAbsolute().get();
1621 CHECK_EXISTS(
mpParameters->Numerical().KSPTolerances().present(),
"Numerical/KSPTolerances");
1622 return mpParameters->Numerical().KSPTolerances()->KSPRelative().present();
1627 CHECK_EXISTS(
mpParameters->Numerical().KSPTolerances().present(),
"Numerical/KSPTolerances");
1630 EXCEPTION(
"Relative tolerance is not set in Chaste parameters");
1632 return mpParameters->Numerical().KSPTolerances()->KSPRelative().get();
1637 CHECK_EXISTS(
mpParameters->Numerical().KSPSolver().present(),
"Numerical/KSPSolver");
1640 case cp::ksp_solver_type::gmres :
1642 case cp::ksp_solver_type::cg :
1644 case cp::ksp_solver_type::symmlq :
1646 case cp::ksp_solver_type::chebychev :
1649 #define COVERAGE_IGNORE
1651 #undef COVERAGE_IGNORE
1656 CHECK_EXISTS(
mpParameters->Numerical().KSPPreconditioner().present(),
"Numerical/KSPPreconditioner");
1657 switch (
mpParameters->Numerical().KSPPreconditioner().get() )
1659 case cp::ksp_preconditioner_type::jacobi :
1661 case cp::ksp_preconditioner_type::bjacobi :
1663 case cp::ksp_preconditioner_type::hypre :
1665 case cp::ksp_preconditioner_type::ml :
1667 case cp::ksp_preconditioner_type::spai :
1669 case cp::ksp_preconditioner_type::blockdiagonal :
1670 return "blockdiagonal";
1671 case cp::ksp_preconditioner_type::ldufactorisation :
1672 return "ldufactorisation";
1673 case cp::ksp_preconditioner_type::twolevelsblockdiagonal :
1674 return "twolevelsblockdiagonal";
1675 case cp::ksp_preconditioner_type::none :
1679 #define COVERAGE_IGNORE
1680 EXCEPTION(
"Unknown ksp preconditioner");
1681 #undef COVERAGE_IGNORE
1686 CHECK_EXISTS(
mpParameters->Numerical().MeshPartitioning().present(),
"Numerical/MeshPartitioning");
1687 switch (
mpParameters->Numerical().MeshPartitioning().get() )
1689 case cp::mesh_partitioning_type::dumb :
1690 return DistributedTetrahedralMeshPartitionType::DUMB;
1691 case cp::mesh_partitioning_type::metis :
1692 return DistributedTetrahedralMeshPartitionType::METIS_LIBRARY;
1693 case cp::mesh_partitioning_type::parmetis :
1694 return DistributedTetrahedralMeshPartitionType::PARMETIS_LIBRARY;
1695 case cp::mesh_partitioning_type::petsc :
1696 return DistributedTetrahedralMeshPartitionType::PETSC_MAT_PARTITION;
1698 #define COVERAGE_IGNORE
1699 EXCEPTION(
"Unknown mesh partitioning type");
1700 #undef COVERAGE_IGNORE
1706 if (IsAdaptivityParametersPresent)
1708 WARNING(
"Use of the Adaptivity library is deprecated");
1724 ENSURE_SECTION_PRESENT(
mpParameters->PostProcessing(), cp::postprocessing_type);
1745 bool result =
false;
1748 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ActionPotentialDurationMap)&
1749 apd_maps =
mpParameters->PostProcessing()->ActionPotentialDurationMap();
1750 result = (apd_maps.begin() != apd_maps.end());
1760 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ActionPotentialDurationMap)&
1761 apd_maps_sequence =
mpParameters->PostProcessing()->ActionPotentialDurationMap();
1763 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::ActionPotentialDurationMap) i = apd_maps_sequence.begin();
1764 i != apd_maps_sequence.end();
1767 std::pair<double,double> map(i->repolarisation_percentage(),i->threshold());
1769 apd_maps.push_back(map);
1775 bool result =
false;
1778 XSD_SEQUENCE_TYPE(cp::postprocessing_type::UpstrokeTimeMap)&
1779 upstroke_map =
mpParameters->PostProcessing()->UpstrokeTimeMap();
1780 result = (upstroke_map.begin() != upstroke_map.end());
1787 assert(upstroke_time_maps.size() == 0);
1789 XSD_SEQUENCE_TYPE(cp::postprocessing_type::UpstrokeTimeMap)&
1790 upstroke_maps_sequence =
mpParameters->PostProcessing()->UpstrokeTimeMap();
1792 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::UpstrokeTimeMap) i = upstroke_maps_sequence.begin();
1793 i != upstroke_maps_sequence.end();
1796 upstroke_time_maps.push_back(i->threshold());
1802 bool result =
false;
1805 XSD_SEQUENCE_TYPE(cp::postprocessing_type::MaxUpstrokeVelocityMap)&
1806 max_upstroke_velocity_map =
mpParameters->PostProcessing()->MaxUpstrokeVelocityMap();
1807 result = (max_upstroke_velocity_map.begin() != max_upstroke_velocity_map.end());
1815 assert(upstroke_velocity_maps.size() == 0);
1817 XSD_SEQUENCE_TYPE(cp::postprocessing_type::MaxUpstrokeVelocityMap)&
1818 max_upstroke_velocity_maps_sequence =
mpParameters->PostProcessing()->MaxUpstrokeVelocityMap();
1820 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::MaxUpstrokeVelocityMap) i = max_upstroke_velocity_maps_sequence.begin();
1821 i != max_upstroke_velocity_maps_sequence.end();
1824 upstroke_velocity_maps.push_back(i->threshold());
1830 bool result =
false;
1833 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ConductionVelocityMap)&
1834 cond_vel_maps =
mpParameters->PostProcessing()->ConductionVelocityMap();
1835 result = (cond_vel_maps.begin() != cond_vel_maps.end());
1843 assert(conduction_velocity_maps.size() == 0);
1845 XSD_SEQUENCE_TYPE(cp::postprocessing_type::ConductionVelocityMap)&
1846 cond_vel_maps_sequence =
mpParameters->PostProcessing()->ConductionVelocityMap();
1848 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::ConductionVelocityMap) i = cond_vel_maps_sequence.begin();
1849 i != cond_vel_maps_sequence.end();
1852 conduction_velocity_maps.push_back(i->origin_node());
1858 bool result =
false;
1861 XSD_SEQUENCE_TYPE(cp::postprocessing_type::TimeTraceAtNode)&
1862 requested_nodes =
mpParameters->PostProcessing()->TimeTraceAtNode();
1863 result = (requested_nodes.begin() != requested_nodes.end());
1871 assert(rRequestedNodes.size() == 0);
1873 XSD_SEQUENCE_TYPE(cp::postprocessing_type::TimeTraceAtNode)&
1874 req_nodes =
mpParameters->PostProcessing()->TimeTraceAtNode();
1876 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::TimeTraceAtNode) i = req_nodes.begin();
1877 i != req_nodes.end();
1880 rRequestedNodes.push_back(i->node_number());
1887 bool result =
false;
1890 XSD_SEQUENCE_TYPE(cp::postprocessing_type::PseudoEcgElectrodePosition)&
1891 electrodes =
mpParameters->PostProcessing()->PseudoEcgElectrodePosition();
1892 result = (electrodes.begin() != electrodes.end());
1897 template<
unsigned SPACE_DIM>
1900 rPseudoEcgElectrodePositions.clear();
1901 XSD_SEQUENCE_TYPE(cp::postprocessing_type::PseudoEcgElectrodePosition)&
1902 electrodes =
mpParameters->PostProcessing()->PseudoEcgElectrodePosition();
1903 for (XSD_ITERATOR_TYPE(cp::postprocessing_type::PseudoEcgElectrodePosition) i = electrodes.begin();
1904 i != electrodes.end();
1920 return mpParameters->Simulation()->OutputVisualizer().present();
1931 return mpParameters->Simulation()->OutputVisualizer()->meshalyzer() == cp::yesno_type::yes;
1943 return mpParameters->Simulation()->OutputVisualizer()->cmgui() == cp::yesno_type::yes;
1955 return mpParameters->Simulation()->OutputVisualizer()->parallel_vtk() == cp::yesno_type::yes;
1967 return mpParameters->Simulation()->OutputVisualizer()->vtk() == cp::yesno_type::yes;
1979 return mpParameters->Simulation()->OutputVisualizer()->precision();
1986 return mpParameters->Simulation()->Electrodes().present();
1994 mpParameters->Simulation()->SpaceDimension().set(spaceDimension);
1999 XSD_CREATE_WITH_FIXED_ATTR1(cp::time_type, time, simulationDuration,
"ms");
2000 mpParameters->Simulation()->SimulationDuration().set(time);
2010 cp::ionic_model_selection_type ionic_model;
2011 ionic_model.Hardcoded(rIonicModel);
2012 cp::ionic_models_type container(ionic_model);
2013 mpParameters->Simulation()->IonicModels().set(container);
2020 XSD_CREATE_WITH_FIXED_ATTR(cp::mesh_type, mesh_to_load,
"cm");
2024 cp::slab_type slab_definition(x, y, z, inter_node_space);
2025 mpParameters->Simulation()->Mesh()->Slab().set(slab_definition);
2032 XSD_CREATE_WITH_FIXED_ATTR(cp::mesh_type, mesh_to_load,
"cm");
2036 cp::sheet_type sheet_definition(x, y, inter_node_space);
2037 mpParameters->Simulation()->Mesh()->Sheet().set(sheet_definition);
2044 XSD_CREATE_WITH_FIXED_ATTR(cp::mesh_type, mesh_to_load,
"cm");
2048 cp::fibre_type fibre_definition(x, inter_node_space);
2049 mpParameters->Simulation()->Mesh()->Fibre().set(fibre_definition);
2056 XSD_CREATE_WITH_FIXED_ATTR(cp::mesh_type, mesh_to_load,
"cm");
2060 XSD_NESTED_TYPE(cp::mesh_type::LoadMesh) mesh_prefix(meshPrefix, fibreDefinition);
2061 mpParameters->Simulation()->Mesh()->LoadMesh().set(mesh_prefix);
2065 std::vector<cp::ionic_model_selection_type>& rIonicModels)
const
2067 assert(rDefinedRegions.size() == rIonicModels.size());
2069 assert(
mpParameters->Simulation()->IonicModels().present());
2070 XSD_SEQUENCE_TYPE(cp::ionic_models_type::Region)&
2071 regions =
mpParameters->Simulation()->IonicModels()->Region();
2073 for (
unsigned region_index=0; region_index<rDefinedRegions.size(); region_index++)
2075 cp::point_type point_a(rDefinedRegions[region_index].rGetLowerCorner()[0],
2076 rDefinedRegions[region_index].rGetLowerCorner()[1],
2077 rDefinedRegions[region_index].rGetLowerCorner()[2]);
2079 cp::point_type point_b(rDefinedRegions[region_index].rGetUpperCorner()[0],
2080 rDefinedRegions[region_index].rGetUpperCorner()[1],
2081 rDefinedRegions[region_index].rGetUpperCorner()[2]);
2083 XSD_CREATE_WITH_FIXED_ATTR(cp::location_type, locn,
"cm");
2084 locn.Cuboid().set(cp::box_type(point_a, point_b));
2086 cp::ionic_model_region_type region(rIonicModels[region_index], locn);
2087 regions.push_back(region);
2092 std::vector< c_vector<double,3> >& rIntraConductivities,
2093 std::vector< c_vector<double,3> >& rExtraConductivities)
2095 assert ( rConductivityAreas.size() == rIntraConductivities.size() );
2096 assert ( rIntraConductivities.size() == rExtraConductivities.size());
2098 XSD_ANON_SEQUENCE_TYPE(cp::physiological_type, ConductivityHeterogeneities, ConductivityHeterogeneity) heterogeneities_container;
2100 for (
unsigned region_index=0; region_index<rConductivityAreas.size(); region_index++)
2102 cp::point_type point_a(rConductivityAreas[region_index].rGetLowerCorner()[0],
2103 rConductivityAreas[region_index].rGetLowerCorner()[1],
2104 rConductivityAreas[region_index].rGetLowerCorner()[2]);
2106 cp::point_type point_b(rConductivityAreas[region_index].rGetUpperCorner()[0],
2107 rConductivityAreas[region_index].rGetUpperCorner()[1],
2108 rConductivityAreas[region_index].rGetUpperCorner()[2]);
2110 XSD_CREATE_WITH_FIXED_ATTR(cp::location_type, locn,
"cm");
2111 locn.Cuboid().set(cp::box_type(point_a, point_b));
2112 cp::conductivity_heterogeneity_type ht(locn);
2114 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2115 rIntraConductivities[region_index][0],
2116 rIntraConductivities[region_index][1],
2117 rIntraConductivities[region_index][2],
2120 ht.IntracellularConductivities(intra);
2122 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2123 rExtraConductivities[region_index][0],
2124 rExtraConductivities[region_index][1],
2125 rExtraConductivities[region_index][2],
2128 ht.ExtracellularConductivities(extra);
2130 heterogeneities_container.push_back(ht);
2133 XSD_ANON_TYPE(cp::physiological_type, ConductivityHeterogeneities) heterogeneities_object;
2134 heterogeneities_object.ConductivityHeterogeneity(heterogeneities_container);
2136 mpParameters->Physiological().ConductivityHeterogeneities().set(heterogeneities_object);
2140 std::vector< c_vector<double,3> >& rIntraConductivities,
2141 std::vector< c_vector<double,3> >& rExtraConductivities)
2143 assert ( rConductivityAreas.size() == rIntraConductivities.size() );
2144 assert ( rIntraConductivities.size() == rExtraConductivities.size());
2146 XSD_ANON_SEQUENCE_TYPE(cp::physiological_type, ConductivityHeterogeneities, ConductivityHeterogeneity) heterogeneities_container;
2148 for (
unsigned region_index=0; region_index<rConductivityAreas.size(); region_index++)
2150 cp::point_type centre(rConductivityAreas[region_index].rGetCentre()[0],
2151 rConductivityAreas[region_index].rGetCentre()[1],
2152 rConductivityAreas[region_index].rGetCentre()[2]);
2154 cp::point_type radii(rConductivityAreas[region_index].rGetRadii()[0],
2155 rConductivityAreas[region_index].rGetRadii()[1],
2156 rConductivityAreas[region_index].rGetRadii()[2]);
2158 XSD_CREATE_WITH_FIXED_ATTR(cp::location_type, locn,
"cm");
2159 locn.Ellipsoid().set(cp::ellipsoid_type(centre, radii));
2160 cp::conductivity_heterogeneity_type ht(locn);
2162 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2163 rIntraConductivities[region_index][0],
2164 rIntraConductivities[region_index][1],
2165 rIntraConductivities[region_index][2],
2168 ht.IntracellularConductivities(intra);
2170 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2171 rExtraConductivities[region_index][0],
2172 rExtraConductivities[region_index][1],
2173 rExtraConductivities[region_index][2],
2176 ht.ExtracellularConductivities(extra);
2178 heterogeneities_container.push_back(ht);
2181 XSD_ANON_TYPE(cp::physiological_type, ConductivityHeterogeneities) heterogeneities_object;
2182 heterogeneities_object.ConductivityHeterogeneity(heterogeneities_container);
2184 mpParameters->Physiological().ConductivityHeterogeneities().set(heterogeneities_object);
2189 mpParameters->Simulation()->OutputDirectory().set(rOutputDirectory);
2194 mpParameters->Simulation()->OutputFilenamePrefix().set(rOutputFilenamePrefix);
2199 if ( !
mpParameters->Simulation()->OutputVariables().present())
2201 cp::output_variables_type variables_requested;
2202 mpParameters->Simulation()->OutputVariables().set(variables_requested);
2205 XSD_SEQUENCE_TYPE(cp::output_variables_type::Var)&
2206 var_type_sequence =
mpParameters->Simulation()->OutputVariables()->Var();
2208 var_type_sequence.clear();
2210 for (
unsigned i=0; i<rOutputVariables.size(); i++)
2212 cp::var_type temp(rOutputVariables[i]);
2213 var_type_sequence.push_back(temp);
2220 mpParameters->Simulation()->OutputUsingOriginalNodeOrdering().set(useOriginal? cp::yesno_type::yes : cp::yesno_type::no);
2228 assert(checkpointTimestep!=-1.0 && maxCheckpointsOnDisk!=UINT_MAX);
2230 XSD_CREATE_WITH_FIXED_ATTR2(cp::simulation_type::XSD_NESTED_TYPE(CheckpointSimulation),
2233 maxCheckpointsOnDisk,
2235 mpParameters->Simulation()->CheckpointSimulation().set(cs);
2239 mpParameters->Simulation()->CheckpointSimulation().reset();
2249 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2250 rIntraConductivities[0],
2251 rIntraConductivities[1],
2252 rIntraConductivities[2],
2255 mpParameters->Physiological().IntracellularConductivities().set(intra);
2260 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2261 rIntraConductivities[0],
2262 rIntraConductivities[1],
2265 mpParameters->Physiological().IntracellularConductivities().set(intra);
2270 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, intra,
2271 rIntraConductivities[0],
2274 mpParameters->Physiological().IntracellularConductivities().set(intra);
2279 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2280 rExtraConductivities[0],
2281 rExtraConductivities[1],
2282 rExtraConductivities[2],
2285 mpParameters->Physiological().ExtracellularConductivities().set(extra);
2290 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2291 rExtraConductivities[0],
2292 rExtraConductivities[1],
2295 mpParameters->Physiological().ExtracellularConductivities().set(extra);
2300 XSD_CREATE_WITH_FIXED_ATTR3(cp::conductivities_type, extra,
2301 rExtraConductivities[0],
2304 mpParameters->Physiological().ExtracellularConductivities().set(extra);
2309 XSD_CREATE_WITH_FIXED_ATTR1(cp::conductivity_type, cond, bathConductivity,
"mS/cm");
2310 mpParameters->Physiological().BathConductivity().set(cond);
2327 if (tissueIds.empty() || bathIds.empty() )
2329 EXCEPTION(
"Identifying set must be non-empty");
2331 std::set<unsigned> shared_identifiers;
2332 std::set_intersection(tissueIds.begin(),
2336 std::inserter(shared_identifiers, shared_identifiers.begin()));
2338 if (!shared_identifiers.empty())
2340 EXCEPTION(
"Tissue identifiers and bath identifiers overlap");
2348 XSD_CREATE_WITH_FIXED_ATTR1(cp::inverse_length_type, ratio_object, ratio,
"1/cm");
2349 mpParameters->Physiological().SurfaceAreaToVolumeRatio().set(ratio_object);
2354 XSD_CREATE_WITH_FIXED_ATTR1(cp::capacitance_type, capacitance_object, capacitance,
"uF/cm^2");
2355 mpParameters->Physiological().Capacitance().set(capacitance_object);
2362 XSD_CREATE_WITH_FIXED_ATTR3(cp::time_steps_type, time_steps,
2363 odeTimeStep, pdeTimeStep, printingTimeStep,
"ms");
2387 EXCEPTION(
"Ode time-step should be positive");
2391 EXCEPTION(
"Pde time-step should be positive");
2395 EXCEPTION(
"Printing time-step should be positive");
2400 EXCEPTION(
"Printing time-step should not be smaller than PDE time-step");
2405 EXCEPTION(
"Printing time-step should be a multiple of PDE time step");
2410 EXCEPTION(
"Ode time-step should not be greater than PDE time-step");
2417 EXCEPTION(
"Checkpoint time-step should be positive");
2422 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);
2814 return mpParameters->Physiological().ApplyDrug().present();
2819 CHECK_EXISTS(
HasDrugDose(),
"Physiological/ApplyDrug");
2820 return mpParameters->Physiological().ApplyDrug()->concentration();
2825 if (!
mpParameters->Physiological().ApplyDrug().present())
2827 cp::apply_drug_type drug(drugDose);
2832 mpParameters->Physiological().ApplyDrug()->concentration(drugDose);
2838 CHECK_EXISTS(
HasDrugDose(),
"Physiological/ApplyDrug");
2839 std::map<std::string, std::pair<double, double> > ic50s;
2841 XSD_SEQUENCE_TYPE(cp::apply_drug_type::IC50)&
2842 ic50_seq =
mpParameters->Physiological().ApplyDrug()->IC50();
2844 for (XSD_ITERATOR_TYPE(cp::apply_drug_type::IC50) i = ic50_seq.begin();
2845 i != ic50_seq.end();
2848 std::pair<double, double> ic50_hill(*i, i->hill());
2849 std::string current = i->current();
2850 ic50s[current] = ic50_hill;
2858 if (!
mpParameters->Physiological().ApplyDrug().present())
2862 XSD_SEQUENCE_TYPE(cp::apply_drug_type::IC50)& ic50_seq =
mpParameters->Physiological().ApplyDrug()->IC50();
2863 if (ic50_seq.empty())
2868 bool entry_exists =
false;
2869 cp::ic50_type ic50_elt(ic50, rCurrentName);
2870 ic50_elt.hill(hill);
2871 for (XSD_ITERATOR_TYPE(cp::apply_drug_type::IC50) i = ic50_seq.begin();
2872 i != ic50_seq.end();
2875 if (i->current() == rCurrentName)
2877 entry_exists =
true;
2884 ic50_seq.push_back(ic50_elt);
2943 return mpParameters->Simulation()->Purkinje().present();
2948 CHECK_EXISTS(
mpParameters->Physiological().Purkinje().present(),
"Physiological/Purkinje");
2949 CHECK_EXISTS(
mpParameters->Physiological().Purkinje()->Capacitance().present(),
2950 "Physiological/Purkinje/Capacitance");
2951 return mpParameters->Physiological().Purkinje()->Capacitance().get();
2956 ENSURE_SECTION_PRESENT(
mpParameters->Physiological().Purkinje(), cp::purkinje_physiological_type);
2957 XSD_CREATE_WITH_FIXED_ATTR1(cp::capacitance_type, purk_Cm, capacitance,
"uF/cm^2");
2958 mpParameters->Physiological().Purkinje()->Capacitance().set(purk_Cm);
2964 CHECK_EXISTS(
mpParameters->Physiological().Purkinje().present(),
"Physiological/Purkinje");
2965 CHECK_EXISTS(
mpParameters->Physiological().Purkinje()->SurfaceAreaToVolumeRatio().present(),
2966 "Physiological/Purkinje/SurfaceAreaToVolumeRatio");
2967 return mpParameters->Physiological().Purkinje()->SurfaceAreaToVolumeRatio().get();
2972 ENSURE_SECTION_PRESENT(
mpParameters->Physiological().Purkinje(), cp::purkinje_physiological_type);
2973 XSD_CREATE_WITH_FIXED_ATTR1(cp::inverse_length_type, purk_Am, ratio,
"1/cm");
2974 mpParameters->Physiological().Purkinje()->SurfaceAreaToVolumeRatio().set(purk_Am);
2979 CHECK_EXISTS(
mpParameters->Physiological().Purkinje().present(),
"Physiological/Purkinje");
2980 CHECK_EXISTS(
mpParameters->Physiological().Purkinje()->Conductivity().present(),
2981 "Physiological/Purkinje/Conductivity");
2982 return mpParameters->Physiological().Purkinje()->Conductivity().get();
2987 ENSURE_SECTION_PRESENT(
mpParameters->Physiological().Purkinje(), cp::purkinje_physiological_type);
2988 XSD_CREATE_WITH_FIXED_ATTR1(cp::conductivity_type, purkinje_conductivity, conductivity,
"mS/cm");
2989 mpParameters->Physiological().Purkinje()->Conductivity().set(purkinje_conductivity);
3002 xercesc::DOMElement* pRootElement)
3004 using namespace xercesc;
3007 "ResumeSimulation/ArchiveDirectory");
3008 if (elts.size() > 0)
3011 DOMElement* p_dir_elt = elts[0];
3012 p_dir_elt->setAttribute(X(
"relative_to"), X(
"chaste_test_output"));
3017 xercesc::DOMElement* pRootElement)
3022 "Simulation/IonicModels/Default");
3023 if (p_elt_list.size() > 0)
3025 assert(p_elt_list.size() == 1);
3029 for (
unsigned i=0; i<p_elt_list.size(); i++)
3037 xercesc::DOMElement* pRootElement)
3041 "Numerical/KSPPreconditioner");
3042 if (p_elt_list.size() > 0)
3044 assert(p_elt_list.size() == 1);
3045 std::string text_value = X2C(p_elt_list[0]->getTextContent());
3046 if (text_value ==
"ilu")
3048 EXCEPTION(
"PETSc does not have a parallel implementation of ilu, so we no longer allow it as an option. Use bjacobi instead.");
3054 xercesc::DOMElement* pRootElement)
3058 "Simulation/ConductivityHeterogeneities");
3059 if (p_elt_list.size() > 0)
3061 assert(p_elt_list.size() == 1);
3062 xercesc::DOMNode* p_parent = p_elt_list[0]->getParentNode();
3063 xercesc::DOMNode* p_child = p_parent->removeChild(p_elt_list[0]);
3065 assert(p_phys_list.size() == 1);
3066 p_phys_list[0]->appendChild(p_child);
3071 xercesc::DOMElement* pRootElement)
3074 if (p_sim_list.size() > 0)
3076 std::vector<xercesc::DOMElement*> p_viz_list =
XmlTools::FindElements(p_sim_list[0],
"OutputVisualizer");
3077 if (p_viz_list.empty())
3080 xercesc::DOMElement* p_viz_elt = pDocument->createElementNS(X(
"https://chaste.comlab.ox.ac.uk/nss/parameters/3_3"), X(
"OutputVisualizer"));
3081 p_sim_list[0]->appendChild(p_viz_elt);
3082 p_viz_elt->setAttribute(X(
"meshalyzer"), X(
"yes"));
3090 #define COVERAGE_IGNORE //These methods are covered above with DIM=1,2,3 but the instantiations may fail spuriously
3095 template void HeartConfig::GetIonicModelRegions<3u>(std::vector<boost::shared_ptr<AbstractChasteRegion<3u> > >& , std::vector<cp::ionic_model_selection_type>&)
const;
3096 template void HeartConfig::GetStimuli<3u>(std::vector<boost::shared_ptr<AbstractStimulusFunction> >& , std::vector<boost::shared_ptr<AbstractChasteRegion<3u> > >& )
const;
3097 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> >*) ;
3098 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;
3100 template void HeartConfig::GetIonicModelRegions<2u>(std::vector<boost::shared_ptr<AbstractChasteRegion<2u> > >& , std::vector<cp::ionic_model_selection_type>&)
const;
3101 template void HeartConfig::GetStimuli<2u>(std::vector<boost::shared_ptr<AbstractStimulusFunction> >& , std::vector<boost::shared_ptr<AbstractChasteRegion<2u> > >& )
const;
3102 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> >*) ;
3103 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;
3105 template void HeartConfig::GetIonicModelRegions<1u>(std::vector<boost::shared_ptr<AbstractChasteRegion<1u> > >& , std::vector<cp::ionic_model_selection_type>&)
const;
3106 template void HeartConfig::GetStimuli<1u>(std::vector<boost::shared_ptr<AbstractStimulusFunction> >& , std::vector<boost::shared_ptr<AbstractChasteRegion<1u> > >& )
const;
3107 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> >*);
3108 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;
3121 #undef COVERAGE_IGNORE //These methods are covered above with DIM=1,2,3 but the instantiations may fail spuriously
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()
static std::auto_ptr< HeartConfig > mpInstance
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 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()