1 // Copyright (c) 2017-2024, 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 <ceed/jit-source/gallery/ceed-poisson2dapply.h> 11 #include <string.h> 12 13 /** 14 @brief Set fields for `CeedQFunction` applying the 2D Poisson operator 15 **/ 16 static int CeedQFunctionInit_Poisson2DApply(Ceed ceed, const char *requested, CeedQFunction qf) { 17 // Check QFunction name 18 const char *name = "Poisson2DApply"; 19 CeedCheck(!strcmp(name, requested), ceed, CEED_ERROR_UNSUPPORTED, "QFunction '%s' does not match requested name: %s", name, requested); 20 21 // Add QFunction fields 22 const CeedInt dim = 2; 23 CeedCall(CeedQFunctionAddInput(qf, "du", dim, CEED_EVAL_GRAD)); 24 CeedCall(CeedQFunctionAddInput(qf, "qdata", dim * (dim + 1) / 2, CEED_EVAL_NONE)); 25 CeedCall(CeedQFunctionAddOutput(qf, "dv", dim, CEED_EVAL_GRAD)); 26 27 CeedCall(CeedQFunctionSetUserFlopsEstimate(qf, 6)); 28 29 return CEED_ERROR_SUCCESS; 30 } 31 32 /** 33 @brief Register `CeedQFunction` for applying the 2D Poisson operator 34 **/ 35 CEED_INTERN int CeedQFunctionRegister_Poisson2DApply(void) { 36 return CeedQFunctionRegister("Poisson2DApply", Poisson2DApply_loc, 1, Poisson2DApply, CeedQFunctionInit_Poisson2DApply); 37 } 38