xref: /libCEED/rust/libceed-sys/c-src/backends/blocked/ceed-blocked.c (revision 856142e1b942abfda690c8495da63ec0cf28a439)
14a2e7687Sjeremylt // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
24a2e7687Sjeremylt // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
34a2e7687Sjeremylt // All Rights reserved. See files LICENSE and NOTICE for details.
44a2e7687Sjeremylt //
54a2e7687Sjeremylt // This file is part of CEED, a collection of benchmarks, miniapps, software
64a2e7687Sjeremylt // libraries and APIs for efficient high-order finite element and spectral
74a2e7687Sjeremylt // element discretizations for exascale applications. For more information and
84a2e7687Sjeremylt // source code availability see http://github.com/ceed.
94a2e7687Sjeremylt //
104a2e7687Sjeremylt // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
114a2e7687Sjeremylt // a collaborative effort of two U.S. Department of Energy organizations (Office
124a2e7687Sjeremylt // of Science and the National Nuclear Security Administration) responsible for
134a2e7687Sjeremylt // the planning and preparation of a capable exascale ecosystem, including
144a2e7687Sjeremylt // software, applications, hardware, advanced system engineering and early
154a2e7687Sjeremylt // testbed platforms, in support of the nation's exascale computing imperative.
164a2e7687Sjeremylt 
174a2e7687Sjeremylt #include <string.h>
184a2e7687Sjeremylt #include "ceed-blocked.h"
194a2e7687Sjeremylt 
204a2e7687Sjeremylt static int CeedInit_Blocked(const char *resource, Ceed ceed) {
214ce2993fSjeremylt   int ierr;
224a2e7687Sjeremylt   if (strcmp(resource, "/cpu/self")
23*856142e1Sjeremylt       && strcmp(resource, "/cpu/self/ref/blocked"))
244a2e7687Sjeremylt     return CeedError(ceed, 1, "Blocked backend cannot use resource: %s", resource);
254a2e7687Sjeremylt 
264a2e7687Sjeremylt   Ceed ceedref;
274a2e7687Sjeremylt 
284a2e7687Sjeremylt   // Create refrence CEED that implementation will be dispatched
294a2e7687Sjeremylt   //   through unless overridden
30*856142e1Sjeremylt   CeedInit("/cpu/self/ref/serial", &ceedref);
314ce2993fSjeremylt   ierr = CeedSetDelegate(ceed, &ceedref); CeedChk(ierr);
324a2e7687Sjeremylt 
33fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateTensorH1",
34fe2413ffSjeremylt                                 CeedBasisCreateTensorH1_Blocked); CeedChk(ierr);
35fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateH1",
36fe2413ffSjeremylt                                 CeedBasisCreateH1_Blocked); CeedChk(ierr);
37fe2413ffSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "OperatorCreate",
38fe2413ffSjeremylt                                 CeedOperatorCreate_Blocked); CeedChk(ierr);
394a2e7687Sjeremylt 
404a2e7687Sjeremylt   return 0;
414a2e7687Sjeremylt }
424a2e7687Sjeremylt 
434a2e7687Sjeremylt __attribute__((constructor))
444a2e7687Sjeremylt static void Register(void) {
45*856142e1Sjeremylt   CeedRegister("/cpu/self/ref/blocked", CeedInit_Blocked, 30);
464a2e7687Sjeremylt }
47