oomph::TriangleMeshOpenCurve Class Reference

#include <unstructured_two_d_mesh_geometry_base.h>

+ Inheritance diagram for oomph::TriangleMeshOpenCurve:

Public Member Functions

 TriangleMeshOpenCurve (const Vector< TriangleMeshCurveSection * > &curve_section_pt)
 Constructor. More...
 
virtual ~TriangleMeshOpenCurve ()
 Empty destructor. More...
 
unsigned nvertices () const
 Number of vertices. More...
 
unsigned nsegments () const
 Total number of segments. More...
 
void output (std::ostream &outfile, const unsigned &n_sample=50)
 Output each sub-boundary at n_sample (default: 50) points. More...
 
TriangleMeshPolyLinepolyline_pt (const unsigned &i) const
 Pointer to i-th constituent polyline. More...
 
TriangleMeshPolyLinepolyline_pt (const unsigned &i)
 Pointer to i-th constituent polyline. More...
 
- Public Member Functions inherited from oomph::TriangleMeshCurve
 TriangleMeshCurve (const Vector< TriangleMeshCurveSection * > &curve_section_pt)
 Empty constructor. More...
 
virtual ~TriangleMeshCurve ()
 Empty destructor. More...
 
unsigned max_boundary_id ()
 Return max boundary id of associated curves. More...
 
virtual unsigned ncurve_section () const
 Number of constituent curves. More...
 
void enable_polyline_refinement (const double &tolerance=0.08)
 
void set_polyline_refinement_tolerance (const double &tolerance)
 
double polyline_refinement_tolerance ()
 
void disable_polyline_refinement ()
 Disable refinement of polylines. More...
 
void enable_polyline_unrefinement (const double &tolerance=0.04)
 
void set_polyline_unrefinement_tolerance (const double &tolerance)
 
double polyline_unrefinement_tolerance ()
 
void disable_polyline_unrefinement ()
 Disable unrefinement of polylines. More...
 
virtual TriangleMeshCurveSectioncurve_section_pt (const unsigned &i) const
 Pointer to i-th constituent curve section. More...
 
virtual TriangleMeshCurveSection *& curve_section_pt (const unsigned &i)
 Pointer to i-th constituent curve section. More...
 

Additional Inherited Members

- Protected Attributes inherited from oomph::TriangleMeshCurve
Vector< TriangleMeshCurveSection * > Curve_section_pt
 Vector of curve sections. More...
 

Detailed Description

////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// Base class defining an open curve for the Triangle mesh generation Basically used to define internal boundaries on the mesh

Constructor & Destructor Documentation

◆ TriangleMeshOpenCurve()

oomph::TriangleMeshOpenCurve::TriangleMeshOpenCurve ( const Vector< TriangleMeshCurveSection * > &  curve_section_pt)

Constructor.

Class defining an open curve for the Triangle mesh generation.

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

