oomph::DiskTetMeshFacetedSurface Class Reference

TetMeshFacetedSurface that defines disk. More...

#include <tetmesh_faceted_surfaces.h>

+ Inheritance diagram for oomph::DiskTetMeshFacetedSurface:

Public Member Functions

 DiskTetMeshFacetedSurface (DiskLikeGeomObjectWithBoundaries *disk_parametrised_by_nonsingular_coordinates_pt, const unsigned &half_nsegment, const unsigned &first_one_based_boundary_id_for_disk, unsigned &last_one_based_boundary_id_for_disk)
 
 ~DiskTetMeshFacetedSurface ()
 Destructor. More...
 
void boundary_zeta01 (const unsigned &facet_id, const double &zeta_boundary, Vector< double > &zeta)
 
- Public Member Functions inherited from oomph::TetMeshFacetedSurface
 TetMeshFacetedSurface ()
 Constructor: More...
 
virtual ~TetMeshFacetedSurface ()
 Empty destructor. More...
 
unsigned nvertex () const
 Number of vertices. More...
 
unsigned nfacet () const
 Number of facets. More...
 
unsigned one_based_facet_boundary_id (const unsigned &j) const
 One-based boundary id of j-th facet. More...
 
unsigned one_based_vertex_boundary_id (const unsigned &j) const
 First (of possibly multiple) one-based boundary id of j-th vertex. More...
 
double vertex_coordinate (const unsigned &j, const unsigned &i) const
 i-th coordinate of j-th vertex More...
 
unsigned nvertex_on_facet (const unsigned &j) const
 Number of vertices defining the j-th facet. More...
 
bool boundaries_can_be_split_in_tetgen ()
 Test whether boundary can be split in tetgen. More...
 
void enable_boundaries_can_be_split_in_tetgen ()
 Test whether boundaries can be split in tetgen. More...
 
void disable_boundaries_can_be_split_in_tetgen ()
 Test whether boundaries can be split in tetgen. More...
 
TetMeshFacetfacet_pt (const unsigned &j) const
 Pointer to j-th facet. More...
 
TetMeshVertexvertex_pt (const unsigned &j) const
 Pointer to j-th vertex. More...
 
DiskLikeGeomObjectWithBoundariesgeom_object_with_boundaries_pt ()
 
void output (std::ostream &outfile) const
 Output. More...
 
void output (const std::string &filename) const
 Output. More...
 
virtual void boundary_zeta12 (const unsigned &facet_id, const double &zeta_boundary, Vector< double > &zeta)
 
virtual void boundary_zeta20 (const unsigned &facet_id, const double &zeta_boundary, Vector< double > &zeta)
 
Vector< unsignedvertex_index_in_tetgen (const unsigned &f)
 

Protected Attributes

unsigned Nfacet
 Number of facets. More...
 
std::vector< boolFacet_is_on_boundary
 Is facet on boundary? More...
 
Vector< doubleLeft_boundary_coordinate
 Left boundary coordinate of i-th facet. More...
 
Vector< doubleRight_boundary_coordinate
 Right boundary coordinate of i-th facet. More...
 
Vector< unsignedBoundary_id
 ID of boundary the i-th facet is located on. More...
 
unsigned Nelement_on_disk_boundary
 Number of elements on disk boundary. More...
 
TriangleMesh< TPoissonElement< 2, 2 > > * Tri_mesh_pt
 Mesh used to facet-ise (discretise) disk. More...
 
std::map< Node *, TetMeshVertex * > Equivalent_vertex_pt
 Mapping between nodes and vertices. More...
 
- Protected Attributes inherited from oomph::TetMeshFacetedSurface
Vector< TetMeshVertex * > Vertex_pt
 Vector pointers to vertices. More...
 
Vector< TetMeshFacet * > Facet_pt
 Vector of pointers to facets. More...
 
bool Boundaries_can_be_split_in_tetgen
 
