1 // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2 // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3 // 4 // SPDX-License-Identifier: BSD-2-Clause 5 // 6 // This file is part of CEED: http://github.com/ceed 7 8 /// @file 9 /// libCEED QFunctions for BP examples using PETSc 10 11 #ifndef common_h 12 #define common_h 13 14 #include <ceed.h> 15 16 // ----------------------------------------------------------------------------- 17 CEED_QFUNCTION(Error)(void *ctx, CeedInt Q, 18 const CeedScalar *const *in, CeedScalar *const *out) { 19 const CeedScalar *u = in[0], *target = in[1], *q_data = in[2]; 20 CeedScalar *error = out[0]; 21 for (CeedInt i=0; i<Q; i++) { 22 error[i] = (u[i] - target[i])*q_data[i]; 23 } 24 return 0; 25 } 26 27 // ----------------------------------------------------------------------------- 28 CEED_QFUNCTION(Error3)(void *ctx, CeedInt Q, 29 const CeedScalar *const *in, CeedScalar *const *out) { 30 const CeedScalar *u = in[0], *target = in[1], *q_data = in[2]; 31 CeedScalar *error = out[0]; 32 for (CeedInt i=0; i<3*Q; i++) { 33 error[i] = (u[i] - target[i])*q_data[i]; 34 } 35 return 0; 36 } 37 // ----------------------------------------------------------------------------- 38 39 #endif // common_h 40