Belos Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BelosStatusTestOutputFactory.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 
11 #ifndef BELOS_STATUS_TEST_OUTPUT_FACTORY_HPP
12 #define BELOS_STATUS_TEST_OUTPUT_FACTORY_HPP
13 
19 #include "BelosConfigDefs.hpp"
20 #include "BelosTypes.hpp"
24 
25 
26 namespace Belos {
27 
37 template <class ScalarType, class MV, class OP>
39 
40  public:
42 
43 
52  StatusTestOutputFactory( int outputStyle, Teuchos::RCP<std::map<std::string,Teuchos::RCP<StatusTest<ScalarType,MV,OP> > > > taggedTests = Teuchos::null )
53  : outputStyle_(outputStyle),
54  taggedTests_(taggedTests)
55  {}
56 
60 
61 
63 
64 
81  int mod,
82  int printStates)
83  {
85 
86  switch( outputStyle_ ) {
87 
88  case General:
89  if (mod > 0) {
90  outputTest = Teuchos::rcp( new StatusTestGeneralOutput<ScalarType,MV,OP>( printer, test, mod, printStates ) );
91  }
92  else {
93  outputTest = Teuchos::rcp( new StatusTestGeneralOutput<ScalarType,MV,OP>( printer, test, 1 ) );
94  }
95  break;
96  case Brief:
97  if (mod > 0) {
98  outputTest = Teuchos::rcp( new StatusTestResNormOutput<ScalarType,MV,OP>( printer, test, mod, printStates ) );
99  }
100  else {
101  outputTest = Teuchos::rcp( new StatusTestResNormOutput<ScalarType,MV,OP>( printer, test, 1 ) );
102  }
103  break;
104  case User:
105  if (mod > 0) {
106  outputTest = Teuchos::rcp( new StatusTestUserOutput<ScalarType,MV,OP>( printer, test, taggedTests_, mod, printStates ) );
107  }
108  else {
109  outputTest = Teuchos::rcp( new StatusTestUserOutput<ScalarType,MV,OP>( printer, test, taggedTests_, 1 ) );
110  }
111  break;
112  default: //Default to General if invalid outputStyle_ given.
113  if (mod > 0) {
114  outputTest = Teuchos::rcp( new StatusTestGeneralOutput<ScalarType,MV,OP>( printer, test, mod, printStates ) );
115  }
116  else {
117  outputTest = Teuchos::rcp( new StatusTestGeneralOutput<ScalarType,MV,OP>( printer, test, 1 ) );
118  }
119  break;
120  }
121 
122 
123  return outputTest;
124  }
125 
127 
128  private:
129 
130  // Which type of StatusTestOutput class
132 
134 
135  // Hide the default constructor and copy constructor
138 
139 };
140 
141 } // end of Belos namespace
142 
143 #endif /* BELOS_STATUS_TEST_OUTPUT_FACTORY_HPP */
Special StatusTest for printing status tests in simple format for residuals.
Collection of types and exceptions used within the Belos solvers.
Belos&#39;s basic output manager for sending information of select verbosity levels to the appropriate ou...
Teuchos::RCP< std::map< std::string, Teuchos::RCP< StatusTest< ScalarType, MV, OP > > > > taggedTests_
A special StatusTest for printing other status tests in a simple format.
A factory class for generating StatusTestOutput objects.
A pure virtual class for defining the status tests for the Belos iterative solvers.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
StatusTestOutputFactory(int outputStyle, Teuchos::RCP< std::map< std::string, Teuchos::RCP< StatusTest< ScalarType, MV, OP > > > > taggedTests=Teuchos::null)
Constructor.
A special StatusTest for printing other status tests in a simple format.
Teuchos::RCP< StatusTestOutput< ScalarType, MV, OP > > create(const Teuchos::RCP< OutputManager< ScalarType > > &printer, Teuchos::RCP< StatusTest< ScalarType, MV, OP > > test, int mod, int printStates)
Create the StatusTestOutput object specified by the outputStyle.
A special StatusTest for printing other status tests.
Special StatusTest for printing status tests in simple format for residuals.
void test()
StatusTestOutputFactory(const StatusTestOutputFactory< ScalarType, MV, OP > &)
Special StatusTest for printing any kind of status test.
Belos header file which uses auto-configuration information to include necessary C++ headers...