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: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Tempus_PhysicsStateCounter_hpp
10 #define Tempus_PhysicsStateCounter_hpp
11 
12 #include "Teuchos_VerboseObject.hpp"
13 #include "Teuchos_Describable.hpp"
14 #include <string>
15 #include "Tempus_PhysicsState.hpp"
16 
17 
18 namespace Tempus_Test {
19 
20 template<class Scalar>
25  : virtual public Tempus::PhysicsState<Scalar>
26 {
27 public:
28 
31  std::string pN = "Tempus::PhysicsStateCounter", int pI = 0)
32  : Tempus::PhysicsState<Scalar>(pN), physicsCounter_(pI)
33  {}
34 
36  virtual ~PhysicsStateCounter() {}
37 
40  {
43  this->physicsCounter_));
44  return pSC;
45  }
46 
47  //using Tempus::PhysicsState<Scalar>::copy;
49  virtual void copy(const Teuchos::RCP<const Tempus::PhysicsState<Scalar> >& pS)
50  {
52  Teuchos::rcp_dynamic_cast<const PhysicsStateCounter<Scalar> >(pS);
53 
54  this->physicsName_ = pSC->getName();
55  this->physicsCounter_ = pSC->getCounter();
56  }
57 
59  virtual int getCounter() const { return physicsCounter_; }
60 
62  virtual void setCounter(int counter) { physicsCounter_ = counter; }
63 
65 
66  virtual void describe(Teuchos::FancyOStream & out,
67  const Teuchos::EVerbosityLevel verbLevel) const
68  {
69  out << this->description() << "::describe" << std::endl
70  << " physicsName = " << this->physicsName_ << std::endl
71  << " physicsCounter = " << physicsCounter_ << std::endl;
72  }
74 
75 protected:
76 
78 
79 };
80 } // namespace Tempus_Test
81 #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.