xref: /libCEED/rust/libceed-sys/c-src/backends/ref/ceed-ref.c (revision 2f86a9204e4fbd31e43e0982a43b4a40f1fd11a7)
10c784865Scamierjs // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
20c784865Scamierjs // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
30c784865Scamierjs // All Rights reserved. See files LICENSE and NOTICE for details.
4ae3cba82Scamierjs //
5ae3cba82Scamierjs // This file is part of CEED, a collection of benchmarks, miniapps, software
6ae3cba82Scamierjs // libraries and APIs for efficient high-order finite element and spectral
7ae3cba82Scamierjs // element discretizations for exascale applications. For more information and
8ae3cba82Scamierjs // source code availability see http://github.com/ceed.
9ae3cba82Scamierjs //
10ae3cba82Scamierjs // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
11ae3cba82Scamierjs // a collaborative effort of two U.S. Department of Energy organizations (Office
12ae3cba82Scamierjs // of Science and the National Nuclear Security Administration) responsible for
13ae3cba82Scamierjs // the planning and preparation of a capable exascale ecosystem, including
14ae3cba82Scamierjs // software, applications, hardware, advanced system engineering and early
15ae3cba82Scamierjs // testbed platforms, in support of the nation's exascale computing imperative.
16ae3cba82Scamierjs 
17ae3cba82Scamierjs #include <string.h>
1821617c04Sjeremylt #include "ceed-ref.h"
19ae3cba82Scamierjs 
20ae3cba82Scamierjs static int CeedInit_Ref(const char *resource, Ceed ceed) {
21fe2413ffSjeremylt   int ierr;
22ae3cba82Scamierjs   if (strcmp(resource, "/cpu/self")
23856142e1Sjeremylt       && strcmp(resource, "/cpu/self/ref/serial"))
24ae3cba82Scamierjs     return CeedError(ceed, 1, "Ref backend cannot use resource: %s", resource);
25fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "VecCreate",
26fe2413ffSjeremylt                                 CeedVectorCreate_Ref); CeedChk(ierr);
27fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateTensorH1",
28fe2413ffSjeremylt                                 CeedBasisCreateTensorH1_Ref); CeedChk(ierr);
29fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateH1",
30fe2413ffSjeremylt                                 CeedBasisCreateH1_Ref); CeedChk(ierr);
31*2f86a920SJeremy L Thompson   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "TensorContractCreate",
32*2f86a920SJeremy L Thompson                                 CeedTensorContractCreate_Ref); CeedChk(ierr);
33fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "ElemRestrictionCreate",
34fe2413ffSjeremylt                                 CeedElemRestrictionCreate_Ref); CeedChk(ierr);
351dfeef1dSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed,
361dfeef1dSjeremylt                                 "ElemRestrictionCreateBlocked",
37fe2413ffSjeremylt                                 CeedElemRestrictionCreate_Ref); CeedChk(ierr);
38fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "QFunctionCreate",
39fe2413ffSjeremylt                                 CeedQFunctionCreate_Ref); CeedChk(ierr);
40fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "OperatorCreate",
41fe2413ffSjeremylt                                 CeedOperatorCreate_Ref); CeedChk(ierr);
4252d6035fSJeremy L Thompson   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "CompositeOperatorCreate",
4352d6035fSJeremy L Thompson                                 CeedCompositeOperatorCreate_Ref); CeedChk(ierr);
44ae3cba82Scamierjs   return 0;
45ae3cba82Scamierjs }
46ae3cba82Scamierjs 
47ae3cba82Scamierjs __attribute__((constructor))
48ae3cba82Scamierjs static void Register(void) {
499ddbf157Sjeremylt //! [Register]
50856142e1Sjeremylt   CeedRegister("/cpu/self/ref/serial", CeedInit_Ref, 40);
519ddbf157Sjeremylt //! [Register]
52ae3cba82Scamierjs }
53