Monte Carlo Integration Library
1.0
High-performance Monte Carlo methods for numerical integration and optimization
src
montecarlo
geometry.hpp
Go to the documentation of this file.
1
9
#ifndef MONTECARLO_1_GEOMETRY_HPP
10
#define MONTECARLO_1_GEOMETRY_HPP
11
12
13
#include <array>
14
#include <cstddef>
15
21
namespace
mc::geom
{
22
30
template
<
int
dim>
31
class
Point
32
{
33
public
:
35
Point
() { coords.fill(0.0); }
36
42
double
&
operator[]
(std::size_t i) {
return
coords[i]; }
43
49
double
operator[]
(std::size_t i)
const
{
return
coords[i]; }
50
55
std::size_t
dimension
()
const
{
return
dim
; }
56
57
private
:
58
std::array<double, dim> coords;
59
};
60
68
template
<
int
dim>
69
class
Bounds
70
{
71
public
:
75
Bounds
()
76
{
77
for
(std::size_t i = 0; i <
dim
; ++i)
78
{
79
bounds[i] = std::make_pair(0.0, 0.0);
80
}
81
}
82
88
const
std::pair<double, double> &
operator[]
(std::size_t i)
const
89
{
90
return
bounds[i];
91
}
92
98
std::pair<double, double> &
operator[]
(std::size_t i)
99
{
100
return
bounds[i];
101
}
102
103
private
:
104
std::array<std::pair<double, double>,
dim
> bounds;
105
};
106
107
108
}
// namespace mc::geom
109
110
#endif
// MONTECARLO_1_GEOMETRY_HPP
mc::geom::Bounds
N-dimensional axis-aligned bounding box.
Definition
geometry.hpp:70
mc::geom::Bounds::Bounds
Bounds()
Default constructor initializing all bounds to [0,0].
Definition
geometry.hpp:75
mc::geom::Bounds::operator[]
std::pair< double, double > & operator[](std::size_t i)
Non-const accessor for bounds along axis i.
Definition
geometry.hpp:98
mc::geom::Bounds::operator[]
const std::pair< double, double > & operator[](std::size_t i) const
Const accessor for bounds along axis i.
Definition
geometry.hpp:88
mc::geom::Point
N-dimensional point representation.
Definition
geometry.hpp:32
mc::geom::Point::dimension
std::size_t dimension() const
Get the dimensionality of the point.
Definition
geometry.hpp:55
mc::geom::Point::Point
Point()
Default constructor initializing all coordinates to 0.0.
Definition
geometry.hpp:35
mc::geom::Point::operator[]
double & operator[](std::size_t i)
Non-const coordinate accessor.
Definition
geometry.hpp:42
mc::geom::Point::operator[]
double operator[](std::size_t i) const
Const coordinate accessor.
Definition
geometry.hpp:49
dim
constexpr int dim
Default dimensionality for integration.
Definition
main.cpp:36
mc::geom
Definition
geometry.hpp:21
Generated by
1.9.8