Belos  Version of the Day
BelosStatusTestOutputFactory.hpp
Go to the documentation of this file.
1 //@HEADER
2 // ************************************************************************
3 //
4 // Belos: Block Linear Solvers Package
5 // Copyright 2004 Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ************************************************************************
40 //@HEADER
41 //
42 
43 #ifndef BELOS_STATUS_TEST_OUTPUT_FACTORY_HPP
44 #define BELOS_STATUS_TEST_OUTPUT_FACTORY_HPP
45 
51 #include "BelosConfigDefs.hpp"
52 #include "BelosTypes.hpp"
55 
56 
57 namespace Belos {
58 
68 template <class ScalarType, class MV, class OP>
70 
71  public:
73 
74 
82  StatusTestOutputFactory( int outputStyle )
83  : outputStyle_(outputStyle)
84  {}
85 
89 
90 
92 
93 
108  Teuchos::RCP<StatusTestOutput<ScalarType,MV,OP> > create(const Teuchos::RCP<OutputManager<ScalarType> > &printer,
109  Teuchos::RCP<StatusTest<ScalarType,MV,OP> > test,
110  int mod,
111  int printStates)
112  {
113  Teuchos::RCP<StatusTestOutput<ScalarType,MV,OP> > outputTest;
114 
115  switch( outputStyle_ ) {
116 
117  case General:
118  if (mod > 0) {
119  outputTest = Teuchos::rcp( new StatusTestGeneralOutput<ScalarType,MV,OP>( printer, test, mod, printStates ) );
120  }
121  else {
122  outputTest = Teuchos::rcp( new StatusTestGeneralOutput<ScalarType,MV,OP>( printer, test, 1 ) );
123  }
124  break;
125  case Brief:
126  if (mod > 0) {
127  outputTest = Teuchos::rcp( new StatusTestResNormOutput<ScalarType,MV,OP>( printer, test, mod, printStates ) );
128  }
129  else {
130  outputTest = Teuchos::rcp( new StatusTestResNormOutput<ScalarType,MV,OP>( printer, test, 1 ) );
131  }
132  break;
133  }
134 
135  return outputTest;
136  }
137 
139 
140  private:
141 
142  // Which type of StatusTestOutput class
143  int outputStyle_;
144 
145  // Hide the default constructor and copy constructor
146  StatusTestOutputFactory( void ) {}
148 
149 };
150 
151 } // end of Belos namespace
152 
153 #endif /* BELOS_STATUS_TEST_OUTPUT_FACTORY_HPP */
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...
A factory class for generating StatusTestOutput objects.
A pure virtual class for defining the status tests for the Belos iterative solvers.
StatusTestOutputFactory(int outputStyle)
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.
Special StatusTest for printing any kind of status test.
Belos header file which uses auto-configuration information to include necessary C++ headers...

Generated on Thu Jul 21 2016 14:43:57 for Belos by doxygen 1.8.11