preCICE v3.1.2
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
precice::mesh::Triangle Class Reference

Triangle of a mesh, defined by three vertices. More...

#include <Triangle.hpp>

Collaboration diagram for precice::mesh::Triangle:
[legend]

Public Types

using const_iterator = IndexRangeIterator<const Triangle, const Vertex::RawCoords>
 Type of the read-only const random-access iterator over Vertex coords.
 
using iterator = const_iterator
 Type of the read-only random access vertex iterator.
 
using value_type = Vertex::RawCoords
 Fix for the Boost.Test versions 1.65.1 - 1.67.
 

Public Member Functions

 Triangle (Edge &edgeOne, Edge &edgeTwo, Edge &edgeThree)
 Constructor based on 3 edges.
 
 Triangle (Vertex &VertexOne, Vertex &VertexTwo, Vertex &VertexThree)
 
int getDimensions () const
 Returns dimensionalty of space the triangle is embedded in.
 
Vertexvertex (int i)
 Returns triangle vertex with index 0, 1 or 2.
 
const Vertexvertex (int i) const
 Returns const triangle vertex with index 0, 1 or 2.
 
Eigen::VectorXd computeNormal () const
 Computes the normal of the triangle.
 
double getArea () const
 Returns the surface area of the triangle.
 
const Eigen::VectorXd getCenter () const
 Returns the barycenter of the triangle.
 
double getEnclosingRadius () const
 Returns the radius of the circle enclosing the triangle.
 
bool operator== (const Triangle &other) const
 Compares two Triangles for equality.
 
bool operator!= (const Triangle &other) const
 Not equal, implemented in terms of equal.
 
bool operator< (const Triangle &other) const
 Weak ordering based on vertex ids.
 
Iterators
iterator begin ()
 Returns a read-only random-access iterator to the begin (0) of the vertex range [0,1,2].
 
iterator end ()
 Returns a read-only random-access iterator to the end (3) of the vertex range [0,1,2].
 
const_iterator begin () const
 Returns a read-only random-access iterator to the begin (0) of the vertex range [0,1,2].
 
const_iterator end () const
 Returns a read-only random access iterator to the end (3) of the vertex range [0,1,2].
 
const_iterator cbegin () const
 Returns a read-only random-access iterator to the begin (0) of the vertex range [0,1,2].
 
const_iterator cend () const
 Returns a read-only random access iterator to the end (3) of the vertex range [0,1,2].
 

Static Public Attributes

static constexpr int vertexCount {3}
 Amount of vertices.
 

Private Attributes

std::array< Vertex *, 3 > _vertices
 Vertices defining the triangle, sorted by Vertex::getID()
 

Detailed Description

Triangle of a mesh, defined by three vertices.

Definition at line 27 of file Triangle.hpp.

Member Typedef Documentation

◆ const_iterator

Type of the read-only const random-access iterator over Vertex coords.

This index-based iterator iterates over the vertices of this Triangle. The returned value is the forwarded result of Vertex::getCoords. It is thus a read-only random-access iterator.

Definition at line 35 of file Triangle.hpp.

◆ iterator

Type of the read-only random access vertex iterator.

Definition at line 38 of file Triangle.hpp.

◆ value_type

Fix for the Boost.Test versions 1.65.1 - 1.67.

Definition at line 41 of file Triangle.hpp.

Constructor & Destructor Documentation

◆ Triangle() [1/2]

precice::mesh::Triangle::Triangle ( Edge & edgeOne,
Edge & edgeTwo,
Edge & edgeThree )

Constructor based on 3 edges.

Definition at line 23 of file Triangle.cpp.

Here is the call graph for this function:

◆ Triangle() [2/2]

precice::mesh::Triangle::Triangle ( Vertex & VertexOne,
Vertex & VertexTwo,
Vertex & VertexThree )

Constructor based on 3 vertices

The vertices will be sorted by Vertex::getID(). This allows to weakly order triangles.

Definition at line 56 of file Triangle.cpp.

Member Function Documentation

◆ begin() [1/2]

Triangle::iterator precice::mesh::Triangle::begin ( )
inline

Returns a read-only random-access iterator to the begin (0) of the vertex range [0,1,2].

Definition at line 155 of file Triangle.hpp.

