xref: /libCEED/rust/libceed-sys/c-src/backends/ref/ceed-ref.c (revision 21617c043cf2be06120e43f272b68c5ebd5f09fa)
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 <ceed-impl.h>
18ae3cba82Scamierjs #include <string.h>
19*21617c04Sjeremylt #include "ceed-ref.h"
20ae3cba82Scamierjs 
21ae3cba82Scamierjs static int CeedInit_Ref(const char *resource, Ceed ceed) {
22ae3cba82Scamierjs   if (strcmp(resource, "/cpu/self")
23ae3cba82Scamierjs       && strcmp(resource, "/cpu/self/ref"))
24ae3cba82Scamierjs     return CeedError(ceed, 1, "Ref backend cannot use resource: %s", resource);
25ae3cba82Scamierjs   ceed->VecCreate = CeedVectorCreate_Ref;
26ae3cba82Scamierjs   ceed->BasisCreateTensorH1 = CeedBasisCreateTensorH1_Ref;
27ae3cba82Scamierjs   ceed->ElemRestrictionCreate = CeedElemRestrictionCreate_Ref;
28ae3cba82Scamierjs   ceed->QFunctionCreate = CeedQFunctionCreate_Ref;
29ae3cba82Scamierjs   ceed->OperatorCreate = CeedOperatorCreate_Ref;
30ae3cba82Scamierjs   return 0;
31ae3cba82Scamierjs }
32ae3cba82Scamierjs 
33ae3cba82Scamierjs __attribute__((constructor))
34ae3cba82Scamierjs static void Register(void) {
35ae3cba82Scamierjs   CeedRegister("/cpu/self/ref", CeedInit_Ref);
36ae3cba82Scamierjs }
37