9 #ifndef _COMPADRE_GMLS_HPP_
10 #define _COMPADRE_GMLS_HPP_
12 #include "Compadre_Config.h"
31 struct GMLSSolutionData;
47 Kokkos::View<double**, layout_right>,
61 Kokkos::View<double*>
_w;
64 Kokkos::View<double*>
_P;
67 Kokkos::View<double*>
_RHS;
70 Kokkos::View<double*>
_Z;
75 Kokkos::View<double*>
_T;
82 Kokkos::View<double*>::HostMirror
_host_T;
256 template <
typename view_type>
259 auto additional_evaluation_coordinates =
coordinates_type(
"device additional evaluation coordinates",
260 evaluation_coordinates.extent(0), evaluation_coordinates.extent(1));
262 typedef typename view_type::memory_space input_array_memory_space;
263 if (std::is_same<input_array_memory_space, device_memory_space>::value) {
268 Kokkos::deep_copy(additional_evaluation_coordinates, evaluation_coordinates);
273 auto host_additional_evaluation_coordinates = Kokkos::create_mirror_view(additional_evaluation_coordinates);
274 Kokkos::deep_copy(host_additional_evaluation_coordinates, evaluation_coordinates);
276 Kokkos::deep_copy(additional_evaluation_coordinates, host_additional_evaluation_coordinates);
286 template <
typename view_type>
294 template <
typename view_type>
295 typename std::enable_if<view_type::rank==1&&std::is_same<neighbor_lists_type::internal_view_type,view_type>::value==1,
void>::type
306 template <
typename view_type>
307 typename std::enable_if<view_type::rank==1&&std::is_same<neighbor_lists_type::internal_view_type,view_type>::value==0,
void>::type
311 gmls_view_type d_additional_evaluation_indices(
"compressed row additional evaluation indices lists data", additional_evaluation_indices.extent(0));
312 gmls_view_type d_number_of_neighbors_list(
"number of additional evaluation indices", number_of_neighbors_list.extent(0));
313 Kokkos::deep_copy(d_additional_evaluation_indices, additional_evaluation_indices);
314 Kokkos::deep_copy(d_number_of_neighbors_list, number_of_neighbors_list);
325 template <
typename view_type>
344 std::string solver_type_to_lower = dense_solver_type;
345 transform(solver_type_to_lower.begin(), solver_type_to_lower.end(), solver_type_to_lower.begin(), ::tolower);
346 if (solver_type_to_lower ==
"lu") {
355 std::string problem_type_to_lower = problem_type;
356 transform(problem_type_to_lower.begin(), problem_type_to_lower.end(), problem_type_to_lower.begin(), ::tolower);
357 if (problem_type_to_lower ==
"standard") {
359 }
else if (problem_type_to_lower ==
"manifold") {
368 std::string constraint_type_to_lower = constraint_type;
369 transform(constraint_type_to_lower.begin(), constraint_type_to_lower.end(), constraint_type_to_lower.begin(), ::tolower);
370 if (constraint_type_to_lower ==
"none") {
372 }
else if (constraint_type_to_lower ==
"neumann_grad_scalar") {
392 const int poly_order,
393 const int dimensions,
397 const int manifold_curvature_poly_order) :
419 (
"operations needed for manifold gradient reconstruction", 1);
420 auto curvature_support_operations_mirror =
422 curvature_support_operations_mirror(0) =
471 const int poly_order,
472 const int dimensions = 3,
473 const std::string dense_solver_type = std::string(
"QR"),
474 const std::string problem_type = std::string(
"STANDARD"),
475 const std::string constraint_type = std::string(
"NO_CONSTRAINT"),
476 const int manifold_curvature_poly_order = 2)
482 const int dimensions = 3,
483 const std::string dense_solver_type = std::string(
"QR"),
484 const std::string problem_type = std::string(
"STANDARD"),
485 const std::string constraint_type = std::string(
"NO_CONSTRAINT"),
486 const int manifold_curvature_poly_order = 2)
493 const int poly_order,
494 const int dimensions = 3,
495 const std::string dense_solver_type = std::string(
"QR"),
496 const std::string problem_type = std::string(
"STANDARD"),
497 const std::string constraint_type = std::string(
"NO_CONSTRAINT"),
498 const int manifold_curvature_poly_order = 2)
499 :
GMLS(reconstruction_space, dual_sampling_strategy, dual_sampling_strategy, poly_order, dimensions, dense_solver_type, problem_type, constraint_type, manifold_curvature_poly_order) {}
511 KOKKOS_INLINE_FUNCTION
523 KOKKOS_INLINE_FUNCTION
526 const int np =
getNP(m, dimension, r_space);
530 nn = np * (1.7 + m*0.1);
533 nn = np * (1.4 + m*0.03);
548 KOKKOS_INLINE_FUNCTION
559 double abs_r_over_h_to_n = std::abs(r/h);
560 if (n>1) abs_r_over_h_to_n = std::pow(abs_r_over_h_to_n, n);
561 return std::pow(1.0-abs_r_over_h_to_n, p) * double(1.0-abs_r_over_h_to_n>0.0);
565 double x = std::abs(r/h);
566 return ((1-x)+x*(1-x)*(1-2*x)) * double(x<=1.0);
571 double x = std::abs(r/h);
572 if (x < 0.5)
return 1.0 + 6.0 * x * x * (-1.0 + x);
573 if (x < 1.0)
return 2.0 * (1.0 + x * (-3.0 + 3.0 * x - 1.0 * x * x));
577 double pi = 3.14159265358979323846;
578 double abs_r_over_h_to_n = std::abs(r/h);
579 return std::cos(0.5*pi*r/h) * double(1.0-abs_r_over_h_to_n>0.0);
584 double h_over_p = h/p;
585 double abs_r_over_h_to_n = std::abs(r/h);
586 return double(1.0-abs_r_over_h_to_n>0.0)/( h_over_p * 2.5066282746310002416124 ) * std::exp(-.5*r*r/(h_over_p*h_over_p));
590 double abs_r_over_h_to_n = std::abs(r/h);
591 return double(1.0-abs_r_over_h_to_n>0.0) / (std::exp(p*r) + std::exp(-p*r) + n);
625 &&
"Entire batch not computed at once, so getFullPolynomialCoefficientsBasis() can not be called.");
627 &&
"generateAlphas() called with keep_coefficients set to false.");
723 double getTangentBundle(
const int target_index,
const int direction,
const int component)
const {
726 scratch_matrix_right_type::HostMirror
728 return T(direction, component);
734 "getRefenceNormalDirection called, but reference outwrad normal directions were never provided.");
735 scratch_vector_type::HostMirror
737 return ref_N(component);
761 &&
"Entire batch not computed at once, so getFullPolynomialCoefficientsBasis() can not be called.");
763 &&
"generateAlphas() called with keep_coefficients set to false.");
786 if (for_target)
return 0;
else return 1;
792 const int target_index_in_weights =
796 const int neighbor_index_in_weights =
801 output_component, input_component);
812 "getSolutionSetHost() called with invalid alpha values.");
819 "getSolutionSetDevice() called with invalid alpha values.");
841 if (
_RHS.extent(0) > 0)
842 _RHS = Kokkos::View<double*>(
"RHS",0);
848 template<
typename view_type_1,
typename view_type_2,
typename view_type_3,
typename view_type_4>
850 view_type_1 neighbor_lists,
851 view_type_2 source_coordinates,
852 view_type_3 target_coordinates,
853 view_type_4 epsilons) {
854 this->setNeighborLists<view_type_1>(neighbor_lists);
855 this->setSourceSites<view_type_2>(source_coordinates);
856 this->setTargetSites<view_type_3>(target_coordinates);
857 this->setWindowSizes<view_type_4>(epsilons);
861 template<
typename view_type_1,
typename view_type_2,
typename view_type_3,
typename view_type_4>
863 view_type_1 cr_neighbor_lists,
864 view_type_1 number_of_neighbors_list,
865 view_type_2 source_coordinates,
866 view_type_3 target_coordinates,
867 view_type_4 epsilons) {
868 this->setNeighborLists<view_type_1>(cr_neighbor_lists, number_of_neighbors_list);
869 this->setSourceSites<view_type_2>(source_coordinates);
870 this->setTargetSites<view_type_3>(target_coordinates);
871 this->setWindowSizes<view_type_4>(epsilons);
875 template<
typename view_type_1,
typename view_type_2>
877 view_type_1 additional_evaluation_indices,
878 view_type_2 additional_evaluation_coordinates) {
879 this->setAuxiliaryEvaluationIndicesLists<view_type_1>(additional_evaluation_indices);
880 this->setAuxiliaryEvaluationCoordinates<view_type_2>(additional_evaluation_coordinates);
884 template<
typename view_type_1,
typename view_type_2>
886 view_type_1 cr_additional_evaluation_indices,
887 view_type_1 number_of_additional_evaluation_indices,
888 view_type_2 additional_evaluation_coordinates) {
889 this->setAuxiliaryEvaluationIndicesLists<view_type_1>(cr_additional_evaluation_indices,
890 number_of_additional_evaluation_indices);
891 this->setAuxiliaryEvaluationCoordinates<view_type_2>(additional_evaluation_coordinates);
895 template <
typename view_type>
896 typename std::enable_if<view_type::rank==1&&std::is_same<neighbor_lists_type::internal_view_type,view_type>::value==1,
void>::type
905 template <
typename view_type>
906 typename std::enable_if<view_type::rank==1&&std::is_same<neighbor_lists_type::internal_view_type,view_type>::value==0,
void>::type
910 gmls_view_type d_neighbor_lists(
"compressed row neighbor lists data", neighbor_lists.extent(0));
911 gmls_view_type d_number_of_neighbors_list(
"number of neighbors list", number_of_neighbors_list.extent(0));
912 Kokkos::deep_copy(d_neighbor_lists, neighbor_lists);
913 Kokkos::deep_copy(d_number_of_neighbors_list, number_of_neighbors_list);
922 template <
typename view_type>
923 typename std::enable_if<view_type::rank==2, void>::type
setNeighborLists(view_type neighbor_lists) {
932 template<
typename view_type>
937 source_coordinates.extent(0), source_coordinates.extent(1));
939 typedef typename view_type::memory_space input_array_memory_space;
940 if (std::is_same<input_array_memory_space, device_memory_space>::value) {
945 Kokkos::deep_copy(sc, source_coordinates);
950 auto host_source_coordinates = Kokkos::create_mirror_view(sc);
951 Kokkos::deep_copy(host_source_coordinates, source_coordinates);
953 Kokkos::deep_copy(sc, host_source_coordinates);
961 template<
typename view_type>
969 template<
typename view_type>
973 target_coordinates.extent(0), target_coordinates.extent(1));
975 typedef typename view_type::memory_space input_array_memory_space;
976 if (std::is_same<input_array_memory_space, device_memory_space>::value) {
981 Kokkos::deep_copy(tc, target_coordinates);
986 auto host_target_coordinates = Kokkos::create_mirror_view(tc);
987 Kokkos::deep_copy(host_target_coordinates, target_coordinates);
989 Kokkos::deep_copy(tc, host_target_coordinates);
993 Kokkos::View<int*>(),
994 Kokkos::View<int*>(
"number of additional evaluation indices",
995 target_coordinates.extent(0))
1006 template<
typename view_type>
1010 Kokkos::View<int*>(),
1011 Kokkos::View<int*>(
"number of additional evaluation indices",
1012 target_coordinates.extent(0))
1023 template<
typename view_type>
1035 template<
typename view_type>
1047 template<
typename view_type>
1055 "tangent_directions must have cardinality #number of targets * #dimensions * #dimensions");
1060 "Memory space does not match between _T and tangent_directions");
1065 Kokkos::parallel_for(
"copy tangent vectors", Kokkos::RangePolicy<device_execution_space>(0, num_targets), KOKKOS_LAMBDA(
const int i) {
1067 for (
int j=0; j<this_dimensions; ++j) {
1068 for (
int k=0; k<this_dimensions; ++k) {
1069 T(j,k) = tangent_directions(i, j, k);
1076 _host_T = Kokkos::create_mirror_view(
_T);
1084 template<
typename view_type>
1091 auto this_ref_N = this->
_ref_N;
1095 Kokkos::parallel_for(
"copy normal vectors", Kokkos::RangePolicy<device_execution_space>(0,
_pc.
_target_coordinates.extent(0)), KOKKOS_LAMBDA(
const int i) {
1096 for (
int j=0; j<this_dimensions; ++j) {
1097 this_ref_N(i*this_dimensions + j) = outward_normal_directions(i, j);
1112 template<
typename view_type>
1119 Kokkos::deep_copy(host_extra_data, extra_data);
1127 template<
typename view_type>
1136 template<
typename view_type>
1143 Kokkos::deep_copy(host_extra_data, extra_data);
1151 template<
typename view_type>
1172 std::string wt_to_lower = wt;
1173 transform(wt_to_lower.begin(), wt_to_lower.end(), wt_to_lower.begin(), ::tolower);
1174 if (wt_to_lower ==
"power") {
1176 }
else if (wt_to_lower ==
"gaussian") {
1178 }
else if (wt_to_lower ==
"cubicspline") {
1180 }
else if (wt_to_lower ==
"cardinalcubicbspline") {
1182 }
else if (wt_to_lower ==
"cosine") {
1184 }
else if (wt_to_lower ==
"sigmoid") {
1201 std::string wt_to_lower = wt;
1202 transform(wt_to_lower.begin(), wt_to_lower.end(), wt_to_lower.begin(), ::tolower);
1203 if (wt_to_lower ==
"power") {
1205 }
else if (wt_to_lower ==
"gaussian") {
1207 }
else if (wt_to_lower ==
"cubicspline") {
1209 }
else if (wt_to_lower ==
"cardinalcubicbspline") {
1211 }
else if (wt_to_lower ==
"cosine") {
1213 }
else if (wt_to_lower ==
"sigmoid") {
1307 "Target coordinates and neighbor lists have different size.");
1311 "Source coordinates and target coordinates have different dimensions.");
1315 "Source coordinates not set in GMLS class before calling generatePolynomialCoefficients.");
1323 "Target coordinates and additional evaluation indices have different size.");
1327 "Target coordinates and additional evaluation indices have different size.");
1332 "Target coordinates and additional evaluation coordinates have different dimensions.");
1352 const bool clear_cache =
true);
1367 void generateAlphas(
const int number_of_batches = 1,
const bool keep_coefficients =
false,
1368 const bool clear_cache =
true);
Kokkos::View< int *, host_execution_space > host_managed_local_index_type
#define compadre_kernel_assert_release(condition)
compadre_kernel_assert_release is similar to compadre_assert_release, but is a call on the device,...
#define compadre_assert_debug(condition)
compadre_assert_debug is used for assertions that are checked in loops, as these significantly impact...
Kokkos::View< double **, layout_right, Kokkos::MemoryTraits< Kokkos::Unmanaged > > scratch_matrix_right_type
#define compadre_assert_release(condition)
compadre_assert_release is used for assertions that should always be checked, but generally are not e...
Lightweight Evaluator Helper This class is a lightweight wrapper for extracting and applying all rele...
Generalized Moving Least Squares (GMLS)
SolutionSet< device_memory_space > _d_ss
int _sampling_multiplier
actual dimension of the sampling functional e.g.
void setWindowSizes(decltype(_epsilons) epsilons)
Sets window sizes, also called the support of the kernel (device)
neighbor_lists_type * getNeighborLists() const
Get neighbor list accessor.
host_managed_local_index_type getPolynomialCoefficientsMemorySize() const
Returns 2D array size in memory on which coefficients are stored.
decltype(_RHS) getFullPolynomialCoefficientsBasis() const
Get a view (device) of all polynomial coefficients basis.
Kokkos::View< const double *****, layout_right >::HostMirror _host_prestencil_weights
generated weights for nontraditional samples required to transform data into expected sampling functi...
void addTargets(TargetOperation lro)
Adds a target to the vector of target functional to be applied to the reconstruction.
double getPreStencilWeight(SamplingFunctional sro, const int target_index, const int neighbor_index, bool for_target, const int output_component=0, const int input_component=0) const
Returns a stencil to transform data from its existing state into the input expected for some sampling...
void setDimensionOfQuadraturePoints(int dim)
Dimensions of quadrature points to use.
void setCurvatureWeightingType(const WeightingFunctionType wt)
Type for weighting kernel for curvature.
int _weighting_p
first parameter to be used for weighting kernel
std::string _quadrature_type
quadrature rule type
void setSourceExtraData(decltype(_source_extra_data) extra_data)
(OPTIONAL) Sets extra data to be used by sampling functionals in certain instances.
std::enable_if< view_type::rank==1 &&std::is_same< neighbor_lists_type::internal_view_type, view_type >::value==0, void >::type setAuxiliaryEvaluationIndicesLists(view_type additional_evaluation_indices, view_type number_of_neighbors_list)
(OPTIONAL) Sets the additional target evaluation indices list information from compressed row format ...
Kokkos::View< double * > _T
Rank 3 tensor for high order approximation of tangent vectors for all problems.
point_connections_type _additional_pc
(OPTIONAL) connections between additional points and neighbors
void setWeightingType(const WeightingFunctionType wt)
Type for weighting kernel for GMLS problem.
int getLocalDimensions() const
Local dimension of the GMLS problem (less than global dimension if on a manifold),...
void addTargets(std::vector< TargetOperation > lro)
Adds a vector of target functionals to the vector of target functionals already to be applied to the ...
bool _reference_outward_normal_direction_provided
whether or not the reference outward normal directions were provided by the user.
int _basis_multiplier
dimension of the reconstructed function e.g.
std::enable_if< view_type::rank==2, void >::type setAuxiliaryEvaluationIndicesLists(view_type additional_evaluation_indices)
(OPTIONAL) Sets the additional target evaluation indices list information.
ReconstructionSpace _reconstruction_space
reconstruction space for GMLS problems, set at GMLS class instantiation
int _reconstruction_space_rank
actual rank of reconstruction basis
void setProblemData(view_type_1 cr_neighbor_lists, view_type_1 number_of_neighbors_list, view_type_2 source_coordinates, view_type_3 target_coordinates, view_type_4 epsilons)
Sets basic problem data (neighbor lists data, number of neighbors list, source coordinates,...
Kokkos::View< double * > _manifold_metric_tensor_inverse
metric tensor inverse for all problems
int getOrderOfQuadraturePoints() const
Order of quadrature points.
const GMLSSolutionData extractSolutionData() const
Get GMLS solution data.
void setReferenceOutwardNormalDirection(view_type outward_normal_directions, bool use_to_orient_surface=true)
(OPTIONAL) Sets outward normal direction.
int _order_of_quadrature_points
order of exact polynomial integration for quadrature rule
void setCurvatureWeightingParameter(int wp, int index=0)
Parameter for weighting kernel for curvature index = 0 sets p paramater for weighting kernel index = ...
int getDimensions() const
Dimension of the GMLS problem, set only at class instantiation.
int _global_dimensions
spatial dimension of the points, set at class instantiation only
void setSourceExtraData(view_type extra_data)
(OPTIONAL) Sets extra data to be used by sampling functionals in certain instances.
void generatePolynomialCoefficients(const int number_of_batches=1, const bool keep_coefficients=false, const bool clear_cache=true)
Generates polynomial coefficients by setting up and solving least squares problems Sets up the batch ...
ReconstructionSpace getReconstructionSpace() const
Get the reconstruction space specified at instantiation.
Kokkos::View< double * > _epsilons
h supports determined through neighbor search (device)
PointConnections< Kokkos::View< double **, layout_right >, Kokkos::View< double **, layout_right >, NeighborLists< Kokkos::View< int * > > > point_connections_type
GMLS(ReconstructionSpace reconstruction_space, SamplingFunctional dual_sampling_strategy, const int poly_order, const int dimensions=3, const std::string dense_solver_type=std::string("QR"), const std::string problem_type=std::string("STANDARD"), const std::string constraint_type=std::string("NO_CONSTRAINT"), const int manifold_curvature_poly_order=2)
Constructor for the case when nonstandard sampling functionals or reconstruction spaces are to be use...
WeightingFunctionType _weighting_type
weighting kernel type for GMLS
ProblemType _problem_type
problem type for GMLS problem, can also be set to STANDARD for normal or MANIFOLD for manifold proble...
int getPolynomialCoefficientsSize() const
Returns size of the basis used in instance's polynomial reconstruction.
int getDimensionOfQuadraturePoints() const
Dimensions of quadrature points.
int _data_sampling_multiplier
effective dimension of the data sampling functional e.g.
std::string getQuadratureType() const
Type of quadrature points.
bool containsValidAlphas() const
Check if GMLS solution set contains valid alpha values (has generateAlphas been called)
int getPolynomialOrder() const
Get basis order used for reconstruction.
void setSourceSites(coordinates_type source_coordinates)
Sets source coordinate information.
void setTangentBundle(view_type tangent_directions)
(OPTIONAL) Sets orthonormal tangent directions for reconstruction on a manifold.
Kokkos::View< double **, layout_right > _source_extra_data
Extra data available to basis functions (optional)
WeightingFunctionType getManifoldWeightingType() const
Type for weighting kernel for curvature.
DenseSolverType _dense_solver_type
solver type for GMLS problem - can be QR, SVD or LU
Kokkos::View< TargetOperation * > _curvature_support_operations
vector containing target functionals to be applied for curvature
void setAdditionalEvaluationSitesData(view_type_1 additional_evaluation_indices, view_type_2 additional_evaluation_coordinates)
(OPTIONAL) Sets additional evaluation sites for each target site
DenseSolverType getDenseSolverType() const
Get dense solver type.
int getGlobalDimensions() const
Dimension of the GMLS problem's point data (spatial description of points in ambient space),...
void setDenseSolverType(const DenseSolverType dst)
Set dense solver type type.
Kokkos::View< double * > _Z
stores evaluations of targets applied to basis
int _initial_index_for_batch
initial index for current batch
void clearTargets()
Empties the vector of target functionals to apply to the reconstruction.
decltype(_ref_N) * getReferenceNormalDirections()
Get a view (device) of all reference outward normal directions.
Kokkos::View< TargetOperation * >::HostMirror _host_operations
vector containing target functionals to be applied for reconstruction problem (host)
void setAdditionalEvaluationSitesData(view_type_1 cr_additional_evaluation_indices, view_type_1 number_of_additional_evaluation_indices, view_type_2 additional_evaluation_coordinates)
(OPTIONAL) Sets additional evaluation sites for each target site
void setWeightingParameter(int wp, int index=0)
Parameter for weighting kernel for GMLS problem index = 0 sets p paramater for weighting kernel index...
int _NP
dimension of basis for polynomial reconstruction
void generateAlphas(const int number_of_batches=1, const bool keep_coefficients=false, const bool clear_cache=true)
Meant to calculate target operations and apply the evaluations to the previously constructed polynomi...
decltype(_pc) * getPointConnections()
Get a view (device) of all point connection info.
void setTargetExtraData(decltype(_target_extra_data) extra_data)
(OPTIONAL) Sets extra data to be used by target operations in certain instances.
void setCurvaturePolynomialOrder(const int curvature_poly_order)
Sets basis order to be used when reconstruction curvature.
int getWeightingParameter(const int index=0) const
Get parameter for weighting kernel for GMLS problem.
int _poly_order
order of basis for polynomial reconstruction
void setAuxiliaryEvaluationCoordinates(view_type evaluation_coordinates)
(OPTIONAL) Sets additional points for evaluation of target operation on polynomial reconstruction.
void setOrderOfQuadraturePoints(int order)
Number quadrature points to use.
bool verifyPointConnections(bool assert_valid=false)
Verify whether _pc is valid.
decltype(_d_ss) * getSolutionSetDevice(bool alpha_validity_check=true)
Get solution set on device.
Kokkos::View< double * > _manifold_curvature_coefficients
curvature polynomial coefficients for all problems
SamplingFunctional _data_sampling_functional
generally the same as _polynomial_sampling_functional, but can differ if specified at
SolutionSet< host_memory_space > _h_ss
Solution Set (contains all alpha values from solution and alpha layout methods)
ConstraintType _constraint_type
constraint type for GMLS problem
Kokkos::View< double **, layout_right > _target_extra_data
Extra data available to target operations (optional)
WeightingFunctionType getWeightingType() const
Type for weighting kernel for GMLS problem.
std::enable_if< view_type::rank==1 &&std::is_same< neighbor_lists_type::internal_view_type, view_type >::value==1, void >::type setAuxiliaryEvaluationIndicesLists(view_type additional_evaluation_indices, view_type number_of_neighbors_list)
(OPTIONAL) Sets the additional target evaluation indices list information from compressed row format ...
double getReferenceNormalDirection(const int target_index, const int component) const
Get component of tangent or normal directions for manifold problems.
decltype(_h_ss) * getSolutionSetHost(bool alpha_validity_check=true)
Get solution set on host.
static ProblemType parseProblemType(const std::string &problem_type)
Parses a string to determine problem type.
static ConstraintType parseConstraintType(const std::string &constraint_type)
Parses a string to determine constraint type.
int _dimensions
dimension of the problem, set at class instantiation only
int _curvature_poly_order
order of basis for curvature reconstruction
GMLS(const int poly_order, const int dimensions=3, const std::string dense_solver_type=std::string("QR"), const std::string problem_type=std::string("STANDARD"), const std::string constraint_type=std::string("NO_CONSTRAINT"), const int manifold_curvature_poly_order=2)
Constructor for the case when the data sampling functional does not match the polynomial sampling fun...
int _curvature_weighting_p
first parameter to be used for weighting kernel for curvature
decltype(_epsilons) * getWindowSizes()
Get a view (device) of all window sizes.
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...
void setQuadratureType(std::string quadrature_type)
Type of quadrature points.
int getManifoldWeightingParameter(const int index=0) const
Get parameter for weighting kernel for curvature.
void setProblemData(view_type_1 neighbor_lists, view_type_2 source_coordinates, view_type_3 target_coordinates, view_type_4 epsilons)
Sets basic problem data (neighbor lists, source coordinates, and target coordinates)
ParallelManager _pm
determines scratch level spaces and is used to call kernels
std::enable_if< view_type::rank==1 &&std::is_same< neighbor_lists_type::internal_view_type, view_type >::value==0, void >::type setNeighborLists(view_type neighbor_lists, view_type number_of_neighbors_list)
Sets neighbor list information from compressed row neighborhood lists data (if different view_type).
WeightingFunctionType _curvature_weighting_type
weighting kernel type for curvature problem
void setWeightingType(const std::string &wt)
Type for weighting kernel for GMLS problem.
int _weighting_n
second parameter to be used for weighting kernel
int getCurvaturePolynomialOrder() const
Get basis order used for curvature reconstruction.
void setConstraintType(const ConstraintType ct)
Set constraint type.
Kokkos::View< TargetOperation * > _operations
vector containing target functionals to be applied for reconstruction problem (device)
bool _orthonormal_tangent_space_provided
whether or not the orthonormal tangent directions were provided by the user.
Kokkos::View< double * > _RHS
sqrt(w)*Identity matrix for all problems, later holds polynomial coefficients for all problems
SamplingFunctional _polynomial_sampling_functional
polynomial sampling functional used to construct P matrix, set at GMLS class instantiation NOTE: ca...
static KOKKOS_INLINE_FUNCTION int getNN(const int m, const int dimension=3, const ReconstructionSpace r_space=ReconstructionSpace::ScalarTaylorPolynomial)
Returns number of neighbors needed for unisolvency for a given basis order and dimension.
Kokkos::View< double * > _P
P*sqrt(w) matrix for all problems.
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....
void setPolynomialOrder(const int poly_order)
Sets basis order to be used when reconstructing any function.
NeighborLists< Kokkos::View< int * > > neighbor_lists_type
GMLS(ReconstructionSpace reconstruction_space, const SamplingFunctional polynomial_sampling_strategy, const SamplingFunctional data_sampling_strategy, const int poly_order, const int dimensions, const DenseSolverType dense_solver_type, const ProblemType problem_type, const ConstraintType constraint_type, const int manifold_curvature_poly_order)
Maximal constructor, not intended for users.
SamplingFunctional getDataSamplingFunctional() const
Get the data sampling functional specified at instantiation (often the same as the polynomial samplin...
decltype(_T) * getTangentDirections()
Get a view (device) of all tangent direction bundles.
void resetCoefficientData()
const GMLSBasisData extractBasisData() const
Get GMLS basis data.
void setTargetSites(view_type target_coordinates)
Sets target coordinate information. Rows of this 2D-array should correspond to rows of the neighbor l...
static DenseSolverType parseSolverType(const std::string &dense_solver_type)
Parses a string to determine solver type.
Kokkos::View< double **, layout_right > coordinates_type
point_connections_type _pc
connections between points and neighbors
SamplingFunctional getPolynomialSamplingFunctional() const
Get the polynomial sampling functional specified at instantiation.
void setSourceSites(view_type source_coordinates)
Sets source coordinate information.
Kokkos::View< double *****, layout_right > _prestencil_weights
generated weights for nontraditional samples required to transform data into expected sampling functi...
Kokkos::View< double * >::HostMirror _host_ref_N
reference outward normal vectors information (host)
decltype(_additional_pc) * getAdditionalPointConnections()
(OPTIONAL) Get a view (device) of all additional evaluation point connection info
ProblemType getProblemType() const
Get problem type.
ConstraintType getConstraintType() const
Get constraint type.
void setCurvatureWeightingType(const std::string &wt)
Type for weighting kernel for curvature.
Kokkos::View< double * > _w
contains weights for all problems
host_managed_local_index_type getPolynomialCoefficientsDomainRangeSize() const
Returns (size of the basis used in instance's polynomial reconstruction) x (data input dimension)
void setWindowSizes(view_type epsilons)
Sets window sizes, also called the support of the kernel.
int _curvature_weighting_n
second parameter to be used for weighting kernel for curvature
bool _entire_batch_computed_at_once
whether entire calculation was computed at once the alternative is that it was broken up over many sm...
static KOKKOS_INLINE_FUNCTION double Wab(const double r, const double h, const WeightingFunctionType &weighting_type, const int p, const int n)
Evaluates the weighting kernel.
int _local_dimensions
dimension of the problem, set at class instantiation only. For manifolds, generally _global_dimension...
GMLS(ReconstructionSpace reconstruction_space, const SamplingFunctional polynomial_sampling_strategy, const SamplingFunctional data_sampling_strategy, const int poly_order, const int dimensions=3, const std::string dense_solver_type=std::string("QR"), const std::string problem_type=std::string("STANDARD"), const std::string constraint_type=std::string("NO_CONSTRAINT"), const int manifold_curvature_poly_order=2)
Maximal constructor, but with string arguments.
std::enable_if< view_type::rank==2, void >::type setNeighborLists(view_type neighbor_lists)
Sets neighbor list information.
Kokkos::View< double * > _manifold_curvature_gradient
_dimension-1 gradient values for curvature for all problems
Kokkos::View< double * >::HostMirror _host_T
tangent vectors information (host)
neighbor_lists_type * getAdditionalEvaluationIndices() const
(OPTIONAL) Get additional evaluation sites neighbor list-like accessor
std::enable_if< view_type::rank==1 &&std::is_same< neighbor_lists_type::internal_view_type, view_type >::value==1, void >::type setNeighborLists(view_type neighbor_lists, view_type number_of_neighbors_list)
Sets neighbor list information from compressed row neighborhood lists data (if same view_type).
bool verifyAdditionalPointConnections(bool assert_valid=false)
Verify whether _additional_pc is valid.
bool _store_PTWP_inv_PTW
whether polynomial coefficients were requested to be stored (in a state not yet applied to data)
int _dimension_of_quadrature_points
dimension of quadrature rule
void setTargetExtraData(view_type extra_data)
(OPTIONAL) Sets extra data to be used by target operations in certain instances.
double getTangentBundle(const int target_index, const int direction, const int component) const
Get component of tangent or normal directions for manifold problems.
void setTargetSites(coordinates_type target_coordinates)
Sets target coordinate information. Rows of this 2D-array should correspond to rows of the neighbor l...
Kokkos::View< double * > _ref_N
Rank 2 tensor for high order approximation of tangent vectors for all problems.
int getNumberOfQuadraturePoints() const
Number of quadrature points.
void setAuxiliaryEvaluationCoordinates(coordinates_type evaluation_coordinates)
(OPTIONAL) Sets additional points for evaluation of target operation on polynomial reconstruction.
Quadrature _qm
manages and calculates quadrature
decltype(_prestencil_weights) getPrestencilWeights() const
Get a view (device) of all rank 2 preprocessing tensors This is a rank 5 tensor that is able to provi...
KOKKOS_INLINE_FUNCTION int getNumberOfQuadraturePoints() const
KOKKOS_INLINE_FUNCTION int getSize(const int degree, const int dimension)
Returns size of basis.
KOKKOS_INLINE_FUNCTION int getSize(const int degree, const int dimension)
Returns size of basis.
KOKKOS_INLINE_FUNCTION int getSize(const int degree, const int dimension)
Returns size of basis.
NeighborLists< view_type_1d > Convert2DToCompressedRowNeighborLists(view_type_2d neighbor_lists)
Converts 2D neighbor lists to compressed row neighbor lists.
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)
KOKKOS_INLINE_FUNCTION int getActualReconstructionSpaceRank(const int &index)
Number of actual components in the ReconstructionSpace.
ConstraintType
Constraint type.
@ NEUMANN_GRAD_SCALAR
Neumann Gradient Scalar Type.
@ NO_CONSTRAINT
No constraint.
constexpr SamplingFunctional PointSample
Available sampling functionals.
ReconstructionSpace
Space in which to reconstruct polynomial.
@ DivergenceFreeVectorTaylorPolynomial
Divergence-free vector polynomial basis.
@ BernsteinPolynomial
Bernstein polynomial basis.
@ ScalarTaylorPolynomial
Scalar polynomial basis centered at the target site and scaled by sum of basis powers e....
@ VectorOfScalarClonesTaylorPolynomial
Scalar basis reused as many times as there are components in the vector resulting in a much cheaper p...
ProblemType
Problem type, that optionally can handle manifolds.
@ STANDARD
Standard GMLS problem type.
@ MANIFOLD
Solve GMLS problem on a manifold (will use QR or SVD to solve the resultant GMLS problem dependent on...
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)
constexpr SamplingFunctional ManifoldVectorPointSample
Point evaluations of the entire vector source function (but on a manifold, so it includes a transform...
constexpr SamplingFunctional VectorPointSample
Point evaluations of the entire vector source function.
DenseSolverType
Dense solver type.
@ LU
LU factorization performed on P^T*W*P matrix.
@ QR
QR+Pivoting factorization performed on P*sqrt(w) matrix.
@ DifferentEachNeighbor
Each target applies a different transform for each neighbor.
@ DifferentEachTarget
Each target applies a different data transform, but the same to each neighbor.
TargetOperation
Available target functionals.
@ GradientOfScalarPointEvaluation
Point evaluation of the gradient of a scalar.
WeightingFunctionType
Available weighting kernel function types.
NeighborLists assists in accessing entries of compressed row neighborhood lists.
Kokkos::View< int * > internal_view_type
KOKKOS_INLINE_FUNCTION int getMaxNumNeighbors() const
Get the maximum number of neighbors of all targets' neighborhoods (host/device)
KOKKOS_INLINE_FUNCTION int getNumberOfTargets() const
Get number of total targets having neighborhoods (host/device).
Combines NeighborLists with the PointClouds from which it was derived Assumed that memory_space is th...
void setSourceCoordinates(view_type_2 source_coordinates)
Update only source coordinates.
void setNeighborLists(nla_type nla)
Update only target coordinates.
void setTargetCoordinates(view_type_1 target_coordinates)
Update only target coordinates.
device_mirror_source_view_type _source_coordinates
device_mirror_target_view_type _target_coordinates
int transform_type
Describes the SamplingFunction relationship to targets, neighbors.
void addTargets(TargetOperation lro)
Adds a target to the vector of target functional to be applied to the reconstruction.
void clearTargets()
Empties the vector of target functionals to apply to the reconstruction.
int _max_evaluation_sites_per_target
maximum number of evaluation sites for each target (includes target site)
bool _contains_valid_alphas
whether internal alpha values are valid (set externally on a solve)
void copyAlphas(SolutionSet< other_memory_space > &other)
Copies alphas between two instances of SolutionSet Copying of alphas is intentionally omitted in copy...