PLaSK library

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
plask::MeshAxis Class Referenceabstract

Abstract class to derive all mesh axes from. More...

`#include <plask/mesh/axis1d.hpp>`

Inheritance diagram for plask::MeshAxis:
[legend]
Collaboration diagram for plask::MeshAxis:
[legend]

## Public Member Functions
virtual shared_ptr< MeshAxis > | clone () const
| Create new mesh which has copy of data included in `this`.
virtual std::size_t | findIndex (double to_find) const
| Find index where `to_find` point could be inserted.
virtual std::size_t | findUpIndex (double to_find) const
| Find the lowest index for which coordinate is larger than `to_find`.
virtual std::size_t | findNearestIndex (double to_find) const
| Find index nearest to `to_find`.
virtual shared_ptr< MeshAxis > | getMidpointAxis () const
| Return an axis that enables iterating over middle points of the ranges.
virtual bool | isIncreasing () const =0
Public Member Functions inherited from plask::MeshD< 1 >
virtual LocalCoords | at (std::size_t index) const=0
| Get point with given mesh index.
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 std::size_t | size () const =0
virtual bool | empty () const
virtual void | writeXML (XMLElement &object) const
| Write mesh to XML.
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
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 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 Attributes inherited from plask::Mesh
boost::signals2::signal< void(Event &)> | changed
| Changed signal, fired when mesh was changed.

## Detailed Description

Abstract class to derive all mesh axes from.

Definition at line 27 of file axis1d.hpp.

## Member Function Documentation

## ◆ beforeCalcMidpointMesh()

void plask::MeshAxis::beforeCalcMidpointMesh | ( |  | ) | const
| protected

Throw exception if this mesh has less than two point.

Definition at line 84 of file axis1d.cpp.

## ◆ clone()

shared_ptr< MeshAxis > plask::MeshAxis::clone | ( |  | ) | const
| virtual

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.

Returns
  new mesh which has copy of data included in `this`

Reimplemented in plask::OrderedAxis, and plask::RegularAxis.

Definition at line 62 of file axis1d.cpp.

## ◆ findIndex()

std::size_t plask::MeshAxis::findIndex | ( | double | to_find | ) | const
| virtual

Find index where `to_find` point could be inserted.

Parameters

  to_find | point to find

Returns
  First index where to_find could be inserted. Refer to value equal to `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 in plask::OrderedAxis, and plask::RegularAxis.

Definition at line 67 of file axis1d.cpp.

## ◆ findNearestIndex()

std::size_t plask::MeshAxis::findNearestIndex | ( | double | to_find | ) | const
| virtual

Find index nearest to `to_find`.

Parameters

  to_find |

Returns
  index i for which abs((*this)[i]-to_find) is minimal

Reimplemented in plask::OrderedAxis, and plask::RegularAxis.

Definition at line 75 of file axis1d.cpp.

## ◆ findUpIndex()

std::size_t plask::MeshAxis::findUpIndex | ( | double | to_find | ) | const
| virtual

Find the lowest index for which coordinate is larger than `to_find`.

Parameters

  to_find | point to find

Returns
  First index with coordinate larger than `to_find`. Can be equal to size() if `to_find` is larger than all points in mesh or equals to the last point.

Reimplemented in plask::OrderedAxis, and plask::RegularAxis.

Definition at line 71 of file axis1d.cpp.

## ◆ getMidpointAxis()

shared_ptr< MeshAxis > plask::MeshAxis::getMidpointAxis | ( |  | ) | const
| virtual

Return an axis that enables iterating over middle points of the ranges.

Throw exception if this mesh has less than two points.

Returns
  new rectilinear mesh with points in the middles of original ranges

Reimplemented in plask::RegularAxis.

Definition at line 79 of file axis1d.cpp.

## ◆ isIncreasing()

virtual bool plask::MeshAxis::isIncreasing | ( |  | ) | const
| pure virtual

Returns
  `true` only if points are in increasing order, `false` if points are in decreasing order

Implemented in plask::MidpointAxis, plask::OnePointAxis, plask::OrderedAxis, and plask::RegularAxis.

The documentation for this class was generated from the following files:

- plask/mesh/axis1d.hpp
- plask/mesh/axis1d.cpp