xref: /libCEED/rust/libceed-sys/c-src/gallery/mass/ceed-mass1dbuild.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.
36a6224a1SJeremy L Thompson //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
56a6224a1SJeremy L Thompson //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
76a6224a1SJeremy L Thompson 
8*49aac155SJeremy L Thompson #include <ceed.h>
96a6224a1SJeremy L Thompson #include <ceed/backend.h>
10a0154adeSJed Brown #include <ceed/jit-source/gallery/ceed-mass1dbuild.h>
112b730f8bSJeremy L Thompson #include <string.h>
126a6224a1SJeremy L Thompson 
136a6224a1SJeremy L Thompson /**
14ea61e9acSJeremy L Thompson   @brief Set fields for Ceed QFunction building the geometric data for the 1D mass matrix
156a6224a1SJeremy L Thompson **/
162b730f8bSJeremy L Thompson static int CeedQFunctionInit_Mass1DBuild(Ceed ceed, const char *requested, CeedQFunction qf) {
176a6224a1SJeremy L Thompson   // Check QFunction name
186a6224a1SJeremy L Thompson   const char *name = "Mass1DBuild";
192b730f8bSJeremy L Thompson   if (strcmp(name, requested)) {
206a6224a1SJeremy L Thompson     // LCOV_EXCL_START
212b730f8bSJeremy L Thompson     return CeedError(ceed, CEED_ERROR_UNSUPPORTED, "QFunction '%s' does not match requested name: %s", name, requested);
226a6224a1SJeremy L Thompson     // LCOV_EXCL_STOP
232b730f8bSJeremy L Thompson   }
246a6224a1SJeremy L Thompson 
256a6224a1SJeremy L Thompson   // Add QFunction fields
266a6224a1SJeremy L Thompson   const CeedInt dim = 1;
272b730f8bSJeremy L Thompson   CeedCall(CeedQFunctionAddInput(qf, "dx", dim * dim, CEED_EVAL_GRAD));
282b730f8bSJeremy L Thompson   CeedCall(CeedQFunctionAddInput(qf, "weights", 1, CEED_EVAL_WEIGHT));
292b730f8bSJeremy L Thompson   CeedCall(CeedQFunctionAddOutput(qf, "qdata", 1, CEED_EVAL_NONE));
306a6224a1SJeremy L Thompson 
312b730f8bSJeremy L Thompson   CeedCall(CeedQFunctionSetUserFlopsEstimate(qf, 1));
326e15d496SJeremy L Thompson 
336a6224a1SJeremy L Thompson   return CEED_ERROR_SUCCESS;
346a6224a1SJeremy L Thompson }
356a6224a1SJeremy L Thompson 
366a6224a1SJeremy L Thompson /**
37ea61e9acSJeremy L Thompson   @brief Register Ceed QFunction for building the geometric data for the 1D mass matrix
386a6224a1SJeremy L Thompson **/
396a6224a1SJeremy L Thompson CEED_INTERN int CeedQFunctionRegister_Mass1DBuild(void) {
402b730f8bSJeremy L Thompson   return CeedQFunctionRegister("Mass1DBuild", Mass1DBuild_loc, 1, Mass1DBuild, CeedQFunctionInit_Mass1DBuild);
416a6224a1SJeremy L Thompson }
42