xref: /libCEED/rust/libceed-sys/c-src/gallery/scale/ceed-scale.c (revision d99fa3c5cd91a1690aedf0679cbf290d44fec74c)
1*d99fa3c5SJeremy L Thompson // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
2*d99fa3c5SJeremy L Thompson // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
3*d99fa3c5SJeremy L Thompson // All Rights reserved. See files LICENSE and NOTICE for details.
4*d99fa3c5SJeremy L Thompson //
5*d99fa3c5SJeremy L Thompson // This file is part of CEED, a collection of benchmarks, miniapps, software
6*d99fa3c5SJeremy L Thompson // libraries and APIs for efficient high-order finite element and spectral
7*d99fa3c5SJeremy L Thompson // element discretizations for exascale applications. For more information and
8*d99fa3c5SJeremy L Thompson // source code availability see http://github.com/ceed.
9*d99fa3c5SJeremy L Thompson //
10*d99fa3c5SJeremy L Thompson // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
11*d99fa3c5SJeremy L Thompson // a collaborative effort of two U.S. Department of Energy organizations (Office
12*d99fa3c5SJeremy L Thompson // of Science and the National Nuclear Security Administration) responsible for
13*d99fa3c5SJeremy L Thompson // the planning and preparation of a capable exascale ecosystem, including
14*d99fa3c5SJeremy L Thompson // software, applications, hardware, advanced system engineering and early
15*d99fa3c5SJeremy L Thompson // testbed platforms, in support of the nation's exascale computing imperative.
16*d99fa3c5SJeremy L Thompson 
17*d99fa3c5SJeremy L Thompson #include <string.h>
18*d99fa3c5SJeremy L Thompson #include "ceed-backend.h"
19*d99fa3c5SJeremy L Thompson #include "ceed-scale.h"
20*d99fa3c5SJeremy L Thompson 
21*d99fa3c5SJeremy L Thompson /**
22*d99fa3c5SJeremy L Thompson   @brief  Set fields for vector scaling QFunction that scales inputs
23*d99fa3c5SJeremy L Thompson **/
24*d99fa3c5SJeremy L Thompson static int CeedQFunctionInit_Scale(Ceed ceed, const char *requested,
25*d99fa3c5SJeremy L Thompson                                    CeedQFunction qf) {
26*d99fa3c5SJeremy L Thompson   // Check QFunction name
27*d99fa3c5SJeremy L Thompson   const char *name = "Scale";
28*d99fa3c5SJeremy L Thompson   if (strcmp(name, requested))
29*d99fa3c5SJeremy L Thompson     // LCOV_EXCL_START
30*d99fa3c5SJeremy L Thompson     return CeedError(ceed, 1, "QFunction '%s' does not match requested name: %s",
31*d99fa3c5SJeremy L Thompson                      name, requested);
32*d99fa3c5SJeremy L Thompson   // LCOV_EXCL_STOP
33*d99fa3c5SJeremy L Thompson 
34*d99fa3c5SJeremy L Thompson   // QFunction fields 'input' and 'output' with requested emodes added
35*d99fa3c5SJeremy L Thompson   //   by the library rather than being added here
36*d99fa3c5SJeremy L Thompson 
37*d99fa3c5SJeremy L Thompson   return 0;
38*d99fa3c5SJeremy L Thompson }
39*d99fa3c5SJeremy L Thompson 
40*d99fa3c5SJeremy L Thompson /**
41*d99fa3c5SJeremy L Thompson   @brief Register scaling QFunction
42*d99fa3c5SJeremy L Thompson **/
43*d99fa3c5SJeremy L Thompson __attribute__((constructor))
44*d99fa3c5SJeremy L Thompson static void Register(void) {
45*d99fa3c5SJeremy L Thompson   CeedQFunctionRegister("Scale", Scale_loc, 1, Scale,
46*d99fa3c5SJeremy L Thompson                         CeedQFunctionInit_Scale);
47*d99fa3c5SJeremy L Thompson }
48