oomph::TriangleMeshPolyLine Class Reference

Class defining a polyline for use in Triangle Mesh generation. More...

#include <unstructured_two_d_mesh_geometry_base.h>

+ Inheritance diagram for oomph::TriangleMeshPolyLine:

Public Member Functions

 TriangleMeshPolyLine (const Vector< Vector< double >> &vertex_coordinate, const unsigned &boundary_id, const unsigned &boundary_chunk=0)
 
virtual ~TriangleMeshPolyLine ()
 Empty destructor. More...
 
unsigned nvertex () const
 Number of vertices. More...
 
unsigned nsegment () const
 Number of segments. More...
 
unsigned boundary_id () const
 Boundary id. More...
 
unsigned boundary_chunk () const
 
Vector< doublevertex_coordinate (const unsigned &i) const
 Coordinate vector of i-th vertex (const version) More...
 
Vector< double > & vertex_coordinate (const unsigned &i)
 Coordinate vector of i-th vertex. More...
 
void initial_vertex_coordinate (Vector< double > &vertex)
 Get first vertex coordinates. More...
 
void final_vertex_coordinate (Vector< double > &vertex)
 Get last vertex coordinates. More...
 
void output (std::ostream &outfile, const unsigned &n_sample=50)
 Output the polyline – n_sample is ignored. More...
 
void reverse ()
 
- Public Member Functions inherited from oomph::TriangleMeshCurveSection
 TriangleMeshCurveSection ()
 Empty constructor. Initialises the curve section as non connected. More...
 
virtual ~TriangleMeshCurveSection ()
 Empty destructor. More...
 
void enable_refinement_tolerance (const double &tolerance=0.08)
 
void set_refinement_tolerance (const double &tolerance)
 
double refinement_tolerance ()
 
void disable_refinement_tolerance ()
 Disable refinement of curve section. More...
 
void enable_unrefinement_tolerance (const double &tolerance=0.04)
 
void set_unrefinement_tolerance (const double &tolerance)
 
double unrefinement_tolerance ()
 
void disable_unrefinement_tolerance ()
 Disable unrefinement of curve sections. More...
 
void set_maximum_length (const double &maximum_length)
 
void disable_use_maximum_length ()
 
double maximum_length ()
 Gets access to the maximum length variable. More...
 
void connect_initial_vertex_to_polyline (TriangleMeshPolyLine *polyline_pt, const unsigned &vertex_number, const double &tolerance_for_connection=1.0e-14)
 
void connect_final_vertex_to_polyline (TriangleMeshPolyLine *polyline_pt, const unsigned &vertex_number, const double &tolerance_for_connection=1.0e-14)
 
void connect_initial_vertex_to_curviline (TriangleMeshCurviLine *curviline_pt, const double &s_value, const double &tolerance_for_connection=1.0e-14)
 
void connect_final_vertex_to_curviline (TriangleMeshCurviLine *curviline_pt, const double &s_value, const double &tolerance_for_connection=1.0e-14)
 
bool is_initial_vertex_connected () const
 Test whether initial vertex is connected or not. More...
 
void set_initial_vertex_connected ()
 Sets the initial vertex as connected. More...
 
void unset_initial_vertex_connected ()
 Sets the initial vertex as non connected. More...
 
void suspend_initial_vertex_connected ()
 
void resume_initial_vertex_connected ()
 
bool is_final_vertex_connected () const
 Test whether final vertex is connected or not. More...
 
void set_final_vertex_connected ()
 Sets the final vertex as connected. More...
 
void unset_final_vertex_connected ()
 Sets the final vertex as non connected. More...
 
void suspend_final_vertex_connected ()
 
void resume_final_vertex_connected ()
 
unsigned initial_vertex_connected_bnd_id () const
 Gets the id to which the initial end is connected. More...
 
unsignedinitial_vertex_connected_bnd_id ()
 Sets the id to which the initial end is connected. More...
 
unsigned initial_vertex_connected_n_vertex () const
 Gets the vertex number to which the initial end is connected. More...
 
unsignedinitial_vertex_connected_n_vertex ()
 Sets the vertex number to which the initial end is connected. More...
 
unsigned initial_vertex_connected_n_chunk () const
 Gets the boundary chunk to which the initial end is connected. More...
 
unsignedinitial_vertex_connected_n_chunk ()
 Sets the boundary chunk to which the initial end is connected. More...
 
unsigned final_vertex_connected_bnd_id () const
 Gets the id to which the final end is connected. More...
 
