$extrastylesheet
libMesh::DofObject Class Reference

#include <dof_object.h>

Inheritance diagram for libMesh::DofObject:

List of all members.

Public Member Functions

void clear_old_dof_object ()
void set_old_dof_object ()
void clear_dofs ()
void invalidate_dofs (const unsigned int sys_num=libMesh::invalid_uint)
void invalidate_id ()
void invalidate_processor_id ()
void invalidate ()
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
unique_id_typeset_unique_id ()
void set_id (const dof_id_type dofid)
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)
bool valid_processor_id () const
unsigned int n_systems () const
void set_n_systems (const unsigned int s)
void add_system ()
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)
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)
void set_n_comp_group (const unsigned int s, const unsigned int vg, const unsigned int ncomp)
dof_id_type dof_number (const unsigned int s, const unsigned int var, const unsigned int comp) const
void set_dof_number (const unsigned int s, const unsigned int var, const unsigned int comp, const dof_id_type dn)
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)
dof_id_type vg_dof_base (const unsigned int s, const unsigned int vg) const
unsigned int packed_indexing_size () const
void unpack_indexing (std::vector< largest_id_type >::const_iterator begin)
void pack_indexing (std::back_insert_iterator< std::vector< largest_id_type > > target) const
void debug_buffer () const
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)
static std::string get_info ()
static void print_info (std::ostream &out=libMesh::out)
static unsigned int n_objects ()
static void enable_print_counter_info ()
static void disable_print_counter_info ()

Public Attributes

DofObjectold_dof_object

Static Public Attributes

static const dof_id_type invalid_id = static_cast<dof_id_type>(-1)
static const unique_id_type invalid_unique_id = static_cast<unique_id_type>(-1)
static const processor_id_type invalid_processor_id = static_cast<processor_id_type>(-1)

Protected Types

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

Protected Member Functions

 DofObject ()
 ~DofObject ()
 DofObject (const DofObject &)
DofObjectoperator= (const DofObject &dof_obj)
void increment_constructor_count (const std::string &name)
void increment_destructor_count (const std::string &name)

Static Protected Attributes

static Counts _counts
static Threads::atomic
< unsigned int > 
_n_objects
static Threads::spin_mutex _mutex
static bool _enable_print_counter = true

Private Types

typedef dof_id_type index_t
typedef std::vector< index_tindex_buffer_t

Private Member Functions

unsigned int var_to_vg (const unsigned int s, const unsigned int var) const
unsigned int system_var_to_vg_var (const unsigned int s, const unsigned int vg, const unsigned int var) const
unsigned int start_idx (const unsigned int s) const
unsigned int end_idx (const unsigned int s) const

Private Attributes

unique_id_type _unique_id
dof_id_type _id
processor_id_type _processor_id
index_buffer_t _idx_buf

Static Private Attributes

static const index_t ncv_magic = 256
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 51 of file dof_object.h.


Member Typedef Documentation

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts [protected, inherited]

Data structure to log the information. The log is identified by the class name.

Definition at line 113 of file reference_counter.h.

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

Definition at line 471 of file dof_object.h.

DoF index information. This is packed into a contiguous buffer of the following format:

   * [ns end_0 end_1 ... end_{ns-1} (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)_ns ]
   * 

where 'end_s' is the index past the end of the variable group storage for system s. Note that we specifically do not store the end for the last system - this always _idx_buf.size().

Specifically, 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 is then given by:

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

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

start_s = _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.)

Definition at line 470 of file dof_object.h.


Constructor & Destructor Documentation

libMesh::DofObject::DofObject ( ) [inline, protected]

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

Definition at line 509 of file dof_object.h.

References invalidate().

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

                      :
#ifdef LIBMESH_ENABLE_AMR
  old_dof_object(NULL),
#endif
#ifdef LIBMESH_ENABLE_UNIQUE_ID
  _unique_id (invalid_unique_id),
#endif
  _id (invalid_id),
  _processor_id (invalid_processor_id)
{
  this->invalidate();
}
libMesh::DofObject::~DofObject ( ) [inline, protected]

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

Definition at line 527 of file dof_object.h.

References clear_dofs(), and clear_old_dof_object().

{
  // Free all memory.
#ifdef LIBMESH_ENABLE_AMR
  this->clear_old_dof_object ();
#endif
  this->clear_dofs ();
}
libMesh::DofObject::DofObject ( const DofObject dof_obj) [protected]

Copy-constructor.

Definition at line 42 of file dof_object.C.

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

                                              :
  ReferenceCountedObject<DofObject>(),
#ifdef LIBMESH_ENABLE_AMR
  old_dof_object (NULL),
#endif
#ifdef LIBMESH_ENABLE_UNIQUE_ID
  _unique_id     (dof_obj._unique_id),
#endif
  _id            (dof_obj._id),
  _processor_id  (dof_obj._processor_id),
  _idx_buf       (dof_obj._idx_buf)
{

  // Check that everything worked
#ifdef DEBUG

  libmesh_assert_equal_to (this->n_systems(), dof_obj.n_systems());

  for (unsigned int s=0; s<this->n_systems(); s++)
    {
      libmesh_assert_equal_to (this->n_vars(s),       dof_obj.n_vars(s));
      libmesh_assert_equal_to (this->n_var_groups(s), dof_obj.n_var_groups(s));

      for (unsigned int vg=0; vg<this->n_var_groups(s); vg++)
        libmesh_assert_equal_to (this->n_vars(s,vg), dof_obj.n_vars(s,vg));

      for (unsigned int v=0; v<this->n_vars(s); v++)
        {
          libmesh_assert_equal_to (this->n_comp(s,v), dof_obj.n_comp(s,v));

          for (unsigned int c=0; c<this->n_comp(s,v); c++)
            libmesh_assert_equal_to (this->dof_number(s,v,c), dof_obj.dof_number(s,v,c));
        }
    }

#endif
}

