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