xref: /libCEED/examples/fluids/qfunctions/strong_boundary_conditions.h (revision d4cc18453651bd0f94c1a2e078b2646a92dafdcc)
1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors.
23722cd23SJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
33722cd23SJames Wright //
43722cd23SJames Wright // SPDX-License-Identifier: BSD-2-Clause
53722cd23SJames Wright //
63722cd23SJames Wright // This file is part of CEED:  http://github.com/ceed
7c0b5abf0SJeremy L Thompson #include <ceed/types.h>
83722cd23SJames Wright 
966170c20SJames Wright #include "setupgeo_helpers.h"
1066170c20SJames Wright 
SetupStrongBC(void * ctx,CeedInt Q,const CeedScalar * const * in,CeedScalar * const * out)113722cd23SJames Wright CEED_QFUNCTION(SetupStrongBC)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
123722cd23SJames Wright   const CeedScalar(*coords)[CEED_Q_VLA]       = (const CeedScalar(*)[CEED_Q_VLA])in[0];
1366170c20SJames Wright   const CeedScalar(*dxdX_q)[3][CEED_Q_VLA]    = (const CeedScalar(*)[3][CEED_Q_VLA])in[1];
1466170c20SJames Wright   const CeedScalar(*multiplicity)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[2];
153722cd23SJames Wright   CeedScalar(*coords_stored)[CEED_Q_VLA]      = (CeedScalar(*)[CEED_Q_VLA])out[0];
1666170c20SJames Wright   CeedScalar(*scale_stored)                   = out[1];
1766170c20SJames Wright   CeedScalar(*dXdx_q)[CEED_Q_VLA]             = (CeedScalar(*)[CEED_Q_VLA])out[2];
183722cd23SJames Wright 
193722cd23SJames Wright   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) {
203722cd23SJames Wright     for (int j = 0; j < 3; j++) coords_stored[j][i] = coords[j][i];
213722cd23SJames Wright     scale_stored[i] = 1.0 / multiplicity[0][i];
2266170c20SJames Wright     CeedScalar dXdx[2][3];
2366170c20SJames Wright     InvertBoundaryMappingJacobian_3D(Q, i, dxdX_q, dXdx);
2466170c20SJames Wright     dXdx_q[0][i] = dXdx[0][0];
2566170c20SJames Wright     dXdx_q[1][i] = dXdx[0][1];
2666170c20SJames Wright     dXdx_q[2][i] = dXdx[0][2];
2766170c20SJames Wright     dXdx_q[3][i] = dXdx[1][0];
2866170c20SJames Wright     dXdx_q[4][i] = dXdx[1][1];
2966170c20SJames Wright     dXdx_q[5][i] = dXdx[1][2];
303722cd23SJames Wright   }
313722cd23SJames Wright   return 0;
323722cd23SJames Wright }
33