XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
range_view.hpp
Go to the documentation of this file.
1 #ifndef RANGE_VIEW_HPP
2 #define RANGE_VIEW_HPP
3 #include "space_settings.hpp"
4 
5 // Create range
6 inline View<double*, HostType> create_range_view(std::string name, double x_min, double x_max, int n){
7  View<double*, HostType> range(NoInit(name), n);
8  double dx = (x_max - x_min)/(n-1);
9  for(int i = 0; i<n; i++){
10  range(i) = x_min + i*dx;
11  }
12  // To ensure to machine precision
13  range(n-1) = x_max;
14 
15  return range;
16 }
17 
18 #endif
View< double *, HostType > create_range_view(std::string name, double x_min, double x_max, int n)
Definition: range_view.hpp:6
Kokkos::ViewAllocateWithoutInitializing NoInit
Definition: space_settings.hpp:69