[cig-commits] [commit] master: Add a heating_model pointer to simulator that gets initialized. Compiles well but no run tests so far. (6f6687a)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Fri May 16 18:39:27 PDT 2014
Repository : https://github.com/geodynamics/aspect
On branch : master
Link : https://github.com/geodynamics/aspect/compare/7b658caa05d489ae3f8d61b8049b015e7be94f77...cc43d3ac6f571573118eb54c2103bf92dfe8355f
>---------------------------------------------------------------
commit 6f6687a936fc10b36eb7e448c8cc7e9c11dc74aa
Author: Rene Gassmoeller <R.Gassmoeller at mailbox.org>
Date: Thu May 15 17:42:00 2014 -0500
Add a heating_model pointer to simulator that gets initialized. Compiles well but no run tests so far.
>---------------------------------------------------------------
6f6687a936fc10b36eb7e448c8cc7e9c11dc74aa
include/aspect/heating_model/interface.h | 13 +++++--------
include/aspect/simulator.h | 2 ++
source/heating_model/interface.cc | 27 ++++++++++++++-------------
source/simulator/core.cc | 3 +++
4 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/include/aspect/heating_model/interface.h b/include/aspect/heating_model/interface.h
index 8e80406..77024af 100644
--- a/include/aspect/heating_model/interface.h
+++ b/include/aspect/heating_model/interface.h
@@ -57,12 +57,11 @@ namespace aspect
virtual ~Interface();
/**
- * Initialization function. Takes a reference to the geometry model so
- * that derived classes can access them.
+ * Initialization function.
*/
virtual
void
- initialize (const GeometryModel::Interface<dim> &geometry_model);
+ initialize ();
/**
* A function that is called at the beginning of each time step to
@@ -163,9 +162,7 @@ namespace aspect
*/
template <int dim>
Interface<dim> *
- create_heating_model (const std::string &name,
- ParameterHandler &prm,
- const GeometryModel::Interface<dim> &geometry_model);
+ create_heating_model (ParameterHandler &prm);
/**
* Return a list of names of all implemented heating models,
@@ -201,10 +198,10 @@ namespace aspect
namespace ASPECT_REGISTER_HEATING_MODEL_ ## classname \
{ \
aspect::internal::Plugins::RegisterHelper<Interface<2>,classname<2> > \
- dummy_ ## classname ## _2d (&aspect::HeatingModels::register_heating_model<2>, \
+ dummy_ ## classname ## _2d (&aspect::HeatingModel::register_heating_model<2>, \
name, description); \
aspect::internal::Plugins::RegisterHelper<Interface<3>,classname<3> > \
- dummy_ ## classname ## _3d (&aspect::HeatingModels::register_heating_model<3>, \
+ dummy_ ## classname ## _3d (&aspect::HeatingModel::register_heating_model<3>, \
name, description); \
}
}
diff --git a/include/aspect/simulator.h b/include/aspect/simulator.h
index d090a0c..235ac13 100644
--- a/include/aspect/simulator.h
+++ b/include/aspect/simulator.h
@@ -43,6 +43,7 @@
#include <aspect/global.h>
#include <aspect/simulator_access.h>
#include <aspect/material_model/interface.h>
+#include <aspect/heating_model/interface.h>
#include <aspect/geometry_model/interface.h>
#include <aspect/gravity_model/interface.h>
#include <aspect/boundary_temperature/interface.h>
@@ -1174,6 +1175,7 @@ namespace aspect
*/
const std::auto_ptr<GeometryModel::Interface<dim> > geometry_model;
const std::auto_ptr<MaterialModel::Interface<dim> > material_model;
+ const std::auto_ptr<HeatingModel::Interface<dim> > heating_model;
const std::auto_ptr<GravityModel::Interface<dim> > gravity_model;
const std::auto_ptr<BoundaryTemperature::Interface<dim> > boundary_temperature;
const std::auto_ptr<BoundaryComposition::Interface<dim> > boundary_composition;
diff --git a/source/heating_model/interface.cc b/source/heating_model/interface.cc
index 1f2ef97..583ffca 100644
--- a/source/heating_model/interface.cc
+++ b/source/heating_model/interface.cc
@@ -40,10 +40,8 @@ namespace aspect
template <int dim>
void
- Interface<dim>::initialize (const GeometryModel::Interface<dim> &geometry_model_)
- {
- geometry_model = &geometry_model_;
- }
+ Interface<dim>::initialize ()
+ {}
@@ -99,14 +97,19 @@ namespace aspect
template <int dim>
Interface<dim> *
- create_heating_model (const std::string &name,
- ParameterHandler &prm,
- const GeometryModel::Interface<dim> &geometry_model)
+ create_heating_model (ParameterHandler &prm)
{
- Interface<dim> *plugin = std_cxx1x::get<dim>(registered_plugins).create_plugin (name,
- "Heating model",
+ std::string model_name;
+ prm.enter_subsection ("Heating model");
+ {
+ model_name = prm.get ("Model name");
+ }
+ prm.leave_subsection ();
+
+ Interface<dim> *plugin = std_cxx1x::get<dim>(registered_plugins).create_plugin (model_name,
+ "Heating model::Model name",
prm);
- plugin->initialize (geometry_model);
+ plugin->initialize();
return plugin;
}
@@ -167,9 +170,7 @@ namespace aspect
\
template \
Interface<dim> * \
- create_heating_model<dim> (const std::string &, \
- ParameterHandler &prm, \
- const GeometryModel::Interface<dim> &geometry_model);
+ create_heating_model<dim> (ParameterHandler &prm); \
ASPECT_INSTANTIATE(INSTANTIATE)
}
diff --git a/source/simulator/core.cc b/source/simulator/core.cc
index 2e24b0d..f47c3a2 100644
--- a/source/simulator/core.cc
+++ b/source/simulator/core.cc
@@ -98,6 +98,7 @@ namespace aspect
geometry_model (GeometryModel::create_geometry_model<dim>(prm)),
material_model (MaterialModel::create_material_model<dim>(prm)),
+ heating_model (HeatingModel::create_heating_model<dim>(prm)),
gravity_model (GravityModel::create_gravity_model<dim>(prm)),
boundary_temperature (BoundaryTemperature::create_boundary_temperature<dim>(prm)),
// create a boundary composition model, but only if we actually need
@@ -219,6 +220,8 @@ namespace aspect
sim->initialize (*this);
if (SimulatorAccess<dim> *sim = dynamic_cast<SimulatorAccess<dim>*>(material_model.get()))
sim->initialize (*this);
+ if (SimulatorAccess<dim> *sim = dynamic_cast<SimulatorAccess<dim>*>(heating_model.get()))
+ sim->initialize (*this);
if (SimulatorAccess<dim> *sim = dynamic_cast<SimulatorAccess<dim>*>(gravity_model.get()))
sim->initialize (*this);
if (SimulatorAccess<dim> *sim = dynamic_cast<SimulatorAccess<dim>*>(boundary_temperature.get()))
More information about the CIG-COMMITS
mailing list