PLaSK library
Loading...
Searching...
No Matches
plask::RectangularMaskedMeshBase< DIM > Struct Template Reference

Common base class for RectangularMaskedMesh 2D and 3D. More...

#include <plask/mesh/rectangular_masked_common.hpp>

Inheritance diagram for plask::RectangularMaskedMeshBase< DIM >:
[legend]
Collaboration diagram for plask::RectangularMaskedMeshBase< DIM >:
[legend]

Classes

struct  BoundaryIndexForAxis
 The lowest and the largest index in use, for each direction. More...
 
class  const_iterator
 Iterator over nodes coordinates. More...
 
struct  ElementMeshBase
 Base class for element meshes with common code for 2D and 3D. More...
 
struct  ElementsBase
 Base class for Elements with common code for 2D and 3D. More...
 

Public Types

enum  : std::size_t { NOT_INCLUDED = Set::NOT_INCLUDED }
 Returned by some methods to signalize that element or node (with given index(es)) is not included in the mesh. More...
 
typedef const_iterator iterator
 Iterator over nodes coordinates. The same as const_iterator, since non-const iterators are not supported.
 

Public Member Functions

 RectangularMaskedMeshBase ()=default
 Construct an empty mesh. One should use reset() or selectAll() method before using it.
 
 RectangularMaskedMeshBase (const RectangularMesh< DIM > &rectangularMesh, Set nodeSet, bool clone_axes=false)
 Constructor which allows us to construct midpoints mesh.
 
 RectangularMaskedMeshBase (const RectangularMesh< DIM > &rectangularMesh, bool clone_axes=false)
 Construct a mesh by wrap of a given rectangularMesh.
 
const_iterator begin () const
 
const_iterator end () const
 
LocalCoords at (std::size_t index) const override
 
std::size_t size () const override
 
bool empty () const override
 
bool full () const
 
void selectAll (const RectangularMesh< DIM > &rectangularMesh, bool clone_axes=false)
 Set wrapped mesh and select all its elements.
 
void selectAll ()
 Select all elements of wrapped mesh.
 
std::size_t index (const Vec< DIM, std::size_t > &indexes) const
 Calculate this mesh index using indexes of axis[0] and axis[1].
 
std::size_t index0 (std::size_t mesh_index) const
 Calculate index of axis0 using this mesh index.
 
std::size_t index1 (std::size_t mesh_index) const
 Calculate index of axis1 using this mesh index.
 
Vec< DIM, std::size_t > indexes (std::size_t mesh_index) const
 Calculate indexes of axes.
 
std::size_t majorIndex (std::size_t mesh_index) const
 Calculate index of major axis using given mesh index.
 
std::size_t minorIndex (std::size_t mesh_index) const
 Calculate index of major axis using given mesh index.
 
std::size_t getElementsCount0 () const
 Get number of elements (for FEM method) in the first direction.
 
std::size_t getElementsCount1 () const
 Get number of elements (for FEM method) in the second direction.
 
std::size_t getElementsCount () const
 Get number of elements (for FEM method).
 
std::size_t getElementIndexFromLowIndex (std::size_t mesh_index_of_el_bottom_left) const
 Convert mesh index of bottom left element corner to index of this element.
 
std::size_t getElementMeshLowIndex (std::size_t element_index) const
 Convert element index to mesh index of bottom-left element corner.
 
Vec< DIM, std::size_t > getElementMeshLowIndexes (std::size_t element_index) const
 Convert an element index to mesh indexes of bottom-left corner of the element.
 
double getElementArea (std::size_t element_index) const
 Get an area of a given element.
 
double getElementMidpoint0 (std::size_t index0) const
 Get first coordinate of point in the center of an elements.
 
double getElementMidpoint1 (std::size_t index1) const
 Get second coordinate of point in the center of an elements.
 
Vec< DIM, doublegetElementMidpoint (std::size_t element_index) const
 Get point in the center of an element.
 
Primitive< DIM >::Box getElementBox (std::size_t element_index) const
 Get an element as a rectangle.
 

Public Attributes

RectangularMesh< DIM > fullMesh
 Full, rectangular, wrapped mesh.
 

Static Public Attributes

static constexpr double MIN_DISTANCE = 1e-9
 Maximum distance from boundary to include in the inerpolation.
 

