[cig-commits] [commit] master: Rename a member function and drop its argument, since the data passed there is duplicative of what we have elsewhere. (0535392)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Fri May 16 10:21:41 PDT 2014
Repository : https://github.com/geodynamics/aspect
On branch : master
Link : https://github.com/geodynamics/aspect/compare/879934a4f474d962f81739a1ca025af06447ae80...0535392cfe87544dac897ca01375a6a0f8fd3f44
>---------------------------------------------------------------
commit 0535392cfe87544dac897ca01375a6a0f8fd3f44
Author: Wolfgang Bangerth <bangerth at math.tamu.edu>
Date: Fri May 16 12:21:25 2014 -0500
Rename a member function and drop its argument, since the data passed there is duplicative of what we have elsewhere.
>---------------------------------------------------------------
0535392cfe87544dac897ca01375a6a0f8fd3f44
doc/manual/manual.tex | 6 ++++--
include/aspect/velocity_boundary_conditions/function.h | 2 +-
include/aspect/velocity_boundary_conditions/gplates.h | 9 ++++-----
include/aspect/velocity_boundary_conditions/interface.h | 15 +++------------
source/simulator/core.cc | 2 +-
source/velocity_boundary_conditions/function.cc | 6 +++---
source/velocity_boundary_conditions/gplates.cc | 9 ++++++---
source/velocity_boundary_conditions/interface.cc | 6 ++----
8 files changed, 24 insertions(+), 31 deletions(-)
diff --git a/doc/manual/manual.tex b/doc/manual/manual.tex
index 9a9cc20..c53a44a 100644
--- a/doc/manual/manual.tex
+++ b/doc/manual/manual.tex
@@ -7388,7 +7388,7 @@ Specifically, your new class needs to implement the following basic interface:
virtual
void
- set_current_time (const double time);
+ update ();
static
void
@@ -7406,7 +7406,9 @@ beginning of the program or at the beginning of each time step. Examples are
models that need to call an external program to obtain plate velocities for the
current time, or from historical records, in which case it is far cheaper to do
so only once at the beginning of the time step than for every boundary point
-separately.
+separately. See, for example, the
+\href{doc/doxygen/classaspect_1_1VelocityBoundaryConditions_1_1GPlates.html}{aspect::VelocityBoundaryConditions::GPlates}
+class.
The remaining functions are obvious, and are also
discussed in the documentation of this interface class at
diff --git a/include/aspect/velocity_boundary_conditions/function.h b/include/aspect/velocity_boundary_conditions/function.h
index bf61096..aa69340 100644
--- a/include/aspect/velocity_boundary_conditions/function.h
+++ b/include/aspect/velocity_boundary_conditions/function.h
@@ -66,7 +66,7 @@ namespace aspect
*/
virtual
void
- set_current_time (const double time);
+ update ();
/**
* Declare the parameters this class takes through input files. The
diff --git a/include/aspect/velocity_boundary_conditions/gplates.h b/include/aspect/velocity_boundary_conditions/gplates.h
index dc16852..90141bb 100644
--- a/include/aspect/velocity_boundary_conditions/gplates.h
+++ b/include/aspect/velocity_boundary_conditions/gplates.h
@@ -279,14 +279,13 @@ namespace aspect
initialize (const GeometryModel::Interface<dim> &geometry_model);
/**
- * A function that is called at the beginning of each time step to
- * indicate what the model time is for which the boundary values will
- * next be evaluated. Also loads the next velocity files if necessary
- * and outputs a warning if the end of the set of velocity files if
+ * A function that is called at the beginning of each time step.
+ * For the current plugin, this function loads the next velocity files if necessary
+ * and outputs a warning if the end of the set of velocity files is
* reached.
*/
void
- set_current_time (const double time);
+ update ();
/**
* Declare the parameters this class takes through input files.
diff --git a/include/aspect/velocity_boundary_conditions/interface.h b/include/aspect/velocity_boundary_conditions/interface.h
index 1f64df8..5a7a3e6 100644
--- a/include/aspect/velocity_boundary_conditions/interface.h
+++ b/include/aspect/velocity_boundary_conditions/interface.h
@@ -65,10 +65,8 @@ namespace aspect
initialize (const GeometryModel::Interface<dim> &geometry_model);
/**
- * A function that is called at the beginning of each time step to
- * indicate what the model time is for which the boundary values will
- * next be evaluated. The default implementation of the function will
- * simply record the time in the current_time member variable, but
+ * A function that is called at the beginning of each time step.
+ * The default implementation of the function does nothing, but
* derived classes that need more elaborate setups for a given time
* step may overload the function.
*
@@ -79,7 +77,7 @@ namespace aspect
*/
virtual
void
- set_current_time (const double time);
+ update ();
/**
* Return the boundary velocity as a function of position.
@@ -113,13 +111,6 @@ namespace aspect
* Pointer to the geometry object in use.
*/
const GeometryModel::Interface<dim> *geometry_model;
-
- /**
- * A variable that stores the current time of the simulation. Derived
- * classes can query this variable. It is set at the beginning of each
- * time step.
- */
- double current_time;
};
diff --git a/source/simulator/core.cc b/source/simulator/core.cc
index 2e24b0d..ae7d930 100644
--- a/source/simulator/core.cc
+++ b/source/simulator/core.cc
@@ -497,7 +497,7 @@ namespace aspect
p = velocity_boundary_conditions.begin();
p != velocity_boundary_conditions.end(); ++p)
{
- p->second->set_current_time (time);
+ p->second->update ();
VectorFunctionFromVelocityFunctionObject<dim> vel
(parameters.n_compositional_fields,
std_cxx1x::bind (&VelocityBoundaryConditions::Interface<dim>::boundary_velocity,
diff --git a/source/velocity_boundary_conditions/function.cc b/source/velocity_boundary_conditions/function.cc
index 4c28640..c13cc06 100644
--- a/source/velocity_boundary_conditions/function.cc
+++ b/source/velocity_boundary_conditions/function.cc
@@ -61,14 +61,14 @@ namespace aspect
template <int dim>
void
- Function<dim>::set_current_time (const double time)
+ Function<dim>::update()
{
// we get time passed as seconds (always) but may want
// to reinterpret it in years
if (this->convert_output_to_years())
- boundary_velocity_function.set_time (time / year_in_seconds);
+ boundary_velocity_function.set_time (this->get_time() / year_in_seconds);
else
- boundary_velocity_function.set_time (time);
+ boundary_velocity_function.set_time (this->get_time());
}
diff --git a/source/velocity_boundary_conditions/gplates.cc b/source/velocity_boundary_conditions/gplates.cc
index db232d6..44ea2bc 100644
--- a/source/velocity_boundary_conditions/gplates.cc
+++ b/source/velocity_boundary_conditions/gplates.cc
@@ -527,6 +527,8 @@ namespace aspect
Assert((dynamic_cast<const GeometryModel::SphericalShell<dim>*> (&geometry_model))->opening_angle()==360, ExcMessage("gplates velocity model just works for opening angle == 360"));
}
+
+
template <int dim>
std::string
GPlates<dim>::create_filename (const int timestep) const
@@ -540,13 +542,14 @@ namespace aspect
return str_filename;
}
+
template <int dim>
void
- GPlates<dim>::set_current_time (const double time)
+ GPlates<dim>::update ()
{
- Interface<dim>::set_current_time(time);
+ Interface<dim>::update ();
- time_relative_to_vel_file_start_time = time - velocity_file_start_time;
+ time_relative_to_vel_file_start_time = this->get_time() - velocity_file_start_time;
const bool first_process = (Utilities::MPI::this_mpi_process (this->get_mpi_communicator ())
== 0);
diff --git a/source/velocity_boundary_conditions/interface.cc b/source/velocity_boundary_conditions/interface.cc
index d3aca35..644ece0 100644
--- a/source/velocity_boundary_conditions/interface.cc
+++ b/source/velocity_boundary_conditions/interface.cc
@@ -49,10 +49,8 @@ namespace aspect
template <int dim>
void
- Interface<dim>::set_current_time (const double time)
- {
- current_time = time;
- }
+ Interface<dim>::update ()
+ {}
More information about the CIG-COMMITS
mailing list