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