PLaSK library
|
Regular mesh in 1d space. More...
#include <plask/mesh/regular1d.hpp>
Public Types | |
typedef double | PointType |
Type of points in this mesh. | |
typedef IndexedIterator< const RegularAxis, PointType > | native_const_iterator |
Public Types inherited from plask::MeshD< 1 > | |
enum | |
Number of dimensions. More... | |
typedef Primitive< DIM >::DVec | LocalCoords |
Type of vector representing coordinates in local space. | |
typedef IndexedIterator< const MeshD< dimension >, LocalCoords > | const_iterator |
Random access iterator type which allow iterate over all points in this mesh, in order appointed by operator[]. | |
typedef const_iterator | iterator |
typedef const_iterator | Iterator |
Public Member Functions | |
native_const_iterator | begin () const |
native_const_iterator | end () const |
RegularAxis () | |
Construct uninitialized mesh. | |
RegularAxis (const RegularAxis &src) | |
Copy constructor. It does not copy owner. | |
RegularAxis (double first, double last, std::size_t points_count) | |
Construct mesh with given parameters. | |
RegularAxis & | operator= (const RegularAxis &src) |
Assign a new mesh. This operation preserves the owner. | |
void | reset (double first, double last, std::size_t points_count) |
Set new mesh parameters. | |
double | first () const |
double | last () const |
double | step () const |
std::size_t | size () const override |
bool | operator== (const RegularAxis &to_compare) const |
Compare meshes. | |
bool | operator!= (const RegularAxis &to_compare) const |
Compare meshes. | |
bool | empty () const override |
double | operator[] (std::size_t index) const |
Get point by index. | |
double | at (std::size_t index) const override |
Get point with given mesh index. | |
void | clear () |
Remove all points from mesh. | |
std::size_t | findIndex (double to_find) const override |
Find index where to_find point could be inserted. | |
native_const_iterator | find (double to_find) const |
Find position where to_find point could be inserted. | |
std::size_t | findUpIndex (double to_find) const override |
Find the lowest index for which coordinate is larger than to_find . | |
native_const_iterator | findUp (double to_find) const |
Find the lowest position for with a coordinate larger than to_find . | |
native_const_iterator | findNearest (double to_find) const |
Find position nearest to to_find . | |
std::size_t | findNearestIndex (double to_find) const override |
Find index nearest to to_find . | |
shared_ptr< MeshAxis > | clone () const override |
Create new mesh which has copy of data included in this . | |
void | writeXML (XMLElement &object) const override |
Write mesh to XML. | |
bool | isIncreasing () const override |
shared_ptr< MeshAxis > | getMidpointAxis () const override |
Return an axis that enables iterating over middle points of the ranges. | |
template<typename RandomAccessContainer > | |
auto | interpolateLinear (const RandomAccessContainer &data, double point) -> typename std::remove_reference< decltype(data[0])>::type |
Calculate (using linear interpolation) value of data in point using data in points describe by this mesh. | |
Public Member Functions inherited from plask::MeshD< 1 > | |
LocalCoords | operator[] (std::size_t index) const |
Get point with given mesh index. | |
const_iterator | begin () const |
const_iterator | end () const |
MeshD (const MeshD &PLASK_UNUSED(to_copy)) | |
Initialize this to be the same as to_copy but don't copy any changes observer. | |
MeshD () | |
MeshD & | operator= (const MeshD &PLASK_UNUSED(to_copy)) |
Set this to be the same as to_copy but doesn't changed changes observer. | |
bool | operator== (const MeshD &to_compare) const |
Check if this mesh and to_compare represent the same sequence of points (have exactly the same points in the same order). | |
bool | operator!= (const MeshD &to_compare) const |
Check if this mesh and to_compare represent different sequences of points. | |
void | print (std::ostream &out) const override |
Print this to stream out . | |
Public Member Functions inherited from plask::Mesh | |
template<typename ClassT , typename methodT > | |
boost::signals2::connection | changedConnectMethod (ClassT *obj, methodT method, boost::signals2::connect_position at=boost::signals2::at_back) |
Connect a method to changed signal. | |
template<typename ClassT , typename methodT > | |
void | changedDisconnectMethod (ClassT *obj, methodT method) |
template<typename EventT = Event, typename ... Args> | |
void | fireChanged (Args &&... event_constructor_params_without_source) |
Call changed with this as event source. | |
void | fireResized () |
This method is called when the mesh is resized. | |
virtual | ~Mesh () |
Public Member Functions inherited from plask::Printable | |
virtual | ~Printable () |
std::string | str () const |
Get string representation of this using print method. | |
Public Member Functions inherited from plask::MeshBase | |
virtual | ~MeshBase () |
Protected Member Functions | |
bool | hasSameNodes (const MeshD< 1 > &to_compare) const override |
Protected Member Functions inherited from plask::MeshAxis | |
void | beforeCalcMidpointMesh () const |
Throw exception if this mesh has less than two point. | |
Protected Member Functions inherited from plask::MeshD< 1 > | |
virtual bool | hasSameNodes (const MeshD< dimension > &to_compare) const |
Check if this mesh and to_compare represent the same sequence of points (have exactly the same points in the same order). | |
Protected Member Functions inherited from plask::Mesh | |
virtual void | onChange (const Event &evt) |
This method is called when the mesh is changed, just before changed signal. | |
Additional Inherited Members | |
Public Attributes inherited from plask::Mesh | |
boost::signals2::signal< void(Event &)> | changed |
Changed signal, fired when mesh was changed. | |
Regular mesh in 1d space.
Definition at line 34 of file regular1d.hpp.
Definition at line 44 of file regular1d.hpp.
Type of points in this mesh.
Definition at line 42 of file regular1d.hpp.
|
inline |
Construct uninitialized mesh.
Definition at line 53 of file regular1d.hpp.
|
inline |
Copy constructor. It does not copy owner.
Definition at line 57 of file regular1d.hpp.
Construct mesh with given parameters.
first | coordinate of first point in mesh |
last | coordinate of last point in mesh |
points_count | number of points in mesh |
Definition at line 66 of file regular1d.hpp.
|
inlineoverridevirtual |
Get point with given mesh index.
index | index of point, from 0 to size()-1 |
index
Implements plask::MeshD< 1 >.
Definition at line 129 of file regular1d.hpp.
|
inline |
Definition at line 47 of file regular1d.hpp.
|
inline |
Remove all points from mesh.
Definition at line 134 of file regular1d.hpp.
|
inlineoverridevirtual |
Create new mesh which has copy of data included in this
.
By default RectangularMesh is used for result, but subclasses can use another types for less memory usage or better performance.
this
Reimplemented from plask::MeshAxis.
Definition at line 184 of file regular1d.hpp.
|
inlineoverridevirtual |
Reimplemented from plask::Mesh.
Definition at line 120 of file regular1d.hpp.
|
inline |
Definition at line 50 of file regular1d.hpp.
|
inline |
Find position where to_find
point could be inserted.
to_find | point to find |
to_find
only if to_find
is already in mesh, in other case it refer to value bigger than to_find. Can be equal to end() if to_find is higher than all points in mesh (in such case returned iterator can't be dereferenced). Definition at line 152 of file regular1d.hpp.
|
inlineoverridevirtual |
Find index where to_find
point could be inserted.
to_find | point to find |
to_find
only if to_find
is already in mesh, in other case it refer to value larger than to_find. Can be equal to size() if to_find
is larger than all points in mesh. Reimplemented from plask::MeshAxis.
Definition at line 140 of file regular1d.hpp.
|
inline |
Find position nearest to to_find
.
to_find |
Definition at line 173 of file regular1d.hpp.
|
inlineoverridevirtual |
Find index nearest to to_find
.
to_find |
Reimplemented from plask::MeshAxis.
Definition at line 182 of file regular1d.hpp.
|
inline |
Find the lowest position for with a coordinate larger than to_find
.
to_find | point to find |
to_find
. It equals to end() if to_find
is larger than all points in mesh or equals to the last point. Definition at line 164 of file regular1d.hpp.
|
overridevirtual |
Find the lowest index for which coordinate is larger than to_find
.
to_find | point to find |
to_find
. Can be equal to size() if to_find
is larger than all points in mesh or equals to the last point. Reimplemented from plask::MeshAxis.
Definition at line 35 of file regular1d.cpp.
|
inline |
Definition at line 84 of file regular1d.hpp.
|
overridevirtual |
Return an axis that enables iterating over middle points of the ranges.
Throw exception if this mesh has less than two points.
Reimplemented from plask::MeshAxis.
Definition at line 54 of file regular1d.cpp.
Definition at line 66 of file regular1d.cpp.
auto plask::RegularAxis::interpolateLinear | ( | const RandomAccessContainer & | data, |
double | point | ||
) | -> typename std::remove_reference<decltype(data[0])>::type |
Calculate (using linear interpolation) value of data in point using data in points describe by this mesh.
data | values of data in points describe by this mesh |
point | point in which value should be calculate |
point
Definition at line 208 of file regular1d.hpp.
|
overridevirtual |
true
only if points are in increasing order, false
if points are in decreasing order Implements plask::MeshAxis.
Definition at line 49 of file regular1d.cpp.
|
inline |
Definition at line 89 of file regular1d.hpp.
|
inline |
Compare meshes.
It uses algorithm which has constant time complexity.
to_compare | mesh to compare |
true
only if this mesh and to_compare
represents different sets of points Definition at line 115 of file regular1d.hpp.
RegularAxis & plask::RegularAxis::operator= | ( | const RegularAxis & | src | ) |
Assign a new mesh. This operation preserves the owner.
Definition at line 20 of file regular1d.cpp.
|
inline |
Compare meshes.
It uses algorithm which has constant time complexity.
to_compare | mesh to compare |
true
only if this mesh and to_compare
represents the same set of points Definition at line 105 of file regular1d.hpp.
|
inline |
Get point by index.
index | index of point, from 0 to size()-1 |
index
Definition at line 127 of file regular1d.hpp.
Set new mesh parameters.
first | coordinate of first point in mesh |
last | coordinate of last point in mesh |
points_count | number of points in mesh |
Definition at line 27 of file regular1d.cpp.
|
inlineoverridevirtual |
Implements plask::Mesh.
Definition at line 97 of file regular1d.hpp.
|
inline |
Definition at line 94 of file regular1d.hpp.
|
overridevirtual |
Write mesh to XML.
object | XML object to write to |
Reimplemented from plask::Mesh.
Definition at line 45 of file regular1d.cpp.