libMesh
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
libMesh::DofObject Class Reference

The DofObject defines an abstract base class for objects that have degrees of freedom associated with them. More...

#include <dof_object.h>

Inheritance diagram for libMesh::DofObject:
[legend]

Public Member Functions

 ~DofObject ()=default
 Destructor. More...
 
DofObjectget_old_dof_object ()
 Pointer accessor for previously public old_dof_object. More...
 
const DofObjectget_old_dof_object () const
 
DofObjectget_old_dof_object_ref ()
 As above, but do not use in situations where the old_dof_object may be nullptr, since this function asserts that the old_dof_object is valid before returning a reference to it. More...
 
const DofObjectget_old_dof_object_ref () const
 
void clear_old_dof_object ()
 Sets the old_dof_object to nullptr. More...
 
void set_old_dof_object ()
 Sets the old_dof_object to a copy of this. More...
 
void clear_dofs ()
 Clear the DofMap data structures holding degree of freedom data. More...
 
void invalidate_dofs (const unsigned int sys_num=libMesh::invalid_uint)
 Sets all degree of freedom numbers to invalid_id. More...
 
void invalidate_id ()
 Sets the id to invalid_id. More...
 
void invalidate_processor_id ()
 Sets the processor id to invalid_processor_id. More...
 
void invalidate ()
 Invalidates all the indices for this DofObject. More...
 
unsigned int n_dofs (const unsigned int s, const unsigned int var=libMesh::invalid_uint) const
 
dof_id_type id () const
 
dof_id_typeset_id ()
 
unique_id_type unique_id () const
 
void set_unique_id (unique_id_type new_id)
 Sets the unique_id for this DofObject. More...
 
void set_id (const dof_id_type dofid)
 Sets the id for this DofObject. More...
 
bool valid_id () const
 
bool valid_unique_id () const
 
processor_id_type processor_id () const
 
processor_id_typeprocessor_id ()
 
void processor_id (const processor_id_type pid)
 Sets the processor_id for this DofObject. More...
 
bool valid_processor_id () const
 
unsigned int n_systems () const
 
unsigned int n_pseudo_systems () const
 
void set_n_systems (const unsigned int s)
 Sets the number of systems for this DofObject. More...
 
void set_extra_integer (const unsigned int index, const dof_id_type value)
 Sets the value on this object of the extra integer associated with index, which should have been obtained via a call to MeshBase::add_elem_integer or MeshBase::add_node_integer. More...
 
dof_id_type get_extra_integer (const unsigned int index) const
 Gets the value on this object of the extra integer associated with index, which should have been obtained via a call to MeshBase::add_elem_integer or MeshBase::add_node_integer. More...
 
template<typename T >
void set_extra_datum (const unsigned int index, const T value)
 Sets the value on this object of the extra datum associated with index, which should have been obtained via a call to MeshBase::add_elem_datum or MeshBase::add_node_datum using the same type T. More...
 
template<typename T >
get_extra_datum (const unsigned int index) const
 Gets the value on this object of the extra datum associated with index, which should have been obtained via a call to MeshBase::add_elem_datum or MeshBase::add_node_datum using the same type T. More...
 
void add_system ()
 Adds an additional system to the DofObject. More...
 
unsigned int n_var_groups (const unsigned int s) const
 
unsigned int n_vars (const unsigned int s, const unsigned int vg) const
 
unsigned int n_vars (const unsigned int s) const
 
void set_n_vars_per_group (const unsigned int s, const std::vector< unsigned int > &nvpg)
 Sets number of variables in each group associated with system s for this DofObject. More...
 
unsigned int n_comp (const unsigned int s, const unsigned int var) const
 
unsigned int n_comp_group (const unsigned int s, const unsigned int vg) const
 
void set_n_comp (const unsigned int s, const unsigned int var, const unsigned int ncomp)
 Sets the number of components for Variable var of system s associated with this DofObject. More...
 
void set_n_comp_group (const unsigned int s, const unsigned int vg, const unsigned int ncomp)
 Sets the number of components for VariableGroup vg of system s associated with this DofObject. More...
 
dof_id_type dof_number (const unsigned int s, const unsigned int var, const unsigned int comp) const
 
dof_id_type dof_number (const unsigned int s, const unsigned int vg, const unsigned int vig, const unsigned int comp, const unsigned int n_comp) const
 
std::pair< unsigned int, unsigned intvar_to_vg_and_offset (const unsigned int s, const unsigned int var) const
 
void set_dof_number (const unsigned int s, const unsigned int var, const unsigned int comp, const dof_id_type dn)
 Sets the global degree of freedom number for variable var, component comp for system s associated with this DofObject. More...
 
bool has_dofs (const unsigned int s=libMesh::invalid_uint) const
 
void set_vg_dof_base (const unsigned int s, const unsigned int vg, const dof_id_type db)
 VariableGroup DoF indices are indexed as id = base + var_in_vg*ncomp + comp This method allows for direct access to the base. More...
 
dof_id_type vg_dof_base (const unsigned int s, const unsigned int vg) const
 VariableGroup DoF indices are indexed as id = base + var_in_vg*ncomp + comp This method allows for direct access to the base. More...
 
void add_extra_integers (const unsigned int n_integers)
 Assigns a set of extra integers to this DofObject. More...
 
void add_extra_integers (const unsigned int n_integers, const std::vector< dof_id_type > &default_values)
 Assigns a set of extra integers to this DofObject. More...
 
unsigned int n_extra_integers () const
 Returns how many extra integers are associated to the DofObject. More...
 
bool has_extra_integers () const
 Returns whether extra integers are associated to the DofObject. More...
 
unsigned int packed_indexing_size () const
 If we pack our indices into an buffer for communications, how many ints do we need? More...
 
void unpack_indexing (std::vector< largest_id_type >::const_iterator begin)
 A method for creating our index buffer from packed data - basically with our current implementation we investigate the size term and then copy. More...
 
void pack_indexing (std::back_insert_iterator< std::vector< largest_id_type >> target) const
 A method for creating packed data from our index buffer - basically a copy with prepended size with our current implementation. More...
 
void debug_buffer () const
 Print our buffer for debugging. More...
 
void print_dof_info () const
 Print out info for debugging. More...
 
void set_buffer (const std::vector< dof_id_type > &buf)
 

Static Public Member Functions

static unsigned int unpackable_indexing_size (std::vector< largest_id_type >::const_iterator begin)
 If we have indices packed into an buffer for communications, how much of that buffer applies to this dof object? More...
 
static std::string get_info ()
 Gets a string containing the reference information. More...
 
static void print_info (std::ostream &out_stream=libMesh::out)
 Prints the reference information, by default to libMesh::out. More...
 
static unsigned int n_objects ()
 Prints the number of outstanding (created, but not yet destroyed) objects. More...
 
static void enable_print_counter_info ()
 Methods to enable/disable the reference counter output from print_info(). More...
 
static void disable_print_counter_info ()
 

Static Public Attributes

static constexpr dof_id_type invalid_id = static_cast<dof_id_type>(-1)
 An invalid id to distinguish an uninitialized DofObject. More...
 
static constexpr unique_id_type invalid_unique_id = static_cast<unique_id_type>(-1)
 An invalid unique_id to distinguish an uninitialized DofObject. More...
 
static constexpr processor_id_type invalid_processor_id = static_cast<processor_id_type>(-1)
 An invalid processor_id to distinguish DoFs that have not been assigned to a processor. More...
 

Protected Types

typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 Data structure to log the information. More...
 

Protected Member Functions

 DofObject ()
 Constructor. More...
 
void increment_constructor_count (const std::string &name) noexcept
 Increments the construction counter. More...
 
void increment_destructor_count (const std::string &name) noexcept
 Increments the destruction counter. More...
 

Protected Attributes

std::unique_ptr< DofObjectold_dof_object
 This object on the last mesh. More...
 

Static Protected Attributes

static Counts _counts
 Actually holds the data. More...
 
static Threads::atomic< unsigned int_n_objects
 The number of objects. More...
 
static Threads::spin_mutex _mutex
 Mutual exclusion object to enable thread-safe reference counting. More...
 
static bool _enable_print_counter = true
 Flag to control whether reference count information is printed when print_info is called. More...
 

Private Types

typedef dof_id_type index_t
 
DoF index information. More...
 
typedef std::vector< index_tindex_buffer_t
 

Private Member Functions

 DofObject (const DofObject &)
 "Copy"-constructor. More...
 
std::unique_ptr< DofObjectconstruct (const DofObject *other=nullptr)
 Convenient factory function that calls either the (deep) copy constructor or the default constructor depending on the input arg. More...
 
DofObjectoperator= (const DofObject &dof_obj)
 Deep-copying assignment operator. More...
 
unsigned int var_to_vg (const unsigned int s, const unsigned int var) const
 Utility function - for variable var in system s, figure out what variable group it lives in. More...
 
unsigned int system_var_to_vg_var (const unsigned int s, const unsigned int vg, const unsigned int var) const
 Utility function - for variable var in system s, figure out what variable group it lives in. More...
 
unsigned int start_idx (const unsigned int s) const
 The starting index for system s. More...
 
unsigned int end_idx (const unsigned int s) const
 The ending index for system s. More...
 
unsigned int start_idx_ints () const
 The starting index for an extra_integers pseudosystem. More...
 
unsigned int end_idx_ints () const
 The ending index for an extra_integers pseudosystem. More...
 

Private Attributes

unique_id_type _unique_id
 A globally unique id, guaranteed not to change as the mesh is repartitioned or adapted. More...
 
dof_id_type _id
 The id of the DofObject. More...
 
processor_id_type _processor_id
 The processor_id of the DofObject. More...
 
index_buffer_t _idx_buf
 

Static Private Attributes

static const index_t ncv_magic = 256
 Above we introduced the chimera ncv, which is a hybrid of the form ncv = ncv_magic*nv + nc where nv are the number of identical variables of a given type, and nc is the number of components for this set of variables. More...
 
static const index_t ncv_magic_exp = 8
 

Detailed Description

The DofObject defines an abstract base class for objects that have degrees of freedom associated with them.

Examples of such objects are the Node and Elem classes. This class can not be instantiated, only derived from.

Author
Benjamin S. Kirk
Date
2003, 2011

Definition at line 54 of file dof_object.h.

Member Typedef Documentation

◆ Counts

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information.

The log is identified by the class name.

Definition at line 119 of file reference_counter.h.

◆ index_buffer_t

typedef std::vector<index_t> libMesh::DofObject::index_buffer_t
private

Definition at line 670 of file dof_object.h.

◆ index_t


DoF index information.

This is packed into a contiguous buffer of the following format:

* [hdr end_0 end_1 ... end_{nps-2} (ncv_0 idx_0 ncv_1 idx_1 ... ncv_nv idx_nv)_0
*                                  (ncv_0 idx_0 ncv_1 idx_1 ... ncv_nv idx_nv)_1
*                                   ...
*                                  (ncv_0 idx_0 ncv_1 idx_1 ... ncv_nv idx_nv)_{nps-2} ]
* 

'hdr' determines whether this DofObject has_extra_integers() associated with it; iff so then it is negative.

The total number of "pseudo systems" is nps := abs(hdr).

The total number of true systems is

* ns = hdr,            hdr >= 0
*    = abs(hdr) - 1,   otherwise.
* 

'end_s' is the index past the end of the variable group (or integer) storage for (pseudo) system s.

Note
We specifically do not store the end for the last (pseudo) system - this always _idx_buf.size().

As a first example, consider the case of 4 systems, with 3, 0, 1, 2 variable groups, respectively. The _idx_buf then looks like:

* [4 10 10 12 () (ncv_0 idx_0 ncv_1 idx_1 ncv_2 idx_2) () (ncv_0 idx_0) (ncv_0 idx_0 ncv_1 idx_1)]
* [0  1  2  3         4     5     6     7     8     9         10    11      12    13    14    15]
* 

The ending index for each (pseudo) system is then given by:

* end_s = _idx_buf.size(),                        s == (nps-1),
*       = _idx_buf[s+1] + has_extra_integers(),   otherwise.
* 

The starting indices are not specifically stored, but rather inferred as follows:

start_s = abs(_idx_buf[s])

Now, the defining characteristic of the VariableGroup is that it supports an arbitrary number of variables of the same type. At the DofObject level, what that means is that each Variable in the VariableGroup will have the same number of nonzero components, and they can all be indexed from the same base number. We use this information in the ncv_# and idx_# entries as follows:

ncv_# = n_vars*ncv_magic + n_comp for variable group # idx_# = base_offset for variable group #

the DoF index for a particular component c of variable v within that group is then given by

idx_var = idx_# + n_comp*v + c

Note
There is a subtlety here - "variable v within that group" usually means nothing to the user. This class is either indexed with variable group numbers, or variable numbers counted within the system. So for a system with 2 variable groups, 4 and 8 variables each, the 5th variable in the system is the 1st variable in 2nd variable group. (Now of course 0-base everything... but you get the idea.)

When hdr is negative when cast to a signed type, then we interpret that to mean there exists one pseudo-system following the true systems, one for which the _idx_buf data stores the values associated with add_extra_integer entries, not ncv and idx data associated with system variables. We still return only the number of true systems for n_systems(), but we report has_extra_integers() as true iff hdr is negative, and abs(hdr) will reflect the total number of pseudo-systems, n_systems()+1.

E.g. if we had added two extra integers to the example case above, the _idx_buf then looks like:

* [-5 11 11 13 17 () (ncv_0 idx_0 ncv_1 idx_1 ncv_2 idx_2) () (ncv_0 idx_0) (ncv_0 idx_0 ncv_1 idx_1) (xtra1 xtra2)]
* [0   1  2  3  4         5     6     7     8     9    10         11    12      13    14    15    16      17    18]
* 

Definition at line 669 of file dof_object.h.

Constructor & Destructor Documentation

◆ DofObject() [1/2]

libMesh::DofObject::DofObject ( )
inlineprotected

Constructor.

Protected so that you can't instantiate one of these except as a part of a Node or Elem.

Definition at line 718 of file dof_object.h.

References invalidate().

Referenced by construct().

718  :
719 #ifdef LIBMESH_ENABLE_UNIQUE_ID
721 #endif
722  _id (invalid_id),
724 {
725  this->invalidate();
726 }
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:484
static constexpr unique_id_type invalid_unique_id
An invalid unique_id to distinguish an uninitialized DofObject.
Definition: dof_object.h:478
dof_id_type _id
The id of the DofObject.
Definition: dof_object.h:574
void invalidate()
Invalidates all the indices for this DofObject.
Definition: dof_object.h:779
unique_id_type _unique_id
A globally unique id, guaranteed not to change as the mesh is repartitioned or adapted.
Definition: dof_object.h:568
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:473
processor_id_type _processor_id
The processor_id of the DofObject.
Definition: dof_object.h:585

