Belos Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Belos_Details_registerLinearSolverFactory.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 
12 #include "Teuchos_ConfigDefs.hpp" // for __attribute__((weak)) check
13 
14 // FIXME (mfh 23 Aug 2015) Belos' main library is upstream from
15 // libraries where Belos' Epetra and Tpetra specializations live.
16 // That's why we need to use weak symbols here. Otherwise, link
17 // errors result. Fixing this requires the same run-time registration
18 // solution that Bug 6392 is all about.
19 
20 #if defined(HAVE_BELOS_EPETRA) && defined(HAVE_TEUCHOS_CXX_ATTRIBUTE_WEAK)
21 namespace Belos {
22 namespace Details {
23 namespace Epetra {
24  extern void __attribute__((weak)) registerLinearSolverFactory ();
25 } // namespace Epetra
26 } // namespace Details
27 } // namespace Belos
28 #endif // defined(HAVE_BELOS_EPETRA) && defined(HAVE_TEUCHOS_CXX_ATTRIBUTE_WEAK)
29 
30 #if defined(HAVE_BELOS_TPETRA) && defined(HAVE_TEUCHOS_CXX_ATTRIBUTE_WEAK)
31 namespace Belos {
32 namespace Details {
33 namespace Tpetra {
34  extern void __attribute__((weak)) registerLinearSolverFactory ();
35 } // namespace Tpetra
36 } // namespace Details
37 } // namespace Belos
38 #endif // defined(HAVE_BELOS_TPETRA) && defined(HAVE_TEUCHOS_CXX_ATTRIBUTE_WEAK)
39 
40 //
41 // FIXME (mfh 23 Aug 2015) We should add Thyra as well.
42 //
43 
44 namespace Belos {
45 namespace Details {
46 
47 void
49 {
50 #if defined(HAVE_BELOS_TPETRA) && defined(HAVE_TEUCHOS_CXX_ATTRIBUTE_WEAK)
51  // It's a weak symbol, so it might be NULL.
52  if (::Belos::Details::Tpetra::registerLinearSolverFactory != NULL) {
53  ::Belos::Details::Tpetra::registerLinearSolverFactory ();
54  }
55 #endif // defined(HAVE_BELOS_TPETRA) && defined(HAVE_TEUCHOS_CXX_ATTRIBUTE_WEAK)
56 
57 #if defined(HAVE_BELOS_EPETRA) && defined(HAVE_TEUCHOS_CXX_ATTRIBUTE_WEAK)
58  // It's a weak symbol, so it might be NULL.
59  if (::Belos::Details::Epetra::registerLinearSolverFactory != NULL) {
60  ::Belos::Details::Epetra::registerLinearSolverFactory ();
61  }
62 #endif // defined(HAVE_BELOS_EPETRA) && defined(HAVE_TEUCHOS_CXX_ATTRIBUTE_WEAK)
63 }
64 
65 } // namespace Details
66 } // namespace Belos
67 
68 
Implementation of Trilinos::Details::LinearSolverFactory.
void registerLinearSolverFactory()
Register Belos' LinearSolverFactory with the central repository, for all enabled combinations of temp...
Declaration of Belos::Details::registerLinearSolverFactory.