xref: /libCEED/rust/libceed-sys/c-src/backends/ref/ceed-ref-qfunction.c (revision 4ce2993fee6e7bc9b86526ee90098d0dc489fc60)
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 <ceed-impl.h>
1821617c04Sjeremylt #include <string.h>
1921617c04Sjeremylt #include "ceed-ref.h"
2021617c04Sjeremylt 
216ddacda3Sjeremylt static int CeedQFunctionApply_Ref(CeedQFunction qf, CeedInt Q,
2221617c04Sjeremylt                                   const CeedScalar *const *u,
2321617c04Sjeremylt                                   CeedScalar *const *v) {
2421617c04Sjeremylt   int ierr;
25*4ce2993fSjeremylt   void *ctx;
26*4ce2993fSjeremylt   ierr = CeedQFunctionGetContext(qf, &ctx); CeedChk(ierr);
27*4ce2993fSjeremylt 
28*4ce2993fSjeremylt   ierr = qf->function(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) {
3721617c04Sjeremylt   qf->Apply = CeedQFunctionApply_Ref;
3821617c04Sjeremylt   qf->Destroy = CeedQFunctionDestroy_Ref;
3921617c04Sjeremylt   return 0;
4021617c04Sjeremylt }
41