◆ ~DofObject()

libMesh::DofObject::~DofObject ( )
default

Destructor.

◆ DofObject() [2/2]

libMesh::DofObject::DofObject ( const DofObject dof_obj)
private

"Copy"-constructor.

Does not copy old_dof_object, but leaves it null in the new object.

Definition at line 27 of file dof_object.C.

References dof_number(), libMesh::make_range(), n_comp(), n_systems(), n_var_groups(), and n_vars().

27  :
28  ReferenceCountedObject<DofObject>(),
29 #ifdef LIBMESH_ENABLE_UNIQUE_ID
30  _unique_id (dof_obj._unique_id),
31 #endif
32  _id (dof_obj._id),
33  _processor_id (dof_obj._processor_id),
34  _idx_buf (dof_obj._idx_buf)
35 {
36  // DO NOT copy old_dof_object, because this isn't a *real* copy
37  // constructor, it's a "copy almost everything" constructor that
38  // is intended to be used solely for internal construction of
39  // old_dof_object, never for a true deep copy where the newly
40  // created object really matches the source object.
41 
42  // Check that everything worked
43 #ifdef DEBUG
44 
45  libmesh_assert_equal_to (this->n_systems(), dof_obj.n_systems());
46 
47  for (auto s : make_range(this->n_systems()))
48  {
49  libmesh_assert_equal_to (this->n_vars(s), dof_obj.n_vars(s));
50  libmesh_assert_equal_to (this->n_var_groups(s), dof_obj.n_var_groups(s));
51 
52  for (auto vg : make_range(this->n_var_groups(s)))
53  libmesh_assert_equal_to (this->n_vars(s,vg), dof_obj.n_vars(s,vg));
54 
55  for (auto v : make_range(this->n_vars(s)))
56  {
57  libmesh_assert_equal_to (this->n_comp(s,v), dof_obj.n_comp(s,v));
58 
59  for (auto c : make_range(this->n_comp(s,v)))
60  libmesh_assert_equal_to (this->dof_number(s,v,c), dof_obj.dof_number(s,v,c));
61  }
62  }
63 
64 #endif
65 }
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Definition: dof_object.h:1008
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:978
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
dof_id_type _id
The id of the DofObject.
Definition: dof_object.h:574
unique_id_type _unique_id
A globally unique id, guaranteed not to change as the mesh is repartitioned or adapted.
Definition: dof_object.h:568
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176
index_buffer_t _idx_buf
Definition: dof_object.h:671
processor_id_type _processor_id
The processor_id of the DofObject.
Definition: dof_object.h:585

Member Function Documentation

◆ add_extra_integers() [1/2]

void libMesh::DofObject::add_extra_integers ( const unsigned int  n_integers)

Assigns a set of extra integers to this DofObject.

There will now be n_integers associated; this replaces, not augments, any previous count.

Any newly-added values will initially be DofObject::invalid_id

If non-integer data is in the set, each datum of type T should be counted sizeof(T)/sizeof(dof_id_type) times in n_integers.

Definition at line 482 of file dof_object.C.

References _idx_buf, invalid_id, and n_extra_integers().

