FEI
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
test_utils
test_Factory_helper.cpp
1
/*--------------------------------------------------------------------*/
2
/* Copyright 2005 Sandia Corporation. */
3
/* Under the terms of Contract DE-AC04-94AL85000, there is a */
4
/* non-exclusive license for use of this work by or on behalf */
5
/* of the U.S. Government. Export of this program may require */
6
/* a license from the United States Government. */
7
/*--------------------------------------------------------------------*/
8
9
#include <fei_macros.hpp>
10
11
#include <test_utils/test_Factory_helper.hpp>
12
13
#include <test_utils/LibraryFactory.hpp>
14
15
#include <fei_Factory_Trilinos.hpp>
16
17
#include <snl_fei_Factory.hpp>
18
19
#include <fei_Vector_Impl.hpp>
20
21
#include <fei_Matrix_Impl.hpp>
22
23
#undef fei_file
24
#define fei_file "test_Factory_helper.cpp"
25
#include <fei_ErrMacros.hpp>
26
27
int
test_Factory_helper::dyncastMatrix(
fei::Matrix
* matrix,
28
const
char
* libname)
29
{
30
std::string sname(libname);
31
32
if
(sname ==
"TEST_LSC"
) {
33
34
fei::Matrix_Impl<LinearSystemCore>* smatrix2 =
35
dynamic_cast<
fei::Matrix_Impl<LinearSystemCore>*
>
(matrix);
36
if
(smatrix2 == NULL) {
37
fei::console_out
() <<
"dynamic_cast<fei::Matrix_Impl<LinearSystemCore>*> failed"
<<FEI_ENDL;
38
ERReturn(-1);
39
}
40
}
41
42
if
(sname ==
"Aztec"
) {
43
#ifdef HAVE_FEI_AZTECOO
44
fei::Matrix_Impl<LinearSystemCore>* smatrix =
45
dynamic_cast<
fei::Matrix_Impl<LinearSystemCore>*
>
(matrix);
46
if
(smatrix == NULL) {
47
fei::console_out
() <<
"dynamic_cast<fei::Matrix_Impl<LinearSystemCore>*> failed"
<<FEI_ENDL;
48
ERReturn(-1);
49
}
50
#else
51
fei::console_out
() <<
"libname==Aztec but HAVE_FEI_AZTECOO not defined."
<<FEI_ENDL;
52
ERReturn(-1);
53
#endif
54
}
55
56
if
(sname ==
"Trilinos"
) {
57
#ifdef HAVE_FEI_EPETRA
58
fei::Matrix_Impl<Epetra_CrsMatrix>* smatrix =
59
dynamic_cast<
fei::Matrix_Impl<Epetra_CrsMatrix>*
>
(matrix);
60
if
(smatrix == NULL) {
61
fei::console_out
() <<
"dynamic_cast<fei::Matrix_Impl<Epetra_CrsMatrix>*> failed"
<<FEI_ENDL;
62
ERReturn(-1);
63
}
64
#else
65
fei::console_out
() <<
"libname==Trilinos but HAVE_FEI_EPETRA not defined."
<<FEI_ENDL;
66
ERReturn(-1);
67
#endif
68
}
69
70
return
(0);
71
}
72
73
int
test_Factory_helper::dyncastVector(
fei::Vector
* vector,
74
const
char
* libname)
75
{
76
std::string sname(libname);
77
if
(sname ==
"TEST_LSC"
) {
78
fei::Vector_Impl<LinearSystemCore>* svector =
79
dynamic_cast<
fei::Vector_Impl<LinearSystemCore>*
>
(vector);
80
if
(svector == NULL) {
81
fei::console_out
() <<
"dynamic_cast<fei::Vector_Impl<LinearSystemCore>*> failed"
<<FEI_ENDL;
82
ERReturn(-1);
83
}
84
}
85
86
if
(sname ==
"Aztec"
) {
87
#ifdef HAVE_FEI_AZTECOO
88
fei::Vector_Impl<LinearSystemCore>* svector =
89
dynamic_cast<
fei::Vector_Impl<LinearSystemCore>*
>
(vector);
90
if
(svector == NULL) {
91
fei::console_out
() <<
"dynamic_cast<fei::Vector_Impl<LinearSystemCore>*> failed"
<<FEI_ENDL;
92
ERReturn(-1);
93
}
94
#else
95
fei::console_out
() <<
"libname==Aztec but HAVE_FEI_AZTECOO not defined."
<<FEI_ENDL;
96
ERReturn(-1);
97
#endif
98
}
99
100
if
(sname ==
"Trilinos"
) {
101
#ifdef HAVE_FEI_EPETRA
102
fei::Vector_Impl<Epetra_MultiVector>* svector =
103
dynamic_cast<
fei::Vector_Impl<Epetra_MultiVector>*
>
(vector);
104
if
(svector == NULL) {
105
fei::console_out
() <<
"dynamic_cast<fei::Vector_Impl<Epetra_MultiVector>*> failed"
<<FEI_ENDL;
106
ERReturn(-1);
107
}
108
#else
109
fei::console_out
() <<
"libname==Trilinos but HAVE_FEI_EPETRA not defined."
<<FEI_ENDL;
110
ERReturn(-1);
111
#endif
112
}
113
114
return
(0);
115
}
fei::Matrix
Definition
fei_Matrix.hpp:30
fei::Vector
Definition
fei_Vector.hpp:57
fei::console_out
std::ostream & console_out()
Definition
fei_console_ostream.cpp:26
Generated by
1.17.0