Compadre  1.5.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Compadre_CreateConstraints.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Compadre: COMpatible PArticle Discretization and REmap Toolkit
4 //
5 // Copyright 2018 NTESS and the Compadre contributors.
6 // SPDX-License-Identifier: BSD-2-Clause
7 // *****************************************************************************
8 // @HEADER
9 #ifndef _CREATE_CONSTRAINTS_
10 #define _CREATE_CONSTRAINTS_
11 
12 #include "Compadre_GMLS.hpp"
13 
14 namespace Compadre {
15 
16 KOKKOS_INLINE_FUNCTION
17 void evaluateConstraints(scratch_matrix_right_type M, scratch_matrix_right_type PsqrtW, const ConstraintType constraint_type, const ReconstructionSpace reconstruction_space, const int NP, const double cutoff_p, const int dimension, const int num_neighbors = 0, scratch_matrix_right_type* T = NULL) {
18  if (constraint_type == ConstraintType::NEUMANN_GRAD_SCALAR) {
19  if (reconstruction_space == ReconstructionSpace::ScalarTaylorPolynomial
21  // Fill in the bottom right entry for PsqrtW
22  PsqrtW(num_neighbors, PsqrtW.extent(1)-1) = 1.0;
23 
24  // Fill in the last column and row of M
25  for (int i=0; i<dimension; ++i) {
26  M(M.extent(0)-1, i+1) = (1.0/cutoff_p)*(*T)(dimension-1,i);
27  M(i+1, M.extent(0)-1) = (1.0/cutoff_p)*(*T)(dimension-1,i);
28  }
29  } else if (reconstruction_space == ReconstructionSpace::VectorTaylorPolynomial) {
30  // Fill in the bottom right of PsqrtW
31  for (int i=0; i<dimension; ++i) {
32  PsqrtW(num_neighbors, PsqrtW.extent(1) - 1 - i) = 1.0;
33  }
34 
35  // Fill in the last column and row of M
36  for (int i=0; i<dimension; ++i) {
37  for (int j=0; j<dimension; ++j) {
38  M(i*NP, M.extent(0) - 1 - j) = (*T)(dimension-1,i);
39  M(M.extent(0) - 1 - j, i*NP) = (*T)(dimension-1,i);
40  }
41  }
42  }
43  }
44 }
45 
46 }
47 #endif
ConstraintType
Constraint type.
Neumann Gradient Scalar Type.
ReconstructionSpace
Space in which to reconstruct polynomial.
Scalar basis reused as many times as there are components in the vector resulting in a much cheaper p...
Vector polynomial basis having # of components _dimensions, or (_dimensions-1) in the case of manifol...
Kokkos::View< double **, layout_right, Kokkos::MemoryTraits< Kokkos::Unmanaged > > scratch_matrix_right_type
Scalar polynomial basis centered at the target site and scaled by sum of basis powers e...
KOKKOS_INLINE_FUNCTION void evaluateConstraints(scratch_matrix_right_type M, scratch_matrix_right_type PsqrtW, const ConstraintType constraint_type, const ReconstructionSpace reconstruction_space, const int NP, const double cutoff_p, const int dimension, const int num_neighbors=0, scratch_matrix_right_type *T=NULL)