Protected Types

typedef CompressedSetOfNumbers< std::size_t > Set
 
typedef BoundaryIndexForAxis BoundaryIndex[DIM]
 

Protected Member Functions

void resetBoundyIndex ()
 
void reset ()
 Clear nodeSet, elementSet and call resetBoundyIndex().
 
const SetensureHasElements () const
 Ensure that elementSet is calculated (calculate it if it is not).
 
const BoundaryIndexensureHasBoundaryIndex () const
 Ensure that boundaryIndex is calculated (calculate it if it is not).
 

Static Protected Member Functions

static void findIndexes (const MeshAxis &axis, double wrapped_point_coord, std::size_t &index_lo, std::size_t &index_hi)
 Used by interpolation.
 
static std::size_t nearest (double p, const MeshAxis &axis, std::size_t index_lo, std::size_t index_hi)
 Used by nearest neighbor interpolation.
 

Protected Attributes

Set nodeSet
 Numbers of rectangularMesh indexes which are in the corners of the elements enabled.
 
Set elementSet
 Numbers of enabled elements.
 
BoundaryIndex boundaryIndex
 
DontCopyThisField< boost::mutex > writeMutex
 Only one thread can calculate elementSet or boundaryIndex.
 
bool elementSetInitialized = true
 Whether elementSet is initialized (default for most constructors).
 
bool boundaryIndexInitialized
 Whether boundatyIndex is initialized.
 

Detailed Description

template<int DIM>
struct plask::RectangularMaskedMeshBase< DIM >

Common base class for RectangularMaskedMesh 2D and 3D.

Do not use directly.

Definition at line 33 of file rectangular_masked_common.hpp.

Member Typedef Documentation

◆ BoundaryIndex

template<int DIM>
typedef BoundaryIndexForAxis plask::RectangularMaskedMeshBase< DIM >::BoundaryIndex[DIM]
protected

Definition at line 60 of file rectangular_masked_common.hpp.

◆ iterator

Iterator over nodes coordinates. The same as const_iterator, since non-const iterators are not supported.

Definition at line 280 of file rectangular_masked_common.hpp.

◆ Set

template<int DIM>
typedef CompressedSetOfNumbers<std::size_t> plask::RectangularMaskedMeshBase< DIM >::Set
protected

Definition at line 46 of file rectangular_masked_common.hpp.

Member Enumeration Documentation

◆ anonymous enum

template<int DIM>
anonymous enum : std::size_t

Returned by some methods to signalize that element or node (with given index(es)) is not included in the mesh.

Enumerator
NOT_INCLUDED 

Definition at line 1 of file rectangular_masked_common.hpp.

Constructor & Destructor Documentation

◆ RectangularMaskedMeshBase() [1/3]

template<int DIM>
plask::RectangularMaskedMeshBase< DIM >::RectangularMaskedMeshBase ( )
default

Construct an empty mesh. One should use reset() or selectAll() method before using it.

◆ RectangularMaskedMeshBase() [2/3]

template<int DIM>
plask::RectangularMaskedMeshBase< DIM >::RectangularMaskedMeshBase ( const RectangularMesh< DIM > &  rectangularMesh,
Set  nodeSet,
bool  clone_axes = false 
)
inline

Constructor which allows us to construct midpoints mesh.

Definition at line 233 of file rectangular_masked_common.hpp.

◆ RectangularMaskedMeshBase() [3/3]

template<int DIM>
plask::RectangularMaskedMeshBase< DIM >::RectangularMaskedMeshBase ( const RectangularMesh< DIM > &  rectangularMesh,
bool  clone_axes = false 
)
inline

Construct a mesh by wrap of a given rectangularMesh.

Parameters
rectangularMeshmesh to wrap (it is copied by the constructor)
clone_axeswhether axes of the rectangularMesh should be cloned (if true) or shared (if false; default)

Definition at line 244 of file rectangular_masked_common.hpp.

Member Function Documentation

◆ at()

template<int DIM>
LocalCoords plask::RectangularMaskedMeshBase< DIM >::at ( std::size_t  index) const
inlineoverride

Definition at line 285 of file rectangular_masked_common.hpp.

◆ begin()