Vector< Vector< unsigned > > Facet_vertex_index_in_tetgen
 
DiskLikeGeomObjectWithBoundariesGeom_object_with_boundaries_pt
 GeomObject with boundaries associated with this surface. More...
 

Detailed Description

TetMeshFacetedSurface that defines disk.

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

Constructor & Destructor Documentation

◆ DiskTetMeshFacetedSurface()

oomph::DiskTetMeshFacetedSurface::DiskTetMeshFacetedSurface ( DiskLikeGeomObjectWithBoundaries disk_parametrised_by_nonsingular_coordinates_pt,
const unsigned half_nsegment,
const unsigned first_one_based_boundary_id_for_disk,
unsigned last_one_based_boundary_id_for_disk 
)
inline

Constructor: Pass pointer to GeomObject (with boundaries, and parametrised by coordinates without coordinate singularities, i.e. not polars, say) that defines the shape of the disk. Other args specify half the number of segments on perimeter of disk and first one-based boundary ID to be used to enumerate the boundaries on the disk. Returns last one-based boundary id used to enumerate the disk

384  {
386  disk_parametrised_by_nonsingular_coordinates_pt;
387 
388  // Provide storage for pointers to the two parts of the curvilinear boundary
389  Vector<TriangleMeshCurveSection*> outer_curvilinear_boundary_pt(2);
390 
391  // First bit
392  GeomObject* outer_boundary_ellipse0_pt=
393  disk_parametrised_by_nonsingular_coordinates_pt->
394  boundary_parametrising_geom_object_pt(0);
395  double zeta_start=disk_parametrised_by_nonsingular_coordinates_pt->
396  zeta_boundary_start(0);
397  double zeta_end=disk_parametrised_by_nonsingular_coordinates_pt->
398  zeta_boundary_end(0);
399  unsigned nsegment=half_nsegment;
400  unsigned boundary_id=0;
401  outer_curvilinear_boundary_pt[0]=new TriangleMeshCurviLine(
402  outer_boundary_ellipse0_pt,zeta_start,zeta_end,nsegment,boundary_id);
403 
404  // Second bit
405  GeomObject* outer_boundary_ellipse1_pt=
406  disk_parametrised_by_nonsingular_coordinates_pt->
407  boundary_parametrising_geom_object_pt(1);
408  zeta_start=disk_parametrised_by_nonsingular_coordinates_pt->
409  zeta_boundary_start(1);
410  zeta_end=disk_parametrised_by_nonsingular_coordinates_pt->
411  zeta_boundary_end(1);
412  nsegment=half_nsegment;
413  boundary_id=1;
414  outer_curvilinear_boundary_pt[1]=new TriangleMeshCurviLine(
415  outer_boundary_ellipse1_pt,zeta_start,zeta_end,nsegment,boundary_id);
416 
417  // Combine to curvilinear boundary and define the
418  // outer boundary
419  TriangleMeshClosedCurve* closed_curve_pt=
420  new TriangleMeshClosedCurve(outer_curvilinear_boundary_pt);
421 
422  // Use the TriangleMeshParameters object for helping on the manage of the
423  // TriangleMesh parameters
424  TriangleMeshParameters triangle_mesh_parameters(closed_curve_pt);
425 
426  // Do we have an annnular internal boundary?
427  if (disk_parametrised_by_nonsingular_coordinates_pt->nboundary()==4)
428  {
429 
430  // Provide storage for pointers to the two parts of the curvilinear boundary
431  Vector<TriangleMeshCurveSection*> inner_curvilinear_boundary_pt(2);
432 
433  // First bit
434  GeomObject* inner_boundary_ellipse0_pt=
435  disk_parametrised_by_nonsingular_coordinates_pt->
436  boundary_parametrising_geom_object_pt(2);
437  double zeta_start=disk_parametrised_by_nonsingular_coordinates_pt->
438  zeta_boundary_start(2);
439  double zeta_end=disk_parametrised_by_nonsingular_coordinates_pt->
440  zeta_boundary_end(2);
441  unsigned nsegment=half_nsegment;
442  unsigned boundary_id=2;
443  inner_curvilinear_boundary_pt[0]=new TriangleMeshCurviLine(
444  inner_boundary_ellipse0_pt,zeta_start,zeta_end,nsegment,boundary_id);
445 
446  // Second bit
447  GeomObject* inner_boundary_ellipse1_pt=
448  disk_parametrised_by_nonsingular_coordinates_pt->
449  boundary_parametrising_geom_object_pt(3);
450  zeta_start=disk_parametrised_by_nonsingular_coordinates_pt->
451  zeta_boundary_start(3);
452  zeta_end=disk_parametrised_by_nonsingular_coordinates_pt->
453  zeta_boundary_end(3);
454  nsegment=half_nsegment;
455  boundary_id=3;
456  inner_curvilinear_boundary_pt[1]=new TriangleMeshCurviLine(
457  inner_boundary_ellipse1_pt,zeta_start,zeta_end,nsegment,boundary_id);
458 
459  // Combine to curvilinear boundary and define the
460  // inner boundary
461  TriangleMeshClosedCurve* inner_curve_pt=
462  new TriangleMeshClosedCurve(inner_curvilinear_boundary_pt);
463 
464 
465  Vector<TriangleMeshClosedCurve *> inner_boundaries_pt(1);
466  inner_boundaries_pt[0]=inner_curve_pt;
467 
468  // Specify the internal closed boundaries
469  triangle_mesh_parameters.internal_closed_curve_pt() = inner_boundaries_pt;
470 
471 
472 
473  // Let's get a map of region coordinates (if any!)
474  std::map<unsigned, Vector<double> > zeta_in_region_map=
475  disk_parametrised_by_nonsingular_coordinates_pt->zeta_in_region();
476  for (std::map<unsigned, Vector<double> >::iterator it=
477  zeta_in_region_map.begin();it!=zeta_in_region_map.end();it++)
478  {
479  // Pass information about the defined regions
480  unsigned r=(*it).first;
481  Vector<double> region_coords=(*it).second;
482  triangle_mesh_parameters.add_region_coordinates(r,region_coords);
483  }
484 
485  }
486 
487  // Specify the element area so that it matches the boundary discretisation
488  double uniform_element_area=sqrt(3.0)/4.0*
489  pow(2.0*MathematicalConstants::Pi/(2.0*double(half_nsegment)),2);
490  triangle_mesh_parameters.element_area() = uniform_element_area;
491 
492  // Create the mesh
493  Tri_mesh_pt = new
494  TriangleMesh<TPoissonElement<2,2> >(triangle_mesh_parameters);
495 
496  // Loop over all boundary elements and rotate their nodes so that
497  // the first two nodes are on the boundary
498  std::map<FiniteElement*,bool> is_on_boundary;
499  for (unsigned b=0;b<2;b++)
500  {
501  unsigned nel=Tri_mesh_pt->nboundary_element(b);
502  for (unsigned e=0;e<nel;e++)
503  {
504  FiniteElement* el_pt=Tri_mesh_pt->boundary_element_pt(b,e);
505  unsigned count=0;
506  for (unsigned j=0;j<3;j++)
507  {
508  Node* nod_pt=el_pt->node_pt(j);
509  if (nod_pt->is_on_boundary()) count++;
510  }
511  if (count==2)
512  {
513  is_on_boundary[el_pt]=true;
514  if ((el_pt->node_pt(0)->is_on_boundary())&&
515  (el_pt->node_pt(1)->is_on_boundary()))
516  {
517  // fine
518  }
519  else
520  {
521  // Reorder nodes so that the first two nodes are on the boundary
522  Node* nod0_pt=el_pt->node_pt(0);
523  Node* nod1_pt=el_pt->node_pt(1);
524  Node* nod2_pt=el_pt->node_pt(2);
525  if (!el_pt->node_pt(0)->is_on_boundary())
526  {
527  el_pt->node_pt(0)=nod1_pt;
528  el_pt->node_pt(1)=nod2_pt;
529  el_pt->node_pt(2)=nod0_pt;
530  }
531  else if (!el_pt->node_pt(1)->is_on_boundary())
532  {
533  el_pt->node_pt(0)=nod2_pt;
534  el_pt->node_pt(1)=nod0_pt;
535  el_pt->node_pt(2)=nod1_pt;
536  }
537  else
538  {
539  std::ostringstream error_message;
540  error_message << "This doesn't make sense!";
541  throw OomphLibError(error_message.str(),
544  }
545  }
546  }
547  else
548  {
549  std::ostringstream error_message;
550  error_message <<
551  "Boundary simplex element doesn't have two nodes on boundary!";
552  throw OomphLibError(error_message.str(),
555  }
556  }
557  }
558 
559 
560  // Now loop over all nodes and turn them into vertices
561  unsigned nnod=Tri_mesh_pt->nnode();
562  Vertex_pt.resize(nnod);
563  for (unsigned j=0;j<nnod;j++)
564  {
565  Node* nod_pt=Tri_mesh_pt->node_pt(j);
566  Vector<double> sheet_point(3,0.0);
567  Vector<double> zeta(nod_pt->position());
569  Vertex_pt[j]=new TetMeshVertex(sheet_point);
570  Vertex_pt[j]->set_zeta_in_geom_object(zeta);
572  }
573 
574 
575  // Quick count to see how many elements/facets are on the boundary
577  unsigned nel=Tri_mesh_pt->nelement();
578  for (unsigned e=0;e<nel;e++)
579  {
580  FiniteElement* el_pt=Tri_mesh_pt->finite_element_pt(e);
581  if (is_on_boundary[el_pt])
582  {
584  }
585  }
586 
587  // Angles of right/left node on boundary (for snapping)
588  Left_boundary_coordinate.resize(nel,0.0);
589  Right_boundary_coordinate.resize(nel,0.0);
590  Boundary_id.resize(nel,0.0);
591 
592  // Now loop over all elements
593  Nfacet=nel;
594  Facet_pt.resize(Nfacet);
595  Facet_is_on_boundary.resize(Nfacet,false);
596  unsigned n_vertex_on_facet=3;
597  for (unsigned e=0;e<nel;e++)
598  {
599  FiniteElement* el_pt=Tri_mesh_pt->finite_element_pt(e);
600  if (is_on_boundary[el_pt])
601  {
602  Node* left_node_pt=el_pt->node_pt(0);
603  Node* right_node_pt=el_pt->node_pt(1);
604  Vector<double> boundary_zeta(1);
605  if (left_node_pt->is_on_boundary(0)&&
606  right_node_pt->is_on_boundary(0))
607  {
608  unsigned b=0;
609  left_node_pt->get_coordinates_on_boundary(b,boundary_zeta);
610  Left_boundary_coordinate[e]=boundary_zeta[0];
611  right_node_pt->get_coordinates_on_boundary(b,boundary_zeta);
612  Right_boundary_coordinate[e]=boundary_zeta[0];
613  Boundary_id[e]=b;
614  }
615  else if (left_node_pt->is_on_boundary(1)&&
616  right_node_pt->is_on_boundary(1))
617  {
618  unsigned b=1;
619  left_node_pt->get_coordinates_on_boundary(b,boundary_zeta);
620  Left_boundary_coordinate[e]=boundary_zeta[0];
621  right_node_pt->get_coordinates_on_boundary(b,boundary_zeta);
622  Right_boundary_coordinate[e]=boundary_zeta[0];
623  Boundary_id[e]=b;
624  }
625  else
626  {
627  std::ostringstream error_message;
628  error_message << "never get here!";
629  throw OomphLibError(error_message.str(),
632  }
633  Facet_is_on_boundary[e]=true;
634  }
635  Facet_pt[e]=new TetMeshFacet(n_vertex_on_facet);
636  unsigned one_based_boundary_id=first_one_based_boundary_id_for_disk+e;
637  Facet_pt[e]->set_one_based_boundary_id(one_based_boundary_id);
638  last_one_based_boundary_id_for_disk=one_based_boundary_id;
639  for (unsigned j=0;j<3;j++)
640  {
641  Facet_pt[e]->set_vertex_pt(j,Equivalent_vertex_pt[el_pt->node_pt(j)]);
642  }
643  }
644  }
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Scalar * b
Definition: benchVecAdd.cpp:17
Vector< double > Right_boundary_coordinate
Right boundary coordinate of i-th facet.
Definition: tetmesh_faceted_surfaces.h:699
std::map< Node *, TetMeshVertex * > Equivalent_vertex_pt
Mapping between nodes and vertices.
Definition: tetmesh_faceted_surfaces.h:713
std::vector< bool > Facet_is_on_boundary
Is facet on boundary?
Definition: tetmesh_faceted_surfaces.h:693
Vector< double > Left_boundary_coordinate
Left boundary coordinate of i-th facet.
Definition: tetmesh_faceted_surfaces.h:696
Vector< unsigned > Boundary_id
ID of boundary the i-th facet is located on.
Definition: tetmesh_faceted_surfaces.h:702
unsigned Nfacet
Number of facets.
Definition: tetmesh_faceted_surfaces.h:690
TriangleMesh< TPoissonElement< 2, 2 > > * Tri_mesh_pt
Mesh used to facet-ise (discretise) disk.
Definition: tetmesh_faceted_surfaces.h:709
unsigned Nelement_on_disk_boundary
Number of elements on disk boundary.
Definition: tetmesh_faceted_surfaces.h:705
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
Vector< TetMeshVertex * > Vertex_pt
Vector pointers to vertices.
Definition: tet_mesh.h:483
DiskLikeGeomObjectWithBoundaries * Geom_object_with_boundaries_pt
GeomObject with boundaries associated with this surface.
Definition: tet_mesh.h:497
Vector< TetMeshFacet * > Facet_pt
Vector of pointers to facets.
Definition: tet_mesh.h:486
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 pow(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:625
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp< Eigen::internal::scalar_zeta_op< typename DerivedX::Scalar >, const DerivedX, const DerivedQ > zeta(const Eigen::ArrayBase< DerivedX > &x, const Eigen::ArrayBase< DerivedQ > &q)
Definition: SpecialFunctionsArrayAPI.h:152
r
Definition: UniformPSDSelfTest.py:20
const double Pi
50 digits from maple
Definition: oomph_utilities.h:157
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References oomph::TriangleMeshParameters::add_region_coordinates(), b, Boundary_id, e(), oomph::TriangleMeshParameters::element_area(), Equivalent_vertex_pt, Facet_is_on_boundary, oomph::TetMeshFacetedSurface::Facet_pt, oomph::TetMeshFacetedSurface::Geom_object_with_boundaries_pt, oomph::Node::get_coordinates_on_boundary(), oomph::TriangleMeshParameters::internal_closed_curve_pt(), oomph::Node::is_on_boundary(), j, Left_boundary_coordinate, oomph::DiskLikeGeomObjectWithBoundaries::nboundary(), Nelement_on_disk_boundary, Nfacet, oomph::FiniteElement::node_pt(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::MathematicalConstants::Pi, oomph::GeomObject::position(), oomph::Node::position(), Eigen::bfloat16_impl::pow(), UniformPSDSelfTest::r, Right_boundary_coordinate, sqrt(), Tri_mesh_pt, oomph::TetMeshFacetedSurface::Vertex_pt, Eigen::zeta(), and oomph::DiskLikeGeomObjectWithBoundaries::zeta_in_region().

◆ ~DiskTetMeshFacetedSurface()

oomph::DiskTetMeshFacetedSurface::~DiskTetMeshFacetedSurface ( )
inline

Destructor.

649  {
650  delete Tri_mesh_pt;
651  Tri_mesh_pt=0;
652  }

References Tri_mesh_pt.

Member Function Documentation

◆ boundary_zeta01()

void oomph::DiskTetMeshFacetedSurface::boundary_zeta01 ( const unsigned facet_id,
const double zeta_boundary,
Vector< double > &  zeta 
)
inlinevirtual

Function that specifies the variation of the zeta coordinates in the GeomObject along the boundary connecting vertices 0 and 1 in the facet. NOTE: input zeta_boundary ranges between 0 and 1; gets mapped to actual boundary coordinate inside!

Reimplemented from oomph::TetMeshFacetedSurface.

662  {
663  if (Facet_is_on_boundary[facet_id])
664  {
665  double phi0=Left_boundary_coordinate[facet_id];
666  double phi1=Right_boundary_coordinate[facet_id];
667  double phi=phi0+(phi1-phi0)*zeta_boundary;
668 
669  unsigned b=Boundary_id[facet_id];
670  double zeta_bound=phi;
672  zeta_bound,
673  zeta);
674  }
675  else
676  {
677  Vector<double> zeta0=Facet_pt[facet_id]->
679  Vector<double> zeta1=Facet_pt[facet_id]->
681  zeta[0]=zeta0[0]+(zeta1[0]-zeta0[0])*zeta_boundary;
682  zeta[1]=zeta0[1]+(zeta1[1]-zeta0[1])*zeta_boundary;
683  }
684  }
void zeta_on_boundary(const unsigned &b, const double &zeta_bound, Vector< double > &zeta) const
Definition: geom_obj_with_boundary.h:91
TetMeshVertex * vertex_pt(const unsigned &j) const
Pointer to j-th vertex.
Definition: tet_mesh.h:379
Vector< double > zeta_in_geom_object() const
Definition: tet_mesh.h:118

References b, Boundary_id, Facet_is_on_boundary, oomph::TetMeshFacetedSurface::Facet_pt, oomph::TetMeshFacetedSurface::Geom_object_with_boundaries_pt, Left_boundary_coordinate, Right_boundary_coordinate, oomph::TetMeshFacetedSurface::vertex_pt(), Eigen::zeta(), oomph::TetMeshVertex::zeta_in_geom_object(), and oomph::DiskLikeGeomObjectWithBoundaries::zeta_on_boundary().

Member Data Documentation

◆ Boundary_id

Vector<unsigned> oomph::DiskTetMeshFacetedSurface::Boundary_id
protected

ID of boundary the i-th facet is located on.

Referenced by boundary_zeta01(), and DiskTetMeshFacetedSurface().

◆ Equivalent_vertex_pt

std::map<Node*,TetMeshVertex*> oomph::DiskTetMeshFacetedSurface::Equivalent_vertex_pt
protected

◆ Facet_is_on_boundary

std::vector<bool> oomph::DiskTetMeshFacetedSurface::Facet_is_on_boundary
protected

◆ Left_boundary_coordinate

Vector<double> oomph::DiskTetMeshFacetedSurface::Left_boundary_coordinate
protected

Left boundary coordinate of i-th facet.

Referenced by boundary_zeta01(), and DiskTetMeshFacetedSurface().

◆ Nelement_on_disk_boundary

unsigned oomph::DiskTetMeshFacetedSurface::Nelement_on_disk_boundary
protected

◆ Nfacet

◆ Right_boundary_coordinate

Vector<double> oomph::DiskTetMeshFacetedSurface::Right_boundary_coordinate
protected

Right boundary coordinate of i-th facet.

Referenced by boundary_zeta01(), and DiskTetMeshFacetedSurface().

◆ Tri_mesh_pt

TriangleMesh<TPoissonElement<2,2> >* oomph::DiskTetMeshFacetedSurface::Tri_mesh_pt
protected

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