Anasazi Version of the Day
Loading...
Searching...
No Matches
AnasaziBasicOutputManager.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Anasazi: Block Eigensolvers Package
4//
5// Copyright 2004 NTESS and the Anasazi contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef ANASAZI_BASIC_OUTPUT_MANAGER_HPP
11#define ANASAZI_BASIC_OUTPUT_MANAGER_HPP
12
16
17#include "AnasaziConfigDefs.hpp"
19#include "Teuchos_oblackholestream.hpp"
20
21#ifdef HAVE_MPI
22#include <mpi.h>
23#include "AnasaziGlobalComm.hpp"
24#endif
25
33
34namespace Anasazi {
35
36 template <class ScalarType>
37 class BasicOutputManager : public OutputManager<ScalarType> {
38
39 public:
40
42
43
45 BasicOutputManager(int vb = Anasazi::Errors, int rootRank = 0);
46
49 const Teuchos::RCP<Teuchos::FancyOStream>& fos)
50 : OutputManager<ScalarType>(vb, fos)
51 {};
52
54 virtual ~BasicOutputManager() {};
56
57
58 private:
59
61
62
65
68
70 };
71
72 template<class ScalarType>
74 : OutputManager<ScalarType>(vb)
75 {
76#ifdef HAVE_MPI
77 // The OutputManger constructor will create fos_ that outputs to std::cout
78 // This class will query MPI to print on processor 0, if parallel.
79 int myRank = 0;
80 int numProcs = 1;
81 // Initialize MPI
82 int mpiStarted = 0;
83 MPI_Initialized(&mpiStarted);
84 if (mpiStarted)
85 {
86 MPI_Comm_rank(get_global_comm(), &myRank);
87 MPI_Comm_size(get_global_comm(), &numProcs);
88 }
89 this->fos_->setProcRankAndSize(myRank, numProcs);
90 this->fos_->setOutputToRootOnly(rootRank);
91#endif
92 }
93
94} // end Anasazi namespace
95
96#endif
97
98// end of file AnasaziOutputManager.hpp
Anasazi header file which uses auto-configuration information to include necessary C++ headers.
Abstract class definition for Anasazi Output Managers.
Anasazi's basic output manager for sending information of select verbosity levels to the appropriate ...
BasicOutputManager(int vb=Anasazi::Errors, int rootRank=0)
Default constructor.
BasicOutputManager(int vb, const Teuchos::RCP< Teuchos::FancyOStream > &fos)
Constructor with specified verbosity and formatted output stream.
Output managers remove the need for the eigensolver to know any information about the required output...
OutputManager(int vb=Anasazi::Errors, const Teuchos::RCP< Teuchos::FancyOStream > &fos=Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout)))
Default constructor.
Namespace Anasazi contains the classes, structs, enums and utilities used by the Anasazi package.