template<int DIM>
const_iterator plask::RectangularMaskedMeshBase< DIM >::begin ( ) const
inline

Definition at line 282 of file rectangular_masked_common.hpp.

◆ empty()

template<int DIM>
bool plask::RectangularMaskedMeshBase< DIM >::empty ( ) const
inlineoverride

Definition at line 291 of file rectangular_masked_common.hpp.

◆ end()

template<int DIM>
const_iterator plask::RectangularMaskedMeshBase< DIM >::end ( ) const
inline

Definition at line 283 of file rectangular_masked_common.hpp.

◆ ensureHasBoundaryIndex()

template<int DIM>
const BoundaryIndex & plask::RectangularMaskedMeshBase< DIM >::ensureHasBoundaryIndex ( ) const
inlineprotected

Ensure that boundaryIndex is calculated (calculate it if it is not).

Returns
this->boundaryIndex

Definition at line 645 of file rectangular_masked_common.hpp.

◆ ensureHasElements()

template<int DIM>
const Set & plask::RectangularMaskedMeshBase< DIM >::ensureHasElements ( ) const
inlineprotected

Ensure that elementSet is calculated (calculate it if it is not).

Returns
this->elementSet

Definition at line 636 of file rectangular_masked_common.hpp.

◆ findIndexes()

template<int DIM>
static void plask::RectangularMaskedMeshBase< DIM >::findIndexes ( const MeshAxis axis,
double  wrapped_point_coord,
std::size_t &  index_lo,
std::size_t &  index_hi 
)
inlinestaticprotected

Used by interpolation.

Parameters
axis
wrapped_point_coord
index_lo
index_hi

Definition at line 70 of file rectangular_masked_common.hpp.

◆ full()

template<int DIM>
bool plask::RectangularMaskedMeshBase< DIM >::full ( ) const
inline
Returns
true if all nodes of the wrapped mesh are selected

Definition at line 296 of file rectangular_masked_common.hpp.

◆ getElementArea()

template<int DIM>
double plask::RectangularMaskedMeshBase< DIM >::getElementArea ( std::size_t  element_index) const
inline

Get an area of a given element.

Parameters
element_indexindex of the element
Returns
the area of the element with given index

Definition at line 433 of file rectangular_masked_common.hpp.

◆ getElementBox()

template<int DIM>
Primitive< DIM >::Box plask::RectangularMaskedMeshBase< DIM >::getElementBox ( std::size_t  element_index) const
inline

Get an element as a rectangle.

Parameters
element_indexindex of the element
Returns
the element as a rectangle (box)

Definition at line 469 of file rectangular_masked_common.hpp.

◆ getElementIndexFromLowIndex()

template<int DIM>
std::size_t plask::RectangularMaskedMeshBase< DIM >::getElementIndexFromLowIndex ( std::size_t  mesh_index_of_el_bottom_left) const
inline

Convert mesh index of bottom left element corner to index of this element.

Parameters
mesh_index_of_el_bottom_leftmesh index
Returns
index of the element, from 0 to getElementsCount()-1

Definition at line 405 of file rectangular_masked_common.hpp.

◆ getElementMeshLowIndex()

template<int DIM>
std::size_t plask::RectangularMaskedMeshBase< DIM >::getElementMeshLowIndex ( std::size_t  element_index) const
inline

Convert element index to mesh index of bottom-left element corner.

Parameters
element_indexindex of element, from 0 to getElementsCount()-1
Returns
mesh index

Definition at line 414 of file rectangular_masked_common.hpp.

◆ getElementMeshLowIndexes()

template<int DIM>
Vec< DIM, std::size_t > plask::RectangularMaskedMeshBase< DIM >::getElementMeshLowIndexes ( std::size_t  element_index) const
inline

Convert an element index to mesh indexes of bottom-left corner of the element.

Parameters
element_indexindex of the element, from 0 to getElementsCount()-1
Returns
axis 0 and axis 1 indexes of mesh, you can easy calculate rest indexes of element corner by adding 1 to returned coordinates

Definition at line 424 of file rectangular_masked_common.hpp.

◆ getElementMidpoint()

template<int DIM>
Vec< DIM, double > plask::RectangularMaskedMeshBase< DIM >::getElementMidpoint ( std::size_t  element_index) const
inline

