oomph::DiskWithTorusAroundEdgeTetMeshFacetedSurface Class Reference

TetMeshFacetedSurface that defines disk with torus around edge. More...

#include <tetmesh_faceted_surfaces.h>

+ Inheritance diagram for oomph::DiskWithTorusAroundEdgeTetMeshFacetedSurface:

Public Member Functions

 DiskWithTorusAroundEdgeTetMeshFacetedSurface (DiskLikeGeomObjectWithBoundaries *disk_parametrised_by_nonsingular_coordinates_pt, const unsigned &half_nsegment, const double &r_torus, const unsigned &nvertex_torus, const unsigned &first_one_based_boundary_id_for_disk, const unsigned &one_based_torus_region_id, unsigned &last_one_based_boundary_id_for_disk, unsigned &first_one_based_boundary_id_for_torus, unsigned &last_one_based_boundary_id_for_torus, Vector< unsigned > &one_based_boundary_id_for_disk_within_torus, Vector< unsigned > &one_based_boundary_id_for_disk_outside_torus)
 
- Public Member Functions inherited from 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)
 
 ~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)
 
- Public Member Functions inherited from oomph::TetMeshFacetedClosedSurface
 TetMeshFacetedClosedSurface ()
 Constructor: More...
 
virtual ~TetMeshFacetedClosedSurface ()
 Empty destructor. More...
 
void enable_faceted_volume_represents_hole_for_gmsh ()
 Declare closed surface to represent hole for gmsh. More...
 
void disable_faceted_volume_represents_hole_for_gmsh ()
 Declare closed surface NOT to represent hole for gmsh. More...
 
bool faceted_volume_represents_hole_for_gmsh () const
 Does closed surface represent hole for gmsh? More...
 
const doubleinternal_point_for_tetgen (const unsigned &j, const unsigned &i) const
 i=th coordinate of the j-th internal point for tetgen More...
 
void set_hole_for_tetgen (const Vector< double > &hole_point)
 Specify coordinate of hole for tetgen. More...
 
void set_region_for_tetgen (const unsigned &region_id, const Vector< double > &region_point)
 
unsigned ninternal_point_for_tetgen ()
 
const intregion_id_for_tetgen (const unsigned &j) const
 
bool internal_point_identifies_hole_for_tetgen (const unsigned &j)
 Is j-th internal point for tetgen associated with a hole? More...
 
bool internal_point_identifies_region_for_tetgen (const unsigned &j)
 Is j-th internal point for tetgen associated with a region? More...
 

Additional Inherited Members

- Protected Attributes inherited from oomph::DiskTetMeshFacetedSurface
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 with torus around edge.

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

Constructor & Destructor Documentation

◆ DiskWithTorusAroundEdgeTetMeshFacetedSurface()

oomph::DiskWithTorusAroundEdgeTetMeshFacetedSurface::DiskWithTorusAroundEdgeTetMeshFacetedSurface ( DiskLikeGeomObjectWithBoundaries disk_parametrised_by_nonsingular_coordinates_pt,
const unsigned half_nsegment,
const double r_torus,
const unsigned nvertex_torus,
const unsigned first_one_based_boundary_id_for_disk,
const unsigned one_based_torus_region_id,
unsigned last_one_based_boundary_id_for_disk,
unsigned first_one_based_boundary_id_for_torus,
unsigned last_one_based_boundary_id_for_torus,
Vector< unsigned > &  one_based_boundary_id_for_disk_within_torus,
Vector< unsigned > &  one_based_boundary_id_for_disk_outside_torus 
)
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
  • radius of torus
  • number of vertices around the perimeter of the torus
  • first one-based boundary ID to be used to enumerate the boundaries on the disk
  • one based region ID for volume contained inside torus.

Computes:

  • last one-based boundary id used to enumerate boundaries on disk
  • first one-based boundary id used to enumerate boundaries on torus
  • last one-based boundary id used to enumerate boundaries on torus
  • vector containing one-based boundary ids of boundaries on disk enclosed within the torus
  • vector containing one-based boundary ids of boundaries on disk not enclosed within the torus