Member Function Documentation

Adds an additional system to the DofObject

Definition at line 187 of file dof_object.C.

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

{
  // quick return?
  if (this->n_systems() == 0)
    {
      this->set_n_systems(1);
      return;
    }

  DofObject::index_buffer_t::iterator it = _idx_buf.begin();

  std::advance(it, this->n_systems());

  // this inserts the current vector size at the position for the new system - creating the
  // entry we need for the new system indicating there are 0 variables.
  _idx_buf.insert(it, cast_int<dof_id_type>(_idx_buf.size()));

  // cache this value before we screw it up!
  const unsigned int ns_orig = this->n_systems();

  // incriment the number of systems and the offsets for each of
  // the systems including the new one we just added.
  for (unsigned int i=0; i<ns_orig+1; i++)
    _idx_buf[i]++;

  libmesh_assert_equal_to (this->n_systems(), (ns_orig+1));
  libmesh_assert_equal_to (this->n_vars(ns_orig), 0);
  libmesh_assert_equal_to (this->n_var_groups(ns_orig), 0);
}
void libMesh::DofObject::clear_dofs ( ) [inline]

Clear the DofMap data structures and return to a pristine state.

Definition at line 585 of file dof_object.h.

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

Referenced by set_n_systems(), and ~DofObject().

{
  // vector swap trick to force deallocation
  index_buffer_t().swap(_idx_buf);

  libmesh_assert_equal_to (this->n_systems(), 0);
  libmesh_assert (_idx_buf.empty());
}

Sets the old_dof_object to NULL

Definition at line 134 of file dof_object.C.

References old_dof_object.

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

{
  delete this->old_dof_object;
  this->old_dof_object = NULL;
}

Print our buffer for debugging.

Definition at line 543 of file dof_object.C.

References _idx_buf, and libMesh::out.

{
  libMesh::out << " [ ";
  for (unsigned int i=0; i<_idx_buf.size(); i++)
    libMesh::out << _idx_buf[i] << " ";
  libMesh::out << "]\n";
}
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 797 of file dof_object.h.

References _idx_buf, invalid_id, n_comp(), n_comp_group(), n_systems(), n_vars(), start_idx(), system_var_to_vg_var(), and var_to_vg().

Referenced by libMesh::DofMap::_dof_indices(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEGenericBase< OutputType >::compute_periodic_constraints(), libMesh::DofMap::constrain_p_dofs(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::GMVIO::copy_nodal_solution(), libMesh::DofMap::distribute_dofs(), DofObject(), libMesh::Node::get_info(), libMesh::Elem::get_info(), libMesh::DofMap::local_variable_indices(), libMesh::DofMap::old_dof_indices(), operator=(), libMesh::HPCoarsenTest::select_refinement(), set_dof_number(), libMesh::DofMap::set_nonlocal_dof_objects(), and libMesh::System::zero_variable().

{
  libmesh_assert_less (s,    this->n_systems());
  libmesh_assert_less (var,  this->n_vars(s));
  libmesh_assert_less (comp, this->n_comp(s,var));

  const unsigned int
    vg            = this->var_to_vg(s,var),
    start_idx_sys = this->start_idx(s);

  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());

  const dof_id_type
    base_idx = _idx_buf[start_idx_sys + 2*vg + 1];

  // if the first component is invalid, they
  // are all invalid
  if (base_idx == invalid_id)
    return invalid_id;

  // otherwise the index is the first component
  // index augemented by the component number
  else
    {
      const unsigned int
        ncg = this->n_comp_group(s,vg),
        vig = this->system_var_to_vg_var(s,vg,var);

      // std::cout << "base_idx, var, vg, vig, ncg, comp="
      // << base_idx << " "
      // << var << " "
      // << vg << " "
      // << vig << " "
      // << ncg << " "
      // << comp << '\n';

      return cast_int<dof_id_type>(base_idx + vig*ncg + comp);
    }
}

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

Definition at line 100 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

{
  _enable_print_counter = true;
  return;
}
unsigned int libMesh::DofObject::end_idx ( const unsigned int  s) const [inline, private]

The ending index for system s.

Definition at line 876 of file dof_object.h.

References _idx_buf, and n_systems().

Referenced by n_var_groups(), and set_n_vars_per_group().

{
  libmesh_assert_less (s, this->n_systems());
  libmesh_assert_less (s, _idx_buf.size());

  return ((s+1) == this->n_systems()) ?
    cast_int<unsigned int>(_idx_buf.size()) :
    cast_int<unsigned int>(_idx_buf[s+1]);
}
std::string libMesh::ReferenceCounter::get_info ( ) [static, inherited]

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().

{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)

  std::ostringstream oss;

  oss << '\n'
      << " ---------------------------------------------------------------------------- \n"
      << "| Reference count information                                                |\n"
      << " ---------------------------------------------------------------------------- \n";

  for (Counts::iterator it = _counts.begin();
       it != _counts.end(); ++it)
    {
      const std::string name(it->first);
      const unsigned int creations    = it->second.first;
      const unsigned int destructions = it->second.second;

      oss << "| " << name << " reference count information:\n"
          << "|  Creations:    " << creations    << '\n'
          << "|  Destructions: " << destructions << '\n';
    }

  oss << " ---------------------------------------------------------------------------- \n";

  return oss.str();

#else

  return "";

#endif
}
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 842 of file dof_object.h.

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

