Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros 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 template<class Scalar>
21 
22 template<class Scalar>
25 
26  const Teuchos::RCP<Teuchos::FancyOStream> out = integrator.getOStream();
27  Teuchos::OSTab ostab(out,0,"ScreenOutput");
28  *out << "\n Begin Subcycling -------------------------------------------------------\n";
29  // << " Step Time dt Abs Error Rel Error Order nFail dCompTime"
30  // << std::endl;
31 }
32 
33 template<class Scalar>
35 observeStartTimeStep(const Integrator<Scalar>& /* integrator */){}
36 
37 template<class Scalar>
39 observeNextTimeStep(const Integrator<Scalar>& /* integrator */){}
40 
41 template<class Scalar>
43 observeBeforeTakeStep(const Integrator<Scalar>& /* integrator */){}
44 
45 template<class Scalar>
47 observeAfterTakeStep(const Integrator<Scalar>& /* integrator */){}
48 
49 template<class Scalar>
52 
53 template<class Scalar>
56 
57  using Teuchos::RCP;
58  RCP<SolutionStateMetaData<Scalar> > csmd =
59  integrator.getSolutionHistory()->getCurrentState()->getMetaData();
60 
61  if ((csmd->getOutputScreen() == true) or
62  (csmd->getOutput() == true) or
63  (csmd->getTime() == integrator.getTimeStepControl()->getFinalTime())) {
64 
65  const Scalar steppertime = integrator.getStepperTimer()->totalElapsedTime();
66  // reset the stepper timer
67  integrator.getStepperTimer()->reset();
68 
69  const Teuchos::RCP<Teuchos::FancyOStream> out = integrator.getOStream();
70  Teuchos::OSTab ostab(out,0,"ScreenOutput");
71  *out<<std::scientific
72  <<std::setw( 6)<<std::setprecision(3)<<csmd->getIStep()
73  <<std::setw(11)<<std::setprecision(3)<<csmd->getTime()
74  <<std::setw(11)<<std::setprecision(3)<<csmd->getDt()
75  <<std::setw(11)<<std::setprecision(3)<<csmd->getErrorAbs()
76  <<std::setw(11)<<std::setprecision(3)<<csmd->getErrorRel()
77  <<std::fixed <<std::setw( 7)<<std::setprecision(1)<<csmd->getOrder()
78  <<std::scientific<<std::setw( 7)<<std::setprecision(3)<<csmd->getNFailures()
79  <<std::setw(11)<<std::setprecision(3)<<steppertime
80  <<std::endl;
81  }
82 
83 }
84 
85 template<class Scalar>
88 
89  const Teuchos::RCP<Teuchos::FancyOStream> out = integrator.getOStream();
90  Teuchos::OSTab ostab(out,0,"ScreenOutput");
91  *out << " End Subcycling ---------------------------------------------------------\n\n";
92 }
93 
94 } // namespace Tempus
95 #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
Observe after checking time step. Observer can still fail the time step here.
virtual void observeStartTimeStep(const Integrator< Scalar > &integrator) override
Observe the beginning of the time step loop.
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...
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.