xref: /libCEED/rust/libceed-sys/c-src/interface/ceed-qfunction-register.c (revision 49aac155e7a09736f56fb3abac0f57dab29f7cbf)
13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
33d8e8822SJeremy L Thompson //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
53d8e8822SJeremy L Thompson //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
73d8e8822SJeremy L Thompson 
8*49aac155SJeremy L Thompson #include <ceed.h>
9ec3da8bcSJed Brown #include <ceed/backend.h>
10*49aac155SJeremy L Thompson #include <stdbool.h>
111d013790SJed Brown 
121d013790SJed Brown static bool register_all_called;
131d013790SJed Brown 
14*49aac155SJeremy L Thompson #define CEED_GALLERY_QFUNCTION(name) CEED_INTERN int name(void);
151d013790SJed Brown #include "../gallery/ceed-gallery-list.h"
16*49aac155SJeremy L Thompson #undef CEED_GALLERY_QFUNCTION
171d013790SJed Brown 
181d013790SJed Brown /**
191d013790SJed Brown   @brief Register the gallery of preconfigured QFunctions.
201d013790SJed Brown 
211d013790SJed Brown   This is called automatically by CeedQFunctionCreateInteriorByName() and thus normally need not be called by users.
221d013790SJed Brown   Users can call CeedQFunctionRegister() to register additional backends.
231d013790SJed Brown 
241d013790SJed Brown   @return An error code: 0 - success, otherwise - failure
251d013790SJed Brown 
261d013790SJed Brown   @sa CeedQFunctionRegister()
271d013790SJed Brown 
28ded9b81dSJeremy L Thompson   @ref User
291d013790SJed Brown **/
301d013790SJed Brown int CeedQFunctionRegisterAll() {
311d013790SJed Brown   if (register_all_called) return 0;
321d013790SJed Brown   register_all_called = true;
338ccf1006SJeremy L Thompson   CeedDebugEnv256(1, "\n---------- Registering Gallery QFunctions ----------\n");
34*49aac155SJeremy L Thompson #define CEED_GALLERY_QFUNCTION(name) CeedChk(name());
351d013790SJed Brown #include "../gallery/ceed-gallery-list.h"
36*49aac155SJeremy L Thompson #undef CEED_GALLERY_QFUNCTION
37e15f9bd0SJeremy L Thompson   return CEED_ERROR_SUCCESS;
381d013790SJed Brown }
39