| ceed-qfunction.c (1c66c397a67401e1a222857807e6e5b7c45b88c0) | ceed-qfunction.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-impl.h> --- 49 unchanged lines hidden (view full) --- 58 59 @return An error code: 0 - success, otherwise - failure 60 61 @ref Developer 62**/ 63int CeedQFunctionRegister(const char *name, const char *source, CeedInt vec_length, CeedQFunctionUser f, 64 int (*init)(Ceed, const char *, CeedQFunction)) { 65 const char *relative_file_path; | 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-impl.h> --- 49 unchanged lines hidden (view full) --- 58 59 @return An error code: 0 - success, otherwise - failure 60 61 @ref Developer 62**/ 63int CeedQFunctionRegister(const char *name, const char *source, CeedInt vec_length, CeedQFunctionUser f, 64 int (*init)(Ceed, const char *, CeedQFunction)) { 65 const char *relative_file_path; |
| 66 int ierr = 0; |
|
| 66 | 67 |
| 67 CeedCheck(num_qfunctions < sizeof(gallery_qfunctions) / sizeof(gallery_qfunctions[0]), NULL, CEED_ERROR_MAJOR, "Too many gallery QFunctions"); 68 | |
| 69 CeedDebugEnv("Gallery Register: %s", name); | 68 CeedDebugEnv("Gallery Register: %s", name); |
| 70 | |
| 71 CeedCall(CeedGetJitRelativePath(source, &relative_file_path)); | 69 CeedCall(CeedGetJitRelativePath(source, &relative_file_path)); |
| 72 73 strncpy(gallery_qfunctions[num_qfunctions].name, name, CEED_MAX_RESOURCE_LEN); 74 gallery_qfunctions[num_qfunctions].name[CEED_MAX_RESOURCE_LEN - 1] = 0; 75 strncpy(gallery_qfunctions[num_qfunctions].source, relative_file_path, CEED_MAX_RESOURCE_LEN); 76 gallery_qfunctions[num_qfunctions].source[CEED_MAX_RESOURCE_LEN - 1] = 0; 77 gallery_qfunctions[num_qfunctions].vec_length = vec_length; 78 gallery_qfunctions[num_qfunctions].f = f; 79 gallery_qfunctions[num_qfunctions].init = init; 80 num_qfunctions++; | 70 CeedPragmaCritical(CeedQFunctionRegister) { 71 if (num_qfunctions < sizeof(gallery_qfunctions) / sizeof(gallery_qfunctions[0])) { 72 strncpy(gallery_qfunctions[num_qfunctions].name, name, CEED_MAX_RESOURCE_LEN); 73 gallery_qfunctions[num_qfunctions].name[CEED_MAX_RESOURCE_LEN - 1] = 0; 74 strncpy(gallery_qfunctions[num_qfunctions].source, relative_file_path, CEED_MAX_RESOURCE_LEN); 75 gallery_qfunctions[num_qfunctions].source[CEED_MAX_RESOURCE_LEN - 1] = 0; 76 gallery_qfunctions[num_qfunctions].vec_length = vec_length; 77 gallery_qfunctions[num_qfunctions].f = f; 78 gallery_qfunctions[num_qfunctions].init = init; 79 num_qfunctions++; 80 } else { 81 ierr = 1; 82 } 83 } 84 // LCOV_EXCL_START 85 CeedCheck(ierr == 0, NULL, CEED_ERROR_MAJOR, "Too many gallery QFunctions"); 86 // LCOV_EXCL_STOP |
| 81 return CEED_ERROR_SUCCESS; 82} 83 84/** 85 @brief Set a CeedQFunction field, used by CeedQFunctionAddInput/Output 86 87 @param[out] f CeedQFunctionField 88 @param[in] field_name Name of QFunction field --- 926 unchanged lines hidden --- | 87 return CEED_ERROR_SUCCESS; 88} 89 90/** 91 @brief Set a CeedQFunction field, used by CeedQFunctionAddInput/Output 92 93 @param[out] f CeedQFunctionField 94 @param[in] field_name Name of QFunction field --- 926 unchanged lines hidden --- |