121617c04Sjeremylt // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC. 221617c04Sjeremylt // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707. 321617c04Sjeremylt // All Rights reserved. See files LICENSE and NOTICE for details. 421617c04Sjeremylt // 521617c04Sjeremylt // This file is part of CEED, a collection of benchmarks, miniapps, software 621617c04Sjeremylt // libraries and APIs for efficient high-order finite element and spectral 721617c04Sjeremylt // element discretizations for exascale applications. For more information and 821617c04Sjeremylt // source code availability see http://github.com/ceed. 921617c04Sjeremylt // 1021617c04Sjeremylt // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, 1121617c04Sjeremylt // a collaborative effort of two U.S. Department of Energy organizations (Office 1221617c04Sjeremylt // of Science and the National Nuclear Security Administration) responsible for 1321617c04Sjeremylt // the planning and preparation of a capable exascale ecosystem, including 1421617c04Sjeremylt // software, applications, hardware, advanced system engineering and early 1521617c04Sjeremylt // testbed platforms, in support of the nation's exascale computing imperative. 1621617c04Sjeremylt 1721617c04Sjeremylt #include <string.h> 1821617c04Sjeremylt #include "ceed-ref.h" 1921617c04Sjeremylt 206ddacda3Sjeremylt static int CeedQFunctionApply_Ref(CeedQFunction qf, CeedInt Q, 2121617c04Sjeremylt const CeedScalar *const *u, 2221617c04Sjeremylt CeedScalar *const *v) { 2321617c04Sjeremylt int ierr; 244ce2993fSjeremylt void *ctx; 254ce2993fSjeremylt ierr = CeedQFunctionGetContext(qf, &ctx); CeedChk(ierr); 26fe2413ffSjeremylt int (*f)() = NULL; 27*28d161eeSjeremylt ierr = CeedQFunctionGetUserFunction(qf, (int (**)())&f); CeedChk(ierr); 28fe2413ffSjeremylt ierr = f(ctx, Q, u, v); CeedChk(ierr); 2921617c04Sjeremylt return 0; 3021617c04Sjeremylt } 3121617c04Sjeremylt 3221617c04Sjeremylt static int CeedQFunctionDestroy_Ref(CeedQFunction qf) { 3321617c04Sjeremylt return 0; 3421617c04Sjeremylt } 3521617c04Sjeremylt 3621617c04Sjeremylt int CeedQFunctionCreate_Ref(CeedQFunction qf) { 37fe2413ffSjeremylt int ierr; 38fe2413ffSjeremylt Ceed ceed; 39fe2413ffSjeremylt ierr = CeedQFunctionGetCeed(qf, &ceed); CeedChk(ierr); 40fe2413ffSjeremylt 41fe2413ffSjeremylt ierr = CeedSetBackendFunction(ceed, "QFunction", qf, "Apply", 42fe2413ffSjeremylt CeedQFunctionApply_Ref); CeedChk(ierr); 43fe2413ffSjeremylt ierr = CeedSetBackendFunction(ceed, "QFunction", qf, "Destroy", 44fe2413ffSjeremylt CeedQFunctionDestroy_Ref); CeedChk(ierr); 4521617c04Sjeremylt return 0; 4621617c04Sjeremylt } 47