RINGMesh  Version 5.0.0
A programming library for geological model meshes
mesh_builder.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2017, Association Scientifique pour la Geologie et ses
3  * Applications (ASGA). All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of ASGA nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ASGA BE LIABLE FOR ANY DIRECT,
20  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  * http://www.ring-team.org
28  *
29  * RING Project
30  * Ecole Nationale Superieure de Geologie - GeoRessources
31  * 2 Rue du Doyen Marcel Roubault - TSA 70605
32  * 54518 VANDOEUVRE-LES-NANCY
33  * FRANCE
34  */
35 
36 #pragma once
37 
38 #include <ringmesh/basic/common.h>
39 
40 #include <memory>
41 #include <numeric>
42 
43 #include <geogram/mesh/mesh_repair.h>
44 
45 #include <ringmesh/basic/factory.h>
46 
47 #include <ringmesh/mesh/mesh.h>
48 
49 namespace RINGMesh
50 {
52 } // namespace RINGMesh
53 
54 namespace RINGMesh
55 {
56  template < index_t DIMENSION >
58  {
61 
62  public:
63  virtual ~MeshBaseBuilder() = default;
75  void copy( const MeshBase< DIMENSION >& rhs, bool copy_attributes )
76  {
77  do_copy( rhs, copy_attributes );
79  }
80 
81  virtual void load_mesh( const std::string& filename ) = 0;
90  void clear( bool keep_attributes, bool keep_memory )
91  {
92  do_clear( keep_attributes, keep_memory );
94  }
102  void repair( GEO::MeshRepairMode mode, double colocate_epsilon )
103  {
104  do_repair( mode, colocate_epsilon );
106  }
117  void set_vertex( index_t v_id, const vecn< DIMENSION >& vertex )
118  {
119  do_set_vertex( v_id, vertex );
121  }
126  index_t create_vertex()
127  {
128  index_t index = do_create_vertex();
130  return index;
131  }
137  index_t create_vertex( const vecn< DIMENSION >& vertex )
138  {
139  index_t index = create_vertex();
140  set_vertex( index, vertex );
141  return index;
142  }
148  index_t create_vertices( index_t nb )
149  {
150  index_t index = do_create_vertices( nb );
152  return index;
153  }
154 
159  void assign_vertices( const std::vector< double >& point_coordinates )
160  {
161  do_assign_vertices( point_coordinates );
163  }
164 
171  void delete_vertices( const std::vector< bool >& to_delete )
172  {
173  do_delete_vertices( to_delete );
175  }
184  void clear_vertices( bool keep_attributes, bool keep_memory )
185  {
186  do_clear_vertices( keep_attributes, keep_memory );
188  }
189  void permute_vertices( const std::vector< index_t >& permutation )
190  {
191  do_permute_vertices( permutation );
193  }
197  static std::unique_ptr< MeshBaseBuilder< DIMENSION > > create_builder(
198  MeshBase< DIMENSION >& mesh );
199 
200  protected:
201  explicit MeshBaseBuilder( MeshBase< DIMENSION >& mesh )
202  : mesh_base_( mesh )
203  {
204  }
207  {
208  mesh_base_.vertex_nn_search_.reset();
209  }
210 
214  virtual void clear_vertex_linked_objects() = 0;
215 
216  private:
224  virtual void do_copy(
225  const MeshBase< DIMENSION >& rhs, bool copy_attributes ) = 0;
234  virtual void do_clear( bool keep_attributes, bool keep_memory ) = 0;
242  virtual void do_repair(
243  GEO::MeshRepairMode mode, double colocate_epsilon ) = 0;
250  virtual void do_set_vertex(
251  index_t v_id, const vecn< DIMENSION >& vertex ) = 0;
256  virtual index_t do_create_vertex() = 0;
262  virtual index_t do_create_vertices( index_t nb ) = 0;
267  virtual void do_assign_vertices(
268  const std::vector< double >& point_coordinates ) = 0;
275  virtual void do_delete_vertices(
276  const std::vector< bool >& to_delete ) = 0;
285  virtual void do_clear_vertices(
286  bool keep_attributes, bool keep_memory ) = 0;
287  virtual void do_permute_vertices(
288  const std::vector< index_t >& permutation ) = 0;
289 
290  protected:
292  };
293 
295 
296  template < index_t DIMENSION >
297  class PointSetMeshBuilder : public MeshBaseBuilder< DIMENSION >
298  {
299  public:
300  static std::unique_ptr< PointSetMeshBuilder< DIMENSION > >
302 
304  {
305  // All vertices are isolated in a Mesh0D
306  }
307 
308  protected:
310  : MeshBaseBuilder< DIMENSION >( mesh ), pointset_mesh_( mesh )
311  {
312  }
313 
314  private:
316  {
317  this->delete_vertex_nn_search();
318  }
319 
320  protected:
322  };
323 
325 
326  template < index_t DIMENSION >
330 
332 
333  template < index_t DIMENSION >
334  class LineMeshBuilder : public MeshBaseBuilder< DIMENSION >
335  {
336  public:
337  static std::unique_ptr< LineMeshBuilder > create_builder(
338  LineMesh< DIMENSION >& mesh );
339 
345  void create_edge( index_t v1_id, index_t v2_id )
346  {
347  do_create_edge( v1_id, v2_id );
348  clear_edge_linked_objects();
349  }
355  index_t create_edges( index_t nb_edges )
356  {
357  index_t index = do_create_edges( nb_edges );
358  clear_edge_linked_objects();
359  return index;
360  }
371  const EdgeLocalVertex& edge_local_vertex, index_t vertex_id )
372  {
373  do_set_edge_vertex( edge_local_vertex, vertex_id );
374  clear_edge_linked_objects();
375  }
384  void delete_edges( const std::vector< bool >& to_delete,
385  bool remove_isolated_vertices )
386  {
387  do_delete_edges( to_delete );
388  if( remove_isolated_vertices )
389  {
390  this->remove_isolated_vertices();
391  }
392  clear_edge_linked_objects();
393  }
402  void clear_edges( bool keep_attributes, bool keep_memory )
403  {
404  do_clear_edges( keep_attributes, keep_memory );
405  clear_edge_linked_objects();
406  }
407  void permute_edges( const std::vector< index_t >& permutation )
408  {
409  do_permute_edges( permutation );
410  clear_edge_linked_objects();
411  }
412 
417  {
418  std::vector< bool > to_delete( line_mesh_.nb_vertices(), true );
419  for( auto e : range( line_mesh_.nb_edges() ) )
420  {
421  for( auto v : range( 2 ) )
422  {
423  index_t vertex_id =
424  line_mesh_.edge_vertex( ElementLocalVertex( e, v ) );
425  to_delete[vertex_id] = false;
426  }
427  }
428  this->delete_vertices( to_delete );
429  }
430 
431  protected:
433  : MeshBaseBuilder< DIMENSION >( mesh ), line_mesh_( mesh )
434  {
435  }
436 
437  private:
442  {
443  line_mesh_.edge_nn_search_.reset();
444  }
445 
447  {
448  this->delete_vertex_nn_search();
449  clear_edge_linked_objects();
450  }
451 
453  {
454  delete_edge_nn_search();
455  }
456 
462  virtual void do_create_edge( index_t v1_id, index_t v2_id ) = 0;
468  virtual index_t do_create_edges( index_t nb_edges ) = 0;
478  virtual void do_set_edge_vertex(
479  const EdgeLocalVertex& edge_local_vertex, index_t vertex_id ) = 0;
486  virtual void do_delete_edges(
487  const std::vector< bool >& to_delete ) = 0;
496  virtual void do_clear_edges(
497  bool keep_attributes, bool keep_memory ) = 0;
498  virtual void do_permute_edges(
499  const std::vector< index_t >& permutation ) = 0;
500 
501  protected:
503  };
504 
506 
507  template < index_t DIMENSION >
511 
513 
514  template < index_t DIMENSION >
515  class SurfaceMeshBuilder : public MeshBaseBuilder< DIMENSION >
516  {
517  public:
518  static std::unique_ptr< SurfaceMeshBuilder< DIMENSION > >
520 
531  void create_polygons( const std::vector< index_t >& polygons,
532  const std::vector< index_t >& polygon_ptr )
533  {
534  do_create_polygons( polygons, polygon_ptr );
535  clear_polygon_linked_objects();
536  }
543  index_t create_polygon( const std::vector< index_t >& vertices )
544  {
545  index_t index = do_create_polygon( vertices );
546  clear_polygon_linked_objects();
547  return index;
548  }
554  index_t create_triangles( index_t nb_triangles )
555  {
556  index_t index = do_create_triangles( nb_triangles );
557  clear_polygon_linked_objects();
558  return index;
559  }
565  index_t create_quads( index_t nb_quads )
566  {
567  index_t index = do_create_quads( nb_quads );
568  clear_polygon_linked_objects();
569  return index;
570  }
581  const PolygonLocalEdge& polygon_local_edge, index_t vertex_id )
582  {
583  do_set_polygon_vertex( polygon_local_edge, vertex_id );
584  clear_polygon_linked_objects();
585  }
597  const PolygonLocalEdge& polygon_local_edge, index_t specifies )
598  {
599  do_set_polygon_adjacent( polygon_local_edge, specifies );
600  }
609  void clear_polygons( bool keep_attributes, bool keep_memory )
610  {
611  do_clear_polygons( keep_attributes, keep_memory );
612  clear_polygon_linked_objects();
613  }
618  {
619  std::vector< index_t > polygons_to_connect(
620  surface_mesh_.nb_polygons() );
621  std::iota(
622  polygons_to_connect.begin(), polygons_to_connect.end(), 0 );
623  connect_polygons( polygons_to_connect );
624  }
626  const std::vector< index_t >& polygons_to_connect )
627  {
628  index_t nb_local_vertices = 0;
629  for( auto polygon : polygons_to_connect )
630  {
631  nb_local_vertices +=
632  this->surface_mesh_.nb_polygon_vertices( polygon );
633  }
634 
635  std::vector< ElementLocalVertex > polygon_vertices;
636  polygon_vertices.reserve( nb_local_vertices );
637  for( auto polygon : polygons_to_connect )
638  {
639  for( auto v : range(
640  this->surface_mesh_.nb_polygon_vertices( polygon ) ) )
641  {
642  polygon_vertices.emplace_back( polygon, v );
643  }
644  }
645 
646  std::vector< index_t > next_local_vertex_around_vertex(
647  nb_local_vertices, NO_ID );
648  std::vector< index_t > vertex2polygon_local_vertex(
649  this->surface_mesh_.nb_vertices(), NO_ID );
650  index_t local_vertex_count = 0;
651  for( auto polygon : polygons_to_connect )
652  {
653  for( auto v = 0;
654  v < this->surface_mesh_.nb_polygon_vertices( polygon );
655  v++, local_vertex_count++ )
656  {
657  index_t vertex = this->surface_mesh_.polygon_vertex(
658  ElementLocalVertex( polygon, v ) );
659  next_local_vertex_around_vertex[local_vertex_count] =
660  vertex2polygon_local_vertex[vertex];
661  vertex2polygon_local_vertex[vertex] = local_vertex_count;
662  }
663  }
664 
665  local_vertex_count = 0;
666  for( auto polygon : polygons_to_connect )
667  {
668  for( index_t v = 0;
669  v < this->surface_mesh_.nb_polygon_vertices( polygon );
670  v++, local_vertex_count++ )
671  {
672  if( !this->surface_mesh_.is_edge_on_border(
673  PolygonLocalEdge( polygon, v ) ) )
674  {
675  continue;
676  }
677  index_t vertex = this->surface_mesh_.polygon_vertex(
678  ElementLocalVertex( polygon, v ) );
679  index_t next_vertex = this->surface_mesh_.polygon_vertex(
680  this->surface_mesh_.next_polygon_vertex(
681  ElementLocalVertex( polygon, v ) ) );
682  for( auto local_vertex =
683  vertex2polygon_local_vertex[next_vertex];
684  local_vertex != NO_ID;
685  local_vertex =
686  next_local_vertex_around_vertex[local_vertex] )
687  {
688  if( local_vertex == local_vertex_count )
689  {
690  continue;
691  }
692  index_t adj_polygon =
693  polygon_vertices[local_vertex].element_id_;
694  index_t adj_local_vertex =
695  polygon_vertices[local_vertex].local_vertex_id_;
696  index_t adj_next_vertex =
697  this->surface_mesh_.polygon_vertex(
698  this->surface_mesh_.next_polygon_vertex(
700  adj_polygon, adj_local_vertex ) ) );
701  if( adj_next_vertex == vertex )
702  {
703  this->set_polygon_adjacent(
704  PolygonLocalEdge( polygon, v ), adj_polygon );
705  this->set_polygon_adjacent(
707  adj_polygon, adj_local_vertex ),
708  polygon );
709  break;
710  }
711  }
712  }
713  }
714  }
715 
716  void permute_polygons( const std::vector< index_t >& permutation )
717  {
718  do_permute_polygons( permutation );
719  clear_polygon_linked_objects();
720  }
730  void delete_polygons( const std::vector< bool >& to_delete,
731  bool remove_isolated_vertices )
732  {
733  do_delete_polygons( to_delete );
734  if( remove_isolated_vertices )
735  {
736  this->remove_isolated_vertices();
737  }
738  clear_polygon_linked_objects();
739  }
740 
753  virtual void remove_small_connected_components(
754  double min_area, index_t min_polygons ) = 0;
755  virtual void triangulate(
756  const SurfaceMeshBase< DIMENSION >& surface_in ) = 0;
762  void remove_isolated_vertices()
763  {
764  std::vector< bool > to_delete( surface_mesh_.nb_vertices(), true );
765  for( auto p : range( surface_mesh_.nb_polygons() ) )
766  {
767  for( auto v : range( surface_mesh_.nb_polygon_vertices( p ) ) )
768  {
769  index_t vertex_id = surface_mesh_.polygon_vertex(
770  ElementLocalVertex( p, v ) );
771  to_delete[vertex_id] = false;
772  }
773  }
774  this->delete_vertices( to_delete );
775  }
776 
777  protected:
779  : MeshBaseBuilder< DIMENSION >( mesh ), surface_mesh_( mesh )
780  {
781  }
782 
783  private:
787  void delete_polygon_nn_search()
788  {
789  surface_mesh_.nn_search_.reset();
790  }
791 
795  void delete_polygon_aabb()
796  {
797  surface_mesh_.polygon_aabb_.reset();
798  }
800  void clear_vertex_linked_objects() override
801  {
802  this->delete_vertex_nn_search();
803  clear_polygon_linked_objects();
804  }
806  void clear_polygon_linked_objects()
807  {
808  delete_polygon_aabb();
809  delete_polygon_nn_search();
810  }
817  virtual void do_create_polygons( const std::vector< index_t >& polygons,
818  const std::vector< index_t >& polygon_ptr ) = 0;
825  virtual index_t do_create_polygon(
826  const std::vector< index_t >& vertices ) = 0;
832  virtual index_t do_create_triangles( index_t nb_triangles ) = 0;
838  virtual index_t do_create_quads( index_t nb_quads ) = 0;
848  virtual void do_set_polygon_vertex(
849  const PolygonLocalEdge& polygon_local_edge, index_t vertex_id ) = 0;
860  virtual void do_set_polygon_adjacent(
861  const PolygonLocalEdge& polygon_local_edge, index_t specifies ) = 0;
870  virtual void do_clear_polygons(
871  bool keep_attributes, bool keep_memory ) = 0;
872 
873  virtual void do_permute_polygons(
874  const std::vector< index_t >& permutation ) = 0;
881  virtual void do_delete_polygons(
882  const std::vector< bool >& to_delete ) = 0;
883 
884  protected:
885  SurfaceMeshBase< DIMENSION >& surface_mesh_;
886  };
887 
889 
890  template < index_t DIMENSION >
894 
896 
897  template < index_t DIMENSION >
898  class VolumeMeshBuilder : public MeshBaseBuilder< DIMENSION >
899  {
900  static_assert( DIMENSION == 3, "DIMENSION template should be 3" );
901 
902  public:
903  static std::unique_ptr< VolumeMeshBuilder< DIMENSION > > create_builder(
904  VolumeMesh< DIMENSION >& mesh );
905 
914  index_t create_cells( index_t nb_cells, CellType type )
915  {
916  index_t index = do_create_cells( nb_cells, type );
917  clear_cell_linked_objects();
918  return index;
919  }
920  /*
921  * \brief Copies a tets mesh into this Mesh.
922  * \details Cells adjacence are not computed.
923  * cell and corner attributes are zeroed.
924  * \param[in] tets cells to vertex links
925  * (using vector::swap).
926  */
927  void assign_cell_tet_mesh( const std::vector< index_t >& tets )
928  {
929  do_assign_cell_tet_mesh( tets );
930  clear_cell_linked_objects();
931  }
942  const ElementLocalVertex& cell_local_vertex, index_t vertex_id )
943  {
944  do_set_cell_vertex( cell_local_vertex, vertex_id );
945  clear_cell_linked_objects();
946  }
954  index_t corner_index, index_t vertex_index )
955  {
956  do_set_cell_corner_vertex_index( corner_index, vertex_index );
957  clear_cell_linked_objects();
958  }
966  const CellLocalFacet& cell_local_facet, index_t cell_adjacent )
967  {
968  do_set_cell_adjacent( cell_local_facet, cell_adjacent );
969  }
970 
974  virtual void connect_cells() = 0;
975 
984  void clear_cells( bool keep_attributes, bool keep_memory )
985  {
986  do_clear_cells( keep_attributes, keep_memory );
987  clear_cell_linked_objects();
988  }
1000  void permute_cells( const std::vector< index_t >& permutation )
1001  {
1002  do_permute_cells( permutation );
1003  clear_cell_linked_objects();
1004  }
1014  void delete_cells( const std::vector< bool >& to_delete,
1015  bool remove_isolated_vertices )
1016  {
1017  do_delete_cells( to_delete );
1018  if( remove_isolated_vertices )
1019  {
1020  this->remove_isolated_vertices();
1021  }
1022  clear_cell_linked_objects();
1023  }
1024 
1026  {
1027  std::vector< bool > to_delete( volume_mesh_.nb_vertices(), true );
1028  for( auto c : range( volume_mesh_.nb_cells() ) )
1029  {
1030  for( auto v : range( volume_mesh_.nb_cell_vertices( c ) ) )
1031  {
1032  index_t vertex_id =
1033  volume_mesh_.cell_vertex( ElementLocalVertex( c, v ) );
1034  to_delete[vertex_id] = false;
1035  }
1036  }
1037  this->delete_vertices( to_delete );
1038  }
1039 
1040  protected:
1042  : MeshBaseBuilder< DIMENSION >( mesh ), volume_mesh_( mesh )
1043  {
1044  }
1045 
1046  private:
1051  {
1052  volume_mesh_.cell_nn_search_.reset();
1053  volume_mesh_.cell_facet_nn_search_.reset();
1054  }
1055 
1060  {
1061  volume_mesh_.cell_aabb_.reset();
1062  }
1063 
1065  {
1066  this->delete_vertex_nn_search();
1067  clear_cell_linked_objects();
1068  }
1069 
1071  {
1072  delete_cell_aabb();
1073  delete_cell_nn_search();
1074  }
1075 
1084  virtual index_t do_create_cells( index_t nb_cells, CellType type ) = 0;
1085  /*
1086  * \brief Copies a tets mesh into this Mesh.
1087  * \details Cells adjacence are not computed.
1088  * cell and corner attributes are zeroed.
1089  * \param[in] tets cells to vertex links
1090  * (using vector::swap).
1091  */
1092  virtual void do_assign_cell_tet_mesh(
1093  const std::vector< index_t >& tets ) = 0;
1103  virtual void do_set_cell_vertex(
1104  const ElementLocalVertex& cell_local_vertex,
1105  index_t vertex_id ) = 0;
1112  virtual void do_set_cell_corner_vertex_index(
1113  index_t corner_index, index_t vertex_index ) = 0;
1120  virtual void do_set_cell_adjacent(
1121  const CellLocalFacet& cell_local_facet, index_t cell_adjacent ) = 0;
1130  virtual void do_clear_cells(
1131  bool keep_attributes, bool keep_memory ) = 0;
1143  virtual void do_permute_cells(
1144  const std::vector< index_t >& permutation ) = 0;
1151  virtual void do_delete_cells(
1152  const std::vector< bool >& to_delete ) = 0;
1153 
1154  protected:
1156  };
1157 
1159 
1160  template < index_t DIMENSION >
1164 
1166 } // namespace RINGMesh
void create_edge(index_t v1_id, index_t v2_id)
Create a new edge.
Definition: mesh_builder.h:345
virtual ~MeshBaseBuilder()=default
GEO::vecng< DIMENSION, double > vecn
Definition: types.h:74
index_t create_vertex()
Creates a new vertex.
Definition: mesh_builder.h:126
PointSetMesh< DIMENSION > & pointset_mesh_
Definition: mesh_builder.h:321
void delete_edges(const std::vector< bool > &to_delete, bool remove_isolated_vertices)
Deletes a set of edges.
Definition: mesh_builder.h:384
index_t create_polygon(const std::vector< index_t > &vertices)
Creates a polygon.
Definition: mesh_builder.h:543
MeshBaseBuilder(MeshBase< DIMENSION > &mesh)
Definition: mesh_builder.h:200
void delete_vertices(const std::vector< bool > &to_delete)
Deletes a set of vertices.
Definition: mesh_builder.h:171
virtual void do_permute_vertices(const std::vector< index_t > &permutation)=0
index_t create_vertex(const vecn< DIMENSION > &vertex)
Creates a new vertex.
Definition: mesh_builder.h:137
void set_cell_corner_vertex_index(index_t corner_index, index_t vertex_index)
Sets the vertex that a corner is incident to.
Definition: mesh_builder.h:953
void permute_edges(const std::vector< index_t > &permutation)
Definition: mesh_builder.h:407
virtual void do_clear_vertices(bool keep_attributes, bool keep_memory)=0
Removes all the vertices and attributes.
void clear_vertex_linked_objects() override
Deletes the NNSearch on vertices.
VolumeMesh< DIMENSION > & volume_mesh_
ringmesh_template_assert_2d_or_3d(DIMENSION)
ALIAS_2D_AND_3D(Box)
virtual void do_clear(bool keep_attributes, bool keep_memory)=0
Removes all the entities and attributes of this mesh.
void copy(const MeshBase< DIMENSION > &rhs, bool copy_attributes)
Copy a mesh into this one.
Definition: mesh_builder.h:75
void connect_polygons()
Retrieve the adjacencies of polygons.
Definition: mesh_builder.h:617
virtual index_t do_create_vertex()=0
Creates a new vertex.
void permute_polygons(const std::vector< index_t > &permutation)
Definition: mesh_builder.h:716
void repair(GEO::MeshRepairMode mode, double colocate_epsilon)
Fixes some defaults in a mesh.
Definition: mesh_builder.h:102
VolumeMeshBuilder(VolumeMesh< DIMENSION > &mesh)
void set_cell_adjacent(const CellLocalFacet &cell_local_facet, index_t cell_adjacent)
Sets the cell adjacent.
Definition: mesh_builder.h:965
void set_cell_vertex(const ElementLocalVertex &cell_local_vertex, index_t vertex_id)
Sets a vertex of a cell by local vertex index.
Definition: mesh_builder.h:941
void delete_cell_nn_search()
Deletes the NNSearch on cells.
void delete_edge_nn_search()
Deletes the NNSearch on edges.
Definition: mesh_builder.h:441
void permute_vertices(const std::vector< index_t > &permutation)
Definition: mesh_builder.h:189
void clear_cells(bool keep_attributes, bool keep_memory)
Removes all the cells and attributes.
Definition: mesh_builder.h:984
virtual void load_mesh(const std::string &filename)=0
index_t create_triangles(index_t nb_triangles)
Creates a contiguous chunk of triangles.
Definition: mesh_builder.h:554
PointSetMeshBuilder(PointSetMesh< DIMENSION > &mesh)
Definition: mesh_builder.h:309
static std::unique_ptr< MeshBaseBuilder< DIMENSION > > create_builder(MeshBase< DIMENSION > &mesh)
CellType
Definition: types.h:89
std::string MeshType
Definition: mesh.h:69
index_t create_vertices(index_t nb)
Creates a contiguous chunk of vertices.
Definition: mesh_builder.h:148
LineMeshBuilder(LineMesh< DIMENSION > &mesh)
Definition: mesh_builder.h:432
virtual void do_set_vertex(index_t v_id, const vecn< DIMENSION > &vertex)=0
Sets a point.
LineMesh< DIMENSION > & line_mesh_
Definition: mesh_builder.h:502
void set_polygon_vertex(const PolygonLocalEdge &polygon_local_edge, index_t vertex_id)
Sets a vertex of a polygon by local vertex index.
Definition: mesh_builder.h:580
void delete_polygons(const std::vector< bool > &to_delete, bool remove_isolated_vertices)
Deletes a set of polygons.
Definition: mesh_builder.h:730
void create_polygons(const std::vector< index_t > &polygons, const std::vector< index_t > &polygon_ptr)
Definition: mesh_builder.h:531
void set_vertex(index_t v_id, const vecn< DIMENSION > &vertex)
Sets a point.
Definition: mesh_builder.h:117
encapsulate adimensional mesh functionalities in order to provide an API on which we base the RINGMes...
Definition: mesh.h:138
index_t create_quads(index_t nb_quads)
Creates a contiguous chunk of quads.
Definition: mesh_builder.h:565
void permute_cells(const std::vector< index_t > &permutation)
Applies a permutation to the entities and their attributes. On exit, permutation is modified (used fo...
virtual void do_copy(const MeshBase< DIMENSION > &rhs, bool copy_attributes)=0
Copy a mesh into this one.
index_t create_cells(index_t nb_cells, CellType type)
Creates a contiguous chunk of cells of the same type.
Definition: mesh_builder.h:914
void set_polygon_adjacent(const PolygonLocalEdge &polygon_local_edge, index_t specifies)
Sets an adjacent polygon by both its polygon.
Definition: mesh_builder.h:596
void remove_isolated_vertices()
Remove vertices not connected to any mesh element.
Definition: mesh_builder.h:416
virtual void do_assign_vertices(const std::vector< double > &point_coordinates)=0
set vertex coordinates from a std::vector of coordinates
void clear_vertex_linked_objects() override
Deletes the NNSearch on vertices.
Definition: mesh_builder.h:446
virtual void remove_isolated_vertices()
Definition: mesh_builder.h:303
void clear_polygons(bool keep_attributes, bool keep_memory)
Removes all the polygons and attributes.
Definition: mesh_builder.h:609
virtual void clear_vertex_linked_objects()=0
Deletes the NNSearch on vertices.
void clear_edges(bool keep_attributes, bool keep_memory)
Removes all the edges and attributes.
Definition: mesh_builder.h:402
void clear_vertices(bool keep_attributes, bool keep_memory)
Removes all the vertices and attributes.
Definition: mesh_builder.h:184
Classes to build GeoModel from various inputs.
Definition: algorithm.h:48
virtual void do_repair(GEO::MeshRepairMode mode, double colocate_epsilon)=0
Fixes some defaults in a mesh.
index_t create_edges(index_t nb_edges)
Creates a contiguous chunk of edges.
Definition: mesh_builder.h:355
virtual void do_delete_vertices(const std::vector< bool > &to_delete)=0
Deletes a set of vertices.
void set_edge_vertex(const EdgeLocalVertex &edge_local_vertex, index_t vertex_id)
Sets a vertex of a edge by local vertex index.
Definition: mesh_builder.h:370
virtual index_t do_create_vertices(index_t nb)=0
Creates a contiguous chunk of vertices.
void assign_cell_tet_mesh(const std::vector< index_t > &tets)
Definition: mesh_builder.h:927
void connect_polygons(const std::vector< index_t > &polygons_to_connect)
Definition: mesh_builder.h:625
void delete_cell_aabb()
Deletes the AABB on cells.
void clear_vertex_linked_objects() final
Deletes the NNSearch on vertices.
Definition: mesh_builder.h:315
ringmesh_disable_copy_and_move(MeshBaseBuilder)
void assign_vertices(const std::vector< double > &point_coordinates)
set vertex coordinates from a std::vector of coordinates
Definition: mesh_builder.h:159
void delete_cells(const std::vector< bool > &to_delete, bool remove_isolated_vertices)
Deletes a set of cells.
MeshBase< DIMENSION > & mesh_base_
Definition: mesh_builder.h:290
FORWARD_DECLARATION_DIMENSION_CLASS(GeoModelMeshEntityAccess)
void clear(bool keep_attributes, bool keep_memory)
Removes all the entities and attributes of this mesh.
Definition: mesh_builder.h:90