Belos Version of the Day
Loading...
Searching...
No Matches
BelosOutputManager.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Belos: Block Linear Solvers Package
4//
5// Copyright 2004-2016 NTESS and the Belos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef BELOS_OUTPUT_MANAGER_HPP
11#define BELOS_OUTPUT_MANAGER_HPP
12
17#include "BelosConfigDefs.hpp"
18#include "BelosTypes.hpp"
19#include "Teuchos_oblackholestream.hpp"
20#include "Teuchos_RCP.hpp"
21
22#ifdef HAVE_MPI
23#include <mpi.h>
24#include "BelosGlobalComm.hpp"
25#endif
26
39namespace Belos {
40
41 template <class ScalarType>
43
44 public:
45
47
48
50 OutputManager( int vb = Belos::Errors, const Teuchos::RCP< std::ostream > &os = Teuchos::rcp(&std::cout,false) );
51
53 virtual ~OutputManager() {};
55
57
58
60 void setOStream( const Teuchos::RCP<std::ostream> &os ) { myOS_ = os; };
61
63 void setVerbosity( int vb ) { vb_ = vb; };
64
66
68
69
71 std::ostream& stream( MsgType type )
72 {
73 if ( (type & vb_) && iPrint_ ) {
74 return *myOS_;
75 }
76 return myBHS_;
77 }
78
80 Teuchos::RCP<std::ostream> getOStream() { return myOS_; };
81
83
85
86
88
91 bool isVerbosity( MsgType type ) const { return (( type == Belos::Errors ) || ( vb_ & type )); };
92
94
96
97
99 void print( MsgType type, const std::string output );
100
102
103 private:
104
106
107
110
113
115
116 int vb_;
117 Teuchos::RCP<std::ostream> myOS_;
118 Teuchos::oblackholestream myBHS_;
119 bool iPrint_;
120 };
121
122 template<class ScalarType>
123 OutputManager<ScalarType>::OutputManager( int vb, const Teuchos::RCP<std::ostream> &os ) :
124 vb_(vb),
125 myOS_(os)
126 {
127 int MyPID;
128#ifdef HAVE_MPI
129 // Initialize MPI
130 int mpiStarted = 0;
133 else MyPID=0;
134#else
135 MyPID = 0;
136#endif
137 iPrint_ = (MyPID == 0);
138 }
139
140 template<class ScalarType>
141 void OutputManager<ScalarType>::print( MsgType type, const std::string output ) {
142 if ( (type & vb_) && iPrint_ ) {
143 *myOS_ << output;
144 }
145}
146
147} // end Belos namespace
148
149#endif
150
151// end of file BelosOutputManager.hpp
Belos header file which uses auto-configuration information to include necessary C++ headers.
Collection of types and exceptions used within the Belos solvers.
Alternative run-time polymorphic interface for operators.
Operator()
Default constructor (does nothing).
Belos's basic output manager for sending information of select verbosity levels to the appropriate ou...
void print(MsgType type, const std::string output)
@ name Print methods
void setVerbosity(int vb)
Set the verbosity level for this manager.
void setOStream(const Teuchos::RCP< std::ostream > &os)
Set the output stream for this manager.
Teuchos::RCP< std::ostream > getOStream()
Get the output stream for this manager.
virtual ~OutputManager()
Destructor.
std::ostream & stream(MsgType type)
Get an output stream for outputting the input message type.
OutputManager(int vb=Belos::Errors, const Teuchos::RCP< std::ostream > &os=Teuchos::rcp(&std::cout, false))
Basic constructor.
bool isVerbosity(MsgType type) const
Find out whether we need to print out information for this message type.
MsgType
Available message types recognized by the linear solvers.

Generated for Belos by doxygen 1.9.8