xref: /libCEED/backends/ref/ceed-ref.c (revision c4e3f59b2ea5a0c95cc0118aa5026c447cce3092)
13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3ae3cba82Scamierjs //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5ae3cba82Scamierjs //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7ae3cba82Scamierjs 
821617c04Sjeremylt #include "ceed-ref.h"
9ae3cba82Scamierjs 
1049aac155SJeremy L Thompson #include <ceed.h>
112b730f8bSJeremy L Thompson #include <ceed/backend.h>
122b730f8bSJeremy L Thompson #include <string.h>
132b730f8bSJeremy L Thompson 
14f10650afSjeremylt //------------------------------------------------------------------------------
15f10650afSjeremylt // Backend Init
16f10650afSjeremylt //------------------------------------------------------------------------------
17ae3cba82Scamierjs static int CeedInit_Ref(const char *resource, Ceed ceed) {
182b730f8bSJeremy L Thompson   if (strcmp(resource, "/cpu/self") && strcmp(resource, "/cpu/self/ref") && strcmp(resource, "/cpu/self/ref/serial")) {
19c042f62fSJeremy L Thompson     // LCOV_EXCL_START
202b730f8bSJeremy L Thompson     return CeedError(ceed, CEED_ERROR_BACKEND, "Ref backend cannot use resource: %s", resource);
21c042f62fSJeremy L Thompson     // LCOV_EXCL_STOP
222b730f8bSJeremy L Thompson   }
232b730f8bSJeremy L Thompson   CeedCallBackend(CeedSetDeterministic(ceed, true));
246f7d248dSjeremylt 
252b730f8bSJeremy L Thompson   CeedCallBackend(CeedSetBackendFunction(ceed, "Ceed", ceed, "VectorCreate", CeedVectorCreate_Ref));
262b730f8bSJeremy L Thompson   CeedCallBackend(CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateTensorH1", CeedBasisCreateTensorH1_Ref));
272b730f8bSJeremy L Thompson   CeedCallBackend(CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateH1", CeedBasisCreateH1_Ref));
282b730f8bSJeremy L Thompson   CeedCallBackend(CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateHdiv", CeedBasisCreateHdiv_Ref));
29*c4e3f59bSSebastian Grimberg   CeedCallBackend(CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateHcurl", CeedBasisCreateHcurl_Ref));
302b730f8bSJeremy L Thompson   CeedCallBackend(CeedSetBackendFunction(ceed, "Ceed", ceed, "TensorContractCreate", CeedTensorContractCreate_Ref));
312b730f8bSJeremy L Thompson   CeedCallBackend(CeedSetBackendFunction(ceed, "Ceed", ceed, "ElemRestrictionCreate", CeedElemRestrictionCreate_Ref));
322b730f8bSJeremy L Thompson   CeedCallBackend(CeedSetBackendFunction(ceed, "Ceed", ceed, "ElemRestrictionCreateOriented", CeedElemRestrictionCreateOriented_Ref));
332b730f8bSJeremy L Thompson   CeedCallBackend(CeedSetBackendFunction(ceed, "Ceed", ceed, "ElemRestrictionCreateBlocked", CeedElemRestrictionCreate_Ref));
342b730f8bSJeremy L Thompson   CeedCallBackend(CeedSetBackendFunction(ceed, "Ceed", ceed, "QFunctionCreate", CeedQFunctionCreate_Ref));
352b730f8bSJeremy L Thompson   CeedCallBackend(CeedSetBackendFunction(ceed, "Ceed", ceed, "QFunctionContextCreate", CeedQFunctionContextCreate_Ref));
362b730f8bSJeremy L Thompson   CeedCallBackend(CeedSetBackendFunction(ceed, "Ceed", ceed, "OperatorCreate", CeedOperatorCreate_Ref));
37e15f9bd0SJeremy L Thompson   return CEED_ERROR_SUCCESS;
38ae3cba82Scamierjs }
39ae3cba82Scamierjs 
40f10650afSjeremylt //------------------------------------------------------------------------------
41f10650afSjeremylt // Backend Register
42f10650afSjeremylt //------------------------------------------------------------------------------
431d013790SJed Brown CEED_INTERN int CeedRegister_Ref(void) {
441d013790SJed Brown   return
459ddbf157Sjeremylt       //! [Register]
46706bc5e6Sjeremylt       CeedRegister("/cpu/self/ref/serial", CeedInit_Ref, 50);
479ddbf157Sjeremylt   //! [Register]
48ae3cba82Scamierjs }
49f10650afSjeremylt //------------------------------------------------------------------------------
50