xref: /libCEED/examples/fluids/qfunctions/strong_boundary_conditions.h (revision 5aed82e4fa97acf4ba24a7f10a35f5303a6798e0)
1 // Copyright (c) 2017-2024, 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 #ifndef strong_boundary_conditions_h
9 #define strong_boundary_conditions_h
10 
11 #include <ceed.h>
12 
13 #include "setupgeo_helpers.h"
14 
15 CEED_QFUNCTION(SetupStrongBC)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
16   // Inputs
17   const CeedScalar(*coords)[CEED_Q_VLA]       = (const CeedScalar(*)[CEED_Q_VLA])in[0];
18   const CeedScalar(*dxdX_q)[3][CEED_Q_VLA]    = (const CeedScalar(*)[3][CEED_Q_VLA])in[1];
19   const CeedScalar(*multiplicity)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[2];
20 
21   // Outputs
22   CeedScalar(*coords_stored)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0];
23   CeedScalar(*scale_stored)              = out[1];
24   CeedScalar(*dXdx_q)[CEED_Q_VLA]        = (CeedScalar(*)[CEED_Q_VLA])out[2];
25 
26   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) {
27     for (int j = 0; j < 3; j++) coords_stored[j][i] = coords[j][i];
28     scale_stored[i] = 1.0 / multiplicity[0][i];
29     CeedScalar dXdx[2][3];
30     InvertBoundaryMappingJacobian_3D(Q, i, dxdX_q, dXdx);
31     dXdx_q[0][i] = dXdx[0][0];
32     dXdx_q[1][i] = dXdx[0][1];
33     dXdx_q[2][i] = dXdx[0][2];
34     dXdx_q[3][i] = dXdx[1][0];
35     dXdx_q[4][i] = dXdx[1][1];
36     dXdx_q[5][i] = dXdx[1][2];
37   }
38   return 0;
39 }
40 
41 #endif  // strong_boundary_conditions_h
42