xref: /libCEED/rust/libceed-sys/c-src/gallery/mass/ceed-mass3dbuild.c (revision ca94c3ddc8f82b7d93a79f9e4812e99b8be840ff)
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 
849aac155SJeremy L Thompson #include <ceed.h>
96a6224a1SJeremy L Thompson #include <ceed/backend.h>
10a0154adeSJed Brown #include <ceed/jit-source/gallery/ceed-mass3dbuild.h>
112b730f8bSJeremy L Thompson #include <string.h>
126a6224a1SJeremy L Thompson 
136a6224a1SJeremy L Thompson /**
14*ca94c3ddSJeremy L Thompson   @brief Set fields for `CeedQFunction` building the geometric data for the 3D mass matrix
156a6224a1SJeremy L Thompson **/
162b730f8bSJeremy L Thompson static int CeedQFunctionInit_Mass3DBuild(Ceed ceed, const char *requested, CeedQFunction qf) {
176a6224a1SJeremy L Thompson   // Check QFunction name
186a6224a1SJeremy L Thompson   const char *name = "Mass3DBuild";
196574a04fSJeremy L Thompson   CeedCheck(!strcmp(name, requested), ceed, CEED_ERROR_UNSUPPORTED, "QFunction '%s' does not match requested name: %s", name, requested);
206a6224a1SJeremy L Thompson 
216a6224a1SJeremy L Thompson   // Add QFunction fields
226a6224a1SJeremy L Thompson   const CeedInt dim = 3;
232b730f8bSJeremy L Thompson   CeedCall(CeedQFunctionAddInput(qf, "dx", dim * dim, CEED_EVAL_GRAD));
242b730f8bSJeremy L Thompson   CeedCall(CeedQFunctionAddInput(qf, "weights", 1, CEED_EVAL_WEIGHT));
252b730f8bSJeremy L Thompson   CeedCall(CeedQFunctionAddOutput(qf, "qdata", 1, CEED_EVAL_NONE));
266a6224a1SJeremy L Thompson 
272b730f8bSJeremy L Thompson   CeedCall(CeedQFunctionSetUserFlopsEstimate(qf, 15));
286e15d496SJeremy L Thompson 
296a6224a1SJeremy L Thompson   return CEED_ERROR_SUCCESS;
306a6224a1SJeremy L Thompson }
316a6224a1SJeremy L Thompson 
326a6224a1SJeremy L Thompson /**
33*ca94c3ddSJeremy L Thompson   @brief Register `CeedQFunction` for building the geometric data for the 3D mass matrix
346a6224a1SJeremy L Thompson **/
356a6224a1SJeremy L Thompson CEED_INTERN int CeedQFunctionRegister_Mass3DBuild(void) {
362b730f8bSJeremy L Thompson   return CeedQFunctionRegister("Mass3DBuild", Mass3DBuild_loc, 1, Mass3DBuild, CeedQFunctionInit_Mass3DBuild);
376a6224a1SJeremy L Thompson }
38