xref: /libCEED/rust/libceed-sys/c-src/backends/ref/ceed-ref.c (revision 89c6efa49859cd40e0a2f99b4a91b922f3b4c9b2)
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 
1721617c04Sjeremylt #include "ceed-ref.h"
18ae3cba82Scamierjs 
19ae3cba82Scamierjs static int CeedInit_Ref(const char *resource, Ceed ceed) {
20fe2413ffSjeremylt   int ierr;
21ae3cba82Scamierjs   if (strcmp(resource, "/cpu/self")
22856142e1Sjeremylt       && strcmp(resource, "/cpu/self/ref/serial"))
23ae3cba82Scamierjs     return CeedError(ceed, 1, "Ref backend cannot use resource: %s", resource);
24fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "VecCreate",
25fe2413ffSjeremylt                                 CeedVectorCreate_Ref); CeedChk(ierr);
26fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateTensorH1",
27fe2413ffSjeremylt                                 CeedBasisCreateTensorH1_Ref); CeedChk(ierr);
28fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateH1",
29fe2413ffSjeremylt                                 CeedBasisCreateH1_Ref); CeedChk(ierr);
302f86a920SJeremy L Thompson   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "TensorContractCreate",
312f86a920SJeremy L Thompson                                 CeedTensorContractCreate_Ref); CeedChk(ierr);
32fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "ElemRestrictionCreate",
33fe2413ffSjeremylt                                 CeedElemRestrictionCreate_Ref); CeedChk(ierr);
341dfeef1dSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed,
351dfeef1dSjeremylt                                 "ElemRestrictionCreateBlocked",
36fe2413ffSjeremylt                                 CeedElemRestrictionCreate_Ref); CeedChk(ierr);
37fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "QFunctionCreate",
38fe2413ffSjeremylt                                 CeedQFunctionCreate_Ref); CeedChk(ierr);
39fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "OperatorCreate",
40fe2413ffSjeremylt                                 CeedOperatorCreate_Ref); CeedChk(ierr);
4152d6035fSJeremy L Thompson   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "CompositeOperatorCreate",
4252d6035fSJeremy L Thompson                                 CeedCompositeOperatorCreate_Ref); CeedChk(ierr);
43ae3cba82Scamierjs   return 0;
44ae3cba82Scamierjs }
45ae3cba82Scamierjs 
46ae3cba82Scamierjs __attribute__((constructor))
47ae3cba82Scamierjs static void Register(void) {
489ddbf157Sjeremylt //! [Register]
49*89c6efa4Sjeremylt   CeedRegister("/cpu/self/ref/serial", CeedInit_Ref, 55);
509ddbf157Sjeremylt //! [Register]
51ae3cba82Scamierjs }
52