769  :
771  disk_parametrised_by_nonsingular_coordinates_pt,
772  half_nsegment,
773  first_one_based_boundary_id_for_disk,
774  last_one_based_boundary_id_for_disk)
775  {
776  // Wipe
777  one_based_boundary_id_for_disk_within_torus.clear();
778  one_based_boundary_id_for_disk_outside_torus.clear();
779 
780 
781  // Is element in torus region or not?
782  std::map<FiniteElement*,bool> is_in_torus_region;
783  {
784  unsigned r=1;
785  /* ofstream some_file; */
786  /* some_file.open("tri_mesh_in_region1.dat"); */
787  unsigned nel=Tri_mesh_pt->nregion_element(r);
788  for(unsigned e=0;e<nel;e++)
789  {
790  FiniteElement* el_pt=Tri_mesh_pt->region_element_pt(r,e);
791  is_in_torus_region[el_pt]=true;
792  //unsigned npts=3;
793  //el_pt->output(some_file,npts);
794  }
795  //some_file.close();
796  }
797 
798 
799  // Now loop over all elements
800  unsigned nel=Tri_mesh_pt->nelement();
801  for (unsigned e=0;e<nel;e++)
802  {
803  FiniteElement* el_pt=Tri_mesh_pt->finite_element_pt(e);
804  unsigned one_based_boundary_id=Facet_pt[e]->one_based_boundary_id();
805  if (is_in_torus_region[el_pt])
806  {
807  Facet_pt[e]->set_one_based_region_that_facet_is_embedded_in
808  (one_based_torus_region_id);
809  one_based_boundary_id_for_disk_within_torus.push_back
810  (one_based_boundary_id);
811  }
812  else
813  {
814  one_based_boundary_id_for_disk_outside_torus.push_back
815  (one_based_boundary_id);
816  }
817  }
818 
819 
820  // Now add torus:
821  //---------------
822  unsigned one_based_boundary_id=last_one_based_boundary_id_for_disk+1;
823  first_one_based_boundary_id_for_torus=one_based_boundary_id;
824 
825  // Find sorted sequence of vertices going around the
826  // inner boundary (innermost part of torus)
827  Vector<TetMeshVertex*> sorted_vertex_pt;
828  Vector<std::pair<TetMeshVertex*,double> > vertex_pt_and_boundary_coord;
829  std::map<Node*,bool> done;
830  Vector<double> boundary_zeta(1);
831  for (unsigned b=2;b<=3;b++)
832  {
833  unsigned nnod=Tri_mesh_pt->nboundary_node(b);
834  for (unsigned j=0;j<nnod;j++)
835  {
836  Node* nod_pt=Tri_mesh_pt->boundary_node_pt(b,j);
837  if (!done[nod_pt])
838  {
839  nod_pt->get_coordinates_on_boundary(b,boundary_zeta);
840  vertex_pt_and_boundary_coord.push_back(
841  std::make_pair(Equivalent_vertex_pt[nod_pt],
842  boundary_zeta[0]));
843  done[nod_pt]=true;
844  }
845  }
846  }
847 
848 
849 
850  oomph_info << "Number of vertices on inner ring: "
851  << vertex_pt_and_boundary_coord.size() << " "
852  << " sum: "
853  << Tri_mesh_pt->nboundary_node(2)+Tri_mesh_pt->nboundary_node(3)
854  << std::endl;
855 
856  // Identify point in torus (for tetgen)
857  Vector<double> point_in_torus(3);
858  unsigned b=0;
859  unsigned j=0;
860  Node* nod_pt=Tri_mesh_pt->boundary_node_pt(b,j);
861  point_in_torus[0]=Equivalent_vertex_pt[nod_pt]->x(0);
862  point_in_torus[1]=Equivalent_vertex_pt[nod_pt]->x(1);
863  point_in_torus[2]=Equivalent_vertex_pt[nod_pt]->x(2)+0.5*r_torus;
864 
865  oomph_info << "point in torus: "
866  << point_in_torus[0] << " "
867  << point_in_torus[1] << " "
868  << point_in_torus[2] << " "
869  << std::endl;
870 
871  // Sort based on boundary coordinate
872  std::sort (vertex_pt_and_boundary_coord.begin(),
873  vertex_pt_and_boundary_coord.end(),
874  HelperForSortingVectorOfPairsOfVertexPtAndDouble::
876 
877  // Loop over annular rings
878  unsigned n_vertices_on_annular_ring=nvertex_torus;
879  unsigned n_new_vertices_on_annular_ring=
880  n_vertices_on_annular_ring-2;
881 
882 
883  // Storage for vertices and facets
884  unsigned nv=Vertex_pt.size();
885  unsigned jv=nv;
886  nv+=n_new_vertices_on_annular_ring*
887  vertex_pt_and_boundary_coord.size();
888  Vertex_pt.resize(nv);
889 
890  unsigned jf=Nfacet;
891  Nfacet+=(n_new_vertices_on_annular_ring+1)*
892  (vertex_pt_and_boundary_coord.size());
893  Facet_pt.resize(Nfacet);
894 
895 
896  unsigned new_vertex_count=0;
897  unsigned new_facet_count=0;
898  unsigned n=vertex_pt_and_boundary_coord.size();
899  Vector<Vector<TetMeshVertex*> > annulus_vertex_pt(n);
900  for (unsigned j=0;j<n;j++)
901  {
902 
903  // Wrap around for simplicity
904  annulus_vertex_pt[j].resize(n_vertices_on_annular_ring);
905  annulus_vertex_pt[j][0]=vertex_pt_and_boundary_coord[j].first;
906  annulus_vertex_pt[j][n_vertices_on_annular_ring-1]=
907  vertex_pt_and_boundary_coord[j].first;
908 
909  // Position of vertex
910  Vector<double> vertex_position(3);
911  vertex_position[0]=vertex_pt_and_boundary_coord[j].first->x(0);
912  vertex_position[1]=vertex_pt_and_boundary_coord[j].first->x(1);
913  vertex_position[2]=vertex_pt_and_boundary_coord[j].first->x(2);
914 
915  // Polar angle
916  double theta=vertex_pt_and_boundary_coord[j].second;
917 
918  // Which boundary is this point located on?
919  unsigned b=0;
921  {
922  b=1;
923  }
924  double zeta_bound=theta;
925 
926  // Get coordinate on edge and normal and tangent vectors
927  Vector<double> x(3);
928  Vector<double> r_edge(3);
929  Vector<double> normal(3);
930  Vector<double> tangent(3);
931  Vector<double> normal_normal(3);
933  zeta_bound,
934  r_edge,
935  tangent,
936  normal,
937  normal_normal);
938 
939  // What rho do we need to create a circle, centred at the edge
940  // going through current vertex?
941  Vector<double> distance_to_edge(3);
942  distance_to_edge[0]=r_edge[0]-vertex_position[0];
943  distance_to_edge[1]=r_edge[1]-vertex_position[1];
944  distance_to_edge[2]=r_edge[2]-vertex_position[2];
945  double rho=sqrt(distance_to_edge[0]*distance_to_edge[0]+
946  distance_to_edge[1]*distance_to_edge[1]+
947  distance_to_edge[2]*distance_to_edge[2]);
948 
949  // What is the starting angle?
950  double cos_phi0=(distance_to_edge[0]*normal[0]+
951  distance_to_edge[1]*normal[1]+
952  distance_to_edge[2]*normal[2])/rho;
953  if (cos_phi0>1.0) cos_phi0=1.0;
954  if (cos_phi0<-1.0) cos_phi0=-1.0;
955 
956  double phi_0=acos(cos_phi0);
957 
958  for (unsigned i=1;i<n_vertices_on_annular_ring-1;i++)
959  {
960  double phi=phi_0+double(i)/double(n_vertices_on_annular_ring-1)*
962  x[0]=r_edge[0]+rho*cos(phi)*normal[0]+rho*sin(phi)*normal_normal[0];
963  x[1]=r_edge[1]+rho*cos(phi)*normal[1]+rho*sin(phi)*normal_normal[1];
964  x[2]=r_edge[2]+rho*cos(phi)*normal[2]+rho*sin(phi)*normal_normal[2];
965 
966  TetMeshVertex* new_vertex_pt=new TetMeshVertex(x);
967  annulus_vertex_pt[j][i]=new_vertex_pt;
968  Vertex_pt[jv]=new_vertex_pt;
969  jv++;
970  new_vertex_count++;
971  }
972  }
973 
974  for (unsigned i=0;i<n-1;i++)
975  {
976  unsigned m=annulus_vertex_pt[i].size();
977  for (unsigned j=0;j<m-1;j++)
978  {
979  unsigned n_vertex_on_facet=4;
980  TetMeshFacet* new_facet_pt=new TetMeshFacet(n_vertex_on_facet);
981  new_facet_count++;
982  new_facet_pt->set_vertex_pt(0,annulus_vertex_pt[i][j]);
983  new_facet_pt->set_vertex_pt(1,annulus_vertex_pt[i][j+1]);
984  new_facet_pt->set_vertex_pt(2,annulus_vertex_pt[i+1][j+1]);
985  new_facet_pt->set_vertex_pt(3,annulus_vertex_pt[i+1][j]);
986  Facet_pt[jf]=new_facet_pt;
987  unsigned region_id=one_based_torus_region_id;
988  Facet_pt[jf]->set_one_based_adjacent_region_id(region_id);
989  Facet_pt[jf]->set_one_based_boundary_id(one_based_boundary_id);
990  one_based_boundary_id++;
991  jf++;
992  }
993  }
994 
995  unsigned m=annulus_vertex_pt[n-1].size();
996  for (unsigned j=0;j<m-1;j++)
997  {
998  unsigned n_vertex_on_facet=4;
999  TetMeshFacet* new_facet_pt=new TetMeshFacet(n_vertex_on_facet);
1000  new_facet_count++;
1001  new_facet_pt->set_vertex_pt(0,annulus_vertex_pt[n-1][j]);
1002  new_facet_pt->set_vertex_pt(1,annulus_vertex_pt[n-1][j+1]);
1003  new_facet_pt->set_vertex_pt(2,annulus_vertex_pt[0][j+1]);
1004  new_facet_pt->set_vertex_pt(3,annulus_vertex_pt[0][j]);
1005  Facet_pt[jf]=new_facet_pt;
1006  unsigned region_id=one_based_torus_region_id;
1007  Facet_pt[jf]->set_one_based_adjacent_region_id(region_id);
1008  Facet_pt[jf]->set_one_based_boundary_id(one_based_boundary_id);
1009  last_one_based_boundary_id_for_torus=one_based_boundary_id;
1010  one_based_boundary_id++;
1011  jf++;
1012  }
1013 
1014  oomph_info << "First/last one-based disk boundary ID: "
1015  << first_one_based_boundary_id_for_disk << " "
1016  << last_one_based_boundary_id_for_disk << std::endl;
1017 
1018 
1019  oomph_info << "First/last one-based torus boundary ID: "
1020  << first_one_based_boundary_id_for_torus << " "
1021  << last_one_based_boundary_id_for_torus << std::endl;
1022 
1023 
1024  // Is it a genuine region?
1025  if (one_based_torus_region_id>0)
1026  {
1027  set_region_for_tetgen(one_based_torus_region_id-1,point_in_torus);
1028  }
1029  else
1030  {
1031  std::ostringstream error_message;
1032  error_message << "one_based_torus_region_id must be strictly positive";
1033  throw OomphLibError(error_message.str(),
1036  }
1037 
1038 
1039 
1040  }
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar acos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:138
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Scalar * b
Definition: benchVecAdd.cpp:17
double zeta_boundary_end(const unsigned &b) const
Definition: geom_obj_with_boundary.h:151
virtual void boundary_triad(const unsigned &b, const double &zeta_bound, Vector< double > &r, Vector< double > &tangent, Vector< double > &normal, Vector< double > &binormal)
Definition: geom_obj_with_boundary.h:159
std::map< Node *, TetMeshVertex * > Equivalent_vertex_pt
Mapping between nodes and vertices.
Definition: tetmesh_faceted_surfaces.h:713
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)
Definition: tetmesh_faceted_surfaces.h:377
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
void set_region_for_tetgen(const unsigned &region_id, const Vector< double > &region_point)
Definition: tet_mesh.h:582
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
int * m
Definition: level2_cplx_impl.h:294
double theta
Definition: two_d_biharmonic.cc:236
r
Definition: UniformPSDSelfTest.py:20
void normal(const Vector< double > &x, Vector< double > &normal)
Definition: free_surface_rotation.cc:65
bool less_than_based_on_double(std::pair< TetMeshVertex *, double > i, std::pair< TetMeshVertex *, double > j)
Less than comparison based on double.
Definition: tetmesh_faceted_surfaces.h:47
const double Pi
50 digits from maple
Definition: oomph_utilities.h:157
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
list x
Definition: plotDoE.py:28
#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 acos(), b, oomph::DiskLikeGeomObjectWithBoundaries::boundary_triad(), cos(), e(), oomph::DiskTetMeshFacetedSurface::Equivalent_vertex_pt, oomph::TetMeshFacetedSurface::Facet_pt, oomph::TetMeshFacetedSurface::Geom_object_with_boundaries_pt, oomph::Node::get_coordinates_on_boundary(), i, j, oomph::HelperForSortingVectorOfPairsOfVertexPtAndDouble::less_than_based_on_double(), m, n, oomph::DiskTetMeshFacetedSurface::Nfacet, WallFunction::normal(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, oomph::MathematicalConstants::Pi, UniformPSDSelfTest::r, oomph::TetMeshFacetedClosedSurface::set_region_for_tetgen(), oomph::TetMeshFacet::set_vertex_pt(), sin(), sqrt(), BiharmonicTestFunctions2::theta, oomph::DiskTetMeshFacetedSurface::Tri_mesh_pt, oomph::TetMeshFacetedSurface::Vertex_pt, plotDoE::x, and oomph::DiskLikeGeomObjectWithBoundaries::zeta_boundary_end().


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