ceed-qfunction-register.c (ac5aa7bc7371bf37e58d1cad715ff1f25da1e838) ceed-qfunction-register.c (58c07c4fa7bdba34c2b29fbdcd58893d48c3fd9e)
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.h>
9#include <ceed/backend.h>
10#include <stdbool.h>
11
12static bool register_all_called;
13
14#define CEED_GALLERY_QFUNCTION(name) CEED_INTERN int name(void);
15#include "../gallery/ceed-gallery-list.h"
16#undef CEED_GALLERY_QFUNCTION
17
18/**
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.h>
9#include <ceed/backend.h>
10#include <stdbool.h>
11
12static bool register_all_called;
13
14#define CEED_GALLERY_QFUNCTION(name) CEED_INTERN int name(void);
15#include "../gallery/ceed-gallery-list.h"
16#undef CEED_GALLERY_QFUNCTION
17
18/**
19 @brief Register the gallery of pre-configured QFunctions.
19 @brief Register the gallery of preconfigured QFunctions.
20
21 This is called automatically by CeedQFunctionCreateInteriorByName() and thus normally need not be called by users.
22 Users can call CeedQFunctionRegister() to register additional backends.
23
24 @return An error code: 0 - success, otherwise - failure
25
26 @sa CeedQFunctionRegister()
27
28 @ref User
29**/
30int CeedQFunctionRegisterAll() {
20
21 This is called automatically by CeedQFunctionCreateInteriorByName() and thus normally need not be called by users.
22 Users can call CeedQFunctionRegister() to register additional backends.
23
24 @return An error code: 0 - success, otherwise - failure
25
26 @sa CeedQFunctionRegister()
27
28 @ref User
29**/
30int CeedQFunctionRegisterAll() {
31 if (register_all_called) return 0;
32 register_all_called = true;
33 CeedDebugEnv256(1, "\n---------- Registering Gallery QFunctions ----------\n");
34#define CEED_GALLERY_QFUNCTION(name) CeedChk(name());
31 int ierr = 0;
32
33 CeedPragmaCritical(CeedQFunctionRegisterAll) {
34 if (!register_all_called) {
35 CeedDebugEnv256(1, "\n---------- Registering Gallery QFunctions ----------\n");
36#define CEED_GALLERY_QFUNCTION(name) \
37 if (!ierr) ierr = name();
35#include "../gallery/ceed-gallery-list.h"
36#undef CEED_GALLERY_QFUNCTION
38#include "../gallery/ceed-gallery-list.h"
39#undef CEED_GALLERY_QFUNCTION
37 return CEED_ERROR_SUCCESS;
40 register_all_called = true;
41 }
42 }
43 return ierr;
38}
44}