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 17*ec3da8bcSJed Brown #include <ceed/ceed.h> 18*ec3da8bcSJed Brown #include <ceed/backend.h> 193d576824SJeremy L Thompson #include <stdbool.h> 203d576824SJeremy L Thompson #include <string.h> 214a2e7687Sjeremylt #include "ceed-blocked.h" 224a2e7687Sjeremylt 23f10650afSjeremylt //------------------------------------------------------------------------------ 24f10650afSjeremylt // Backend Init 25f10650afSjeremylt //------------------------------------------------------------------------------ 261d013790SJed Brown CEED_INTERN int CeedInit_Blocked(const char *resource, Ceed ceed) { 274ce2993fSjeremylt int ierr; 284a2e7687Sjeremylt if (strcmp(resource, "/cpu/self") 29856142e1Sjeremylt && strcmp(resource, "/cpu/self/ref/blocked")) 30c042f62fSJeremy L Thompson // LCOV_EXCL_START 31e15f9bd0SJeremy L Thompson return CeedError(ceed, CEED_ERROR_BACKEND, 32e15f9bd0SJeremy L Thompson "Blocked backend cannot use resource: %s", resource); 33c042f62fSJeremy L Thompson // LCOV_EXCL_STOP 34e15f9bd0SJeremy L Thompson ierr = CeedSetDeterministic(ceed, true); CeedChkBackend(ierr); 354a2e7687Sjeremylt 365f67fadeSJeremy L Thompson // Create reference CEED that implementation will be dispatched 374a2e7687Sjeremylt // through unless overridden 386f7d248dSjeremylt Ceed ceedref; 39856142e1Sjeremylt CeedInit("/cpu/self/ref/serial", &ceedref); 40e15f9bd0SJeremy L Thompson ierr = CeedSetDelegate(ceed, ceedref); CeedChkBackend(ierr); 414a2e7687Sjeremylt 42e2f04181SAndrew T. Barker // Set fallback CEED resource for advanced operator functionality 43e2f04181SAndrew T. Barker const char fallbackresource[] = "/cpu/self/ref/serial"; 44e2f04181SAndrew T. Barker ierr = CeedSetOperatorFallbackResource(ceed, fallbackresource); 45e2f04181SAndrew T. Barker CeedChkBackend(ierr); 46e2f04181SAndrew T. Barker 47fe2413ffSjeremylt ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "OperatorCreate", 48e15f9bd0SJeremy L Thompson CeedOperatorCreate_Blocked); CeedChkBackend(ierr); 494a2e7687Sjeremylt 50e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 514a2e7687Sjeremylt } 524a2e7687Sjeremylt 53f10650afSjeremylt //------------------------------------------------------------------------------ 54f10650afSjeremylt // Backend Register 55f10650afSjeremylt //------------------------------------------------------------------------------ 561d013790SJed Brown CEED_INTERN int CeedRegister_Ref_Blocked(void) { 571d013790SJed Brown return CeedRegister("/cpu/self/ref/blocked", CeedInit_Blocked, 55); 584a2e7687Sjeremylt } 59f10650afSjeremylt //------------------------------------------------------------------------------ 60