9 #include "KokkosBatched_Gemm_TeamVector_Internal.hpp" 16 &&
"keep_coefficients is set to true, but number of batches exceeds 1.");
33 &&
"No target operations added to GMLS class before calling generatePolynomialCoefficients().");
43 &&
"Neighbor lists not set in GMLS class before calling generatePolynomialCoefficients.");
47 &&
"Source coordinates not set in GMLS class before calling generatePolynomialCoefficients.");
58 &&
"Cannot solve GMLS problems with the NEUMANN_GRAD_SCALAR constraint using QR Factorization.");
73 }
catch(std::exception &e) {
74 printf(
"Insufficient memory to store alphas: \n\n%s", e.what());
83 std::pow(2,sro.use_target_site_weights),
93 }
catch(std::exception &e) {
94 printf(
"Insufficient memory to store prestencil weights: \n\n%s", e.what());
134 int team_scratch_size_a = 0;
137 int team_scratch_size_b = 0;
138 int thread_scratch_size_a = 0;
139 int thread_scratch_size_b = 0;
150 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
166 team_scratch_size_b += scratch_vector_type::shmem_size(max_P_row_size);
167 thread_scratch_size_b += scratch_vector_type::shmem_size(max_manifold_NP*
_basis_multiplier);
168 thread_scratch_size_b += scratch_vector_type::shmem_size((max_poly_order+1)*
_global_dimensions);
186 team_scratch_size_a += scratch_vector_type::shmem_size(max_num_rows);
187 team_scratch_size_a += scratch_vector_type::shmem_size(max_num_rows);
193 thread_scratch_size_b += scratch_vector_type::shmem_size(this_num_cols);
205 int RHS_dim_0, RHS_dim_1;
208 int P_dim_0, P_dim_1;
219 _w = Kokkos::View<double*>(
"w", max_batch_size*
TO_GLOBAL(max_num_rows));
220 }
catch (std::exception &e) {
221 printf(
"Failed to allocate space for RHS, P, and w. Consider increasing number_of_batches: \n\n%s", e.what());
232 &&
"Normal vectors are required for solving GMLS problems with the NEUMANN_GRAD_SCALAR constraint.");
237 for (
int batch_num=0; batch_num<number_of_batches; ++batch_num) {
240 Kokkos::deep_copy(
_RHS, 0.0);
241 Kokkos::deep_copy(
_P, 0.0);
242 Kokkos::deep_copy(
_w, 0.0);
267 Kokkos::Profiling::pushRegion(
"Curvature LU Factorization");
271 GMLS_LinearAlgebra::batchQRPivotingSolve<layout_right,layout_left,layout_right>(
_pm,
_RHS.data(), RHS_dim_0, RHS_dim_1,
_P.data(), P_dim_1, P_dim_0, manifold_NP, manifold_NP,
_max_num_neighbors, this_batch_size);
272 Kokkos::Profiling::popRegion();
275 Kokkos::Profiling::pushRegion(
"Curvature QR+Pivoting Factorization");
276 GMLS_LinearAlgebra::batchQRPivotingSolve<layout_right,layout_right,layout_right>(
_pm,
_P.data(), P_dim_0, P_dim_1,
_RHS.data(), RHS_dim_0, RHS_dim_1,
_max_num_neighbors, manifold_NP,
_max_num_neighbors, this_batch_size);
277 Kokkos::Profiling::popRegion();
284 Kokkos::deep_copy(
_P, 0.0);
286 if (batch_num==number_of_batches-1) {
288 _host_T = Kokkos::create_mirror_view(
_T);
299 Kokkos::Profiling::pushRegion(
"Curvature LU Factorization");
300 GMLS_LinearAlgebra::batchQRPivotingSolve<layout_right,layout_left,layout_right>(
_pm,
_RHS.data(), RHS_dim_0, RHS_dim_1,
_P.data(), P_dim_1, P_dim_0, manifold_NP, manifold_NP,
_max_num_neighbors, this_batch_size);
301 Kokkos::Profiling::popRegion();
304 Kokkos::Profiling::pushRegion(
"Curvature QR+Pivoting Factorization");
305 GMLS_LinearAlgebra::batchQRPivotingSolve<layout_right,layout_right,layout_right>(
_pm,
_P.data(), P_dim_0, P_dim_1,
_RHS.data(), RHS_dim_0, RHS_dim_1,
_max_num_neighbors, manifold_NP,
_max_num_neighbors, this_batch_size);
306 Kokkos::Profiling::popRegion();
320 Kokkos::deep_copy(
_P, 0.0);
327 Kokkos::Profiling::pushRegion(
"Manifold LU Factorization");
328 GMLS_LinearAlgebra::batchQRPivotingSolve<layout_right,layout_left,layout_right>(
_pm,
_RHS.data(), RHS_dim_0, RHS_dim_1,
_P.data(), P_dim_1, P_dim_0, this_num_cols, this_num_cols, max_num_rows, this_batch_size);
329 Kokkos::Profiling::popRegion();
331 Kokkos::Profiling::pushRegion(
"Manifold QR+Pivoting Factorization");
332 GMLS_LinearAlgebra::batchQRPivotingSolve<layout_right,layout_right,layout_right>(
_pm,
_P.data(), P_dim_0, P_dim_1,
_RHS.data(), RHS_dim_0, RHS_dim_1, max_num_rows, this_num_cols, max_num_rows, this_batch_size);
333 Kokkos::Profiling::popRegion();
350 Kokkos::Profiling::pushRegion(
"LU Factorization");
351 GMLS_LinearAlgebra::batchQRPivotingSolve<layout_right,layout_left,layout_right>(
_pm,
_RHS.data(), RHS_dim_0, RHS_dim_1,
_P.data(), P_dim_1, P_dim_0, this_num_cols + added_coeff_size, this_num_cols + added_coeff_size, max_num_rows +
_added_alpha_size, this_batch_size);
352 Kokkos::Profiling::popRegion();
354 Kokkos::Profiling::pushRegion(
"QR+Pivoting Factorization");
356 GMLS_LinearAlgebra::batchQRPivotingSolve<layout_right,layout_right,layout_right>(
_pm,
_RHS.data(), RHS_dim_0, RHS_dim_1,
_P.data(), P_dim_1, P_dim_0, this_num_cols + added_coeff_size, this_num_cols + added_coeff_size, max_num_rows +
_added_alpha_size, this_batch_size);
358 GMLS_LinearAlgebra::batchQRPivotingSolve<layout_right,layout_right,layout_right>(
_pm,
_P.data(), P_dim_0, P_dim_1,
_RHS.data(), RHS_dim_0, RHS_dim_1, max_num_rows, this_num_cols, max_num_rows, this_batch_size);
360 Kokkos::Profiling::popRegion();
397 _w = Kokkos::View<double*>(
"w",0);
398 if (number_of_batches > 1) {
399 _RHS = Kokkos::View<double*>(
"RHS",0);
400 _P = Kokkos::View<double*>(
"P",0);
404 _RHS = Kokkos::View<double*>(
"RHS", 0);
405 if (!keep_coefficients)
_P = Kokkos::View<double*>(
"P", 0);
408 _P = Kokkos::View<double*>(
"P", 0);
409 if (!keep_coefficients)
_RHS = Kokkos::View<double*>(
"RHS", 0);
411 _RHS = Kokkos::View<double*>(
"RHS", 0);
412 if (!keep_coefficients)
_P = Kokkos::View<double*>(
"P", 0);
441 KOKKOS_INLINE_FUNCTION
449 const int local_index = teamMember.league_rank();
455 int RHS_dim_0, RHS_dim_1;
457 int P_dim_0, P_dim_1;
480 this->
createWeightsAndP(teamMember, delta, thread_workspace, PsqrtW, w,
_dimensions,
_poly_order,
true , NULL ,
_reconstruction_space,
_polynomial_sampling_functional);
484 double * rhs_data = RHS.data();
485 Kokkos::parallel_for(Kokkos::TeamVectorRange(teamMember,this_num_rows), [&] (
const int i) {
486 rhs_data[i] = std::sqrt(w(i));
493 KokkosBatched::TeamVectorGemmInternal<KokkosBatched::Algo::Gemm::Unblocked>
495 this_num_cols, this_num_cols, this_num_rows,
497 PsqrtW.data(), PsqrtW.stride(1), PsqrtW.stride(0),
498 PsqrtW.data(), PsqrtW.stride(0), PsqrtW.stride(1),
500 M.data(), M.stride(0), M.stride(1));
501 teamMember.team_barrier();
504 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember, max_num_rows), [&] (
const int i) {
505 for (
int j=0; j < this_num_cols; j++) {
506 PsqrtW(i, j) = PsqrtW(i, j)*std::sqrt(w(i));
509 teamMember.team_barrier();
519 double cutoff_p =
_epsilons(target_index);
527 KOKKOS_INLINE_FUNCTION
534 const int local_index = teamMember.league_rank();
539 int RHS_dim_0, RHS_dim_1;
541 int P_dim_0, P_dim_1;
574 teamMember.team_barrier();
577 teamMember.team_barrier();
581 KOKKOS_INLINE_FUNCTION
589 const int local_index = teamMember.league_rank();
593 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
597 int P_dim_0, P_dim_1;
625 KokkosBatched::TeamVectorGemmInternal<KokkosBatched::Algo::Gemm::Unblocked>
629 PsqrtW.data(), PsqrtW.stride(1), PsqrtW.stride(0),
630 PsqrtW.data(), PsqrtW.stride(0), PsqrtW.stride(1),
632 PTP.data(), PTP.stride(0), PTP.stride(1));
633 teamMember.team_barrier();
639 teamMember.team_barrier();
643 KOKKOS_INLINE_FUNCTION
651 const int local_index = teamMember.league_rank();
655 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
656 const int this_num_neighbors = this->
getNNeighbors(target_index);
660 int RHS_dim_0, RHS_dim_1;
662 int P_dim_0, P_dim_1;
689 teamMember.team_barrier();
696 double * rhs_data = RHS.data();
697 Kokkos::parallel_for(Kokkos::TeamVectorRange(teamMember,this_num_neighbors), [&] (
const int i) {
698 rhs_data[i] = std::sqrt(w(i));
706 KokkosBatched::TeamVectorGemmInternal<KokkosBatched::Algo::Gemm::Unblocked>
708 manifold_NP, manifold_NP, this_num_neighbors,
710 CurvaturePsqrtW.data(), CurvaturePsqrtW.stride(1), CurvaturePsqrtW.stride(0),
711 CurvaturePsqrtW.data(), CurvaturePsqrtW.stride(0), CurvaturePsqrtW.stride(1),
713 M.data(), M.stride(0), M.stride(1));
714 teamMember.team_barrier();
717 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember, this_num_neighbors), [=] (
const int i) {
718 for (
int j=0; j < manifold_NP; j++) {
719 CurvaturePsqrtW(i, j) = CurvaturePsqrtW(i, j)*std::sqrt(w(i));
723 teamMember.team_barrier();
726 KOKKOS_INLINE_FUNCTION
734 const int local_index = teamMember.league_rank();
738 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
742 int RHS_dim_0, RHS_dim_1;
744 int P_dim_0, P_dim_1;
781 teamMember.team_barrier();
783 double grad_xi1 = 0, grad_xi2 = 0;
788 Kokkos::parallel_reduce(Kokkos::TeamThreadRange(teamMember,
789 manifold_NP), [=] (
const int l,
double &talpha_ij) {
790 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
791 talpha_ij += P_target_row(offset,l)*Q(l,i);
794 teamMember.team_barrier();
795 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
796 manifold_gradient(i*(
_dimensions-1) + k) = alpha_ij;
799 teamMember.team_barrier();
802 double normal_coordinate = rel_coord[
_dimensions-1];
805 grad_xi1 += manifold_gradient(i*(
_dimensions-1)) * normal_coordinate;
807 teamMember.team_barrier();
811 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
813 double grad_xi[2] = {grad_xi1, grad_xi2};
831 norm += T(0,j)*T(0,j);
835 norm = std::sqrt(norm);
842 double dot_product = T(0,0)*T(1,0) + T(0,1)*T(1,1) + T(0,2)*T(1,2);
844 T(1,j) -= dot_product*T(0,j);
849 norm += T(1,j)*T(1,j);
851 norm = std::sqrt(norm);
858 double norm_t_normal = 0;
860 T(
_dimensions-1,0) = T(0,1)*T(1,2) - T(1,1)*T(0,2);
862 T(
_dimensions-1,1) = -(T(0,0)*T(1,2) - T(1,0)*T(0,2));
864 T(
_dimensions-1,2) = T(0,0)*T(1,1) - T(1,0)*T(0,1);
872 norm_t_normal = std::sqrt(norm_t_normal);
877 teamMember.team_barrier();
880 KOKKOS_INLINE_FUNCTION
899 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
901 double dot_product = 0;
906 if (dot_product < 0) {
922 teamMember.team_barrier();
925 KOKKOS_INLINE_FUNCTION
933 const int local_index = teamMember.league_rank();
937 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
941 int RHS_dim_0, RHS_dim_1;
943 int P_dim_0, P_dim_1;
986 teamMember.team_barrier();
988 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
989 for (
int j=0; j<manifold_NP; ++j) {
990 manifold_coeffs(j) = 0;
993 teamMember.team_barrier();
995 double grad_xi1 = 0, grad_xi2 = 0;
1000 Kokkos::parallel_reduce(Kokkos::TeamThreadRange(teamMember,
1001 manifold_NP), [=] (
const int l,
double &talpha_ij) {
1002 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
1003 talpha_ij += P_target_row(offset,l)*Q(l,i);
1006 teamMember.team_barrier();
1007 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
1008 manifold_gradient(i*(
_dimensions-1) + k) = alpha_ij;
1011 teamMember.team_barrier();
1014 double normal_coordinate = rel_coord[
_dimensions-1];
1017 grad_xi1 += manifold_gradient(i*(
_dimensions-1)) * normal_coordinate;
1020 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
1021 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
1023 for (
int j=0; j<manifold_NP; ++j) {
1024 manifold_coeffs(j) += Q(j,i) * normal_coordinate;
1028 teamMember.team_barrier();
1032 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
1034 manifold_gradient_coeffs(0) = grad_xi1;
1035 if (
_dimensions>2) manifold_gradient_coeffs(1) = grad_xi2;
1038 G(0,0) = 1 + grad_xi1*grad_xi1;
1041 G(0,1) = grad_xi1*grad_xi2;
1042 G(1,0) = grad_xi2*grad_xi1;
1043 G(1,1) = 1 + grad_xi2*grad_xi2;
1046 double G_determinant;
1048 G_determinant = G(0,0);
1050 G_inv(0,0) = 1/G_determinant;
1052 G_determinant = G(0,0)*G(1,1) - G(0,1)*G(1,0);
1056 G_inv(0,0) = G(1,1)/G_determinant;
1057 G_inv(1,1) = G(0,0)/G_determinant;
1058 G_inv(0,1) = -G(0,1)/G_determinant;
1059 G_inv(1,0) = -G(1,0)/G_determinant;
1064 teamMember.team_barrier();
1070 KOKKOS_INLINE_FUNCTION
1078 const int local_index = teamMember.league_rank();
1082 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
1087 int RHS_dim_0, RHS_dim_1;
1089 int P_dim_0, P_dim_1;
1114 this->
createWeightsAndP(teamMember, delta, thread_workspace, PsqrtW, w,
_dimensions-1,
_poly_order,
true , &T,
_reconstruction_space,
_polynomial_sampling_functional);
1115 teamMember.team_barrier();
1119 double * Q_data = Q.data();
1120 Kokkos::parallel_for(Kokkos::TeamVectorRange(teamMember,this_num_rows), [&] (
const int i) {
1121 Q_data[i] = std::sqrt(w(i));
1129 KokkosBatched::TeamVectorGemmInternal<KokkosBatched::Algo::Gemm::Unblocked>
1130 ::invoke(teamMember,
1131 this_num_cols, this_num_cols, this_num_rows,
1133 PsqrtW.data(), PsqrtW.stride(1), PsqrtW.stride(0),
1134 PsqrtW.data(), PsqrtW.stride(0), PsqrtW.stride(1),
1136 M.data(), M.stride(0), M.stride(1));
1137 teamMember.team_barrier();
1141 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember, max_num_rows), [&] (
const int i) {
1142 for (
int j=0; j < this_num_cols; j++) {
1143 PsqrtW(i, j) = PsqrtW(i, j)*std::sqrt(w(i));
1147 teamMember.team_barrier();
1150 KOKKOS_INLINE_FUNCTION
1158 const int local_index = teamMember.league_rank();
1162 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
1166 int RHS_dim_0, RHS_dim_1;
1168 int P_dim_0, P_dim_1;
1206 teamMember.team_barrier();
1210 teamMember.team_barrier();
1214 KOKKOS_INLINE_FUNCTION
1222 const int local_index = teamMember.league_rank();
1226 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
1230 int RHS_dim_0, RHS_dim_1;
1232 int P_dim_0, P_dim_1;
1266 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
1267 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
1273 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
1274 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
1284 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember,this->
getNNeighbors(target_index)), [=] (
const int m) {
1285 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
1287 XYZ tangent_quadrature_coord_2d;
1292 double tangent_vector[3];
1293 tangent_vector[0] = tangent_quadrature_coord_2d[0]*T(0,0) + tangent_quadrature_coord_2d[1]*T(1,0);
1294 tangent_vector[1] = tangent_quadrature_coord_2d[0]*T(0,1) + tangent_quadrature_coord_2d[1]*T(1,1);
1295 tangent_vector[2] = tangent_quadrature_coord_2d[0]*T(0,2) + tangent_quadrature_coord_2d[1]*T(1,2);
1309 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember,this->
getNNeighbors(target_index)), [&] (
const int m) {
1311 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
1312 this->
calcGradientPij(teamMember, delta.data(), thread_workspace.data(), target_index, m, 0 , 0 ,
_dimensions-1,
_curvature_poly_order,
false , &T,
ReconstructionSpace::ScalarTaylorPolynomial,
PointSample);
1315 double grad_xi1 = 0, grad_xi2 = 0;
1316 Kokkos::parallel_reduce(Kokkos::ThreadVectorRange(teamMember,this->
getNNeighbors(target_index)), [=] (
const int i,
double &t_grad_xi1) {
1317 double alpha_ij = 0;
1318 for (
int l=0; l<manifold_NP; ++l) {
1319 alpha_ij += delta(l)*Q(l,i);
1322 double normal_coordinate = rel_coord[
_dimensions-1];
1325 t_grad_xi1 += alpha_ij * normal_coordinate;
1329 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
1330 this->
calcGradientPij(teamMember, delta.data(), thread_workspace.data(), target_index, m, 0 , 1 ,
_dimensions-1,
_curvature_poly_order,
false , &T,
ReconstructionSpace::ScalarTaylorPolynomial,
PointSample);
1332 Kokkos::parallel_reduce(Kokkos::ThreadVectorRange(teamMember,this->
getNNeighbors(target_index)), [=] (
const int i,
double &t_grad_xi2) {
1333 double alpha_ij = 0;
1334 for (
int l=0; l<manifold_NP; ++l) {
1335 alpha_ij += delta(l)*Q(l,i);
1338 double normal_coordinate = rel_coord[
_dimensions-1];
1341 if (
_dimensions>2) t_grad_xi2 += alpha_ij * normal_coordinate;
1346 teamMember.team_barrier();
1350 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember,this->
getNNeighbors(target_index)), [=] (
const int m) {
1352 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
1361 norm += tangent(0,j)*tangent(0,j);
1365 norm = std::sqrt(norm);
1367 tangent(0,j) /= norm;
1372 double dot_product = tangent(0,0)*tangent(1,0) + tangent(0,1)*tangent(1,1) + tangent(0,2)*tangent(1,2);
1374 tangent(1,j) -= dot_product*tangent(0,j);
1379 norm += tangent(1,j)*tangent(1,j);
1381 norm = std::sqrt(norm);
1383 tangent(1,j) /= norm;
1396 teamMember.team_barrier();
Kokkos::View< double * > _manifold_metric_tensor_inverse
metric tensor inverse for all problems
Kokkos::View< double *, layout_right > _alphas
generated alpha coefficients (device)
std::size_t global_index_type
KOKKOS_INLINE_FUNCTION int getAdditionalAlphaSizeFromConstraint(DenseSolverType dense_solver_type, ConstraintType constraint_type)
Kokkos::View< const double *****, layout_right >::HostMirror _host_prestencil_weights
generated weights for nontraditional samples required to transform data into expected sampling functi...
Kokkos::View< TargetOperation * > _operations
vector containing target functionals to be applied for reconstruction problem (device) ...
bool _entire_batch_computed_at_once
whether entire calculation was computed at once the alternative is that it was broken up over many sm...
KOKKOS_INLINE_FUNCTION double getNeighborCoordinate(const int target_index, const int neighbor_list_num, const int dim, const scratch_matrix_right_type *V=NULL) const
Returns one component of the neighbor coordinate for a particular target.
int _max_evaluation_sites_per_target
maximum number of evaluation sites for each target (includes target site)
Kokkos::View< double * > _manifold_curvature_coefficients
curvature polynomial coefficients for all problems
KOKKOS_INLINE_FUNCTION void createWeightsAndP(const member_type &teamMember, scratch_vector_type delta, scratch_vector_type thread_workspace, scratch_matrix_right_type P, scratch_vector_type w, const int dimension, int polynomial_order, bool weight_p=false, scratch_matrix_right_type *V=NULL, const ReconstructionSpace reconstruction_space=ReconstructionSpace::ScalarTaylorPolynomial, const SamplingFunctional sampling_strategy=PointSample) const
Fills the _P matrix with either P or P*sqrt(w)
void generatePolynomialCoefficients(const int number_of_batches=1, const bool keep_coefficients=false)
Generates polynomial coefficients by setting up and solving least squares problems ! Sets up the batc...
Tag for functor to evaluate curvature targets and apply to coefficients of curvature reconstruction...
Kokkos::View< double * > _ref_N
Rank 2 tensor for high order approximation of tangent vectors for all problems.
KOKKOS_INLINE_FUNCTION void calcGradientPij(const member_type &teamMember, double *delta, double *thread_workspace, const int target_index, int neighbor_index, const double alpha, const int partial_direction, const int dimension, const int poly_order, bool specific_order_only, const scratch_matrix_right_type *V, const ReconstructionSpace reconstruction_space, const SamplingFunctional sampling_strategy, const int additional_evaluation_local_index=0) const
Evaluates the gradient of a polynomial basis under the Dirac Delta (pointwise) sampling function...
void CallFunctorWithTeamThreads(C functor, const global_index_type batch_size) const
Calls a parallel_for parallel_for will break out over loops over teams with each thread executing cod...
constexpr SamplingFunctional ManifoldVectorPointSample
Point evaluations of the entire vector source function (but on a manifold, so it includes a transform...
template void batchQRPivotingSolve< layout_right, layout_left, layout_right >(ParallelManager, double *, int, int, double *, int, int, int, int, int, const int)
bool _reference_outward_normal_direction_provided
whether or not the reference outward normal directions were provided by the user. ...
KOKKOS_INLINE_FUNCTION double getSite(const int index, const int component) const
team_policy::member_type member_type
KOKKOS_INLINE_FUNCTION int getAdditionalCoeffSizeFromConstraintAndSpace(DenseSolverType dense_solver_type, ConstraintType constraint_type, ReconstructionSpace reconstruction_space, const int dimension)
Neumann Gradient Scalar Type.
int _NP
dimension of basis for polynomial reconstruction
int _total_alpha_values
used for sizing P_target_row and the _alphas view
Kokkos::View< double * > _epsilons
h supports determined through neighbor search (device)
bool _orthonormal_tangent_space_provided
whether or not the orthonormal tangent directions were provided by the user.
KOKKOS_INLINE_FUNCTION void largestTwoEigenvectorsThreeByThreeSymmetric(const member_type &teamMember, scratch_matrix_right_type V, scratch_matrix_right_type PtP, const int dimensions, pool_type &random_number_pool)
Calculates two eigenvectors corresponding to two dominant eigenvalues.
bool _use_reference_outward_normal_direction_provided_to_orient_surface
whether or not to use reference outward normal directions to orient the surface in a manifold problem...
Kokkos::View< double * > _RHS
sqrt(w)*Identity matrix for all problems, later holds polynomial coefficients for all problems ...
Kokkos::View< double * > _w
contains weights for all problems
KOKKOS_INLINE_FUNCTION int getTeamScratchLevel(const int level) const
int _sampling_multiplier
actual dimension of the sampling functional e.g.
void CallFunctorWithTeamThreadsAndVectors(C functor, const global_index_type batch_size, const int threads_per_team=-1, const int vector_lanes_per_thread=-1) const
Calls a parallel_for parallel_for will break out over loops over teams with each vector lane executin...
int _curvature_poly_order
order of basis for curvature reconstruction
constexpr SamplingFunctional VaryingManifoldVectorPointSample
For integrating polynomial dotted with normal over an edge.
Kokkos::View< double **, layout_right > _target_coordinates
coordinates for target sites for reconstruction (device)
Each target applies a different data transform, but the same to each neighbor.
int _data_sampling_multiplier
effective dimension of the data sampling functional e.g.
Each target applies a different transform for each neighbor.
NeighborLists< Kokkos::View< int * > > _neighbor_lists
Accessor to get neighbor list data, offset data, and number of neighbors per target.
Quadrature _qm
manages and calculates quadrature
Kokkos::View< double * >::HostMirror _host_T
tangent vectors information (host)
KOKKOS_INLINE_FUNCTION double getTargetCoordinate(const int target_index, const int dim, const scratch_matrix_right_type *V=NULL) const
Returns one component of the target coordinate for a particular target.
std::vector< TargetOperation > _lro
vector of user requested target operations
constexpr SamplingFunctional StaggeredEdgeAnalyticGradientIntegralSample
Analytical integral of a gradient source vector is just a difference of the scalar source at neighbor...
KOKKOS_INLINE_FUNCTION int getThreadScratchLevel(const int level) const
Scalar polynomial basis centered at the target site and scaled by sum of basis powers e...
Solve GMLS problem on a manifold (will use QR or SVD to solve the resultant GMLS problem dependent on...
int _max_num_neighbors
maximum number of neighbors over all target sites
template void batchQRPivotingSolve< layout_right, layout_right, layout_right >(ParallelManager, double *, int, int, double *, int, int, int, int, int, const int)
const SamplingFunctional _data_sampling_functional
generally the same as _polynomial_sampling_functional, but can differ if specified at GMLS class inst...
Tag for functor to evaluate targets, apply target evaluation to polynomial coefficients to store in _...
KOKKOS_INLINE_FUNCTION int getNNeighbors(const int target_index) const
Returns number of neighbors for a particular target.
int calculateBasisMultiplier(const ReconstructionSpace rs) const
Calculate basis_multiplier.
DenseSolverType _dense_solver_type
solver type for GMLS problem - can be QR, SVD or LU
QR+Pivoting factorization performed on P*sqrt(w) matrix.
Tag for functor to create a coarse tangent approximation from a given neighborhood of points...
pool_type _random_number_pool
Kokkos::View< double * > _manifold_curvature_gradient
_dimension-1 gradient values for curvature for all problems
Kokkos::View< double *****, layout_right > _prestencil_weights
generated weights for nontraditional samples required to transform data into expected sampling functi...
#define TO_GLOBAL(variable)
int _initial_index_for_batch
initial index for current batch
KOKKOS_INLINE_FUNCTION int getTargetOffsetIndexDevice(const int lro_num, const int input_component, const int output_component, const int additional_evaluation_local_index=0) const
Handles offset from operation input/output + extra evaluation sites.
static KOKKOS_INLINE_FUNCTION int getNP(const int m, const int dimension=3, const ReconstructionSpace r_space=ReconstructionSpace::ScalarTaylorPolynomial)
Returns size of the basis for a given polynomial order and dimension General to dimension 1...
constexpr SamplingFunctional StaggeredEdgeIntegralSample
Samples consist of the result of integrals of a vector dotted with the tangent along edges between ne...
const SamplingFunctional _polynomial_sampling_functional
polynomial sampling functional used to construct P matrix, set at GMLS class instantiation ...
Tag for functor to assemble the P*sqrt(weights) matrix and construct sqrt(weights)*Identity.
Tag for functor to calculate prestencil weights to apply to data to transform into a format expected ...
KOKKOS_INLINE_FUNCTION void getPDims(DenseSolverType dense_solver_type, ConstraintType constraint_type, ReconstructionSpace reconstruction_space, const int dimension, const int M, const int N, int &out_row, int &out_col)
Kokkos::View< double **, layout_right, Kokkos::MemoryTraits< Kokkos::Unmanaged > > scratch_matrix_right_type
Kokkos::View< double *, Kokkos::MemoryTraits< Kokkos::Unmanaged > > scratch_vector_type
KOKKOS_INLINE_FUNCTION int getNumberOfQuadraturePoints() const
int getOutputDimensionOfSampling(SamplingFunctional sro) const
Dimensions ^ output rank for sampling operation (always in local chart if on a manifold, never ambient space)
Kokkos::View< double **, layout_right > _source_coordinates
all coordinates for the source for which _neighbor_lists refers (device)
void generateAlphas(const int number_of_batches=1, const bool keep_coefficients=false)
Meant to calculate target operations and apply the evaluations to the previously ! constructed polyno...
int _dimension_of_quadrature_points
dimension of quadrature rule
ParallelManager _pm
determines scratch level spaces and is used to call kernels
KOKKOS_INLINE_FUNCTION XYZ getRelativeCoord(const int target_index, const int neighbor_list_num, const int dimension, const scratch_matrix_right_type *V=NULL) const
Returns the relative coordinate as a vector between the target site and the neighbor site...
int _added_alpha_size
additional alpha coefficients due to constraints
ProblemType _problem_type
problem type for GMLS problem, can also be set to STANDARD for normal or MANIFOLD for manifold proble...
int _basis_multiplier
dimension of the reconstructed function e.g.
int _global_dimensions
spatial dimension of the points, set at class instantiation only
Kokkos::View< double * > _T
Rank 3 tensor for high order approximation of tangent vectors for all problems.
KOKKOS_INLINE_FUNCTION void computeTargetFunctionals(const member_type &teamMember, scratch_vector_type t1, scratch_vector_type t2, scratch_matrix_right_type P_target_row) const
Evaluates a polynomial basis with a target functional applied to each member of the basis...
global_index_type getTotalNeighborsOverAllListsHost() const
Get the sum of the number of neighbors of all targets' neighborhoods (host)
void setTeamScratchSize(const int level, const int value)
LU factorization performed on P^T*W*P matrix.
bool _store_PTWP_inv_PTW
whether polynomial coefficients were requested to be stored (in a state not yet applied to data) ...
void setThreadScratchSize(const int level, const int value)
ReconstructionSpace _reconstruction_space
reconstruction space for GMLS problems, set at GMLS class instantiation
Kokkos::View< const double *, layout_right >::HostMirror _host_alphas
generated alpha coefficients (host)
Kokkos::View< double * > _P
P*sqrt(w) matrix for all problems.
Tag for functor to evaluate targets, apply target evaluation to polynomial coefficients to store in _...
Tag for functor to assemble the P*sqrt(weights) matrix and construct sqrt(weights)*Identity.
KOKKOS_INLINE_FUNCTION void getRHSDims(DenseSolverType dense_solver_type, ConstraintType constraint_type, ReconstructionSpace reconstruction_space, const int dimension, const int M, const int N, int &RHS_row, int &RHS_col)
constexpr SamplingFunctional PointSample
Available sampling functionals.
int _dimensions
dimension of the problem, set at class instantiation only
std::string _quadrature_type
quadrature rule type
Kokkos::View< TargetOperation * >::HostMirror _host_operations
vector containing target functionals to be applied for reconstruction problem (host) ...
bool _nontrivial_nullspace
whether or not operator to be inverted for GMLS problem has a nontrivial nullspace (requiring SVD) ...
KOKKOS_INLINE_FUNCTION void applyTargetsToCoefficients(const member_type &teamMember, scratch_vector_type t1, scratch_vector_type t2, scratch_matrix_right_type Q, scratch_vector_type w, scratch_matrix_right_type P_target_row, const int target_NP) const
Helper function for applying the evaluations from a target functional to the polynomial coefficients...
Tag for functor to assemble the P*sqrt(weights) matrix and construct sqrt(weights)*Identity for curva...
bool nontrivial_nullspace
Whether the SamplingFunctional + ReconstructionSpace results in a nontrivial nullspace.
#define compadre_assert_debug(condition)
compadre_assert_debug is used for assertions that are checked in loops, as these significantly impact...
KOKKOS_INLINE_FUNCTION void operator()(const AssembleStandardPsqrtW &, const member_type &teamMember) const
Functor to assemble the P*sqrt(weights) matrix and construct sqrt(weights)*Identity.
int calculateSamplingMultiplier(const ReconstructionSpace rs, const SamplingFunctional sro) const
Calculate sampling_multiplier.
ConstraintType _constraint_type
constraint type for GMLS problem
KOKKOS_INLINE_FUNCTION void computeCurvatureFunctionals(const member_type &teamMember, scratch_vector_type t1, scratch_vector_type t2, scratch_matrix_right_type P_target_row, const scratch_matrix_right_type *V, const local_index_type local_neighbor_index=-1) const
Evaluates a polynomial basis for the curvature with a gradient target functional applied.
int _local_dimensions
dimension of the problem, set at class instantiation only. For manifolds, generally _global_dimension...
int _order_of_quadrature_points
order of exact polynomial integration for quadrature rule
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)
#define compadre_assert_release(condition)
compadre_assert_release is used for assertions that should always be checked, but generally are not e...
Tag for functor to determine if tangent directions need reordered, and to reorder them if needed...
Tag for functor to evaluate curvature targets and construct accurate tangent direction approximation ...
KOKKOS_INLINE_FUNCTION void computeTargetFunctionalsOnManifold(const member_type &teamMember, scratch_vector_type t1, scratch_vector_type t2, scratch_matrix_right_type P_target_row, scratch_matrix_right_type V, scratch_matrix_right_type G_inv, scratch_vector_type curvature_coefficients, scratch_vector_type curvature_gradients) const
Evaluates a polynomial basis with a target functional applied, using information from the manifold cu...
KOKKOS_INLINE_FUNCTION double getWeight(const int index) const
int _poly_order
order of basis for polynomial reconstruction
KOKKOS_INLINE_FUNCTION int getNumberOfTargets() const
Get number of total targets having neighborhoods (host/device).
#define compadre_kernel_assert_debug(condition)
KOKKOS_INLINE_FUNCTION void createWeightsAndPForCurvature(const member_type &teamMember, scratch_vector_type delta, scratch_vector_type thread_workspace, scratch_matrix_right_type P, scratch_vector_type w, const int dimension, bool only_specific_order, scratch_matrix_right_type *V=NULL) const
Fills the _P matrix with P*sqrt(w) for use in solving for curvature.