xref: /libCEED/rust/libceed-sys/c-src/gallery/identity/ceed-identity.c (revision 3d576824e8d990e1f48c6609089904bee9170514)
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 
17*3d576824SJeremy L Thompson #include <ceed.h>
18*3d576824SJeremy 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
310219ea01SJeremy L Thompson     return CeedError(ceed, 1, "QFunction '%s' does not match requested name: %s",
320219ea01SJeremy L Thompson                      name, requested);
33f0d2f928Sjeremylt   // LCOV_EXCL_STOP
340219ea01SJeremy L Thompson 
3560f77c51Sjeremylt   // QFunction fields 'input' and 'output' with requested emodes added
3660f77c51Sjeremylt   //   by the library rather than being added here
370219ea01SJeremy L Thompson 
380219ea01SJeremy L Thompson   return 0;
390219ea01SJeremy L Thompson }
400219ea01SJeremy L Thompson 
410219ea01SJeremy L Thompson /**
420219ea01SJeremy L Thompson   @brief Register identity QFunction that copies inputs directly into outputs
430219ea01SJeremy L Thompson **/
441d013790SJed Brown CEED_INTERN int CeedQFunctionRegister_Identity(void) {
451d013790SJed Brown   return CeedQFunctionRegister("Identity", Identity_loc, 1, Identity,
460219ea01SJeremy L Thompson                                CeedQFunctionInit_Identity);
470219ea01SJeremy L Thompson }
48