mesh_base.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_MESH_BASE_H
21 #define LIBMESH_MESH_BASE_H
22 
23 // Local Includes
24 #include "libmesh/auto_ptr.h" // deprecated
25 #include "libmesh/boundary_info.h"
26 #include "libmesh/dof_object.h" // for invalid_processor_id
27 #include "libmesh/libmesh_common.h"
32 #include "libmesh/simple_range.h"
33 
34 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS
35 namespace libMesh
36 {
37 enum ElemType : int;
38 }
39 #else
40 #include "libmesh/enum_elem_type.h"
41 #endif
42 
43 // C++ Includes
44 #include <cstddef>
45 #include <string>
46 #include <memory>
47 
48 namespace libMesh
49 {
50 
51 // forward declarations
52 class Elem;
53 class GhostingFunctor;
54 class Node;
55 class Point;
56 class Partitioner;
57 
58 template <class MT>
59 class MeshInput;
60 
61 
77 class MeshBase : public ParallelObject
78 {
79 public:
80 
86  MeshBase (const Parallel::Communicator & comm_in,
87  unsigned char dim=1);
88 
92  MeshBase (const MeshBase & other_mesh);
93 
98  MeshBase(MeshBase &&);
99 
110  MeshBase & operator= (const MeshBase &) = delete;
111  MeshBase & operator= (MeshBase &&) = delete;
112 
116  virtual std::unique_ptr<MeshBase> clone() const = 0;
117 
121  virtual ~MeshBase ();
122 
126  virtual std::unique_ptr<Partitioner> & partitioner() { return _partitioner; }
127 
131  const BoundaryInfo & get_boundary_info() const { return *boundary_info; }
132 
137 
141  virtual void clear ();
142 
147  bool is_prepared () const
148  { return _is_prepared; }
149 
154  virtual bool is_serial () const
155  { return true; }
156 
161  virtual bool is_serial_on_zero () const
162  { return true; }
163 
169  virtual void set_distributed ()
170  { libmesh_error(); }
171 
176  virtual bool is_replicated () const
177  { return true; }
178 
183  virtual void allgather () {}
184 
189  virtual void gather_to_zero() {}
190 
196  virtual void delete_remote_elements () {}
197 
204  unsigned int mesh_dimension () const;
205 
213  void set_mesh_dimension (unsigned char d)
214  { _elem_dims.clear(); _elem_dims.insert(d); }
215 
220  const std::set<unsigned char> & elem_dimensions() const
221  { return _elem_dims; }
222 
248  unsigned int spatial_dimension () const;
249 
254  void set_spatial_dimension(unsigned char d);
255 
265  virtual dof_id_type n_nodes () const = 0;
266 
276  virtual dof_id_type parallel_n_nodes () const = 0;
277 
281  dof_id_type n_nodes_on_proc (const processor_id_type proc) const;
282 
287  { return this->n_nodes_on_proc (this->processor_id()); }
288 
294 
299  virtual dof_id_type max_node_id () const = 0;
300 
301 #ifdef LIBMESH_ENABLE_UNIQUE_ID
302 
306 
311 #endif
312 
321  virtual void reserve_nodes (const dof_id_type nn) = 0;
322 
330  virtual dof_id_type n_elem () const = 0;
331 
339  virtual dof_id_type parallel_n_elem () const = 0;
340 
345  virtual dof_id_type max_elem_id () const = 0;
346 
351 #ifdef LIBMESH_ENABLE_UNIQUE_ID
352  virtual unique_id_type parallel_max_unique_id () const = 0;
353 #endif
354 
363  virtual void reserve_elem (const dof_id_type ne) = 0;
364 
369  virtual void update_parallel_id_counts () = 0;
370 
376  virtual dof_id_type n_active_elem () const = 0;
377 
381  dof_id_type n_elem_on_proc (const processor_id_type proc) const;
382 
387  { return this->n_elem_on_proc (this->processor_id()); }
388 
394 
399 
404  { return this->n_active_elem_on_proc (this->processor_id()); }
405 
415  dof_id_type n_sub_elem () const;
416 
421 
427  virtual const Point & point (const dof_id_type i) const = 0;
428 
434  virtual const Node & node_ref (const dof_id_type i) const {
435  return *this->node_ptr(i);
436  }
437 
442  virtual Node & node_ref (const dof_id_type i) {
443  return *this->node_ptr(i);
444  }
445 
453 #ifdef LIBMESH_ENABLE_DEPRECATED
454  virtual const Node & node (const dof_id_type i) const
455  {
456  libmesh_deprecated();
457  return *this->node_ptr(i);
458  }
459 #endif
460 
467 #ifdef LIBMESH_ENABLE_DEPRECATED
468  virtual Node & node (const dof_id_type i)
469  {
470  libmesh_deprecated();
471  return *this->node_ptr(i);
472  }
473 #endif
474 
479  virtual const Node * node_ptr (const dof_id_type i) const = 0;
480 
486  virtual Node * node_ptr (const dof_id_type i) = 0;
487 
492  virtual const Node * query_node_ptr (const dof_id_type i) const = 0;
493 
498  virtual Node * query_node_ptr (const dof_id_type i) = 0;
499 
504  virtual const Elem & elem_ref (const dof_id_type i) const {
505  return *this->elem_ptr(i);
506  }
507 
513  virtual Elem & elem_ref (const dof_id_type i) {
514  return *this->elem_ptr(i);
515  }
516 
521  virtual const Elem * elem_ptr (const dof_id_type i) const = 0;
522 
528  virtual Elem * elem_ptr (const dof_id_type i) = 0;
529 
536 #ifdef LIBMESH_ENABLE_DEPRECATED
537  virtual const Elem * elem (const dof_id_type i) const
538  {
539  libmesh_deprecated();
540  return this->elem_ptr(i);
541  }
542 #endif
543 
551 #ifdef LIBMESH_ENABLE_DEPRECATED
552  virtual Elem * elem (const dof_id_type i)
553  {
554  libmesh_deprecated();
555  return this->elem_ptr(i);
556  }
557 #endif
558 
563  virtual const Elem * query_elem_ptr (const dof_id_type i) const = 0;
564 
569  virtual Elem * query_elem_ptr (const dof_id_type i) = 0;
570 
577 #ifdef LIBMESH_ENABLE_DEPRECATED
578  virtual const Elem * query_elem (const dof_id_type i) const
579  {
580  libmesh_deprecated();
581  return this->query_elem_ptr(i);
582  }
583 #endif
584 
591 #ifdef LIBMESH_ENABLE_DEPRECATED
592  virtual Elem * query_elem (const dof_id_type i)
593  {
594  libmesh_deprecated();
595  return this->query_elem_ptr(i);
596  }
597 #endif
598 
609  virtual Node * add_point (const Point & p,
611  const processor_id_type proc_id =
613 
617  virtual Node * add_node (Node * n) = 0;
618 
626  virtual Node * insert_node(Node * n) = 0;
627 
631  virtual void delete_node (Node * n) = 0;
632 
639  virtual void own_node (Node &) {}
640 
646  virtual void renumber_node (dof_id_type old_id, dof_id_type new_id) = 0;
647 
657  virtual Elem * add_elem (Elem * e) = 0;
658 
666  virtual Elem * insert_elem (Elem * e) = 0;
667 
678  virtual void delete_elem (Elem * e) = 0;
679 
685  virtual void renumber_elem (dof_id_type old_id, dof_id_type new_id) = 0;
686 
699  virtual void find_neighbors (const bool reset_remote_elements = false,
700  const bool reset_current_list = true) = 0;
701 
707  virtual void renumber_nodes_and_elements () = 0;
708 
715  virtual void fix_broken_node_and_element_numbering () = 0;
716 
717 
718 #ifdef LIBMESH_ENABLE_AMR
719 
724  virtual bool contract () = 0;
725 #endif
726 
742  void prepare_for_use (const bool skip_renumber_nodes_and_elements=false, const bool skip_find_neighbors=false);
743 
747  virtual void partition (const unsigned int n_parts);
748 
749  void partition ()
750  { this->partition(this->n_processors()); }
751 
757  virtual void redistribute () {}
758 
763  virtual void update_post_partitioning () {}
764 
784 
793 
811  void skip_partitioning(bool skip) { _skip_partitioning = skip; }
812  bool skip_partitioning() const { return _skip_partitioning || !_partitioner.get(); }
813 
823  void add_ghosting_functor(GhostingFunctor & ghosting_functor)
824  { _ghosting_functors.insert(&ghosting_functor); }
825 
830  void remove_ghosting_functor(GhostingFunctor & ghosting_functor);
831 
835  std::set<GhostingFunctor *>::const_iterator ghosting_functors_begin() const
836  { return _ghosting_functors.begin(); }
837 
841  std::set<GhostingFunctor *>::const_iterator ghosting_functors_end() const
842  { return _ghosting_functors.end(); }
843 
848 
856  void subdomain_ids (std::set<subdomain_id_type> & ids) const;
857 
866 
875  unsigned int n_partitions () const
876  { return _n_parts; }
877 
882  std::string get_info () const;
883 
887  void print_info (std::ostream & os=libMesh::out) const;
888 
894  friend std::ostream & operator << (std::ostream & os, const MeshBase & m);
895 
900  virtual void read (const std::string & name,
901  void * mesh_data=nullptr,
902  bool skip_renumber_nodes_and_elements=false,
903  bool skip_find_neighbors=false) = 0;
904  virtual void write (const std::string & name) = 0;
905 
912  virtual void all_first_order () = 0;
913 
925  virtual void all_second_order (const bool full_ordered=true) = 0;
926 
932 
940  struct element_iterator;
941  struct const_element_iterator;
942 
950  struct node_iterator;
951  struct const_node_iterator;
952 
962  unsigned int recalculate_n_partitions();
963 
970 #ifdef LIBMESH_ENABLE_DEPRECATED
971  const PointLocatorBase & point_locator () const;
972 #endif
973 
981  std::unique_ptr<PointLocatorBase> sub_point_locator () const;
982 
986  void clear_point_locator ();
987 
993  void set_count_lower_dim_elems_in_point_locator(bool count_lower_dim_elems);
994 
999 
1007  virtual void libmesh_assert_valid_parallel_ids() const {}
1008 
1013  std::string & subdomain_name(subdomain_id_type id);
1014  const std::string & subdomain_name(subdomain_id_type id) const;
1015 
1020  subdomain_id_type get_id_by_name(const std::string & name) const;
1021 
1022  //
1023  // element_iterator accessors
1024  //
1025 
1029  virtual element_iterator elements_begin () = 0;
1030  virtual element_iterator elements_end () = 0;
1031  virtual const_element_iterator elements_begin () const = 0;
1032  virtual const_element_iterator elements_end () const = 0;
1035 
1039  virtual element_iterator ancestor_elements_begin () = 0;
1040  virtual element_iterator ancestor_elements_end () = 0;
1041  virtual const_element_iterator ancestor_elements_begin () const = 0;
1042  virtual const_element_iterator ancestor_elements_end () const = 0;
1043 
1047  virtual element_iterator subactive_elements_begin () = 0;
1048  virtual element_iterator subactive_elements_end () = 0;
1049  virtual const_element_iterator subactive_elements_begin () const = 0;
1050  virtual const_element_iterator subactive_elements_end () const = 0;
1051 
1055  virtual element_iterator semilocal_elements_begin () = 0;
1056  virtual element_iterator semilocal_elements_end () = 0;
1057  virtual const_element_iterator semilocal_elements_begin () const = 0;
1058  virtual const_element_iterator semilocal_elements_end () const = 0;
1059 
1063  virtual element_iterator facelocal_elements_begin () = 0;
1064  virtual element_iterator facelocal_elements_end () = 0;
1065  virtual const_element_iterator facelocal_elements_begin () const = 0;
1066  virtual const_element_iterator facelocal_elements_end () const = 0;
1067 
1071  virtual element_iterator level_elements_begin (unsigned int level) = 0;
1072  virtual element_iterator level_elements_end (unsigned int level) = 0;
1073  virtual const_element_iterator level_elements_begin (unsigned int level) const = 0;
1074  virtual const_element_iterator level_elements_end (unsigned int level) const = 0;
1075 
1079  virtual element_iterator pid_elements_begin (processor_id_type proc_id) = 0;
1080  virtual element_iterator pid_elements_end (processor_id_type proc_id) = 0;
1081  virtual const_element_iterator pid_elements_begin (processor_id_type proc_id) const = 0;
1082  virtual const_element_iterator pid_elements_end (processor_id_type proc_id) const = 0;
1083 
1087  virtual element_iterator type_elements_begin (ElemType type) = 0;
1088  virtual element_iterator type_elements_end (ElemType type) = 0;
1089  virtual const_element_iterator type_elements_begin (ElemType type) const = 0;
1090  virtual const_element_iterator type_elements_end (ElemType type) const = 0;
1091 
1095  virtual element_iterator unpartitioned_elements_begin () = 0;
1096  virtual element_iterator unpartitioned_elements_end () = 0;
1097  virtual const_element_iterator unpartitioned_elements_begin () const = 0;
1098  virtual const_element_iterator unpartitioned_elements_end () const = 0;
1099 
1103  virtual element_iterator active_unpartitioned_elements_begin () = 0;
1104  virtual element_iterator active_unpartitioned_elements_end () = 0;
1105  virtual const_element_iterator active_unpartitioned_elements_begin () const = 0;
1106  virtual const_element_iterator active_unpartitioned_elements_end () const = 0;
1107 
1112  virtual element_iterator ghost_elements_begin () = 0;
1113  virtual element_iterator ghost_elements_end () = 0;
1114  virtual const_element_iterator ghost_elements_begin () const = 0;
1115  virtual const_element_iterator ghost_elements_end () const = 0;
1116 
1122  virtual element_iterator
1123  evaluable_elements_begin (const DofMap & dof_map,
1124  unsigned int var_num = libMesh::invalid_uint) = 0;
1125 
1126  virtual element_iterator
1127  evaluable_elements_end (const DofMap & dof_map,
1128  unsigned int var_num = libMesh::invalid_uint) = 0;
1129 
1130  virtual const_element_iterator
1131  evaluable_elements_begin (const DofMap & dof_map,
1132  unsigned int var_num = libMesh::invalid_uint) const = 0;
1133 
1134  virtual const_element_iterator
1135  evaluable_elements_end (const DofMap & dof_map,
1136  unsigned int var_num = libMesh::invalid_uint) const = 0;
1137 
1138 #ifdef LIBMESH_ENABLE_AMR
1139 
1142  virtual element_iterator flagged_elements_begin (unsigned char rflag) = 0;
1143  virtual element_iterator flagged_elements_end (unsigned char rflag) = 0;
1144  virtual const_element_iterator flagged_elements_begin (unsigned char rflag) const = 0;
1145  virtual const_element_iterator flagged_elements_end (unsigned char rflag) const = 0;
1146 
1151  virtual element_iterator flagged_pid_elements_begin (unsigned char rflag,
1152  processor_id_type pid) = 0;
1153  virtual element_iterator flagged_pid_elements_end (unsigned char rflag,
1154  processor_id_type pid) = 0;
1155  virtual const_element_iterator flagged_pid_elements_begin (unsigned char rflag,
1156  processor_id_type pid) const = 0;
1157  virtual const_element_iterator flagged_pid_elements_end (unsigned char rflag,
1158  processor_id_type pid) const = 0;
1159 #endif
1160 
1166  virtual element_iterator active_elements_begin () = 0;
1167  virtual element_iterator active_elements_end () = 0;
1168  virtual const_element_iterator active_elements_begin () const = 0;
1169  virtual const_element_iterator active_elements_end () const = 0;
1172 
1173  virtual element_iterator local_elements_begin () = 0;
1174  virtual element_iterator local_elements_end () = 0;
1175  virtual const_element_iterator local_elements_begin () const = 0;
1176  virtual const_element_iterator local_elements_end () const = 0;
1177 
1178  virtual element_iterator active_semilocal_elements_begin () = 0;
1179  virtual element_iterator active_semilocal_elements_end () = 0;
1180  virtual const_element_iterator active_semilocal_elements_begin () const = 0;
1181  virtual const_element_iterator active_semilocal_elements_end () const = 0;
1182 
1183  virtual element_iterator active_type_elements_begin (ElemType type) = 0;
1184  virtual element_iterator active_type_elements_end (ElemType type) = 0;
1185  virtual const_element_iterator active_type_elements_begin (ElemType type) const = 0;
1186  virtual const_element_iterator active_type_elements_end (ElemType type) const = 0;
1187 
1188  virtual element_iterator active_pid_elements_begin (processor_id_type proc_id) = 0;
1189  virtual element_iterator active_pid_elements_end (processor_id_type proc_id) = 0;
1190  virtual const_element_iterator active_pid_elements_begin (processor_id_type proc_id) const = 0;
1191  virtual const_element_iterator active_pid_elements_end (processor_id_type proc_id) const = 0;
1192 
1193  virtual element_iterator active_subdomain_elements_begin (subdomain_id_type subdomain_id) = 0;
1194  virtual element_iterator active_subdomain_elements_end (subdomain_id_type subdomain_id) = 0;
1195  virtual const_element_iterator active_subdomain_elements_begin (subdomain_id_type subdomain_id) const = 0;
1196  virtual const_element_iterator active_subdomain_elements_end (subdomain_id_type subdomain_id) const = 0;
1197 
1198  virtual element_iterator active_subdomain_set_elements_begin (std::set<subdomain_id_type> ss) = 0;
1199  virtual element_iterator active_subdomain_set_elements_end (std::set<subdomain_id_type> ss) = 0;
1200  virtual const_element_iterator active_subdomain_set_elements_begin (std::set<subdomain_id_type> ss) const = 0;
1201  virtual const_element_iterator active_subdomain_set_elements_end (std::set<subdomain_id_type> ss) const = 0;
1202 
1203  virtual element_iterator active_local_subdomain_elements_begin (subdomain_id_type subdomain_id) = 0;
1204  virtual element_iterator active_local_subdomain_elements_end (subdomain_id_type subdomain_id) = 0;
1205  virtual const_element_iterator active_local_subdomain_elements_begin (subdomain_id_type subdomain_id) const = 0;
1206  virtual const_element_iterator active_local_subdomain_elements_end (subdomain_id_type subdomain_id) const = 0;
1207 
1208  virtual element_iterator local_level_elements_begin (unsigned int level) = 0;
1209  virtual element_iterator local_level_elements_end (unsigned int level) = 0;
1210  virtual const_element_iterator local_level_elements_begin (unsigned int level) const = 0;
1211  virtual const_element_iterator local_level_elements_end (unsigned int level) const = 0;
1212 
1213  virtual element_iterator local_not_level_elements_begin (unsigned int level) = 0;
1214  virtual element_iterator local_not_level_elements_end (unsigned int level) = 0;
1215  virtual const_element_iterator local_not_level_elements_begin (unsigned int level) const = 0;
1216  virtual const_element_iterator local_not_level_elements_end (unsigned int level) const = 0;
1217 
1218  virtual element_iterator not_level_elements_begin (unsigned int level) = 0;
1219  virtual element_iterator not_level_elements_end (unsigned int level) = 0;
1220  virtual const_element_iterator not_level_elements_begin (unsigned int level) const = 0;
1221  virtual const_element_iterator not_level_elements_end (unsigned int level) const = 0;
1222 
1223  virtual element_iterator active_local_elements_begin () = 0;
1224  virtual element_iterator active_local_elements_end () = 0;
1225  virtual const_element_iterator active_local_elements_begin () const = 0;
1226  virtual const_element_iterator active_local_elements_end () const = 0;
1229 
1230  virtual element_iterator active_not_local_elements_begin () = 0;
1231  virtual element_iterator active_not_local_elements_end () = 0;
1232  virtual const_element_iterator active_not_local_elements_begin () const = 0;
1233  virtual const_element_iterator active_not_local_elements_end () const = 0;
1234 
1235  virtual element_iterator not_local_elements_begin () = 0;
1236  virtual element_iterator not_local_elements_end () = 0;
1237  virtual const_element_iterator not_local_elements_begin () const = 0;
1238  virtual const_element_iterator not_local_elements_end () const = 0;
1239 
1240  virtual element_iterator not_subactive_elements_begin () = 0;
1241  virtual element_iterator not_subactive_elements_end () = 0;
1242  virtual const_element_iterator not_subactive_elements_begin () const = 0;
1243  virtual const_element_iterator not_subactive_elements_end () const = 0;
1244 
1245  virtual element_iterator not_active_elements_begin () = 0;
1246  virtual element_iterator not_active_elements_end () = 0;
1247  virtual const_element_iterator not_active_elements_begin () const = 0;
1248  virtual const_element_iterator not_active_elements_end () const = 0;
1249 
1250  virtual element_iterator not_ancestor_elements_begin () = 0;
1251  virtual element_iterator not_ancestor_elements_end () = 0;
1252  virtual const_element_iterator not_ancestor_elements_begin () const = 0;
1253  virtual const_element_iterator not_ancestor_elements_end () const = 0;
1254 
1255  //
1256  // node_iterator accessors
1257  //
1258 
1262  virtual node_iterator nodes_begin () = 0;
1263  virtual node_iterator nodes_end () = 0;
1264  virtual const_node_iterator nodes_begin () const = 0;
1265  virtual const_node_iterator nodes_end () const = 0;
1268 
1272  virtual node_iterator active_nodes_begin () = 0;
1273  virtual node_iterator active_nodes_end () = 0;
1274  virtual const_node_iterator active_nodes_begin () const = 0;
1275  virtual const_node_iterator active_nodes_end () const = 0;
1276 
1280  virtual node_iterator local_nodes_begin () = 0;
1281  virtual node_iterator local_nodes_end () = 0;
1282  virtual const_node_iterator local_nodes_begin () const = 0;
1283  virtual const_node_iterator local_nodes_end () const = 0;
1286 
1290  virtual node_iterator pid_nodes_begin (processor_id_type proc_id) = 0;
1291  virtual node_iterator pid_nodes_end (processor_id_type proc_id) = 0;
1292  virtual const_node_iterator pid_nodes_begin (processor_id_type proc_id) const = 0;
1293  virtual const_node_iterator pid_nodes_end (processor_id_type proc_id) const = 0;
1294 
1298  virtual node_iterator bid_nodes_begin (boundary_id_type bndry_id) = 0;
1299  virtual node_iterator bid_nodes_end (boundary_id_type bndry_id) = 0;
1300  virtual const_node_iterator bid_nodes_begin (boundary_id_type bndry_id) const = 0;
1301  virtual const_node_iterator bid_nodes_end (boundary_id_type bndry_id) const = 0;
1302 
1306  virtual node_iterator bnd_nodes_begin () = 0;
1307  virtual node_iterator bnd_nodes_end () = 0;
1308  virtual const_node_iterator bnd_nodes_begin () const = 0;
1309  virtual const_node_iterator bnd_nodes_end () const = 0;
1310 
1316  virtual node_iterator
1317  evaluable_nodes_begin (const DofMap & dof_map,
1318  unsigned int var_num = libMesh::invalid_uint) = 0;
1319 
1320  virtual node_iterator
1321  evaluable_nodes_end (const DofMap & dof_map,
1322  unsigned int var_num = libMesh::invalid_uint) = 0;
1323 
1324  virtual const_node_iterator
1325  evaluable_nodes_begin (const DofMap & dof_map,
1326  unsigned int var_num = libMesh::invalid_uint) const = 0;
1327 
1328  virtual const_node_iterator
1329  evaluable_nodes_end (const DofMap & dof_map,
1330  unsigned int var_num = libMesh::invalid_uint) const = 0;
1331 
1335  std::map<subdomain_id_type, std::string> & set_subdomain_name_map ()
1336  { return _block_id_to_name; }
1337  const std::map<subdomain_id_type, std::string> & get_subdomain_name_map () const
1338  { return _block_id_to_name; }
1339 
1340 
1346  void cache_elem_dims();
1347 
1352  void detect_interior_parents();
1353 
1354 
1363  std::unique_ptr<BoundaryInfo> boundary_info;
1364 
1365 
1366 protected:
1367 
1371  unsigned int & set_n_partitions ()
1372  { return _n_parts; }
1373 
1384  unsigned int _n_parts;
1385 
1390 
1398  mutable std::unique_ptr<PointLocatorBase> _point_locator;
1399 
1405 
1412  std::unique_ptr<Partitioner> _partitioner;
1413 
1414 #ifdef LIBMESH_ENABLE_UNIQUE_ID
1415 
1419 #endif
1420 
1425 
1432 
1440 
1446  std::map<subdomain_id_type, std::string> _block_id_to_name;
1447 
1453  std::set<unsigned char> _elem_dims;
1454 
1459  unsigned char _spatial_dimension;
1460 
1466  std::unique_ptr<GhostingFunctor> _default_ghosting;
1467 
1475  std::set<GhostingFunctor *> _ghosting_functors;
1476 
1481  friend class Partitioner;
1482 
1487  friend class MeshInput<MeshBase>;
1488 
1493  friend class BoundaryInfo;
1494 };
1495 
1496 
1497 
1498 
1499 
1500 
1501 
1502 
1503 
1504 
1505 
1509 struct
1510 MeshBase::element_iterator : variant_filter_iterator<MeshBase::Predicate, Elem *>
1511 {
1512  // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
1513  template <typename PredType, typename IterType>
1514  element_iterator (const IterType & d,
1515  const IterType & e,
1516  const PredType & p ) :
1518 };
1519 
1520 
1521 
1522 
1527 struct
1529  Elem * const,
1530  Elem * const &,
1531  Elem * const *>
1532 {
1536  template <typename PredType, typename IterType>
1537  const_element_iterator (const IterType & d,
1538  const IterType & e,
1539  const PredType & p ) :
1540  variant_filter_iterator<MeshBase::Predicate, Elem * const, Elem * const &, Elem * const *>(d,e,p) {}
1541 
1549  variant_filter_iterator<Predicate, Elem * const, Elem * const &, Elem * const *>(rhs) {}
1550 };
1551 
1552 
1553 
1554 
1555 
1556 
1557 
1561 struct
1562 MeshBase::node_iterator : variant_filter_iterator<MeshBase::Predicate, Node *>
1563 {
1567  template <typename PredType, typename IterType>
1568  node_iterator (const IterType & d,
1569  const IterType & e,
1570  const PredType & p ) :
1572 };
1573 
1574 
1575 
1576 
1581 struct
1583  Node * const,
1584  Node * const &,
1585  Node * const *>
1586 {
1590  template <typename PredType, typename IterType>
1591  const_node_iterator (const IterType & d,
1592  const IterType & e,
1593  const PredType & p ) :
1594  variant_filter_iterator<MeshBase::Predicate, Node * const, Node * const &, Node * const *>(d,e,p) {}
1595 
1603  variant_filter_iterator<Predicate, Node * const, Node * const &, Node * const *>(rhs) {}
1604 };
1605 
1606 
1607 } // namespace libMesh
1608 
1609 #endif // LIBMESH_MESH_BASE_H
std::string name(const ElemQuality q)
Definition: elem_quality.C:42
virtual element_iterator evaluable_elements_begin(const DofMap &dof_map, unsigned int var_num=libMesh::invalid_uint)=0
virtual node_iterator active_nodes_end()=0
virtual element_iterator ancestor_elements_begin()=0
virtual void redistribute()
Definition: mesh_base.h:757
virtual element_iterator facelocal_elements_end()=0
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false)=0
virtual void reserve_nodes(const dof_id_type nn)=0
virtual element_iterator not_ancestor_elements_begin()=0
bool _skip_renumber_nodes_and_elements
Definition: mesh_base.h:1431
bool is_prepared() const
Definition: mesh_base.h:147
virtual const Elem * elem(const dof_id_type i) const
Definition: mesh_base.h:537
virtual dof_id_type n_active_elem() const =0
A geometric point in (x,y,z) space associated with a DOF.
Definition: node.h:52
virtual void renumber_node(dof_id_type old_id, dof_id_type new_id)=0
virtual element_iterator not_level_elements_begin(unsigned int level)=0
variant_filter_iterator(const IterType &d, const IterType &e, const PredType &p)
dof_id_type n_elem_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:332
virtual unique_id_type parallel_max_unique_id() const =0
virtual element_iterator active_subdomain_set_elements_end(std::set< subdomain_id_type > ss)=0
dof_id_type n_unpartitioned_nodes() const
Definition: mesh_base.h:292
const unsigned int invalid_uint
Definition: libmesh.h:245
virtual element_iterator not_local_elements_end()=0
virtual SimpleRange< node_iterator > local_node_ptr_range()=0
virtual node_iterator pid_nodes_end(processor_id_type proc_id)=0
std::unique_ptr< PointLocatorBase > sub_point_locator() const
Definition: mesh_base.C:496
virtual element_iterator level_elements_begin(unsigned int level)=0
BoundaryInfo & get_boundary_info()
Definition: mesh_base.h:136
virtual node_iterator evaluable_nodes_end(const DofMap &dof_map, unsigned int var_num=libMesh::invalid_uint)=0
void allow_renumbering(bool allow)
Definition: mesh_base.h:782
void detect_interior_parents()
Definition: mesh_base.C:633
virtual element_iterator local_level_elements_end(unsigned int level)=0
void skip_partitioning(bool skip)
Definition: mesh_base.h:811
dof_id_type n_active_elem_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:345
virtual element_iterator active_semilocal_elements_end()=0
virtual element_iterator active_subdomain_elements_end(subdomain_id_type subdomain_id)=0
virtual element_iterator not_ancestor_elements_end()=0
virtual node_iterator bid_nodes_end(boundary_id_type bndry_id)=0
virtual element_iterator local_elements_begin()=0
Predicates::multi_predicate Predicate
Definition: mesh_base.h:931
virtual void allgather()
Definition: mesh_base.h:183
virtual element_iterator unpartitioned_elements_begin()=0
void set_spatial_dimension(unsigned char d)
Definition: mesh_base.C:142
virtual element_iterator not_subactive_elements_begin()=0
bool get_count_lower_dim_elems_in_point_locator() const
Definition: mesh_base.C:531
void remove_ghosting_functor(GhostingFunctor &ghosting_functor)
Definition: mesh_base.C:281
The base class for all geometric element types.
Definition: elem.h:100
virtual element_iterator ancestor_elements_end()=0
uint8_t processor_id_type
Definition: id_types.h:99
dof_id_type n_local_nodes() const
Definition: mesh_base.h:286
virtual std::unique_ptr< Partitioner > & partitioner()
Definition: mesh_base.h:126
virtual element_iterator flagged_elements_end(unsigned char rflag)=0
virtual void gather_to_zero()
Definition: mesh_base.h:189
std::string get_info() const
Definition: mesh_base.C:378
virtual Elem & elem_ref(const dof_id_type i)
Definition: mesh_base.h:513
const_element_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition: mesh_base.h:1537
virtual node_iterator bid_nodes_begin(boundary_id_type bndry_id)=0
virtual void fix_broken_node_and_element_numbering()=0
virtual SimpleRange< element_iterator > active_element_ptr_range()=0
unsigned char _spatial_dimension
Definition: mesh_base.h:1459
virtual void own_node(Node &)
Definition: mesh_base.h:639
virtual element_iterator flagged_pid_elements_end(unsigned char rflag, processor_id_type pid)=0
std::unique_ptr< BoundaryInfo > boundary_info
Definition: mesh_base.h:1363
virtual element_iterator subactive_elements_end()=0
const PointLocatorBase & point_locator() const
Definition: mesh_base.C:479
virtual Elem * elem(const dof_id_type i)
Definition: mesh_base.h:552
bool _allow_remote_element_removal
Definition: mesh_base.h:1439
virtual void all_first_order()=0
virtual Elem * query_elem(const dof_id_type i)
Definition: mesh_base.h:592
virtual element_iterator not_active_elements_end()=0
const BoundaryInfo & get_boundary_info() const
Definition: mesh_base.h:131
dof_id_type n_unpartitioned_elem() const
Definition: mesh_base.h:392
virtual element_iterator active_local_subdomain_elements_end(subdomain_id_type subdomain_id)=0
virtual std::unique_ptr< MeshBase > clone() const =0
virtual Node & node_ref(const dof_id_type i)
Definition: mesh_base.h:442
virtual element_iterator active_semilocal_elements_begin()=0
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
dof_id_type n_local_elem() const
Definition: mesh_base.h:386
virtual element_iterator local_level_elements_begin(unsigned int level)=0
Base class for Mesh.
Definition: mesh_base.h:77
Base class for all concrete Partitioner instantiations.
Definition: partitioner.h:50
virtual bool is_serial_on_zero() const
Definition: mesh_base.h:161
virtual void set_distributed()
Definition: mesh_base.h:169
void subdomain_ids(std::set< subdomain_id_type > &ids) const
Definition: mesh_base.C:288
node_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition: mesh_base.h:1568
virtual node_iterator nodes_begin()=0
virtual element_iterator elements_begin()=0
virtual SimpleRange< element_iterator > active_local_element_ptr_range()=0
Manages the degrees of freedom (DOFs) in a simulation.
Definition: dof_map.h:176
virtual element_iterator level_elements_end(unsigned int level)=0
std::set< GhostingFunctor * > _ghosting_functors
Definition: mesh_base.h:1475
unique_id_type _next_unique_id
Definition: mesh_base.h:1418
virtual const Elem * query_elem(const dof_id_type i) const
Definition: mesh_base.h:578
virtual element_iterator facelocal_elements_begin()=0
unsigned int _n_parts
Definition: mesh_base.h:1384
virtual element_iterator ghost_elements_end()=0
virtual element_iterator active_subdomain_elements_begin(subdomain_id_type subdomain_id)=0
virtual element_iterator active_subdomain_set_elements_begin(std::set< subdomain_id_type > ss)=0
virtual node_iterator evaluable_nodes_begin(const DofMap &dof_map, unsigned int var_num=libMesh::invalid_uint)=0
dof_id_type n_active_local_elem() const
Definition: mesh_base.h:403
void allow_remote_element_removal(bool allow)
Definition: mesh_base.h:791
processor_id_type n_processors() const
virtual bool is_serial() const
Definition: mesh_base.h:154
virtual element_iterator active_local_subdomain_elements_begin(subdomain_id_type subdomain_id)=0
virtual void find_neighbors(const bool reset_remote_elements=false, const bool reset_current_list=true)=0
virtual element_iterator not_subactive_elements_end()=0
virtual node_iterator active_nodes_begin()=0
int8_t boundary_id_type
Definition: id_types.h:51
virtual void delete_elem(Elem *e)=0
virtual SimpleRange< element_iterator > element_ptr_range()=0
virtual element_iterator semilocal_elements_begin()=0
const std::map< subdomain_id_type, std::string > & get_subdomain_name_map() const
Definition: mesh_base.h:1337
virtual node_iterator local_nodes_end()=0
virtual void all_second_order(const bool full_ordered=true)=0
static const processor_id_type invalid_processor_id
Definition: dof_object.h:358
virtual element_iterator active_local_elements_begin()=0
dof_id_type n_sub_elem() const
Definition: mesh_base.C:354
virtual element_iterator active_pid_elements_begin(processor_id_type proc_id)=0
virtual Elem * add_elem(Elem *e)=0
virtual element_iterator type_elements_end(ElemType type)=0
virtual void update_parallel_id_counts()=0
virtual element_iterator flagged_elements_begin(unsigned char rflag)=0
virtual element_iterator elements_end()=0
std::unique_ptr< Partitioner > _partitioner
Definition: mesh_base.h:1412
virtual const Node * query_node_ptr(const dof_id_type i) const =0
virtual element_iterator not_active_elements_begin()=0
virtual SimpleRange< node_iterator > node_ptr_range()=0
virtual dof_id_type max_elem_id() const =0
void clear_point_locator()
Definition: mesh_base.C:517
virtual Node * insert_node(Node *n)=0
Used by the Mesh to keep track of boundary nodes and elements.
Definition: boundary_info.h:57
virtual element_iterator local_elements_end()=0
virtual element_iterator active_unpartitioned_elements_end()=0
static const dof_id_type invalid_id
Definition: dof_object.h:347
virtual void delete_node(Node *n)=0
std::set< unsigned char > _elem_dims
Definition: mesh_base.h:1453
void prepare_for_use(const bool skip_renumber_nodes_and_elements=false, const bool skip_find_neighbors=false)
Definition: mesh_base.C:152
std::string & subdomain_name(subdomain_id_type id)
Definition: mesh_base.C:538
const std::set< unsigned char > & elem_dimensions() const
Definition: mesh_base.h:220
virtual void write(const std::string &name)=0
void set_mesh_dimension(unsigned char d)
Definition: mesh_base.h:213
dof_id_type n_nodes_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:319
virtual dof_id_type parallel_n_nodes() const =0
std::map< subdomain_id_type, std::string > & set_subdomain_name_map()
Definition: mesh_base.h:1335
bool allow_remote_element_removal() const
Definition: mesh_base.h:792
virtual element_iterator not_level_elements_end(unsigned int level)=0
An object whose state is distributed along a set of processors.
virtual dof_id_type parallel_n_elem() const =0
virtual void clear()
Definition: mesh_base.C:260
virtual node_iterator bnd_nodes_end()=0
friend std::ostream & operator<<(std::ostream &os, const MeshBase &m)
Definition: mesh_base.C:419
virtual element_iterator active_elements_begin()=0
virtual element_iterator flagged_pid_elements_begin(unsigned char rflag, processor_id_type pid)=0
bool skip_partitioning() const
Definition: mesh_base.h:812
virtual const Node & node(const dof_id_type i) const
Definition: mesh_base.h:454
unsigned int n_partitions() const
Definition: mesh_base.h:875
virtual Node * add_node(Node *n)=0
virtual element_iterator pid_elements_begin(processor_id_type proc_id)=0
virtual element_iterator active_elements_end()=0
virtual const Elem * elem_ptr(const dof_id_type i) const =0
const_node_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition: mesh_base.h:1591
virtual Elem * insert_elem(Elem *e)=0
virtual node_iterator local_nodes_begin()=0
virtual element_iterator active_not_local_elements_end()=0
unsigned int recalculate_n_partitions()
Definition: mesh_base.C:458
std::set< GhostingFunctor * >::const_iterator ghosting_functors_begin() const
Definition: mesh_base.h:835
subdomain_id_type n_subdomains() const
Definition: mesh_base.C:304
virtual node_iterator nodes_end()=0
virtual element_iterator active_pid_elements_end(processor_id_type proc_id)=0
virtual bool contract()=0
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0
virtual element_iterator active_unpartitioned_elements_begin()=0
virtual void renumber_elem(dof_id_type old_id, dof_id_type new_id)=0
virtual element_iterator type_elements_begin(ElemType type)=0
unsigned int spatial_dimension() const
Definition: mesh_base.C:135
element_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition: mesh_base.h:1514
virtual node_iterator bnd_nodes_begin()=0
virtual element_iterator evaluable_elements_end(const DofMap &dof_map, unsigned int var_num=libMesh::invalid_uint)=0
virtual element_iterator semilocal_elements_end()=0
virtual bool is_replicated() const
Definition: mesh_base.h:176
virtual const Elem & elem_ref(const dof_id_type i) const
Definition: mesh_base.h:504
void set_count_lower_dim_elems_in_point_locator(bool count_lower_dim_elems)
Definition: mesh_base.C:524
MeshBase(const Parallel::Communicator &comm_in, unsigned char dim=1)
Definition: mesh_base.C:51
dof_id_type n_active_sub_elem() const
Definition: mesh_base.C:366
virtual ~MeshBase()
Definition: mesh_base.C:117
unsigned int mesh_dimension() const
Definition: mesh_base.C:126
std::unique_ptr< GhostingFunctor > _default_ghosting
Definition: mesh_base.h:1466
virtual element_iterator unpartitioned_elements_end()=0
unique_id_type next_unique_id()
Definition: mesh_base.h:305
virtual element_iterator active_not_local_elements_begin()=0
virtual void libmesh_assert_valid_parallel_ids() const
Definition: mesh_base.h:1007
virtual const Node & node_ref(const dof_id_type i) const
Definition: mesh_base.h:434
virtual const Point & point(const dof_id_type i) const =0
virtual Node & node(const dof_id_type i)
Definition: mesh_base.h:468
const_node_iterator(const MeshBase::node_iterator &rhs)
Definition: mesh_base.h:1602
bool allow_renumbering() const
Definition: mesh_base.h:783
void set_next_unique_id(unique_id_type id)
Definition: mesh_base.h:310
virtual element_iterator not_local_elements_begin()=0
void cache_elem_dims()
Definition: mesh_base.C:574
virtual void delete_remote_elements()
Definition: mesh_base.h:196
void print_info(std::ostream &os=libMesh::out) const
Definition: mesh_base.C:412
const_element_iterator(const MeshBase::element_iterator &rhs)
Definition: mesh_base.h:1548
virtual void update_post_partitioning()
Definition: mesh_base.h:763
virtual dof_id_type max_node_id() const =0
virtual dof_id_type n_elem() const =0
virtual const Node * node_ptr(const dof_id_type i) const =0
virtual element_iterator active_type_elements_end(ElemType type)=0
processor_id_type processor_id() const
std::unique_ptr< PointLocatorBase > _point_locator
Definition: mesh_base.h:1398
virtual element_iterator local_not_level_elements_end(unsigned int level)=0
OStreamProxy out(std::cout)
virtual node_iterator pid_nodes_begin(processor_id_type proc_id)=0
virtual element_iterator active_local_elements_end()=0
bool _count_lower_dim_elems_in_point_locator
Definition: mesh_base.h:1404
GhostingFunctor & default_ghosting()
Definition: mesh_base.h:847
A geometric point in (x,y,z) space.
Definition: point.h:38
virtual void reserve_elem(const dof_id_type ne)=0
uint8_t unique_id_type
Definition: id_types.h:79
virtual element_iterator ghost_elements_begin()=0
std::map< subdomain_id_type, std::string > _block_id_to_name
Definition: mesh_base.h:1446
unsigned int & set_n_partitions()
Definition: mesh_base.h:1371
virtual element_iterator subactive_elements_begin()=0
virtual void renumber_nodes_and_elements()=0
virtual dof_id_type n_nodes() const =0
virtual element_iterator active_type_elements_begin(ElemType type)=0
subdomain_id_type get_id_by_name(const std::string &name) const
Definition: mesh_base.C:558
std::set< GhostingFunctor * >::const_iterator ghosting_functors_end() const
Definition: mesh_base.h:841
void add_ghosting_functor(GhostingFunctor &ghosting_functor)
Definition: mesh_base.h:823
uint8_t dof_id_type
Definition: id_types.h:64
MeshBase & operator=(const MeshBase &)=delete
virtual element_iterator local_not_level_elements_begin(unsigned int level)=0
virtual element_iterator pid_elements_end(processor_id_type proc_id)=0