unsignedfinal_vertex_connected_bnd_id ()
 Sets the id to which the final end is connected. More...
 
unsigned final_vertex_connected_n_vertex () const
 Sets the vertex number to which the final end is connected. More...
 
unsignedfinal_vertex_connected_n_vertex ()
 Gets the vertex number to which the final end is connected. More...
 
unsigned final_vertex_connected_n_chunk () const
 Gets the boundary chunk to which the final end is connected. More...
 
unsignedfinal_vertex_connected_n_chunk ()
 Sets the boundary chunk to which the final end is connected. More...
 
bool is_initial_vertex_connected_to_curviline () const
 Test whether the initial vertex is connected to a curviline. More...
 
void set_initial_vertex_connected_to_curviline ()
 Sets the initial vertex as connected to a curviline. More...
 
void unset_initial_vertex_connected_to_curviline ()
 Sets the initial vertex as non connected to a curviline. More...
 
bool is_final_vertex_connected_to_curviline () const
 Test whether the final vertex is connected to a curviline. More...
 
void set_final_vertex_connected_to_curviline ()
 Sets the final vertex as connected to a curviline. More...
 
void unset_final_vertex_connected_to_curviline ()
 Sets the final vertex as non connected to a curviline. More...
 
double initial_s_connection_value () const
 Gets the s value to which the initial end is connected. More...
 
doubleinitial_s_connection_value ()
 Sets the s value to which the initial end is connected. More...
 
double final_s_connection_value () const
 Gets the s value to which the final end is connected. More...
 
doublefinal_s_connection_value ()
 Sets the s value to which the final end is connected. More...
 
double tolerance_for_s_connection () const
 
doubletolerance_for_s_connection ()
 

Private Attributes

Vector< Vector< double > > Vertex_coordinate
 Vector of Vector of vertex coordinates. More...
 
unsigned Boundary_id
 Boundary ID. More...
 
unsigned Boundary_chunk
 

Additional Inherited Members

- Protected Attributes inherited from oomph::TriangleMeshCurveSection
bool Initial_vertex_connected
 
bool Final_vertex_connected
 
bool Initial_vertex_connected_suspended
 
bool Final_vertex_connected_suspended
 
unsigned Initial_vertex_connected_bnd_id
 Stores the id to which the initial end is connected. More...
 
unsigned Initial_vertex_connected_n_vertex
 
unsigned Initial_vertex_connected_n_chunk
 
unsigned Final_vertex_connected_bnd_id
 Stores the id to which the initial end is connected. More...
 
unsigned Final_vertex_connected_n_vertex
 
unsigned Final_vertex_connected_n_chunk
 
bool Initial_vertex_connected_to_curviline
 States if the initial vertex is connected to a curviline. More...
 
bool Final_vertex_connected_to_curviline
 States if the final vertex is connected to a curviline. More...
 
double Initial_s_connection_value
 
double Final_s_connection_value
 
double Tolerance_for_s_connection
 Tolerance used for connecting the ends to a curviline. More...
 

Detailed Description

Class defining a polyline for use in Triangle Mesh generation.

Constructor & Destructor Documentation

◆ TriangleMeshPolyLine()

oomph::TriangleMeshPolyLine::TriangleMeshPolyLine ( const Vector< Vector< double >> &  vertex_coordinate,
const unsigned boundary_id,
const unsigned boundary_chunk = 0 
)
inline

Constructor: Takes vectors of vertex coordinates in order Also allows the optional specification of a boundary ID – useful in a mesh generation context. If not specified it defaults to zero.

