Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_PhysicsStateCounter.hpp
Go to the documentation of this file.
1 //@HEADER
2 // *****************************************************************************
3 // Tempus: Time Integration and Sensitivity Analysis Package
4 //
5 // Copyright 2017 NTESS and the Tempus contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 //@HEADER
9 
10 #ifndef Tempus_PhysicsStateCounter_hpp
11 #define Tempus_PhysicsStateCounter_hpp
12 
13 #include "Teuchos_VerboseObject.hpp"
14 #include "Teuchos_Describable.hpp"
15 #include <string>
16 #include "Tempus_PhysicsState.hpp"
17 
18 namespace Tempus_Test {
19 
20 template <class Scalar>
24 class PhysicsStateCounter : virtual public Tempus::PhysicsState<Scalar> {
25  public:
27  PhysicsStateCounter(std::string pN = "Tempus::PhysicsStateCounter",
28  int pI = 0)
29  : Tempus::PhysicsState<Scalar>(pN), physicsCounter_(pI)
30  {
31  }
32 
34  virtual ~PhysicsStateCounter() {}
35 
38  {
41  this->physicsCounter_));
42  return pSC;
43  }
44 
45  // using Tempus::PhysicsState<Scalar>::copy;
47  virtual void copy(const Teuchos::RCP<const Tempus::PhysicsState<Scalar> >& pS)
48  {
50  Teuchos::rcp_dynamic_cast<const PhysicsStateCounter<Scalar> >(pS);
51 
52  this->physicsName_ = pSC->getName();
53  this->physicsCounter_ = pSC->getCounter();
54  }
55 
57  virtual int getCounter() const { return physicsCounter_; }
58 
60  virtual void setCounter(int counter) { physicsCounter_ = counter; }
61 
63 
64  virtual void describe(Teuchos::FancyOStream& out,
65  const Teuchos::EVerbosityLevel verbLevel) const
66  {
67  out << this->description() << "::describe" << std::endl
68  << " physicsName = " << this->physicsName_ << std::endl
69  << " physicsCounter = " << physicsCounter_ << std::endl;
70  }
72 
73  protected:
75 };
76 } // namespace Tempus_Test
77 #endif // Tempus_PhysicsStateCounter_hpp
PhysicsState is a simple class to hold information about the physics.
virtual int getCounter() const
Return counter of PhysicsStateCounter.
PhysicsStateCounter(std::string pN="Tempus::PhysicsStateCounter", int pI=0)
Constructor.
PhysicsState(std::string pN="Tempus::PhysicsState")
Constructor.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual void copy(const Teuchos::RCP< const Tempus::PhysicsState< Scalar > > &pS)
This is a deep copy.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
PhysicsStateCounter is a simple PhysicsState that counts steps.
virtual std::string description() const
std::string physicsName_
Name of the creating Physics.
virtual Teuchos::RCP< Tempus::PhysicsState< Scalar > > clone() const
Clone constructor.
virtual void setCounter(int counter)
Set counter of PhysicsStateCounter.