FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test_Factory_helper.cpp
Go to the documentation of this file.
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 
12 
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 
28  const char* libname)
29 {
30  std::string sname(libname);
31 
32  if (sname == "TEST_LSC") {
33 
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
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
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 
74  const char* libname)
75 {
76  std::string sname(libname);
77  if (sname == "TEST_LSC") {
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
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
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 }
int dyncastVector(fei::Vector *vector, const char *libname)
#define ERReturn(a)
int dyncastMatrix(fei::Matrix *matrix, const char *libname)
#define FEI_ENDL
std::ostream & console_out()