880  {
881 #ifdef PARANOID
882  unsigned nvert = Vertex_coordinate.size();
883  for (unsigned i = 0; i < nvert; i++)
884  {
885  if (Vertex_coordinate[i].size() != 2)
886  {
887  std::ostringstream error_stream;
888  error_stream << "TriangleMeshPolyLine should only be used in 2D!\n"
889  << "Your Vector of coordinates, contains data for "
890  << Vertex_coordinate[i].size()
891  << "-dimensional coordinates." << std::endl;
892  throw OomphLibError(error_stream.str(),
895  }
896  }
897 #endif
898  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
TriangleMeshCurveSection()
Empty constructor. Initialises the curve section as non connected.
Definition: unstructured_two_d_mesh_geometry_base.h:166
unsigned Boundary_id
Boundary ID.
Definition: unstructured_two_d_mesh_geometry_base.h:1096
unsigned boundary_chunk() const
Definition: unstructured_two_d_mesh_geometry_base.h:923
unsigned Boundary_chunk
Definition: unstructured_two_d_mesh_geometry_base.h:1100
Vector< Vector< double > > Vertex_coordinate
Vector of Vector of vertex coordinates.
Definition: unstructured_two_d_mesh_geometry_base.h:1093
Vector< double > vertex_coordinate(const unsigned &i) const
Coordinate vector of i-th vertex (const version)
Definition: unstructured_two_d_mesh_geometry_base.h:929
unsigned boundary_id() const
Boundary id.
Definition: unstructured_two_d_mesh_geometry_base.h:916
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References i, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, size, and Vertex_coordinate.

◆ ~TriangleMeshPolyLine()

virtual oomph::TriangleMeshPolyLine::~TriangleMeshPolyLine ( )
inlinevirtual

Empty destructor.

901 {}

Member Function Documentation

◆ boundary_chunk()

unsigned oomph::TriangleMeshPolyLine::boundary_chunk ( ) const
inlinevirtual

Boundary chunk (Used when a boundary is represented by more than one polyline

Implements oomph::TriangleMeshCurveSection.

924  {
925  return Boundary_chunk;
926  }

References Boundary_chunk.

Referenced by oomph::TriangleMeshCurveSection::connect_final_vertex_to_polyline(), and oomph::TriangleMeshCurveSection::connect_initial_vertex_to_polyline().

◆ boundary_id()

unsigned oomph::TriangleMeshPolyLine::boundary_id ( ) const
inlinevirtual

◆ final_vertex_coordinate()

void oomph::TriangleMeshPolyLine::final_vertex_coordinate ( Vector< double > &  vertex)
inlinevirtual

Get last vertex coordinates.

Implements oomph::TriangleMeshCurveSection.

948  {
949  vertex = Vertex_coordinate[nvertex() - 1];
950  }
unsigned nvertex() const
Number of vertices.
Definition: unstructured_two_d_mesh_geometry_base.h:904

References nvertex(), and Vertex_coordinate.

◆ initial_vertex_coordinate()

void oomph::TriangleMeshPolyLine::initial_vertex_coordinate ( Vector< double > &  vertex)
inlinevirtual

Get first vertex coordinates.

Implements oomph::TriangleMeshCurveSection.

942  {
943  vertex = Vertex_coordinate[0];
944  }

References Vertex_coordinate.

◆ nsegment()

unsigned oomph::TriangleMeshPolyLine::nsegment ( ) const
inlinevirtual

Number of segments.

Implements oomph::TriangleMeshCurveSection.

911  {
912  return Vertex_coordinate.size() - 1;
913  }

References Vertex_coordinate.

◆ nvertex()

◆ output()

void oomph::TriangleMeshPolyLine::output ( std::ostream &  outfile,
const unsigned n_sample = 50 
)
inlinevirtual

Output the polyline – n_sample is ignored.

Implements oomph::TriangleMeshCurveSection.

954  {
955  outfile << "ZONE T=\"TriangleMeshPolyLine with boundary ID" << Boundary_id
956  << "\"" << std::endl;
957  unsigned nvert = Vertex_coordinate.size();
958  for (unsigned i = 0; i < nvert; i++)
959  {
960  outfile << Vertex_coordinate[i][0] << " " << Vertex_coordinate[i][1]
961  << std::endl;
962  }
963  }

References Boundary_id, i, and Vertex_coordinate.

◆ reverse()

void oomph::TriangleMeshPolyLine::reverse ( )
inline

Reverse the polyline, this includes the connection information and the vertices order

968  {
969  // Do the reversing of the connection information
970 
971  // Is there a connection to the initial vertex
972  const bool initial_connection = is_initial_vertex_connected();
973 
974  // Is there a connection to the initial vertex
975  const bool final_connection = is_final_vertex_connected();
976 
977  // If there are any connection at the ends that info. needs to be
978  // reversed
979  if (initial_connection || final_connection)
980  {
981  // Backup the connection information
982 
983  // -------------------------------------------------------------------
984  // Backup the initial vertex connection information
985  // The boundary id
986  const unsigned backup_initial_vertex_connected_bnd_id =
988  // The chunk number
989  const unsigned backup_initial_vertex_connected_chunk =
991  // The vertex number
992  const unsigned backup_initial_vertex_connected_n_vertex =
994  // Is it connected to a curviline
995  const bool backup_initial_vertex_connected_to_curviline =
997  // The s value for the curviline connection
998  const double backup_initial_s_connection = initial_s_connection_value();
999  // The tolerance
1000  const double backup_initial_s_tolerance = tolerance_for_s_connection();
1001 
1002  // -------------------------------------------------------------------
1003  // Backup the final vertex connection information
1004  // The boundary id
1005  const unsigned backup_final_vertex_connected_bnd_id =
1007  // The chunk number
1008  const unsigned backup_final_vertex_connected_chunk =
1010  // The vertex number
1011  const unsigned backup_final_vertex_connected_n_vertex =
1013  // Is it connected to a curviline
1014  const bool backup_final_vertex_connected_to_curviline =
1016  // The s value for the curviline connection
1017  const double backup_final_s_connection = final_s_connection_value();
1018  // The tolerance
1019  const double backup_final_s_tolerance = tolerance_for_s_connection();
1020  // -------------------------------------------------------------------
1021 
1022  // Disconnect the polyline
1023 
1024  // Disconnect the initial vertex
1027 
1028  // Disconnect the final vertex
1031 
1032  // Now reconnected but in inverted order
1033  if (initial_connection)
1034  {
1035  // Set the final vertex as connected
1037  // Copy the boundary id
1039  backup_initial_vertex_connected_bnd_id;
1040  // Copy the chunk number
1042  backup_initial_vertex_connected_chunk;
1043  // Copy the vertex number
1045  backup_initial_vertex_connected_n_vertex;
1046  // Is it connected to a curviline
1047  if (backup_initial_vertex_connected_to_curviline)
1048  {
1049  // Set the final vertex as connected to curviline
1051  // Copy the s value to connected
1052  final_s_connection_value() = backup_initial_s_connection;
1053  // Copy the tolerance
1054  tolerance_for_s_connection() = backup_initial_s_tolerance;
1055  } // if (backup_initial_vertex_connected_to_curviline)
1056 
1057  } // if (initial_connection)
1058 
1059  if (final_connection)
1060  {
1061  // Set the initial vertex as connected
1063  // Copy the boundary id
1065  backup_final_vertex_connected_bnd_id;
1066  // Copy the chunk number
1068  backup_final_vertex_connected_chunk;
1069  // Copy the vertex number
1071  backup_final_vertex_connected_n_vertex;
1072  // Is it connected to a curviline
1073  if (backup_final_vertex_connected_to_curviline)
1074  {
1075  // Set the initial vertex as connected to curviline
1077  // Copy the s value to connected
1078  initial_s_connection_value() = backup_final_s_connection;
1079  // Copy the tolerance
1080  tolerance_for_s_connection() = backup_final_s_tolerance;
1081  } // if (backup_final_vertex_connected_to_curviline)
1082 
1083  } // if (final_connection)
1084 
1085  } // if (initial_connection || final_connection)
1086 
1087  // Do the reversing of the vertices
1089  }
void reverse(const MatrixType &m)
Definition: array_reverse.cpp:17
bool is_initial_vertex_connected_to_curviline() const
Test whether the initial vertex is connected to a curviline.
Definition: unstructured_two_d_mesh_geometry_base.h:511
void unset_final_vertex_connected_to_curviline()
Sets the final vertex as non connected to a curviline.
Definition: unstructured_two_d_mesh_geometry_base.h:541
double final_s_connection_value() const
Gets the s value to which the final end is connected.
Definition: unstructured_two_d_mesh_geometry_base.h:559
double tolerance_for_s_connection() const
Definition: unstructured_two_d_mesh_geometry_base.h:572
unsigned initial_vertex_connected_n_vertex() const
Gets the vertex number to which the initial end is connected.
Definition: unstructured_two_d_mesh_geometry_base.h:451
unsigned final_vertex_connected_n_chunk() const
Gets the boundary chunk to which the final end is connected.
Definition: unstructured_two_d_mesh_geometry_base.h:499
void unset_initial_vertex_connected()
Sets the initial vertex as non connected.
Definition: unstructured_two_d_mesh_geometry_base.h:363
unsigned final_vertex_connected_n_vertex() const
Sets the vertex number to which the final end is connected.
Definition: unstructured_two_d_mesh_geometry_base.h:487
bool is_final_vertex_connected_to_curviline() const
Test whether the final vertex is connected to a curviline.
Definition: unstructured_two_d_mesh_geometry_base.h:529
bool is_final_vertex_connected() const
Test whether final vertex is connected or not.
Definition: unstructured_two_d_mesh_geometry_base.h:395
unsigned initial_vertex_connected_bnd_id() const
Gets the id to which the initial end is connected.
Definition: unstructured_two_d_mesh_geometry_base.h:439
bool is_initial_vertex_connected() const
Test whether initial vertex is connected or not.
Definition: unstructured_two_d_mesh_geometry_base.h:351
void set_initial_vertex_connected()
Sets the initial vertex as connected.
Definition: unstructured_two_d_mesh_geometry_base.h:357
void set_final_vertex_connected()
Sets the final vertex as connected.
Definition: unstructured_two_d_mesh_geometry_base.h:401
void unset_final_vertex_connected()
Sets the final vertex as non connected.
Definition: unstructured_two_d_mesh_geometry_base.h:407
void set_initial_vertex_connected_to_curviline()
Sets the initial vertex as connected to a curviline.
Definition: unstructured_two_d_mesh_geometry_base.h:517
double initial_s_connection_value() const
Gets the s value to which the initial end is connected.
Definition: unstructured_two_d_mesh_geometry_base.h:547
unsigned initial_vertex_connected_n_chunk() const
Gets the boundary chunk to which the initial end is connected.
Definition: unstructured_two_d_mesh_geometry_base.h:463
void set_final_vertex_connected_to_curviline()
Sets the final vertex as connected to a curviline.
Definition: unstructured_two_d_mesh_geometry_base.h:535
unsigned final_vertex_connected_bnd_id() const
Gets the id to which the final end is connected.
Definition: unstructured_two_d_mesh_geometry_base.h:475
void unset_initial_vertex_connected_to_curviline()
Sets the initial vertex as non connected to a curviline.
Definition: unstructured_two_d_mesh_geometry_base.h:523

References oomph::TriangleMeshCurveSection::final_s_connection_value(), oomph::TriangleMeshCurveSection::final_vertex_connected_bnd_id(), oomph::TriangleMeshCurveSection::final_vertex_connected_n_chunk(), oomph::TriangleMeshCurveSection::final_vertex_connected_n_vertex(), oomph::TriangleMeshCurveSection::initial_s_connection_value(), oomph::TriangleMeshCurveSection::initial_vertex_connected_bnd_id(), oomph::TriangleMeshCurveSection::initial_vertex_connected_n_chunk(), oomph::TriangleMeshCurveSection::initial_vertex_connected_n_vertex(), oomph::TriangleMeshCurveSection::is_final_vertex_connected(), oomph::TriangleMeshCurveSection::is_final_vertex_connected_to_curviline(), oomph::TriangleMeshCurveSection::is_initial_vertex_connected(), oomph::TriangleMeshCurveSection::is_initial_vertex_connected_to_curviline(), reverse(), oomph::TriangleMeshCurveSection::set_final_vertex_connected(), oomph::TriangleMeshCurveSection::set_final_vertex_connected_to_curviline(), oomph::TriangleMeshCurveSection::set_initial_vertex_connected(), oomph::TriangleMeshCurveSection::set_initial_vertex_connected_to_curviline(), oomph::TriangleMeshCurveSection::tolerance_for_s_connection(), oomph::TriangleMeshCurveSection::unset_final_vertex_connected(), oomph::TriangleMeshCurveSection::unset_final_vertex_connected_to_curviline(), oomph::TriangleMeshCurveSection::unset_initial_vertex_connected(), oomph::TriangleMeshCurveSection::unset_initial_vertex_connected_to_curviline(), and Vertex_coordinate.

◆ vertex_coordinate() [1/2]

Vector<double>& oomph::TriangleMeshPolyLine::vertex_coordinate ( const unsigned i)
inline

Coordinate vector of i-th vertex.

936  {
937  return Vertex_coordinate[i];
938  }

References i, and Vertex_coordinate.

◆ vertex_coordinate() [2/2]

Member Data Documentation

◆ Boundary_chunk

unsigned oomph::TriangleMeshPolyLine::Boundary_chunk
private

Boundary chunk (Used when a boundary is represented by more than one polyline

Referenced by boundary_chunk().

◆ Boundary_id

unsigned oomph::TriangleMeshPolyLine::Boundary_id
private

Boundary ID.

Referenced by boundary_id(), and output().

◆ Vertex_coordinate

Vector<Vector<double> > oomph::TriangleMeshPolyLine::Vertex_coordinate
private

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