Set of functions to generate points. More...
#include <vector>
#include <cmath>
#include "../tessellation/geometry.hpp"
#include <algorithm>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_real_distribution.hpp>
Go to the source code of this file.
Functions | |
std::vector< Vector2D > | cartesian_mesh (int nx, int ny, Vector2D const &lower_left, Vector2D const &upper_right) |
Generates a cartesian mesh. More... | |
std::vector< Vector2D > | CirclePointsRmax (int PointNum, double Rmin, double Rmax, double xmax, double ymax, double xmin, double ymin, double xc=0, double yc=0) |
Generates a round grid with constant point density. More... | |
std::vector< Vector2D > | CirclePointsRmax_2 (int PointNum, double Rmin, double Rmax, double xc=0, double yc=0, double xmax=1, double ymax=1, double xmin=-1, double ymin=1) |
Generates a round grid with 1/r^2 point density confined to a rectangle given by xmin,xmax,ymin and ymax. More... | |
std::vector< Vector2D > | CirclePointsRmax_1 (int PointNum, double Rmin, double Rmax, double xc=0, double yc=0, double xmax=1, double ymax=1, double xmin=-1, double ymin=-1) |
Generates a round grid with 1/r point density confined to a rectangle given by xmin,xmax,ymin and ymax. More... | |
std::vector< Vector2D > | circle_circumference (size_t point_number, double radius, Vector2D const ¢er, double angle_start=0, double angle_end=2 *M_PI) |
Creates a circle of evenly spaced points. More... | |
std::vector< Vector2D > | Line (int PointNum, double xmin, double xmax, double ymin, double ymax) |
Creates a line of evenly spaced points y=slope*x+b. More... | |
std::vector< Vector2D > | CirclePointsRmax_a (int PointNum, double Rmin, double Rmax, double xc, double yc, double xmax, double ymax, double xmin, double ymin, double alpha, double angle_start=0, double angle_end=2 *M_PI) |
Generates a round grid with r^alpha point density confined to a rectangle given by xmin,xmax,ymin and ymax. More... | |
std::vector< Vector2D > | RandPointsR (int PointNum, double xl=-0.5, double xr=0.5, double yd=-0.5, double yu=0.5, double minR=0, double xc=0, double yc=0) |
Generates a rectangular grid with random 1/r point density. More... | |
std::vector< Vector2D > | RandSquare (int PointNum, Vector2D const &lowerleft, Vector2D const &upperright) |
Generates a random rectangular grid with uniform point density and a constant seed. More... | |
std::vector< Vector2D > | RandSquare (int PointNum, double xl=-0.5, double xr=0.5, double yd=-0.5, double yu=0.5) |
Generates a random rectangular grid with uniform point density and a constant seed. More... | |
std::vector< Vector2D > | RandSquare (int PointNum, boost::random::mt19937 &eng, double xl=-0.5, double xr=0.5, double yd=-0.5, double yu=0.5) |
Generates a random rectangular grid with uniform point density. This is when reseting the seed between calls isn't wanted. More... | |
std::vector< Vector2D > | RandPointsRa (int PointNum, double Rmin, double Rmax, double alpha, Vector2D const &lowerleft, Vector2D const &upperright, Vector2D const ¢er=Vector2D(0, 0)) |
Generates a random round grid with r^(1-a) point density. More... | |
std::vector< Vector2D > | RandPointsRmax (int PointNum, double Rmin, double Rmax, double xc=0, double yc=0) |
Generates a random round grid with 1/r point density. More... | |
Set of functions to generate points.
Definition in file mesh_generator.hpp.
std::vector<Vector2D> cartesian_mesh | ( | int | nx, |
int | ny, | ||
Vector2D const & | lower_left, | ||
Vector2D const & | upper_right | ||
) |
Generates a cartesian mesh.
nx | Number of points along the x axis |
ny | Number of points along the y axis |
lower_left | Lower left point |
upper_right | Upper right point |
Definition at line 194 of file mesh_generator.cpp.
std::vector<Vector2D> circle_circumference | ( | size_t | point_number, |
double | radius, | ||
Vector2D const & | center, | ||
double | angle_start = 0 , |
||
double | angle_end = 2 *M_PI |
||
) |
Creates a circle of evenly spaced points.
point_number | Number of points along the circumference |
radius | Radius of the circle |
center | Position of the center of the circle |
Definition at line 216 of file mesh_generator.cpp.
std::vector<Vector2D> CirclePointsRmax | ( | int | PointNum, |
double | Rmin, | ||
double | Rmax, | ||
double | xmax, | ||
double | ymax, | ||
double | xmin, | ||
double | ymin, | ||
double | xc = 0 , |
||
double | yc = 0 |
||
) |
Generates a round grid with constant point density.
PointNum | The number of points. |
Rmin | The min radius |
Rmax | The max radius |
xc | X of circle center |
yc | Y of circle center |
xmin | Left edge of confining rectangle |
xmax | Right edge of confining rectangle |
ymax | Upper edge of confining rectangle |
ymin | Lower edge of confining rectangle |
Definition at line 172 of file mesh_generator.cpp.
std::vector<Vector2D> CirclePointsRmax_1 | ( | int | PointNum, |
double | Rmin, | ||
double | Rmax, | ||
double | xc = 0 , |
||
double | yc = 0 , |
||
double | xmax = 1 , |
||
double | ymax = 1 , |
||
double | xmin = -1 , |
||
double | ymin = -1 |
||
) |
Generates a round grid with 1/r point density confined to a rectangle given by xmin,xmax,ymin and ymax.
PointNum | The number of points. |
Rmin | The min radius |
Rmax | The max radius |
xc | X of circle center |
yc | Y of circle center |
xmin | Left edge of confining rectangle |
xmax | Right edge of confining rectangle |
ymax | Upper edge of confining rectangle |
ymin | Lower edge of confining rectangle |
Definition at line 129 of file mesh_generator.cpp.
std::vector<Vector2D> CirclePointsRmax_2 | ( | int | PointNum, |
double | Rmin, | ||
double | Rmax, | ||
double | xc = 0 , |
||
double | yc = 0 , |
||
double | xmax = 1 , |
||
double | ymax = 1 , |
||
double | xmin = -1 , |
||
double | ymin = 1 |
||
) |
Generates a round grid with 1/r^2 point density confined to a rectangle given by xmin,xmax,ymin and ymax.
PointNum | The number of points. |
Rmin | The min radius |
Rmax | The max radius |
xc | X of circle center |
yc | Y of circle center |
xmin | Left edge of confining rectangle |
xmax | Right edge of confining rectangle |
ymax | Upper edge of confining rectangle |
ymin | Lower edge of confining rectangle |
Definition at line 150 of file mesh_generator.cpp.
std::vector<Vector2D> CirclePointsRmax_a | ( | int | PointNum, |
double | Rmin, | ||
double | Rmax, | ||
double | xc, | ||
double | yc, | ||
double | xmax, | ||
double | ymax, | ||
double | xmin, | ||
double | ymin, | ||
double | alpha, | ||
double | angle_start = 0 , |
||
double | angle_end = 2 *M_PI |
||
) |
Generates a round grid with r^alpha point density confined to a rectangle given by xmin,xmax,ymin and ymax.
PointNum | The number of points. |
Rmin | The min radius |
Rmax | The max radius |
xc | X of circle center |
yc | Y of circle center |
xmin | Left edge of confining rectangle |
xmax | Right edge of confining rectangle |
ymax | Upper edge of confining rectangle |
ymin | Lower edge of confining rectangle |
alpha | The point density, should not be -1 or -2 |
Definition at line 247 of file mesh_generator.cpp.
std::vector<Vector2D> Line | ( | int | PointNum, |
double | xmin, | ||
double | xmax, | ||
double | ymin, | ||
double | ymax | ||
) |
Creates a line of evenly spaced points y=slope*x+b.
PointNum | The number of points |
xmin | The minimum x of the line |
xmax | The maximum x of the line |
ymin | The minimum y of the line |
ymax | The maximum y of the line |
Definition at line 229 of file mesh_generator.cpp.
std::vector<Vector2D> RandPointsR | ( | int | PointNum, |
double | xl = -0.5 , |
||
double | xr = 0.5 , |
||
double | yd = -0.5 , |
||
double | yu = 0.5 , |
||
double | minR = 0 , |
||
double | xc = 0 , |
||
double | yc = 0 |
||
) |
Generates a rectangular grid with random 1/r point density.
PointNum | The number of points. |
xl | The left boundary |
xr | The right boundary |
yd | The lower boundary |
yu | The upper boundary |
minR | The inner radius in which there are no points |
xc | The X of center of the circle |
yc | The Y of center of the circle |
Definition at line 100 of file mesh_generator.cpp.
std::vector<Vector2D> RandPointsRa | ( | int | PointNum, |
double | Rmin, | ||
double | Rmax, | ||
double | alpha, | ||
Vector2D const & | lowerleft, | ||
Vector2D const & | upperright, | ||
Vector2D const & | center = Vector2D(0, 0) |
||
) |
Generates a random round grid with r^(1-a) point density.
PointNum | The number of points. |
Rmin | The min radius |
Rmax | The max radius |
alpha | The radial density of the points, shouldn't be 1 |
lowerleft | The lowerleft corner of the domain |
upperright | The upperright corner of the domain |
center | The center of the coordinates system |
Definition at line 73 of file mesh_generator.cpp.
std::vector<Vector2D> RandPointsRmax | ( | int | PointNum, |
double | Rmin, | ||
double | Rmax, | ||
double | xc = 0 , |
||
double | yc = 0 |
||
) |
Generates a random round grid with 1/r point density.
PointNum | The number of points. |
Rmin | The min radius |
Rmax | The max radius |
xc | X of circle center |
yc | Y of circle center |
Definition at line 11 of file mesh_generator.cpp.
std::vector<Vector2D> RandSquare | ( | int | PointNum, |
Vector2D const & | lowerleft, | ||
Vector2D const & | upperright | ||
) |
Generates a random rectangular grid with uniform point density and a constant seed.
PointNum | The number of points. |
lowerleft | The lower left point of the domain |
upperright | The upper right point of the domain |
Definition at line 6 of file mesh_generator.cpp.
std::vector<Vector2D> RandSquare | ( | int | PointNum, |
double | xl = -0.5 , |
||
double | xr = 0.5 , |
||
double | yd = -0.5 , |
||
double | yu = 0.5 |
||
) |
Generates a random rectangular grid with uniform point density and a constant seed.
PointNum | The number of points. |
xl | The left boundary |
xr | The right boundary |
yd | The lower boundary |
yu | The upper boundary |
Definition at line 32 of file mesh_generator.cpp.
std::vector<Vector2D> RandSquare | ( | int | PointNum, |
boost::random::mt19937 & | eng, | ||
double | xl = -0.5 , |
||
double | xr = 0.5 , |
||
double | yd = -0.5 , |
||
double | yu = 0.5 |
||
) |
Generates a random rectangular grid with uniform point density. This is when reseting the seed between calls isn't wanted.
PointNum | The number of points. |
eng | The random number generator |
xl | The left boundary |
xr | The right boundary |
yd | The lower boundary |
yu | The upper boundary |
Definition at line 53 of file mesh_generator.cpp.