20 #ifndef LIBMESH_DOF_OBJECT_H 21 #define LIBMESH_DOF_OBJECT_H 53 #ifdef LIBMESH_IS_UNIT_TESTING 73 #ifdef LIBMESH_ENABLE_AMR 124 unsigned int n_dofs (
const unsigned int s,
125 const unsigned int var =
152 { this->
set_id() = dofid; }
218 unsigned int n_vars(
const unsigned int s,
219 const unsigned int vg)
const;
225 unsigned int n_vars(
const unsigned int s)
const;
235 const std::vector<unsigned int> & nvpg);
246 unsigned int n_comp(
const unsigned int s,
247 const unsigned int var)
const;
259 const unsigned int vg)
const;
266 const unsigned int var,
267 const unsigned int ncomp);
274 const unsigned int vg,
275 const unsigned int ncomp);
286 const unsigned int var,
287 const unsigned int comp)
const;
298 const unsigned int vg,
299 const unsigned int vig,
300 const unsigned int comp,
301 const unsigned int n_comp)
const;
308 std::pair<unsigned int, unsigned int>
310 const unsigned int var)
const;
317 const unsigned int var,
318 const unsigned int comp,
333 const unsigned int vg,
342 const unsigned int vg)
const;
371 (std::vector<largest_id_type>::const_iterator begin);
378 void unpack_indexing(std::vector<largest_id_type>::const_iterator begin);
385 void pack_indexing(std::back_insert_iterator<std::vector<largest_id_type>> target)
const;
400 #ifndef LIBMESH_ENABLE_DEPRECATED 421 unsigned int var_to_vg (
const unsigned int s,
422 const unsigned int var)
const;
429 const unsigned int vg,
430 const unsigned int var)
const;
435 #ifdef LIBMESH_ENABLE_UNIQUE_ID 525 unsigned int start_idx(
const unsigned int s)
const;
530 unsigned int end_idx(
const unsigned int s)
const;
533 #ifdef LIBMESH_IS_UNIT_TESTING 546 #ifdef LIBMESH_ENABLE_AMR
547 old_dof_object(nullptr),
549 #ifdef LIBMESH_ENABLE_UNIQUE_ID
550 _unique_id (invalid_unique_id),
566 #ifdef LIBMESH_ENABLE_AMR 580 for (
unsigned int s=0; s<this->
n_systems(); s++)
587 for (
unsigned int vg=0; vg<this->
n_var_groups(sys_num); vg++)
626 libmesh_assert_equal_to (this->
n_systems(), 0);
634 const unsigned int var)
const 636 libmesh_assert_less (s, this->
n_systems());
638 unsigned int num = 0;
642 for (
unsigned int v=0; v<this->
n_vars(s); v++)
647 num = this->
n_comp(s,var);
674 #ifdef LIBMESH_ENABLE_UNIQUE_ID 687 #ifdef LIBMESH_ENABLE_UNIQUE_ID 690 libmesh_not_implemented();
707 #ifdef LIBMESH_ENABLE_UNIQUE_ID 752 0 : cast_int<unsigned int>(
_idx_buf[0]);
760 libmesh_assert_less (s, this->
n_systems());
769 const unsigned int vg)
const 771 libmesh_assert_less (s, this->
n_systems());
774 const unsigned int start_idx_sys = this->
start_idx(s);
776 libmesh_assert_less ((start_idx_sys + 2*vg),
_idx_buf.size());
778 return (cast_int<unsigned int>
787 libmesh_assert_less (s, this->
n_systems());
793 for (
unsigned int vg=0; vg<nvg; vg++)
794 val += this->
n_vars(s,vg);
804 const unsigned int var)
const 806 libmesh_assert_less (s, this->
n_systems());
807 libmesh_assert_less (var, this->
n_vars(s));
817 const unsigned int vg)
const 819 libmesh_assert_less (s, this->
n_systems());
825 libmesh_assert_less ((start_idx_sys + 2*vg),
_idx_buf.size());
834 const unsigned int var,
835 const unsigned int comp)
const 837 libmesh_assert_less (s, this->
n_systems());
838 libmesh_assert_less (var, this->
n_vars(s));
839 libmesh_assert_less (comp, this->
n_comp(s,var));
841 const std::pair<unsigned int, unsigned int>
847 return this->
dof_number(s, vg_vig.first, vg_vig.second,
855 const unsigned int vg,
856 const unsigned int vig,
857 const unsigned int comp,
858 const unsigned int n_comp)
const 860 libmesh_assert_less (s, this->
n_systems());
862 libmesh_assert_less (vig, this->
n_vars(s,vg));
867 libmesh_assert_less ((start_idx_sys + 2*vg + 1),
_idx_buf.size());
870 base_idx =
_idx_buf[start_idx_sys + 2*vg + 1];
880 return cast_int<dof_id_type>(base_idx + vig*
n_comp + comp);
886 std::pair<unsigned int, unsigned int>
888 const unsigned int var)
const 890 std::pair<unsigned int, unsigned int> returnval(0,0);
892 unsigned int & vg = returnval.first;
893 unsigned int & offset = returnval.second;
895 unsigned int vg_start = 0;
900 const unsigned int vg_end = vg_start + this->
n_vars(s,vg);
903 offset = var - vg_start;
917 for (
unsigned int s=0; s<this->
n_systems(); s++)
924 libmesh_assert_less (sys, this->
n_systems());
938 libmesh_assert_less (s, this->
n_systems());
939 libmesh_assert_less (s,
_idx_buf.size());
941 return cast_int<unsigned int>(
_idx_buf[s]);
949 libmesh_assert_less (s, this->
n_systems());
950 libmesh_assert_less (s,
_idx_buf.size());
953 cast_int<unsigned int>(
_idx_buf.size()) :
954 cast_int<unsigned int>(
_idx_buf[s+1]);
961 const unsigned int vg,
964 libmesh_assert_less (s, this->
n_systems());
970 libmesh_assert_less ((start_idx_sys + 2*vg + 1),
_idx_buf.size());
972 _idx_buf[start_idx_sys + 2*vg + 1] = db;
974 libmesh_assert_equal_to (this->
vg_dof_base(s,vg), db);
981 const unsigned int vg)
const 983 libmesh_assert_less (s, this->
n_systems());
989 libmesh_assert_less ((start_idx_sys + 2*vg + 1),
_idx_buf.size());
998 return _idx_buf[start_idx_sys + 2*vg + 1];
1005 const unsigned int var)
const 1010 for (
unsigned int vg=0, vg_end=0; vg<nvg; vg++)
1012 vg_end += this->
n_vars(s,vg);
1013 if (var < vg_end)
return vg;
1016 libmesh_error_msg(
"Error: could not map variable " << var <<
" to variable group.");
1023 const unsigned int vg,
1024 const unsigned int var)
const 1026 unsigned int accumulated_sum=0;
1028 for (
unsigned int vgc=0; vgc<vg; vgc++)
1029 accumulated_sum += this->
n_vars(s,vgc);
1031 libmesh_assert_less_equal (accumulated_sum, var);
1033 return (var - accumulated_sum);
1040 #endif // #ifndef LIBMESH_DOF_OBJECT_H void set_n_comp(const unsigned int s, const unsigned int var, const unsigned int ncomp)
unsigned int system_var_to_vg_var(const unsigned int s, const unsigned int vg, const unsigned int var) const
dof_id_type vg_dof_base(const unsigned int s, const unsigned int vg) const
unique_id_type & set_unique_id()
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
void set_old_dof_object()
static unsigned int unpackable_indexing_size(std::vector< largest_id_type >::const_iterator begin)
const unsigned int invalid_uint
unsigned int n_comp(const unsigned int s, const unsigned int var) const
unsigned int n_var_groups(const unsigned int s) const
unsigned int var_to_vg(const unsigned int s, const unsigned int var) const
void set_id(const dof_id_type dofid)
uint8_t processor_id_type
unique_id_type unique_id() const
void set_vg_dof_base(const unsigned int s, const unsigned int vg, const dof_id_type db)
bool has_dofs(const unsigned int s=libMesh::invalid_uint) const
unique_id_type _unique_id
unsigned int n_dofs(const unsigned int s, const unsigned int var=libMesh::invalid_uint) const
unsigned int end_idx(const unsigned int s) const
void set_buffer(const std::vector< dof_id_type > &buf)
DofObject & operator=(const DofObject &dof_obj)
static const unique_id_type invalid_unique_id
static const processor_id_type invalid_processor_id
void set_dof_number(const unsigned int s, const unsigned int var, const unsigned int comp, const dof_id_type dn)
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
unsigned int n_systems() const
processor_id_type _processor_id
void print_dof_info() const
bool valid_processor_id() const
void clear_old_dof_object()
static const dof_id_type invalid_id
bool valid_unique_id() const
void invalidate_processor_id()
std::vector< index_t > index_buffer_t
void set_n_comp_group(const unsigned int s, const unsigned int vg, const unsigned int ncomp)
void set_n_systems(const unsigned int s)
void set_n_vars_per_group(const unsigned int s, const std::vector< unsigned int > &nvpg)
DofObject * old_dof_object
unsigned int start_idx(const unsigned int s) const
unsigned int packed_indexing_size() const
void pack_indexing(std::back_insert_iterator< std::vector< largest_id_type >> target) const
void invalidate_dofs(const unsigned int sys_num=libMesh::invalid_uint)
void unpack_indexing(std::vector< largest_id_type >::const_iterator begin)
std::pair< unsigned int, unsigned int > var_to_vg_and_offset(const unsigned int s, const unsigned int var) const
void debug_buffer() const
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
processor_id_type processor_id() const
processor_id_type _processor_id
static const index_t ncv_magic_exp
static const index_t ncv_magic