xref: /libCEED/rust/libceed-sys/c-src/gallery/scale/ceed-scale.c (revision ea61e9ac44808524e4667c1525a05976f536c19c)
13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3d99fa3c5SJeremy L Thompson //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5d99fa3c5SJeremy L Thompson //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7d99fa3c5SJeremy L Thompson 
8ec3da8bcSJed Brown #include <ceed/backend.h>
92b730f8bSJeremy L Thompson #include <ceed/ceed.h>
10a0154adeSJed Brown #include <ceed/jit-source/gallery/ceed-scale.h>
112b730f8bSJeremy L Thompson #include <string.h>
12d99fa3c5SJeremy L Thompson 
13d99fa3c5SJeremy L Thompson /**
14d99fa3c5SJeremy L Thompson   @brief  Set fields for vector scaling QFunction that scales inputs
15d99fa3c5SJeremy L Thompson **/
162b730f8bSJeremy L Thompson static int CeedQFunctionInit_Scale(Ceed ceed, const char *requested, CeedQFunction qf) {
17d99fa3c5SJeremy L Thompson   // Check QFunction name
18d99fa3c5SJeremy L Thompson   const char *name = "Scale";
192b730f8bSJeremy L Thompson   if (strcmp(name, requested)) {
20d99fa3c5SJeremy L Thompson     // LCOV_EXCL_START
212b730f8bSJeremy L Thompson     return CeedError(ceed, CEED_ERROR_UNSUPPORTED, "QFunction '%s' does not match requested name: %s", name, requested);
22d99fa3c5SJeremy L Thompson     // LCOV_EXCL_STOP
232b730f8bSJeremy L Thompson   }
24d99fa3c5SJeremy L Thompson 
25*ea61e9acSJeremy L Thompson   // QFunction fields 'input' and 'output' with requested emodes added by the library rather than being added here
26d99fa3c5SJeremy L Thompson 
27e15f9bd0SJeremy L Thompson   return CEED_ERROR_SUCCESS;
28d99fa3c5SJeremy L Thompson }
29d99fa3c5SJeremy L Thompson 
30d99fa3c5SJeremy L Thompson /**
31d99fa3c5SJeremy L Thompson   @brief Register scaling QFunction
32d99fa3c5SJeremy L Thompson **/
332b730f8bSJeremy L Thompson CEED_INTERN int CeedQFunctionRegister_Scale(void) { return CeedQFunctionRegister("Scale", Scale_loc, 1, Scale, CeedQFunctionInit_Scale); }
34