Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_IntegratorObserverSubcycling_impl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ****************************************************************************
3 // Tempus: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Tempus_IntegratorObserverSubcycling_impl_hpp
10 #define Tempus_IntegratorObserverSubcycling_impl_hpp
11 
12 #include "Tempus_Stepper.hpp"
13 
14 namespace Tempus {
15 
16 template <class Scalar>
18 {
19 }
20 
21 template <class Scalar>
23 {
24 }
25 
26 template <class Scalar>
28  const Integrator<Scalar>& integrator)
29 {
30  const Teuchos::RCP<Teuchos::FancyOStream> out = integrator.getOStream();
31  out->setOutputToRootOnly(0);
32  Teuchos::OSTab ostab(out, 0, "ScreenOutput");
33  *out << "\n Begin Subcycling "
34  "-------------------------------------------------------\n";
35  // << " Step Time dt Abs Error Rel Error Order nFail
36  // dCompTime"
37  // << std::endl;
38 }
39 
40 template <class Scalar>
42  const Integrator<Scalar>& /* integrator */)
43 {
44 }
45 
46 template <class Scalar>
48  const Integrator<Scalar>& /* integrator */)
49 {
50 }
51 
52 template <class Scalar>
54  const Integrator<Scalar>& /* integrator */)
55 {
56 }
57 
58 template <class Scalar>
60  const Integrator<Scalar>& /* integrator */)
61 {
62 }
63 
64 template <class Scalar>
66  const Integrator<Scalar>& /* integrator */)
67 {
68 }
69 
70 template <class Scalar>
72  const Integrator<Scalar>& integrator)
73 {
74  using Teuchos::RCP;
75  auto cs = integrator.getSolutionHistory()->getCurrentState();
76 
77  if ((cs->getOutputScreen() == true) || (cs->getOutput() == true) ||
78  (cs->getTime() == integrator.getTimeStepControl()->getFinalTime())) {
79  const Scalar steppertime = integrator.getStepperTimer()->totalElapsedTime();
80  // reset the stepper timer
81  integrator.getStepperTimer()->reset();
82 
83  const Teuchos::RCP<Teuchos::FancyOStream> out = integrator.getOStream();
84  out->setOutputToRootOnly(0);
85  Teuchos::OSTab ostab(out, 0, "ScreenOutput");
86  *out << std::scientific << std::setw(6) << std::setprecision(3)
87  << cs->getIndex() << std::setw(11) << std::setprecision(3)
88  << cs->getTime() << std::setw(11) << std::setprecision(3)
89  << cs->getTimeStep() << std::setw(11) << std::setprecision(3)
90  << cs->getErrorAbs() << std::setw(11) << std::setprecision(3)
91  << cs->getErrorRel() << std::fixed << std::setw(7)
92  << std::setprecision(1) << cs->getOrder() << std::scientific
93  << std::setw(7) << std::setprecision(3) << cs->getNFailures()
94  << std::setw(11) << std::setprecision(3) << steppertime << std::endl;
95  }
96 }
97 
98 template <class Scalar>
100  const Integrator<Scalar>& integrator)
101 {
102  const Teuchos::RCP<Teuchos::FancyOStream> out = integrator.getOStream();
103  out->setOutputToRootOnly(0);
104  Teuchos::OSTab ostab(out, 0, "ScreenOutput");
105  *out << " End Subcycling "
106  "---------------------------------------------------------\n\n";
107 }
108 
109 } // namespace Tempus
110 #endif // Tempus_IntegratorObserverSubcycling_impl_hpp
virtual void observeEndIntegrator(const Integrator< Scalar > &integrator) override
Observe the end of the time integrator.
virtual Teuchos::RCP< Teuchos::Time > getStepperTimer() const =0
virtual void observeBeforeTakeStep(const Integrator< Scalar > &integrator) override
Observe before Stepper takes step.
virtual void observeAfterTakeStep(const Integrator< Scalar > &integrator) override
Observe after Stepper takes step.
virtual Teuchos::RCP< const TimeStepControl< Scalar > > getTimeStepControl() const =0
Returns the TimeStepControl for this Integrator.
virtual void observeAfterCheckTimeStep(const Integrator< Scalar > &integrator) override
virtual void observeStartTimeStep(const Integrator< Scalar > &integrator) override
Observe the beginning of the time step loop.
basic_FancyOStream & setOutputToRootOnly(const int rootRank)
virtual void observeStartIntegrator(const Integrator< Scalar > &integrator) override
Observe the beginning of the time integrator.
virtual void observeNextTimeStep(const Integrator< Scalar > &integrator) override
Observe after the next time step size is selected.
Thyra Base interface for time integrators. Time integrators are designed to advance the solution from...
double totalElapsedTime(bool readCurrentTime=false) const
virtual RCP< FancyOStream > getOStream() const
virtual void observeEndTimeStep(const Integrator< Scalar > &integrator) override
Observe the end of the time step loop.
virtual Teuchos::RCP< const SolutionHistory< Scalar > > getSolutionHistory() const =0
Returns the SolutionHistory for this Integrator.