LCOV - code coverage report
Current view: top level - include/mesh - mesh_base.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4485 (d48e80) with base 862243 Lines: 126 134 94.0 %
Date: 2026-06-17 01:59:26 Functions: 117 225 52.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // The libMesh Finite Element Library.
       2             : // Copyright (C) 2002-2026 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/dof_object.h" // for invalid_processor_id
      25             : #include "libmesh/enum_order.h"
      26             : #include "libmesh/int_range.h"
      27             : #include "libmesh/libmesh_common.h"
      28             : #include "libmesh/multi_predicates.h"
      29             : #include "libmesh/point_locator_base.h"
      30             : #include "libmesh/variant_filter_iterator.h"
      31             : #include "libmesh/parallel_object.h"
      32             : #include "libmesh/simple_range.h"
      33             : 
      34             : // C++ Includes
      35             : #include <cstddef>
      36             : #include <string>
      37             : #include <memory>
      38             : 
      39             : #include "libmesh/vector_value.h"
      40             : 
      41             : namespace libMesh
      42             : {
      43             : // Forward declarations
      44             : class BoundaryInfo;
      45             : class Elem;
      46             : class GhostingFunctor;
      47             : class Node;
      48             : class Point;
      49             : class Partitioner;
      50             : class PeriodicBoundary;
      51             : class PeriodicBoundaries;
      52             : 
      53             : template <typename T>
      54             : class SparseMatrix;
      55             : 
      56             : enum ElemType : int;
      57             : enum ElemMappingType : unsigned char;
      58             : 
      59             : template <class MT>
      60             : class MeshInput;
      61             : 
      62             : template <typename iterator_type, typename object_type>
      63             : class StoredRange;
      64             : 
      65             : /**
      66             :  * This is the \p MeshBase class. This class provides all the data necessary
      67             :  * to describe a geometric entity.  It allows for the description of a
      68             :  * \p dim dimensional object that lives in \p LIBMESH_DIM-dimensional space.
      69             :  * \par
      70             :  * A mesh is made of nodes and elements, and this class provides data
      71             :  * structures to store and access both.  A mesh may be partitioned into a
      72             :  * number of subdomains, and this class provides that functionality.
      73             :  * Furthermore, this class provides functions for reading and writing a
      74             :  * mesh to disk in various formats.
      75             :  *
      76             :  * \author Benjamin S. Kirk
      77             :  * \date 2002
      78             :  * \brief Base class for Mesh.
      79             :  */
      80             : class MeshBase : public ParallelObject
      81             : {
      82             : public:
      83             : 
      84             :   /**
      85             :    * Constructor.  Takes \p dim, the dimension of the mesh.
      86             :    * The mesh dimension can be changed (and may automatically be
      87             :    * changed by mesh generation/loading) later.
      88             :    */
      89             :   MeshBase (const Parallel::Communicator & comm_in,
      90             :             unsigned char dim=1);
      91             : 
      92             :   /**
      93             :    * Copy-constructor.
      94             :    */
      95             :   MeshBase (const MeshBase & other_mesh);
      96             : 
      97             :   /**
      98             :    * Move-constructor - deleted because after a theoretical move-construction
      99             :    * and then destruction of the moved-from object, the moved \p BoundaryInfo
     100             :    * would hold an invalid reference to the moved-from mesh
     101             :    */
     102             :   MeshBase(MeshBase &&) = delete;
     103             : 
     104             :   /**
     105             :    * Copy and move assignment are not allowed because MeshBase
     106             :    * subclasses manually manage memory (Elems and Nodes) and therefore
     107             :    * the default versions of these operators would leak memory.  Since
     108             :    * we don't want to maintain non-default copy and move assignment
     109             :    * operators at this time, the safest and most self-documenting
     110             :    * approach is to delete them.
     111             :    *
     112             :    * If you need to copy a Mesh, use the clone() method.
     113             :    */
     114             :   MeshBase & operator= (const MeshBase &) = delete;
     115             :   MeshBase & operator= (MeshBase && other_mesh);
     116             : 
     117             :   /**
     118             :    * Shim to allow operator = (&&) to behave like a virtual function
     119             :    * without having to be one.
     120             :    */
     121             :   virtual MeshBase & assign(MeshBase && other_mesh) = 0;
     122             : 
     123             :   /**
     124             :    * This tests for exactly-equal data in all the senses that a
     125             :    * mathematician would care about (element connectivity, nodal
     126             :    * coordinates), but in the senses a programmer would care about it
     127             :    * allows for non-equal equivalence in some ways (we accept
     128             :    * different Elem/Node addresses in memory) but not others (we do
     129             :    * not accept different subclass types, nor even different Elem/Node
     130             :    * ids).
     131             :    *
     132             :    * Though this method is non-virtual, its implementation calls the
     133             :    * virtual function \p subclass_locally_equals() to test for
     134             :    * equality of subclass-specific data as well.
     135             :    */
     136             :   bool operator== (const MeshBase & other_mesh) const;
     137             : 
     138             :   bool operator!= (const MeshBase & other_mesh) const
     139             :   {
     140             :     return !(*this == other_mesh);
     141             :   }
     142             : 
     143             :   /**
     144             :    * This behaves the same as operator==, but only for the local and
     145             :    * ghosted aspects of the mesh; i.e. operator== is true iff local
     146             :    * equality is true on every rank.
     147             :    */
     148             :   bool locally_equals (const MeshBase & other_mesh) const;
     149             : 
     150             :   /**
     151             :    * Virtual "copy constructor".  The copy will be of the same
     152             :    * subclass as \p this, and will satisfy "copy == this" when it is
     153             :    * created.
     154             :    */
     155             :   virtual std::unique_ptr<MeshBase> clone() const = 0;
     156             : 
     157             :   /**
     158             :    * Destructor.
     159             :    */
     160             :   virtual ~MeshBase ();
     161             : 
     162             :   /**
     163             :    * A partitioner to use at each partitioning
     164             :    */
     165      449600 :   virtual std::unique_ptr<Partitioner> & partitioner() { return _partitioner; }
     166             : 
     167             :   /**
     168             :    * The information about boundary ids on the mesh
     169             :    */
     170      775877 :   const BoundaryInfo & get_boundary_info() const { return *boundary_info; }
     171             : 
     172             :   /**
     173             :    * Writable information about boundary ids on the mesh
     174             :    */
     175     1383321 :   BoundaryInfo & get_boundary_info() { return *boundary_info; }
     176             : 
     177             :   /**
     178             :    * Deletes all the element and node data that is currently stored.
     179             :    *
     180             :    * elem and node extra_integer data is nevertheless *retained* here,
     181             :    * for better compatibility between that feature and older code's
     182             :    * use of MeshBase::clear()
     183             :    */
     184             :   virtual void clear ();
     185             : 
     186             :   /**
     187             :    * Deletes all the element data that is currently stored.
     188             :    *
     189             :    * No Node is removed from the mesh, however even NodeElem elements
     190             :    * are deleted, so the remaining Nodes will be considered "unused"
     191             :    * and cleared unless they are reconnected to new elements before
     192             :    * the next preparation step.
     193             :    *
     194             :    * This does not affect BoundaryInfo data; any boundary information
     195             :    * associated elements should already be cleared.
     196             :    */
     197             :   virtual void clear_elems () = 0;
     198             : 
     199             :   /**
     200             :    * \returns \p true if the mesh is marked as having undergone all of
     201             :    * the preparation done in a call to \p prepare_for_use, \p false
     202             :    * otherwise.
     203             :    */
     204             :   bool is_prepared () const;
     205             : 
     206             :   /**
     207             :    * \returns the \p Preparation structure with details about in what
     208             :    * ways \p this mesh is currently prepared or unprepared.  This
     209             :    * structure may change in the future when cache designs change.
     210             :    */
     211             :   struct Preparation;
     212             : 
     213         804 :   Preparation preparation () const
     214       24405 :   { return _preparation; }
     215             : 
     216             : #ifdef LIBMESH_ENABLE_DEPRECATED
     217             :   /**
     218             :    * Tells this we have done some operation where we should no longer
     219             :    * consider ourself prepared.  This is a very coarse setting; it is
     220             :    * generally more efficient to mark finer-grained settings instead.
     221             :    *
     222             :    * This method name is now deprecated, in part to match the less
     223             :    * awkward unset_has_ names of the more fine-grained methods, in
     224             :    * part as a way to prompt older user codes to use the more
     225             :    * fine-grained methods where they can, to speed up the
     226             :    * complete_preparation() calls afterward.
     227             :    */
     228             :   void set_isnt_prepared()
     229             :   { libmesh_deprecated(); _preparation = false; }
     230             : #endif // LIBMESH_ENABLE_DEPRECATED
     231             : 
     232             :   /**
     233             :    * Tells this we have done some operation where we should no longer
     234             :    * consider ourself prepared.  This is a very coarse setting; it is
     235             :    * generally more efficient to mark finer-grained settings instead.
     236             :    */
     237             :   void unset_is_prepared();
     238             : 
     239             :   /**
     240             :    * Tells this we have done some operation creating unpartitioned
     241             :    * elements.
     242             :    *
     243             :    * User code which adds elements to this mesh must either partition
     244             :    * them too or call this method.
     245             :    */
     246             :   void unset_is_partitioned()
     247             :   { _preparation.is_partitioned = false; }
     248             : 
     249             :   /**
     250             :    * Tells this we have done some operation (e.g. adding objects to a
     251             :    * distributed mesh on one processor only) which can lose
     252             :    * synchronization of id counts.
     253             :    *
     254             :    * User code which does distributed additions of nodes or elements
     255             :    * must call either this method or \p update_parallel_id_counts().
     256             :    */
     257             :   void unset_has_synched_id_counts()
     258             :   { _preparation.has_synched_id_counts = false; }
     259             : 
     260             :   /**
     261             :    * Tells this we have done some operation (e.g. adding elements
     262             :    * without setting their neighbor pointers, or adding disjoint
     263             :    * neighbor boundary pairs) which requires neighbor pointers to be
     264             :    * determined later.
     265             :    *
     266             :    * User code which adds new elements to this mesh must call this
     267             :    * function or manually set neighbor pointer from and to those
     268             :    * elements.
     269             :    */
     270             :   void unset_has_neighbor_ptrs()
     271             :   { _preparation.has_neighbor_ptrs = false; }
     272             : 
     273             :   /**
     274             :    * Tells this we have done some operation (e.g. adding elements with
     275             :    * a new dimension or subdomain value) which may invalidate cached
     276             :    * summaries of element data.
     277             :    *
     278             :    * User code which adds new elements to this mesh must call this
     279             :    * function.
     280             :    */
     281           0 :   void unset_has_cached_elem_data()
     282           0 :   { _preparation.has_cached_elem_data = false; }
     283             : 
     284             :   /**
     285             :    * Tells this we have done some operation (e.g. refining elements
     286             :    * with interior parents) which requires interior parent pointers to
     287             :    * be found later.
     288             :    *
     289             :    * Most user code will not need to call this method; any user code
     290             :    * that manipulates interior parents or their boundary elements may
     291             :    * be an exception.
     292             :    */
     293             :   void unset_has_interior_parent_ptrs()
     294             :   { _preparation.has_interior_parent_ptrs = false; }
     295             : 
     296             :   /**
     297             :    * Tells this we have done some operation (e.g. repartitioning)
     298             :    * which may have left elements as ghosted which on a distributed
     299             :    * mesh should be remote.
     300             :    *
     301             :    * User code should probably never need to use this; we can set it
     302             :    * in Partitioner.  Any user code which manually repartitions
     303             :    * elements on distributed meshes may need to call this manually, in
     304             :    * addition to manually communicating elements with newly-created
     305             :    * ghosting requirements.
     306             :    */
     307             :   void unset_has_removed_remote_elements()
     308             :   { _preparation.has_removed_remote_elements = false; }
     309             : 
     310             :   /**
     311             :    * Tells this we have done some operation (e.g. coarsening)
     312             :    * which may have left orphaned nodes in need of removal.
     313             :    *
     314             :    * Most user code should probably never need to use this; we can set
     315             :    * it in MeshRefinement.  User code which deletes elements without
     316             :    * carefully deleting orphaned nodes should call this manually.
     317             :    */
     318             :   void unset_has_removed_orphaned_nodes()
     319             :   { _preparation.has_removed_orphaned_nodes = false; }
     320             : 
     321             :   /**
     322             :    * Tells this we have done some operation (e.g. adding or removing
     323             :    * elements) which may require a reinit() of custom ghosting
     324             :    * functors.
     325             :    *
     326             :    * User code which adds or removes elements should call this method.
     327             :    * User code which moves nodes ... should probably call this method,
     328             :    * in case ghosting functors depending on position exist?
     329             :    */
     330             :   void unset_has_reinit_ghosting_functors()
     331             :   { _preparation.has_reinit_ghosting_functors = false; }
     332             : 
     333             :   /**
     334             :    * Tells this we have done some operation which may have invalidated
     335             :    * our cached boundary id sets.
     336             :    *
     337             :    * User code which removes elements, or which adds or removes
     338             :    * boundary entries, should call this method.
     339             :    */
     340             :   void unset_has_boundary_id_sets()
     341             :   { _preparation.has_boundary_id_sets = false; }
     342             : 
     343             :   /**
     344             :    * Tells this we have done some operation which may have left the
     345             :    * subdomain id to name map inconsistent across processors.
     346             :    *
     347             :    * User code which adds or changes subdomain names should call this
     348             :    * method.
     349             :    */
     350       46744 :   void unset_has_synched_subdomain_name_map()
     351     1110779 :   { _preparation.has_synched_subdomain_name_map = false; }
     352             : 
     353             :   /**
     354             :    * \returns \p true if all elements and nodes of the mesh
     355             :    * exist on the current processor, \p false otherwise
     356             :    */
     357      795501 :   virtual bool is_serial () const
     358      795501 :   { return true; }
     359             : 
     360             :   /**
     361             :    * \returns \p true if all elements and nodes of the mesh
     362             :    * exist on the processor 0, \p false otherwise
     363             :    */
     364         749 :   virtual bool is_serial_on_zero () const
     365         749 :   { return true; }
     366             : 
     367             :   /**
     368             :    * Asserts that not all elements and nodes of the mesh necessarily
     369             :    * exist on the current processor.  Only valid to call on classes
     370             :    * which can be created in a distributed form.
     371             :    */
     372           0 :   virtual void set_distributed ()
     373           0 :   { libmesh_error(); }
     374             : 
     375             :   /**
     376             :    * \returns \p true if new elements and nodes can and should be
     377             :    * created in synchronization on all processors, \p false otherwise
     378             :    */
     379     2468078 :   virtual bool is_replicated () const
     380     2468078 :   { return true; }
     381             : 
     382             :   /**
     383             :    * Gathers all elements and nodes of the mesh onto
     384             :    * every processor
     385             :    */
     386           2 :   virtual void allgather () {}
     387             : 
     388             :   /**
     389             :    * Gathers all elements and nodes of the mesh onto
     390             :    * processor zero
     391             :    */
     392           0 :   virtual void gather_to_zero() {}
     393             : 
     394             :   /**
     395             :    * When supported, deletes all nonlocal elements of the mesh
     396             :    * except for "ghosts" which touch a local element, and deletes
     397             :    * all nodes which are not part of a local or ghost element
     398             :    */
     399       66211 :   virtual void delete_remote_elements () {
     400       66211 :     _preparation.has_removed_remote_elements = true;
     401       66211 :   }
     402             : 
     403             :   /**
     404             :    * Loops over ghosting functors and calls mesh_reinit()
     405             :    */
     406             :   void reinit_ghosting_functors();
     407             : 
     408             :   /**
     409             :    * \returns The logical dimension of the mesh; i.e. the manifold
     410             :    * dimension of the elements in the mesh.  When we have
     411             :    * multi-dimensional meshes (e.g. hexes and quads in the same mesh)
     412             :    * then this will return the largest such dimension.
     413             :    */
     414             :   unsigned int mesh_dimension () const;
     415             : 
     416             :   /**
     417             :    * Resets the logical dimension of the mesh. If the mesh has
     418             :    * elements of multiple dimensions, this should be set to the largest
     419             :    * dimension. E.g. if the mesh has 1D and 2D elements, this should
     420             :    * be set to 2. If the mesh has 2D and 3D elements, this should be
     421             :    * set to 3.
     422             :    */
     423       10034 :   void set_mesh_dimension (unsigned char d)
     424      294691 :   { _elem_dims.clear(); _elem_dims.insert(d); }
     425             : 
     426             :   /**
     427             :    * \returns A const reference to a std::set of element dimensions
     428             :    * present in the mesh.
     429             :    */
     430       87725 :   const std::set<unsigned char> & elem_dimensions() const
     431       87725 :   { return _elem_dims; }
     432             : 
     433             :   /**
     434             :    * \returns A const reference to a std::set of element default
     435             :    * orders present in the mesh.
     436             :    */
     437           0 :   const std::set<Order> & elem_default_orders() const
     438           0 :   { return _elem_default_orders; }
     439             : 
     440             :   /**
     441             :    * \returns The smallest supported_nodal_order() of any element
     442             :    * present in the mesh, which is thus the maximum supported nodal
     443             :    * order on the mesh as a whole.
     444             :    */
     445         432 :   Order supported_nodal_order() const
     446       14989 :   { return _supported_nodal_order; }
     447             : 
     448             :   /**
     449             :    * Most of the time you should not need to call this, as the element
     450             :    * dimensions will be set automatically by a call to cache_elem_data(),
     451             :    * therefore only call this if you know what you're doing.
     452             :    *
     453             :    * In some specialized situations, for example when adding a single
     454             :    * Elem on all procs, it can be faster to skip calling cache_elem_data()
     455             :    * and simply specify the element dimensions manually, which is why this
     456             :    * setter exists.
     457             :    */
     458             :   void set_elem_dimensions(std::set<unsigned char> elem_dims);
     459             : 
     460             :   /**
     461             :    * Typedef for the "set" container used to store elemset ids. The
     462             :    * main requirements are that the entries be sorted and unique, so
     463             :    * std::set works for this, but there may be more efficient
     464             :    * alternatives.
     465             :    */
     466             :   typedef std::set<elemset_id_type> elemset_type;
     467             : 
     468             :   /**
     469             :    * Tabulate a user-defined "code" for elements which belong to the element sets
     470             :    * specified in \p id_set. For example, suppose that we have two elemsets A and
     471             :    * B with the following Elem ids:
     472             :    * Elemset A = {1, 3}
     473             :    * Elemset B = {2, 3}
     474             :    *
     475             :    * This implies the following mapping from elem id to elemset id:
     476             :    * Elem 1 -> {A}
     477             :    * Elem 2 -> {B}
     478             :    * Elem 3 -> {A,B}
     479             :    *
     480             :    * In this case, we would need to tabulate three different elemset codes, e.g.:
     481             :    * 0 -> {A}
     482             :    * 1 -> {B}
     483             :    * 2 -> {A,B}
     484             :    *
     485             :    * Also sets up the inverse mapping, so that if one knows all the
     486             :    * element sets an Elem belongs to, one can look up the
     487             :    * corresponding elemset code.
     488             :    */
     489             :   void add_elemset_code(dof_id_type code, MeshBase::elemset_type id_set);
     490             : 
     491             :   /**
     492             :    * Returns the number of unique elemset ids which have been added
     493             :    * via add_elemset_code(), which is the size of the _all_elemset_ids
     494             :    * set.
     495             :    */
     496             :   unsigned int n_elemsets() const;
     497             : 
     498             :   /**
     499             :    * Look up the element sets for a given elemset code and
     500             :    * vice-versa. The elemset must have been previously stored by
     501             :    * calling add_elemset_code(). If no such code/set is found, returns
     502             :    * the empty set or DofObject::invalid_id, respectively.
     503             :    */
     504             :   void get_elemsets(dof_id_type elemset_code, MeshBase::elemset_type & id_set_to_fill) const;
     505             :   dof_id_type get_elemset_code(const MeshBase::elemset_type & id_set) const;
     506             : 
     507             :   /**
     508             :    * Return a vector of all elemset codes defined on the mesh. We get
     509             :    * this by looping over the _elemset_codes map.
     510             :    */
     511             :   std::vector<dof_id_type> get_elemset_codes() const;
     512             : 
     513             :   /**
     514             :    * Replace elemset code "old_code" with "new_code". This function loops over
     515             :    * all elements and changes the extra integer corresponding to the "elemset_code"
     516             :    * label, and updates the _elemset_codes and _elemset_codes_inverse_map members.
     517             :    * Does not change the elemset ids of any of the sets.
     518             :    */
     519             :   void change_elemset_code(dof_id_type old_code, dof_id_type new_code);
     520             : 
     521             :   /**
     522             :    * Replace elemset id "old_id" with "new_id". Does not change any of the
     523             :    * elemset codes, so does not need to loop over the elements themselves.
     524             :    */
     525             :   void change_elemset_id(elemset_id_type old_id, elemset_id_type new_id);
     526             : 
     527             :   /**
     528             :    * \returns The "spatial dimension" of the mesh.
     529             :    *
     530             :    * The spatial dimension is defined as:
     531             :    *
     532             :    *   1 - for an exactly x-aligned mesh of 1D elements
     533             :    *   2 - for an exactly x-y planar mesh of 2D elements
     534             :    *   3 - otherwise
     535             :    *
     536             :    * No tolerance checks are performed to determine whether the Mesh
     537             :    * is x-aligned or x-y planar, only strict equality with zero in the
     538             :    * higher dimensions is checked.  Also, x-z and y-z planar meshes are
     539             :    * considered to have spatial dimension == 3.
     540             :    *
     541             :    * The spatial dimension is updated during mesh preparation based
     542             :    * on the dimensions of the various elements present in the Mesh,
     543             :    * but is *never automatically decreased*.
     544             :    *
     545             :    * For example, if the user calls set_spatial_dimension(2) and then
     546             :    * later inserts 3D elements into the mesh,
     547             :    * Mesh::spatial_dimension() will return 3 after the next call to
     548             :    * prepare_for_use() or complete_preparation().  On the other hand,
     549             :    * if the user calls set_spatial_dimension(3) and then inserts only
     550             :    * x-aligned 1D elements into the Mesh, mesh.spatial_dimension()
     551             :    * will remain 3.
     552             :    */
     553             :   unsigned int spatial_dimension () const;
     554             : 
     555             :   /**
     556             :    * Sets the "spatial dimension" of the Mesh.  See the documentation
     557             :    * for Mesh::spatial_dimension() for more information.
     558             :    */
     559             :   void set_spatial_dimension(unsigned char d);
     560             : 
     561             :   /**
     562             :    * \returns The number of nodes in the mesh.
     563             :    *
     564             :    * This function and others must be defined in derived classes since
     565             :    * the MeshBase class has no specific storage for nodes or elements.
     566             :    * The standard \p n_nodes() function may return a cached value on
     567             :    * distributed meshes, and so can be called by any processor at any
     568             :    * time.
     569             :    */
     570             :   virtual dof_id_type n_nodes () const = 0;
     571             : 
     572             :   /**
     573             :    * \returns The number of nodes in the mesh.
     574             :    *
     575             :    * This function and others must be overridden in derived classes since
     576             :    * the MeshBase class has no specific storage for nodes or elements.
     577             :    * The \p parallel_n_nodes() function computes a parallel-synchronized
     578             :    * value on distributed meshes, and so must be called in parallel
     579             :    * only.
     580             :    */
     581             :   virtual dof_id_type parallel_n_nodes () const = 0;
     582             : 
     583             :   /**
     584             :    * \returns The number of nodes on processor \p proc.
     585             :    */
     586             :   dof_id_type n_nodes_on_proc (const processor_id_type proc) const;
     587             : 
     588             :   /**
     589             :    * \returns The number of nodes on the local processor.
     590             :    */
     591         496 :   dof_id_type n_local_nodes () const
     592     1732849 :   { return this->n_nodes_on_proc (this->processor_id()); }
     593             : 
     594             :   /**
     595             :    * \returns The number of nodes owned by no processor.
     596             :    */
     597        2752 :   dof_id_type n_unpartitioned_nodes () const
     598     1724028 :   { return this->n_nodes_on_proc (DofObject::invalid_processor_id); }
     599             : 
     600             :   /**
     601             :    * \returns A number one greater than the maximum node id in the
     602             :    * mesh. A more apt name for this method would be end_node_id
     603             :    */
     604             :   virtual dof_id_type max_node_id () const = 0;
     605             : 
     606             : #ifdef LIBMESH_ENABLE_UNIQUE_ID
     607             :   /**
     608             :    * \returns The next unique id to be used.
     609             :    */
     610        7176 :   unique_id_type next_unique_id() const { return _next_unique_id; }
     611             : 
     612             :   /**
     613             :    * Sets the next available unique id to be used.  On a
     614             :    * ReplicatedMesh, or when adding unpartitioned objects to a
     615             :    * DistributedMesh, this must be kept in sync on all processors.
     616             :    *
     617             :    * On a DistributedMesh, other unique_id values (larger than this
     618             :    * one) may be chosen next, to allow unique_id assignment without
     619             :    * communication.
     620             :    */
     621             :   virtual void set_next_unique_id(unique_id_type id) = 0;
     622             : #endif
     623             : 
     624             :   /**
     625             :    * Reserves space for a known number of nodes.
     626             :    *
     627             :    * \note This method may or may not do anything, depending on the
     628             :    * actual \p Mesh implementation.  If you know the number of nodes
     629             :    * you will add and call this method before repeatedly calling \p
     630             :    * add_point() the implementation will be more efficient.
     631             :    */
     632             :   virtual void reserve_nodes (const dof_id_type nn) = 0;
     633             : 
     634             :   /**
     635             :    * \returns The number of elements in the mesh.
     636             :    *
     637             :    * The standard n_elem() function may return a cached value on
     638             :    * distributed meshes, and so can be called by any processor at any
     639             :    * time.
     640             :    */
     641             :   virtual dof_id_type n_elem () const = 0;
     642             : 
     643             :   /**
     644             :    * \returns The number of elements in the mesh.
     645             :    *
     646             :    * The parallel_n_elem() function computes a parallel-synchronized
     647             :    * value on distributed meshes, and so must be called in parallel
     648             :    * only.
     649             :    */
     650             :   virtual dof_id_type parallel_n_elem () const = 0;
     651             : 
     652             :   /**
     653             :    * \returns A number one greater than the maximum element id in the
     654             :    * mesh. A more apt name for this method would be end_elem_id
     655             :    */
     656             :   virtual dof_id_type max_elem_id () const = 0;
     657             : 
     658             :   /**
     659             :    * \returns A number greater than or equal to the maximum unique_id in the
     660             :    * mesh.
     661             :    */
     662             : #ifdef LIBMESH_ENABLE_UNIQUE_ID
     663             :   virtual unique_id_type parallel_max_unique_id () const = 0;
     664             : #endif
     665             : 
     666             :   /**
     667             :    * Reserves space for a known number of elements.
     668             :    *
     669             :    * \note This method may or may not do anything, depending on the
     670             :    * actual \p Mesh implementation.  If you know the number of
     671             :    * elements you will add and call this method before repeatedly
     672             :    * calling \p add_point() the implementation will be more efficient.
     673             :    */
     674             :   virtual void reserve_elem (const dof_id_type ne) = 0;
     675             : 
     676             :   /**
     677             :    * Updates parallel caches so that methods like n_elem()
     678             :    * accurately reflect changes on other processors
     679             :    */
     680             :   virtual void update_parallel_id_counts () = 0;
     681             : 
     682             :   /**
     683             :    * \returns The number of active elements in the mesh.
     684             :    *
     685             :    * Implemented in terms of active_element_iterators.
     686             :    */
     687             :   virtual dof_id_type n_active_elem () const = 0;
     688             : 
     689             :   /**
     690             :    * \returns The number of elements on processor \p proc.
     691             :    */
     692             :   dof_id_type n_elem_on_proc (const processor_id_type proc) const;
     693             : 
     694             :   /**
     695             :    * \returns The number of elements on the local processor.
     696             :    */
     697         480 :   dof_id_type n_local_elem () const
     698     1731830 :   { return this->n_elem_on_proc (this->processor_id()); }
     699             : 
     700             :   /**
     701             :    * \returns The number of elements owned by no processor.
     702             :    */
     703       15684 :   dof_id_type n_unpartitioned_elem () const
     704     2156311 :   { return this->n_elem_on_proc (DofObject::invalid_processor_id); }
     705             : 
     706             :   /**
     707             :    * \returns The number of active elements on processor \p proc.
     708             :    */
     709             :   dof_id_type n_active_elem_on_proc (const processor_id_type proc) const;
     710             : 
     711             :   /**
     712             :    * \returns The number of active elements on the local processor.
     713             :    */
     714         216 :   dof_id_type n_active_local_elem () const
     715     1295721 :   { return this->n_active_elem_on_proc (this->processor_id()); }
     716             : 
     717             :   /**
     718             :    * \returns The number of elements that will be written
     719             :    * out in certain I/O formats.
     720             :    *
     721             :    * For example, a 9-noded quadrilateral will be broken into 4 linear
     722             :    * sub-elements for plotting purposes.  Thus, for a mesh of 2 \p
     723             :    * QUAD9 elements \p n_tecplot_elem() will return 8.  Implemented in
     724             :    * terms of element_iterators.
     725             :    */
     726             :   dof_id_type n_sub_elem () const;
     727             : 
     728             :   /**
     729             :    * Same as \p n_sub_elem(), but only counts active elements.
     730             :    */
     731             :   dof_id_type n_active_sub_elem () const;
     732             : 
     733             :   /**
     734             :    * \returns A constant reference (for reading only) to the
     735             :    * \f$ i^{th} \f$ point, which should be present in this processor's
     736             :    * subset of the mesh data structure.
     737             :    */
     738             :   virtual const Point & point (const dof_id_type i) const = 0;
     739             : 
     740             :   /**
     741             :    * \returns A constant reference (for reading only) to the
     742             :    * \f$ i^{th} \f$ node, which should be present in this processor's
     743             :    * subset of the mesh data structure.
     744             :    */
     745    59533707 :   virtual const Node & node_ref (const dof_id_type i) const
     746             :   {
     747    59533707 :     return *this->node_ptr(i);
     748             :   }
     749             : 
     750             :   /**
     751             :    * \returns A reference to the \f$ i^{th} \f$ node, which should be
     752             :    * present in this processor's subset of the mesh data structure.
     753             :    */
     754   504083444 :   virtual Node & node_ref (const dof_id_type i)
     755             :   {
     756   504083444 :     return *this->node_ptr(i);
     757             :   }
     758             : 
     759             :   /**
     760             :    * \returns A pointer to the \f$ i^{th} \f$ node, which should be
     761             :    * present in this processor's subset of the mesh data structure.
     762             :    */
     763             :   virtual const Node * node_ptr (const dof_id_type i) const = 0;
     764             : 
     765             :   /**
     766             :    * \returns A writable pointer to the \f$ i^{th} \f$ node, which
     767             :    * should be present in this processor's subset of the mesh data
     768             :    * structure.
     769             :    */
     770             :   virtual Node * node_ptr (const dof_id_type i) = 0;
     771             : 
     772             :   /**
     773             :    * \returns A pointer to the \f$ i^{th} \f$ node, or \p nullptr if no such
     774             :    * node exists in this processor's mesh data structure.
     775             :    */
     776             :   virtual const Node * query_node_ptr (const dof_id_type i) const = 0;
     777             : 
     778             :   /**
     779             :    * \returns A writable pointer to the \f$ i^{th} \f$ node, or \p nullptr if
     780             :    * no such node exists in this processor's mesh data structure.
     781             :    */
     782             :   virtual Node * query_node_ptr (const dof_id_type i) = 0;
     783             : 
     784             :   /**
     785             :    * \returns A reference to the \f$ i^{th} \f$ element, which should be
     786             :    * present in this processor's subset of the mesh data structure.
     787             :    */
     788     5294972 :   virtual const Elem & elem_ref (const dof_id_type i) const
     789             :   {
     790     5294972 :     return *this->elem_ptr(i);
     791             :   }
     792             : 
     793             :   /**
     794             :    * \returns A writable reference to the \f$ i^{th} \f$ element, which
     795             :    * should be present in this processor's subset of the mesh data
     796             :    * structure.
     797             :    */
     798   304562689 :   virtual Elem & elem_ref (const dof_id_type i)
     799             :   {
     800   304562689 :     return *this->elem_ptr(i);
     801             :   }
     802             : 
     803             :   /**
     804             :    * \returns A pointer to the \f$ i^{th} \f$ element, which should be
     805             :    * present in this processor's subset of the mesh data structure.
     806             :    */
     807             :   virtual const Elem * elem_ptr (const dof_id_type i) const = 0;
     808             : 
     809             :   /**
     810             :    * \returns A writable pointer to the \f$ i^{th} \f$ element, which
     811             :    * should be present in this processor's subset of the mesh data
     812             :    * structure.
     813             :    */
     814             :   virtual Elem * elem_ptr (const dof_id_type i) = 0;
     815             : 
     816             :   /**
     817             :    * \returns A pointer to the \f$ i^{th} \f$ element, or nullptr if no
     818             :    * such element exists in this processor's mesh data structure.
     819             :    */
     820             :   virtual const Elem * query_elem_ptr (const dof_id_type i) const = 0;
     821             : 
     822             :   /**
     823             :    * \returns A writable pointer to the \f$ i^{th} \f$ element, or nullptr
     824             :    * if no such element exists in this processor's mesh data structure.
     825             :    */
     826             :   virtual Elem * query_elem_ptr (const dof_id_type i) = 0;
     827             : 
     828             :   /**
     829             :    * Add a new \p Node at \p Point \p p to the end of the vertex array,
     830             :    * with processor_id \p procid.
     831             :    * Use DofObject::invalid_processor_id (default) to add a node to all
     832             :    * processors, or this->processor_id() to add a node to the local
     833             :    * processor only.
     834             :    * If adding a node locally, passing an \p id other than
     835             :    * DofObject::invalid_id will set that specific node id.  Only
     836             :    * do this in parallel if you are manually keeping ids consistent.
     837             :    */
     838             :   virtual Node * add_point (const Point & p,
     839             :                             const dof_id_type id = DofObject::invalid_id,
     840             :                             const processor_id_type proc_id =
     841             :                             DofObject::invalid_processor_id) = 0;
     842             : 
     843             :   /**
     844             :    * Add \p Node \p n to the end of the vertex array.
     845             :    */
     846             :   virtual Node * add_node (Node * n) = 0;
     847             : 
     848             :   /**
     849             :    * Version of add_node() taking a std::unique_ptr by value. The version
     850             :    * taking a dumb pointer will eventually be deprecated in favor of this
     851             :    * version. This API is intended to indicate that ownership of the Node
     852             :    * is transferred to the Mesh when this function is called, and it should
     853             :    * play more nicely with the Node::build() API which has always returned
     854             :    * a std::unique_ptr.
     855             :    */
     856             :   virtual Node * add_node (std::unique_ptr<Node> n) = 0;
     857             : 
     858             :   /**
     859             :    * Removes the Node n from the mesh.
     860             :    */
     861             :   virtual void delete_node (Node * n) = 0;
     862             : 
     863             :   /**
     864             :    * Takes ownership of node \p n on this partition of a distributed
     865             :    * mesh, by setting n.processor_id() to this->processor_id(), as
     866             :    * well as changing n.id() and moving it in the mesh's internal
     867             :    * container to give it a new authoritative id.
     868             :    */
     869           0 :   virtual void own_node (Node &) {}
     870             : 
     871             :   /**
     872             :    * Changes the id of node \p old_id, both by changing node(old_id)->id() and
     873             :    * by moving node(old_id) in the mesh's internal container.  No element with
     874             :    * the id \p new_id should already exist.
     875             :    */
     876             :   virtual void renumber_node (dof_id_type old_id, dof_id_type new_id) = 0;
     877             : 
     878             :   /**
     879             :    * Add elem \p e to the end of the element array.
     880             :    * To add an element locally, set e->processor_id() before adding it.
     881             :    * To ensure a specific element id, call e->set_id() before adding it;
     882             :    * only do this in parallel if you are manually keeping ids consistent.
     883             :    *
     884             :    * Users should call MeshBase::complete_preparation() after elements are
     885             :    * added to and/or deleted from the mesh.
     886             :    */
     887             :   virtual Elem * add_elem (Elem * e) = 0;
     888             : 
     889             :   /**
     890             :    * Version of add_elem() taking a std::unique_ptr by value. The version
     891             :    * taking a dumb pointer will eventually be deprecated in favor of this
     892             :    * version. This API is intended to indicate that ownership of the Elem
     893             :    * is transferred to the Mesh when this function is called, and it should
     894             :    * play more nicely with the Elem::build() API which has always returned
     895             :    * a std::unique_ptr.
     896             :    */
     897             :   virtual Elem * add_elem (std::unique_ptr<Elem> e) = 0;
     898             : 
     899             :   /**
     900             :    * Insert elem \p e to the element array, preserving its id
     901             :    * and replacing/deleting any existing element with the same id.
     902             :    *
     903             :    * Users should call MeshBase::complete_preparation() after elements are
     904             :    * added to and/or deleted from the mesh.
     905             :    */
     906             :   virtual Elem * insert_elem (Elem * e) = 0;
     907             : 
     908             :   /**
     909             :    * Version of insert_elem() taking a std::unique_ptr by value. The version
     910             :    * taking a dumb pointer will eventually be deprecated in favor of this
     911             :    * version. This API is intended to indicate that ownership of the Elem
     912             :    * is transferred to the Mesh when this function is called, and it should
     913             :    * play more nicely with the Elem::build() API which has always returned
     914             :    * a std::unique_ptr.
     915             :    */
     916             :   virtual Elem * insert_elem (std::unique_ptr<Elem> e) = 0;
     917             : 
     918             :   /**
     919             :    * Removes element \p e from the mesh. This method must be
     920             :    * implemented in derived classes in such a way that it does not
     921             :    * invalidate element iterators.  Users should call
     922             :    * MeshBase::complete_preparation() after elements are added to
     923             :    * and/or deleted from the mesh.
     924             :    *
     925             :    * \note Calling this method may produce isolated nodes, i.e. nodes
     926             :    * not connected to any element.
     927             :    */
     928             :   virtual void delete_elem (Elem * e) = 0;
     929             : 
     930             :   /**
     931             :    * Changes the id of element \p old_id, both by changing elem(old_id)->id()
     932             :    * and by moving elem(old_id) in the mesh's internal container.  No element
     933             :    * with the id \p new_id should already exist.
     934             :    */
     935             :   virtual void renumber_elem (dof_id_type old_id, dof_id_type new_id) = 0;
     936             : 
     937             :   /**
     938             :    * Returns the default master space to physical space mapping basis
     939             :    * functions to be used on newly added elements.
     940             :    */
     941      859001 :   ElemMappingType default_mapping_type () const
     942             :   {
     943    58580810 :     return _default_mapping_type;
     944             :   }
     945             : 
     946             :   /**
     947             :    * Set the default master space to physical space mapping basis
     948             :    * functions to be used on newly added elements.
     949             :    */
     950          44 :   void set_default_mapping_type (const ElemMappingType type)
     951             :   {
     952       16029 :     _default_mapping_type = type;
     953          44 :   }
     954             : 
     955             :   /**
     956             :    * Returns any default data value used by the master space to
     957             :    * physical space mapping.
     958             :    */
     959      859001 :   unsigned char default_mapping_data () const
     960             :   {
     961    58580810 :     return _default_mapping_data;
     962             :   }
     963             : 
     964             :   /**
     965             :    * Set the default master space to physical space mapping basis
     966             :    * functions to be used on newly added elements.
     967             :    */
     968          44 :   void set_default_mapping_data (const unsigned char data)
     969             :   {
     970       16029 :     _default_mapping_data = data;
     971          44 :   }
     972             : 
     973             :   /**
     974             :    * Locate element face (edge in 2D) neighbors.  This is done with the help
     975             :    * of a \p std::map that functions like a hash table.
     976             :    * After this routine is called all the elements with a \p nullptr neighbor
     977             :    * pointer are guaranteed to be on the boundary.  Thus this routine is
     978             :    * useful for automatically determining the boundaries of the domain.
     979             :    *
     980             :    * If \p reset_remote_elements is left to false, remote neighbor
     981             :    * links are not reset and searched for in the local mesh.
     982             :    *
     983             :    * If \p reset_current_list is left as true, then any existing links
     984             :    * will be reset before initiating the algorithm, while honoring the
     985             :    * value of the \p reset_remote_elements flag.
     986             :    *
     987             :    * If \p assert_valid is left as true, then in dbg mode extensive
     988             :    * consistency checking is performed before returning.
     989             :    */
     990             :   virtual void find_neighbors (const bool reset_remote_elements = false,
     991             :                                const bool reset_current_list    = true,
     992             :                                const bool assert_valid          = true) = 0;
     993             : 
     994             :   /**
     995             :    * Removes any orphaned nodes, nodes not connected to any elements.
     996             :    * Typically done automatically in a preparation step
     997             :    */
     998             :   void remove_orphaned_nodes ();
     999             : 
    1000             :   /**
    1001             :    * After partitioning a mesh it is useful to renumber the nodes and elements
    1002             :    * so that they lie in contiguous blocks on the processors.  This method
    1003             :    * does just that.
    1004             :    */
    1005             :   virtual void renumber_nodes_and_elements () = 0;
    1006             : 
    1007             :   /**
    1008             :    * There is no reason for a user to ever call this function.
    1009             :    *
    1010             :    * This function restores a previously broken element/node numbering such that
    1011             :    * \p mesh.node_ref(n).id() == n.
    1012             :    */
    1013             :   virtual void fix_broken_node_and_element_numbering () = 0;
    1014             : 
    1015             : 
    1016             : #ifdef LIBMESH_ENABLE_AMR
    1017             :   /**
    1018             :    * Delete subactive (i.e. children of coarsened) elements.
    1019             :    * This removes all elements descended from currently active
    1020             :    * elements in the mesh.
    1021             :    */
    1022             :   virtual bool contract () = 0;
    1023             : #endif
    1024             : 
    1025             :   /**
    1026             :    * Register an integer datum (of type dof_id_type) to be added to
    1027             :    * each element in the mesh.
    1028             :    *
    1029             :    * If the mesh already has elements, data by default is allocated in
    1030             :    * each of them.  This may be expensive to do repeatedly; use
    1031             :    * add_elem_integers instead.  Alternatively, the \p allocate_data
    1032             :    * option can be manually set to false, but if this is done then a
    1033             :    * manual call to \p size_elem_extra_integers() will need to be done
    1034             :    * before the new space is usable.
    1035             :    *
    1036             :    * Newly allocated values for the new datum will be initialized to
    1037             :    * \p default_value
    1038             :    *
    1039             :    * \returns The index number for the new datum, or for the existing
    1040             :    * datum if one by the same name has already been added.
    1041             :    */
    1042             :   unsigned int add_elem_integer(std::string name,
    1043             :                                 bool allocate_data = true,
    1044             :                                 dof_id_type default_value = DofObject::invalid_id);
    1045             : 
    1046             :   /**
    1047             :    * Register integer data (of type dof_id_type) to be added to
    1048             :    * each element in the mesh, one string name for each new integer.
    1049             :    *
    1050             :    * If the mesh already has elements, data by default is allocated in
    1051             :    * each of them.
    1052             :    *
    1053             :    * Newly allocated values for the new datum with name \p names[i]
    1054             :    * will be initialized to \p default_values[i], or to
    1055             :    * DofObject::invalid_id if \p default_values is null.
    1056             :    *
    1057             :    * \returns The index numbers for the new data, and/or for existing
    1058             :    * data if data by some of the same names has already been added.
    1059             :    */
    1060             :   std::vector<unsigned int> add_elem_integers(const std::vector<std::string> & names,
    1061             :                                               bool allocate_data = true,
    1062             :                                               const std::vector<dof_id_type> * default_values = nullptr);
    1063             : 
    1064             :   /*
    1065             :    * \returns The index number for the named extra element integer
    1066             :    * datum, which must have already been added.
    1067             :    */
    1068             :   unsigned int get_elem_integer_index(std::string_view name) const;
    1069             : 
    1070             :   /*
    1071             :    * \returns Whether or not the mesh has an element integer with its name.
    1072             :    */
    1073             :   bool has_elem_integer(std::string_view name) const;
    1074             : 
    1075             :   /*
    1076             :    * \returns The name for the indexed extra element integer
    1077             :    * datum, which must have already been added.
    1078             :    */
    1079          19 :   const std::string & get_elem_integer_name(unsigned int i) const
    1080          38 :   { return _elem_integer_names[i]; }
    1081             : 
    1082             :   /*
    1083             :    * \returns The number of extra element integers for which space is
    1084             :    * being reserved on this mesh.
    1085             :    *
    1086             :    * If non-integer data has been associated, each datum of type T
    1087             :    * counts for sizeof(T)/sizeof(dof_id_type) times in the return
    1088             :    * value.
    1089             :    */
    1090         816 :   unsigned int n_elem_integers() const { return _elem_integer_names.size(); }
    1091             : 
    1092             :   /**
    1093             :    * Register a datum (of type T) to be added to each element in the
    1094             :    * mesh.
    1095             :    *
    1096             :    * If the mesh already has elements, data by default is allocated in
    1097             :    * each of them.  This may be expensive to do repeatedly; use
    1098             :    * add_elem_data instead.  Alternatively, the \p allocate_data
    1099             :    * option can be manually set to false, but if this is done then a
    1100             :    * manual call to \p size_elem_extra_integers() will need to be done
    1101             :    * before the new space is usable.
    1102             :    *
    1103             :    * Newly allocated values for the new datum will be initialized to
    1104             :    * \p *default_value if \p default_value is not null, or to
    1105             :    * meaningless memcpy output otherwise.
    1106             :    *
    1107             :    * \returns The index numbers for the new data, and/or for existing
    1108             :    * data if data by some of the same names has already been added.
    1109             :    *
    1110             :    * If type T is larger than dof_id_type, its data will end up
    1111             :    * spanning multiple index values, but will be queried with the
    1112             :    * starting index number.
    1113             :    *
    1114             :    * No type checking is done with this function!  If you add data of
    1115             :    * type T, don't try to access it with a call specifying type U.
    1116             :    */
    1117             :   template <typename T>
    1118             :   unsigned int add_elem_datum(const std::string & name,
    1119             :                               bool allocate_data = true,
    1120             :                               const T * default_value = nullptr);
    1121             : 
    1122             :   /**
    1123             :    * Register data (of type T) to be added to each element in the
    1124             :    * mesh.
    1125             :    *
    1126             :    * If the mesh already has elements, data is allocated in each.
    1127             :    *
    1128             :    * Newly allocated values for the new datum with name \p names[i]
    1129             :    * will be initialized to \p default_values[i], or to
    1130             :    * meaningless memcpy output if \p default_values is null.
    1131             :    *
    1132             :    * \returns The starting index number for the new data, or for the
    1133             :    * existing data if one by the same name has already been added.
    1134             :    *
    1135             :    * If type T is larger than dof_id_type, each datum will end up
    1136             :    * spanning multiple index values, but will be queried with the
    1137             :    * starting index number.
    1138             :    *
    1139             :    * No type checking is done with this function!  If you add data of
    1140             :    * type T, don't try to access it with a call specifying type U.
    1141             :    */
    1142             :   template <typename T>
    1143             :   std::vector<unsigned int> add_elem_data(const std::vector<std::string> & names,
    1144             :                                           bool allocate_data = true,
    1145             :                                           const std::vector<T> * default_values = nullptr);
    1146             : 
    1147             :   /**
    1148             :    * Register an integer datum (of type dof_id_type) to be added to
    1149             :    * each node in the mesh.
    1150             :    *
    1151             :    * If the mesh already has nodes, data by default is allocated in
    1152             :    * each of them.  This may be expensive to do repeatedly; use
    1153             :    * add_node_integers instead.  Alternatively, the \p allocate_data
    1154             :    * option can be manually set to false, but if this is done then a
    1155             :    * manual call to \p size_node_extra_integers() will need to be done
    1156             :    * before the new space is usable.
    1157             :    *
    1158             :    * Newly allocated values for the new datum will be initialized to
    1159             :    * \p default_value
    1160             :    *
    1161             :    * \returns The index number for the new datum, or for the existing
    1162             :    * datum if one by the same name has already been added.
    1163             :    */
    1164             :   unsigned int add_node_integer(std::string name,
    1165             :                                 bool allocate_data = true,
    1166             :                                 dof_id_type default_value = DofObject::invalid_id);
    1167             : 
    1168             :   /**
    1169             :    * Register integer data (of type dof_id_type) to be added to
    1170             :    * each node in the mesh.
    1171             :    *
    1172             :    * If the mesh already has nodes, data by default is allocated in
    1173             :    * each.
    1174             :    *
    1175             :    * Newly allocated values for the new datum with name \p names[i]
    1176             :    * will be initialized to \p default_values[i], or to
    1177             :    * DofObject::invalid_id if \p default_values is null.
    1178             :    *
    1179             :    * \returns The index numbers for the new data, and/or for existing
    1180             :    * data if data by some of the same names has already been added.
    1181             :    */
    1182             :   std::vector<unsigned int> add_node_integers(const std::vector<std::string> & names,
    1183             :                                               bool allocate_data = true,
    1184             :                                               const std::vector<dof_id_type> * default_values = nullptr);
    1185             : 
    1186             :   /*
    1187             :    * \returns The index number for the named extra node integer
    1188             :    * datum, which must have already been added.
    1189             :    */
    1190             :   unsigned int get_node_integer_index(std::string_view name) const;
    1191             : 
    1192             :   /*
    1193             :    * \returns Whether or not the mesh has a node integer with its name.
    1194             :    */
    1195             :   bool has_node_integer(std::string_view name) const;
    1196             : 
    1197             :   /*
    1198             :    * \returns The name for the indexed extra node integer
    1199             :    * datum, which must have already been added.
    1200             :    */
    1201          36 :   const std::string & get_node_integer_name(unsigned int i) const
    1202          72 :   { return _node_integer_names[i]; }
    1203             : 
    1204             :   /*
    1205             :    * \returns The number of extra node integers for which space is
    1206             :    * being reserved on this mesh.
    1207             :    *
    1208             :    * If non-integer data has been associated, each datum of type T
    1209             :    * counts for sizeof(T)/sizeof(dof_id_type) times in the return
    1210             :    * value.
    1211             :    */
    1212         816 :   unsigned int n_node_integers() const { return _node_integer_names.size(); }
    1213             : 
    1214             :   /**
    1215             :    * Register a datum (of type T) to be added to each node in the
    1216             :    * mesh.
    1217             :    *
    1218             :    * If the mesh already has nodes, data by default is allocated in
    1219             :    * each of them.  This may be expensive to do repeatedly; use
    1220             :    * add_node_data instead.  Alternatively, the \p allocate_data
    1221             :    * option can be manually set to false, but if this is done then a
    1222             :    * manual call to \p size_node_extra_integers() will need to be done
    1223             :    * before the new space is usable.
    1224             :    *
    1225             :    * Newly allocated values for the new datum will be initialized to
    1226             :    * \p *default_value if \p default_value is not null, or to
    1227             :    * meaningless memcpy output otherwise.
    1228             :    *
    1229             :    * \returns The starting index number for the new datum, or for the
    1230             :    * existing datum if one by the same name has already been added.
    1231             :    *
    1232             :    * If type T is larger than dof_id_type, its data will end up
    1233             :    * spanning multiple index values, but will be queried with the
    1234             :    * starting index number.
    1235             :    *
    1236             :    * No type checking is done with this function!  If you add data of
    1237             :    * type T, don't try to access it with a call specifying type U.
    1238             :    */
    1239             :   template <typename T>
    1240             :   unsigned int add_node_datum(const std::string & name,
    1241             :                               bool allocate_data = true,
    1242             :                               const T * default_value = nullptr);
    1243             : 
    1244             :   /**
    1245             :    * Register data (of type T) to be added to each node in the
    1246             :    * mesh.
    1247             :    *
    1248             :    * If the mesh already has nodes, data by default is allocated in each.
    1249             :    *
    1250             :    * Newly allocated values for the new datum with name \p names[i]
    1251             :    * will be initialized to \p default_values[i], or to
    1252             :    * meaningless memcpy output if \p default_values is null.
    1253             :    *
    1254             :    * \returns The starting index number for the new data, or for the
    1255             :    * existing data if one by the same name has already been added.
    1256             :    *
    1257             :    * If type T is larger than dof_id_type, its data will end up
    1258             :    * spanning multiple index values, but will be queried with the
    1259             :    * starting index number.
    1260             :    *
    1261             :    * No type checking is done with this function!  If you add data of
    1262             :    * type T, don't try to access it with a call specifying type U.
    1263             :    */
    1264             :   template <typename T>
    1265             :   std::vector<unsigned int> add_node_data(const std::vector<std::string> & name,
    1266             :                                           bool allocate_data = true,
    1267             :                                           const std::vector<T> * default_values = nullptr);
    1268             : 
    1269             :   /**
    1270             :    * Prepare a newly created (or read) mesh for use.
    1271             :    * This involves several steps:
    1272             :    *  1.) renumbering (if enabled)
    1273             :    *  2.) removing any orphaned nodes
    1274             :    *  3.) updating parallel id counts
    1275             :    *  4.) finding neighbor links
    1276             :    *  5.) caching summarized element data
    1277             :    *  6.) finding interior parent links
    1278             :    *  7.) clearing any old point locator
    1279             :    *  8.) calling reinit() on ghosting functors
    1280             :    *  9.) repartitioning (if enabled)
    1281             :    *  10.) removing any remote elements (if enabled)
    1282             :    *  11.) regenerating summarized boundary id sets
    1283             :    *
    1284             :    * For backwards compatibility, prepare_for_use() performs *all* those
    1285             :    * steps, regardless of the official preparation() state of the
    1286             :    * mesh.  In codes which have maintained a valid preparation() state
    1287             :    * via methods such as unset_has_synched_id_counts(), calling
    1288             :    * complete_preparation() will result in a fully-prepared mesh at
    1289             :    * less cost.
    1290             :    *
    1291             :    * The argument to skip renumbering is now deprecated - to prevent a
    1292             :    * mesh from being renumbered, set allow_renumbering(false). The argument to skip
    1293             :    * finding neighbors is also deprecated. To prevent find_neighbors, set
    1294             :    * allow_find_neighbors(false)
    1295             :    *
    1296             :    * If this is a distributed mesh, local copies of remote elements
    1297             :    * will be deleted here - to keep those elements replicated during
    1298             :    * preparation, set allow_remote_element_removal(false).
    1299             :    */
    1300             : #ifdef LIBMESH_ENABLE_DEPRECATED
    1301             :   void prepare_for_use (const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors);
    1302             :   void prepare_for_use (const bool skip_renumber_nodes_and_elements);
    1303             : #endif // LIBMESH_ENABLE_DEPRECATED
    1304             :   void prepare_for_use ();
    1305             : 
    1306             :   /*
    1307             :    * Prepare a newly created or modified mesh for use.
    1308             :    *
    1309             :    * Unlike \p prepare_for_use(), \p complete_preparation() performs
    1310             :    * *only* those preparatory steps that have been marked as
    1311             :    * necessary in the MeshBase::Preparation state.
    1312             :    */
    1313             :   void complete_preparation();
    1314             : 
    1315             :   /**
    1316             :    * Call the default partitioner (currently \p metis_partition()).
    1317             :    */
    1318             :   virtual void partition (const unsigned int n_parts);
    1319             : 
    1320        2018 :   void partition ()
    1321      433897 :   { this->partition(this->n_processors()); }
    1322             : 
    1323             :   /**
    1324             :    * Redistribute elements between processors.  This gets called
    1325             :    * automatically by the Partitioner, and merely notifies any
    1326             :    * GhostingFunctors of redistribution in the case of a
    1327             :    * ReplicatedMesh or serialized DistributedMesh
    1328             :    */
    1329             :   virtual void redistribute ();
    1330             : 
    1331             :   /**
    1332             :    * Recalculate any cached data (or invalidate any caches that are
    1333             :    * computed on the fly) after elements and nodes have been
    1334             :    * repartitioned.
    1335             :    */
    1336             :   virtual void update_post_partitioning ();
    1337             : 
    1338             :   /**
    1339             :    * If false is passed in then this mesh will no longer be renumbered
    1340             :    * when being prepared for use.  This may slightly adversely affect
    1341             :    * performance during subsequent element access, particularly when
    1342             :    * using a distributed mesh.
    1343             :    *
    1344             :    * Important! When allow_renumbering(false) is set,
    1345             :    * ReplicatedMesh::n_elem() and ReplicatedMesh::n_nodes() will
    1346             :    * return *wrong* values whenever adaptive refinement is followed by
    1347             :    * adaptive coarsening. (Uniform refinement followed by uniform
    1348             :    * coarsening is OK.) This is due to the fact that n_elem() and
    1349             :    * n_nodes() are currently O(1) functions that just return the size
    1350             :    * of the respective underlying vectors, and this size is wrong when
    1351             :    * the numbering includes "gaps" from nodes and elements that have
    1352             :    * been deleted. We plan to implement a caching mechanism in the
    1353             :    * near future that will fix this incorrect behavior.
    1354             :    */
    1355       74403 :   void allow_renumbering(bool allow) { _skip_renumber_nodes_and_elements = !allow; }
    1356       47276 :   bool allow_renumbering() const { return !_skip_renumber_nodes_and_elements; }
    1357             : 
    1358             :   /**
    1359             :    * If \p false is passed then this mesh will no longer work to find element
    1360             :    * neighbors when being prepared for use
    1361             :    */
    1362       71488 :   void allow_find_neighbors(bool allow) { _skip_find_neighbors = !allow; }
    1363      171103 :   bool allow_find_neighbors() const { return !_skip_find_neighbors; }
    1364             : 
    1365             :   /**
    1366             :    * If \p false is passed then this mesh will no longer work to detect
    1367             :    * interior parents when being prepared for use
    1368             :    */
    1369       30363 :   void allow_detect_interior_parents(bool allow) { _skip_detect_interior_parents = !allow; }
    1370       29591 :   bool allow_detect_interior_parents() const { return !_skip_detect_interior_parents; }
    1371             : 
    1372             :   /**
    1373             :    * If false is passed in then this mesh will no longer have remote
    1374             :    * elements deleted when being prepared for use; i.e. even a
    1375             :    * DistributedMesh will remain (if it is already) serialized.
    1376             :    * This may adversely affect performance and memory use.
    1377             :    */
    1378      725122 :   void allow_remote_element_removal(bool allow) { _allow_remote_element_removal = allow; }
    1379      408874 :   bool allow_remote_element_removal() const { return _allow_remote_element_removal; }
    1380             : 
    1381             :   /**
    1382             :    * If \p true is passed, then this mesh will no longer require
    1383             :    * unique_ids to be unique across the set of all DofObjects. That
    1384             :    * is, although no two Elems (resp. Nodes) will share the same
    1385             :    * unique_id, a given Elem and Node might share the same unique_id.
    1386             :    */
    1387         142 :   void allow_node_and_elem_unique_id_overlap(bool allow) { _allow_node_and_elem_unique_id_overlap = allow; }
    1388       26626 :   bool allow_node_and_elem_unique_id_overlap() const { return _allow_node_and_elem_unique_id_overlap; }
    1389             : 
    1390             :   /**
    1391             :    * If true is passed in then the elements on this mesh will no
    1392             :    * longer be (re)partitioned, and the nodes on this mesh will only
    1393             :    * be repartitioned if they are found "orphaned" via coarsening or
    1394             :    * other removal of the last element responsible for their
    1395             :    * node/element processor id consistency.
    1396             :    *
    1397             :    * \note It would probably be a bad idea to call this on a
    1398             :    * DistributedMesh _before_ the first partitioning has happened...
    1399             :    * because no elements would get assigned to your processor pool.
    1400             :    *
    1401             :    * \note Skipping partitioning can have adverse effects on your
    1402             :    * performance when using AMR... i.e. you could get large load
    1403             :    * imbalances.  However you might still want to use this if the
    1404             :    * communication and computation of the rebalance and repartition is
    1405             :    * too high for your application.
    1406             :    *
    1407             :    * It is also possible, for backwards-compatibility purposes, to
    1408             :    * skip noncritical partitioning by resetting the partitioner()
    1409             :    * pointer for this mesh.
    1410             :    */
    1411             :   void skip_noncritical_partitioning(bool skip)
    1412             :   { _skip_noncritical_partitioning = skip; }
    1413             : 
    1414        3758 :   bool skip_noncritical_partitioning() const
    1415      155429 :   { return _skip_noncritical_partitioning || _skip_all_partitioning || !_partitioner.get(); }
    1416             : 
    1417             : 
    1418             :   /**
    1419             :    * If true is passed in then nothing on this mesh will be
    1420             :    * (re)partitioned.
    1421             :    *
    1422             :    * \note The caveats for skip_noncritical_partitioning() still
    1423             :    * apply, and removing elements from a mesh with this setting
    1424             :    * enabled can leave node processor ids in an inconsistent state
    1425             :    * (not matching any attached element), causing failures in other
    1426             :    * library code.  Do not use this setting along with element
    1427             :    * deletion or coarsening.
    1428             :    */
    1429       29900 :   void skip_partitioning(bool skip) { _skip_all_partitioning = skip; }
    1430             : 
    1431      466482 :   bool skip_partitioning() const { return _skip_all_partitioning; }
    1432             : 
    1433             :   /**
    1434             :    * Adds a functor which can specify ghosting requirements for use on
    1435             :    * distributed meshes.  Multiple ghosting functors can be added; any
    1436             :    * element which is required by any functor will be ghosted.
    1437             :    *
    1438             :    * GhostingFunctor memory must be managed by the code which calls
    1439             :    * this function; the GhostingFunctor lifetime is expected to extend
    1440             :    * until either the functor is removed or the Mesh is destructed.
    1441             :    */
    1442             :   void add_ghosting_functor(GhostingFunctor & ghosting_functor);
    1443             : 
    1444             :   /**
    1445             :    * Adds a functor which can specify ghosting requirements for use on
    1446             :    * distributed meshes.  Multiple ghosting functors can be added; any
    1447             :    * element which is required by any functor will be ghosted.
    1448             :    *
    1449             :    * GhostingFunctor memory when using this method is managed by the
    1450             :    * shared_ptr mechanism.
    1451             :    */
    1452       30708 :   void add_ghosting_functor(std::shared_ptr<GhostingFunctor> ghosting_functor)
    1453       60428 :   { _shared_functors[ghosting_functor.get()] = ghosting_functor;
    1454       30708 :     this->add_ghosting_functor(*ghosting_functor); }
    1455             : 
    1456             :   /**
    1457             :    * Removes a functor which was previously added to the set of
    1458             :    * ghosting functors.
    1459             :    */
    1460             :   void remove_ghosting_functor(GhostingFunctor & ghosting_functor);
    1461             : 
    1462             :   /**
    1463             :    * Iterator type for ghosting functor ranges.  This has changed in
    1464             :    * the past and may change again; code should use auto or the type
    1465             :    * here.
    1466             :    */
    1467             :   typedef std::vector<GhostingFunctor *>::const_iterator GhostingFunctorIterator;
    1468             : 
    1469             :   /**
    1470             :    * Beginning of range of ghosting functors
    1471             :    */
    1472        2662 :   GhostingFunctorIterator ghosting_functors_begin() const
    1473       17639 :   { return _ghosting_functors.begin(); }
    1474             : 
    1475             :   /**
    1476             :    * End of range of ghosting functors
    1477             :    */
    1478        2662 :   GhostingFunctorIterator ghosting_functors_end() const
    1479       17639 :   { return _ghosting_functors.end(); }
    1480             : 
    1481             :   /**
    1482             :    * Default ghosting functor
    1483             :    */
    1484           6 :   GhostingFunctor & default_ghosting() { return *_default_ghosting; }
    1485             : 
    1486             :   /**
    1487             :    * Constructs a list of all subdomain identifiers in the local mesh if
    1488             :    * \p global == false, and in the global mesh if \p global == true (default).
    1489             :    * Subdomains correspond to separate subsets of the mesh which could correspond
    1490             :    * e.g. to different materials in a solid mechanics application,
    1491             :    * or regions where different physical processes are important.  The subdomain
    1492             :    * mapping is independent from the parallel decomposition.
    1493             :    *
    1494             :    * Unpartitioned elements are included in the set in the case that \p
    1495             :    * global == true. If \p global == false, the unpartitioned elements are not
    1496             :    * included because unpartitioned elements do not have a sense of locality.
    1497             :    */
    1498             :   void subdomain_ids (std::set<subdomain_id_type> & ids, const bool global = true) const;
    1499             : 
    1500             :   /**
    1501             :    * \returns The number of subdomains in the global mesh. Subdomains correspond
    1502             :    * to separate subsets of the mesh which could correspond e.g. to different
    1503             :    * materials in a solid mechanics application, or regions where different
    1504             :    * physical processes are important.  The subdomain mapping is independent
    1505             :    * from the parallel decomposition.
    1506             :    */
    1507             :   subdomain_id_type n_subdomains () const;
    1508             : 
    1509             :   /**
    1510             :    * \returns The number of subdomains in the local mesh. Subdomains correspond
    1511             :    * to separate subsets of the mesh which could correspond e.g. to different
    1512             :    * materials in a solid mechanics application, or regions where different
    1513             :    * physical processes are important.  The subdomain mapping is independent
    1514             :    * from the parallel decomposition.
    1515             :    */
    1516             :   subdomain_id_type n_local_subdomains () const;
    1517             : 
    1518             :   /**
    1519             :    * \returns The number of partitions which have been defined via
    1520             :    * a call to either mesh.partition() or by building a Partitioner
    1521             :    * object and calling partition.
    1522             :    *
    1523             :    * \note The partitioner object is responsible for setting this
    1524             :    * value.
    1525             :    */
    1526        6934 :   unsigned int n_partitions () const
    1527       56571 :   { return _n_parts; }
    1528             : 
    1529             :   /**
    1530             :    * \returns A string containing relevant information
    1531             :    * about the mesh.
    1532             :    *
    1533             :    * \p verbosity sets the verbosity, with 0 being the least and 2 being the greatest.
    1534             :    * 0 - Dimensions, number of nodes, number of elems, number of subdomains, number of
    1535             :    *     partitions, prepared status.
    1536             :    * 1 - Adds the mesh bounding box, mesh element types, specific nodesets/edgesets/sidesets
    1537             :    *     with element types, number of nodes/edges/sides.
    1538             :    * 2 - Adds volume information and bounding boxes to boundary information.
    1539             :    *
    1540             :    * The \p global parameter pertains primarily to verbosity levels 1 and above.
    1541             :    * When \p global == true, information is only output on rank 0 and the information
    1542             :    * is reduced. When \p global == false, information is output on all ranks that pertains
    1543             :    * only to that local partition.
    1544             :    */
    1545             :   std::string get_info (const unsigned int verbosity = 0, const bool global = true) const;
    1546             : 
    1547             :   /**
    1548             :    * Prints relevant information about the mesh.
    1549             :    *
    1550             :    * Take note of the docstring for get_info() for more information pretaining to
    1551             :    * the \p verbosity and \p global parameters.
    1552             :    */
    1553             :   void print_info (std::ostream & os=libMesh::out, const unsigned int verbosity = 0, const bool global = true) const;
    1554             : 
    1555             :   /**
    1556             :    * Equivalent to calling print_info() above, but now you can write:
    1557             :    * Mesh mesh;
    1558             :    * libMesh::out << mesh << std::endl;
    1559             :    */
    1560             :   friend std::ostream & operator << (std::ostream & os, const MeshBase & m);
    1561             : 
    1562             :   /**
    1563             :    * Interfaces for reading/writing a mesh to/from a file.  Must be
    1564             :    * implemented in derived classes.
    1565             :    */
    1566             :   virtual void read  (const std::string & name,
    1567             :                       void * mesh_data=nullptr,
    1568             :                       bool skip_renumber_nodes_and_elements=false,
    1569             :                       bool skip_find_neighbors=false,
    1570             :                       bool skip_detect_interior_parents=false) = 0;
    1571             :   virtual void write (const std::string & name) const = 0;
    1572             : 
    1573             :   /**
    1574             :    * Converts a mesh with higher-order
    1575             :    * elements into a mesh with linear elements.  For
    1576             :    * example, a mesh consisting of \p Tet10 will be converted
    1577             :    * to a mesh with \p Tet4 etc.
    1578             :    */
    1579             :   virtual void all_first_order () = 0;
    1580             : 
    1581             :   /**
    1582             :    * We need an empty, generic class to act as a predicate for this
    1583             :    * and derived mesh classes.
    1584             :    */
    1585             :   typedef Predicates::multi_predicate Predicate;
    1586             : 
    1587             :   /**
    1588             :    * structs for the element_iterator's.
    1589             :    *
    1590             :    * \note These iterators were designed so that derived mesh classes
    1591             :    * could use the _same_ base class iterators interchangeably.  Their
    1592             :    * definition comes later in the header file.
    1593             :    */
    1594             :   struct element_iterator;
    1595             :   struct const_element_iterator;
    1596             : 
    1597             :   /**
    1598             :    * structs for the node_iterator's.
    1599             :    *
    1600             :    * \note These iterators were designed so that derived mesh classes
    1601             :    * could use the _same_ base class iterators interchangeably.  Their
    1602             :    * definition comes later in the header file.
    1603             :    */
    1604             :   struct node_iterator;
    1605             :   struct const_node_iterator;
    1606             : 
    1607             :   /**
    1608             :    * Converts a set of this Mesh's elements defined by \p range from
    1609             :    * FIRST order to SECOND order. Must be called on conforming,
    1610             :    * non-refined meshes. For example, a mesh consisting of \p Tet4
    1611             :    * will be converted to a mesh with \p Tet10 etc.
    1612             :    *
    1613             :    * \note For some elements like \p Hex8 there exist two higher order
    1614             :    * equivalents, \p Hex20 and \p Hex27.  When \p full_ordered is \p
    1615             :    * true (default), then \p Hex27 is built.  Otherwise, \p Hex20 is
    1616             :    * built.  The same holds obviously for \p Quad4, \p Prism6, etc.
    1617             :    */
    1618             :   virtual void all_second_order_range(const SimpleRange<element_iterator> & range,
    1619             :                                       const bool full_ordered = true) = 0;
    1620             : 
    1621             :   /**
    1622             :    * Calls the range-based version of this function with a range
    1623             :    * consisting of all elements in the mesh.
    1624             :    */
    1625             :   void all_second_order (const bool full_ordered = true);
    1626             : 
    1627             :   /**
    1628             :    * Converts a set of elements in this (conforming, non-refined) mesh
    1629             :    * into "complete" order elements, i.e. elements which
    1630             :    * can store degrees of freedom on any vertex, edge, or face.  For
    1631             :    * example, a mesh consisting of \p Tet4 or \p Tet10 will be
    1632             :    * converted to a mesh with \p Tet14 etc.
    1633             :    */
    1634             :   virtual void all_complete_order_range(const SimpleRange<element_iterator> & range) = 0;
    1635             : 
    1636             :   /**
    1637             :    * Calls the range-based version of this function with a range
    1638             :    * consisting of all elements in the mesh.
    1639             :    */
    1640             :   virtual void all_complete_order ();
    1641             : 
    1642             :   /**
    1643             :    * In a few (very rare) cases, the user may have manually tagged the
    1644             :    * elements with specific processor IDs by hand, without using a
    1645             :    * partitioner.  In this case, the Mesh will not know that the total
    1646             :    * number of partitions, _n_parts, has changed, unless you call this
    1647             :    * function.  This is an O(N active elements) calculation.  The return
    1648             :    * value is the number of partitions, and _n_parts is also set by
    1649             :    * this function.
    1650             :    */
    1651             :   unsigned int recalculate_n_partitions();
    1652             : 
    1653             :   /**
    1654             :    * \returns A pointer to a subordinate \p PointLocatorBase object
    1655             :    * for this mesh, constructing a master PointLocator first if
    1656             :    * necessary.  This should not be used in threaded or
    1657             :    * non-parallel_only code unless the master has already been
    1658             :    * constructed.
    1659             :    */
    1660             :   std::unique_ptr<PointLocatorBase> sub_point_locator () const;
    1661             : 
    1662             :   /**
    1663             :    * Set value used by PointLocatorBase::close_to_point_tol().
    1664             :    *
    1665             :    * Defaults to 0.0. If nonzero, calls close_to_point_tol() whenever
    1666             :    * a new PointLocator is built for use by this Mesh.  Since the Mesh
    1667             :    * controls the creation and destruction of the PointLocator, if
    1668             :    * there are any parameters we need to customize on it, the Mesh
    1669             :    * will need to know about them.
    1670             :    */
    1671             :   void set_point_locator_close_to_point_tol(Real val);
    1672             :   Real get_point_locator_close_to_point_tol() const;
    1673             : 
    1674             :   /**
    1675             :    * Releases the current \p PointLocator object.
    1676             :    */
    1677             :   void clear_point_locator ();
    1678             : 
    1679             :   /**
    1680             :    * In the point locator, do we count lower dimensional elements
    1681             :    * when we refine point locator regions? This is relevant in
    1682             :    * tree-based point locators, for example.
    1683             :    */
    1684             :   void set_count_lower_dim_elems_in_point_locator(bool count_lower_dim_elems);
    1685             : 
    1686             :   /**
    1687             :    * Get the current value of _count_lower_dim_elems_in_point_locator.
    1688             :    */
    1689             :   bool get_count_lower_dim_elems_in_point_locator() const;
    1690             : 
    1691             :   /**
    1692             :    * Verify id and processor_id consistency of our elements and
    1693             :    * nodes containers.
    1694             :    * Calls libmesh_assert() on each possible failure.
    1695             :    * Currently only implemented on DistributedMesh; a serial data
    1696             :    * structure is much harder to get out of sync.
    1697             :    */
    1698         292 :   virtual void libmesh_assert_valid_parallel_ids() const {}
    1699             : 
    1700             :   /**
    1701             :    * \returns A writable reference for getting/setting an optional
    1702             :    * name for a subdomain.
    1703             :    */
    1704             :   std::string & subdomain_name(subdomain_id_type id);
    1705             :   const std::string & subdomain_name(subdomain_id_type id) const;
    1706             : 
    1707             :   /**
    1708             :    * \returns The id of the named subdomain if it exists,
    1709             :    * \p Elem::invalid_subdomain_id otherwise.
    1710             :    */
    1711             :   subdomain_id_type get_id_by_name(std::string_view name) const;
    1712             : 
    1713             :   /*
    1714             :    * We have many combinations of iterators that filter on various
    1715             :    * characteristics; we use macros to make their abstract base class
    1716             :    * and their subclass declarations more terse.
    1717             :    */
    1718             : #define ABSTRACT_ELEM_ITERATORS(TYPE, ARGDECL) \
    1719             :   virtual element_iterator TYPE##elements_begin(ARGDECL) = 0; \
    1720             :   virtual element_iterator TYPE##elements_end(ARGDECL) = 0; \
    1721             :   virtual const_element_iterator TYPE##elements_begin(ARGDECL) const = 0; \
    1722             :   virtual const_element_iterator TYPE##elements_end(ARGDECL) const = 0; \
    1723             :   virtual SimpleRange<element_iterator> TYPE##element_ptr_range(ARGDECL) = 0; \
    1724             :   virtual SimpleRange<const_element_iterator> TYPE##element_ptr_range(ARGDECL) const = 0;
    1725             : 
    1726             : #define DECLARE_ELEM_ITERATORS(TYPE, ARGDECL, ARGS) \
    1727             :   virtual element_iterator TYPE##elements_begin(ARGDECL) override final; \
    1728             :   virtual element_iterator TYPE##elements_end(ARGDECL) override final; \
    1729             :   virtual const_element_iterator TYPE##elements_begin(ARGDECL) const override final; \
    1730             :   virtual const_element_iterator TYPE##elements_end(ARGDECL) const override final; \
    1731             :   virtual SimpleRange<element_iterator> TYPE##element_ptr_range(ARGDECL) override final { return {TYPE##elements_begin(ARGS), TYPE##elements_end(ARGS)}; } \
    1732             :   virtual SimpleRange<const_element_iterator> TYPE##element_ptr_range(ARGDECL) const override final  { return {TYPE##elements_begin(ARGS), TYPE##elements_end(ARGS)}; }
    1733             : 
    1734             : #define ABSTRACT_NODE_ITERATORS(TYPE, ARGDECL) \
    1735             :   virtual node_iterator TYPE##nodes_begin(ARGDECL) = 0; \
    1736             :   virtual node_iterator TYPE##nodes_end(ARGDECL) = 0; \
    1737             :   virtual const_node_iterator TYPE##nodes_begin(ARGDECL) const = 0; \
    1738             :   virtual const_node_iterator TYPE##nodes_end(ARGDECL) const = 0; \
    1739             :   virtual SimpleRange<node_iterator> TYPE##node_ptr_range(ARGDECL) = 0; \
    1740             :   virtual SimpleRange<const_node_iterator> TYPE##node_ptr_range(ARGDECL) const = 0;
    1741             : 
    1742             : #define DECLARE_NODE_ITERATORS(TYPE, ARGDECL, ARGS) \
    1743             :   virtual node_iterator TYPE##nodes_begin(ARGDECL) override final; \
    1744             :   virtual node_iterator TYPE##nodes_end(ARGDECL) override final; \
    1745             :   virtual const_node_iterator TYPE##nodes_begin(ARGDECL) const override final; \
    1746             :   virtual const_node_iterator TYPE##nodes_end(ARGDECL) const override final; \
    1747             :   virtual SimpleRange<node_iterator> TYPE##node_ptr_range(ARGDECL) override final { return {TYPE##nodes_begin(ARGS), TYPE##nodes_end(ARGS)}; } \
    1748             :   virtual SimpleRange<const_node_iterator> TYPE##node_ptr_range(ARGDECL) const override final  { return {TYPE##nodes_begin(ARGS), TYPE##nodes_end(ARGS)}; }
    1749             : 
    1750             : #define LIBMESH_COMMA ,
    1751             : 
    1752             :   /*
    1753             :    * element_iterator accessors
    1754             :    *
    1755             :    * The basic elements_begin() and elements_end() iterators iterate
    1756             :    * over all elements in a mesh, returning element pointers or const
    1757             :    * element pointers when dereferenced (depending on whether the mesh
    1758             :    * reference was const). range-for loops can be written using
    1759             :    * element_ptr_range()
    1760             :    *
    1761             :    * Filtered versions of these iterators, which skip over all
    1762             :    * elements not matching some predicate, are also available, by
    1763             :    * adding a prefix to the methods above.  E.g. local_ (in a form
    1764             :    * like local_elements_begin() or local_element_ptr_range()) will
    1765             :    * iterate only over elements whose processor_id() is the current
    1766             :    * processor, or active_ will iterate only over active elements even
    1767             :    * if the mesh is refined, or active_local_ will iterate over
    1768             :    * elements that are both active and local.  Negation forms such as
    1769             :    * not_local_ also exist.
    1770             :    *
    1771             :    * For some iterator prefixes, such as type_, an argument is needed
    1772             :    * for the filter; e.g. the ElemType to select for in that case.
    1773             :    *
    1774             :    * All valid prefixes and their corresponding arguments can be found
    1775             :    * in the macro invocations below.
    1776             :    */
    1777             :   ABSTRACT_ELEM_ITERATORS(,)                // elements_begin(), element_ptr_range(): all elements
    1778             :   ABSTRACT_ELEM_ITERATORS(active_,)         // Elem::active() == true
    1779             :   ABSTRACT_ELEM_ITERATORS(ancestor_,)       // Elem::ancestor() == true
    1780             :   ABSTRACT_ELEM_ITERATORS(subactive_,)      // Elem::subactive() == true
    1781             :   ABSTRACT_ELEM_ITERATORS(local_,)          // Elem::processor_id() == this processor
    1782             :   ABSTRACT_ELEM_ITERATORS(unpartitioned_,)  // Elem::processor_id() == invalid_processor_id
    1783             :   ABSTRACT_ELEM_ITERATORS(facelocal_,)      // is on or has a neighbor on this processor
    1784             :   ABSTRACT_ELEM_ITERATORS(level_,unsigned int level)   // Elem::level() == level
    1785             :   ABSTRACT_ELEM_ITERATORS(pid_,processor_id_type pid)  // Elem::processor_id() == pid
    1786             :   ABSTRACT_ELEM_ITERATORS(type_,ElemType type)         // Elem::type() == type
    1787             : 
    1788             :   ABSTRACT_ELEM_ITERATORS(active_subdomain_,subdomain_id_type sid) // active && Elem::subdomain_id() == sid
    1789             :   ABSTRACT_ELEM_ITERATORS(active_subdomain_set_,std::set<subdomain_id_type> ss) // active && ss.contains(Elem::subdomain_id())
    1790             : 
    1791             :   // Iterators which use negations of filters described above
    1792             :   ABSTRACT_ELEM_ITERATORS(not_active_,)
    1793             :   ABSTRACT_ELEM_ITERATORS(not_ancestor_,)
    1794             :   ABSTRACT_ELEM_ITERATORS(not_subactive_,)
    1795             :   ABSTRACT_ELEM_ITERATORS(not_local_,)
    1796             :   ABSTRACT_ELEM_ITERATORS(not_level_,unsigned int level)
    1797             : 
    1798             :   // Iterators which combine multiple of the filters described above
    1799             :   ABSTRACT_ELEM_ITERATORS(active_local_,)
    1800             :   ABSTRACT_ELEM_ITERATORS(active_not_local_,)
    1801             :   ABSTRACT_ELEM_ITERATORS(active_unpartitioned_,)
    1802             :   ABSTRACT_ELEM_ITERATORS(active_type_,ElemType type)
    1803             :   ABSTRACT_ELEM_ITERATORS(active_pid_,processor_id_type pid)
    1804             :   ABSTRACT_ELEM_ITERATORS(local_level_,unsigned int level)
    1805             :   ABSTRACT_ELEM_ITERATORS(local_not_level_,unsigned int level)
    1806             :   ABSTRACT_ELEM_ITERATORS(active_local_subdomain_,subdomain_id_type sid)
    1807             :   ABSTRACT_ELEM_ITERATORS(active_local_subdomain_set_,std::set<subdomain_id_type> ss)
    1808             : 
    1809             :   // Backwards compatibility
    1810             :   virtual SimpleRange<element_iterator> active_subdomain_elements_ptr_range(subdomain_id_type sid) = 0;
    1811             :   virtual SimpleRange<const_element_iterator> active_subdomain_elements_ptr_range(subdomain_id_type sid) const = 0;
    1812             :   virtual SimpleRange<element_iterator> active_local_subdomain_elements_ptr_range(subdomain_id_type sid) = 0;
    1813             :   virtual SimpleRange<const_element_iterator> active_local_subdomain_elements_ptr_range(subdomain_id_type sid) const = 0;
    1814             :   virtual SimpleRange<element_iterator> active_subdomain_set_elements_ptr_range(std::set<subdomain_id_type> ss) = 0;
    1815             :   virtual SimpleRange<const_element_iterator> active_subdomain_set_elements_ptr_range(std::set<subdomain_id_type> ss) const = 0;
    1816             : 
    1817             :   // Discouraged from use - these iterators use outdated
    1818             :   // pre-GhostingFunctor definitions and should be renamed if not
    1819             :   // deprecated
    1820             :   ABSTRACT_ELEM_ITERATORS(semilocal_,)         // active && Elem::is_semilocal()
    1821             :   ABSTRACT_ELEM_ITERATORS(ghost_,)             // active && Elem::is_semilocal() && not local discouraged
    1822             :   ABSTRACT_ELEM_ITERATORS(active_semilocal_,)
    1823             : 
    1824             :   // solution can be evaluated, with the given DoF map, for the given
    1825             :   // variable number, or for all variables by default
    1826             :   ABSTRACT_ELEM_ITERATORS(evaluable_,const DofMap & dof_map LIBMESH_COMMA unsigned int var_num = libMesh::invalid_uint)
    1827             : 
    1828             :   // solution can be evaluated for all variables of all given DoF maps
    1829             :   ABSTRACT_ELEM_ITERATORS(multi_evaluable_,std::vector<const DofMap *> dof_maps)
    1830             : 
    1831             : #ifdef LIBMESH_ENABLE_AMR
    1832             :   ABSTRACT_ELEM_ITERATORS(flagged_,unsigned char rflag)  // Elem::refinement_flag() == rflag
    1833             : 
    1834             :   // Elem::refinement_flag() == rflag && Elem::processor_id() == pid
    1835             :   ABSTRACT_ELEM_ITERATORS(flagged_pid_,unsigned char rflag LIBMESH_COMMA processor_id_type pid)
    1836             : #endif
    1837             : 
    1838             :   /*
    1839             :    * node_iterator accessors
    1840             :    *
    1841             :    * The basic nodes_begin() and nodes_end() iterators iterate
    1842             :    * over all nodes in a mesh, returning node pointers or const
    1843             :    * node pointers when dereferenced (depending on whether the mesh
    1844             :    * reference was const). range-for loops can be written using
    1845             :    * node_ptr_range()
    1846             :    *
    1847             :    * Filtered versions of these iterators, which skip over all
    1848             :    * nodes not matching some predicate, are also available, by
    1849             :    * adding a prefix to the methods above.  E.g. local_ (in a form
    1850             :    * like local_nodes_begin() or local_node_ptr_range()) will
    1851             :    * iterate only over nodes whose processor_id() is the current
    1852             :    * processor.
    1853             :    *
    1854             :    * All valid prefixes and their corresponding arguments can be found
    1855             :    * in the macro invocations below.
    1856             :    */
    1857             :   ABSTRACT_NODE_ITERATORS(,)          // nodes_begin(), node_ptr_range(): all nodes
    1858             :   ABSTRACT_NODE_ITERATORS(active_,)   // Node::active() == true; i.e. Node::id() != invalid_id
    1859             :   ABSTRACT_NODE_ITERATORS(local_,)    // Node::processor_id() == this processor
    1860             :   ABSTRACT_NODE_ITERATORS(bnd_,)      // BoundaryInfo::n_boundary_ids(node) > 0
    1861             :   ABSTRACT_NODE_ITERATORS(pid_,processor_id_type pid)  // Node::processor_id() == pid
    1862             :   ABSTRACT_NODE_ITERATORS(bid_,boundary_id_type bid)   // BoundaryInfo::has_boundary_id(node, bid)
    1863             : 
    1864             :   // solution can be evaluated, with the given DoF map, for the given
    1865             :   // variable number, or for all variables by default
    1866             :   ABSTRACT_NODE_ITERATORS(evaluable_,const DofMap & dof_map LIBMESH_COMMA unsigned int var_num = libMesh::invalid_uint)
    1867             : 
    1868             :   // solution can be evaluated for all variables of all given DoF maps
    1869             :   ABSTRACT_NODE_ITERATORS(multi_evaluable_,std::vector<const DofMap *> dof_maps)
    1870             : 
    1871             :   // Technically these define libMesh::MeshBase::*ElemRange, but since
    1872             :   // those don't conflict with libMesh::*ElemRange they're as good as
    1873             :   // a real forward declaration, which we can't do here.
    1874             :   typedef StoredRange<MeshBase::element_iterator,             Elem *>      ElemRange;
    1875             :   typedef StoredRange<MeshBase::const_element_iterator, const Elem *> ConstElemRange;
    1876             : 
    1877             :   /**
    1878             :    * \returns A reference to a cached vector copy of a range of
    1879             :    * pointers to all semilocal elements, suitable for threading.
    1880             :    *
    1881             :    * Iterating over all semilocal elements is most useful for
    1882             :    * modifying the mesh, so we only have a non-const version for now.
    1883             :    */
    1884             :   const ElemRange & element_stored_range();
    1885             : 
    1886             :   /**
    1887             :    * \returns A reference to a cached vector copy of a range of
    1888             :    * pointers to all active local elements, suitable for threading.
    1889             :    *
    1890             :    * Iterating over only local elements is most useful for computing
    1891             :    * on the mesh, so we only have a non-const version for now.
    1892             :    */
    1893             :   const ConstElemRange & active_local_element_stored_range() const;
    1894             : 
    1895             :   /**
    1896             :    * Clears stored ranges, to indicate that the mesh has changed and
    1897             :    * they should be regenerated when next needed.
    1898             :    */
    1899             :   void clear_stored_ranges();
    1900             : 
    1901             :   /**
    1902             :    * \returns A writable reference to the whole subdomain name map
    1903             :    */
    1904        1478 :   std::map<subdomain_id_type, std::string> & set_subdomain_name_map ()
    1905       23679 :   { this->unset_has_synched_subdomain_name_map(); return _block_id_to_name; }
    1906         445 :   const std::map<subdomain_id_type, std::string> & get_subdomain_name_map () const
    1907         721 :   { return _block_id_to_name; }
    1908             : 
    1909             :   typedef std::vector<std::pair<std::pair<const Elem *, unsigned int>, Real>> constraint_rows_mapped_type;
    1910             :   typedef std::map<const Node *, constraint_rows_mapped_type> constraint_rows_type;
    1911             : 
    1912             :   /**
    1913             :    * Constraint rows accessors
    1914             :    */
    1915        8528 :   constraint_rows_type & get_constraint_rows()
    1916      200016 :   { return _constraint_rows; }
    1917             : 
    1918       24853 :   const constraint_rows_type & get_constraint_rows() const
    1919       24853 :   { return _constraint_rows; }
    1920             : 
    1921             :   dof_id_type n_constraint_rows() const;
    1922             : 
    1923             :   /**
    1924             :    * Copy the constraints from the other mesh to this mesh
    1925             :    */
    1926             :   void copy_constraint_rows(const MeshBase & other_mesh);
    1927             : 
    1928             :   /**
    1929             :    * Copy the constraints from the given matrix to this mesh.  The
    1930             :    * \p constraint_operator should be an mxn matrix, where
    1931             :    * m == this->n_nodes() and the operator indexing matches the
    1932             :    * current node indexing.  This may require users to disable mesh
    1933             :    * renumbering in between loading a mesh file and loading a
    1934             :    * constraint matrix which matches it.
    1935             :    *
    1936             :    * If any "constraint" rows in the matrix are unit vectors, the node
    1937             :    * corresponding to that row index will be left unconstrained, and
    1938             :    * will be used to constrain any other nodes which have a non-zero
    1939             :    * in the column index of that unit vector.
    1940             :    *
    1941             :    * For each matrix column index which does not correspond to an
    1942             :    * existing node, a new NodeElem will be added to the mesh on which
    1943             :    * to store the new unconstrained degree(s) of freedom.
    1944             :    *
    1945             :    * If \p precondition_constraint_operator is true, then the values
    1946             :    * of those new unconstrained degrees of freedom may be scaled to
    1947             :    * improve the conditioning of typical PDE matrices integrated on
    1948             :    * constrained mesh elements.
    1949             :    *
    1950             :    * \p T for the constraint_operator in this function should be \p
    1951             :    * Real or \p Number ... and the data should be \p Real - we just
    1952             :    * allow complex \p T for the sake of subclasses which have to be
    1953             :    * configured and compiled with only one runtime option.
    1954             :    */
    1955             :   template <typename T>
    1956             :   void copy_constraint_rows(const SparseMatrix<T> & constraint_operator,
    1957             :                             bool precondition_constraint_operator = false);
    1958             : 
    1959             :   /**
    1960             :    * Prints (from processor 0) all mesh constraint rows.  If \p
    1961             :    * print_nonlocal is true, then each constraint is printed once for
    1962             :    * each processor that knows about it, which may be useful for \p
    1963             :    * DistributedMesh debugging.
    1964             :    */
    1965             :   void print_constraint_rows(std::ostream & os=libMesh::out,
    1966             :                              bool print_nonlocal=false) const;
    1967             : 
    1968             :   /**
    1969             :    * Gets a string reporting all mesh constraint rows local to
    1970             :    * this processor.  If \p print_nonlocal is true, then nonlocal
    1971             :    * constraints which are locally known are included.
    1972             :    */
    1973             :   std::string get_local_constraints(bool print_nonlocal=false) const;
    1974             : 
    1975             : #ifdef LIBMESH_ENABLE_DEPRECATED
    1976             :   /**
    1977             :    * \deprecated This method has ben replaced by \p cache_elem_data which
    1978             :    * caches data in addition to elem dimensions (e.g. elem subdomain ids)
    1979             :    * Search the mesh and cache the different dimensions of the elements
    1980             :    * present in the mesh.  This is done in prepare_for_use(), but can
    1981             :    * be done manually by other classes after major mesh modifications.
    1982             :    */
    1983             :   void cache_elem_dims();
    1984             : #endif // LIBMESH_ENABLE_DEPRECATED
    1985             : 
    1986             :   /*
    1987             :    * Search the mesh and cache data for the elements
    1988             :    * present in the mesh.  This is done in prepare_for_use(), but can
    1989             :    * be done manually by other classes after major mesh modifications.
    1990             :    * Data cached includes:
    1991             :    *   - elem dimensions
    1992             :    *   - elem subdomains
    1993             :    */
    1994             :   void cache_elem_data();
    1995             : 
    1996             :   /**
    1997             :    * libMesh often expects all processors to know about names of all
    1998             :    * subdomain ids, but distributed mesh generators may only know
    1999             :    * about part of a mesh when creating names.  This method can
    2000             :    * synchronize the subdomain id to name map across processors,
    2001             :    * assuming no conflicts exist.  It is called automatically during
    2002             :    * complete_preparation() unless the map is already known to be
    2003             :    * synchronized.
    2004             :    */
    2005             :   void sync_subdomain_name_map();
    2006             : 
    2007             :   /**
    2008             :    * Search the mesh for elements that have a neighboring element
    2009             :    * of dim+1 and set that element as the interior parent
    2010             :    */
    2011             :   void detect_interior_parents();
    2012             : 
    2013             :   /**
    2014             :    * \return A mesh that may own interior parents of elements in this
    2015             :    * mesh.  In most cases this mesh includes its own interior parents,
    2016             :    * but in cases where a separate "interior" mesh was used to create
    2017             :    * this mesh as a distinct lower-dimensional boundary (or boundary
    2018             :    * subset) mesh, the original mesh will be returned here.
    2019             :    */
    2020         156 :   const MeshBase & interior_mesh() const { return *_interior_mesh; }
    2021             : 
    2022             :   /**
    2023             :    * \return A writeable reference to the interior mesh.
    2024             :    */
    2025       34182 :   MeshBase & interior_mesh() { return *_interior_mesh; }
    2026             : 
    2027             :   /**
    2028             :    * Sets the interior mesh.  For advanced use only.
    2029             :    */
    2030        3280 :   void set_interior_mesh(MeshBase & int_mesh) { _interior_mesh = &int_mesh; }
    2031             : 
    2032             :   /**
    2033             :    * \return The cached mesh subdomains. As long as the mesh is prepared, this
    2034             :    * should contain all the subdomain ids across processors. Relies on the mesh
    2035             :    * being prepared
    2036             :    */
    2037             :   const std::set<subdomain_id_type> & get_mesh_subdomains() const
    2038             :   { libmesh_assert(this->is_prepared()); return _mesh_subdomains; }
    2039             : 
    2040             : #ifdef LIBMESH_ENABLE_PERIODIC
    2041             :   /**
    2042             :    * Register a pair of boundaries as disjoint neighbor boundary pairs.
    2043             :    */
    2044             :   void add_disjoint_neighbor_boundary_pairs(const boundary_id_type b1,
    2045             :                                    const boundary_id_type b2,
    2046             :                                    const RealVectorValue & translation);
    2047             : 
    2048             :   PeriodicBoundaries * get_disjoint_neighbor_boundary_pairs();
    2049             : 
    2050             :   const PeriodicBoundaries * get_disjoint_neighbor_boundary_pairs() const;
    2051             : 
    2052             :   void remove_disjoint_boundary_pair(const boundary_id_type b1,
    2053             :                                      const boundary_id_type b2);
    2054             : #endif
    2055             : 
    2056             :   /**
    2057             :    * Flags indicating in what ways a mesh has been prepared for use.
    2058             :    */
    2059             :   struct Preparation
    2060             :   {
    2061             :     /**
    2062             :      * Constructor. Initializes all flags to false.
    2063             :      */
    2064             :     Preparation();
    2065             : 
    2066             :     /**
    2067             :      * Returns true iff all the flags are true.
    2068             :      */
    2069             :     explicit operator bool() const;
    2070             : 
    2071             :     /**
    2072             :      * Set all flags to the "set_all" value.
    2073             :      */
    2074             :     Preparation & operator= (bool set_all);
    2075             : 
    2076             :     /**
    2077             :      * Two Preparation objects are equivalent iff all the flags match,
    2078             :      * regardless of the true/false status of any given flag.
    2079             :      */
    2080             :     bool operator== (const Preparation & other) const;
    2081             :     bool operator!= (const Preparation & other) const;
    2082             : 
    2083             :     bool is_partitioned;
    2084             :     bool has_synched_id_counts;
    2085             :     bool has_neighbor_ptrs;
    2086             :     bool has_cached_elem_data;
    2087             :     bool has_interior_parent_ptrs;
    2088             :     bool has_removed_remote_elements;
    2089             :     bool has_removed_orphaned_nodes;
    2090             :     bool has_boundary_id_sets;
    2091             :     bool has_reinit_ghosting_functors;
    2092             :     bool has_synched_subdomain_name_map;
    2093             :   };
    2094             : 
    2095             : protected:
    2096             : 
    2097             : #ifdef LIBMESH_ENABLE_PERIODIC
    2098             :   /// @brief The disjoint neighbor boundary id pairs.
    2099             :   std::unique_ptr<PeriodicBoundaries> _disjoint_neighbor_boundary_pairs;
    2100             : #endif
    2101             : 
    2102             :   /**
    2103             :    * This class holds the boundary information.  It can store nodes, edges,
    2104             :    * and faces with a corresponding id that facilitates setting boundary
    2105             :    * conditions.
    2106             :    *
    2107             :    * Direct access to this class is now officially deprecated and will
    2108             :    * be removed in future libMesh versions.  Use the \p get_boundary_info()
    2109             :    * accessor instead.
    2110             :    */
    2111             :   std::unique_ptr<BoundaryInfo> boundary_info;
    2112             : 
    2113             :   /**
    2114             :    * Moves any superclass data (e.g. GhostingFunctors that might rely
    2115             :    * on element and nodal data (which is managed by subclasses!)
    2116             :    * being already moved first.
    2117             :    *
    2118             :    * Must be manually called in dofobject-managing subclass move
    2119             :    * operators.
    2120             :    */
    2121             :   void post_dofobject_moves(MeshBase && other_mesh);
    2122             : 
    2123             :   /**
    2124             :    * Helper class to copy cached data, to synchronize with a possibly
    2125             :    * unprepared \p other_mesh
    2126             :    */
    2127             :   void copy_cached_data (const MeshBase & other_mesh);
    2128             : 
    2129             :   /**
    2130             :    * Shim to allow operator == (&) to behave like a virtual function
    2131             :    * without having to be one.
    2132             :    */
    2133             :   virtual bool subclass_locally_equals (const MeshBase & other_mesh) const = 0;
    2134             : 
    2135             :   /**
    2136             :    * Tests for equality of all elements and nodes in the mesh.  Helper
    2137             :    * function for subclass_equals() in unstructured mesh subclasses.
    2138             :    */
    2139             :   bool nodes_and_elements_equal(const MeshBase & other_mesh) const;
    2140             : 
    2141             :   /**
    2142             :    * \returns A writable reference to the number of partitions.
    2143             :    */
    2144       13402 :   unsigned int & set_n_partitions ()
    2145       13402 :   { return _n_parts; }
    2146             : 
    2147             :   /**
    2148             :    * The number of partitions the mesh has.  This is set by
    2149             :    * the partitioners, and may not be changed directly by
    2150             :    * the user.
    2151             :    *
    2152             :    * \note The number of partitions \e need \e not equal
    2153             :    * this->n_processors(), consider for example the case where you
    2154             :    * simply want to partition a mesh on one processor and view the
    2155             :    * result in GMV.
    2156             :    */
    2157             :   unsigned int _n_parts;
    2158             : 
    2159             :   /**
    2160             :    * The default mapping type (typically Lagrange) between master and
    2161             :    * physical space to assign to newly added elements.
    2162             :    */
    2163             :   ElemMappingType _default_mapping_type;
    2164             : 
    2165             :   /**
    2166             :    * The default mapping data (unused with Lagrange, used for nodal
    2167             :    * weight lookup index with rational bases) to assign to newly added
    2168             :    * elements.
    2169             :    */
    2170             :   unsigned char _default_mapping_data;
    2171             : 
    2172             :   /**
    2173             :    * Flags indicating in what ways \p this mesh has been prepared.
    2174             :    */
    2175             :   Preparation _preparation;
    2176             : 
    2177             :   /**
    2178             :    * A cached \p ElemRange for threaded mutation of all semilocal
    2179             :    * elements of this mesh.
    2180             :    *
    2181             :    * This will not actually be built unless needed. Further, since we
    2182             :    * want our \p elem_stored_range() method to be \p const (yet do the
    2183             :    * dynamic allocating) this needs to be mutable.
    2184             :    */
    2185             :   mutable std::unique_ptr<ElemRange> _element_stored_range;
    2186             : 
    2187             :   /**
    2188             :    * A cached \p ConstElemRange for threaded calculation on all
    2189             :    * local elements of this mesh.
    2190             :    *
    2191             :    * This will not actually be built unless needed. Further, since we
    2192             :    * want our \p elem_stored_range() method to be \p const (yet do the
    2193             :    * dynamic allocating) this needs to be mutable.
    2194             :    */
    2195             :   mutable std::unique_ptr<ConstElemRange>
    2196             :     _const_active_local_element_stored_range;
    2197             : 
    2198             :   /**
    2199             :    * A \p PointLocator class for this mesh.
    2200             :    * This will not actually be built unless needed. Further, since we want
    2201             :    * our \p point_locator() method to be \p const (yet do the dynamic allocating)
    2202             :    * this needs to be mutable.  Since the PointLocatorBase::build() member is used,
    2203             :    * and it operates on a constant reference to the mesh, this is OK.
    2204             :    */
    2205             :   mutable std::unique_ptr<PointLocatorBase> _point_locator;
    2206             : 
    2207             :   /**
    2208             :    * Do we count lower dimensional elements in point locator refinement?
    2209             :    * This is relevant in tree-based point locators, for example.
    2210             :    */
    2211             :   bool _count_lower_dim_elems_in_point_locator;
    2212             : 
    2213             :   /**
    2214             :    * A partitioner to use at each prepare_for_use().
    2215             :    *
    2216             :    * This will be built in the constructor of each derived class, but
    2217             :    * can be replaced by the user through the partitioner() accessor.
    2218             :    */
    2219             :   std::unique_ptr<Partitioner> _partitioner;
    2220             : 
    2221             : #ifdef LIBMESH_ENABLE_UNIQUE_ID
    2222             :   /**
    2223             :    * The next available unique id for assigning ids to DOF objects
    2224             :    */
    2225             :   unique_id_type _next_unique_id;
    2226             : #endif
    2227             : 
    2228             :   /**
    2229             :    * Defaulting to \p this, a pointer to the mesh used to generate
    2230             :    * boundary elements on \p this.
    2231             :    */
    2232             :   MeshBase *_interior_mesh;
    2233             : 
    2234             :   /**
    2235             :    * If this is true then no partitioning should be done with the
    2236             :    * possible exception of orphaned nodes.
    2237             :    */
    2238             :   bool _skip_noncritical_partitioning;
    2239             : 
    2240             :   /**
    2241             :    * If this is true then no partitioning should be done.
    2242             :    */
    2243             :   bool _skip_all_partitioning;
    2244             : 
    2245             :   /**
    2246             :    * If this is true then renumbering will be kept to a minimum.
    2247             :    *
    2248             :    * This is set when prepare_for_use() is called.
    2249             :    */
    2250             :   bool _skip_renumber_nodes_and_elements;
    2251             : 
    2252             :   /**
    2253             :    * If this is \p true then we will skip \p find_neighbors in \p prepare_for_use
    2254             :    */
    2255             :   bool _skip_find_neighbors;
    2256             : 
    2257             :   /**
    2258             :    * If this is \p true then we will skip \p detect_interior_parents in \p prepare_for_use
    2259             :    */
    2260             :   bool _skip_detect_interior_parents;
    2261             : 
    2262             :   /**
    2263             :    * If this is false then even on DistributedMesh remote elements
    2264             :    * will not be deleted during mesh preparation.
    2265             :    *
    2266             :    * This is true by default.
    2267             :    */
    2268             :   bool _allow_remote_element_removal;
    2269             : 
    2270             :   /**
    2271             :    * The Exodus reader (and potentially other readers in the future?)
    2272             :    * now supports setting Node and Elem unique_ids based on values
    2273             :    * from within the Exodus file itself, rather than generating them
    2274             :    * automatically in LibMesh. In this case, the unique_ids will not
    2275             :    * necessarily be unique across the set of all _DofObjects_,
    2276             :    * although they should still be unique within the individual sets
    2277             :    * of Elems and Nodes. The reader can therefore set this Mesh flag
    2278             :    * (which defaults to false) to indicate we should be less strict
    2279             :    * when checking the "uniqueness" of unique_ids.
    2280             :    */
    2281             :   bool _allow_node_and_elem_unique_id_overlap;
    2282             : 
    2283             :   /**
    2284             :    * This structure maintains the mapping of named blocks
    2285             :    * for file formats that support named blocks.  Currently
    2286             :    * this is only implemented for ExodusII
    2287             :    */
    2288             :   std::map<subdomain_id_type, std::string> _block_id_to_name;
    2289             : 
    2290             :   /**
    2291             :    * We cache the dimension of the elements present in the mesh.
    2292             :    * So, if we have a mesh with 1D and 2D elements, this structure
    2293             :    * will contain 1 and 2.
    2294             :    */
    2295             :   std::set<unsigned char> _elem_dims;
    2296             : 
    2297             :   /**
    2298             :    * We cache the (default) order of the geometric elements present in
    2299             :    * the mesh.  E.g. if we have a mesh with TRI3 and TRI6 elements,
    2300             :    * this structure will contain FIRST and SECOND.
    2301             :    */
    2302             :   std::set<Order> _elem_default_orders;
    2303             : 
    2304             :   /**
    2305             :    * We cache the maximum nodal order supported by all the mesh's
    2306             :    * elements (the minimum supported_nodal_order() of any element)
    2307             :    */
    2308             :   Order _supported_nodal_order;
    2309             : 
    2310             :   /**
    2311             :    * We cache the subdomain ids of the elements present in the mesh.
    2312             :    */
    2313             :   std::set<subdomain_id_type> _mesh_subdomains;
    2314             : 
    2315             :   /**
    2316             :    * Map from "element set code" to list of set ids to which that element
    2317             :    * belongs (and vice-versa). Remarks:
    2318             :    * 1.) The elemset code is a dof_id_type because (if used) it is
    2319             :    * stored as an extra_integer (named "elemset_code") on all elements,
    2320             :    * and extra_integers are of type dof_id_type. Elements which do not
    2321             :    * belong to any set should be assigned an elemset code of DofObject::invalid_id.
    2322             :    * 2.) Element sets can be thought of as a generalization of the concept
    2323             :    * of a subdomain. Subdomains have the following restrictions:
    2324             :    *   a.) A given element can only belong to a single subdomain
    2325             :    *   b.) When using Exodus file input/output, subdomains are (unfortunately)
    2326             :    *   tied to the concept of exodus element blocks, which consist of a single
    2327             :    *   geometric element type, somewhat limiting their generality.
    2328             :    * 3.) The user is responsible for filling in the values of this map
    2329             :    * in a consistent manner, unless the elemsets are read in from an
    2330             :    * Exodus file, in which case the elemset codes will be set up
    2331             :    * automatically. The codes can basically be chosen arbitrarily,
    2332             :    * with the one requirement that elements which belong to no sets
    2333             :    * should have a set code of DofObject::invalid_id.
    2334             :    * 4.) We also keep a list of all the elemset ids which have been added in
    2335             :    * order to support O(1) performance behavior in n_elemsets() calls.
    2336             :    */
    2337             :   std::map<dof_id_type, const MeshBase::elemset_type *> _elemset_codes;
    2338             :   std::map<MeshBase::elemset_type, dof_id_type> _elemset_codes_inverse_map;
    2339             :   MeshBase::elemset_type _all_elemset_ids;
    2340             : 
    2341             :   /**
    2342             :    * The "spatial dimension" of the Mesh.  See the documentation for
    2343             :    * Mesh::spatial_dimension() for more information.
    2344             :    */
    2345             :   unsigned char _spatial_dimension;
    2346             : 
    2347             :   /**
    2348             :    * The array of names for integer data associated with each element
    2349             :    * in the mesh
    2350             :    */
    2351             :   std::vector<std::string> _elem_integer_names;
    2352             : 
    2353             :   /**
    2354             :    * The array of default initialization values for integer data
    2355             :    * associated with each element in the mesh
    2356             :    */
    2357             :   std::vector<dof_id_type> _elem_integer_default_values;
    2358             : 
    2359             :   /**
    2360             :    * The array of names for integer data associated with each node
    2361             :    * in the mesh
    2362             :    */
    2363             :   std::vector<std::string> _node_integer_names;
    2364             : 
    2365             :   /**
    2366             :    * The array of default initialization values for integer data
    2367             :    * associated with each node in the mesh
    2368             :    */
    2369             :   std::vector<dof_id_type> _node_integer_default_values;
    2370             : 
    2371             :   /**
    2372             :    * Size extra-integer arrays of all elements in the mesh
    2373             :    */
    2374             :   void size_elem_extra_integers();
    2375             : 
    2376             :   /**
    2377             :    * Size extra-integer arrays of all nodes in the mesh
    2378             :    */
    2379             :   void size_node_extra_integers();
    2380             : 
    2381             :   /**
    2382             :    * Merge extra-integer arrays from an \p other mesh.  Returns two
    2383             :    * mappings from index values in \p other to (possibly newly created)
    2384             :    * index values with the same string name in \p this mesh, the first
    2385             :    * for element integers and the second for node integers.
    2386             :    */
    2387             :   std::pair<std::vector<unsigned int>, std::vector<unsigned int>>
    2388             :     merge_extra_integer_names(const MeshBase & other);
    2389             : 
    2390             :   /**
    2391             :    * The default geometric GhostingFunctor, used to implement standard
    2392             :    * libMesh element ghosting behavior.  We use a base class pointer
    2393             :    * here to avoid dragging in more header dependencies.
    2394             :    */
    2395             :   std::unique_ptr<GhostingFunctor> _default_ghosting;
    2396             : 
    2397             :   /**
    2398             :    * The list of all GhostingFunctor objects to be used when
    2399             :    * distributing a DistributedMesh.
    2400             :    *
    2401             :    * Basically unused by ReplicatedMesh for now, but belongs to
    2402             :    * MeshBase because the cost is trivial.
    2403             :    */
    2404             :   std::vector<GhostingFunctor *> _ghosting_functors;
    2405             : 
    2406             :   /**
    2407             :    * Hang on to references to any GhostingFunctor objects we were
    2408             :    * passed in shared_ptr form
    2409             :    */
    2410             :   std::map<GhostingFunctor *, std::shared_ptr<GhostingFunctor> > _shared_functors;
    2411             : 
    2412             :   // Keep track of any constraint equations that are inherent to the
    2413             :   // mesh, such as FE nodes whose Rational Bernstein values need to be
    2414             :   // constrained in terms of values on spline control nodes.
    2415             :   //
    2416             :   // _constraint_rows[constrained_node][i].first.first is an
    2417             :   // element (e.g. a NodeElem for a spline control node),
    2418             :   // _constraint_rows[constrained_node][i].first.second is the
    2419             :   // local node id of that element which is a constraining node,
    2420             :   // _constraint_rows[constrained_node][i].second is that node's
    2421             :   // constraint coefficient.
    2422             :   constraint_rows_type _constraint_rows;
    2423             : 
    2424             :   /**
    2425             :    * If nonzero, we will call PointLocatorBase::set_close_to_point_tol()
    2426             :    * on any PointLocators that we create.
    2427             :    */
    2428             :   Real _point_locator_close_to_point_tol;
    2429             : 
    2430             :   /**
    2431             :    * The partitioner class is a friend so that it can set
    2432             :    * the number of partitions.
    2433             :    */
    2434             :   friend class Partitioner;
    2435             : 
    2436             :   /**
    2437             :    * The MeshInput classes are friends so that they can set the number
    2438             :    * of partitions.
    2439             :    */
    2440             :   friend class MeshInput<MeshBase>;
    2441             : 
    2442             :   /**
    2443             :    * Make the \p BoundaryInfo class a friend so that
    2444             :    * it can create and interact with \p BoundaryMesh.
    2445             :    */
    2446             :   friend class BoundaryInfo;
    2447             : 
    2448             :   /**
    2449             :    * Make the \p MeshCommunication class a friend so that
    2450             :    * it can directly broadcast *_integer_names
    2451             :    */
    2452             :   friend class MeshCommunication;
    2453             : 
    2454             : 
    2455             :   /**
    2456             :    * The original iterator classes weren't properly const-safe;
    2457             :    * relying on their const-incorrectness is now deprecated.
    2458             :    */
    2459             : #ifdef LIBMESH_ENABLE_DEPRECATED
    2460             : typedef variant_filter_iterator<MeshBase::Predicate, Elem *> elem_filter_iter;
    2461             : 
    2462             : typedef variant_filter_iterator<MeshBase::Predicate,
    2463             :                                 Elem * const,
    2464             :                                 Elem * const &,
    2465             :                                 Elem * const *> const_elem_filter_iter;
    2466             : 
    2467             : typedef variant_filter_iterator<MeshBase::Predicate, Node *> node_filter_iter;
    2468             : 
    2469             : typedef variant_filter_iterator<MeshBase::Predicate,
    2470             :                                 Node * const,
    2471             :                                 Node * const &,
    2472             :                                 Node * const *> const_node_filter_iter;
    2473             : #else
    2474             : typedef variant_filter_iterator<MeshBase::Predicate,
    2475             :                                 Elem * const,
    2476             :                                 Elem * const &,
    2477             :                                 Elem * const *,
    2478             :                                 const Elem * const,
    2479             :                                 const Elem * const &,
    2480             :                                 const Elem * const *> elem_filter_iter;
    2481             : 
    2482             : typedef variant_filter_iterator<MeshBase::Predicate,
    2483             :                                 const Elem * const,
    2484             :                                 const Elem * const &,
    2485             :                                 const Elem * const *> const_elem_filter_iter;
    2486             : 
    2487             : typedef variant_filter_iterator<MeshBase::Predicate,
    2488             :                                 Node * const,
    2489             :                                 Node * const &,
    2490             :                                 Node * const *,
    2491             :                                 const Node * const,
    2492             :                                 const Node * const &,
    2493             :                                 const Node * const *> node_filter_iter;
    2494             : 
    2495             : typedef variant_filter_iterator<MeshBase::Predicate,
    2496             :                                 const Node * const,
    2497             :                                 const Node * const &,
    2498             :                                 const Node * const *> const_node_filter_iter;
    2499             : #endif // LIBMESH_ENABLE_DEPRECATED
    2500             : 
    2501             : };
    2502             : 
    2503             : 
    2504             : 
    2505             : 
    2506             : 
    2507             : 
    2508             : 
    2509             : 
    2510             : 
    2511             : 
    2512             : 
    2513             : /**
    2514             :  * The definition of the element_iterator struct.
    2515             :  */
    2516             : struct
    2517    37083633 : MeshBase::element_iterator : MeshBase::elem_filter_iter
    2518             : {
    2519             :   // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
    2520             :   template <typename PredType, typename IterType>
    2521      625130 :   element_iterator (const IterType & d,
    2522             :                     const IterType & e,
    2523             :                     const PredType & p ) :
    2524    28331686 :     elem_filter_iter(d,e,p) {}
    2525             : };
    2526             : 
    2527             : 
    2528             : 
    2529             : 
    2530             : /**
    2531             :  * The definition of the const_element_iterator struct.  It is similar to the regular
    2532             :  * iterator above, but also provides an additional conversion-to-const ctor.
    2533             :  */
    2534             : struct
    2535    72976462 : MeshBase::const_element_iterator : MeshBase::const_elem_filter_iter
    2536             : {
    2537             :   /**
    2538             :    * Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor.
    2539             :    */
    2540             :   template <typename PredType, typename IterType>
    2541     8582924 :   const_element_iterator (const IterType & d,
    2542             :                           const IterType & e,
    2543             :                           const PredType & p ) :
    2544    42237806 :     const_elem_filter_iter(d,e,p)  {}
    2545             : 
    2546             :   /**
    2547             :    * The conversion-to-const ctor.  Takes a regular iterator and calls the appropriate
    2548             :    * variant_filter_iterator copy constructor.
    2549             :    *
    2550             :    * \note This one is \e not templated!
    2551             :    */
    2552     6291964 :   const_element_iterator (const MeshBase::element_iterator & rhs) :
    2553     3493034 :     const_elem_filter_iter(rhs) {}
    2554             : };
    2555             : 
    2556             : 
    2557             : 
    2558             : 
    2559             : 
    2560             : 
    2561             : 
    2562             : /**
    2563             :  * The definition of the node_iterator struct.
    2564             :  */
    2565             : struct
    2566    12525300 : MeshBase::node_iterator : MeshBase::node_filter_iter
    2567             : {
    2568             :   /**
    2569             :    * Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor.
    2570             :    */
    2571             :   template <typename PredType, typename IterType>
    2572      314398 :   node_iterator (const IterType & d,
    2573             :                  const IterType & e,
    2574             :                  const PredType & p ) :
    2575    11120294 :     node_filter_iter(d,e,p)  {}
    2576             : };
    2577             : 
    2578             : 
    2579             : 
    2580             : 
    2581             : /**
    2582             :  * The definition of the const_node_iterator struct.  It is similar to the regular
    2583             :  * iterator above, but also provides an additional conversion-to-const ctor.
    2584             :  */
    2585             : struct
    2586     7588399 : MeshBase::const_node_iterator : MeshBase::const_node_filter_iter
    2587             : {
    2588             :   /**
    2589             :    * Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor.
    2590             :    */
    2591             :   template <typename PredType, typename IterType>
    2592      251272 :   const_node_iterator (const IterType & d,
    2593             :                        const IterType & e,
    2594             :                        const PredType & p ) :
    2595     7584023 :     const_node_filter_iter(d,e,p)  {}
    2596             : 
    2597             :   /**
    2598             :    * The conversion-to-const ctor.  Takes a regular iterator and calls the appropriate
    2599             :    * variant_filter_iterator copy constructor.
    2600             :    *
    2601             :    * \note This one is *not* templated!
    2602             :    */
    2603       39260 :   const_node_iterator (const MeshBase::node_iterator & rhs) :
    2604       20196 :     const_node_filter_iter(rhs) {}
    2605             : };
    2606             : 
    2607             : 
    2608             : template <typename T>
    2609             : inline
    2610             : unsigned int MeshBase::add_elem_datum(const std::string & name,
    2611             :                                       bool allocate_data,
    2612             :                                       const T * default_value)
    2613             : {
    2614             :   const std::size_t old_size = _elem_integer_names.size();
    2615             : 
    2616             :   unsigned int n_more_integers = (sizeof(T)-1)/sizeof(dof_id_type);
    2617             :   std::vector<dof_id_type> int_data(n_more_integers+1, DofObject::invalid_id);
    2618             :   if (default_value)
    2619             :     std::memcpy(int_data.data(), default_value, sizeof(T));
    2620             : 
    2621             :   unsigned int start_idx = this->add_elem_integer(name, false, int_data[0]);
    2622             :   for (unsigned int i=0; i != n_more_integers; ++i)
    2623             :     this->add_elem_integer(name+"__"+std::to_string(i), false, int_data[i+1]);
    2624             : 
    2625             :   if (allocate_data && old_size != _elem_integer_names.size())
    2626             :     this->size_elem_extra_integers();
    2627             : 
    2628             :   return start_idx;
    2629             : }
    2630             : 
    2631             : 
    2632             : template <typename T>
    2633             : inline
    2634             : std::vector<unsigned int> MeshBase::add_elem_data(const std::vector<std::string> & names,
    2635             :                                                   bool allocate_data,
    2636             :                                                   const std::vector<T> * default_values)
    2637             : {
    2638             :   libmesh_assert(!default_values || default_values->size() == names.size());
    2639             : 
    2640             :   std::vector<unsigned int> returnval(names.size());
    2641             : 
    2642             :   const std::size_t old_size = _elem_integer_names.size();
    2643             : 
    2644             :   for (auto i : index_range(names))
    2645             :     returnval[i] =
    2646             :       this->add_elem_datum<T>(names[i], false,
    2647             :                               default_values ?
    2648             :                               (*default_values)[i] : nullptr);
    2649             : 
    2650             :   if (allocate_data && old_size != _elem_integer_names.size())
    2651             :     this->size_elem_extra_integers();
    2652             : 
    2653             :   return returnval;
    2654             : }
    2655             : 
    2656             : 
    2657             : template <typename T>
    2658             : inline
    2659          72 : unsigned int MeshBase::add_node_datum(const std::string & name,
    2660             :                                       bool allocate_data,
    2661             :                                       const T * default_value)
    2662             : {
    2663          12 :   const std::size_t old_size = _node_integer_names.size();
    2664             : 
    2665           6 :   unsigned int n_more_integers = (sizeof(T)-1)/sizeof(dof_id_type);
    2666          72 :   std::vector<dof_id_type> int_data(n_more_integers+1, DofObject::invalid_id);
    2667          72 :   if (default_value)
    2668          72 :     std::memcpy(int_data.data(), default_value, sizeof(T));
    2669             : 
    2670          78 :   unsigned int start_idx = this->add_node_integer(name, false, int_data[0]);
    2671          36 :   for (unsigned int i=0; i != n_more_integers; ++i)
    2672          36 :     this->add_node_integer(name+"__"+std::to_string(i), false, int_data[i+1]);
    2673             : 
    2674          72 :   if (allocate_data && old_size != _node_integer_names.size())
    2675          72 :     this->size_node_extra_integers();
    2676             : 
    2677          78 :   return start_idx;
    2678             : }
    2679             : 
    2680             : 
    2681             : template <typename T>
    2682             : inline
    2683             : std::vector<unsigned int> MeshBase::add_node_data(const std::vector<std::string> & names,
    2684             :                                                   bool allocate_data,
    2685             :                                                   const std::vector<T> * default_values)
    2686             : {
    2687             :   libmesh_assert(!default_values || default_values->size() == names.size());
    2688             : 
    2689             :   std::vector<unsigned int> returnval(names.size());
    2690             : 
    2691             :   const std::size_t old_size = _node_integer_names.size();
    2692             : 
    2693             :   for (auto i : index_range(names))
    2694             :     returnval[i] =
    2695             :       this->add_node_datum<T>(names[i], false,
    2696             :                               default_values ?
    2697             :                               (*default_values)[i] : nullptr);
    2698             : 
    2699             :   if (allocate_data && old_size != _node_integer_names.size())
    2700             :     this->size_node_extra_integers();
    2701             : 
    2702             :   return returnval;
    2703             : }
    2704             : 
    2705             : 
    2706             : 
    2707             : } // namespace libMesh
    2708             : 
    2709             : #endif // LIBMESH_MESH_BASE_H

Generated by: LCOV version 1.14