Anasazi
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
src
AnasaziOutputStreamTraits.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_OUTPUT_STREAM_TRAITS_HPP
11
#define ANASAZI_OUTPUT_STREAM_TRAITS_HPP
12
16
17
#include "
AnasaziConfigDefs.hpp
"
18
#include "
AnasaziTypes.hpp
"
19
20
#include "Teuchos_FancyOStream.hpp"
21
#include "Teuchos_RCP.hpp"
22
23
#ifdef HAVE_ANASAZI_MPI
24
#include <mpi.h>
25
#include "AnasaziGlobalComm.hpp"
26
#endif
27
36
37
namespace
Anasazi
{
38
39
template
<
class
OperatorType>
40
struct
OutputStreamTraits
{
41
42
// The input argument, op, is presumed to be a valid object that can be queried to
43
// determine the correct output stream.
44
static
Teuchos::RCP<Teuchos::FancyOStream>
45
getOutputStream (
const
OperatorType&
/* op */
,
int
rootRank = 0)
46
{
47
Teuchos::RCP<Teuchos::FancyOStream> fos = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
48
49
#ifdef HAVE_ANASAZI_MPI
50
// The default implementation will output on processor 0, if parallel.
51
int
myRank = 0;
52
int
numProcs = 1;
53
// Initialize MPI
54
int
mpiStarted = 0;
55
MPI_Initialized(&mpiStarted);
56
if
(mpiStarted)
57
{
58
MPI_Comm_rank(get_global_comm(), &myRank);
59
MPI_Comm_size(get_global_comm(), &numProcs);
60
}
61
fos->setProcRankAndSize(myRank, numProcs);
62
fos->setOutputToRootOnly(rootRank);
63
#endif
64
65
return
fos;
66
}
67
};
68
69
70
}
// end Anasazi namespace
71
72
#endif
73
74
// end of file AnasaziOutputStreamTraits.hpp
AnasaziConfigDefs.hpp
Anasazi header file which uses auto-configuration information to include necessary C++ headers.
AnasaziTypes.hpp
Types and exceptions used within Anasazi solvers and interfaces.
Anasazi
Namespace Anasazi contains the classes, structs, enums and utilities used by the Anasazi package.
Anasazi::OutputStreamTraits
Output managers remove the need for the eigensolver to know any information about the required output...
Definition
AnasaziOutputStreamTraits.hpp:40
Generated by
1.17.0