Referenced by libMesh::ReplicatedMesh::add_elem(), libMesh::DistributedMesh::add_elem(), add_extra_integers(), libMesh::ReplicatedMesh::add_node(), libMesh::DistributedMesh::add_node(), libMesh::ReplicatedMesh::add_point(), libMesh::UnstructuredMesh::all_first_order(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::UnstructuredMesh::create_submesh(), libMesh::ReplicatedMesh::insert_elem(), libMesh::DistributedMesh::insert_elem(), DofObjectTest< Node >::testAddExtraData(), DofObjectTest< Node >::testAddSystemExtraInts(), DofObjectTest< Node >::testSetNSystemsExtraInts(), and DofObjectTest< Node >::testSetNVariableGroupsExtraInts().

483 {
484  if (_idx_buf.empty())
485  {
486  if (n_integers)
487  {
488  _idx_buf.resize(n_integers+1, DofObject::invalid_id);
489  _idx_buf[0] = dof_id_type(-1);
490  }
491  return;
492  }
493  else
494  {
495  const int hdr = dof_id_signed_type(_idx_buf[0]);
496 
497  // We already have some extra integers, but may need more or
498  // less now.
499  if (hdr < 0)
500  {
501  const unsigned int old_n_integers = this->n_extra_integers();
502  if (n_integers != old_n_integers)
503  {
504  // Make or remove space as needed by count change
505  _idx_buf.resize(_idx_buf.size()+n_integers-old_n_integers, DofObject::invalid_id);
506 
507  // The start index for the extra integers is unchanged.
508  }
509  }
510  else if (n_integers)
511  // We had no extra integers, but need to add some
512  {
513  // Mark the DofObject as holding extra integers
514  _idx_buf[0] = dof_id_type(-hdr-1);
515 
516  // Insert the integer start position
517  DofObject::index_buffer_t::iterator it = _idx_buf.begin() + hdr;
518  _idx_buf.insert(it, _idx_buf.size()+1);
519 
520  // Increment the previous system start positions to account
521  // for the new header entry creating an offset
522  for (int i=1; i<hdr; i++)
523  _idx_buf[i]++;
524 
525  // Append space for extra integers
526  _idx_buf.resize(_idx_buf.size()+n_integers, DofObject::invalid_id);
527  }
528  }
529 }
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:473
int8_t dof_id_signed_type
Definition: id_types.h:68
unsigned int n_extra_integers() const
Returns how many extra integers are associated to the DofObject.
Definition: dof_object.h:1146
index_buffer_t _idx_buf
Definition: dof_object.h:671
uint8_t dof_id_type
Definition: id_types.h:67

◆ add_extra_integers() [2/2]

void libMesh::DofObject::add_extra_integers ( const unsigned int  n_integers,
const std::vector< dof_id_type > &  default_values 
)

Assigns a set of extra integers to this DofObject.

There will now be n_integers associated; this replaces, not augments, any previous count.

Any newly-added values will be copied from default_values.

If non-integer data is in the set, each datum of type T should be counted sizeof(T)/sizeof(dof_id_type) times in n_integers, and its data should be expressed in default_values as per memcpy.

Definition at line 534 of file dof_object.C.

References _idx_buf, add_extra_integers(), and n_extra_integers().

536 {
537  libmesh_assert_equal_to(n_integers, default_values.size());
538 
539  const unsigned int n_old_integers = this->n_extra_integers();
540  this->add_extra_integers(n_integers);
541  if (n_integers > n_old_integers)
542  {
543  const unsigned int n_more_integers = n_integers - n_old_integers;
544  std::copy(default_values.begin()+n_old_integers,
545  default_values.end(),
546  _idx_buf.end()-n_more_integers);
547  }
548 }
void add_extra_integers(const unsigned int n_integers)
Assigns a set of extra integers to this DofObject.
Definition: dof_object.C:482
unsigned int n_extra_integers() const
Returns how many extra integers are associated to the DofObject.
Definition: dof_object.h:1146
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ add_system()

void libMesh::DofObject::add_system ( )

Adds an additional system to the DofObject.

Definition at line 187 of file dof_object.C.

References _idx_buf, has_extra_integers(), n_systems(), n_var_groups(), n_vars(), and set_n_systems().

Referenced by DofObjectTest< Node >::testAddSystemExtraInts().

188 {
189  // quick return?
190  if (this->n_systems() == 0)
191  {
192  this->set_n_systems(1);
193  return;
194  }
195 
196  // cache this value before we screw it up!
197  const unsigned int ns_orig = this->n_systems();
198 
199  DofObject::index_buffer_t::iterator it = _idx_buf.begin() + ns_orig;
200 
201  // Create the entry for the new system indicating 0 variables.
202  //
203  // increment the number of systems and the offsets for each of
204  // the systems including the new one we just added.
205  if (this->has_extra_integers())
206  {
207  // this inserts the extra_integers' start position as the start
208  // position for the new system. We'll increment all those
209  // counts in one sweep next, to account for header expansion.
210  _idx_buf.insert(it, *it);
211 
212  _idx_buf[0]--;
213  for (unsigned int i=1; i<ns_orig+2; i++)
214  {
215  libmesh_assert_less(i, _idx_buf.size());
216  _idx_buf[i]++;
217  }
218  }
219  else
220  {
221  // this inserts the current vector size at the position for the
222  // new system
223  _idx_buf.insert(it, cast_int<dof_id_type>(_idx_buf.size()));
224 
225  for (unsigned int i=0; i<ns_orig+1; i++)
226  {
227  libmesh_assert_less(i, _idx_buf.size());
228  _idx_buf[i]++;
229  }
230  }
231 
232  libmesh_assert_equal_to (this->n_systems(), (ns_orig+1));
233  libmesh_assert_equal_to (this->n_vars(ns_orig), 0);
234  libmesh_assert_equal_to (this->n_var_groups(ns_orig), 0);
235 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
bool has_extra_integers() const
Returns whether extra integers are associated to the DofObject.
Definition: dof_object.h:1164
void set_n_systems(const unsigned int s)
Sets the number of systems for this DofObject.
Definition: dof_object.C:142
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ clear_dofs()

void libMesh::DofObject::clear_dofs ( )
inline

Clear the DofMap data structures holding degree of freedom data.

If any extra integers are associated with this DofObject, their count and values are unchanged.

Definition at line 789 of file dof_object.h.

References set_n_systems().

790 {
791  this->set_n_systems(0);
792 }
void set_n_systems(const unsigned int s)
Sets the number of systems for this DofObject.
Definition: dof_object.C:142

◆ clear_old_dof_object()

void libMesh::DofObject::clear_old_dof_object ( )

Sets the old_dof_object to nullptr.

Definition at line 120 of file dof_object.C.

References old_dof_object.

Referenced by operator=(), set_old_dof_object(), and unpack_indexing().

121 {
122  this->old_dof_object.reset(nullptr);
123 }
std::unique_ptr< DofObject > old_dof_object
This object on the last mesh.
Definition: dof_object.h:88

◆ construct()

std::unique_ptr< DofObject > libMesh::DofObject::construct ( const DofObject other = nullptr)
inlineprivate

Convenient factory function that calls either the (deep) copy constructor or the default constructor depending on the input arg.

Like the copy constructor, this function is also private. We can't use std::make_unique to construct a DofObject since the copy constructor is private, but we can at least encapsulate the code which calls "new" directly.

Definition at line 732 of file dof_object.h.

References DofObject().

Referenced by operator=(), set_old_dof_object(), and unpack_indexing().

733 {
734  return other
735  ? std::unique_ptr<DofObject>(new DofObject(*other))
736  : std::unique_ptr<DofObject>(new DofObject());
737 }
DofObject()
Constructor.
Definition: dof_object.h:718

◆ debug_buffer()

void libMesh::DofObject::debug_buffer ( ) const

Print our buffer for debugging.

Definition at line 652 of file dof_object.C.

References _idx_buf, libMesh::MeshTools::Generation::Private::idx(), and libMesh::out.

653 {
654  libMesh::out << " [ ";
655  for (const auto & idx : _idx_buf)
656  libMesh::out << idx << " ";
657  libMesh::out << "]\n";
658 }
OStreamProxy out
index_buffer_t _idx_buf
Definition: dof_object.h:671
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)
A useful inline function which replaces the macros used previously.

◆ disable_print_counter_info()

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 100 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

101 {
102  _enable_print_counter = false;
103  return;
104 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

◆ dof_number() [1/2]

dof_id_type libMesh::DofObject::dof_number ( const unsigned int  s,
const unsigned int  var,
const unsigned int  comp 
) const
inline
Returns
The global degree of freedom number for variable var, component comp for system s associated with this DofObject

When partitioning and DoF numbering have been performed by libMesh, every current DoF on this DofObject will belong to its processor.

Definition at line 1008 of file dof_object.h.

References n_comp(), n_comp_group(), n_systems(), n_vars(), and var_to_vg_and_offset().

Referenced by libMesh::DofMap::_dof_indices(), libMesh::DofMap::_node_dof_indices(), libMesh::DofMap::allgather_recursive_constraints(), assemble_matrix_and_rhs(), assemble_shell(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::VariationalSmootherConstraint::constrain_node_to_line(), libMesh::VariationalSmootherConstraint::constrain_node_to_plane(), libMesh::DofMap::constrain_p_dofs(), libMesh::Nemesis_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::Nemesis_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::dof_indices(), DofObject(), libMesh::OldSolutionCoefs< Output, point_output >::eval_at_node(), libMesh::OldSolutionValue< Output, point_output >::eval_at_node(), libMesh::OldSolutionCoefs< Output, point_output >::eval_mixed_derivatives(), libMesh::OldSolutionValue< Output, point_output >::eval_mixed_derivatives(), libMesh::OldSolutionCoefs< Output, point_output >::eval_old_dofs(), libMesh::OldSolutionValue< Output, point_output >::eval_old_dofs(), fill_dirichlet_bc(), libMesh::VariationalSmootherConstraint::fix_node(), libMesh::Node::get_info(), libMesh::Elem::get_info(), libMesh::DofMap::local_variable_indices(), main(), libMesh::DofMap::old_dof_indices(), libMesh::BuildProjectionList::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectVertices::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectEdges::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectInteriors::operator()(), operator=(), print_dof_info(), libMesh::DofMap::process_mesh_constraint_rows(), LinearElasticityWithContact::residual_and_jacobian(), libMesh::HPCoarsenTest::select_refinement(), set_dof_number(), libMesh::PetscPreconditioner< T >::set_hypre_ads_data(), libMesh::PetscPreconditioner< T >::set_hypre_ams_data(), libMesh::DofMap::set_nonlocal_dof_objects(), ParsedFEMFunctionTest::setUp(), DofObjectTest< Node >::testJensEftangBug(), DofObjectTest< Node >::testManualDofCalculation(), libMesh::BoundaryVolumeSolutionTransfer::transfer_boundary_volume(), libMesh::DTKAdapter::update_variable_values(), and libMesh::Nemesis_IO_Helper::write_nodal_solution().

1011 {
1012  libmesh_assert_less (s, this->n_systems());
1013  libmesh_assert_less (var, this->n_vars(s));
1014  libmesh_assert_less (comp, this->n_comp(s,var));
1015 
1016  const std::pair<unsigned int, unsigned int>
1017  vg_vig = this->var_to_vg_and_offset(s,var);
1018 
1019  const unsigned int
1020  n_comp = this->n_comp_group(s,vg_vig.first);
1021 
1022  return this->dof_number(s, vg_vig.first, vg_vig.second,
1023  comp, n_comp);
1024 }
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Definition: dof_object.h:1008
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:978
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
std::pair< unsigned int, unsigned int > var_to_vg_and_offset(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:1176
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:991

◆ dof_number() [2/2]

dof_id_type libMesh::DofObject::dof_number ( const unsigned int  s,
const unsigned int  vg,
const unsigned int  vig,
const unsigned int  comp,
const unsigned int  n_comp 
) const
inline
Returns
The global degree of freedom number for variable group vg, variable index vig within the group, component comp out of n_comp, for system s on this DofObject

Even users who need to call dof_number from user code probably don't want to call this overload.

Definition at line 1029 of file dof_object.h.

References _idx_buf, invalid_id, n_comp(), n_systems(), n_var_groups(), n_vars(), and start_idx().

1034 {
1035  libmesh_assert_less (s, this->n_systems());
1036  libmesh_assert_less (vg, this->n_var_groups(s));
1037  libmesh_assert_less (vig, this->n_vars(s,vg));
1038 
1039  const unsigned int
1040  start_idx_sys = this->start_idx(s);
1041 
1042  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());
1043 
1044  const dof_id_type
1045  base_idx = _idx_buf[start_idx_sys + 2*vg + 1];
1046 
1047  // if the first component is invalid, they
1048  // are all invalid
1049  if (base_idx == invalid_id)
1050  return invalid_id;
1051 
1052  // otherwise the index is the first component
1053  // index augmented by the component number
1054  else
1055  return cast_int<dof_id_type>(base_idx + vig*n_comp + comp);
1056 }
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:978
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:473
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
unsigned int start_idx(const unsigned int s) const
The starting index for system s.
Definition: dof_object.h:1225
index_buffer_t _idx_buf
Definition: dof_object.h:671
uint8_t dof_id_type
Definition: id_types.h:67

◆ enable_print_counter_info()

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info().

Enabled by default.

Definition at line 94 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

Referenced by libMesh::LibMeshInit::~LibMeshInit().

95 {
96  _enable_print_counter = true;
97  return;
98 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

◆ end_idx()

unsigned int libMesh::DofObject::end_idx ( const unsigned int  s) const
inlineprivate

The ending index for system s.

Definition at line 1236 of file dof_object.h.

References _idx_buf, n_pseudo_systems(), and n_systems().

Referenced by n_var_groups(), and set_n_vars_per_group().

1237 {
1238  libmesh_assert_less (s, this->n_systems());
1239  libmesh_assert_less (s, _idx_buf.size());
1240 
1241  return ((s+1) == this->n_pseudo_systems()) ?
1242  cast_int<unsigned int>(_idx_buf.size()) :
1243  cast_int<unsigned int>(_idx_buf[s+1]);
1244 }
unsigned int n_pseudo_systems() const
Definition: dof_object.h:923
unsigned int n_systems() const
Definition: dof_object.h:913
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ end_idx_ints()

unsigned int libMesh::DofObject::end_idx_ints ( ) const
inlineprivate

The ending index for an extra_integers pseudosystem.

Definition at line 1263 of file dof_object.h.

References _idx_buf, has_extra_integers(), and libMesh::libmesh_assert().

1264 {
1266 
1267  return cast_int<unsigned int>(_idx_buf.size());
1268 }
libmesh_assert(ctx)
bool has_extra_integers() const
Returns whether extra integers are associated to the DofObject.
Definition: dof_object.h:1164
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ get_extra_datum()

template<typename T >
T libMesh::DofObject::get_extra_datum ( const unsigned int  index) const
inline

Gets the value on this object of the extra datum associated with index, which should have been obtained via a call to MeshBase::add_elem_datum or MeshBase::add_node_datum using the same type T.

Definition at line 1122 of file dof_object.h.

References _idx_buf, n_extra_integers(), n_systems(), and start_idx_ints().

Referenced by libMesh::MeshTools::Modification::all_rbb(), libMesh::Elem::get_info(), libMesh::VTKIO::nodes_to_vtk(), libMesh::rational_fe_shape(), libMesh::rational_fe_shape_deriv(), libMesh::rational_fe_shape_second_deriv(), libMesh::rational_fe_weighted_shapes(), libMesh::rational_fe_weighted_shapes_derivs(), libMesh::ExodusII_IO::read(), and DofObjectTest< Node >::testAddExtraData().

1123 {
1124 #ifndef NDEBUG
1125  const unsigned int n_more_integers = (sizeof(T)-1)/sizeof(dof_id_type);
1126 #endif
1127  libmesh_assert_less(index+n_more_integers, this->n_extra_integers());
1128  libmesh_assert_less(this->n_systems(), _idx_buf.size());
1129 
1130  const unsigned int start_idx_i = this->start_idx_ints();
1131 
1132  libmesh_assert_less(start_idx_i+index+n_more_integers, _idx_buf.size());
1133  T returnval;
1134  std::memcpy(&returnval, &_idx_buf[start_idx_i+index], sizeof(T));
1135  return returnval;
1136 }
unsigned int start_idx_ints() const
The starting index for an extra_integers pseudosystem.
Definition: dof_object.h:1249
unsigned int n_systems() const
Definition: dof_object.h:913
unsigned int n_extra_integers() const
Returns how many extra integers are associated to the DofObject.
Definition: dof_object.h:1146
index_buffer_t _idx_buf
Definition: dof_object.h:671
uint8_t dof_id_type
Definition: id_types.h:67

◆ get_extra_integer()

dof_id_type libMesh::DofObject::get_extra_integer ( const unsigned int  index) const
inline

Gets the value on this object of the extra integer associated with index, which should have been obtained via a call to MeshBase::add_elem_integer or MeshBase::add_node_integer.

Definition at line 1078 of file dof_object.h.

References _idx_buf, n_extra_integers(), n_systems(), and start_idx_ints().

Referenced by libMesh::MeshTools::Modification::all_tri(), WriteElemsetData::checkByCentroid(), libMesh::MeshTools::Modification::flatten(), libMesh::SyncElementIntegers::gather_data(), libMesh::XdrIO::pack_element(), libMesh::CheckpointIO::read_connectivity(), libMesh::SimplexRefiner::refine_via_edges(), set_n_vars_per_group(), DofObjectTest< Node >::testAddExtraData(), DofObjectTest< Node >::testAddSystemExtraInts(), ExtraIntegersTest::testExtraIntegersExodusReading(), DofObjectTest< Node >::testSetNSystemsExtraInts(), DofObjectTest< Node >::testSetNVariableGroupsExtraInts(), and libMesh::XdrIO::write_serialized_nodes().

1079 {
1080  libmesh_assert_less(index, this->n_extra_integers());
1081  libmesh_assert_less(this->n_systems(), _idx_buf.size());
1082 
1083  const unsigned int start_idx_i = this->start_idx_ints();
1084 
1085  libmesh_assert_less(start_idx_i+index, _idx_buf.size());
1086  return _idx_buf[start_idx_i+index];
1087 }
unsigned int start_idx_ints() const
The starting index for an extra_integers pseudosystem.
Definition: dof_object.h:1249
unsigned int n_systems() const
Definition: dof_object.h:913
unsigned int n_extra_integers() const
Returns how many extra integers are associated to the DofObject.
Definition: dof_object.h:1146
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ get_info()

std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().

Referenced by libMesh::ReferenceCounter::print_info().

48 {
49 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50 
51  std::ostringstream oss;
52 
53  oss << '\n'
54  << " ---------------------------------------------------------------------------- \n"
55  << "| Reference count information |\n"
56  << " ---------------------------------------------------------------------------- \n";
57 
58  for (const auto & [name, cd] : _counts)
59  oss << "| " << name << " reference count information:\n"
60  << "| Creations: " << cd.first << '\n'
61  << "| Destructions: " << cd.second << '\n';
62 
63  oss << " ---------------------------------------------------------------------------- \n";
64 
65  return oss.str();
66 
67 #else
68 
69  return "";
70 
71 #endif
72 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
static Counts _counts
Actually holds the data.

◆ get_old_dof_object() [1/2]

DofObject* libMesh::DofObject::get_old_dof_object ( )
inline

◆ get_old_dof_object() [2/2]

const DofObject* libMesh::DofObject::get_old_dof_object ( ) const
inline

Definition at line 97 of file dof_object.h.

References old_dof_object.

97 { return old_dof_object.get(); }
std::unique_ptr< DofObject > old_dof_object
This object on the last mesh.
Definition: dof_object.h:88

◆ get_old_dof_object_ref() [1/2]

DofObject& libMesh::DofObject::get_old_dof_object_ref ( )
inline

As above, but do not use in situations where the old_dof_object may be nullptr, since this function asserts that the old_dof_object is valid before returning a reference to it.

Definition at line 104 of file dof_object.h.

References libMesh::libmesh_assert(), and old_dof_object.

Referenced by libMesh::OldSolutionCoefs< Output, point_output >::eval_old_dofs(), libMesh::OldSolutionValue< Output, point_output >::eval_old_dofs(), and libMesh::DofMap::old_dof_indices().

105  {
107  return *old_dof_object;
108  }
libmesh_assert(ctx)
std::unique_ptr< DofObject > old_dof_object
This object on the last mesh.
Definition: dof_object.h:88

◆ get_old_dof_object_ref() [2/2]

const DofObject& libMesh::DofObject::get_old_dof_object_ref ( ) const
inline

Definition at line 110 of file dof_object.h.

References libMesh::libmesh_assert(), and old_dof_object.

111  {
113  return *old_dof_object;
114  }
libmesh_assert(ctx)
std::unique_ptr< DofObject > old_dof_object
This object on the last mesh.
Definition: dof_object.h:88

◆ has_dofs()

bool libMesh::DofObject::has_dofs ( const unsigned int  s = libMesh::invalid_uint) const
inline
Returns
true if any system has variables which have been assigned, false otherwise.

Definition at line 1202 of file dof_object.h.

References libMesh::invalid_uint, libMesh::make_range(), n_systems(), and n_vars().

Referenced by libMesh::DofMap::old_dof_indices().

1203 {
1204  if (sys == libMesh::invalid_uint)
1205  {
1206  for (auto s : make_range(this->n_systems()))
1207  if (this->n_vars(s))
1208  return true;
1209  }
1210 
1211  else
1212  {
1213  libmesh_assert_less (sys, this->n_systems());
1214 
1215  if (this->n_vars(sys))
1216  return true;
1217  }
1218 
1219  return false;
1220 }
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition: libmesh.h:303
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176

◆ has_extra_integers()

bool libMesh::DofObject::has_extra_integers ( ) const
inline

Returns whether extra integers are associated to the DofObject.

Definition at line 1164 of file dof_object.h.

References _idx_buf.

Referenced by add_system(), end_idx_ints(), set_n_vars_per_group(), start_idx_ints(), DofObjectTest< Node >::testAddExtraData(), DofObjectTest< Node >::testAddSystemExtraInts(), and DofObjectTest< Node >::testSetNSystemsExtraInts().

1165 {
1166  if (_idx_buf.empty())
1167  return 0;
1168 
1169  return (dof_id_signed_type(_idx_buf[0]) < 0);
1170 }
int8_t dof_id_signed_type
Definition: id_types.h:68
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ id()

dof_id_type libMesh::DofObject::id ( ) const
inline
Returns
The id for this DofObject

Definition at line 819 of file dof_object.h.

References _id.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::MeshTools::Subdivision::add_boundary_ghosts(), add_cube_convex_hull_to_mesh(), libMesh::ReplicatedMesh::add_elem(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::TopologyMap::add_node(), libMesh::ReplicatedMesh::add_node(), libMesh::DistributedMesh::add_node(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::ClawSystem::assemble_avg_coupling_matrices(), assemble_ellipticdg(), libMesh::ClawSystem::assemble_jump_coupling_matrix(), libMesh::Node::build(), libMesh::MeshTools::Generation::build_cube(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::MeshTetInterface::check_hull_integrity(), compute_jacobian(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::FEAbstract::compute_periodic_node_constraints(), compute_residual(), libMesh::InfFE< Dim, T_radial, T_map >::compute_shape_functions(), libMesh::MeshBase::copy_constraint_rows(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::ReplicatedMesh::delete_elem(), libMesh::DistributedMesh::delete_elem(), libMesh::ReplicatedMesh::delete_node(), libMesh::DistributedMesh::delete_node(), libMesh::C0Polyhedron::disconnected_clone(), libMesh::Elem::disconnected_clone(), libMesh::StaticCondensationDofMap::dof_indices(), libMesh::DTKAdapter::DTKAdapter(), libMesh::UNVIO::elements_out(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshTools::find_nodal_neighbors(), libMesh::MeshTools::find_nodal_or_face_neighbors(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshTools::Modification::flatten(), libMesh::ReplicatedMesh::get_boundary_points(), libMesh::ReplicatedMesh::get_disconnected_subdomains(), libMesh::Node::get_info(), libMesh::Elem::get_info(), libMesh::MeshBase::get_info(), libMesh::VariationalSmootherConstraint::get_neighbors_for_boundary_constraint(), libMesh::VariationalSmootherConstraint::get_neighbors_for_subdomain_constraint(), libMesh::MeshTetInterface::improve_hull_integrity(), libMesh::ParmetisPartitioner::initialize(), libMesh::TreeNode< N >::insert(), libMesh::TriangulatorInterface::insert_any_extra_boundary_points(), libMesh::ReplicatedMesh::insert_elem(), libMesh::DistributedMesh::insert_elem(), libMesh::Poly2TriTriangulator::insert_refinement_points(), EIM_F::interior_assembly(), AssemblyEIM::interior_assembly(), libMesh::Elem::interior_parent(), libMesh::FEMap::inverse_map(), libMesh::MeshTools::libmesh_assert_valid_amr_elem_ids(), libMesh::MeshTools::libmesh_assert_valid_constraint_rows(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::Tri3Subdivision::local_node_number(), main(), MeshPerElemTest< elem_type >::meshes_equal_enough(), LinearElasticityWithContact::move_mesh(), libMesh::MeshTools::n_connected_components(), libMesh::Elem::node_id(), libMesh::TriangulatorInterface::nodes_to_segments(), libMesh::VTKIO::nodes_to_vtk(), libMesh::CompareElemIdsByLevel::operator()(), libMesh::GhostPointNeighbors::operator()(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectVertices::operator()(), libMesh::CompareDofObjectsByID::operator()(), libMesh::CompareDofObjectsByPIDAndThenID::operator()(), libMesh::BoundaryInfo::operator==(), libMesh::DistributedMesh::own_node(), libMesh::DistributedMesh::parallel_max_elem_id(), libMesh::DistributedMesh::parallel_max_node_id(), libMesh::MetisPartitioner::partition_range(), print_dof_info(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::DistributedMesh::query_elem_ptr(), libMesh::query_ghosting_functors(), libMesh::DistributedMesh::query_node_ptr(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::EquationSystems::redundant_added_side(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::DistributedMesh::renumber_elem(), libMesh::DistributedMesh::renumber_node(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::C0Polyhedron::retriangulate(), libMesh::DofMap::scatter_constraints(), libMesh::StaticCondensation::set_current_elem(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), FETestBase< order, family, elem_type, N_x >::setUp(), libMesh::MeshTools::Modification::smooth(), libMesh::BoundaryInfo::sync(), libMesh::Parallel::sync_dofobject_data_by_id(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id_once(), ElemTest< elem_type >::test_orient_elements(), DefaultCouplingTest::testCoupling(), MixedDimensionMeshTest::testPointLocatorTree(), InfFERadialTest::testRefinement(), DofObjectTest< Node >::testSetId(), DisjointNeighborTest::testTempJump(), libMesh::Elem::topologically_equal(), libMesh::NetGenMeshInterface::triangulate(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::Poly2TriTriangulator::triangulate_current_points(), libMesh::MeshTetInterface::volume_to_surface_mesh(), libMesh::GmshIO::write_mesh(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), and libMesh::XdrIO::write_serialized_nodes().

820 {
821  return _id;
822 }
dof_id_type _id
The id of the DofObject.
Definition: dof_object.h:574

◆ increment_constructor_count()

void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the construction counter.

Should be called in the constructor of any derived class that will be reference counted.

Definition at line 183 of file reference_counter.h.

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

184 {
185  libmesh_try
186  {
187  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
188  std::pair<unsigned int, unsigned int> & p = _counts[name];
189  p.first++;
190  }
191  libmesh_catch (...)
192  {
193  auto stream = libMesh::err.get();
194  stream->exceptions(stream->goodbit); // stream must not throw
195  libMesh::err << "Encountered unrecoverable error while calling "
196  << "ReferenceCounter::increment_constructor_count() "
197  << "for a(n) " << name << " object." << std::endl;
198  std::terminate();
199  }
200 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
OStreamProxy err
static Counts _counts
Actually holds the data.
streamT * get()
Rather than implement every ostream/ios/ios_base function, we&#39;ll be lazy and make esoteric uses go th...
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:30

◆ increment_destructor_count()

void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the destruction counter.

Should be called in the destructor of any derived class that will be reference counted.

Definition at line 207 of file reference_counter.h.

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

208 {
209  libmesh_try
210  {
211  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
212  std::pair<unsigned int, unsigned int> & p = _counts[name];
213  p.second++;
214  }
215  libmesh_catch (...)
216  {
217  auto stream = libMesh::err.get();
218  stream->exceptions(stream->goodbit); // stream must not throw
219  libMesh::err << "Encountered unrecoverable error while calling "
220  << "ReferenceCounter::increment_destructor_count() "
221  << "for a(n) " << name << " object." << std::endl;
222  std::terminate();
223  }
224 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
OStreamProxy err
static Counts _counts
Actually holds the data.
streamT * get()
Rather than implement every ostream/ios/ios_base function, we&#39;ll be lazy and make esoteric uses go th...
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:30

◆ invalidate()

void libMesh::DofObject::invalidate ( )
inline

Invalidates all the indices for this DofObject.

Definition at line 779 of file dof_object.h.

References invalidate_dofs(), invalidate_id(), and invalidate_processor_id().

Referenced by DofObject().

780 {
781  this->invalidate_dofs ();
782  this->invalidate_id ();
783  this->invalidate_processor_id ();
784 }
void invalidate_id()
Sets the id to invalid_id.
Definition: dof_object.h:763
void invalidate_processor_id()
Sets the processor id to invalid_processor_id.
Definition: dof_object.h:771
void invalidate_dofs(const unsigned int sys_num=libMesh::invalid_uint)
Sets all degree of freedom numbers to invalid_id.
Definition: dof_object.h:742

◆ invalidate_dofs()

void libMesh::DofObject::invalidate_dofs ( const unsigned int  sys_num = libMesh::invalid_uint)
inline

Sets all degree of freedom numbers to invalid_id.

Definition at line 742 of file dof_object.h.

References invalid_id, libMesh::make_range(), n_comp_group(), n_systems(), n_var_groups(), and set_vg_dof_base().

Referenced by invalidate().

743 {
744  const unsigned int n_sys = this->n_systems();
745  // If the user does not specify the system number...
746  if (sys_num >= n_sys)
747  {
748  for (auto s : make_range(n_sys))
749  for (auto vg : make_range(this->n_var_groups(s)))
750  if (this->n_comp_group(s,vg))
751  this->set_vg_dof_base(s,vg,invalid_id);
752  }
753  // ...otherwise invalidate the dofs for all systems
754  else
755  for (auto vg : make_range(this->n_var_groups(sys_num)))
756  if (this->n_comp_group(sys_num,vg))
757  this->set_vg_dof_base(sys_num,vg,invalid_id);
758 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
void set_vg_dof_base(const unsigned int s, const unsigned int vg, const dof_id_type db)
VariableGroup DoF indices are indexed as id = base + var_in_vg*ncomp + comp This method allows for di...
Definition: dof_object.h:1273
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:473
unsigned int n_systems() const
Definition: dof_object.h:913
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:991

◆ invalidate_id()

void libMesh::DofObject::invalidate_id ( )
inline

Sets the id to invalid_id.

Definition at line 763 of file dof_object.h.

References invalid_id, and set_id().

Referenced by invalidate(), and DofObjectTest< Node >::testInvalidateId().

764 {
765  this->set_id (invalid_id);
766 }
dof_id_type & set_id()
Definition: dof_object.h:827
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:473

◆ invalidate_processor_id()

void libMesh::DofObject::invalidate_processor_id ( )
inline

Sets the processor id to invalid_processor_id.

Definition at line 771 of file dof_object.h.

References invalid_processor_id, and processor_id().

Referenced by invalidate(), libMesh::Partitioner::set_parent_processor_ids(), and DofObjectTest< Node >::testInvalidateProcId().

772 {
774 }
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:484
processor_id_type processor_id() const
Definition: dof_object.h:881

◆ n_comp()

unsigned int libMesh::DofObject::n_comp ( const unsigned int  s,
const unsigned int  var 
) const
inline
Returns
The number of components for variable var of system s associated with this DofObject. For example, the HIERARCHIC shape functions may have multiple DoFs associated with one node. Another example is the MONOMIALs, where only the elements hold the DoFs. For the different spatial directions, and orders, see FE.

Definition at line 978 of file dof_object.h.

References n_comp_group(), n_systems(), n_vars(), and var_to_vg().

Referenced by libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::DofMap::constrain_p_dofs(), libMesh::Nemesis_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::Nemesis_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::DofMap::distribute_dofs(), dof_number(), DofObject(), libMesh::OldSolutionCoefs< Output, point_output >::eval_at_node(), libMesh::OldSolutionValue< Output, point_output >::eval_at_node(), libMesh::OldSolutionCoefs< Output, point_output >::eval_mixed_derivatives(), libMesh::OldSolutionValue< Output, point_output >::eval_mixed_derivatives(), libMesh::Node::get_info(), libMesh::Elem::get_info(), libMesh::DofMap::local_variable_indices(), main(), n_dofs(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectVertices::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides::operator()(), operator=(), print_dof_info(), set_dof_number(), set_n_vars_per_group(), libMesh::DofMap::set_nonlocal_dof_objects(), and libMesh::Nemesis_IO_Helper::write_nodal_solution().

980 {
981  libmesh_assert_less (s, this->n_systems());
982  libmesh_assert_less (var, this->n_vars(s));
983 
984  return this->n_comp_group(s,this->var_to_vg(s,var));
985 }
unsigned int var_to_vg(const unsigned int s, const unsigned int var) const
Utility function - for variable var in system s, figure out what variable group it lives in...
Definition: dof_object.h:1317
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:991

◆ n_comp_group()

unsigned int libMesh::DofObject::n_comp_group ( const unsigned int  s,
const unsigned int  vg 
) const
inline
Returns
The number of components for VariableGroup vg of system s associated with this DofObject. For example, the HIERARCHIC shape functions may have multiple DoFs associated with one node. Another example is the MONOMIALs, where only the elements hold the DoFs. For the different spatial directions, and orders, see FE.

Definition at line 991 of file dof_object.h.

References _idx_buf, n_systems(), n_var_groups(), ncv_magic, and start_idx().

Referenced by libMesh::DofMap::_dof_indices(), libMesh::DofMap::_node_dof_indices(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::dof_indices(), dof_number(), libMesh::OldSolutionCoefs< Output, point_output >::eval_old_dofs(), libMesh::OldSolutionValue< Output, point_output >::eval_old_dofs(), invalidate_dofs(), n_comp(), libMesh::DofMap::old_dof_indices(), libMesh::BuildProjectionList::operator()(), libMesh::DofMap::reinit(), set_dof_number(), set_n_comp_group(), set_n_vars_per_group(), and libMesh::DofMap::set_nonlocal_dof_objects().

993 {
994  libmesh_assert_less (s, this->n_systems());
995  libmesh_assert_less (vg, this->n_var_groups(s));
996 
997  const unsigned int
998  start_idx_sys = this->start_idx(s);
999 
1000  libmesh_assert_less ((start_idx_sys + 2*vg), _idx_buf.size());
1001 
1002  return (_idx_buf[start_idx_sys + 2*vg] % ncv_magic);
1003 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
unsigned int n_systems() const
Definition: dof_object.h:913
unsigned int start_idx(const unsigned int s) const
The starting index for system s.
Definition: dof_object.h:1225
index_buffer_t _idx_buf
Definition: dof_object.h:671
static const index_t ncv_magic
Above we introduced the chimera ncv, which is a hybrid of the form ncv = ncv_magic*nv + nc where nv a...
Definition: dof_object.h:682

◆ n_dofs()

unsigned int libMesh::DofObject::n_dofs ( const unsigned int  s,
const unsigned int  var = libMesh::invalid_uint 
) const
inline
Returns
The number of degrees of freedom associated with system s directly stored on this object. Optionally only degrees of freedom for variable number var are counted. Does not count degrees of freedom only indirectly associated with this object, such as those stored on an element's nodes when n_dofs() is called on the element itself.

Definition at line 797 of file dof_object.h.

References libMesh::invalid_uint, libMesh::make_range(), n_comp(), n_systems(), and n_vars().

Referenced by libMesh::PetscDMWrapper::add_dofs_helper(), and libMesh::EquationSystems::build_parallel_solution_vector().

799 {
800  libmesh_assert_less (s, this->n_systems());
801 
802  unsigned int num = 0;
803 
804  // Count all variables
805  if (var == libMesh::invalid_uint)
806  for (auto v : make_range(this->n_vars(s)))
807  num += this->n_comp(s,v);
808 
809  // Only count specified variable
810  else
811  num = this->n_comp(s,var);
812 
813  return num;
814 }
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition: libmesh.h:303
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:978
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176

◆ n_extra_integers()

unsigned int libMesh::DofObject::n_extra_integers ( ) const
inline

Returns how many extra integers are associated to the DofObject.

If non-integer data has been associated, each datum of type T counts for sizeof(T)/sizeof(dof_id_type) times in the return value.

Definition at line 1146 of file dof_object.h.

References _idx_buf, and start_idx_ints().

Referenced by add_extra_integers(), libMesh::MeshTools::Modification::all_tri(), libMesh::C0Polyhedron::disconnected_clone(), libMesh::Elem::disconnected_clone(), libMesh::MeshTools::Modification::flatten(), get_extra_datum(), get_extra_integer(), libMesh::CheckpointIO::read_connectivity(), libMesh::CheckpointIO::read_nodes(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::Elem::refine(), libMesh::SimplexRefiner::refine_via_edges(), set_extra_datum(), set_extra_integer(), set_n_systems(), set_n_vars_per_group(), DofObjectTest< Node >::testAddExtraData(), DofObjectTest< Node >::testAddSystemExtraInts(), DofObjectTest< Node >::testSetNSystemsExtraInts(), and DofObjectTest< Node >::testSetNVariableGroupsExtraInts().

1147 {
1148  if (_idx_buf.empty())
1149  return 0;
1150 
1151  const int hdr = dof_id_signed_type(_idx_buf[0]);
1152  if (hdr >= 0)
1153  return 0;
1154 
1155  const unsigned int start_idx_i = this->start_idx_ints();
1156 
1157  return _idx_buf.size() - start_idx_i;
1158 }
unsigned int start_idx_ints() const
The starting index for an extra_integers pseudosystem.
Definition: dof_object.h:1249
int8_t dof_id_signed_type
Definition: id_types.h:68
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ n_objects()

static unsigned int libMesh::ReferenceCounter::n_objects ( )
inlinestaticinherited

Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 85 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

Referenced by libMesh::LibMeshInit::~LibMeshInit().

86  { return _n_objects; }
static Threads::atomic< unsigned int > _n_objects
The number of objects.

◆ n_pseudo_systems()

unsigned int libMesh::DofObject::n_pseudo_systems ( ) const
inline
Returns
The total number of pseudo-systems associated with this DofObject : n_systems(), plus one iff this->has_extra_integers()

Definition at line 923 of file dof_object.h.

References _idx_buf.

Referenced by end_idx(), set_extra_datum(), and set_extra_integer().

924 {
925  const int hdr = _idx_buf.empty() ?
926  0 : cast_int<int>(dof_id_signed_type(_idx_buf[0]));
927  return std::abs(hdr);
928 }
int8_t dof_id_signed_type
Definition: id_types.h:68
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ n_systems()

unsigned int libMesh::DofObject::n_systems ( ) const
inline

◆ n_var_groups()

unsigned int libMesh::DofObject::n_var_groups ( const unsigned int  s) const
inline
Returns
The number of VariableGroup variable groups associated with system s for this DofObject

Definition at line 933 of file dof_object.h.

References end_idx(), n_systems(), and start_idx().

Referenced by add_system(), dof_number(), DofObject(), invalidate_dofs(), n_comp_group(), n_vars(), libMesh::BuildProjectionList::operator()(), operator=(), set_n_comp_group(), set_n_systems(), set_n_vars_per_group(), libMesh::DofMap::set_nonlocal_dof_objects(), set_vg_dof_base(), DofObjectTest< Node >::testSetNVariableGroups(), DofObjectTest< Node >::testSetNVariableGroupsExtraInts(), var_to_vg(), var_to_vg_and_offset(), and vg_dof_base().

934 {
935  libmesh_assert_less (s, this->n_systems());
936 
937  return (this->end_idx(s) - this->start_idx(s)) / 2;
938 }
unsigned int end_idx(const unsigned int s) const
The ending index for system s.
Definition: dof_object.h:1236
unsigned int n_systems() const
Definition: dof_object.h:913
unsigned int start_idx(const unsigned int s) const
The starting index for system s.
Definition: dof_object.h:1225

◆ n_vars() [1/2]

unsigned int libMesh::DofObject::n_vars ( const unsigned int  s,
const unsigned int  vg 
) const
inline
Returns
The number of Variable variables associated with VariableGroup vg in system s for this DofObject

Definition at line 943 of file dof_object.h.

References _idx_buf, n_systems(), n_var_groups(), ncv_magic_exp, and start_idx().

Referenced by add_system(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::DofMap::distribute_dofs(), dof_number(), DofObject(), libMesh::OldSolutionCoefs< Output, point_output >::eval_at_node(), libMesh::OldSolutionValue< Output, point_output >::eval_at_node(), libMesh::OldSolutionCoefs< Output, point_output >::eval_mixed_derivatives(), libMesh::OldSolutionValue< Output, point_output >::eval_mixed_derivatives(), libMesh::Node::get_info(), libMesh::Elem::get_info(), has_dofs(), n_comp(), n_dofs(), n_vars(), libMesh::BuildProjectionList::operator()(), operator=(), print_dof_info(), set_dof_number(), set_n_comp(), set_n_comp_group(), set_n_systems(), set_n_vars_per_group(), libMesh::DofMap::set_nonlocal_dof_objects(), system_var_to_vg_var(), DofObjectTest< Node >::testAddSystemExtraInts(), DofObjectTest< Node >::testSetNVariableGroups(), DofObjectTest< Node >::testSetNVariableGroupsExtraInts(), var_to_vg(), and var_to_vg_and_offset().

945 {
946  libmesh_assert_less (s, this->n_systems());
947  libmesh_assert_less (vg, this->n_var_groups(s));
948 
949  const unsigned int start_idx_sys = this->start_idx(s);
950 
951  libmesh_assert_less ((start_idx_sys + 2*vg), _idx_buf.size());
952 
953  return (cast_int<unsigned int>
954  (_idx_buf[start_idx_sys + 2*vg]) >> ncv_magic_exp);
955 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
unsigned int n_systems() const
Definition: dof_object.h:913
unsigned int start_idx(const unsigned int s) const
The starting index for system s.
Definition: dof_object.h:1225
index_buffer_t _idx_buf
Definition: dof_object.h:671
static const index_t ncv_magic_exp
Definition: dof_object.h:683

◆ n_vars() [2/2]

unsigned int libMesh::DofObject::n_vars ( const unsigned int  s) const
inline
Returns
The number of Variable variables associated with system s for this DofObject

Definition at line 960 of file dof_object.h.

References n_systems(), n_var_groups(), and n_vars().

961 {
962  libmesh_assert_less (s, this->n_systems());
963 
964  const unsigned int nvg = this->n_var_groups(s);
965 
966  unsigned int val=0;
967 
968  for (unsigned int vg=0; vg<nvg; vg++)
969  val += this->n_vars(s,vg);
970 
971  return val;
972 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913

◆ operator=()

DofObject & libMesh::DofObject::operator= ( const DofObject dof_obj)
private

Deep-copying assignment operator.

Definition at line 69 of file dof_object.C.

References _id, _idx_buf, _processor_id, _unique_id, clear_old_dof_object(), construct(), dof_number(), get_old_dof_object(), libMesh::make_range(), n_comp(), n_systems(), n_var_groups(), n_vars(), and old_dof_object.

70 {
71  if (&dof_obj == this)
72  return *this;
73 
74 #ifdef LIBMESH_ENABLE_AMR
75  this->clear_old_dof_object();
76  this->old_dof_object = this->construct(dof_obj.get_old_dof_object());
77 #endif
78 
79  _id = dof_obj._id;
80 #ifdef LIBMESH_ENABLE_UNIQUE_ID
81  _unique_id = dof_obj._unique_id;
82 #endif
83  _processor_id = dof_obj._processor_id;
84  _idx_buf = dof_obj._idx_buf;
85 
86 
87  // Check that everything worked
88 #ifdef DEBUG
89 
90  libmesh_assert_equal_to (this->n_systems(), dof_obj.n_systems());
91 
92  for (auto s : make_range(this->n_systems()))
93  {
94  libmesh_assert_equal_to (this->n_vars(s), dof_obj.n_vars(s));
95  libmesh_assert_equal_to (this->n_var_groups(s), dof_obj.n_var_groups(s));
96 
97  for (auto vg : make_range(this->n_var_groups(s)))
98  libmesh_assert_equal_to (this->n_vars(s,vg), dof_obj.n_vars(s,vg));
99 
100  for (auto v : make_range(this->n_vars(s)))
101  {
102  libmesh_assert_equal_to (this->n_comp(s,v), dof_obj.n_comp(s,v));
103 
104  for (auto c : make_range(this->n_comp(s,v)))
105  libmesh_assert_equal_to (this->dof_number(s,v,c), dof_obj.dof_number(s,v,c));
106  }
107  }
108 
109 #endif
110 
111  return *this;
112 }
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Definition: dof_object.h:1008
std::unique_ptr< DofObject > construct(const DofObject *other=nullptr)
Convenient factory function that calls either the (deep) copy constructor or the default constructor ...
Definition: dof_object.h:732
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:978
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
dof_id_type _id
The id of the DofObject.
Definition: dof_object.h:574
unique_id_type _unique_id
A globally unique id, guaranteed not to change as the mesh is repartitioned or adapted.
Definition: dof_object.h:568
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
void clear_old_dof_object()
Sets the old_dof_object to nullptr.
Definition: dof_object.C:120
std::unique_ptr< DofObject > old_dof_object
This object on the last mesh.
Definition: dof_object.h:88
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176
index_buffer_t _idx_buf
Definition: dof_object.h:671
processor_id_type _processor_id
The processor_id of the DofObject.
Definition: dof_object.h:585

◆ pack_indexing()

void libMesh::DofObject::pack_indexing ( std::back_insert_iterator< std::vector< largest_id_type >>  target) const

A method for creating packed data from our index buffer - basically a copy with prepended size with our current implementation.

Definition at line 634 of file dof_object.C.

References _idx_buf, and old_dof_object.

635 {
636 #ifdef LIBMESH_ENABLE_AMR
637  // We might need to pack old_dof_object too
638  *target++ = (old_dof_object == nullptr) ? 0 : 1;
639 #endif
640 
641  *target++ = _idx_buf.size();
642  std::copy(_idx_buf.begin(), _idx_buf.end(), target);
643 
644 #ifdef LIBMESH_ENABLE_AMR
645  if (old_dof_object)
646  old_dof_object->pack_indexing(target);
647 #endif
648 }
std::unique_ptr< DofObject > old_dof_object
This object on the last mesh.
Definition: dof_object.h:88
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ packed_indexing_size()

unsigned int libMesh::DofObject::packed_indexing_size ( ) const

If we pack our indices into an buffer for communications, how many ints do we need?

Definition at line 552 of file dof_object.C.

References _idx_buf, and old_dof_object.

Referenced by libMesh::Node::packed_size().

553 {
554  return
555  cast_int<unsigned int> (
556 #ifdef LIBMESH_ENABLE_AMR
557  ((old_dof_object == nullptr) ? 0 : old_dof_object->packed_indexing_size()) + 2 +
558 #else
559  1 +
560 #endif
561  _idx_buf.size());
562 }
std::unique_ptr< DofObject > old_dof_object
This object on the last mesh.
Definition: dof_object.h:88
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ print_dof_info()

void libMesh::DofObject::print_dof_info ( ) const

Print out info for debugging.

Definition at line 662 of file dof_object.C.

References dof_number(), id(), libMesh::make_range(), n_comp(), n_systems(), n_vars(), and libMesh::out.

663 {
664  libMesh::out << this->id() << " [ ";
665 
666  for (auto s : make_range(this->n_systems()))
667  {
668  libMesh::out << "s:" << s << " ";
669  for (auto var : make_range(this->n_vars(s)))
670  {
671  libMesh::out << "v:" << var << " ";
672  for (auto comp : make_range(this->n_comp(s,var)))
673  {
674  libMesh::out << "c:" << comp << " dof:" << this->dof_number(s,var,comp) << " ";
675  }
676  }
677  }
678 
679  libMesh::out << "]\n";
680 }
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Definition: dof_object.h:1008
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:978
dof_id_type id() const
Definition: dof_object.h:819
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
OStreamProxy out
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176

◆ print_info()

void libMesh::ReferenceCounter::print_info ( std::ostream &  out_stream = libMesh::out)
staticinherited

Prints the reference information, by default to libMesh::out.

Definition at line 81 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().

Referenced by libMesh::LibMeshInit::~LibMeshInit().

82 {
84  out_stream << ReferenceCounter::get_info();
85 }
static std::string get_info()
Gets a string containing the reference information.
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

◆ processor_id() [1/3]

processor_id_type libMesh::DofObject::processor_id ( ) const
inline
Returns
The processor that this DofObject belongs to.

When partitioning and DoF numbering have been performed by libMesh, every current DoF on this DofObject will belong to its processor.

Definition at line 881 of file dof_object.h.

References _processor_id.

Referenced by NonManifoldTestPartitioner::_do_partition(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DistributedMesh::add_node(), libMesh::MeshRefinement::add_node(), libMesh::ReplicatedMesh::add_point(), libMesh::DistributedMesh::add_point(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::Patch::build_around_element(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::MeshFunction::check_found_elem(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubProjector::construct_projection(), libMesh::MeshBase::copy_constraint_rows(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::DistributedMesh::delete_elem(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::Elem::Elem(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshTools::Modification::flatten(), libMesh::Node::get_info(), libMesh::Elem::get_info(), libMesh::Elem::inherit_data_from(), libMesh::RBEIMConstruction::initialize_qp_data(), libMesh::DistributedMesh::insert_elem(), invalidate_processor_id(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_amr_elem_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), AugmentSparsityOnInterface::mesh_reinit(), MeshPerElemTest< elem_type >::meshes_equal_enough(), libMesh::PeriodicBoundaries::neighbor(), libMesh::RBEIMEvaluation::node_distribute_bfs(), AugmentSparsityOnNodes::operator()(), AugmentSparsityOnInterface::operator()(), OverlappingCouplingFunctor::operator()(), libMesh::GhostPointNeighbors::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SortAndCopy::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectVertices::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectEdges::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectInteriors::operator()(), libMesh::CompareDofObjectsByPIDAndThenID::operator()(), libMesh::DistributedMesh::own_node(), libMesh::XdrIO::pack_element(), libMesh::LinearPartitioner::partition_range(), libMesh::SFCPartitioner::partition_range(), libMesh::CentroidPartitioner::partition_range(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::Polygon::Polygon(), libMesh::Polyhedron::Polyhedron(), libMesh::DofMap::process_mesh_constraint_rows(), processor_id(), libMesh::CheckpointIO::read_connectivity(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::DofMap::scatter_constraints(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), libMesh::Partitioner::set_interface_node_processor_ids_linear(), libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), ParsedFEMFunctionTest::setUp(), libMesh::Partitioner::single_partition_range(), libMesh::Parallel::sync_dofobject_data_by_id(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id_once(), MeshFunctionTest::test_bad_gradient_var_with_out_of_mesh_value(), MeshFunctionTest::test_bad_hessian_var_with_out_of_mesh_value(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), DofObjectTest< Node >::testInvalidateProcId(), EquationSystemsTest::testPostInitAddElem(), DofObjectTest< Node >::testSetProcId(), BoundaryInfoTest::testShellFaceConstraints(), DofObjectTest< Node >::testValidProcId(), libMesh::DTKAdapter::update_variable_values(), NonManifoldGhostingFunctorTest::verify_send_list_entries_helper(), libMesh::GmshIO::write_mesh(), and libMesh::Nemesis_IO_Helper::write_sidesets().

882 {
883  return _processor_id;
884 }
processor_id_type _processor_id
The processor_id of the DofObject.
Definition: dof_object.h:585

◆ processor_id() [2/3]

processor_id_type & libMesh::DofObject::processor_id ( )
inline
Returns
The processor that this DofObject belongs to as a writable reference.

Definition at line 889 of file dof_object.h.

References _processor_id.

890 {
891  return _processor_id;
892 }
processor_id_type _processor_id
The processor_id of the DofObject.
Definition: dof_object.h:585

◆ processor_id() [3/3]

void libMesh::DofObject::processor_id ( const processor_id_type  pid)
inline

Sets the processor_id for this DofObject.

Definition at line 897 of file dof_object.h.

References processor_id().

898 {
899  this->processor_id() = pid;
900 }
processor_id_type processor_id() const
Definition: dof_object.h:881

◆ set_buffer()

void libMesh::DofObject::set_buffer ( const std::vector< dof_id_type > &  buf)
inline

Definition at line 708 of file dof_object.h.

References _idx_buf.

Referenced by DofObjectTest< Node >::testJensEftangBug().

709  { _idx_buf = buf; }
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ set_dof_number()

void libMesh::DofObject::set_dof_number ( const unsigned int  s,
const unsigned int  var,
const unsigned int  comp,
const dof_id_type  dn 
)

Sets the global degree of freedom number for variable var, component comp for system s associated with this DofObject.

Definition at line 446 of file dof_object.C.

References _idx_buf, dof_number(), invalid_id, libMesh::libmesh_assert(), n_comp(), n_comp_group(), n_systems(), n_vars(), start_idx(), system_var_to_vg_var(), and var_to_vg().

450 {
451  libmesh_assert_less (s, this->n_systems());
452  libmesh_assert_less (var, this->n_vars(s));
453  libmesh_assert_less (comp, this->n_comp(s,var));
454 
455  const unsigned int
456  vg = this->var_to_vg(s,var),
457 #ifndef NDEBUG
458  ncg = this->n_comp_group(s,vg),
459 #endif
460  vig = this->system_var_to_vg_var(s,vg,var),
461  start_idx_sys = this->start_idx(s);
462 
463  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());
464 
465  dof_id_type & base_idx = _idx_buf[start_idx_sys + 2*vg + 1];
466 
467  // We intend to change all dof numbers together or not at all
468  if (comp || vig)
469  libmesh_assert ((dn == invalid_id && base_idx == invalid_id) ||
470  (dn == base_idx + vig*ncg + comp));
471 
472  // only explicitly store the base index for vig==0, comp==0
473  else
474  base_idx = dn;
475 
476  libmesh_assert_equal_to (this->dof_number(s, var, comp), dn);
477 }
unsigned int system_var_to_vg_var(const unsigned int s, const unsigned int vg, const unsigned int var) const
Utility function - for variable var in system s, figure out what variable group it lives in...
Definition: dof_object.h:1335
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Definition: dof_object.h:1008
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:978
unsigned int var_to_vg(const unsigned int s, const unsigned int var) const
Utility function - for variable var in system s, figure out what variable group it lives in...
Definition: dof_object.h:1317
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:473
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
libmesh_assert(ctx)
unsigned int start_idx(const unsigned int s) const
The starting index for system s.
Definition: dof_object.h:1225
index_buffer_t _idx_buf
Definition: dof_object.h:671
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:991
uint8_t dof_id_type
Definition: id_types.h:67

◆ set_extra_datum()

template<typename T >
void libMesh::DofObject::set_extra_datum ( const unsigned int  index,
const T  value 
)
inline

Sets the value on this object of the extra datum associated with index, which should have been obtained via a call to MeshBase::add_elem_datum or MeshBase::add_node_datum using the same type T.

Definition at line 1102 of file dof_object.h.

References _idx_buf, n_extra_integers(), n_pseudo_systems(), start_idx_ints(), and value.

Referenced by libMesh::MeshTools::Modification::all_rbb(), libMesh::ExodusII_IO::read(), libMesh::DynaIO::read_mesh(), and DofObjectTest< Node >::testAddExtraData().

1104 {
1105 #ifndef NDEBUG
1106  const unsigned int n_more_integers = (sizeof(T)-1)/sizeof(dof_id_type);
1107 #endif
1108  libmesh_assert_less(index+n_more_integers, this->n_extra_integers());
1109  libmesh_assert_less(this->n_pseudo_systems(), _idx_buf.size());
1110 
1111  const unsigned int start_idx_i = this->start_idx_ints();
1112 
1113  libmesh_assert_less(start_idx_i+index+n_more_integers, _idx_buf.size());
1114  std::memcpy(&_idx_buf[start_idx_i+index], &value, sizeof(T));
1115 }
unsigned int n_pseudo_systems() const
Definition: dof_object.h:923
unsigned int start_idx_ints() const
The starting index for an extra_integers pseudosystem.
Definition: dof_object.h:1249
static const bool value
Definition: xdr_io.C:55
unsigned int n_extra_integers() const
Returns how many extra integers are associated to the DofObject.
Definition: dof_object.h:1146
index_buffer_t _idx_buf
Definition: dof_object.h:671
uint8_t dof_id_type
Definition: id_types.h:67

◆ set_extra_integer()

void libMesh::DofObject::set_extra_integer ( const unsigned int  index,
const dof_id_type  value 
)
inline

Sets the value on this object of the extra integer associated with index, which should have been obtained via a call to MeshBase::add_elem_integer or MeshBase::add_node_integer.

Definition at line 1062 of file dof_object.h.

References _idx_buf, n_extra_integers(), n_pseudo_systems(), start_idx_ints(), and value.

Referenced by libMesh::SyncElementIntegers::act_on_data(), libMesh::BoundaryInfo::add_elements(), libMesh::UnstructuredMesh::all_first_order(), libMesh::UnstructuredMesh::create_submesh(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::CheckpointIO::read_nodes(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::Elem::refine(), DofObjectTest< Node >::testAddExtraData(), DofObjectTest< Node >::testAddSystemExtraInts(), DofObjectTest< Node >::testSetNSystemsExtraInts(), and DofObjectTest< Node >::testSetNVariableGroupsExtraInts().

1064 {
1065  libmesh_assert_less(index, this->n_extra_integers());
1066  libmesh_assert_less(this->n_pseudo_systems(), _idx_buf.size());
1067 
1068  const unsigned int start_idx_i = this->start_idx_ints();
1069 
1070  libmesh_assert_less(start_idx_i+index, _idx_buf.size());
1071  _idx_buf[start_idx_i+index] = value;
1072 }
unsigned int n_pseudo_systems() const
Definition: dof_object.h:923
unsigned int start_idx_ints() const
The starting index for an extra_integers pseudosystem.
Definition: dof_object.h:1249
static const bool value
Definition: xdr_io.C:55
unsigned int n_extra_integers() const
Returns how many extra integers are associated to the DofObject.
Definition: dof_object.h:1146
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ set_id() [1/2]

dof_id_type & libMesh::DofObject::set_id ( )
inline

◆ set_id() [2/2]

void libMesh::DofObject::set_id ( const dof_id_type  dofid)
inline

Sets the id for this DofObject.

Definition at line 192 of file dof_object.h.

References set_id().

193  { this->set_id() = dofid; }
dof_id_type & set_id()
Definition: dof_object.h:827

◆ set_n_comp()

void libMesh::DofObject::set_n_comp ( const unsigned int  s,
const unsigned int  var,
const unsigned int  ncomp 
)

Sets the number of components for Variable var of system s associated with this DofObject.

Definition at line 377 of file dof_object.C.

References n_systems(), n_vars(), set_n_comp_group(), and var_to_vg().

380 {
381  libmesh_assert_less (s, this->n_systems());
382  libmesh_assert_less (var, this->n_vars(s));
383 
384  this->set_n_comp_group(s, this->var_to_vg(s,var), ncomp);
385 }
unsigned int var_to_vg(const unsigned int s, const unsigned int var) const
Utility function - for variable var in system s, figure out what variable group it lives in...
Definition: dof_object.h:1317
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
void set_n_comp_group(const unsigned int s, const unsigned int vg, const unsigned int ncomp)
Sets the number of components for VariableGroup vg of system s associated with this DofObject...
Definition: dof_object.C:389

◆ set_n_comp_group()

void libMesh::DofObject::set_n_comp_group ( const unsigned int  s,
const unsigned int  vg,
const unsigned int  ncomp 
)

Sets the number of components for VariableGroup vg of system s associated with this DofObject.

Definition at line 389 of file dof_object.C.

References _idx_buf, invalid_id, n_comp_group(), n_systems(), n_var_groups(), n_vars(), ncv_magic, and start_idx().

Referenced by libMesh::DofMap::reinit(), set_n_comp(), set_n_vars_per_group(), libMesh::DofMap::set_nonlocal_dof_objects(), and DofObjectTest< Node >::testManualDofCalculation().

392 {
393  libmesh_assert_less (s, this->n_systems());
394  libmesh_assert_less (vg, this->n_var_groups(s));
395 
396  // Check for trivial return
397  if (ncomp == this->n_comp_group(s,vg)) return;
398 
399 #ifndef NDEBUG
400  if (ncomp >= ncv_magic)
401  {
402  const index_t ncvm = ncv_magic;
403  libmesh_error_msg("ERROR: ncomp must be less than DofObject::ncv_magic!\n" \
404  << "ncomp = " \
405  << ncomp \
406  << ", ncv_magic = " \
407  << ncvm \
408  << "\nrecompile and try again!");
409  }
410 #endif
411 
412  const unsigned int
413  start_idx_sys = this->start_idx(s),
414  n_vars_group = this->n_vars(s,vg),
415  base_offset = start_idx_sys + 2*vg;
416 
417  libmesh_assert_less ((base_offset + 1), _idx_buf.size());
418 
419  // if (ncomp)
420  // libMesh::out << "s,vg,ncomp="
421  // << s << ","
422  // << vg << ","
423  // << ncomp << '\n';
424 
425  // set the number of components, maintaining the number
426  // of variables in the group
427  _idx_buf[base_offset] = ncv_magic*n_vars_group + ncomp;
428 
429  // We use (invalid_id - 1) to signify no
430  // components for this object
431  _idx_buf[base_offset + 1] = (ncomp == 0) ? invalid_id - 1 : invalid_id;
432 
433  // this->debug_buffer();
434  // libMesh::out << "s,vg = " << s << "," << vg << '\n'
435  // << "base_offset=" << base_offset << '\n'
436  // << "this->n_comp(s,vg)=" << this->n_comp(s,vg) << '\n'
437  // << "this->n_comp_group(s,vg)=" << this->n_comp_group(s,vg) << '\n'
438  // << "this->n_vars(s,vg)=" << this->n_vars(s,vg) << '\n'
439  // << "this->n_var_groups(s)=" << this->n_var_groups(s) << '\n';
440 
441  libmesh_assert_equal_to (ncomp, this->n_comp_group(s,vg));
442 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
dof_id_type index_t
DoF index information.
Definition: dof_object.h:669
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:473
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
unsigned int start_idx(const unsigned int s) const
The starting index for system s.
Definition: dof_object.h:1225
index_buffer_t _idx_buf
Definition: dof_object.h:671
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:991
static const index_t ncv_magic
Above we introduced the chimera ncv, which is a hybrid of the form ncv = ncv_magic*nv + nc where nv a...
Definition: dof_object.h:682

◆ set_n_systems()

void libMesh::DofObject::set_n_systems ( const unsigned int  s)

Sets the number of systems for this DofObject.

If this number is a change, also clears all variable count and DoF indexing associated with this DofObject.

If any extra integers are associated with this DofObject, their count and values are unchanged.

Definition at line 142 of file dof_object.C.

References _idx_buf, libMesh::make_range(), n_extra_integers(), n_systems(), n_var_groups(), n_vars(), and start_idx_ints().

Referenced by add_system(), clear_dofs(), libMesh::Elem::refine(), DofObjectTest< Node >::testManualDofCalculation(), DofObjectTest< Node >::testSetNSystems(), DofObjectTest< Node >::testSetNSystemsExtraInts(), DofObjectTest< Node >::testSetNVariableGroups(), and DofObjectTest< Node >::testSetNVariableGroupsExtraInts().

143 {
144  const unsigned int old_ns = this->n_systems();
145 
146  // Check for trivial return
147  if (ns == old_ns)
148  return;
149 
150  const unsigned int nei = this->n_extra_integers();
151  const dof_id_type header_size = ns + bool(nei);
152  const dof_id_type hdr = nei ?
153  static_cast<dof_id_type>(-static_cast<std::ptrdiff_t>(header_size))
154  : header_size;
155  index_buffer_t new_buf(header_size + nei, hdr);
156  if (nei)
157  {
158  const unsigned int start_idx_ints = old_ns ?
159  cast_int<unsigned int>(_idx_buf[old_ns]) :
160  1;
161  libmesh_assert_less(start_idx_ints, _idx_buf.size());
162  std::copy(_idx_buf.begin()+start_idx_ints,
163  _idx_buf.end(),
164  new_buf.begin()+header_size);
165  if (ns)
166  std::fill(new_buf.begin()+1, new_buf.begin()+ns+1, ns+1);
167  }
168 
169  // vector swap trick to force deallocation when shrinking
170  new_buf.swap(_idx_buf);
171 
172 #ifdef DEBUG
173  libmesh_assert_equal_to(nei, this->n_extra_integers());
174 
175  // check that all systems now exist and that they have 0 size
176  libmesh_assert_equal_to (ns, this->n_systems());
177  for (auto s : make_range(this->n_systems()))
178  {
179  libmesh_assert_equal_to (this->n_vars(s), 0);
180  libmesh_assert_equal_to (this->n_var_groups(s), 0);
181  }
182 #endif
183 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
unsigned int start_idx_ints() const
The starting index for an extra_integers pseudosystem.
Definition: dof_object.h:1249
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
std::vector< index_t > index_buffer_t
Definition: dof_object.h:670
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176
unsigned int n_extra_integers() const
Returns how many extra integers are associated to the DofObject.
Definition: dof_object.h:1146
index_buffer_t _idx_buf
Definition: dof_object.h:671
uint8_t dof_id_type
Definition: id_types.h:67

◆ set_n_vars_per_group()

void libMesh::DofObject::set_n_vars_per_group ( const unsigned int  s,
const std::vector< unsigned int > &  nvpg 
)

Sets number of variables in each group associated with system s for this DofObject.

Implicit in this is also setting the number of VariableGroup variable groups for the system. Has the effect of setting the number of components to 0 even when called even with (nvg == this->n_var_groups(s)).

Definition at line 239 of file dof_object.C.

References _idx_buf, end_idx(), get_extra_integer(), has_extra_integers(), invalid_id, libMesh::make_range(), n_comp(), n_comp_group(), n_extra_integers(), n_systems(), n_var_groups(), n_vars(), ncv_magic, set_n_comp_group(), and start_idx().

Referenced by DofObjectTest< Node >::testManualDofCalculation(), DofObjectTest< Node >::testSetNVariableGroups(), and DofObjectTest< Node >::testSetNVariableGroupsExtraInts().

241 {
242  const unsigned int n_sys = this->n_systems();
243 
244  libmesh_assert_less (s, n_sys);
245 
246  // number of variable groups for this system - inferred
247  const unsigned int nvg = cast_int<unsigned int>(nvpg.size());
248 
249  // BSK - note that for compatibility with the previous implementation
250  // calling this method when (nvars == this->n_vars()) requires that
251  // we invalidate the DOF indices and set the number of components to 0.
252  // Note this was a bit of a surprise to me - there was no quick return in
253  // the old method, which caused removal and readdition of the DOF indices
254  // even in the case of (nvars == this->n_vars()), resulting in n_comp(s,v)
255  // implicitly becoming 0 regardless of any previous value.
256  // quick return?
257  if (nvg == this->n_var_groups(s))
258  {
259  for (unsigned int vg=0; vg<nvg; vg++)
260  {
261  this->set_n_comp_group(s,vg,0);
262  libmesh_assert_equal_to (this->n_vars(s,vg), nvpg[vg]);
263  }
264  return;
265  }
266 
267  const bool hei = this->has_extra_integers();
268 
269  // since there is ample opportunity to screw up other systems, let us
270  // cache their current sizes and later assert that they are unchanged.
271 #ifdef DEBUG
272  const unsigned int nei = this->n_extra_integers();
273 
274  DofObject::index_buffer_t old_system_sizes, old_extra_integers;
275  old_system_sizes.reserve(n_sys);
276  old_extra_integers.reserve(nei);
277 
278  for (unsigned int s_ctr=0; s_ctr<n_sys; s_ctr++)
279  old_system_sizes.push_back(this->n_var_groups(s_ctr));
280 
281  for (unsigned int ei=0; ei != nei; ++ei)
282  old_extra_integers.push_back(this->get_extra_integer(ei));
283 #endif
284 
285  // remove current indices if we have some
286  if (this->n_var_groups(s) != 0)
287  {
288  const unsigned int old_nvg_s = this->n_var_groups(s);
289 
290  DofObject::index_buffer_t::iterator
291  it = _idx_buf.begin(),
292  end = _idx_buf.begin();
293 
294  std::advance(it, this->start_idx(s));
295  std::advance(end, this->end_idx(s));
296  _idx_buf.erase(it,end);
297 
298  for (unsigned int ctr=(s+1); ctr<n_sys; ctr++)
299  _idx_buf[ctr] -= 2*old_nvg_s;
300 
301  if (hei)
302  _idx_buf[n_sys] -= 2*old_nvg_s;
303  }
304 
305  // better not have any now!
306  libmesh_assert_equal_to (this->n_var_groups(s), 0);
307 
308  // Make sure we didn't screw up any of our sizes!
309 #ifdef DEBUG
310  for (auto s_ctr : make_range(this->n_systems()))
311  if (s_ctr != s)
312  libmesh_assert_equal_to (this->n_var_groups(s_ctr), old_system_sizes[s_ctr]);
313 
314  libmesh_assert_equal_to (nei, this->n_extra_integers());
315 
316  for (unsigned int ei=0; ei != nei; ++ei)
317  libmesh_assert_equal_to(old_extra_integers[ei], this->get_extra_integer(ei));
318 #endif
319 
320  // OK, if the user requested 0 that is what we have
321  if (nvg == 0)
322  return;
323 
324  {
325  // array to hold new indices
326  DofObject::index_buffer_t var_idxs(2*nvg);
327  for (unsigned int vg=0; vg<nvg; vg++)
328  {
329  var_idxs[2*vg ] = ncv_magic*nvpg[vg] + 0;
330  var_idxs[2*vg + 1] = invalid_id - 1;
331  }
332 
333  DofObject::index_buffer_t::iterator it = _idx_buf.begin();
334  std::advance(it, this->end_idx(s));
335  _idx_buf.insert(it, var_idxs.begin(), var_idxs.end());
336 
337  for (unsigned int ctr=(s+1); ctr<n_sys; ctr++)
338  _idx_buf[ctr] += 2*nvg;
339 
340  if (hei)
341  _idx_buf[n_sys] += 2*nvg;
342 
343  // resize _idx_buf to fit so no memory is wasted.
345  }
346 
347  libmesh_assert_equal_to (nvg, this->n_var_groups(s));
348 
349 #ifdef DEBUG
350 
351  libmesh_assert_equal_to (this->n_var_groups(s), nvpg.size());
352 
353  for (auto vg : make_range(this->n_var_groups(s)))
354  {
355  libmesh_assert_equal_to (this->n_vars(s,vg), nvpg[vg]);
356  libmesh_assert_equal_to (this->n_comp_group(s,vg), 0);
357  }
358 
359  for (auto v : make_range(this->n_vars(s)))
360  libmesh_assert_equal_to (this->n_comp(s,v), 0);
361 
362  // again, all other system sizes should be unchanged!
363  for (auto s_ctr : make_range(this->n_systems()))
364  if (s_ctr != s)
365  libmesh_assert_equal_to (this->n_var_groups(s_ctr), old_system_sizes[s_ctr]);
366 
367  // Extra integers count and values should also be unchanged!
368  libmesh_assert_equal_to (nei, this->n_extra_integers());
369 
370  for (unsigned int ei=0; ei != nei; ++ei)
371  libmesh_assert_equal_to(old_extra_integers[ei], this->get_extra_integer(ei));
372 #endif
373 }
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:978
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
unsigned int end_idx(const unsigned int s) const
The ending index for system s.
Definition: dof_object.h:1236
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:473
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943
unsigned int n_systems() const
Definition: dof_object.h:913
bool has_extra_integers() const
Returns whether extra integers are associated to the DofObject.
Definition: dof_object.h:1164
std::vector< index_t > index_buffer_t
Definition: dof_object.h:670
void set_n_comp_group(const unsigned int s, const unsigned int vg, const unsigned int ncomp)
Sets the number of components for VariableGroup vg of system s associated with this DofObject...
Definition: dof_object.C:389
unsigned int start_idx(const unsigned int s) const
The starting index for system s.
Definition: dof_object.h:1225
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176
unsigned int n_extra_integers() const
Returns how many extra integers are associated to the DofObject.
Definition: dof_object.h:1146
index_buffer_t _idx_buf
Definition: dof_object.h:671
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:991
dof_id_type get_extra_integer(const unsigned int index) const
Gets the value on this object of the extra integer associated with index, which should have been obta...
Definition: dof_object.h:1078
static const index_t ncv_magic
Above we introduced the chimera ncv, which is a hybrid of the form ncv = ncv_magic*nv + nc where nv a...
Definition: dof_object.h:682

◆ set_old_dof_object()

void libMesh::DofObject::set_old_dof_object ( )

Sets the old_dof_object to a copy of this.

Definition at line 127 of file dof_object.C.

References clear_old_dof_object(), construct(), libMesh::libmesh_assert(), and old_dof_object.

128 {
129  this->clear_old_dof_object();
130 
132 
133  // Make a new DofObject, assign a copy of \p this.
134  // Make sure the copy ctor for DofObject works!!
135  this->old_dof_object = this->construct(this);
136 }
std::unique_ptr< DofObject > construct(const DofObject *other=nullptr)
Convenient factory function that calls either the (deep) copy constructor or the default constructor ...
Definition: dof_object.h:732
void clear_old_dof_object()
Sets the old_dof_object to nullptr.
Definition: dof_object.C:120
libmesh_assert(ctx)
std::unique_ptr< DofObject > old_dof_object
This object on the last mesh.
Definition: dof_object.h:88

◆ set_unique_id()

void libMesh::DofObject::set_unique_id ( unique_id_type  new_id)
inline

◆ set_vg_dof_base()

void libMesh::DofObject::set_vg_dof_base ( const unsigned int  s,
const unsigned int  vg,
const dof_id_type  db 
)
inline

VariableGroup DoF indices are indexed as id = base + var_in_vg*ncomp + comp This method allows for direct access to the base.

Definition at line 1273 of file dof_object.h.

References _idx_buf, n_systems(), n_var_groups(), start_idx(), and vg_dof_base().

Referenced by libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), invalidate_dofs(), libMesh::DofMap::reinit(), libMesh::DofMap::set_nonlocal_dof_objects(), and DofObjectTest< Node >::testManualDofCalculation().

1276 {
1277  libmesh_assert_less (s, this->n_systems());
1278  libmesh_assert_less (vg, this->n_var_groups(s));
1279 
1280  const unsigned int
1281  start_idx_sys = this->start_idx(s);
1282 
1283  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());
1284 
1285  _idx_buf[start_idx_sys + 2*vg + 1] = db;
1286 
1287  libmesh_assert_equal_to (this->vg_dof_base(s,vg), db);
1288 }
dof_id_type vg_dof_base(const unsigned int s, const unsigned int vg) const
VariableGroup DoF indices are indexed as id = base + var_in_vg*ncomp + comp This method allows for di...
Definition: dof_object.h:1293
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
unsigned int n_systems() const
Definition: dof_object.h:913
unsigned int start_idx(const unsigned int s) const
The starting index for system s.
Definition: dof_object.h:1225
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ start_idx()

unsigned int libMesh::DofObject::start_idx ( const unsigned int  s) const
inlineprivate

The starting index for system s.

Definition at line 1225 of file dof_object.h.

References _idx_buf, and n_systems().

Referenced by dof_number(), n_comp_group(), n_var_groups(), n_vars(), set_dof_number(), set_n_comp_group(), set_n_vars_per_group(), set_vg_dof_base(), and vg_dof_base().

1226 {
1227  libmesh_assert_less (s, this->n_systems());
1228  libmesh_assert_less (s, _idx_buf.size());
1229 
1230  return cast_int<unsigned int>(std::abs(dof_id_signed_type(_idx_buf[s])));
1231 }
unsigned int n_systems() const
Definition: dof_object.h:913
int8_t dof_id_signed_type
Definition: id_types.h:68
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ start_idx_ints()

unsigned int libMesh::DofObject::start_idx_ints ( ) const
inlineprivate

The starting index for an extra_integers pseudosystem.

Definition at line 1249 of file dof_object.h.

References _idx_buf, has_extra_integers(), libMesh::libmesh_assert(), and n_systems().

Referenced by get_extra_datum(), get_extra_integer(), n_extra_integers(), set_extra_datum(), set_extra_integer(), and set_n_systems().

1250 {
1252 
1253  unsigned int n_sys = this->n_systems();
1254 
1255  libmesh_assert_less(this->n_systems(), _idx_buf.size());
1256  return n_sys ? cast_int<unsigned int>(_idx_buf[this->n_systems()]) :
1257  (n_sys+1);
1258 }
unsigned int n_systems() const
Definition: dof_object.h:913
libmesh_assert(ctx)
bool has_extra_integers() const
Returns whether extra integers are associated to the DofObject.
Definition: dof_object.h:1164
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ system_var_to_vg_var()

unsigned int libMesh::DofObject::system_var_to_vg_var ( const unsigned int  s,
const unsigned int  vg,
const unsigned int  var 
) const
inlineprivate

Utility function - for variable var in system s, figure out what variable group it lives in.

Definition at line 1335 of file dof_object.h.

References n_vars().

Referenced by set_dof_number().

1338 {
1339  unsigned int accumulated_sum=0;
1340 
1341  for (unsigned int vgc=0; vgc<vg; vgc++)
1342  accumulated_sum += this->n_vars(s,vgc);
1343 
1344  libmesh_assert_less_equal (accumulated_sum, var);
1345 
1346  return (var - accumulated_sum);
1347 }
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943

◆ unique_id()

unique_id_type libMesh::DofObject::unique_id ( ) const
inline
Returns
The globally unique_id for this DofObject

Definition at line 835 of file dof_object.h.

References _unique_id, invalid_unique_id, libMesh::libmesh_assert(), and valid_unique_id().

Referenced by libMesh::ReplicatedMesh::add_elem(), libMesh::DistributedMesh::add_elem(), libMesh::ReplicatedMesh::add_node(), libMesh::DistributedMesh::add_node(), libMesh::ReplicatedMesh::add_point(), libMesh::MeshTools::Modification::all_tri(), libMesh::C0Polyhedron::disconnected_clone(), libMesh::Elem::disconnected_clone(), libMesh::MeshTools::Modification::flatten(), libMesh::Elem::get_info(), libMesh::ReplicatedMesh::insert_elem(), libMesh::DistributedMesh::insert_elem(), libMesh::XdrIO::pack_element(), libMesh::ExodusII_IO::read_elemental_variable(), MeshInputTest::testExodusSetNodeUniqueIdsFromMaps_implementation(), SlitMeshRefinedSystemTest::testRestart(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), and libMesh::XdrIO::write_serialized_nodes().

836 {
837 #ifdef LIBMESH_ENABLE_UNIQUE_ID
839  return _unique_id;
840 #else
841  return invalid_unique_id;
842 #endif
843 }
static constexpr unique_id_type invalid_unique_id
An invalid unique_id to distinguish an uninitialized DofObject.
Definition: dof_object.h:478
unique_id_type _unique_id
A globally unique id, guaranteed not to change as the mesh is repartitioned or adapted.
Definition: dof_object.h:568
libmesh_assert(ctx)
bool valid_unique_id() const
Definition: dof_object.h:869

◆ unpack_indexing()

void libMesh::DofObject::unpack_indexing ( std::vector< largest_id_type >::const_iterator  begin)

A method for creating our index buffer from packed data - basically with our current implementation we investigate the size term and then copy.

Definition at line 587 of file dof_object.C.

References _idx_buf, clear_old_dof_object(), construct(), libMesh::libmesh_assert(), and old_dof_object.

588 {
589  _idx_buf.clear();
590 
591 #ifdef LIBMESH_ENABLE_AMR
592  this->clear_old_dof_object();
593  const bool has_old_dof_object = cast_int<bool>(*begin++);
594 #endif
595 
596  const largest_id_type size = *begin++;
597  _idx_buf.reserve(size);
598  std::copy(begin, begin+size, back_inserter(_idx_buf));
599 
600  // Check as best we can for internal consistency now
601  libmesh_assert(_idx_buf.empty() ||
602  (std::abs(dof_id_signed_type(_idx_buf[0])) <=
603  cast_int<dof_id_signed_type>(_idx_buf.size())));
604 #ifdef DEBUG
605  if (!_idx_buf.empty())
606  {
607  const int hdr = cast_int<int>(dof_id_signed_type(_idx_buf[0]));
608  const unsigned int ns = hdr >= 0 ? hdr : (-hdr-1);
609  for (unsigned int i=1; i < ns; ++i)
610  {
611  if (hdr > 0 || i > 1)
612  libmesh_assert_greater_equal (_idx_buf[i], _idx_buf[i-1]);
613  else
614  libmesh_assert_greater_equal (_idx_buf[i], ns);
615  libmesh_assert_equal_to ((_idx_buf[i] - _idx_buf[i-1])%2, 0);
616  libmesh_assert_less_equal (_idx_buf[i], _idx_buf.size());
617  }
618  if (hdr < 0 && ns > 0)
619  libmesh_assert_less_equal(_idx_buf[ns], _idx_buf.size());
620  }
621 #endif
622 
623 #ifdef LIBMESH_ENABLE_AMR
624  if (has_old_dof_object)
625  {
626  this->old_dof_object = this->construct();
627  this->old_dof_object->unpack_indexing(begin+size);
628  }
629 #endif
630 }
std::unique_ptr< DofObject > construct(const DofObject *other=nullptr)
Convenient factory function that calls either the (deep) copy constructor or the default constructor ...
Definition: dof_object.h:732
uint64_t largest_id_type
Definition: id_types.h:148
void clear_old_dof_object()
Sets the old_dof_object to nullptr.
Definition: dof_object.C:120
libmesh_assert(ctx)
int8_t dof_id_signed_type
Definition: id_types.h:68
std::unique_ptr< DofObject > old_dof_object
This object on the last mesh.
Definition: dof_object.h:88
index_buffer_t _idx_buf
Definition: dof_object.h:671

◆ unpackable_indexing_size()

unsigned int libMesh::DofObject::unpackable_indexing_size ( std::vector< largest_id_type >::const_iterator  begin)
static

If we have indices packed into an buffer for communications, how much of that buffer applies to this dof object?

Definition at line 567 of file dof_object.C.

568 {
569 #ifdef LIBMESH_ENABLE_AMR
570  const bool has_old_dof_object = cast_int<bool>(*begin++);
571 
572  static const int dof_header_size = 2;
573 #else
574  static const bool has_old_dof_object = false;
575  static const int dof_header_size = 1;
576 #endif
577 
578  const largest_id_type this_indexing_size = *begin++;
579 
580  return cast_int<unsigned int>
581  (dof_header_size + this_indexing_size +
582  (has_old_dof_object ?
583  unpackable_indexing_size(begin+this_indexing_size) : 0));
584 }
static unsigned int unpackable_indexing_size(std::vector< largest_id_type >::const_iterator begin)
If we have indices packed into an buffer for communications, how much of that buffer applies to this ...
Definition: dof_object.C:567
uint64_t largest_id_type
Definition: id_types.h:148

◆ valid_id()

bool libMesh::DofObject::valid_id ( ) const
inline

◆ valid_processor_id()

bool libMesh::DofObject::valid_processor_id ( ) const
inline
Returns
true if this DofObject has a valid id set, false otherwise.

Definition at line 905 of file dof_object.h.

References _processor_id, and invalid_processor_id.

Referenced by DofObjectTest< Node >::testInvalidateProcId(), and DofObjectTest< Node >::testValidProcId().

906 {
908 }
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:484
processor_id_type _processor_id
The processor_id of the DofObject.
Definition: dof_object.h:585

◆ valid_unique_id()

bool libMesh::DofObject::valid_unique_id ( ) const
inline
Returns
true if this DofObject has a valid unique_id set, false otherwise.

Definition at line 869 of file dof_object.h.

References _unique_id, and invalid_unique_id.

Referenced by libMesh::ReplicatedMesh::add_elem(), libMesh::DistributedMesh::add_elem(), libMesh::ReplicatedMesh::add_node(), libMesh::DistributedMesh::add_node(), libMesh::ReplicatedMesh::add_point(), libMesh::C0Polyhedron::disconnected_clone(), libMesh::Elem::disconnected_clone(), libMesh::Elem::get_info(), libMesh::ReplicatedMesh::insert_elem(), libMesh::DistributedMesh::insert_elem(), and unique_id().

870 {
871 #ifdef LIBMESH_ENABLE_UNIQUE_ID
873 #else
874  return false;
875 #endif
876 }
static constexpr unique_id_type invalid_unique_id
An invalid unique_id to distinguish an uninitialized DofObject.
Definition: dof_object.h:478
unique_id_type _unique_id
A globally unique id, guaranteed not to change as the mesh is repartitioned or adapted.
Definition: dof_object.h:568

◆ var_to_vg()

unsigned int libMesh::DofObject::var_to_vg ( const unsigned int  s,
const unsigned int  var 
) const
inlineprivate

Utility function - for variable var in system s, figure out what variable group it lives in.

Definition at line 1317 of file dof_object.h.

References n_var_groups(), and n_vars().

Referenced by n_comp(), set_dof_number(), and set_n_comp().

1319 {
1320  const unsigned int
1321  nvg = this->n_var_groups(s);
1322 
1323  for (unsigned int vg=0, vg_end=0; vg<nvg; vg++)
1324  {
1325  vg_end += this->n_vars(s,vg);
1326  if (var < vg_end) return vg;
1327  }
1328 
1329  libmesh_error_msg("Error: could not map variable " << var << " to variable group.");
1330 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943

◆ var_to_vg_and_offset()

std::pair< unsigned int, unsigned int > libMesh::DofObject::var_to_vg_and_offset ( const unsigned int  s,
const unsigned int  var 
) const
inline
Returns
A pair consisting of the variable group number and the offset index from the start of that group for variable var on system s associated with this DofObject

Definition at line 1176 of file dof_object.h.

References n_var_groups(), and n_vars().

Referenced by libMesh::DofMap::_dof_indices(), libMesh::DofMap::_node_dof_indices(), dof_number(), libMesh::OldSolutionCoefs< Output, point_output >::eval_old_dofs(), and libMesh::OldSolutionValue< Output, point_output >::eval_old_dofs().

1178 {
1179  std::pair<unsigned int, unsigned int> returnval(0,0);
1180 
1181  unsigned int & vg = returnval.first;
1182  unsigned int & offset = returnval.second;
1183 
1184  unsigned int vg_start = 0;
1185  for (; ; vg++)
1186  {
1187  libmesh_assert_less(vg, this->n_var_groups(s));
1188 
1189  const unsigned int vg_end = vg_start + this->n_vars(s,vg);
1190  if (var < vg_end)
1191  {
1192  offset = var - vg_start;
1193  return returnval;
1194  }
1195  vg_start = vg_end;
1196  }
1197 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:943

◆ vg_dof_base()

dof_id_type libMesh::DofObject::vg_dof_base ( const unsigned int  s,
const unsigned int  vg 
) const
inline

VariableGroup DoF indices are indexed as id = base + var_in_vg*ncomp + comp This method allows for direct access to the base.

Definition at line 1293 of file dof_object.h.

References _idx_buf, n_systems(), n_var_groups(), and start_idx().

Referenced by libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::reinit(), libMesh::DofMap::set_nonlocal_dof_objects(), set_vg_dof_base(), and DofObjectTest< Node >::testManualDofCalculation().

1295 {
1296  libmesh_assert_less (s, this->n_systems());
1297  libmesh_assert_less (vg, this->n_var_groups(s));
1298 
1299  const unsigned int
1300  start_idx_sys = this->start_idx(s);
1301 
1302  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());
1303 
1304  // #ifdef DEBUG
1305  // std::cout << " [ ";
1306  // for (auto i : _idx_buf)
1307  // std::cout << i << " ";
1308  // std::cout << "]\n";
1309  // #endif
1310 
1311  return _idx_buf[start_idx_sys + 2*vg + 1];
1312 }
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:933
unsigned int n_systems() const
Definition: dof_object.h:913
unsigned int start_idx(const unsigned int s) const
The starting index for system s.
Definition: dof_object.h:1225
index_buffer_t _idx_buf
Definition: dof_object.h:671

Member Data Documentation

◆ _counts

ReferenceCounter::Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

Actually holds the data.

Definition at line 124 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::get_info().

◆ _enable_print_counter

bool libMesh::ReferenceCounter::_enable_print_counter = true
staticprotectedinherited

Flag to control whether reference count information is printed when print_info is called.

Definition at line 143 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().

◆ _id

dof_id_type libMesh::DofObject::_id
private

The id of the DofObject.

Definition at line 574 of file dof_object.h.

Referenced by id(), operator=(), set_id(), and valid_id().

◆ _idx_buf

index_buffer_t libMesh::DofObject::_idx_buf
private

◆ _mutex

Threads::spin_mutex libMesh::ReferenceCounter::_mutex
staticprotectedinherited

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 137 of file reference_counter.h.

◆ _n_objects

Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects
staticprotectedinherited

The number of objects.

Print the reference count information when the number returns to 0.

Definition at line 132 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().

◆ _processor_id

processor_id_type libMesh::DofObject::_processor_id
private

The processor_id of the DofObject.

Degrees of freedom are wholly owned by processors, however they may be duplicated on other processors.

This is stored as an unsigned short int since we cannot expect to be solving on 65000+ processors any time soon, can we??

Definition at line 585 of file dof_object.h.

Referenced by operator=(), processor_id(), and valid_processor_id().

◆ _unique_id

unique_id_type libMesh::DofObject::_unique_id
private

A globally unique id, guaranteed not to change as the mesh is repartitioned or adapted.

Definition at line 568 of file dof_object.h.

Referenced by operator=(), set_unique_id(), unique_id(), and valid_unique_id().

◆ invalid_id

constexpr dof_id_type libMesh::DofObject::invalid_id = static_cast<dof_id_type>(-1)
static

An invalid id to distinguish an uninitialized DofObject.

Definition at line 473 of file dof_object.h.

Referenced by libMesh::DofMap::_dof_indices(), libMesh::DofMap::_node_dof_indices(), libMesh::Node::active(), libMesh::MeshBase::add_elem_datum(), libMesh::MeshBase::add_elem_integers(), add_extra_integers(), libMesh::StaticCondensation::add_matrix(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::TopologyMap::add_node(), libMesh::MeshRefinement::add_node(), libMesh::MeshBase::add_node_datum(), libMesh::MeshBase::add_node_integers(), libMesh::ReplicatedMesh::add_point(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::DofMap::assert_no_nodes_missed(), libMesh::Elem::bracketing_nodes(), ExtraIntegersTest::checkpoint_helper(), libMesh::StaticCondensation::clear(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_proj_constraints(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::dof_indices(), dof_number(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::OldSolutionValue< Output, point_output >::eval_old_dofs(), libMesh::TopologyMap::find(), libMesh::DofMap::gather_constraints(), libMesh::MeshBase::get_elemset_code(), libMesh::Poly2TriTriangulator::insert_refinement_points(), libMesh::Elem::interior_parent(), invalidate_dofs(), invalidate_id(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::Node::Node(), libMesh::Elem::node_id(), libMesh::DofMap::old_dof_indices(), libMesh::DistributedMesh::own_node(), libMesh::XdrIO::pack_element(), libMesh::SFCPartitioner::partition_range(), libMesh::Elem::point(), libMesh::ExodusII_IO::read(), libMesh::DynaIO::read_mesh(), libMesh::System::read_parallel_data(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::StaticCondensationDofMap::reinit(), libMesh::DofMap::SCALAR_dof_indices(), set_dof_number(), set_n_comp_group(), set_n_vars_per_group(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Parallel::sync_node_data_by_element_id_once(), ExtraIntegersTest::test_and_set_initial_data(), DofObjectTest< Node >::testAddExtraData(), DofObjectTest< Node >::testAddSystemExtraInts(), ExtraIntegersTest::testExtraIntegersExodusReading(), InfFERadialTest::testRefinement(), DofObjectTest< Node >::testSetNSystemsExtraInts(), DofObjectTest< Node >::testSetNVariableGroupsExtraInts(), MeshTetTest::testTetInterfaceBase(), DofObjectTest< Node >::testValidId(), MeshSmootherTest::testVariationalSmoother(), WriteElemsetData::testWriteImpl(), libMesh::NetGenMeshInterface::triangulate(), libMesh::Poly2TriTriangulator::triangulate_current_points(), valid_id(), libMesh::System::write_parallel_data(), and libMesh::XdrIO::write_serialized_connectivity().

◆ invalid_processor_id

constexpr processor_id_type libMesh::DofObject::invalid_processor_id = static_cast<processor_id_type>(-1)
static

An invalid processor_id to distinguish DoFs that have not been assigned to a processor.

Definition at line 484 of file dof_object.h.

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::DistributedMesh::add_elem(), libMesh::DistributedMesh::add_node(), libMesh::MeshRefinement::add_node(), libMesh::MeshCommunication::allgather(), libMesh::Node::choose_processor_id(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubProjector::construct_projection(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), libMesh::MeshTools::create_nodal_bounding_box(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::Elem::Elem(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), libMesh::MeshCommunication::find_global_indices(), libMesh::MeshBase::get_info(), libMesh::DistributedMesh::insert_elem(), invalidate_processor_id(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshBase::n_constraint_rows(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::MeshBase::n_unpartitioned_elem(), libMesh::MeshBase::n_unpartitioned_nodes(), libMesh::SparsityPattern::Build::operator()(), libMesh::Partitioner::processor_pairs_to_interface_nodes(), libMesh::Nemesis_IO_Helper::read_var_names_impl(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), OverlappingFunctorTest::run_coupling_functor_test(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::send_and_insert_dof_values(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::Parallel::sync_dofobject_data_by_id(), libMesh::Parallel::sync_dofobject_data_by_xyz(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id_once(), DofObjectTest< Node >::testValidProcId(), libMesh::MeshTools::total_weight(), valid_processor_id(), and libMesh::CheckpointIO::write().

◆ invalid_unique_id

constexpr unique_id_type libMesh::DofObject::invalid_unique_id = static_cast<unique_id_type>(-1)
static

An invalid unique_id to distinguish an uninitialized DofObject.

Definition at line 478 of file dof_object.h.

Referenced by libMesh::DistributedMesh::renumber_dof_objects(), unique_id(), and valid_unique_id().

◆ ncv_magic

const index_t libMesh::DofObject::ncv_magic = 256
staticprivate

Above we introduced the chimera ncv, which is a hybrid of the form ncv = ncv_magic*nv + nc where nv are the number of identical variables of a given type, and nc is the number of components for this set of variables.

It is hoped that by setting this to a power of two, an optimizing compiler will recognize later that #/ncv_magic is simply a bitshift

Definition at line 682 of file dof_object.h.

Referenced by n_comp_group(), set_n_comp_group(), and set_n_vars_per_group().

◆ ncv_magic_exp

const index_t libMesh::DofObject::ncv_magic_exp = 8
staticprivate

Definition at line 683 of file dof_object.h.

Referenced by n_vars().

◆ old_dof_object

std::unique_ptr<DofObject> libMesh::DofObject::old_dof_object
protected

This object on the last mesh.

Useful for projecting solutions from one mesh to another.

Public access to old_dof_object is now officially deprecated and will be removed in future libMesh versions. Use the get_old_dof_object() accessor instead.

Definition at line 88 of file dof_object.h.

Referenced by clear_old_dof_object(), get_old_dof_object(), get_old_dof_object_ref(), operator=(), pack_indexing(), packed_indexing_size(), set_old_dof_object(), and unpack_indexing().


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