Get point in the center of an element.

Parameters
element_indexindex of Elements
Returns
point in center of element with given index

Definition at line 460 of file rectangular_masked_common.hpp.

◆ getElementMidpoint0()

template<int DIM>
double plask::RectangularMaskedMeshBase< DIM >::getElementMidpoint0 ( std::size_t  index0) const
inline

Get first coordinate of point in the center of an elements.

Parameters
index0index of the element (axis0 index)
Returns
first coordinate of the point in the center of the element

Definition at line 442 of file rectangular_masked_common.hpp.

◆ getElementMidpoint1()

template<int DIM>
double plask::RectangularMaskedMeshBase< DIM >::getElementMidpoint1 ( std::size_t  index1) const
inline

Get second coordinate of point in the center of an elements.

Parameters
index1index of the element (axis1 index)
Returns
second coordinate of the point in the center of the element

Definition at line 451 of file rectangular_masked_common.hpp.

◆ getElementsCount()

template<int DIM>
std::size_t plask::RectangularMaskedMeshBase< DIM >::getElementsCount ( ) const
inline

Get number of elements (for FEM method).

Returns
number of elements in this mesh

Definition at line 396 of file rectangular_masked_common.hpp.

◆ getElementsCount0()

template<int DIM>
std::size_t plask::RectangularMaskedMeshBase< DIM >::getElementsCount0 ( ) const
inline

Get number of elements (for FEM method) in the first direction.

Returns
number of elements in the full rectangular mesh in the first direction (axis0 direction).

Definition at line 380 of file rectangular_masked_common.hpp.

◆ getElementsCount1()

template<int DIM>
std::size_t plask::RectangularMaskedMeshBase< DIM >::getElementsCount1 ( ) const
inline

Get number of elements (for FEM method) in the second direction.

Returns
number of elements in the full rectangular mesh in the second direction (axis1 direction).

Definition at line 388 of file rectangular_masked_common.hpp.

◆ index()

template<int DIM>
std::size_t plask::RectangularMaskedMeshBase< DIM >::index ( const Vec< DIM, std::size_t > &  indexes) const
inline

Calculate this mesh index using indexes of axis[0] and axis[1].

Parameters
indexesindex of axis[0] and axis[1]
Returns
this mesh index, from 0 to size()-1, or NOT_INCLUDED

Definition at line 327 of file rectangular_masked_common.hpp.

◆ index0()

template<int DIM>
std::size_t plask::RectangularMaskedMeshBase< DIM >::index0 ( std::size_t  mesh_index) const
inline

Calculate index of axis0 using this mesh index.

Parameters
mesh_indexthis mesh index, from 0 to size()-1
Returns
index of axis0, from 0 to axis0->size()-1

Definition at line 336 of file rectangular_masked_common.hpp.

◆ index1()

template<int DIM>
std::size_t plask::RectangularMaskedMeshBase< DIM >::index1 ( std::size_t  mesh_index) const
inline

Calculate index of axis1 using this mesh index.

Parameters
mesh_indexthis mesh index, from 0 to size()-1
Returns
index of axis1, from 0 to axis1->size()-1

Definition at line 345 of file rectangular_masked_common.hpp.

◆ indexes()

template<int DIM>
Vec< DIM, std::size_t > plask::RectangularMaskedMeshBase< DIM >::indexes ( std::size_t  mesh_index) const
inline

Calculate indexes of axes.

Parameters
mesh_indexthis mesh index, from 0 to size()-1
Returns
indexes of axes

Definition at line 354 of file rectangular_masked_common.hpp.

◆ majorIndex()

template<int DIM>
std::size_t plask::RectangularMaskedMeshBase< DIM >::majorIndex ( std::size_t  mesh_index) const
inline

Calculate index of major axis using given mesh index.

Parameters
mesh_indexthis mesh index, from 0 to size()-1
Returns
index of major axis, from 0 to majorAxis.size()-1

Definition at line 363 of file rectangular_masked_common.hpp.

◆ minorIndex()

template<int DIM>
std::size_t plask::RectangularMaskedMeshBase< DIM >::minorIndex ( std::size_t  mesh_index) const
inline

Calculate index of major axis using given mesh index.

