Compadre  1.2.0
GMLS_Multiple_Evaluation_Sites.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <string>
3 #include <vector>
4 #include <map>
5 #include <stdlib.h>
6 #include <cstdio>
7 #include <random>
8 
9 #include <Compadre_Config.h>
10 #include <Compadre_GMLS.hpp>
11 #include <Compadre_Evaluator.hpp>
13 
14 #include "GMLS_Tutorial.hpp"
15 
16 #ifdef COMPADRE_USE_MPI
17 #include <mpi.h>
18 #endif
19 
20 #include <Kokkos_Timer.hpp>
21 #include <Kokkos_Core.hpp>
22 
23 using namespace Compadre;
24 
25 //! [Parse Command Line Arguments]
26 
27 // called from command line
28 int main (int argc, char* args[]) {
29 
30 // initializes MPI (if available) with command line arguments given
31 #ifdef COMPADRE_USE_MPI
32 MPI_Init(&argc, &args);
33 #endif
34 
35 // initializes Kokkos with command line arguments given
36 Kokkos::initialize(argc, args);
37 
38 // becomes false if the computed solution not within the failure_threshold of the actual solution
39 bool all_passed = true;
40 
41 
42 // code block to reduce scope for all Kokkos View allocations
43 // otherwise, Views may be deallocating when we call Kokkos::finalize() later
44 {
45  // check if 7 arguments are given from the command line, the first being the program name
46  // constraint_type used in solving each GMLS problem:
47  // 0 - No constraints used in solving each GMLS problem
48  // 1 - Neumann Gradient Scalar used in solving each GMLS problem
49  int constraint_type = 0; // No constraints by default
50  if (argc >= 7) {
51  int arg7toi = atoi(args[6]);
52  if (arg7toi > 0) {
53  constraint_type = arg7toi;
54  }
55  }
56 
57  // check if 6 arguments are given from the command line, the first being the program name
58  // problem_type used in solving each GMLS problem:
59  // 0 - Standard GMLS problem
60  // 1 - Manifold GMLS problem
61  int problem_type = 0; // Standard by default
62  if (argc >= 6) {
63  int arg6toi = atoi(args[5]);
64  if (arg6toi > 0) {
65  problem_type = arg6toi;
66  }
67  }
68 
69  // check if 5 arguments are given from the command line, the first being the program name
70  // solver_type used for factorization in solving each GMLS problem:
71  // 0 - SVD used for factorization in solving each GMLS problem
72  // 1 - QR used for factorization in solving each GMLS problem
73  // 2 - LU used for factorization in solving each GMLS problem
74  int solver_type = 1; // QR by default
75  if (argc >= 5) {
76  int arg5toi = atoi(args[4]);
77  if (arg5toi >= 0) {
78  solver_type = arg5toi;
79  }
80  }
81 
82  // check if 4 arguments are given from the command line
83  // dimension for the coordinates and the solution
84  int dimension = 3; // dimension 3 by default
85  if (argc >= 4) {
86  int arg4toi = atoi(args[3]);
87  if (arg4toi > 0) {
88  dimension = arg4toi;
89  }
90  }
91  compadre_assert_release((dimension==3) && "This test must be run in 3 dimensions.");
92 
93  // check if 3 arguments are given from the command line
94  // set the number of target sites where we will reconstruct the target functionals at
95  int number_target_coords = 200; // 200 target sites by default
96  if (argc >= 3) {
97  int arg3toi = atoi(args[2]);
98  if (arg3toi > 0) {
99  number_target_coords = arg3toi;
100  }
101  }
102 
103  // check if 2 arguments are given from the command line
104  // set the number of target sites where we will reconstruct the target functionals at
105  int order = 3; // 3rd degree polynomial basis by default
106  if (argc >= 2) {
107  int arg2toi = atoi(args[1]);
108  if (arg2toi > 0) {
109  order = arg2toi;
110  }
111  }
112 
113  // the functions we will be seeking to reconstruct are in the span of the basis
114  // of the reconstruction space we choose for GMLS, so the error should be very small
115  const double failure_tolerance = 1e-9;
116 
117  // minimum neighbors for unisolvency is the same as the size of the polynomial basis
118  const int min_neighbors = Compadre::GMLS::getNP(order, dimension);
119 
120  //! [Parse Command Line Arguments]
121  Kokkos::Timer timer;
122  Kokkos::Profiling::pushRegion("Setup Point Data");
123  //! [Setting Up The Point Cloud]
124 
125  // approximate spacing of source sites
126  double h_spacing = 0.05;
127  int n_neg1_to_1 = 2*(1/h_spacing) + 1; // always odd
128 
129  // number of source coordinate sites that will fill a box of [-1,1]x[-1,1]x[-1,1] with a spacing approximately h
130  const int number_source_coords = std::pow(n_neg1_to_1, dimension);
131 
132  // coordinates of source sites
133  Kokkos::View<double**, Kokkos::DefaultExecutionSpace> source_coords_device("source coordinates",
134  number_source_coords, 3);
135  Kokkos::View<double**>::HostMirror source_coords = Kokkos::create_mirror_view(source_coords_device);
136 
137  // coordinates of target sites
138  Kokkos::View<double**, Kokkos::DefaultExecutionSpace> target_coords_device ("target coordinates", number_target_coords, 3);
139  Kokkos::View<double**>::HostMirror target_coords = Kokkos::create_mirror_view(target_coords_device);
140 
141  // coordinates of additional evaluation sites
142  Kokkos::View<double**, Kokkos::DefaultExecutionSpace> additional_target_coords_device ("additional target coordinates", 2*number_target_coords /* multiple evaluation sites for each target index */, 3);
143  Kokkos::View<double**>::HostMirror additional_target_coords = Kokkos::create_mirror_view(additional_target_coords_device);
144 
145  // additional target site indices
146  Kokkos::View<int**, Kokkos::DefaultExecutionSpace> additional_target_indices_device ("additional target indices", number_target_coords, 4 /* # of extra evaluation sites plus index for each */);
147  Kokkos::View<int**>::HostMirror additional_target_indices = Kokkos::create_mirror_view(additional_target_indices_device);
148 
149 
150  // fill source coordinates with a uniform grid
151  int source_index = 0;
152  double this_coord[3] = {0,0,0};
153  for (int i=-n_neg1_to_1/2; i<n_neg1_to_1/2+1; ++i) {
154  this_coord[0] = i*h_spacing;
155  for (int j=-n_neg1_to_1/2; j<n_neg1_to_1/2+1; ++j) {
156  this_coord[1] = j*h_spacing;
157  for (int k=-n_neg1_to_1/2; k<n_neg1_to_1/2+1; ++k) {
158  this_coord[2] = k*h_spacing;
159  if (dimension==3) {
160  source_coords(source_index,0) = this_coord[0];
161  source_coords(source_index,1) = this_coord[1];
162  source_coords(source_index,2) = this_coord[2];
163  source_index++;
164  }
165  }
166  if (dimension==2) {
167  source_coords(source_index,0) = this_coord[0];
168  source_coords(source_index,1) = this_coord[1];
169  source_coords(source_index,2) = 0;
170  source_index++;
171  }
172  }
173  if (dimension==1) {
174  source_coords(source_index,0) = this_coord[0];
175  source_coords(source_index,1) = 0;
176  source_coords(source_index,2) = 0;
177  source_index++;
178  }
179  }
180 
181  // fill target coords somewhere inside of [-0.5,0.5]x[-0.5,0.5]x[-0.5,0.5]
182  for(int i=0; i<number_target_coords; i++){
183 
184  // first, we get a uniformly random distributed direction
185  double rand_dir[3] = {0,0,0};
186 
187  for (int j=0; j<dimension; ++j) {
188  // rand_dir[j] is in [-0.5, 0.5]
189  rand_dir[j] = ((double)rand() / (double) RAND_MAX) - 0.5;
190  }
191 
192  // then we get a uniformly random radius
193  for (int j=0; j<dimension; ++j) {
194  target_coords(i,j) = rand_dir[j];
195  }
196 
197  }
198 
199  // generate coordinates to test multiple site evaluations
200  // strategy is to have a variable number of evaluation sites per target site
201  // so as to fully test the multi-site evaluation
202  int extra_evaluation_coordinates_count = 0;
203  for(int i=0; i<number_target_coords; i++){
204 
205  // set list of indices for extra evaluations
206  additional_target_indices(i,0) = (i%3)+1;
207 
208  // evaluation sites are same as target plus some perturbation
209  for (int k=0; k<(i%3+1); ++k) {
210  for (int j=0; j<dimension; ++j) {
211  additional_target_coords(extra_evaluation_coordinates_count,j) = target_coords(i,j) + (j==0)*1e-3 + (j==1)*1e-2 + (j==1)*(-1e-1);
212  }
213  additional_target_indices(i,k+1) = extra_evaluation_coordinates_count;
214  extra_evaluation_coordinates_count++;
215  }
216  }
217 
218 
219  //! [Setting Up The Point Cloud]
220 
221  Kokkos::Profiling::popRegion();
222  Kokkos::Profiling::pushRegion("Creating Data");
223 
224  //! [Creating The Data]
225 
226 
227  // source coordinates need copied to device before using to construct sampling data
228  Kokkos::deep_copy(source_coords_device, source_coords);
229 
230  // target coordinates copied next, because it is a convenient time to send them to device
231  Kokkos::deep_copy(target_coords_device, target_coords);
232 
233  // additional evaluation coordinates copied next, because it is a convenient time to send them to device
234  Kokkos::deep_copy(additional_target_coords_device, additional_target_coords);
235 
236  // additional evaluation indices copied next, because it is a convenient time to send them to device
237  Kokkos::deep_copy(additional_target_indices_device, additional_target_indices);
238 
239  // need Kokkos View storing true solution
240  Kokkos::View<double*, Kokkos::DefaultExecutionSpace> sampling_data_device("samples of true solution",
241  source_coords_device.extent(0));
242 
243  Kokkos::View<double**, Kokkos::DefaultExecutionSpace> gradient_sampling_data_device("samples of true gradient",
244  source_coords_device.extent(0), dimension);
245 
246  Kokkos::View<double**, Kokkos::DefaultExecutionSpace> divergence_sampling_data_device
247  ("samples of true solution for divergence test", source_coords_device.extent(0), dimension);
248 
249  Kokkos::parallel_for("Sampling Manufactured Solutions", Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>
250  (0,source_coords.extent(0)), KOKKOS_LAMBDA(const int i) {
251 
252  // coordinates of source site i
253  double xval = source_coords_device(i,0);
254  double yval = (dimension>1) ? source_coords_device(i,1) : 0;
255  double zval = (dimension>2) ? source_coords_device(i,2) : 0;
256 
257  // data for targets with scalar input
258  sampling_data_device(i) = trueSolution(xval, yval, zval, order, dimension);
259 
260  // data for targets with vector input (divergence)
261  double true_grad[3] = {0,0,0};
262  trueGradient(true_grad, xval, yval,zval, order, dimension);
263 
264  for (int j=0; j<dimension; ++j) {
265  gradient_sampling_data_device(i,j) = true_grad[j];
266 
267  // data for target with vector input (curl)
268  divergence_sampling_data_device(i,j) = divergenceTestSamples(xval, yval, zval, j, dimension);
269  }
270 
271  });
272 
273 
274  //! [Creating The Data]
275 
276  Kokkos::Profiling::popRegion();
277  Kokkos::Profiling::pushRegion("Neighbor Search");
278 
279  //! [Performing Neighbor Search]
280 
281 
282  // Point cloud construction for neighbor search
283  // CreatePointCloudSearch constructs an object of type PointCloudSearch, but deduces the templates for you
284  auto point_cloud_search(CreatePointCloudSearch(source_coords, dimension));
285 
286  // each row is a neighbor list for a target site, with the first column of each row containing
287  // the number of neighbors for that rows corresponding target site
288  double epsilon_multiplier = 1.5;
289  int estimated_upper_bound_number_neighbors =
290  point_cloud_search.getEstimatedNumberNeighborsUpperBound(min_neighbors, dimension, epsilon_multiplier);
291 
292  Kokkos::View<int**, Kokkos::DefaultExecutionSpace> neighbor_lists_device("neighbor lists",
293  number_target_coords, estimated_upper_bound_number_neighbors); // first column is # of neighbors
294  Kokkos::View<int**>::HostMirror neighbor_lists = Kokkos::create_mirror_view(neighbor_lists_device);
295 
296  // each target site has a window size
297  Kokkos::View<double*, Kokkos::DefaultExecutionSpace> epsilon_device("h supports", number_target_coords);
298  Kokkos::View<double*>::HostMirror epsilon = Kokkos::create_mirror_view(epsilon_device);
299 
300  // query the point cloud to generate the neighbor lists using a kdtree to produce the n nearest neighbor
301  // to each target site, adding (epsilon_multiplier-1)*100% to whatever the distance away the further neighbor used is from
302  // each target to the view for epsilon
303  point_cloud_search.generate2DNeighborListsFromKNNSearch(false /*not dry run*/, target_coords, neighbor_lists,
304  epsilon, min_neighbors, epsilon_multiplier);
305 
306 
307  //! [Performing Neighbor Search]
308 
309  Kokkos::Profiling::popRegion();
310  Kokkos::fence(); // let call to build neighbor lists complete before copying back to device
311  timer.reset();
312 
313  //! [Setting Up The GMLS Object]
314 
315 
316  // Copy data back to device (they were filled on the host)
317  // We could have filled Kokkos Views with memory space on the host
318  // and used these instead, and then the copying of data to the device
319  // would be performed in the GMLS class
320  Kokkos::deep_copy(neighbor_lists_device, neighbor_lists);
321  Kokkos::deep_copy(epsilon_device, epsilon);
322 
323  // solver name for passing into the GMLS class
324  std::string solver_name;
325  if (solver_type == 0) { // SVD
326  solver_name = "SVD";
327  } else if (solver_type == 1) { // QR
328  solver_name = "QR";
329  } else if (solver_type == 2) { // LU
330  solver_name = "LU";
331  }
332 
333  // problem name for passing into the GMLS class
334  std::string problem_name;
335  if (problem_type == 0) { // Standard
336  problem_name = "STANDARD";
337  } else if (problem_type == 1) { // Manifold
338  problem_name = "MANIFOLD";
339  }
340 
341  // boundary name for passing into the GMLS class
342  std::string constraint_name;
343  if (constraint_type == 0) { // No constraints
344  constraint_name = "NO_CONSTRAINT";
345  } else if (constraint_type == 1) { // Neumann Gradient Scalar
346  constraint_name = "NEUMANN_GRAD_SCALAR";
347  }
348 
349  // initialize an instance of the GMLS class
351  order, dimension,
352  solver_name.c_str(), problem_name.c_str(), constraint_name.c_str(),
353  2 /*manifold order*/);
354 
355  // pass in neighbor lists, source coordinates, target coordinates, and window sizes
356  //
357  // neighbor lists have the format:
358  // dimensions: (# number of target sites) X (# maximum number of neighbors for any given target + 1)
359  // the first column contains the number of neighbors for that rows corresponding target index
360  //
361  // source coordinates have the format:
362  // dimensions: (# number of source sites) X (dimension)
363  // entries in the neighbor lists (integers) correspond to rows of this 2D array
364  //
365  // target coordinates have the format:
366  // dimensions: (# number of target sites) X (dimension)
367  // # of target sites is same as # of rows of neighbor lists
368  //
369  my_GMLS.setProblemData(neighbor_lists_device, source_coords_device, target_coords_device, epsilon_device);
370 
371  // set up additional sites to evaluate target operators
372  my_GMLS.setAdditionalEvaluationSitesData(additional_target_indices_device, additional_target_coords_device);
373 
374  // create a vector of target operations
375  std::vector<TargetOperation> lro(2);
376  lro[0] = ScalarPointEvaluation;
378 
379  // and then pass them to the GMLS class
380  my_GMLS.addTargets(lro);
381 
382  // sets the weighting kernel function from WeightingFunctionType
383  my_GMLS.setWeightingType(WeightingFunctionType::Power);
384 
385  // power to use in that weighting kernel function
386  my_GMLS.setWeightingPower(2);
387 
388  // generate the alphas that to be combined with data for each target operation requested in lro
389  my_GMLS.generateAlphas();
390 
391 
392  //! [Setting Up The GMLS Object]
393 
394  double instantiation_time = timer.seconds();
395  std::cout << "Took " << instantiation_time << "s to complete alphas generation." << std::endl;
396  Kokkos::fence(); // let generateAlphas finish up before using alphas
397  Kokkos::Profiling::pushRegion("Apply Alphas to Data");
398 
399  //! [Apply GMLS Alphas To Data]
400 
401  // it is important to note that if you expect to use the data as a 1D view, then you should use double*
402  // however, if you know that the target operation will result in a 2D view (vector or matrix output),
403  // then you should template with double** as this is something that can not be infered from the input data
404  // or the target operator at compile time. Additionally, a template argument is required indicating either
405  // Kokkos::HostSpace or Kokkos::DefaultExecutionSpace::memory_space()
406 
407  // The Evaluator class takes care of handling input data views as well as the output data views.
408  // It uses information from the GMLS class to determine how many components are in the input
409  // as well as output for any choice of target functionals and then performs the contactions
410  // on the data using the alpha coefficients generated by the GMLS class, all on the device.
411  Evaluator gmls_evaluator(&my_GMLS);
412 
413  auto output_value1 = gmls_evaluator.applyAlphasToDataAllComponentsAllTargetSites<double*, Kokkos::HostSpace>
414  (sampling_data_device, ScalarPointEvaluation, PointSample,
415  true /*scalar_as_vector_if_needed*/, 1 /*evaluation site index*/);
416 
417  auto output_gradient1 = gmls_evaluator.applyAlphasToDataAllComponentsAllTargetSites<double**, Kokkos::HostSpace>
418  (sampling_data_device, GradientOfScalarPointEvaluation, PointSample,
419  true /*scalar_as_vector_if_needed*/, 1 /*evaluation site index*/);
420 
421  auto output_value2 = gmls_evaluator.applyAlphasToDataAllComponentsAllTargetSites<double*, Kokkos::HostSpace>
422  (sampling_data_device, ScalarPointEvaluation, PointSample,
423  true /*scalar_as_vector_if_needed*/, 2 /*evaluation site index*/);
424 
425  auto output_gradient2 = gmls_evaluator.applyAlphasToDataAllComponentsAllTargetSites<double**, Kokkos::HostSpace>
426  (sampling_data_device, GradientOfScalarPointEvaluation, PointSample,
427  true /*scalar_as_vector_if_needed*/, 2 /*evaluation site index*/);
428 
429  auto output_value3 = gmls_evaluator.applyAlphasToDataAllComponentsAllTargetSites<double*, Kokkos::HostSpace>
430  (sampling_data_device, ScalarPointEvaluation, PointSample,
431  true /*scalar_as_vector_if_needed*/, 3 /*evaluation site index*/);
432 
433  auto output_gradient3 = gmls_evaluator.applyAlphasToDataAllComponentsAllTargetSites<double**, Kokkos::HostSpace>
434  (sampling_data_device, GradientOfScalarPointEvaluation, PointSample,
435  true /*scalar_as_vector_if_needed*/, 3 /*evaluation site index*/);
436 
437  //! [Apply GMLS Alphas To Data]
438 
439  Kokkos::fence(); // let application of alphas to data finish before using results
440  Kokkos::Profiling::popRegion();
441  // times the Comparison in Kokkos
442  Kokkos::Profiling::pushRegion("Comparison");
443 
444  //! [Check That Solutions Are Correct]
445 
446  // load value from output
447  double GMLS_value;
448  // load partial x from gradient
449  double GMLS_GradX;
450  // load partial y from gradient
451  double GMLS_GradY;
452  // load partial z from gradient
453  double GMLS_GradZ;
454 
455  // loop through the target sites
456  extra_evaluation_coordinates_count = 0;
457  for (int i=0; i<number_target_coords; i++) {
458 
459  for (int k=0; k<(i%3)+1; ++k) {
460  if (k==0) {
461  // load value from output
462  GMLS_value = output_value1(i);
463  // load partial x from gradient
464  GMLS_GradX = output_gradient1(i,0);
465  // load partial y from gradient
466  GMLS_GradY = (dimension>1) ? output_gradient1(i,1) : 0;
467  // load partial z from gradient
468  GMLS_GradZ = (dimension>2) ? output_gradient1(i,2) : 0;
469  } else if (k==1) {
470  // load value from output
471  GMLS_value = output_value2(i);
472  // load partial x from gradient
473  GMLS_GradX = output_gradient2(i,0);
474  // load partial y from gradient
475  GMLS_GradY = (dimension>1) ? output_gradient2(i,1) : 0;
476  // load partial z from gradient
477  GMLS_GradZ = (dimension>2) ? output_gradient2(i,2) : 0;
478  } else if (k==2) {
479  // load value from output
480  GMLS_value = output_value3(i);
481  // load partial x from gradient
482  GMLS_GradX = output_gradient3(i,0);
483  // load partial y from gradient
484  GMLS_GradY = (dimension>1) ? output_gradient3(i,1) : 0;
485  // load partial z from gradient
486  GMLS_GradZ = (dimension>2) ? output_gradient3(i,2) : 0;
487  }
488 
489  // target site i's coordinate
490  double xval = additional_target_coords(extra_evaluation_coordinates_count,0);
491  double yval = additional_target_coords(extra_evaluation_coordinates_count,1);
492  double zval = additional_target_coords(extra_evaluation_coordinates_count,2);
493 
494  // evaluation of various exact solutions
495  double actual_value = trueSolution(xval, yval, zval, order, dimension);
496 
497  double actual_Gradient[3] = {0,0,0}; // initialized for 3, but only filled up to dimension
498  trueGradient(actual_Gradient, xval, yval, zval, order, dimension);
499 
500  // check actual function value
501  if(GMLS_value!=GMLS_value || std::abs(actual_value - GMLS_value) > failure_tolerance) {
502  all_passed = false;
503  std::cout << i << " Failed Actual by: " << std::abs(actual_value - GMLS_value) << " for evaluation site: " << k << std::endl;
504  }
505 
506  // check gradient
507  if(std::abs(actual_Gradient[0] - GMLS_GradX) > failure_tolerance) {
508  all_passed = false;
509  std::cout << i << " Failed GradX by: " << std::abs(actual_Gradient[0] - GMLS_GradX) << " for evaluation site: " << k << std::endl;
510  if (dimension>1) {
511  if(std::abs(actual_Gradient[1] - GMLS_GradY) > failure_tolerance) {
512  all_passed = false;
513  std::cout << i << " Failed GradY by: " << std::abs(actual_Gradient[1] - GMLS_GradY) << " for evaluation site: " << k << std::endl;
514  }
515  }
516  if (dimension>2) {
517  if(std::abs(actual_Gradient[2] - GMLS_GradZ) > failure_tolerance) {
518  all_passed = false;
519  std::cout << i << " Failed GradZ by: " << std::abs(actual_Gradient[2] - GMLS_GradZ) << " for evaluation site: " << k << std::endl;
520  }
521  }
522  }
523  extra_evaluation_coordinates_count++;
524  }
525  }
526 
527 
528  //! [Check That Solutions Are Correct]
529  // popRegion hidden from tutorial
530  // stop timing comparison loop
531  Kokkos::Profiling::popRegion();
532  //! [Finalize Program]
533 
534 
535 } // end of code block to reduce scope, causing Kokkos View de-allocations
536 // otherwise, Views may be deallocating when we call Kokkos::finalize() later
537 
538 // finalize Kokkos and MPI (if available)
539 Kokkos::finalize();
540 #ifdef COMPADRE_USE_MPI
541 MPI_Finalize();
542 #endif
543 
544 // output to user that test passed or failed
545 if(all_passed) {
546  fprintf(stdout, "Passed test \n");
547  return 0;
548 } else {
549  fprintf(stdout, "Failed test \n");
550  return -1;
551 }
552 
553 } // main
554 
555 
556 //! [Finalize Program]
Lightweight Evaluator Helper This class is a lightweight wrapper for extracting and applying all rele...
PointCloudSearch< view_type > CreatePointCloudSearch(view_type src_view, const local_index_type dimensions=-1, const local_index_type max_leaf=-1)
CreatePointCloudSearch allows for the construction of an object of type PointCloudSearch with templat...
Point evaluation of a scalar.
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 void trueGradient(double *ans, double x, double y, double z, int order, int dimension)
Scalar basis reused as many times as there are components in the vector resulting in a much cheaper p...
Kokkos::View< output_data_type, output_array_layout, output_memory_space > applyAlphasToDataAllComponentsAllTargetSites(view_type_input_data sampling_data, TargetOperation lro, const SamplingFunctional sro_in=PointSample, bool scalar_as_vector_if_needed=true, const int evaluation_site_local_index=0) const
Transformation of data under GMLS.
int main(int argc, char *args[])
[Parse Command Line Arguments]
Point evaluation of the gradient of a scalar.
Generalized Moving Least Squares (GMLS)
KOKKOS_INLINE_FUNCTION double divergenceTestSamples(double x, double y, double z, int component, int dimension)
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) ...
constexpr SamplingFunctional PointSample
Available sampling functionals.
KOKKOS_INLINE_FUNCTION double trueSolution(double x, double y, double z, int order, int dimension)
#define compadre_assert_release(condition)
compadre_assert_release is used for assertions that should always be checked, but generally are not e...
constexpr SamplingFunctional VectorPointSample
Point evaluations of the entire vector source function.