xref: /libCEED/examples/fluids/qfunctions/strong_boundary_conditions.h (revision 3722cd2309c405e01edbe38527e69f9775d947c0)
1*3722cd23SJames Wright // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2*3722cd23SJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3*3722cd23SJames Wright //
4*3722cd23SJames Wright // SPDX-License-Identifier: BSD-2-Clause
5*3722cd23SJames Wright //
6*3722cd23SJames Wright // This file is part of CEED:  http://github.com/ceed
7*3722cd23SJames Wright 
8*3722cd23SJames Wright #ifndef strong_boundary_conditions_h
9*3722cd23SJames Wright #define strong_boundary_conditions_h
10*3722cd23SJames Wright 
11*3722cd23SJames Wright #include <ceed.h>
12*3722cd23SJames Wright 
13*3722cd23SJames Wright CEED_QFUNCTION(SetupStrongBC)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
14*3722cd23SJames Wright   // Inputs
15*3722cd23SJames Wright   const CeedScalar(*coords)[CEED_Q_VLA]       = (const CeedScalar(*)[CEED_Q_VLA])in[0];
16*3722cd23SJames Wright   const CeedScalar(*multiplicity)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[1];
17*3722cd23SJames Wright 
18*3722cd23SJames Wright   // Outputs
19*3722cd23SJames Wright   CeedScalar(*coords_stored)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0];
20*3722cd23SJames Wright   CeedScalar(*scale_stored)              = (CeedScalar(*))out[1];
21*3722cd23SJames Wright 
22*3722cd23SJames Wright   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) {
23*3722cd23SJames Wright     for (int j = 0; j < 3; j++) coords_stored[j][i] = coords[j][i];
24*3722cd23SJames Wright     scale_stored[i] = 1.0 / multiplicity[0][i];
25*3722cd23SJames Wright   }
26*3722cd23SJames Wright   return 0;
27*3722cd23SJames Wright }
28*3722cd23SJames Wright 
29*3722cd23SJames Wright #endif  // strong_boundary_conditions_h
30