PLaSK library
|
Rectangular mesh which uses (and indexes) only chosen elements and all nodes in their corners. More...
#include <plask/mesh/rectangular_masked3d.hpp>
Classes | |
struct | BoundaryIteratorImpl |
Iterator over plane CHANGE_DIR_SLOWER, CHANGE_DIR_FASTER (an index if the remain coordinate is constant). More... | |
struct | BoundaryNodeSetImpl |
class | Element |
struct | ElementMesh |
Element mesh. More... | |
struct | Elements |
Public Types | |
typedef std::function< bool(const RectangularMesh3D::Element &)> | Predicate |
Type of predicate function which returns bool for given element of a mesh. | |
Public Types inherited from plask::RectangularMaskedMeshBase< 3 > | |
enum | |
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 | |
std::size_t | index2 (std::size_t mesh_index) const |
Calculate index of axis2 using this mesh index. | |
std::size_t | middleIndex (std::size_t mesh_index) const |
Calculate index of middle axis using given mesh index. | |
std::size_t | getElementsCount2 () const |
Get number of elements (for FEM method) in the third direction. | |
double | getElementMidpoint2 (std::size_t index2) const |
Get third coordinate of point in the center of an elements. | |
RectangularMaskedMesh3D ()=default | |
Construct empty/uninitialized mesh. | |
void | reset (const Predicate &predicate) |
Change a selection of elements used to once pointed by a given predicate . | |
RectangularMaskedMesh3D (const RectangularMesh< 3 > &fullMesh, const Predicate &predicate, bool clone_axes=false) | |
Construct masked mesh with elements of fullMesh chosen by a predicate . | |
void | reset (const RectangularMesh< 3 > &fullMesh, const Predicate &predicate, bool clone_axes=false) |
Change parameter of this mesh to use elements of fullMesh chosen by a predicate . | |
RectangularMaskedMesh3D (const RectangularMesh< 3 > &fullMesh, const GeometryD< 3 > &geom, const std::function< bool(shared_ptr< const Material >)> materialPredicate, bool clone_axes=false) | |
Construct masked mesh with all elements of fullMesh which have required materials in the midpoints. | |
void | reset (const RectangularMesh< 3 > &rectangularMesh, const GeometryD< 3 > &geom, const std::function< bool(shared_ptr< const Material >)> materialPredicate, bool clone_axes=false) |
Change parameter of this mesh to use all elements of rectangularMesh which have required materials in the midpoints. | |
RectangularMaskedMesh3D (const RectangularMesh< 3 > &rectangularMesh, const GeometryD< 3 > &geom, unsigned materialKinds, bool clone_axes=false) | |
Construct masked mesh with all elements of rectangularMesh which have required kinds of materials (in the midpoints). | |
void | reset (const RectangularMesh< 3 > &rectangularMesh, const GeometryD< 3 > &geom, unsigned materialKinds, bool clone_axes=false) |
Change parameters of this mesh to use all elements of rectangularMesh which have required kinds of materials (in the midpoints). | |
RectangularMaskedMesh3D (const RectangularMesh< DIM > &rectangularMesh, Set nodeSet, bool clone_axes=false) | |
Construct a mesh with given set of nodes. | |
Elements | elements () const |
Elements | getElements () const |
Element | element (std::size_t i0, std::size_t i1, std::size_t i2) const |
Element | getElement (std::size_t i0, std::size_t i1, std::size_t i2) const |
Element | element (std::size_t i) const |
Get an element with a given index i . | |
Element | getElement (std::size_t i) const |
Get an element with a given index i . | |
std::size_t | index (std::size_t axis0_index, std::size_t axis1_index, std::size_t axis2_index) const |
Calculate this mesh index using indexes of axis0 and axis1. | |
Vec< 3, double > | at (std::size_t index0, std::size_t index1, std::size_t index2) const |
Get point with given mesh indices. | |
Vec< 3, double > | operator() (std::size_t axis0_index, std::size_t axis1_index, std::size_t axis2_index) const |
Get point with given x and y indexes. | |
shared_ptr< RectangularMaskedMesh3D::ElementMesh > | getElementMesh () const |
Return a mesh that enables iterating over middle points of the selected rectangles. | |
bool | prepareInterpolation (const Vec< 3 > &point, Vec< 3 > &wrapped_point, std::size_t &index0_lo, std::size_t &index0_hi, std::size_t &index1_lo, std::size_t &index1_hi, std::size_t &index2_lo, std::size_t &index2_hi, const InterpolationFlags &flags) const |
Prepare point for inteprolation. | |
template<typename RandomAccessContainer > | |
auto | interpolateLinear (const RandomAccessContainer &data, const Vec< 3 > &point, const InterpolationFlags &flags) const -> typename std::remove_reference< decltype(data[0])>::type |
Calculate (using linear interpolation) value of data in point using data in points described by this mesh. | |
template<typename RandomAccessContainer > | |
auto | interpolateNearestNeighbor (const RandomAccessContainer &data, const Vec< 3 > &point, const InterpolationFlags &flags) const -> typename std::remove_reference< decltype(data[0])>::type |
Calculate (using nearest neighbor interpolation) value of data in point using data in points described by this mesh. | |
std::size_t | getElementIndexFromLowIndexes (std::size_t axis0_index, std::size_t axis1_index, std::size_t axis2_index) const |
Convert mesh indexes of a back-left-bottom corner of an element to the index of this element. | |
double | getElementArea (std::size_t index0, std::size_t index1, std::size_t index2) const |
Get an area of a given element. | |
Vec< 3, double > | getElementMidpoint (std::size_t index0, std::size_t index1, std::size_t index2) const |
Get point in center of Elements. | |
Box3D | getElementBox (std::size_t index0, std::size_t index1, std::size_t index2) const |
Get element as rectangle. | |
BoundaryNodeSet | createIndex0BoundaryAtLine (std::size_t line_nr_axis0, std::size_t index1Begin, std::size_t index1End, std::size_t index2Begin, std::size_t index2End) const override |
BoundaryNodeSet | createIndex0BoundaryAtLine (std::size_t line_nr_axis0) const override |
BoundaryNodeSet | createIndex1BoundaryAtLine (std::size_t line_nr_axis1, std::size_t index0Begin, std::size_t index0End, std::size_t index2Begin, std::size_t index2End) const override |
BoundaryNodeSet | createIndex1BoundaryAtLine (std::size_t line_nr_axis1) const override |
BoundaryNodeSet | createIndex2BoundaryAtLine (std::size_t line_nr_axis2, std::size_t index0Begin, std::size_t index0End, std::size_t index1Begin, std::size_t index1End) const override |
BoundaryNodeSet | createIndex2BoundaryAtLine (std::size_t line_nr_axis2) const override |
BoundaryNodeSet | createBackBoundary () const override |
BoundaryNodeSet | createFrontBoundary () const override |
BoundaryNodeSet | createLeftBoundary () const override |
BoundaryNodeSet | createRightBoundary () const override |
BoundaryNodeSet | createBottomBoundary () const override |
BoundaryNodeSet | createTopBoundary () const override |
BoundaryNodeSet | createBackOfBoundary (const Box3D &box) const override |
BoundaryNodeSet | createFrontOfBoundary (const Box3D &box) const override |
BoundaryNodeSet | createLeftOfBoundary (const Box3D &box) const override |
BoundaryNodeSet | createRightOfBoundary (const Box3D &box) const override |
BoundaryNodeSet | createBottomOfBoundary (const Box3D &box) const override |
BoundaryNodeSet | createTopOfBoundary (const Box3D &box) const override |
Public Member Functions inherited from plask::RectangularMaskedMeshBase< 3 > | |
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, double > | getElementMidpoint (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. | |
Additional Inherited Members | |
Public Attributes inherited from plask::RectangularMaskedMeshBase< 3 > | |
RectangularMesh< DIM > | fullMesh |
Full, rectangular, wrapped mesh. | |
Static Public Attributes inherited from plask::RectangularMaskedMeshBase< 3 > | |
static constexpr double | MIN_DISTANCE |
Maximum distance from boundary to include in the inerpolation. | |
Protected Types inherited from plask::RectangularMaskedMeshBase< 3 > | |
typedef CompressedSetOfNumbers< std::size_t > | Set |
typedef BoundaryIndexForAxis | BoundaryIndex[DIM] |
Protected Member Functions inherited from plask::RectangularMaskedMeshBase< 3 > | |
void | resetBoundyIndex () |
void | reset () |
Clear nodeSet, elementSet and call resetBoundyIndex(). | |
const Set & | ensureHasElements () const |
Ensure that elementSet is calculated (calculate it if it is not). | |
const BoundaryIndex & | ensureHasBoundaryIndex () const |
Ensure that boundaryIndex is calculated (calculate it if it is not). | |
Static Protected Member Functions inherited from plask::RectangularMaskedMeshBase< 3 > | |
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 inherited from plask::RectangularMaskedMeshBase< 3 > | |
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 |
Whether elementSet is initialized (default for most constructors). | |
bool | boundaryIndexInitialized |
Whether boundatyIndex is initialized. | |
Rectangular mesh which uses (and indexes) only chosen elements and all nodes in their corners.
Objects of this class can be constructed from instances of full rectangular mesh (RectangularMaskedMesh3D) and they can use the same boundary conditions (BoundaryConditions instance for full mesh accepts also objects of this class). Interpolation methods return NaN-s for all elements which have not been chosen.
Definition at line 28 of file rectangular_masked3d.hpp.
typedef std::function<bool(const RectangularMesh3D::Element&)> plask::RectangularMaskedMesh3D::Predicate |
Type of predicate function which returns bool for given element of a mesh.
Definition at line 66 of file rectangular_masked3d.hpp.
|
default |
Construct empty/uninitialized mesh.
One should call reset() or selectAll() method before using this.
plask::RectangularMaskedMesh3D::RectangularMaskedMesh3D | ( | const RectangularMesh< 3 > & | fullMesh, |
const Predicate & | predicate, | ||
bool | clone_axes = false |
||
) |
Construct masked mesh with elements of fullMesh
chosen by a predicate
.
Preserve order of elements and nodes of fullMesh
.
fullMesh | input mesh, before masking |
predicate | predicate which returns either true for accepting element or false for rejecting it |
clone_axes | whether axes of the fullMesh should be cloned (if true ) or shared (if false ; default) |
Definition at line 23 of file rectangular_masked3d.cpp.
|
inline |
Construct masked mesh with all elements of fullMesh
which have required materials in the midpoints.
Preserve order of elements and nodes of fullMesh
.
fullMesh | input mesh, before masking |
geom | geometry to get materials from |
materialPredicate | predicate which returns either true for accepting material or false for rejecting it |
clone_axes | whether axes of the fullMesh should be cloned (if true ) or shared (if false ; default) |
Definition at line 394 of file rectangular_masked3d.hpp.
|
inline |
Construct masked mesh with all elements of rectangularMesh
which have required kinds of materials (in the midpoints).
Preserve order of elements and nodes of rectangularMesh
.
rectangularMesh | input mesh, before masking |
geom | geometry to get materials from |
materialKinds | one or more kinds of material encoded with bit or operation, e.g. DIELECTRIC|METAL for selecting all dielectrics and metals, or ~ (DIELECTRIC|METAL) for selecting everything else |
clone_axes | whether axes of the rectangularMesh should be cloned (if true ) or shared (if false ; default) |
Definition at line 425 of file rectangular_masked3d.hpp.
plask::RectangularMaskedMesh3D::RectangularMaskedMesh3D | ( | const RectangularMesh< DIM > & | rectangularMesh, |
Set | nodeSet, | ||
bool | clone_axes = false |
||
) |
Construct a mesh with given set of nodes.
Set of elements are calculated on-demand, just before the first use, according to the rule: An element is selected if and only if all its vertices are included in the nodeSet
.
This constructor is used by getElementMesh.
|
inline |
Get point with given mesh indices.
index0 | index of point in axis[0] |
index1 | index of point in axis[1] |
index2 | index of point in axis[2] |
index
Definition at line 499 of file rectangular_masked3d.hpp.
|
override |
Definition at line 153 of file rectangular_masked3d.cpp.
|
override |
Definition at line 177 of file rectangular_masked3d.cpp.
|
override |
Definition at line 169 of file rectangular_masked3d.cpp.
|
override |
Definition at line 217 of file rectangular_masked3d.cpp.
|
override |
Definition at line 157 of file rectangular_masked3d.cpp.
|
override |
Definition at line 187 of file rectangular_masked3d.cpp.
|
override |
Definition at line 122 of file rectangular_masked3d.cpp.
|
override |
Definition at line 114 of file rectangular_masked3d.cpp.
|
override |
Definition at line 135 of file rectangular_masked3d.cpp.
|
override |
Definition at line 127 of file rectangular_masked3d.cpp.
|
override |
Definition at line 148 of file rectangular_masked3d.cpp.
|
override |
Definition at line 140 of file rectangular_masked3d.cpp.
|
override |
Definition at line 161 of file rectangular_masked3d.cpp.
|
override |
Definition at line 197 of file rectangular_masked3d.cpp.
|
override |
Definition at line 165 of file rectangular_masked3d.cpp.
|
override |
Definition at line 207 of file rectangular_masked3d.cpp.
|
override |
Definition at line 173 of file rectangular_masked3d.cpp.
|
override |
Definition at line 227 of file rectangular_masked3d.cpp.
|
inline |
Get an element with a given index i
.
i | index of the element |
Definition at line 469 of file rectangular_masked3d.hpp.
|
inline |
Definition at line 461 of file rectangular_masked3d.hpp.
|
inline |
Definition at line 458 of file rectangular_masked3d.hpp.
|
inline |
Get an element with a given index i
.
i | index of the element |
Definition at line 476 of file rectangular_masked3d.hpp.
|
inline |
Definition at line 462 of file rectangular_masked3d.hpp.
|
inline |
Get an area of a given element.
index0,index1,index2 | axes 0, 1 and 1 indexes of the element |
Definition at line 621 of file rectangular_masked3d.hpp.
|
inline |
Get element as rectangle.
index0,index1,index2 | index of Elements |
Definition at line 639 of file rectangular_masked3d.hpp.
|
inline |
Convert mesh indexes of a back-left-bottom corner of an element to the index of this element.
axis0_index | index of the corner along the axis[0] (back), from 0 to axis[0]->size()-1 |
axis1_index | index of the corner along the axis[1] (left), from 0 to axis[1]->size()-1 |
axis2_index | index of the corner along the axis[2] (bottom), from 0 to axis[2]->size()-1 |
Definition at line 612 of file rectangular_masked3d.hpp.
|
inline |
Return a mesh that enables iterating over middle points of the selected rectangles.
Definition at line 518 of file rectangular_masked3d.hpp.
|
inline |
Get point in center of Elements.
index0,index1,index2 | index of Elements |
Definition at line 630 of file rectangular_masked3d.hpp.
|
inline |
Get third coordinate of point in the center of an elements.
index2 | index of the element (axis2 index) |
Definition at line 61 of file rectangular_masked3d.hpp.
|
inline |
Definition at line 459 of file rectangular_masked3d.hpp.
|
inline |
Get number of elements (for FEM method) in the third direction.
Definition at line 52 of file rectangular_masked3d.hpp.
|
inline |
Calculate this mesh index using indexes of axis0 and axis1.
axis0_index | index of axis0, from 0 to axis[0]->size()-1 |
axis1_index | index of axis1, from 0 to axis[1]->size()-1 |
axis2_index | index of axis2, from 0 to axis[2]->size()-1 |
Definition at line 485 of file rectangular_masked3d.hpp.
|
inline |
Calculate index of axis2 using this mesh index.
mesh_index | this mesh index, from 0 to size()-1 |
Definition at line 35 of file rectangular_masked3d.hpp.
|
inline |
Calculate (using linear interpolation) value of data in point using data in points described 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 556 of file rectangular_masked3d.hpp.
|
inline |
Calculate (using nearest neighbor interpolation) value of data in point using data in points described 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 588 of file rectangular_masked3d.hpp.
|
inline |
Calculate index of middle axis using given mesh index.
mesh_index | this mesh index, from 0 to size()-1 |
Definition at line 44 of file rectangular_masked3d.hpp.
|
inline |
Get point with given x and y indexes.
axis0_index | index of axis[0], from 0 to axis[0]->size()-1 |
axis1_index | index of axis[1], from 0 to axis[1]->size()-1 |
axis1_index | index of axis[2], from 0 to axis[2]->size()-1 |
Definition at line 510 of file rectangular_masked3d.hpp.
bool plask::RectangularMaskedMesh3D::prepareInterpolation | ( | const Vec< 3 > & | point, |
Vec< 3 > & | wrapped_point, | ||
std::size_t & | index0_lo, | ||
std::size_t & | index0_hi, | ||
std::size_t & | index1_lo, | ||
std::size_t & | index1_hi, | ||
std::size_t & | index2_lo, | ||
std::size_t & | index2_hi, | ||
const InterpolationFlags & | flags | ||
) | const |
Prepare point for inteprolation.
point | point to check | |
[out] | wrapped_point | point after wrapping with interpolation flags |
[out] | index0_lo,index0_hi | surrounding indices in the rectantular mesh for axis0 |
[out] | index1_lo,index1_hi | surrounding indices in the rectantular mesh for axis1 |
[out] | index2_lo,index2_hi | surrounding indices in the rectantular mesh for axis2 |
flags | interpolation flags |
false
if the point falls in the hole or outside of the mesh, true
if it can be interpolated Definition at line 68 of file rectangular_masked3d.cpp.
Change a selection of elements used to once pointed by a given predicate
.
predicate | predicate which returns either true for accepting element or false for rejecting it |
Definition at line 18 of file rectangular_masked3d.cpp.
void plask::RectangularMaskedMesh3D::reset | ( | const RectangularMesh< 3 > & | fullMesh, |
const Predicate & | predicate, | ||
bool | clone_axes = false |
||
) |
Change parameter of this mesh to use elements of fullMesh
chosen by a predicate
.
Preserve order of elements and nodes of fullMesh
.
rectangularMesh | input mesh, before masking |
predicate | predicate which returns either true for accepting element or false for rejecting it |
clone_axes | whether axes of the fullMesh should be cloned (if true ) or shared with fullMesh (if false ; default) |
Definition at line 29 of file rectangular_masked3d.cpp.
|
inline |
Change parameter of this mesh to use all elements of rectangularMesh
which have required materials in the midpoints.
Preserve order of elements and nodes of rectangularMesh
.
rectangularMesh | input mesh, before masking |
geom | geometry to get materials from |
materialPredicate | predicate which returns either true for accepting material or false for rejecting it |
clone_axes | whether axes of the rectangularMesh should be cloned (if true ) or shared (if false ; default) |
Definition at line 409 of file rectangular_masked3d.hpp.
|
inline |
Change parameters of this mesh to use all elements of rectangularMesh
which have required kinds of materials (in the midpoints).
Preserve order of elements and nodes of rectangularMesh
.
rectangularMesh | input mesh, before masking |
geom | geometry to get materials from |
materialKinds | one or more kinds of material encoded with bit or operation, e.g. DIELECTRIC|METAL for selecting all dielectrics and metals, or ~ (DIELECTRIC|METAL) for selecting everything else |
clone_axes | whether axes of the rectangularMesh should be cloned (if true ) or shared (if false ; default) |
Definition at line 442 of file rectangular_masked3d.hpp.