xref: /libCEED/rust/libceed-sys/c-src/gallery/identity/ceed-identity.c (revision e15f9bd09af0280c89b79924fa9af7dd2e3e30be)
10219ea01SJeremy L Thompson // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
20219ea01SJeremy L Thompson // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
30219ea01SJeremy L Thompson // All Rights reserved. See files LICENSE and NOTICE for details.
40219ea01SJeremy L Thompson //
50219ea01SJeremy L Thompson // This file is part of CEED, a collection of benchmarks, miniapps, software
60219ea01SJeremy L Thompson // libraries and APIs for efficient high-order finite element and spectral
70219ea01SJeremy L Thompson // element discretizations for exascale applications. For more information and
80219ea01SJeremy L Thompson // source code availability see http://github.com/ceed.
90219ea01SJeremy L Thompson //
100219ea01SJeremy L Thompson // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
110219ea01SJeremy L Thompson // a collaborative effort of two U.S. Department of Energy organizations (Office
120219ea01SJeremy L Thompson // of Science and the National Nuclear Security Administration) responsible for
130219ea01SJeremy L Thompson // the planning and preparation of a capable exascale ecosystem, including
140219ea01SJeremy L Thompson // software, applications, hardware, advanced system engineering and early
150219ea01SJeremy L Thompson // testbed platforms, in support of the nation's exascale computing imperative.
160219ea01SJeremy L Thompson 
173d576824SJeremy L Thompson #include <ceed.h>
183d576824SJeremy L Thompson #include <ceed-backend.h>
190219ea01SJeremy L Thompson #include <string.h>
200219ea01SJeremy L Thompson #include "ceed-identity.h"
210219ea01SJeremy L Thompson 
220219ea01SJeremy L Thompson /**
230219ea01SJeremy L Thompson   @brief Set fields identity QFunction that copies inputs directly into outputs
240219ea01SJeremy L Thompson **/
250219ea01SJeremy L Thompson static int CeedQFunctionInit_Identity(Ceed ceed, const char *requested,
260219ea01SJeremy L Thompson                                       CeedQFunction qf) {
270219ea01SJeremy L Thompson   // Check QFunction name
280219ea01SJeremy L Thompson   const char *name = "Identity";
290219ea01SJeremy L Thompson   if (strcmp(name, requested))
30f0d2f928Sjeremylt     // LCOV_EXCL_START
31*e15f9bd0SJeremy L Thompson     return CeedError(ceed, CEED_ERROR_UNSUPPORTED,
32*e15f9bd0SJeremy L Thompson                      "QFunction '%s' does not match requested name: %s",
330219ea01SJeremy L Thompson                      name, requested);
34f0d2f928Sjeremylt   // LCOV_EXCL_STOP
350219ea01SJeremy L Thompson 
3660f77c51Sjeremylt   // QFunction fields 'input' and 'output' with requested emodes added
3760f77c51Sjeremylt   //   by the library rather than being added here
380219ea01SJeremy L Thompson 
39*e15f9bd0SJeremy L Thompson   return CEED_ERROR_SUCCESS;
400219ea01SJeremy L Thompson }
410219ea01SJeremy L Thompson 
420219ea01SJeremy L Thompson /**
430219ea01SJeremy L Thompson   @brief Register identity QFunction that copies inputs directly into outputs
440219ea01SJeremy L Thompson **/
451d013790SJed Brown CEED_INTERN int CeedQFunctionRegister_Identity(void) {
461d013790SJed Brown   return CeedQFunctionRegister("Identity", Identity_loc, 1, Identity,
470219ea01SJeremy L Thompson                                CeedQFunctionInit_Identity);
480219ea01SJeremy L Thompson }
49