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 // ----------------------------------------------------------------------------- 15 CEED_QFUNCTION(Error)(void *ctx, CeedInt Q, 16 const CeedScalar *const *in, CeedScalar *const *out) { 17 const CeedScalar *u = in[0], *target = in[1]; 18 CeedScalar *error = out[0]; 19 for (CeedInt i=0; i<Q; i++) { 20 error[i] = u[i] - target[i]; 21 } 22 return 0; 23 } 24 25 // ----------------------------------------------------------------------------- 26 CEED_QFUNCTION(Error3)(void *ctx, CeedInt Q, 27 const CeedScalar *const *in, CeedScalar *const *out) { 28 const CeedScalar *u = in[0], *target = in[1]; 29 CeedScalar *error = out[0]; 30 for (CeedInt i=0; i<3*Q; i++) { 31 error[i] = u[i] - target[i]; 32 } 33 return 0; 34 } 35 // ----------------------------------------------------------------------------- 36 37 #endif // common_h 38