PLaSK library
|
#include <plask/mesh/triangular2d.hpp>
Classes | |
struct | Builder |
Instance of this class allows for adding triangles to the mesh effectively. More... | |
struct | Element |
Represent FEM-like element (triangle) in TriangularMesh2D. More... | |
struct | ElementIndex |
Index which allows for fast finding elements which includes particular points. More... | |
class | ElementMesh |
struct | Elements |
Wrapper to TriangularMesh2D which allows for accessing FEM-like elements. More... | |
Public Types | |
typedef plask::Boundary< TriangularMesh2D > | Boundary |
Boundary type. | |
typedef std::vector< LocalCoords > | LocalCoordsVec |
typedef LocalCoordsVec::const_iterator | const_iterator |
typedef const_iterator | iterator |
typedef std::array< std::size_t, 3 > | TriangleNodeIndexes |
typedef std::function< bool(const Element &)> | Predicate |
Type of predicate function which returns bool for given element of a mesh. | |
typedef std::pair< std::size_t, std::size_t > | Segment |
Segment (two-element set of node indices) represented by a pair of indices such that first < second. | |
typedef std::unordered_map< TriangularMesh2D::Segment, std::size_t, boost::hash< Segment > > | SegmentsCounts |
Map segments to their counts. | |
Public Types inherited from plask::MeshD< 2 > | |
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 | |
Elements | getElements () const |
Elements | elements () const |
Element | getElement (std::size_t elementIndex) const |
Element | element (std::size_t elementIndex) const |
std::size_t | getElementsCount () const |
Get number of elements (triangles) in this mesh. | |
shared_ptr< ElementMesh > | getElementMesh () const |
Return a mesh that enables iterating over middle points of the rectangles. | |
LocalCoords | at (std::size_t index) const override |
Get point with given mesh index. | |
std::size_t | size () const override |
bool | empty () const override |
const_iterator | begin () const |
const_iterator | end () const |
TriangularMesh2D | masked (const Predicate &predicate) const |
Construct masked mesh with elements of this chosen by a predicate . | |
TriangularMesh2D | masked (const GeometryD< 2 > &geom, const std::function< bool(shared_ptr< const Material >)> materialPredicate) const |
Construct masked mesh with all elements of this which have required materials in the midpoints. | |
TriangularMesh2D | masked (const GeometryD< 2 > &geom, unsigned materialKinds) const |
Construct masked mesh with all elements of this which have required kinds of materials (in the midpoints). | |
void | writeXML (XMLElement &object) const override |
Write mesh to XML. | |
SegmentsCounts | countSegments () const |
Calculate numbers of segments (sides of triangles). | |
SegmentsCounts | countSegmentsIn (const Box2D &box) const |
Calculate numbers of segments (sides of triangles) inside a box . | |
SegmentsCounts | countSegmentsIn (const std::vector< Box2D > &boxes) const |
Calculate numbers of segments (sides of triangles) inside any of boxes member. | |
SegmentsCounts | countSegmentsIn (const GeometryD< 2 > &geometry, const GeometryObject &object, const PathHints *path=nullptr) const |
Calculate numbers of segments (sides of triangles) inside of object . | |
Public Member Functions inherited from plask::MeshD< 2 > | |
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 () |
Static Public Member Functions | |
static TriangularMesh2D | read (XMLReader &reader) |
Construct new mesh with data from XPL file. | |
template<typename Predicate > | |
static Boundary | getBoundary (Predicate predicate) |
static Boundary | getAllBoundary () |
Get boundary which describes all nodes which lies on all (outer and inner) boundaries of the whole mesh. | |
static Boundary | getRightBoundary () |
Get boundary which describes all nodes which lies on outer right boundary of the whole mesh. | |
static Boundary | getTopBoundary () |
Get boundary which describes all nodes which lies on outer top boundary of the whole mesh. | |
static Boundary | getLeftBoundary () |
Get boundary which describes all nodes which lies on outer left boundary of the whole mesh. | |
static Boundary | getBottomBoundary () |
Get boundary which describes all nodes which lies on outer bottom boundary of the whole mesh. | |
static Boundary | getAllBoundaryIn (const Box2D &box) |
Get boundary which describes all nodes which lies on all (outer and inner) boundaries of a given box . | |
static Boundary | getRightOfBoundary (const Box2D &box) |
Get boundary which describes all nodes which lies on right boundary of a given box . | |
static Boundary | getLeftOfBoundary (const Box2D &box) |
Get boundary which describes all nodes which lies on left boundary of a given box . | |
static Boundary | getTopOfBoundary (const Box2D &box) |
Get boundary which describes all nodes which lies on top boundary of a given box . | |
static Boundary | getBottomOfBoundary (const Box2D &box) |
Get boundary which describes all nodes which lies on bottom boundary of a given box . | |
static Boundary | getAllBoundaryIn (const std::vector< Box2D > &boxes) |
Get boundary which describes all nodes which lies on all (outer and inner) boundaries of a given boxes . | |
static Boundary | getRightOfBoundary (const std::vector< Box2D > &boxes) |
Get boundary which describes all nodes which lies on right boundaries of a given boxes . | |
static Boundary | getLeftOfBoundary (const std::vector< Box2D > &boxes) |
Get boundary which describes all nodes which lies on left boundaries of a given boxes . | |
static Boundary | getTopOfBoundary (const std::vector< Box2D > &boxes) |
Get boundary which describes all nodes which lies on top boundaries of a given boxes . | |
static Boundary | getBottomOfBoundary (const std::vector< Box2D > &boxes) |
Get boundary which describes all nodes which lies on bottom boundaries of a given boxes . | |
static Boundary | getAllBoundaryIn (shared_ptr< const GeometryObject > object) |
Get boundary which describes all nodes which lies on all (outer and inner) boundaries of a given object . | |
static Boundary | getRightOfBoundary (shared_ptr< const GeometryObject > object) |
Get boundary which describes all nodes which lies on outer right boundary of a given object . | |
static Boundary | getLeftOfBoundary (shared_ptr< const GeometryObject > object) |
Get boundary which describes all nodes which lies on outer left boundary of a given object . | |
static Boundary | getTopOfBoundary (shared_ptr< const GeometryObject > object) |
Get boundary which describes all nodes which lies on outer top boundary of a given object . | |
static Boundary | getBottomOfBoundary (shared_ptr< const GeometryObject > object) |
Get boundary which describes all nodes which lies on outer bottom boundary of a given object . | |
static Boundary | getAllBoundaryIn (shared_ptr< const GeometryObject > object, const PathHints &path) |
Get boundary which describes all nodes which lies on all (outer and inner) boundaries of a given object . | |
static Boundary | getAllBoundaryIn (shared_ptr< const GeometryObject > object, const PathHints *path) |
Get boundary which describes all nodes which lies on all (outer and inner) boundaries of a given object . | |
static Boundary | getRightOfBoundary (shared_ptr< const GeometryObject > object, const PathHints &path) |
Get boundary which describes all nodes which lies on outer right boundary of a given object . | |
static Boundary | getRightOfBoundary (shared_ptr< const GeometryObject > object, const PathHints *path) |
Get boundary which describes all nodes which lies on outer right boundary of a given object . | |
static Boundary | getLeftOfBoundary (shared_ptr< const GeometryObject > object, const PathHints &path) |
Get boundary which describes all nodes which lies on outer left boundary of a given object . | |
static Boundary | getLeftOfBoundary (shared_ptr< const GeometryObject > object, const PathHints *path) |
Get boundary which describes all nodes which lies on outer left boundary of a given object . | |
static Boundary | getTopOfBoundary (shared_ptr< const GeometryObject > object, const PathHints &path) |
Get boundary which describes all nodes which lies on outer top boundary of a given object . | |
static Boundary | getTopOfBoundary (shared_ptr< const GeometryObject > object, const PathHints *path) |
Get boundary which describes all nodes which lies on outer top boundary of a given object . | |
static Boundary | getBottomOfBoundary (shared_ptr< const GeometryObject > object, const PathHints &path) |
Get boundary which describes all nodes which lies on outer bottom boundary of a given object . | |
static Boundary | getBottomOfBoundary (shared_ptr< const GeometryObject > object, const PathHints *path) |
Get boundary which describes all nodes which lies on outer bottom boundary of a given object . | |
static Boundary | getBoundary (const std::string &boundary_desc) |
static Boundary | getBoundary (XMLReader &boundary_desc, Manager &manager) |
Public Attributes | |
LocalCoordsVec | nodes |
std::vector< TriangleNodeIndexes > | elementNodes |
Public Attributes inherited from plask::Mesh | |
boost::signals2::signal< void(Event &)> | changed |
Changed signal, fired when mesh was changed. | |
Friends | |
struct | ExtrudedTriangularMesh3D |
Additional Inherited Members | |
Protected Member Functions inherited from plask::MeshD< 2 > | |
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. | |
Definition at line 32 of file triangular2d.hpp.
Boundary type.
Definition at line 37 of file triangular2d.hpp.
typedef LocalCoordsVec::const_iterator plask::TriangularMesh2D::const_iterator |
Definition at line 41 of file triangular2d.hpp.
Definition at line 42 of file triangular2d.hpp.
typedef std::vector<LocalCoords> plask::TriangularMesh2D::LocalCoordsVec |
Definition at line 40 of file triangular2d.hpp.
typedef std::function<bool(const Element&)> plask::TriangularMesh2D::Predicate |
Type of predicate function which returns bool for given element of a mesh.
Definition at line 321 of file triangular2d.hpp.
typedef std::pair<std::size_t, std::size_t> plask::TriangularMesh2D::Segment |
Segment (two-element set of node indices) represented by a pair of indices such that first < second.
Definition at line 377 of file triangular2d.hpp.
typedef std::unordered_map<TriangularMesh2D::Segment, std::size_t, boost::hash<Segment> > plask::TriangularMesh2D::SegmentsCounts |
Map segments to their counts.
Definition at line 380 of file triangular2d.hpp.
typedef std::array<std::size_t, 3> plask::TriangularMesh2D::TriangleNodeIndexes |
Definition at line 46 of file triangular2d.hpp.
|
inlineoverridevirtual |
Get point with given mesh index.
index | index of point, from 0 to size()-1 |
index
Implements plask::MeshD< 2 >.
Definition at line 301 of file triangular2d.hpp.
|
inline |
Definition at line 315 of file triangular2d.hpp.
TriangularMesh2D::SegmentsCounts plask::TriangularMesh2D::countSegments | ( | ) | const |
Calculate numbers of segments (sides of triangles).
Definition at line 149 of file triangular2d.cpp.
TriangularMesh2D::SegmentsCounts plask::TriangularMesh2D::countSegmentsIn | ( | const Box2D & | box | ) | const |
Calculate numbers of segments (sides of triangles) inside a box
.
box | a region in which segments should be counted |
Definition at line 155 of file triangular2d.cpp.
TriangularMesh2D::SegmentsCounts plask::TriangularMesh2D::countSegmentsIn | ( | const GeometryD< 2 > & | geometry, |
const GeometryObject & | object, | ||
const PathHints * | path = nullptr |
||
) | const |
Calculate numbers of segments (sides of triangles) inside of object
.
geometry | geometry (of the mesh) which contains an object |
object | object to test |
path | path hints specifying the object |
Definition at line 180 of file triangular2d.cpp.
TriangularMesh2D::SegmentsCounts plask::TriangularMesh2D::countSegmentsIn | ( | const std::vector< Box2D > & | boxes | ) | const |
Calculate numbers of segments (sides of triangles) inside any of boxes
member.
box | vector of boxes that describes a region in which segments should be counted |
Definition at line 163 of file triangular2d.cpp.
|
inline |
Definition at line 177 of file triangular2d.hpp.
|
inline |
Definition at line 171 of file triangular2d.hpp.
|
inlineoverridevirtual |
true
only if mesh is empty (there are no points in mesh) Reimplemented from plask::Mesh.
Definition at line 310 of file triangular2d.hpp.
|
inline |
Definition at line 316 of file triangular2d.hpp.
|
inlinestatic |
Get boundary which describes all nodes which lies on all (outer and inner) boundaries of the whole mesh.
Definition at line 463 of file triangular2d.hpp.
Get boundary which describes all nodes which lies on all (outer and inner) boundaries of a given box
.
box | box which describes a region |
Definition at line 498 of file triangular2d.hpp.
|
inlinestatic |
Get boundary which describes all nodes which lies on all (outer and inner) boundaries of a given boxes
.
boxes | vector of boxes that describes a region |
Definition at line 537 of file triangular2d.hpp.
|
inlinestatic |
Get boundary which describes all nodes which lies on all (outer and inner) boundaries of a given object
.
object | object to test |
Definition at line 576 of file triangular2d.hpp.
|
inlinestatic |
Get boundary which describes all nodes which lies on all (outer and inner) boundaries of a given object
.
object | object to test |
path | path hints specifying the object |
Definition at line 617 of file triangular2d.hpp.
|
inlinestatic |
Get boundary which describes all nodes which lies on all (outer and inner) boundaries of a given object
.
object | object to test |
path | (optional) path hints specifying the object |
Definition at line 629 of file triangular2d.hpp.
|
static |
Get boundary which describes all nodes which lies on outer bottom boundary of the whole mesh.
Definition at line 350 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on bottom boundary of a given box
.
box | box which describes a region |
Definition at line 374 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on bottom boundaries of a given boxes
.
boxes | vector of boxes that describes a region |
Definition at line 398 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on outer bottom boundary of a given object
.
object | object to test |
Definition at line 440 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on outer bottom boundary of a given object
.
object | object to test |
path | path hints specifying the object |
Definition at line 446 of file triangular2d.cpp.
|
inlinestatic |
Get boundary which describes all nodes which lies on outer bottom boundary of a given object
.
object | object to test |
path | (optional) path hints specifying the object |
Definition at line 701 of file triangular2d.hpp.
|
static |
Definition at line 452 of file triangular2d.cpp.
Definition at line 372 of file triangular2d.hpp.
|
static |
Definition at line 461 of file triangular2d.cpp.
|
inline |
Definition at line 173 of file triangular2d.hpp.
|
inline |
Return a mesh that enables iterating over middle points of the rectangles.
Definition at line 264 of file triangular2d.hpp.
|
inline |
Definition at line 170 of file triangular2d.hpp.
|
inline |
Get number of elements (triangles) in this mesh.
Definition at line 185 of file triangular2d.hpp.
|
static |
Get boundary which describes all nodes which lies on outer left boundary of the whole mesh.
Definition at line 344 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on left boundary of a given box
.
box | box which describes a region |
Definition at line 368 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on left boundaries of a given boxes
.
boxes | vector of boxes that describes a region |
Definition at line 392 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on outer left boundary of a given object
.
object | object to test |
path | path hints specifying the object |
Definition at line 428 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on outer left boundary of a given object
.
object | object to test |
path | path hints specifying the object |
Definition at line 434 of file triangular2d.cpp.
|
inlinestatic |
Get boundary which describes all nodes which lies on outer left boundary of a given object
.
object | object to test |
path | (optional) path hints specifying the object |
Definition at line 665 of file triangular2d.hpp.
|
static |
Get boundary which describes all nodes which lies on outer right boundary of the whole mesh.
Definition at line 332 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on right boundary of a given box
.
box | box which describes a region |
Definition at line 356 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on right boundaries of a given boxes
.
boxes | vector of boxes that describes a region |
Definition at line 380 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on outer right boundary of a given object
.
object | object to test |
Definition at line 404 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on outer right boundary of a given object
.
object | object to test |
path | path hints specifying the object |
Definition at line 410 of file triangular2d.cpp.
|
inlinestatic |
Get boundary which describes all nodes which lies on outer right boundary of a given object
.
object | object to test |
path | (optional) path hints specifying the object |
Definition at line 647 of file triangular2d.hpp.
|
static |
Get boundary which describes all nodes which lies on outer top boundary of the whole mesh.
Definition at line 338 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on top boundary of a given box
.
box | box which describes a region |
Definition at line 362 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on top boundaries of a given boxes
.
boxes | vector of boxes that describes a region |
Definition at line 386 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on outer top boundary of a given object
.
object | object to test |
Definition at line 416 of file triangular2d.cpp.
|
static |
Get boundary which describes all nodes which lies on outer top boundary of a given object
.
object | object to test |
path | path hints specifying the object |
Definition at line 422 of file triangular2d.cpp.
|
inlinestatic |
Get boundary which describes all nodes which lies on outer top boundary of a given object
.
object | object to test |
path | (optional) path hints specifying the object |
Definition at line 683 of file triangular2d.hpp.
|
inline |
Construct masked mesh with all elements of this
which have required materials in the midpoints.
Preserve order of elements of this
.
geom | geometry to get materials from |
materialPredicate | predicate which returns either true for accepting material or false for rejecting it |
Definition at line 338 of file triangular2d.hpp.
|
inline |
Construct masked mesh with all elements of this
which have required kinds of materials (in the midpoints).
Preserve order of elements of this
.
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 |
Definition at line 351 of file triangular2d.hpp.
TriangularMesh2D plask::TriangularMesh2D::masked | ( | const Predicate & | predicate | ) | const |
Construct masked mesh with elements of this
chosen by a predicate
.
Preserve order of elements of this
.
predicate | predicate which returns either true for accepting element or false for rejecting it |
Definition at line 123 of file triangular2d.cpp.
|
static |
Construct new mesh with data from XPL file.
reader |
Definition at line 486 of file triangular2d.cpp.
|
inlineoverridevirtual |
Implements plask::Mesh.
Definition at line 306 of file triangular2d.hpp.
|
overridevirtual |
Write mesh to XML.
object | XML object to write to |
Reimplemented from plask::Mesh.
Definition at line 131 of file triangular2d.cpp.
|
friend |
Definition at line 34 of file triangular2d.hpp.
std::vector< TriangleNodeIndexes > plask::TriangularMesh2D::elementNodes |
Definition at line 48 of file triangular2d.hpp.
LocalCoordsVec plask::TriangularMesh2D::nodes |
Definition at line 44 of file triangular2d.hpp.