xref: /libCEED/rust/libceed-sys/c-src/gallery/identity/ceed-identity.c (revision 60f77c51b5a8877aa3ab66b685cde4f5f7c967bb)
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 
170219ea01SJeremy L Thompson #include <string.h>
180219ea01SJeremy L Thompson #include "ceed-backend.h"
190219ea01SJeremy L Thompson #include "ceed-identity.h"
200219ea01SJeremy L Thompson 
210219ea01SJeremy L Thompson /**
220219ea01SJeremy L Thompson   @brief Set fields identity QFunction that copies inputs directly into outputs
230219ea01SJeremy L Thompson **/
240219ea01SJeremy L Thompson static int CeedQFunctionInit_Identity(Ceed ceed, const char *requested,
250219ea01SJeremy L Thompson                                       CeedQFunction qf) {
260219ea01SJeremy L Thompson   // Check QFunction name
270219ea01SJeremy L Thompson   const char *name = "Identity";
280219ea01SJeremy L Thompson   if (strcmp(name, requested))
29f0d2f928Sjeremylt     // LCOV_EXCL_START
300219ea01SJeremy L Thompson     return CeedError(ceed, 1, "QFunction '%s' does not match requested name: %s",
310219ea01SJeremy L Thompson                      name, requested);
32f0d2f928Sjeremylt   // LCOV_EXCL_STOP
330219ea01SJeremy L Thompson 
34*60f77c51Sjeremylt   // QFunction fields 'input' and 'output' with requested emodes added
35*60f77c51Sjeremylt   //   by the library rather than being added here
360219ea01SJeremy L Thompson 
370219ea01SJeremy L Thompson   return 0;
380219ea01SJeremy L Thompson }
390219ea01SJeremy L Thompson 
400219ea01SJeremy L Thompson /**
410219ea01SJeremy L Thompson   @brief Register identity QFunction that copies inputs directly into outputs
420219ea01SJeremy L Thompson **/
430219ea01SJeremy L Thompson __attribute__((constructor))
440219ea01SJeremy L Thompson static void Register(void) {
450219ea01SJeremy L Thompson   CeedQFunctionRegister("Identity", Identity_loc, 1, Identity,
460219ea01SJeremy L Thompson                         CeedQFunctionInit_Identity);
470219ea01SJeremy L Thompson }
48