Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Amesos2_Details_registerLinearSolverFactory.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Amesos2: Templated Direct Sparse Solver Package
4 //
5 // Copyright 2011 NTESS and the Amesos2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
13 
14 #ifndef AMESOS2_DETAILS_REGISTERLINEARSOLVERFACTORY_HPP
15 #define AMESOS2_DETAILS_REGISTERLINEARSOLVERFACTORY_HPP
16 
17 #include "Amesos2_config.h"
18 
19 namespace Amesos2 {
20 namespace Details {
21 
48 void registerLinearSolverFactory ();
49 
50 } // namespace Details
51 } // namespace Amesos2
52 
53 namespace { // (anonymous)
54 
55 // \class RegisterLinearSolverFactory
56 // \brief Register Amesos2's solver factory/ies with the central registry.
57 //
58 // \warning NOT FOR USERS. ONLY FOR USE IN THIS FILE.
59 //
60 // Invoke this class' constructor to register Amesos2's solver
61 // factory/ies with the central registry, for all template parameter
62 // combinations that Amesos2 enabled. You need not keep the instance
63 // of the class around; the constructor has a side effect if it
64 // returns. (This is the C++ way of doing
65 // <tt>__attribute__((constructor))</tt>, without actually requiring
66 // the syntax extension.)
67 class RegisterLinearSolverFactory {
68 public:
69  RegisterLinearSolverFactory () {
70  Amesos2::Details::registerLinearSolverFactory ();
71  }
72 };
73 
74 // Creating an instance of RegisterLinearSolverFactory invokes its
75 // constructor, which has the side effect of calling
76 // Amesos2::Details::registerLinearSolverFactory().
77 RegisterLinearSolverFactory registerIt;
78 
79 } // namespace (anonymous)
80 
81 #endif // AMESOS2_DETAILS_REGISTERLINEARSOLVERFACTORY_HPP