1839  {
1840  // Matching of curve sections i.e. the last vertex of
1841  // the i curve section should match with the first
1842  // vertex of the i+1 curve section
1843 
1844  // Total number of boundaries
1845  unsigned n_boundaries = Curve_section_pt.size();
1846 
1847  // Check last point of each boundary bit coincides with first point
1848  // on next one
1849  for (unsigned i = 0; i < n_boundaries - 1; i++)
1850  {
1851  // Auxiliary vertex for storing the vertex values of contiguous curves
1852  Vector<double> v1(2);
1853  Vector<double> v2(2);
1854 
1855  // This is for getting the final coordinates of the i curve section
1856  Curve_section_pt[i]->final_vertex_coordinate(v1);
1857 
1858  // This is for the start coordinates of the i+1 curve section
1859  Curve_section_pt[i + 1]->initial_vertex_coordinate(v2);
1860 
1861  // Work out error
1862  double error = sqrt(pow(v1[0] - v2[0], 2) + pow(v1[1] - v2[1], 2));
1864  {
1865  std::ostringstream error_stream;
1866  error_stream
1867  << "The start and end points of curve section boundary parts " << i
1868  << " and " << i + 1
1869  << " don't match when judged \nwith the tolerance of "
1871  << " which is specified in the namespace \nvariable "
1872  << "ToleranceForVertexMismatchInPolygons::Tolerable_error.\n\n"
1873  << "Feel free to adjust this or to recompile the code without\n"
1874  << "paranoia if you think this is OK...\n"
1875  << std::endl;
1876  throw OomphLibError(
1877  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1878  }
1879  else
1880  {
1881  // Aligns (only implemented for polylines)
1882  TriangleMeshPolyLine* current_polyline =
1883  dynamic_cast<TriangleMeshPolyLine*>(Curve_section_pt[i]);
1884  TriangleMeshPolyLine* next_polyline =
1885  dynamic_cast<TriangleMeshPolyLine*>(Curve_section_pt[i + 1]);
1886 
1887  if (current_polyline && next_polyline)
1888  {
1889  unsigned last_vertex = current_polyline->nvertex() - 1;
1890  next_polyline->vertex_coordinate(0) =
1891  current_polyline->vertex_coordinate(last_vertex);
1892  }
1893  }
1894 
1895  } // For n_boundaries - 1
1896  }
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Map< RowVectorXf > v2(M2.data(), M2.size())
M1<< 1, 2, 3, 4, 5, 6, 7, 8, 9;Map< RowVectorXf > v1(M1.data(), M1.size())
Vector< TriangleMeshCurveSection * > Curve_section_pt
Vector of curve sections.
Definition: unstructured_two_d_mesh_geometry_base.h:1321
TriangleMeshCurve(const Vector< TriangleMeshCurveSection * > &curve_section_pt)
Empty constructor.
Definition: unstructured_two_d_mesh_geometry_base.h:1139
virtual TriangleMeshCurveSection * curve_section_pt(const unsigned &i) const
Pointer to i-th constituent curve section.
Definition: unstructured_two_d_mesh_geometry_base.h:1308
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 pow(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:625
int error
Definition: calibrate.py:297
double Tolerable_error
Definition: unstructured_two_d_mesh_geometry_base.cc:1103
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References oomph::TriangleMeshCurve::Curve_section_pt, calibrate::error, i, oomph::TriangleMeshPolyLine::nvertex(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Eigen::bfloat16_impl::pow(), sqrt(), oomph::ToleranceForVertexMismatchInPolygons::Tolerable_error, v1(), v2(), and oomph::TriangleMeshPolyLine::vertex_coordinate().

◆ ~TriangleMeshOpenCurve()

virtual oomph::TriangleMeshOpenCurve::~TriangleMeshOpenCurve ( )
inlinevirtual

Empty destructor.

1649 {}

Member Function Documentation

◆ nsegments()

unsigned oomph::TriangleMeshOpenCurve::nsegments ( ) const
inlinevirtual

Total number of segments.

Implements oomph::TriangleMeshCurve.

1668  {
1669  unsigned n_curve_section = ncurve_section();
1670  unsigned nseg = 0;
1671  for (unsigned j = 0; j < n_curve_section; j++)
1672  {
1673  nseg += Curve_section_pt[j]->nsegment();
1674  }
1675  return nseg;
1676  }
virtual unsigned ncurve_section() const
Number of constituent curves.
Definition: unstructured_two_d_mesh_geometry_base.h:1172
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References oomph::TriangleMeshCurve::Curve_section_pt, j, and oomph::TriangleMeshCurve::ncurve_section().

◆ nvertices()

unsigned oomph::TriangleMeshOpenCurve::nvertices ( ) const
inlinevirtual

Number of vertices.

Implements oomph::TriangleMeshCurve.

1653  {
1654  unsigned n_vertices = 0;
1655  unsigned n_curve_section = ncurve_section();
1656  for (unsigned i = 0; i < n_curve_section; i++)
1657  n_vertices += Curve_section_pt[i]->nvertex();
1658  // If there's just one boundary. All the vertices should be counted
1659  if (n_curve_section == 1)
1660  {
1661  n_vertices += 1;
1662  }
1663  return n_vertices;
1664  }

References oomph::TriangleMeshCurve::Curve_section_pt, i, and oomph::TriangleMeshCurve::ncurve_section().

◆ output()

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

Output each sub-boundary at n_sample (default: 50) points.

Implements oomph::TriangleMeshCurve.

1680  {
1681  unsigned nb = Curve_section_pt.size();
1682  for (unsigned i = 0; i < nb; i++)
1683  {
1684  Curve_section_pt[i]->output(outfile, n_sample);
1685  }
1686  }
int nb
Definition: level2_impl.h:286

References oomph::TriangleMeshCurve::Curve_section_pt, i, and nb.

◆ polyline_pt() [1/2]

TriangleMeshPolyLine* oomph::TriangleMeshOpenCurve::polyline_pt ( const unsigned i)
inline

Pointer to i-th constituent polyline.

1712  {
1713  TriangleMeshPolyLine* tmp_polyline =
1714  dynamic_cast<TriangleMeshPolyLine*>(Curve_section_pt[i]);
1715 #ifdef PARANOID
1716  if (tmp_polyline == NULL)
1717  {
1718  std::ostringstream error_stream;
1719  error_stream << "The (" << i
1720  << ")-th TriangleMeshCurveSection is not a "
1721  << "TriangleMeshPolyLine.\nPlease make sure that when you"
1722  << "first created this object the (" << i << ")-th\n"
1723  << "TriangleCurveSection is a TriangleMeshPolyLine."
1724  << std::endl;
1725  throw OomphLibError(
1726  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1727  }
1728 #endif
1729  return tmp_polyline;
1730  }

References oomph::TriangleMeshCurve::Curve_section_pt, i, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ polyline_pt() [2/2]

TriangleMeshPolyLine* oomph::TriangleMeshOpenCurve::polyline_pt ( const unsigned i) const
inline

Pointer to i-th constituent polyline.

1690  {
1691  TriangleMeshPolyLine* tmp_polyline =
1692  dynamic_cast<TriangleMeshPolyLine*>(Curve_section_pt[i]);
1693 #ifdef PARANOID
1694  if (tmp_polyline == NULL)
1695  {
1696  std::ostringstream error_stream;
1697  error_stream << "The (" << i
1698  << ")-th TriangleMeshCurveSection is not a "
1699  << "TriangleMeshPolyLine.\nPlease make sure that when you"
1700  << "first created this object the (" << i << ")-th\n"
1701  << "TriangleCurveSection is a TriangleMeshPolyLine."
1702  << std::endl;
1703  throw OomphLibError(
1704  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1705  }
1706 #endif
1707  return tmp_polyline;
1708  }

References oomph::TriangleMeshCurve::Curve_section_pt, i, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.


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