Functions
mesh_generator.hpp File Reference

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>
Include dependency graph for mesh_generator.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::vector< Vector2Dcartesian_mesh (int nx, int ny, Vector2D const &lower_left, Vector2D const &upper_right)
 Generates a cartesian mesh. More...
 
std::vector< Vector2DCirclePointsRmax (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< Vector2DCirclePointsRmax_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< Vector2DCirclePointsRmax_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< Vector2Dcircle_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. More...
 
std::vector< Vector2DLine (int PointNum, double xmin, double xmax, double ymin, double ymax)
 Creates a line of evenly spaced points y=slope*x+b. More...
 
std::vector< Vector2DCirclePointsRmax_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< Vector2DRandPointsR (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< Vector2DRandSquare (int PointNum, Vector2D const &lowerleft, Vector2D const &upperright)
 Generates a random rectangular grid with uniform point density and a constant seed. More...
 
std::vector< Vector2DRandSquare (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< Vector2DRandSquare (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< Vector2DRandPointsRa (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. More...
 
std::vector< Vector2DRandPointsRmax (int PointNum, double Rmin, double Rmax, double xc=0, double yc=0)
 Generates a random round grid with 1/r point density. More...
 

Detailed Description

Set of functions to generate points.

Author
Elad Steinberg

Definition in file mesh_generator.hpp.

Function Documentation

◆ cartesian_mesh()

std::vector<Vector2D> cartesian_mesh ( int  nx,
int  ny,
Vector2D const &  lower_left,
Vector2D const &  upper_right 
)

Generates a cartesian mesh.

Parameters
nxNumber of points along the x axis
nyNumber of points along the y axis
lower_leftLower left point
upper_rightUpper right point
Returns
Set of two dimensional points

Definition at line 194 of file mesh_generator.cpp.

Here is the call graph for this function:

◆ circle_circumference()

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.

Parameters
point_numberNumber of points along the circumference
radiusRadius of the circle
centerPosition of the center of the circle
Returns
List of two dimensional points

Definition at line 216 of file mesh_generator.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CirclePointsRmax()

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.

Parameters
PointNumThe number of points.
RminThe min radius
RmaxThe max radius
xcX of circle center
ycY of circle center
xminLeft edge of confining rectangle
xmaxRight edge of confining rectangle
ymaxUpper edge of confining rectangle
yminLower edge of confining rectangle
Returns
List of two dimensional points

Definition at line 172 of file mesh_generator.cpp.

◆ CirclePointsRmax_1()

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.

Parameters
PointNumThe number of points.
RminThe min radius
RmaxThe max radius
xcX of circle center
ycY of circle center
xminLeft edge of confining rectangle
xmaxRight edge of confining rectangle
ymaxUpper edge of confining rectangle
yminLower edge of confining rectangle
Returns
List of two dimensional points

Definition at line 129 of file mesh_generator.cpp.

◆ CirclePointsRmax_2()

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.

Parameters
PointNumThe number of points.
RminThe min radius
RmaxThe max radius
xcX of circle center
ycY of circle center
xminLeft edge of confining rectangle
xmaxRight edge of confining rectangle
ymaxUpper edge of confining rectangle
yminLower edge of confining rectangle
Returns
List of two dimensional points

Definition at line 150 of file mesh_generator.cpp.

◆ CirclePointsRmax_a()

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.

Parameters
PointNumThe number of points.
RminThe min radius
RmaxThe max radius
xcX of circle center
ycY of circle center
xminLeft edge of confining rectangle
xmaxRight edge of confining rectangle
ymaxUpper edge of confining rectangle
yminLower edge of confining rectangle
alphaThe point density, should not be -1 or -2
Returns
List of two dimensional points

Definition at line 247 of file mesh_generator.cpp.

◆ Line()

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.

Parameters
PointNumThe number of points
xminThe minimum x of the line
xmaxThe maximum x of the line
yminThe minimum y of the line
ymaxThe maximum y of the line
Returns
List of two dimensional points

Definition at line 229 of file mesh_generator.cpp.

Here is the call graph for this function:

◆ RandPointsR()

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.

Parameters
PointNumThe number of points.
xlThe left boundary
xrThe right boundary
ydThe lower boundary
yuThe upper boundary
minRThe inner radius in which there are no points
xcThe X of center of the circle
ycThe Y of center of the circle
Returns
List of two dimensional points

Definition at line 100 of file mesh_generator.cpp.

Here is the call graph for this function:

◆ RandPointsRa()

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.

Parameters
PointNumThe number of points.
RminThe min radius
RmaxThe max radius
alphaThe radial density of the points, shouldn't be 1
lowerleftThe lowerleft corner of the domain
upperrightThe upperright corner of the domain
centerThe center of the coordinates system
Returns
List of two dimensional points

Definition at line 73 of file mesh_generator.cpp.

◆ RandPointsRmax()

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.

Parameters
PointNumThe number of points.
RminThe min radius
RmaxThe max radius
xcX of circle center
ycY of circle center
Returns
List of two dimensional points

Definition at line 11 of file mesh_generator.cpp.

◆ RandSquare() [1/3]

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.

Parameters
PointNumThe number of points.
lowerleftThe lower left point of the domain
upperrightThe upper right point of the domain
Returns
List of two dimensional points

Definition at line 6 of file mesh_generator.cpp.

◆ RandSquare() [2/3]

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.

Parameters
PointNumThe number of points.
xlThe left boundary
xrThe right boundary
ydThe lower boundary
yuThe upper boundary
Returns
List of two dimensional points

Definition at line 32 of file mesh_generator.cpp.

◆ RandSquare() [3/3]

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.

Parameters
PointNumThe number of points.
engThe random number generator
xlThe left boundary
xrThe right boundary
ydThe lower boundary
yuThe upper boundary
Returns
List of two dimensional points

Definition at line 53 of file mesh_generator.cpp.