26 #ifndef O2SCL_CONTOUR_H 27 #define O2SCL_CONTOUR_H 31 #include <gsl/gsl_math.h> 33 #include <boost/numeric/ublas/vector.hpp> 34 #include <boost/numeric/ublas/matrix.hpp> 36 #include <o2scl/interp.h> 37 #include <o2scl/uniform_grid.h> 39 #ifndef DOXYGEN_NO_O2NS 59 std::vector<double>
x;
61 std::vector<double>
y;
76 if (
this==&c)
return *
this;
128 if (
this==&ec)
return *
this;
265 template<
class vec_t,
class mat_t>
266 void set_data(
size_t sizex,
size_t sizey,
const vec_t &x_fun,
267 const vec_t &y_fun,
const mat_t &udata) {
269 if (sizex<2 || sizey<2) {
270 O2SCL_ERR(
"Not enough data (must be at least 2x2) in set_data().",
279 for(
int i=0;i<nx;i++) xfun[i]=x_fun[i];
280 for(
int i=0;i<ny;i++) yfun[i]=y_fun[i];
281 for(
int i=0;i<nx;i++) {
282 for(
int j=0;j<ny;j++) {
283 data(i,j)=udata(i,j);
301 template<
class mat_t>
304 const mat_t &udata) {
309 if (sizex<2 || sizey<2) {
310 O2SCL_ERR(
"Not enough data (must be at least 2x2) in set_data().",
319 for(
int i=0;i<nx;i++) xfun[i]=ugx[i];
320 for(
int i=0;i<ny;i++) yfun[i]=ugy[i];
321 for(
int i=0;i<nx;i++) {
322 for(
int j=0;j<ny;j++) {
323 data(i,j)=udata(i,j);
337 template<
class vec_t>
void set_levels(
size_t nlevels, vec_t &ulevels) {
339 levels.resize(nlevels);
340 for(
size_t i=0;i<nlevels;i++) {
341 levels[i]=ulevels[i];
353 void calc_contours(std::vector<contour_line> &clines);
373 void regrid_data(
size_t xfact,
size_t yfact,
387 void get_data(
size_t &sizex,
size_t &sizey, ubvector *&x_fun,
388 ubvector *&y_fun, ubmatrix *&udata) {
406 std::vector<edge_crossings> &y_edges) {
443 static const int empty=0;
444 static const int edge=1;
445 static const int contourp=2;
446 static const int endpoint=3;
449 #ifndef DOXYGEN_INTERNAL 455 static const int dxdir=0;
456 static const int dydir=1;
461 static const int efound=1;
462 static const int enot_found=0;
480 std::vector<edge_crossings>
yed;
482 std::vector<edge_crossings>
xed;
485 int find_next_point_y_direct(
int j,
int k,
int &jnext,
int &knext,
486 int &dir_next,
int nsw,
491 int find_next_point_x_direct(
int j,
int k,
int &jnext,
int &knext,
492 int &dir_next,
int nsw,
497 void find_intersections(
size_t ilev,
double &
level,
509 void process_line(
int j,
int k,
int dir, std::vector<double> &
x,
510 std::vector<double> &
y,
526 #ifndef DOXYGEN_NO_O2NS edge_crossings()
Create an empty object.
Edges for the contour class.
The main O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl names...
contour_line()
Create an empty line.
edge_crossings(const edge_crossings &ec)
Copy constructor.
invalid argument supplied by user
contour_line(const contour_line &c)
Copy constructor.
void set_data(size_t sizex, size_t sizey, const vec_t &x_fun, const vec_t &y_fun, const mat_t &udata)
Set the data.
Cubic spline for natural boundary conditions.
void get_data(size_t &sizex, size_t &sizey, ubvector *&x_fun, ubvector *&y_fun, ubmatrix *&udata)
Get the data.
std::vector< edge_crossings > xed
Bottom edge list.
Calculate contour lines from a two-dimensional data set.
ubmatrix_int status
Edge status.
ubmatrix values
Edge values.
std::vector< double > x
The line x coordinates.
#define O2SCL_ERR(d, n)
Set an error with message d and code n.
void set_data(const uniform_grid< double > &ugx, const uniform_grid< double > &ugy, const mat_t &udata)
Set the data.
double lev_adjust
(default )
std::vector< edge_crossings > yed
Right edge list.
int verbose
Verbosity parameter (default 0)
double level
The contour level.
void set_levels(size_t nlevels, vec_t &ulevels)
Set the contour levels.
edge_crossings & operator=(const edge_crossings &ec)
Copy constructor with operator=()
contour_line & operator=(const contour_line &c)
Copy constructor with operator=()
std::vector< double > y
The line y coordinates.
bool debug_next_point
If true, debug the functions which determine the next point functions (default false)p.
Interpolation class for general vectors.
void get_edges(std::vector< edge_crossings > &x_edges, std::vector< edge_crossings > &y_edges)
Return the edges for each contour level.