Parameters
mesh_indexthis mesh index, from 0 to size()-1
Returns
index of major axis, from 0 to majorAxis.size()-1

Definition at line 372 of file rectangular_masked_common.hpp.

◆ nearest()

template<int DIM>
static std::size_t plask::RectangularMaskedMeshBase< DIM >::nearest ( double  p,
const MeshAxis axis,
std::size_t  index_lo,
std::size_t  index_hi 
)
inlinestaticprotected

Used by nearest neighbor interpolation.

Parameters
ppoint coordinate such that axis.at(index_lo) <= p <= axis.at(index_hi)
axis
index_lo,index_hiindexes
Returns
either index_lo or index_hi, index which minimize |p - axis.at(index)|

Definition at line 84 of file rectangular_masked_common.hpp.

◆ reset()

template<int DIM>
void plask::RectangularMaskedMeshBase< DIM >::reset ( )
inlineprotected

Clear nodeSet, elementSet and call resetBoundyIndex().

Definition at line 218 of file rectangular_masked_common.hpp.

◆ resetBoundyIndex()

template<int DIM>
void plask::RectangularMaskedMeshBase< DIM >::resetBoundyIndex ( )
inlineprotected

Definition at line 209 of file rectangular_masked_common.hpp.

◆ selectAll() [1/2]

template<int DIM>
void plask::RectangularMaskedMeshBase< DIM >::selectAll ( )
inline

Select all elements of wrapped mesh.

Definition at line 311 of file rectangular_masked_common.hpp.

◆ selectAll() [2/2]

template<int DIM>
void plask::RectangularMaskedMeshBase< DIM >::selectAll ( const RectangularMesh< DIM > &  rectangularMesh,
bool  clone_axes = false 
)
inline

Set wrapped mesh and select all its elements.

Parameters
rectangularMeshinput mesh, before masking
clone_axeswhether axes of the rectangularMesh should be cloned (if true) or shared (if false; default)

Definition at line 303 of file rectangular_masked_common.hpp.

◆ size()

template<int DIM>
std::size_t plask::RectangularMaskedMeshBase< DIM >::size ( ) const
inlineoverride

Definition at line 289 of file rectangular_masked_common.hpp.

Member Data Documentation

◆ boundaryIndex

template<int DIM>
BoundaryIndex plask::RectangularMaskedMeshBase< DIM >::boundaryIndex
protected

Definition at line 61 of file rectangular_masked_common.hpp.

◆ boundaryIndexInitialized

template<int DIM>
bool plask::RectangularMaskedMeshBase< DIM >::boundaryIndexInitialized
protected

Whether boundatyIndex is initialized.

Definition at line 482 of file rectangular_masked_common.hpp.

◆ elementSet

template<int DIM>
Set plask::RectangularMaskedMeshBase< DIM >::elementSet
protected

Numbers of enabled elements.

Definition at line 52 of file rectangular_masked_common.hpp.

◆ elementSetInitialized

template<int DIM>
bool plask::RectangularMaskedMeshBase< DIM >::elementSetInitialized = true
protected

Whether elementSet is initialized (default for most constructors).

Definition at line 479 of file rectangular_masked_common.hpp.

◆ fullMesh

template<int DIM>
RectangularMesh<DIM> plask::RectangularMaskedMeshBase< DIM >::fullMesh

Full, rectangular, wrapped mesh.

Definition at line 39 of file rectangular_masked_common.hpp.

◆ MIN_DISTANCE

template<int DIM>
constexpr double plask::RectangularMaskedMeshBase< DIM >::MIN_DISTANCE = 1e-9
staticconstexpr

Maximum distance from boundary to include in the inerpolation.

Definition at line 36 of file rectangular_masked_common.hpp.

◆ nodeSet

template<int DIM>
Set plask::RectangularMaskedMeshBase< DIM >::nodeSet
protected

Numbers of rectangularMesh indexes which are in the corners of the elements enabled.

Definition at line 49 of file rectangular_masked_common.hpp.

◆ writeMutex

template<int DIM>
DontCopyThisField<boost::mutex> plask::RectangularMaskedMeshBase< DIM >::writeMutex
protected

Only one thread can calculate elementSet or boundaryIndex.

Definition at line 476 of file rectangular_masked_common.hpp.


The documentation for this struct was generated from the following file: