Teuchos - Trilinos Tools Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_CompObject.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 // Kris
11 // 07.08.03 -- Move into Teuchos package/namespace
12 
13 #ifndef TEUCHOS_COMPOBJECT_HPP
14 #define TEUCHOS_COMPOBJECT_HPP
15 
21 #include "Teuchos_Object.hpp"
22 #include "Teuchos_Flops.hpp"
23 
31 namespace Teuchos
32 {
33 class TEUCHOSNUMERICS_LIB_DLL_EXPORT CompObject
34 {
35 
36  public:
37 
39 
40 
42  CompObject();
43 
45  CompObject(const CompObject &source);
46 
48  virtual ~CompObject();
50 
52 
53  void setFlopCounter(const Flops &FlopCounter) {flopCounter_= (Flops *) &FlopCounter; return;}
55 
57  void setFlopCounter(const CompObject &compObject) {flopCounter_= (Flops *) (compObject.getFlopCounter()); return;}
58 
60  void unsetFlopCounter() {flopCounter_=0; return;}
61 
63  Flops * getFlopCounter() const {return(flopCounter_);}
65 
67 
68  void resetFlops() const {if (flopCounter_!=0) flopCounter_->resetFlops(); return;}
70 
72  double getFlops() const {if (flopCounter_!=0) return(flopCounter_->flops()); else return(0.0);}
74 
76 
77  void updateFlops(int addflops) const { if (flopCounter_!=0) flopCounter_->updateFlops(addflops); return;}
79 
81  void updateFlops(long int addflops) const { if (flopCounter_!=0) flopCounter_->updateFlops(addflops); return;}
82 
84  void updateFlops(double addflops) const { if (flopCounter_!=0) flopCounter_->updateFlops(addflops); return;}
85 
87  void updateFlops(float addflops) const {if (flopCounter_!=0) flopCounter_->updateFlops(addflops); return;}
89 
90  protected:
91 
92  Flops *flopCounter_;
93 
94 };
95 
96  // #include "Teuchos_CompObject.cpp"
97 
98 } // namespace Teuchos
99 
100 #endif // end of TEUCHOS_COMPOBJECT_HPP
void updateFlops(long int addflops) const
Increment Flop count for this object.
void setFlopCounter(const CompObject &compObject)
Set the internal Teuchos::Flops() pointer to the flop counter of another Teuchos::CompObject.
void unsetFlopCounter()
Set the internal Teuchos::Flops() pointer to 0 (no flops counted).
Functionality and data that is common to all computational classes.
void resetFlops()
Resets the number of floating point operations to zero for this multi-std::vector.
double getFlops() const
Returns the number of floating point operations with this multi-std::vector.
Object for providing basic support and consistent interfaces for counting/reporting floating-point op...
The base Teuchos object.
Flops * getFlopCounter() const
Get the pointer to the Teuchos::Flops() object associated with this object, returns 0 if none...
void updateFlops(float addflops) const
Increment Flop count for this object.
void updateFlops(double addflops) const
Increment Flop count for this object.
The Teuchos Floating Point Operations Class.