xref: /libCEED/interface/ceed-register.c (revision 129d873643707da2348b9f89b9ef383c571b232a)
1 // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2 // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3 //
4 // SPDX-License-Identifier: BSD-2-Clause
5 //
6 // This file is part of CEED:  http://github.com/ceed
7 
8 #include <ceed/ceed.h>
9 #include <ceed/backend.h>
10 #include <ceed-impl.h>
11 #include <stdbool.h>
12 #include <stdio.h>
13 
14 static bool register_all_called;
15 
16 #define MACRO(name,...) CEED_INTERN int name(void);
17 #include "../backends/ceed-backend-list.h"
18 #undef MACRO
19 
20 /**
21   @brief Register all preconfigured backends.
22 
23   This is called automatically by CeedInit() and thus normally need not be called by users.
24   Users can call CeedRegister() to register additional backends.
25 
26   @return An error code: 0 - success, otherwise - failure
27 
28   @sa CeedRegister()
29 
30   @ref User
31 **/
32 int CeedRegisterAll() {
33   if (register_all_called) return 0;
34   register_all_called = true;
35 
36 #define MACRO(name,...) CeedChk(name());
37 #include "../backends/ceed-backend-list.h"
38 #undef MACRO
39   return CEED_ERROR_SUCCESS;
40 }
41