Belos Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test_gcrodr_complex.cpp
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 #include <BelosConfigDefs.hpp>
13 #include <BelosLinearProblem.hpp>
14 #include <BelosGCRODRSolMgr.hpp>
15 #include <complex>
16 
17 #include "MyMultiVec.hpp"
18 #include "MyBetterOperator.hpp"
19 #include "MyOperator.hpp"
20 
21 //
22 // mfh 20 Jan 2014: This test ensures the following:
23 //
24 // 1. Belos::GCRODRSolMgr can compile whether its ScalarType (first)
25 // template parameter is real or complex.
26 // 2. Belos::GCRODRSolMgr's constructor throws std::logic_error if and
27 // only if its ScalarType (first) template parameter is complex.
28 //
29 // At some point, if GCRODRSolMgr gets fixed so that it works with
30 // complex ScalarType, the second test will no longer pass. This will
31 // be a good thing! The test should still be built in that case, in
32 // order to demonstrate that GCRODRSolMgr compiles for complex
33 // ScalarType. However, in that case, the TEST_THROW macro should be
34 // changed to TEST_NOTHROW, and the macro's second argument should be
35 // removed.
36 //
37 // This test requires that Trilinos was compiled with complex
38 // arithmetic support enabled.
39 //
40 // Updates
41 // 4/15/2014: GCRODR is changed from RealSolverManager to SolverManager,
42 // and the test is changed from THROW to NOTHROW. (phtsuji)
43 
44 TEUCHOS_UNIT_TEST( GCRODR, RealDoesNotThrow )
45 {
46  using Teuchos::RCP;
47  using Teuchos::rcp;
48  typedef double ST;
49  typedef Belos::MultiVec<ST> MV;
50  typedef Belos::Operator<ST> OP;
51  //typedef Belos::MultiVecTraits<ST, MV> MVT;
52  //typedef Belos::OperatorTraits<ST, MV, OP> OPT;
53  typedef Belos::GCRODRSolMgr<ST, MV, OP> sol_mgr_type;
54 
55  RCP<sol_mgr_type> solver;
56  TEST_NOTHROW( solver = rcp (new sol_mgr_type ()) );
57 }
58 
59 TEUCHOS_UNIT_TEST( GCRODR, ComplexDoesNotThrow )
60 {
61  using Teuchos::RCP;
62  using Teuchos::rcp;
63  typedef std::complex<double> ST;
64  typedef Belos::MultiVec<ST> MV;
65  typedef Belos::Operator<ST> OP;
66  // typedef Belos::MultiVecTraits<ST, MV> MVT;
67  // typedef Belos::OperatorTraits<ST, MV, OP> OPT;
68  typedef Belos::GCRODRSolMgr<ST, MV, OP> sol_mgr_type;
69 
70  RCP<sol_mgr_type> solver;
71  TEST_NOTHROW( solver = rcp (new sol_mgr_type ()) );
72 }
#define TEST_NOTHROW(code)
TEUCHOS_UNIT_TEST(Factory, Bug6383)
Definition: Factory.cpp:201
Declaration and definition of Belos::GCRODRSolMgr, which implements the GCRODR (recycling GMRES) solv...
Alternative run-time polymorphic interface for operators.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class which describes the linear problem to be solved by the iterative solver.
Implementation of the GCRODR (Recycling GMRES) iterative linear solver.
Interface for multivectors used by Belos&#39; linear solvers.
Belos header file which uses auto-configuration information to include necessary C++ headers...