14 &&
"keep_coefficients is set to true, but number of batches exceeds 1.");
31 &&
"No target operations added to GMLS class before calling generatePolynomialCoefficients().");
41 &&
"Neighbor lists not set in GMLS class before calling generatePolynomialCoefficients.");
45 &&
"Source coordinates not set in GMLS class before calling generatePolynomialCoefficients.");
56 &&
"Cannot solve GMLS problems with the NEUMANN_GRAD_SCALAR constraint using QR Factorization.");
68 }
catch(std::exception &e) {
69 printf(
"Insufficient memory to store alphas: \n\n%s", e.what());
78 std::pow(2,sro.use_target_site_weights),
88 }
catch(std::exception &e) {
89 printf(
"Insufficient memory to store prestencil weights: \n\n%s", e.what());
129 int team_scratch_size_a = 0;
132 int team_scratch_size_b = 0;
133 int thread_scratch_size_a = 0;
134 int thread_scratch_size_b = 0;
145 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP : _NP;
156 team_scratch_size_b += scratch_vector_type::shmem_size( (
_dimensions-1)*_max_num_neighbors );
158 team_scratch_size_b += scratch_vector_type::shmem_size(_max_num_neighbors*std::max(
_sampling_multiplier,_basis_multiplier));
159 team_scratch_size_b += scratch_vector_type::shmem_size(_max_num_neighbors*std::max(
_sampling_multiplier,_basis_multiplier));
161 team_scratch_size_b += scratch_vector_type::shmem_size(max_P_row_size);
162 thread_scratch_size_b += scratch_vector_type::shmem_size(max_manifold_NP*_basis_multiplier);
163 thread_scratch_size_b += scratch_vector_type::shmem_size((max_poly_order+1)*
_global_dimensions);
181 team_scratch_size_a += scratch_vector_type::shmem_size(max_num_rows);
182 team_scratch_size_a += scratch_vector_type::shmem_size(max_num_rows);
188 thread_scratch_size_b += scratch_vector_type::shmem_size(this_num_cols);
191 #ifdef COMPADRE_USE_CUDA
204 int P_dim_0, P_dim_1;
215 _w = Kokkos::View<double*>(
"w", max_batch_size*
TO_GLOBAL(max_num_rows));
216 }
catch (std::exception &e) {
217 printf(
"Failed to allocate space for RHS, P, and w. Consider increasing number_of_batches: \n\n%s", e.what());
228 &&
"Normal vectors are required for solving GMLS problems with the NEUMANN_GRAD_SCALAR constraint.");
233 for (
int batch_num=0; batch_num<number_of_batches; ++batch_num) {
236 Kokkos::deep_copy(
_RHS, 0.0);
237 Kokkos::deep_copy(
_P, 0.0);
238 Kokkos::deep_copy(
_w, 0.0);
263 Kokkos::Profiling::pushRegion(
"Curvature LU Factorization");
264 GMLS_LinearAlgebra::batchLUFactorize(
_pm,
_RHS.data(), RHS_square_dim, RHS_square_dim,
_P.data(), P_dim_1, P_dim_0, manifold_NP, manifold_NP,
_max_num_neighbors, this_batch_size,
_max_num_neighbors,
_initial_index_for_batch,
_host_number_of_neighbors_list.data());
265 Kokkos::Profiling::popRegion();
268 Kokkos::Profiling::pushRegion(
"Curvature QR Factorization");
269 GMLS_LinearAlgebra::batchQRFactorize(
_pm,
_P.data(), P_dim_0, P_dim_1,
_RHS.data(), RHS_square_dim, RHS_square_dim,
_max_num_neighbors, manifold_NP,
_max_num_neighbors, this_batch_size,
_max_num_neighbors,
_initial_index_for_batch,
_host_number_of_neighbors_list.data());
270 Kokkos::Profiling::popRegion();
277 Kokkos::deep_copy(
_P, 0.0);
279 if (batch_num==number_of_batches-1) {
281 _host_T = Kokkos::create_mirror_view(
_T);
292 Kokkos::Profiling::pushRegion(
"Curvature LU Factorization");
293 GMLS_LinearAlgebra::batchLUFactorize(
_pm,
_RHS.data(), RHS_square_dim, RHS_square_dim,
_P.data(), P_dim_1, P_dim_0, manifold_NP, manifold_NP,
_max_num_neighbors, this_batch_size,
_max_num_neighbors,
_initial_index_for_batch,
_host_number_of_neighbors_list.data());
294 Kokkos::Profiling::popRegion();
297 Kokkos::Profiling::pushRegion(
"Curvature QR Factorization");
298 GMLS_LinearAlgebra::batchQRFactorize(
_pm,
_P.data(), P_dim_0, P_dim_1,
_RHS.data(), RHS_square_dim, RHS_square_dim,
_max_num_neighbors, manifold_NP,
_max_num_neighbors, this_batch_size,
_max_num_neighbors,
_initial_index_for_batch,
_host_number_of_neighbors_list.data());
299 Kokkos::Profiling::popRegion();
313 Kokkos::deep_copy(
_P, 0.0);
321 Kokkos::Profiling::pushRegion(
"Manifold SVD Factorization");
322 GMLS_LinearAlgebra::batchSVDFactorize(
_pm,
true,
_P.data(), P_dim_0, P_dim_1,
true,
_RHS.data(), RHS_square_dim, RHS_square_dim, max_num_rows, this_num_cols, max_num_rows, this_batch_size,
_max_num_neighbors,
_initial_index_for_batch,
_host_number_of_neighbors_list.data());
323 Kokkos::Profiling::popRegion();
325 Kokkos::Profiling::pushRegion(
"Manifold LU Factorization");
326 GMLS_LinearAlgebra::batchLUFactorize(
_pm,
_RHS.data(), RHS_square_dim, RHS_square_dim,
_P.data(), P_dim_1, P_dim_0, this_num_cols, this_num_cols, max_num_rows, this_batch_size,
_max_num_neighbors,
_initial_index_for_batch,
_host_number_of_neighbors_list.data());
327 Kokkos::Profiling::popRegion();
329 Kokkos::Profiling::pushRegion(
"Manifold QR Factorization");
330 GMLS_LinearAlgebra::batchQRFactorize(
_pm,
_P.data(), P_dim_0, P_dim_1,
_RHS.data(), RHS_square_dim, RHS_square_dim, max_num_rows, this_num_cols, max_num_rows, this_batch_size,
_max_num_neighbors,
_initial_index_for_batch,
_host_number_of_neighbors_list.data());
331 Kokkos::Profiling::popRegion();
350 Kokkos::Profiling::pushRegion(
"SVD Factorization");
351 GMLS_LinearAlgebra::batchSVDFactorize(
_pm,
false,
_RHS.data(), RHS_square_dim, RHS_square_dim,
true,
_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, 0,
_initial_index_for_batch, NULL);
352 Kokkos::Profiling::popRegion();
354 Kokkos::Profiling::pushRegion(
"LU Factorization");
355 GMLS_LinearAlgebra::batchLUFactorize(
_pm,
_RHS.data(), RHS_square_dim, RHS_square_dim,
_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,
_max_num_neighbors,
_initial_index_for_batch,
_host_number_of_neighbors_list.data());
356 Kokkos::Profiling::popRegion();
361 Kokkos::Profiling::pushRegion(
"SVD Factorization");
362 GMLS_LinearAlgebra::batchSVDFactorize(
_pm,
true,
_P.data(), P_dim_0, P_dim_1,
true,
_RHS.data(), RHS_square_dim, RHS_square_dim, max_num_rows, this_num_cols, max_num_rows, this_batch_size,
_max_num_neighbors,
_initial_index_for_batch,
_host_number_of_neighbors_list.data());
363 Kokkos::Profiling::popRegion();
365 Kokkos::Profiling::pushRegion(
"LU Factorization");
366 GMLS_LinearAlgebra::batchLUFactorize(
_pm,
_RHS.data(), RHS_square_dim, RHS_square_dim,
_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,
_max_num_neighbors,
_initial_index_for_batch,
_host_number_of_neighbors_list.data());
367 Kokkos::Profiling::popRegion();
369 Kokkos::Profiling::pushRegion(
"QR Factorization");
370 GMLS_LinearAlgebra::batchQRFactorize(
_pm,
_P.data(), P_dim_0, P_dim_1,
_RHS.data(), RHS_square_dim, RHS_square_dim, max_num_rows, this_num_cols, max_num_rows, this_batch_size,
_max_num_neighbors,
_initial_index_for_batch,
_host_number_of_neighbors_list.data());
371 Kokkos::Profiling::popRegion();
409 _w = Kokkos::View<double*>(
"w",0);
410 if (number_of_batches > 1) {
411 _RHS = Kokkos::View<double*>(
"RHS",0);
412 _P = Kokkos::View<double*>(
"P",0);
416 _RHS = Kokkos::View<double*>(
"RHS", 0);
417 if (!keep_coefficients)
_P = Kokkos::View<double*>(
"P", 0);
420 _P = Kokkos::View<double*>(
"P", 0);
421 if (!keep_coefficients)
_RHS = Kokkos::View<double*>(
"RHS", 0);
423 _RHS = Kokkos::View<double*>(
"RHS", 0);
424 if (!keep_coefficients)
_P = Kokkos::View<double*>(
"P", 0);
453 KOKKOS_INLINE_FUNCTION
461 const int local_index = teamMember.league_rank();
468 int P_dim_0, P_dim_1;
491 this->
createWeightsAndP(teamMember, delta, thread_workspace, PsqrtW, w,
_dimensions,
_poly_order,
true , NULL ,
_reconstruction_space,
_polynomial_sampling_functional);
496 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember,this_num_rows), [=] (
const int i) {
497 for(
int j = 0; j < this_num_rows; ++j) {
498 RHS(j,i) = (i==j) ? std::sqrt(w(i)) : 0;
509 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember, max_num_rows), [=] (
const int i) {
510 for (
int j=0; j < this_num_cols; j++) {
511 PsqrtW(i, j) = PsqrtW(i, j)*std::sqrt(w(i));
514 teamMember.team_barrier();
524 double cutoff_p =
_epsilons(target_index);
532 KOKKOS_INLINE_FUNCTION
539 const int local_index = teamMember.league_rank();
545 int P_dim_0, P_dim_1;
578 teamMember.team_barrier();
581 teamMember.team_barrier();
585 KOKKOS_INLINE_FUNCTION
593 const int local_index = teamMember.league_rank();
597 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
601 int P_dim_0, P_dim_1;
635 teamMember.team_barrier();
639 KOKKOS_INLINE_FUNCTION
647 const int local_index = teamMember.league_rank();
651 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
652 const int this_num_neighbors = this->
getNNeighbors(target_index);
657 int P_dim_0, P_dim_1;
684 teamMember.team_barrier();
691 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember,this_num_neighbors), [=] (
const int i) {
692 for(
int j = 0; j < this_num_neighbors; ++j) {
693 RHS(i, j) = (i==j) ? std::sqrt(w(i)) : 0;
705 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember, this_num_neighbors), [=] (
const int i) {
706 for (
int j=0; j < manifold_NP; j++) {
707 CurvaturePsqrtW(i, j) = CurvaturePsqrtW(i, j)*std::sqrt(w(i));
711 teamMember.team_barrier();
714 KOKKOS_INLINE_FUNCTION
722 const int local_index = teamMember.league_rank();
726 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
731 int P_dim_0, P_dim_1;
768 teamMember.team_barrier();
770 double grad_xi1 = 0, grad_xi2 = 0;
775 Kokkos::parallel_reduce(Kokkos::TeamThreadRange(teamMember,
776 manifold_NP), [=] (
const int l,
double &talpha_ij) {
777 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
778 talpha_ij += P_target_row(offset,l)*Q(l,i);
781 teamMember.team_barrier();
782 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
783 manifold_gradient(i*(_dimensions-1) + k) = alpha_ij;
786 teamMember.team_barrier();
789 double normal_coordinate = rel_coord[_dimensions-1];
792 grad_xi1 += manifold_gradient(i*(_dimensions-1)) * normal_coordinate;
793 if (_dimensions>2) grad_xi2 += manifold_gradient(i*(_dimensions-1)+1) * normal_coordinate;
794 teamMember.team_barrier();
798 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
800 double grad_xi[2] = {grad_xi1, grad_xi2};
810 T(i,j) = grad_xi[i]*T(_dimensions-1,j);
818 norm += T(0,j)*T(0,j);
822 norm = std::sqrt(norm);
828 if (_dimensions-1 == 2) {
829 double dot_product = T(0,0)*T(1,0) + T(0,1)*T(1,1) + T(0,2)*T(1,2);
831 T(1,j) -= dot_product*T(0,j);
836 norm += T(1,j)*T(1,j);
838 norm = std::sqrt(norm);
845 double norm_t_normal = 0;
847 T(_dimensions-1,0) = T(0,1)*T(1,2) - T(1,1)*T(0,2);
848 norm_t_normal += T(_dimensions-1,0)*T(_dimensions-1,0);
849 T(_dimensions-1,1) = -(T(0,0)*T(1,2) - T(1,0)*T(0,2));
850 norm_t_normal += T(_dimensions-1,1)*T(_dimensions-1,1);
851 T(_dimensions-1,2) = T(0,0)*T(1,1) - T(1,0)*T(0,1);
852 norm_t_normal += T(_dimensions-1,2)*T(_dimensions-1,2);
854 T(_dimensions-1,0) = T(1,1) - T(0,1);
855 norm_t_normal += T(_dimensions-1,0)*T(_dimensions-1,0);
856 T(_dimensions-1,1) = T(0,0) - T(1,0);
857 norm_t_normal += T(_dimensions-1,1)*T(_dimensions-1,1);
859 norm_t_normal = std::sqrt(norm_t_normal);
860 for (
int i=0; i<_dimensions-1; ++i) {
861 T(_dimensions-1,i) /= norm_t_normal;
864 teamMember.team_barrier();
867 KOKKOS_INLINE_FUNCTION
886 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
888 double dot_product = 0;
890 dot_product += T(_dimensions-1,i) * N(i);
893 if (dot_product < 0) {
894 if (_dimensions==3) {
904 T(_dimensions-1,i) *= -1;
909 teamMember.team_barrier();
912 KOKKOS_INLINE_FUNCTION
920 const int local_index = teamMember.league_rank();
924 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
929 int P_dim_0, P_dim_1;
972 teamMember.team_barrier();
974 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
975 for (
int j=0; j<manifold_NP; ++j) {
976 manifold_coeffs(j) = 0;
979 teamMember.team_barrier();
981 double grad_xi1 = 0, grad_xi2 = 0;
986 Kokkos::parallel_reduce(Kokkos::TeamThreadRange(teamMember,
987 manifold_NP), [=] (
const int l,
double &talpha_ij) {
988 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
989 talpha_ij += P_target_row(offset,l)*Q(l,i);
992 teamMember.team_barrier();
993 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
994 manifold_gradient(i*(_dimensions-1) + k) = alpha_ij;
997 teamMember.team_barrier();
1000 double normal_coordinate = rel_coord[_dimensions-1];
1003 grad_xi1 += manifold_gradient(i*(_dimensions-1)) * normal_coordinate;
1004 if (_dimensions>2) grad_xi2 += manifold_gradient(i*(_dimensions-1)+1) * normal_coordinate;
1006 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
1007 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
1009 for (
int j=0; j<manifold_NP; ++j) {
1010 manifold_coeffs(j) += Q(j,i) * normal_coordinate;
1014 teamMember.team_barrier();
1018 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
1020 manifold_gradient_coeffs(0) = grad_xi1;
1021 if (
_dimensions>2) manifold_gradient_coeffs(1) = grad_xi2;
1024 G(0,0) = 1 + grad_xi1*grad_xi1;
1027 G(0,1) = grad_xi1*grad_xi2;
1028 G(1,0) = grad_xi2*grad_xi1;
1029 G(1,1) = 1 + grad_xi2*grad_xi2;
1032 double G_determinant;
1034 G_determinant = G(0,0);
1036 G_inv(0,0) = 1/G_determinant;
1038 G_determinant = G(0,0)*G(1,1) - G(0,1)*G(1,0);
1042 G_inv(0,0) = G(1,1)/G_determinant;
1043 G_inv(1,1) = G(0,0)/G_determinant;
1044 G_inv(0,1) = -G(0,1)/G_determinant;
1045 G_inv(1,0) = -G(1,0)/G_determinant;
1050 teamMember.team_barrier();
1056 KOKKOS_INLINE_FUNCTION
1064 const int local_index = teamMember.league_rank();
1068 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
1074 int P_dim_0, P_dim_1;
1099 this->
createWeightsAndP(teamMember, delta, thread_workspace, PsqrtW, w,
_dimensions-1,
_poly_order,
true , &T,
_reconstruction_space,
_polynomial_sampling_functional);
1100 teamMember.team_barrier();
1104 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember,this_num_rows), [=] (
const int i) {
1105 for(
int j = 0; j < this_num_rows; ++j) {
1106 Q(i, j) = (i==j) ? std::sqrt(w(i)) : 0;
1118 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember, max_num_rows), [=] (
const int i) {
1119 for (
int j=0; j < this_num_cols; j++) {
1120 PsqrtW(i, j) = PsqrtW(i, j)*std::sqrt(w(i));
1124 teamMember.team_barrier();
1127 KOKKOS_INLINE_FUNCTION
1135 const int local_index = teamMember.league_rank();
1139 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
1144 int P_dim_0, P_dim_1;
1182 teamMember.team_barrier();
1186 teamMember.team_barrier();
1190 KOKKOS_INLINE_FUNCTION
1198 const int local_index = teamMember.league_rank();
1202 const int max_manifold_NP = (manifold_NP >
_NP) ? manifold_NP :
_NP;
1207 int P_dim_0, P_dim_1;
1241 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
1242 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
1248 Kokkos::single(Kokkos::PerTeam(teamMember), [&] () {
1249 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
1251 for (
int k=0; k<_dimensions-1; ++k) {
1259 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember,this->
getNNeighbors(target_index)), [=] (
const int m) {
1260 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
1262 XYZ tangent_quadrature_coord_2d;
1267 double tangent_vector[3];
1268 tangent_vector[0] = tangent_quadrature_coord_2d[0]*T(0,0) + tangent_quadrature_coord_2d[1]*T(1,0);
1269 tangent_vector[1] = tangent_quadrature_coord_2d[0]*T(0,1) + tangent_quadrature_coord_2d[1]*T(1,1);
1270 tangent_vector[2] = tangent_quadrature_coord_2d[0]*T(0,2) + tangent_quadrature_coord_2d[1]*T(1,2);
1284 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember,this->
getNNeighbors(target_index)), [&] (
const int m) {
1286 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
1287 this->
calcGradientPij(teamMember, delta.data(), thread_workspace.data(), target_index, m, 0 , 0 ,
_dimensions-1,
_curvature_poly_order,
false , &T,
ReconstructionSpace::ScalarTaylorPolynomial,
PointSample);
1290 double grad_xi1 = 0, grad_xi2 = 0;
1291 Kokkos::parallel_reduce(Kokkos::ThreadVectorRange(teamMember,this->
getNNeighbors(target_index)), [=] (
const int i,
double &t_grad_xi1) {
1292 double alpha_ij = 0;
1293 for (
int l=0; l<manifold_NP; ++l) {
1294 alpha_ij += delta(l)*Q(l,i);
1297 double normal_coordinate = rel_coord[
_dimensions-1];
1300 t_grad_xi1 += alpha_ij * normal_coordinate;
1304 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
1305 this->
calcGradientPij(teamMember, delta.data(), thread_workspace.data(), target_index, m, 0 , 1 ,
_dimensions-1,
_curvature_poly_order,
false , &T,
ReconstructionSpace::ScalarTaylorPolynomial,
PointSample);
1307 Kokkos::parallel_reduce(Kokkos::ThreadVectorRange(teamMember,this->
getNNeighbors(target_index)), [=] (
const int i,
double &t_grad_xi2) {
1308 double alpha_ij = 0;
1309 for (
int l=0; l<manifold_NP; ++l) {
1310 alpha_ij += delta(l)*Q(l,i);
1313 double normal_coordinate = rel_coord[
_dimensions-1];
1316 if (
_dimensions>2) t_grad_xi2 += alpha_ij * normal_coordinate;
1321 teamMember.team_barrier();
1325 Kokkos::parallel_for(Kokkos::TeamThreadRange(teamMember,this->
getNNeighbors(target_index)), [=] (
const int m) {
1327 Kokkos::single(Kokkos::PerThread(teamMember), [&] () {
1329 tangent(0,j) = t1(m)*T(_dimensions-1,j) + T(0,j);
1330 tangent(1,j) = t2(m)*T(_dimensions-1,j) + T(1,j);
1336 norm += tangent(0,j)*tangent(0,j);
1340 norm = std::sqrt(norm);
1342 tangent(0,j) /= norm;
1346 if (_dimensions-1 == 2) {
1347 double dot_product = tangent(0,0)*tangent(1,0) + tangent(0,1)*tangent(1,1) + tangent(0,2)*tangent(1,2);
1349 tangent(1,j) -= dot_product*tangent(0,j);
1354 norm += tangent(1,j)*tangent(1,j);
1356 norm = std::sqrt(norm);
1358 tangent(1,j) /= norm;
1364 for (
int k=0; k<_dimensions-1; ++k) {
1371 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)
int calculateBasisMultiplier(const ReconstructionSpace rs) const
Calculate basis_multiplier.
KOKKOS_INLINE_FUNCTION int getVectorLanesPerThread() const
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) ...
KOKKOS_INLINE_FUNCTION int getTeamScratchLevel(const int level) const
bool _entire_batch_computed_at_once
whether entire calculation was computed at once the alternative is that it was broken up over many sm...
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
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.
constexpr SamplingFunctional ManifoldVectorPointSample
Point evaluations of the entire vector source function (but on a manifold, so it includes a transform...
bool _reference_outward_normal_direction_provided
whether or not the reference outward normal directions were provided by the user. ...
int getOutputDimensionOfSampling(SamplingFunctional sro) const
Dimensions ^ output rank for sampling operation (always in local chart if on a manifold, never ambient space)
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
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)
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 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.
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.
Kokkos::View< int *, host_memory_space > _host_number_of_neighbors_list
convenient copy on host of number of neighbors
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_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...
Kokkos::View< double * > _w
contains weights for all problems
int _sampling_multiplier
actual dimension of the sampling functional e.g.
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 getWeight(const int index) const
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...
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...
KOKKOS_INLINE_FUNCTION double getSite(const int index, const int component) const
int _max_num_neighbors
maximum number of neighbors over all target sites
KOKKOS_INLINE_FUNCTION int getThreadsPerTeam(const int vector_lanes_per_thread=1) const
void batchLUFactorize(ParallelManager pm, double *P, int lda, int nda, double *RHS, int ldb, int ndb, int M, int N, int NRHS, const int num_matrices, const size_t max_neighbors, const int initial_index_of_batch, int *neighbor_list_sizes)
Calls LAPACK or CUBLAS to solve a batch of LU problems.
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 _...
DenseSolverType _dense_solver_type
solver type for GMLS problem - can be QR, SVD or LU
QR 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)
KOKKOS_INLINE_FUNCTION int getNumberOfTargets() const
Get number of total targets having neighborhoods (host/device).
int _initial_index_for_batch
initial index for current batch
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...
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.
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.
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...
constexpr SamplingFunctional StaggeredEdgeIntegralSample
Samples consist of the result of integrals of a vector dotted with the tangent along edges between ne...
SVD factorization performed on P*sqrt(w) matrix.
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::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
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...
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.
ParallelManager _pm
determines scratch level spaces and is used to call kernels
void CallFunctorWithTeamThreads(const global_index_type batch_size, C functor) const
Calls a parallel_for parallel_for will break out over loops over teams with each thread executing cod...
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 _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.
void CallFunctorWithTeamThreadsAndVectors(const global_index_type batch_size, const int threads_per_team, const int vector_lanes_per_thread, C functor) const
Calls a parallel_for parallel_for will break out over loops over teams with each vector lane executin...
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.
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)
void batchSVDFactorize(ParallelManager pm, bool swap_layout_P, double *P, int lda, int nda, bool swap_layout_RHS, double *RHS, int ldb, int ndb, int M, int N, int NRHS, const int num_matrices, const size_t max_neighbors, const int initial_index_of_batch, int *neighbor_list_sizes)
Calls LAPACK or CUBLAS to solve a batch of SVD problems.
KOKKOS_INLINE_FUNCTION int getNumberOfQuadraturePoints() const
void batchQRFactorize(ParallelManager pm, double *P, int lda, int nda, double *RHS, int ldb, int ndb, int M, int N, int NRHS, const int num_matrices, const size_t max_neighbors, const int initial_index_of_batch, int *neighbor_list_sizes)
Calls LAPACK or CUBLAS to solve a batch of QR problems.
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.
constexpr SamplingFunctional PointSample
Available sampling functionals.
int _dimensions
dimension of the problem, set at class instantiation only
int calculateSamplingMultiplier(const ReconstructionSpace rs, const SamplingFunctional sro) const
Calculate sampling_multiplier.
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) ...
struct SubviewND< T, T2, enable_if_t<(T::rank< 2)> >{T _data_in;T2 _data_original_view;bool _scalar_as_vector_if_needed;SubviewND(T data_in, T2 data_original_view, bool scalar_as_vector_if_needed){_data_in=data_in;_data_original_view=data_original_view;_scalar_as_vector_if_needed=scalar_as_vector_if_needed;}auto get1DView(const int column_num) -> decltype(Kokkos::subview(_data_in, Kokkos::ALL))
Creates 1D subviews of data from a 1D view, generally constructed with CreateNDSliceOnDeviceView.
global_index_type getTotalNeighborsOverAllListsHost() const
Get the sum of the number of neighbors of all targets' neighborhoods (host)
Tag for functor to assemble the P*sqrt(weights) matrix and construct sqrt(weights)*Identity for curva...
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.
bool nontrivial_nullspace
Whether the SamplingFunctional + ReconstructionSpace results in a nontrivial nullspace requiring SVD...
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...
KOKKOS_INLINE_FUNCTION void createM(const member_type &teamMember, scratch_matrix_right_type M_data, scratch_matrix_right_type weighted_P, const int columns, const int rows)
Creates a matrix M=A^T*A from a matrix A.
ConstraintType _constraint_type
constraint type for GMLS problem
void setThreadsPerTeam(const int value)
int _local_dimensions
dimension of the problem, set at class instantiation only. For manifolds, generally _global_dimension...
KOKKOS_INLINE_FUNCTION int getRHSSquareDim(DenseSolverType dense_solver_type, ConstraintType constraint_type, ReconstructionSpace reconstruction_space, const int dimension, const int M, const int N)
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 int getNNeighbors(const int target_index) const
Returns number of neighbors for a particular target.
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...
int _poly_order
order of basis for polynomial reconstruction
#define compadre_kernel_assert_debug(condition)
KOKKOS_INLINE_FUNCTION int getThreadScratchLevel(const int level) const