◆ begin() [2/2]

Triangle::const_iterator precice::mesh::Triangle::begin ( ) const
inline

Returns a read-only random-access iterator to the begin (0) of the vertex range [0,1,2].

Definition at line 165 of file Triangle.hpp.

◆ cbegin()

Triangle::const_iterator precice::mesh::Triangle::cbegin ( ) const
inline

Returns a read-only random-access iterator to the begin (0) of the vertex range [0,1,2].

Definition at line 175 of file Triangle.hpp.

Here is the call graph for this function:

◆ cend()

Triangle::const_iterator precice::mesh::Triangle::cend ( ) const
inline

Returns a read-only random access iterator to the end (3) of the vertex range [0,1,2].

Definition at line 180 of file Triangle.hpp.

Here is the call graph for this function:

◆ computeNormal()

Eigen::VectorXd precice::mesh::Triangle::computeNormal ( ) const

Computes the normal of the triangle.

Definition at line 75 of file Triangle.cpp.

Here is the call graph for this function:

◆ end() [1/2]

Triangle::iterator precice::mesh::Triangle::end ( )
inline

Returns a read-only random-access iterator to the end (3) of the vertex range [0,1,2].

Definition at line 160 of file Triangle.hpp.

◆ end() [2/2]

Triangle::const_iterator precice::mesh::Triangle::end ( ) const
inline

Returns a read-only random access iterator to the end (3) of the vertex range [0,1,2].

Definition at line 170 of file Triangle.hpp.

◆ getArea()

double precice::mesh::Triangle::getArea ( ) const

Returns the surface area of the triangle.

Definition at line 70 of file Triangle.cpp.

Here is the call graph for this function:

◆ getCenter()

const Eigen::VectorXd precice::mesh::Triangle::getCenter ( ) const

Returns the barycenter of the triangle.

Definition at line 89 of file Triangle.cpp.

◆ getDimensions()

int precice::mesh::Triangle::getDimensions ( ) const

Returns dimensionalty of space the triangle is embedded in.

Definition at line 84 of file Triangle.cpp.

◆ getEnclosingRadius()

double precice::mesh::Triangle::getEnclosingRadius ( ) const

Returns the radius of the circle enclosing the triangle.

Definition at line 94 of file Triangle.cpp.

Here is the call graph for this function:

◆ operator!=()

bool precice::mesh::Triangle::operator!= ( const Triangle & other) const

Not equal, implemented in terms of equal.

Definition at line 108 of file Triangle.cpp.

◆ operator<()

bool precice::mesh::Triangle::operator< ( const Triangle & other) const
inline

Weak ordering based on vertex ids.

Definition at line 130 of file Triangle.hpp.

Here is the call graph for this function:

◆ operator==()

bool precice::mesh::Triangle::operator== ( const Triangle & other) const

Compares two Triangles for equality.

Two Triangles are equal if the three edges are equal, whereas the order of edges is NOT important.

Definition at line 102 of file Triangle.cpp.

Here is the call graph for this function:

◆ vertex() [1/2]

Vertex & precice::mesh::Triangle::vertex ( int i)
inline

Returns triangle vertex with index 0, 1 or 2.

Vertex 0 is the first vertex of edge 0. Vertex 1 the second vertex of edge 0. Vertex 2 is either the first or second vertex of edge 1, which is determined on construction of the triangle.

Definition at line 143 of file Triangle.hpp.

◆ vertex() [2/2]

const Vertex & precice::mesh::Triangle::vertex ( int i) const
inline

Returns const triangle vertex with index 0, 1 or 2.

Vertex 0 is the first vertex of edge 0. Vertex 1 the second vertex of edge 0. Vertex 2 is either the first or second vertex of edge 1, which is determined on construction of the triangle.

Definition at line 149 of file Triangle.hpp.

Member Data Documentation

◆ _vertices

std::array<Vertex *, 3> precice::mesh::Triangle::_vertices
private

Vertices defining the triangle, sorted by Vertex::getID()

Definition at line 138 of file Triangle.hpp.

◆ vertexCount

constexpr int precice::mesh::Triangle::vertexCount {3}
staticconstexpr

Amount of vertices.

Definition at line 44 of file Triangle.hpp.


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