23 #ifndef O2SCL_UNIFORM_GRID_H
24 #define O2SCL_UNIFORM_GRID_H
31 #include <boost/numeric/ublas/vector.hpp>
33 #include <o2scl/err_hnd.h>
34 #include <o2scl/string_conv.h>
50 #ifndef DOXYGEN_NO_O2NS
54 #ifdef O2SCL_NEVER_DEFINED
57 template<
class data_t>
class uniform_grid;
92 template<
class data_t=
double>
class uniform_grid {
135 O2SCL_ERR2(
"Requested grid with start==end in ",
140 O2SCL_ERR2(
"Requested width <=1 for logrithmic grid in ",
145 O2SCL_ERR2(
"Requested negative or zero width for linear grid in ",
181 O2SCL_ERR(
"Grid not set in uniform_grid::get_npoints().",
193 O2SCL_ERR(
"Grid not set in uniform_grid::get_npoints().",
206 template<
class resize_vec_t>
void vector(resize_vec_t &v)
const {
209 O2SCL_ERR(
"Grid not set in uniform_grid::get_npoints().",
230 O2SCL_ERR(
"Grid not set in uniform_grid::get_npoints().",
234 #if !O2SCL_NO_RANGE_CHECK
238 " in uniform_grid::operator[].";
319 uniform_grid<data_t>(start,end,(end-start)/((data_t)n_bins),
337 uniform_grid<data_t>(start,start+n_bins*width,width,n_bins,false) {
355 ((size_t)((end-start)/width)),false) {
372 uniform_grid<data_t>(start,end,std::pow(end/start,1.0/((data_t)n_bins)),
390 uniform_grid<data_t>(start,start*std::pow(width,n_bins),
409 ((size_t)(log(end/start)/log(width))),true) {
413 #ifndef DOXYGEN_NO_O2NS
void hdf_output(hdf_file &hf, std::vector< o2scl::edge_crossings > &ec, std::string name)
Output a vector of o2scl::edge_crossings objects to a hdf_file.
invalid argument supplied by user
#define O2SCL_ERR2(d, d2, n)
Set an error, two-string version.
#define O2SCL_ERR(d, n)
Set an error with message d and code n.
void hdf_output(hdf_file &hf, o2scl::uniform_grid< double > &t, std::string name)
Output a o2scl::uniform_grid object to a hdf_file.
Store data in an O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl...
Invalid index for array or matrix.
std::string szttos(size_t x)
Convert a size_t to a string.
void hdf_input(hdf_file &hf, o2scl::uniform_grid< double > &t, std::string name)
Input a o2scl::uniform_grid object from a hdf_file.
void hdf_input(hdf_file &hf, o2scl::table< vec_t > &t, std::string name)
Input a o2scl::table object from a hdf_file.