Go to the documentation of this file.
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];
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;
486 int &dir_next,
int nsw,
492 int &dir_next,
int nsw,
509 void process_line(
int j,
int k,
int dir, std::vector<double> &x,
510 std::vector<double> &y,
526 #ifndef DOXYGEN_NO_O2NS
int find_next_point_x_direct(int j, int k, int &jnext, int &knext, int &dir_next, int nsw, edge_crossings &xedges, edge_crossings &yedges)
Find next point starting from a point on a bottom edge.
void edges_in_y_direct(double level, interp< ubvector > &si, edge_crossings &yedges)
Interpolate all right edge crossings.
contour_line()
Create an empty line.
void set_levels(size_t nlevels, vec_t &ulevels)
Set the contour levels.
ubmatrix_int status
Edge status.
int find_next_point_y_direct(int j, int k, int &jnext, int &knext, int &dir_next, int nsw, edge_crossings &xedges, edge_crossings &yedges)
Find next point starting from a point on a right edge.
Edges for the contour class.
void find_intersections(size_t ilev, double &level, edge_crossings &xedges, edge_crossings &yedges)
Find all of the intersections of the edges with the contour level.
std::vector< edge_crossings > yed
Right edge list.
int verbose
Verbosity parameter (default 0)
double lev_adjust
(default )
The main O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl names...
contour_line(const contour_line &c)
Copy constructor.
edge_crossings & operator=(const edge_crossings &ec)
Copy constructor with operator=()
void get_data(size_t &sizex, size_t &sizey, ubvector *&x_fun, ubvector *&y_fun, ubmatrix *&udata)
Get the data.
Calculate contour lines from a two-dimensional data set.
void regrid_data(size_t xfact, size_t yfact, size_t interp_type=o2scl::itp_cspline)
Regrid the data.
edge_crossings(const edge_crossings &ec)
Copy constructor.
edge_crossings()
Create an empty object.
void set_data(const uniform_grid< double > &ugx, const uniform_grid< double > &ugy, const mat_t &udata)
Set the data.
@ exc_einval
invalid argument supplied by user
void calc_contours(std::vector< contour_line > &clines)
Calculate the contours.
void check_data()
Check to ensure the x- and y-arrays are monotonic.
void print_edges_xhoriz(edge_crossings &xedges, edge_crossings &yedges)
Print out the edges to cout.
contour_line & operator=(const contour_line &c)
Copy constructor with operator=()
void process_line(int j, int k, int dir, std::vector< double > &x, std::vector< double > &y, bool first, edge_crossings &xedges, edge_crossings &yedges)
Create a contour line from a starting edge.
void get_edges(std::vector< edge_crossings > &x_edges, std::vector< edge_crossings > &y_edges)
Return the edges for each contour level.
ubmatrix values
Edge values.
double level
The contour level.
Interpolation class for general vectors.
#define O2SCL_ERR(d, n)
Set an error with message d and code n.
void print_edges_yhoriz(edge_crossings &xedges, edge_crossings &yedges)
Print out the edges to cout.
@ itp_cspline
Cubic spline for natural boundary conditions.
bool debug_next_point
If true, debug the functions which determine the next point functions (default false)p.
std::vector< edge_crossings > xed
Bottom edge list.
std::vector< double > x
The line x coordinates.
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.
std::vector< double > y
The line y coordinates.
void edges_in_x_direct(double level, interp< ubvector > &si, edge_crossings &xedges)
Interpolate all bottom edge crossings.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).