OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
util.hpp
1 /*
2  * util.hpp
3  *
4  * Created on: Feb 23, 2016
5  * Author: i-bird
6  */
7 
8 #ifndef OPENFPM_IO_SRC_PLOT_UTIL_HPP_
9 #define OPENFPM_IO_SRC_PLOT_UTIL_HPP_
10 
19 template<typename T> static inline void Fill1D(T start, T stop, size_t np, openfpm::vector<T> & x,T f(T x))
20 {
21  x.resize(np);
22 
23  T spacing = (stop - start) / (np - 1);
24 
25  for (size_t i = 0 ; i < np ; i++)
26  x.get(i) = f(start + i*spacing);
27 }
28 
35 template<typename T> static inline void Fill1D(T start, T stop, size_t np, openfpm::vector<T> & x)
36 {
37  x.resize(np);
38 
39  T spacing = (stop - start) / (np - 1);
40 
41  for (size_t i = 0 ; i < np ; i++)
42  x.get(i) = start + i*spacing;
43 }
44 
45 #endif /* OPENFPM_IO_SRC_PLOT_UTIL_HPP_ */
Implementation of 1-D std::vector like structure.
Definition: map_vector.hpp:61