oomph::TetEdge Class Reference

Helper class to keep track of edges in tet mesh generation. More...

#include <gmsh_tet_mesh.template.h>

Public Member Functions

 TetEdge (const unsigned &vertex1, const unsigned &vertex2)
 
unsigned first_vertex_id () const
 First vertex id. More...
 
unsigned second_vertex_id () const
 Second vertex id. More...
 
bool is_reversed () const
 
bool operator== (const TetEdge &tet_edge) const
 
bool operator< (const TetEdge &tet_edge) const
 

Private Attributes

std::pair< unsigned, unsignedVertex_pair
 The vertices (sorted by vertex ids) More...
 
bool Reversed
 

Detailed Description

Helper class to keep track of edges in tet mesh generation.

////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////

Constructor & Destructor Documentation

◆ TetEdge()

oomph::TetEdge::TetEdge ( const unsigned vertex1,
const unsigned vertex2 
)
inline

Constructor: Pass two vertices, identified by their indices Edge "direction" is from lower vertex to higher vertex id so can compare if we're dealing with the same one...

272  {
273  if (vertex1 > vertex2)
274  {
275  Reversed = true;
276  Vertex_pair = std::make_pair(vertex2, vertex1);
277  }
278  else if (vertex1 < vertex2)
279  {
280  Reversed = false;
281  Vertex_pair = std::make_pair(vertex1, vertex2);
282  }
283  else
284  {
285  throw OomphLibError(
286  "Muppet! You can't build an edge from one vertex to the same vertex!",
289  }
290  }
std::pair< unsigned, unsigned > Vertex_pair
The vertices (sorted by vertex ids)
Definition: gmsh_tet_mesh.template.h:346
bool Reversed
Definition: gmsh_tet_mesh.template.h:350
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Reversed, and Vertex_pair.

Member Function Documentation

◆ first_vertex_id()

unsigned oomph::TetEdge::first_vertex_id ( ) const
inline

First vertex id.

295  {
296  return Vertex_pair.first;
297  }

References Vertex_pair.

Referenced by operator<(), and operator==().

◆ is_reversed()

bool oomph::TetEdge::is_reversed ( ) const
inline

Edge is reversed in the sense that vertex1 actually has a higher id than vertex2 (when specified in the constructor)

309  {
310  return Reversed;
311  }

References Reversed.

Referenced by oomph::GmshTetScaffoldMesh::write_geo_file().

◆ operator<()

bool oomph::TetEdge::operator< ( const TetEdge tet_edge) const
inline

Comparison operator. Lexicographic comparison based on vertex ids

324  {
325  if ((tet_edge.first_vertex_id() == Vertex_pair.first) &&
326  (tet_edge.second_vertex_id() == Vertex_pair.second))
327  {
328  return false;
329  }
330  else
331  {
332  if (tet_edge.first_vertex_id() == Vertex_pair.first)
333  {
334  return (tet_edge.second_vertex_id() < Vertex_pair.second);
335  }
336  else
337  {
338  return (tet_edge.first_vertex_id() < Vertex_pair.first);
339  }
340  }
341  }

References first_vertex_id(), second_vertex_id(), and Vertex_pair.

◆ operator==()

bool oomph::TetEdge::operator== ( const TetEdge tet_edge) const
inline

Comparison operator: Edges are identical if their sorted (and therefore possibly reversed) vertex ids agree

316  {
317  return ((tet_edge.first_vertex_id() == Vertex_pair.first) &&
318  (tet_edge.second_vertex_id() == Vertex_pair.second));
319  }

References first_vertex_id(), second_vertex_id(), and Vertex_pair.

◆ second_vertex_id()

unsigned oomph::TetEdge::second_vertex_id ( ) const
inline

Second vertex id.

301  {
302  return Vertex_pair.second;
303  }

References Vertex_pair.

Referenced by operator<(), and operator==().

Member Data Documentation

◆ Reversed

bool oomph::TetEdge::Reversed
private

Is it reversed? I.e. is the first input vertex stored after the second one?

Referenced by is_reversed(), and TetEdge().

◆ Vertex_pair

std::pair<unsigned, unsigned> oomph::TetEdge::Vertex_pair
private

The vertices (sorted by vertex ids)

Referenced by first_vertex_id(), operator<(), operator==(), second_vertex_id(), and TetEdge().


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