[cig-commits] commit 1915 by buerg to /var/svn/dealii/aspect

dealii.demon at gmail.com dealii.demon at gmail.com
Mon Sep 23 15:23:48 PDT 2013


Revision 1915

Insert r1816.

A   trunk/aspire/include/aspect/termination_criteria/end_step.h
A   trunk/aspire/source/termination_criteria/end_step.cc


http://www.dealii.org/websvn/revision.php?repname=Aspect+Repository&path=%2F&rev=1915&peg=1915

Diff:
Added: trunk/aspire/include/aspect/termination_criteria/end_step.h
===================================================================
--- trunk/aspire/include/aspect/termination_criteria/end_step.h	                        (rev 0)
+++ trunk/aspire/include/aspect/termination_criteria/end_step.h	2013-09-23 22:23:36 UTC (rev 1915)
@@ -0,0 +1,72 @@
+/*
+Copyright (C) 2011, 2012 by the authors of the ASPECT code.
+ 
+This file is part of ASPECT.
+ 
+ASPECT is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+ASPECT is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+ 
+You should have received a copy of the GNU General Public License
+along with ASPECT; see the file doc/COPYING. If not see
+<http://www.gnu.org/licenses/>.
+*/
+ 
+#ifndef __aspect__termination_criteria_end_step_h
+#define __aspect__termination_criteria_end_step_h
+ 
+#include <aspect/termination_criteria/interface.h>
+#include <aspect/simulator.h>
+ 
+namespace aspect
+{
+  namespace TerminationCriteria
+  {
+ 
+    /**
+     * A class that terminates the simulation when a specified end timestep
+     * is reached.
+     *
+     * @ingroup TerminationCriteria
+     */
+    template <int dim>
+    class EndStep : public Interface<dim>, public SimulatorAccess<dim>
+    {
+      public:
+        /**
+         * Evaluate this termination criterion.
+         *
+         * @return Whether to terminate the simulation (true) or continue (false).
+         */
+        virtual
+        bool
+        execute (void);
+ 
+        /**
+         * Declare the parameters this class takes through input files.
+         */
+        static
+        void
+        declare_parameters (ParameterHandler &prm);
+ 
+        /**
+         * Read the parameters this class declares from the parameter
+         * file.
+         */
+        virtual
+        void
+        parse_parameters (ParameterHandler &prm);
+ 
+      private:
+        unsigned int end_step;
+    };
+  }
+}
+ 
+#endif

Added: trunk/aspire/source/termination_criteria/end_step.cc
===================================================================
--- trunk/aspire/source/termination_criteria/end_step.cc	                        (rev 0)
+++ trunk/aspire/source/termination_criteria/end_step.cc	2013-09-23 22:23:36 UTC (rev 1915)
@@ -0,0 +1,71 @@
+/*
+Copyright (C) 2011, 2012 by the authors of the ASPECT code.
+ 
+This file is part of ASPECT.
+ 
+ASPECT is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+ASPECT is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+ 
+You should have received a copy of the GNU General Public License
+along with ASPECT; see the file doc/COPYING. If not see
+<http://www.gnu.org/licenses/>.
+*/
+ 
+#include <aspect/termination_criteria/end_step.h>
+ 
+namespace aspect
+{
+  namespace TerminationCriteria
+  {
+    template <int dim>
+    bool
+    EndStep<dim>::execute()
+    {
+      return (this->get_timestep_number () > end_step);
+    }
+ 
+    template <int dim>
+    void
+    EndStep<dim>::declare_parameters (ParameterHandler &prm)
+    {
+      prm.enter_subsection("Termination criteria");
+      {
+        prm.declare_entry ("End step", "100",
+                           Patterns::Integer (0),
+                           "Terminate the simulation once the specified timestep has been reached.");
+      }
+      prm.leave_subsection ();
+    }
+ 
+ 
+    template <int dim>
+    void
+    EndStep<dim>::parse_parameters (ParameterHandler &prm)
+    {
+      prm.enter_subsection("Termination criteria");
+      {
+        end_step = prm.get_integer ("End step");
+      }
+      prm.leave_subsection ();
+    }
+  }
+}
+ 
+// explicit instantiations
+namespace aspect
+{
+  namespace TerminationCriteria
+  {
+    ASPECT_REGISTER_TERMINATION_CRITERION(EndStep,
+                                          "end step",
+                                          "Terminate the simulation once the specified timestep"
+                                          "has been reached. ")
+  }
+}


More information about the CIG-COMMITS mailing list