Referenced by libMesh::MeshTools::libmesh_assert_old_dof_objects(), libMesh::DofMap::old_dof_indices(), and libMesh::DofMap::reinit().

{
  if (sys == libMesh::invalid_uint)
    {
      for (unsigned int s=0; s<this->n_systems(); s++)
        if (this->n_vars(s))
          return true;
    }

  else
    {
      libmesh_assert_less (sys, this->n_systems());

      if (this->n_vars(sys))
        return true;
    }

  return false;
}
dof_id_type libMesh::DofObject::id ( ) const [inline]
Returns:
the id for this DofObject

Definition at line 619 of file dof_object.h.

References _id, libMesh::libmesh_assert(), and valid_id().

Referenced by libMesh::MetisPartitioner::_do_partition(), libMesh::SFCPartitioner::_do_partition(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::MeshTools::Subdivision::add_boundary_ghosts(), libMesh::SerialMesh::add_elem(), libMesh::ParallelMesh::add_elem(), libMesh::SerialMesh::add_node(), libMesh::ParallelMesh::add_node(), libMesh::ParallelMesh::add_point(), libMesh::UnstructuredMesh::all_first_order(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Subdivision::all_subdivision(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::MeshData::assign(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::MeshTools::Generation::build_delaunay_square(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::VTKIO::cells_to_vtk(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::FEGenericBase< OutputType >::compute_periodic_constraints(), libMesh::FEMap::compute_single_point_map(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::SerialMesh::delete_elem(), libMesh::ParallelMesh::delete_elem(), libMesh::SerialMesh::delete_node(), libMesh::ParallelMesh::delete_node(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::MeshData::elem_to_foreign_id(), libMesh::UNVIO::elements_out(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshTools::find_nodal_neighbors(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshTools::Modification::flatten(), libMesh::Node::get_info(), libMesh::Elem::get_info(), libMesh::DofMap::get_local_constraints(), libMesh::EquationSystems::get_solution(), libMesh::UNVIO::groups_in(), libMesh::LaplaceMeshSmoother::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::TreeNode< N >::insert(), libMesh::SerialMesh::insert_elem(), libMesh::ParallelMesh::insert_elem(), libMesh::SerialMesh::insert_node(), libMesh::FE< Dim, T >::inverse_map(), libMesh::MeshTools::libmesh_assert_valid_amr_elem_ids(), libMesh::MeshTools::libmesh_assert_valid_elem_ids(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::Tri3Subdivision::local_node_number(), libMesh::Elem::node(), libMesh::MeshData::node_to_foreign_id(), libMesh::UNVIO::nodes_out(), libMesh::VTKIO::nodes_to_vtk(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::BoundaryInfo::operator=(), libMesh::Parallel::pack(), libMesh::ErrorVector::plot_error(), libMesh::ParallelMesh::query_elem(), libMesh::ParallelMesh::query_node_ptr(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::AbaqusIO::read_elements(), libMesh::ParallelMesh::renumber_elem(), libMesh::ParallelMesh::renumber_node(), libMesh::ParallelMesh::renumber_nodes_and_elements(), libMesh::DofMap::scatter_constraints(), libMesh::HPCoarsenTest::select_refinement(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::FE< Dim, T >::shape(), libMesh::FE< Dim, T >::shape_deriv(), libMesh::FE< Dim, T >::shape_second_deriv(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshTools::Modification::smooth(), libMesh::SerialMesh::stitching_helper(), 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(), libMesh::Elem::topological_neighbor(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::Parallel::unpack(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::CheckpointIO::write_connectivity(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::GmshIO::write_mesh(), libMesh::LegacyXdrIO::write_mesh(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::CheckpointIO::write_nodes(), and libMesh::XdrIO::write_serialized_connectivity().

{
  libmesh_assert (this->valid_id());
  return _id;
}
void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name) [inline, protected, inherited]

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

Definition at line 163 of file reference_counter.h.

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

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

{
  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
  std::pair<unsigned int, unsigned int>& p = _counts[name];

  p.first++;
}
void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name) [inline, protected, inherited]

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

Definition at line 176 of file reference_counter.h.

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

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

{
  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
  std::pair<unsigned int, unsigned int>& p = _counts[name];

  p.second++;
}
void libMesh::DofObject::invalidate ( ) [inline]

Invalidates all the indices for this DofObject

Definition at line 575 of file dof_object.h.

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

Referenced by DofObject().

{
  this->invalidate_dofs ();
  this->invalidate_id ();
  this->invalidate_processor_id ();
}
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 539 of file dof_object.h.

References invalid_id, n_comp_group(), n_systems(), n_var_groups(), and set_vg_dof_base().

Referenced by invalidate().

{
  // If the user does not specify the system number...
  if (sys_num >= this->n_systems())
    {
      for (unsigned int s=0; s<this->n_systems(); s++)
        for (unsigned int vg=0; vg<this->n_var_groups(s); vg++)
          if (this->n_comp_group(s,vg))
            this->set_vg_dof_base(s,vg,invalid_id);
    }
  // ...otherwise invalidate the dofs for all systems
  else
    for (unsigned int vg=0; vg<this->n_var_groups(sys_num); vg++)
      if (this->n_comp_group(sys_num,vg))
        this->set_vg_dof_base(sys_num,vg,invalid_id);
}

Sets the id to invalid_id

Definition at line 559 of file dof_object.h.

References invalid_id, and set_id().

Referenced by invalidate().

{
  this->set_id (invalid_id);
}
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 767 of file dof_object.h.

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

Referenced by libMesh::DofMap::_dof_indices(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEGenericBase< OutputType >::compute_periodic_constraints(), libMesh::DofMap::constrain_p_dofs(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), dof_number(), DofObject(), libMesh::Node::get_info(), libMesh::Elem::get_info(), libMesh::DofMap::local_variable_indices(), n_dofs(), libMesh::DofMap::old_dof_indices(), operator=(), set_dof_number(), set_n_vars_per_group(), libMesh::DofMap::set_nonlocal_dof_objects(), and libMesh::System::zero_variable().

{
  libmesh_assert_less (s,   this->n_systems());
  libmesh_assert_less (var, this->n_vars(s));

  return this->n_comp_group(s,this->var_to_vg(s,var));
}
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 780 of file dof_object.h.

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

Referenced by libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), dof_number(), invalidate_dofs(), n_comp(), libMesh::DofMap::reinit(), set_dof_number(), set_n_comp_group(), set_n_vars_per_group(), and libMesh::DofMap::set_nonlocal_dof_objects().

{
  libmesh_assert_less (s,  this->n_systems());
  libmesh_assert_less (vg, this->n_var_groups(s));

  const unsigned int
    start_idx_sys = this->start_idx(s);

  libmesh_assert_less ((start_idx_sys + 2*vg), _idx_buf.size());

  return (_idx_buf[start_idx_sys + 2*vg] % ncv_magic);
}
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 for this object. Optionally only counts degrees of freedom for variable number var

Definition at line 597 of file dof_object.h.

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

Referenced by libMesh::EquationSystems::build_solution_vector().

{
  libmesh_assert_less (s, this->n_systems());

  unsigned int num = 0;

  // Count all variables
  if (var == libMesh::invalid_uint)
    for (unsigned int v=0; v<this->n_vars(s); v++)
      num += this->n_comp(s,v);

  // Only count specified variable
  else
    num = this->n_comp(s,var);

  return num;
}
static unsigned int libMesh::ReferenceCounter::n_objects ( ) [inline, static, inherited]

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

Definition at line 79 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

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

  { return _n_objects; }
unsigned int libMesh::DofObject::n_var_groups ( const unsigned int  s) const [inline]
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 732 of file dof_object.h.

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

Referenced by libMesh::DofMap::add_neighbors_to_send_list(), add_system(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::DofMap::distribute_dofs(), dof_number(), DofObject(), libMesh::Node::get_info(), libMesh::Elem::get_info(), has_dofs(), n_comp(), n_dofs(), n_vars(), operator=(), 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(), and var_to_vg().

{
  libmesh_assert_less (s,  this->n_systems());
  libmesh_assert_less (vg, this->n_var_groups(s));

  const unsigned int start_idx_sys = this->start_idx(s);

  libmesh_assert_less ((start_idx_sys + 2*vg), _idx_buf.size());

  return (cast_int<unsigned int>
          (_idx_buf[start_idx_sys + 2*vg]) >> ncv_magic_exp);
}
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 749 of file dof_object.h.

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

{
  libmesh_assert_less (s, this->n_systems());

  const unsigned int nvg = this->n_var_groups(s);

  unsigned int val=0;

  for (unsigned int vg=0; vg<nvg; vg++)
    val += this->n_vars(s,vg);

  return val;
}
DofObject & libMesh::DofObject::operator= ( const DofObject dof_obj) [protected]

Deep-copying assignment operator

Definition at line 82 of file dof_object.C.

References _id, _idx_buf, _processor_id, _unique_id, clear_old_dof_object(), dof_number(), DofObject(), n_comp(), n_systems(), n_var_groups(), n_vars(), and old_dof_object.

{
  if (&dof_obj == this)
    return *this;

#ifdef LIBMESH_ENABLE_AMR
  this->clear_old_dof_object();

  this->old_dof_object = new DofObject(*(dof_obj.old_dof_object));
#endif

  _id           = dof_obj._id;
#ifdef LIBMESH_ENABLE_UNIQUE_ID
  _unique_id    = dof_obj._unique_id;
#endif
  _processor_id = dof_obj._processor_id;
  _idx_buf      = dof_obj._idx_buf;


  // Check that everything worked
#ifdef DEBUG

  libmesh_assert_equal_to (this->n_systems(), dof_obj.n_systems());

  for (unsigned int s=0; s<this->n_systems(); s++)
    {
      libmesh_assert_equal_to (this->n_vars(s),       dof_obj.n_vars(s));
      libmesh_assert_equal_to (this->n_var_groups(s), dof_obj.n_var_groups(s));

      for (unsigned int vg=0; vg<this->n_var_groups(s); vg++)
        libmesh_assert_equal_to (this->n_vars(s,vg), dof_obj.n_vars(s,vg));

      for (unsigned int v=0; v<this->n_vars(s); v++)
        {
          libmesh_assert_equal_to (this->n_comp(s,v), dof_obj.n_comp(s,v));

          for (unsigned int c=0; c<this->n_comp(s,v); c++)
            libmesh_assert_equal_to (this->dof_number(s,v,c), dof_obj.dof_number(s,v,c));
        }
    }

#endif

  return *this;
}
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 525 of file dof_object.C.

Referenced by libMesh::Parallel::pack().

{
#ifdef LIBMESH_ENABLE_AMR
  // We might need to pack old_dof_object too
  *target++ = (old_dof_object == NULL) ? 0 : 1;
#endif

  *target++ = _idx_buf.size();
  std::copy(_idx_buf.begin(), _idx_buf.end(), target);

#ifdef LIBMESH_ENABLE_AMR
  if (old_dof_object)
    old_dof_object->pack_indexing(target);
#endif
}

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

Definition at line 450 of file dof_object.C.

References _idx_buf, and old_dof_object.

Referenced by libMesh::Parallel::pack(), libMesh::Parallel::packable_size(), libMesh::Node::packed_size(), and libMesh::Parallel::unpack().

{
  return
    cast_int<unsigned int> (
#ifdef LIBMESH_ENABLE_AMR
                            ((old_dof_object == NULL) ? 0 : old_dof_object->packed_indexing_size()) + 2 +
#else
                            1 +
#endif
                            _idx_buf.size());
}
void libMesh::ReferenceCounter::print_info ( std::ostream &  out = libMesh::out) [static, inherited]

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

Definition at line 88 of file reference_counter.C.

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

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

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 681 of file dof_object.h.

References _processor_id.

Referenced by libMesh::LinearPartitioner::_do_partition(), libMesh::MetisPartitioner::_do_partition(), libMesh::SFCPartitioner::_do_partition(), libMesh::CentroidPartitioner::_do_partition(), libMesh::GMVIO::_read_materials(), libMesh::ParallelMesh::add_elem(), libMesh::Patch::add_local_face_neighbors(), libMesh::Patch::add_local_point_neighbors(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::ParallelMesh::add_node(), libMesh::SerialMesh::add_point(), libMesh::ParallelMesh::add_point(), libMesh::UnstructuredMesh::all_first_order(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::Patch::build_around_element(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::UnstructuredMesh::create_submesh(), libMesh::ParallelMesh::delete_elem(), libMesh::ParallelMesh::delete_node(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::Elem::Elem(), libMesh::MeshFunction::find_element(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshTools::Modification::flatten(), libMesh::Node::get_info(), libMesh::Elem::get_info(), libMesh::DofMap::get_info(), libMesh::DofMap::get_local_constraints(), libMesh::ParallelMesh::insert_elem(), invalidate_processor_id(), libMesh::Elem::is_semilocal(), libMesh::MeshTools::libmesh_assert_valid_amr_elem_ids(), libMesh::MeshTools::libmesh_assert_valid_elem_ids(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::Parallel::pack(), libMesh::XdrIO::pack_element(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), processor_id(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::MeshData::read_xdr(), libMesh::Elem::refine(), libMesh::DofMap::scatter_constraints(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), 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(), libMesh::Parallel::unpack(), libMesh::CheckpointIO::write_connectivity(), libMesh::GmshIO::write_mesh(), libMesh::CheckpointIO::write_nodes(), libMesh::XdrIO::write_serialized_connectivity(), and libMesh::Nemesis_IO_Helper::write_sidesets().

{
  return _processor_id;
}
Returns:
the processor that this DofObject belongs to as a writeable reference.

Definition at line 689 of file dof_object.h.

References _processor_id.

{
  return _processor_id;
}

Sets the processor_id for this DofObject.

Definition at line 697 of file dof_object.h.

References processor_id().

{
  this->processor_id() = pid;
}
void libMesh::DofObject::set_buffer ( const std::vector< dof_id_type > &  buf) [inline]

Definition at line 499 of file dof_object.h.

References _idx_buf.

  { _idx_buf = buf; }
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 407 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().

{
  libmesh_assert_less (s,    this->n_systems());
  libmesh_assert_less (var,  this->n_vars(s));
  libmesh_assert_less (comp, this->n_comp(s,var));

  const unsigned int
    vg            = this->var_to_vg(s,var),
#ifndef NDEBUG
    ncg           = this->n_comp_group(s,vg),
#endif
    vig           = this->system_var_to_vg_var(s,vg,var),
    start_idx_sys = this->start_idx(s);

  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());

  dof_id_type &base_idx = _idx_buf[start_idx_sys + 2*vg + 1];

  // We intend to change all dof numbers together or not at all
  if (comp || vig)
    libmesh_assert ((dn == invalid_id && base_idx == invalid_id) ||
                    (dn == base_idx + vig*ncg + comp));

  // only explicitly store the base index for vig==0, comp==0
  else
    base_idx = dn;

  // #ifdef DEBUG
  //   libMesh::out << " [ ";
  //   for (unsigned int i=0; i<_idx_buf.size(); i++)
  //     libMesh::out << _idx_buf[i] << " ";
  //   libMesh::out << "]\n";
  // #endif

  libmesh_assert_equal_to (this->dof_number(s, var, comp), dn);
}
void libMesh::DofObject::set_id ( const dof_id_type  dofid) [inline]

Sets the id for this DofObject

Definition at line 161 of file dof_object.h.

References set_id().

Referenced by set_id().

  { this->set_id() = dofid; }
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 338 of file dof_object.C.

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

{
  libmesh_assert_less (s,   this->n_systems());
  libmesh_assert_less (var, this->n_vars(s));

  this->set_n_comp_group(s, this->var_to_vg(s,var), ncomp);
}
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 350 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(), and libMesh::DofMap::set_nonlocal_dof_objects().

{
  libmesh_assert_less (s,  this->n_systems());
  libmesh_assert_less (vg, this->n_var_groups(s));

  // Check for trivial return
  if (ncomp == this->n_comp_group(s,vg)) return;

#ifndef NDEBUG
  if (ncomp >= ncv_magic)
    {
      const index_t ncvm = ncv_magic;
      libmesh_error_msg("ERROR: ncomp must be less than DofObject::ncv_magic!\n" \
                        << "ncomp = "                                   \
                        << ncomp                                \
                        << ", ncv_magic = "                     \
                        << ncvm                                 \
                        << "\nrecompile and try again!");
    }
#endif

  const unsigned int
    start_idx_sys = this->start_idx(s),
    n_vars_group  = this->n_vars(s,vg),
    base_offset   = start_idx_sys + 2*vg;

  libmesh_assert_less ((base_offset + 1), _idx_buf.size());

  // if (ncomp)
  //   libMesh::out << "s,vg,ncomp="
  //       << s  << ","
  //       << vg << ","
  //       << ncomp << '\n';

  // set the number of components, maintaining the number
  // of variables in the group
  _idx_buf[base_offset] = ncv_magic*n_vars_group + ncomp;

  // We use (invalid_id - 1) to signify no
  // components for this object
  _idx_buf[base_offset + 1] = (ncomp == 0) ? invalid_id - 1 : invalid_id;

  // this->debug_buffer();
  // libMesh::out << "s,vg = " << s << "," << vg << '\n'
  //     << "base_offset=" << base_offset << '\n'
  //     << "this->n_comp(s,vg)=" << this->n_comp(s,vg) << '\n'
  //     << "this->n_comp_group(s,vg)=" << this->n_comp_group(s,vg) << '\n'
  //     << "this->n_vars(s,vg)=" << this->n_vars(s,vg) << '\n'
  //     << "this->n_var_groups(s)=" << this->n_var_groups(s) << '\n';

  libmesh_assert_equal_to (ncomp, this->n_comp_group(s,vg));
}
void libMesh::DofObject::set_n_systems ( const unsigned int  s)

Sets the number of systems for this DofObject

Definition at line 157 of file dof_object.C.

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

Referenced by add_system(), and libMesh::Elem::refine().

{
  // Check for trivial return
  if (ns == this->n_systems())
    return;

  // Clear any existing data.  This is safe to call
  // even if we don't have any data.
  this->clear_dofs();

  // Set the new number of systems
  _idx_buf.resize(ns, ns);
  _idx_buf[0] = ns;


#ifdef DEBUG

  // check that all systems now exist and that they have 0 size
  libmesh_assert_equal_to (ns, this->n_systems());
  for (unsigned int s=0; s<this->n_systems(); s++)
    {
      libmesh_assert_equal_to (this->n_vars(s),       0);
      libmesh_assert_equal_to (this->n_var_groups(s), 0);
    }

#endif
}
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 salso 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 219 of file dof_object.C.

References _idx_buf, end, end_idx(), invalid_id, n_comp(), n_comp_group(), n_systems(), n_var_groups(), n_vars(), ncv_magic, set_n_comp_group(), and start_idx().

{

  libmesh_assert_less (s, this->n_systems());

  // number of varaible groups for this system - inferred
  const unsigned int nvg = cast_int<unsigned int>(nvpg.size());

  // BSK - note that for compatibility with the previous implementation
  // calling this method when (nvars == this->n_vars()) requires that
  // we invalidate the DOF indices and set the number of components to 0.
  // Note this was a bit of a suprise to me - there was no quick return in
  // the old method, which caused removal and readdition of the DOF indices
  // even in the case of (nvars == this->n_vars()), resulting in n_comp(s,v)
  // implicitly becoming 0 regardless of any previous value.
  // quick return?
  if (nvg == this->n_var_groups(s))
    {
      for (unsigned int vg=0; vg<nvg; vg++)
        {
          this->set_n_comp_group(s,vg,0);
          libmesh_assert_equal_to (this->n_vars(s,vg), nvpg[vg]);
        }
      return;
    }

  // since there is ample opportunity to screw up other systems, let us
  // cache their current sizes and later assert that they are unchanged.
#ifdef DEBUG
  DofObject::index_buffer_t old_system_sizes;
  old_system_sizes.reserve(this->n_systems());

  for (unsigned int s_ctr=0; s_ctr<this->n_systems(); s_ctr++)
    old_system_sizes.push_back(this->n_var_groups(s_ctr));
#endif

  // remove current indices if we have some
  if (this->n_var_groups(s) != 0)
    {
      const unsigned int old_nvg_s = this->n_var_groups(s);

      DofObject::index_buffer_t::iterator
        it  = _idx_buf.begin(),
        end = _idx_buf.begin();

      std::advance(it,  this->start_idx(s));
      std::advance(end, this->end_idx(s));
      _idx_buf.erase(it,end);

      for (unsigned int ctr=(s+1); ctr<this->n_systems(); ctr++)
        _idx_buf[ctr] -= 2*old_nvg_s;
    }

  // better not have any now!
  libmesh_assert_equal_to (this->n_var_groups(s), 0);

  // had better not screwed up any of our sizes!
#ifdef DEBUG
  for (unsigned int s_ctr=0; s_ctr<this->n_systems(); s_ctr++)
    if (s_ctr != s)
      libmesh_assert_equal_to (this->n_var_groups(s_ctr), old_system_sizes[s_ctr]);
#endif

  // OK, if the user requested 0 that is what we have
  if (nvg == 0)
    return;

  {
    // array to hold new indices
    DofObject::index_buffer_t var_idxs(2*nvg);
    for (unsigned int vg=0; vg<nvg; vg++)
      {
        var_idxs[2*vg    ] = ncv_magic*nvpg[vg] + 0;
        var_idxs[2*vg + 1] = invalid_id - 1;
      }

    DofObject::index_buffer_t::iterator it = _idx_buf.begin();
    std::advance(it, this->end_idx(s));
    _idx_buf.insert(it, var_idxs.begin(), var_idxs.end());

    for (unsigned int ctr=(s+1); ctr<this->n_systems(); ctr++)
      _idx_buf[ctr] += 2*nvg;

    // resize _idx_buf to fit so no memory is wasted.
    DofObject::index_buffer_t(_idx_buf).swap(_idx_buf);
  }

  // that better had worked.  Assert stuff.
  libmesh_assert_equal_to (nvg, this->n_var_groups(s));

#ifdef DEBUG

  // libMesh::out << " [ ";
  // for (unsigned int i=0; i<_idx_buf.size(); i++)
  //   libMesh::out << _idx_buf[i] << " ";
  // libMesh::out << "]\n";

  libmesh_assert_equal_to (this->n_var_groups(s), nvpg.size());

  for (unsigned int vg=0; vg<this->n_var_groups(s); vg++)
    {
      libmesh_assert_equal_to (this->n_vars(s,vg), nvpg[vg]);
      libmesh_assert_equal_to (this->n_comp_group(s,vg), 0);
    }

  for (unsigned int v=0; v<this->n_vars(s); v++)
    libmesh_assert_equal_to (this->n_comp(s,v), 0);

  // again, all other system sizes shoudl be unchanged!
  for (unsigned int s_ctr=0; s_ctr<this->n_systems(); s_ctr++)
    if (s_ctr != s)
      libmesh_assert_equal_to (this->n_var_groups(s_ctr), old_system_sizes[s_ctr]);

#endif
}

Sets the old_dof_object to a copy of this

Definition at line 142 of file dof_object.C.

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

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

{
  this->clear_old_dof_object();

  libmesh_assert (!this->old_dof_object);

  // Make a new DofObject, assign a copy of \p this.
  // Make sure the copy ctor for DofObject works!!
  this->old_dof_object = new DofObject(*this);
}
Returns:
the globally unique_id for this DofObject as a writeable reference.

Definition at line 649 of file dof_object.h.

References _unique_id.

Referenced by libMesh::SerialMesh::add_elem(), libMesh::ParallelMesh::add_elem(), libMesh::SerialMesh::add_node(), libMesh::ParallelMesh::add_node(), libMesh::CheckpointIO::read_connectivity(), libMesh::CheckpointIO::read_nodes(), libMesh::XdrIO::read_serialized_connectivity(), and libMesh::Parallel::unpack().

{
#ifdef LIBMESH_ENABLE_UNIQUE_ID
  return _unique_id;
#else
  libmesh_not_implemented();
#endif
}
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 889 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(), and libMesh::DofMap::set_nonlocal_dof_objects().

{
  libmesh_assert_less (s,  this->n_systems());
  libmesh_assert_less (vg, this->n_var_groups(s));

  const unsigned int
    start_idx_sys = this->start_idx(s);

  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());

  _idx_buf[start_idx_sys + 2*vg + 1] = db;

  libmesh_assert_equal_to (this->vg_dof_base(s,vg), db);
}
unsigned int libMesh::DofObject::start_idx ( const unsigned int  s) const [inline, private]

The starting index for system s.

Definition at line 865 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().

{
  libmesh_assert_less (s, this->n_systems());
  libmesh_assert_less (s, _idx_buf.size());

  return cast_int<unsigned int>(_idx_buf[s]);
}
unsigned int libMesh::DofObject::system_var_to_vg_var ( const unsigned int  s,
const unsigned int  vg,
const unsigned int  var 
) const [inline, private]

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

Definition at line 952 of file dof_object.h.

References n_vars().

Referenced by dof_number(), and set_dof_number().

{
  unsigned int accumulated_sum=0;

  for (unsigned int vgc=0; vgc<vg; vgc++)
    accumulated_sum += this->n_vars(s,vgc);

  libmesh_assert_less_equal (accumulated_sum, var);

  return (var - accumulated_sum);
}
Returns:
the globally unique_id for this DofObject

Definition at line 636 of file dof_object.h.

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

Referenced by libMesh::Parallel::pack(), libMesh::XdrIO::pack_element(), libMesh::CheckpointIO::write_connectivity(), and libMesh::CheckpointIO::write_nodes().

{
#ifdef LIBMESH_ENABLE_UNIQUE_ID
  libmesh_assert (this->valid_unique_id());
  return _unique_id;
#else
  return invalid_unique_id;
#endif
}
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 487 of file dof_object.C.

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

Referenced by libMesh::Parallel::unpack(), and unpack_indexing().

{
  _idx_buf.clear();

#ifdef LIBMESH_ENABLE_AMR
  this->clear_old_dof_object();
  const bool has_old_dof_object = cast_int<bool>(*begin++);
#endif

  const largest_id_type size = *begin++;
  _idx_buf.reserve(size);
  std::copy(begin, begin+size, back_inserter(_idx_buf));

  // Check as best we can for internal consistency now
  libmesh_assert(_idx_buf.empty() ||
                 (_idx_buf[0] <= _idx_buf.size()));
#ifdef DEBUG
  if (!_idx_buf.empty())
    for (unsigned int i=1; i < _idx_buf[0]; ++i)
      {
        libmesh_assert_greater_equal (_idx_buf[i], _idx_buf[i-1]);
        libmesh_assert_equal_to ((_idx_buf[i] - _idx_buf[i-1])%2, 0);
        libmesh_assert_less_equal (_idx_buf[i], _idx_buf.size());
      }
#endif

#ifdef LIBMESH_ENABLE_AMR
  if (has_old_dof_object)
    {
      this->old_dof_object = new DofObject();
      this->old_dof_object->unpack_indexing(begin+size);
    }
#endif
}
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 466 of file dof_object.C.

Referenced by libMesh::Parallel::pack(), libMesh::Parallel::packed_size(), and libMesh::Parallel::unpack().

{
#ifdef LIBMESH_ENABLE_AMR
  const bool has_old_dof_object = cast_int<bool>(*begin++);

  static const int dof_header_size = 2;
#else
  static const bool has_old_dof_object = false;
  static const int dof_header_size = 1;
#endif

  const largest_id_type this_indexing_size = *begin++;

  return cast_int<unsigned int>
    (dof_header_size + this_indexing_size +
     (has_old_dof_object ?
      unpackable_indexing_size(begin+this_indexing_size) : 0));
}
bool libMesh::DofObject::valid_processor_id ( ) const [inline]
Returns:
true if this DofObject has a valid id set, false otherwise.

Definition at line 705 of file dof_object.h.

References _processor_id, and invalid_processor_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 669 of file dof_object.h.

References _unique_id, and invalid_unique_id.

Referenced by libMesh::SerialMesh::add_elem(), libMesh::ParallelMesh::add_elem(), libMesh::SerialMesh::add_node(), libMesh::ParallelMesh::add_node(), libMesh::Parallel::pack(), and unique_id().

{
#ifdef LIBMESH_ENABLE_UNIQUE_ID
  return (DofObject::invalid_unique_id != _unique_id);
#else
  return false;
#endif
}
unsigned int libMesh::DofObject::var_to_vg ( const unsigned int  s,
const unsigned int  var 
) const [inline, private]

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

Definition at line 933 of file dof_object.h.

References n_var_groups(), and n_vars().

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

{
  const unsigned int
    nvg = this->n_var_groups(s);

  for (unsigned int vg=0, vg_end=0; vg<nvg; vg++)
    {
      vg_end += this->n_vars(s,vg);
      if (var < vg_end) return vg;
    }

  libmesh_error_msg("We'll never get here!");
  return 0;
}
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 909 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(), and set_vg_dof_base().

{
  libmesh_assert_less (s,  this->n_systems());
  libmesh_assert_less (vg, this->n_var_groups(s));

  const unsigned int
    start_idx_sys = this->start_idx(s);

  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());

  // #ifdef DEBUG
  //   std::cout << " [ ";
  //   for (unsigned int i=0; i<_idx_buf.size(); i++)
  //     std::cout << _idx_buf[i] << " ";
  //   std::cout << "]\n";
  // #endif

  return _idx_buf[start_idx_sys + 2*vg + 1];
}

Member Data Documentation

bool libMesh::ReferenceCounter::_enable_print_counter = true [static, protected, inherited]

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

Definition at line 137 of file reference_counter.h.

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

The id of the DofObject

Definition at line 407 of file dof_object.h.

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

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 131 of file reference_counter.h.

Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects [static, protected, inherited]

The number of objects. Print the reference count information when the number returns to 0.

Definition at line 126 of file reference_counter.h.

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

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 418 of file dof_object.h.

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

A globally unique id, guarenteed not to change as the mesh is repartioned or adapted

Definition at line 401 of file dof_object.h.

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

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

Definition at line 346 of file dof_object.h.

Referenced by libMesh::ParallelMesh::add_elem(), libMesh::ParallelMesh::add_node(), libMesh::MeshCommunication::allgather(), libMesh::MeshTools::bounding_box(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ParallelMesh::delete_elem(), libMesh::ParallelMesh::delete_node(), libMesh::Elem::Elem(), libMesh::MeshCommunication::find_global_indices(), libMesh::ParallelMesh::insert_elem(), invalidate_processor_id(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::ParallelMesh::n_active_elem(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::MeshBase::n_unpartitioned_elem(), libMesh::MeshBase::n_unpartitioned_nodes(), libMesh::CheckpointIO::read_connectivity(), libMesh::ParallelMesh::renumber_dof_objects(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::BoundaryInfo::sync(), 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(), libMesh::MeshTools::total_weight(), libMesh::Parallel::unpack(), libMesh::SerialMesh::unpartitioned_elements_begin(), libMesh::ParallelMesh::unpartitioned_elements_begin(), libMesh::SerialMesh::unpartitioned_elements_end(), libMesh::ParallelMesh::unpartitioned_elements_end(), valid_processor_id(), and libMesh::CheckpointIO::write_connectivity().

An invaild unique_id to distinguish an uninitialized DofObject

Definition at line 340 of file dof_object.h.

Referenced by libMesh::Parallel::pack(), libMesh::ParallelMesh::renumber_dof_objects(), unique_id(), and valid_unique_id().

const index_t libMesh::DofObject::ncv_magic = 256 [static, private]

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 recgnize later that #/ncv_magic is simply a bitshift

Definition at line 483 of file dof_object.h.

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

const index_t libMesh::DofObject::ncv_magic_exp = 8 [static, private]

Definition at line 484 of file dof_object.h.

Referenced by n_vars().


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