libMesh
dof_object.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_DOF_OBJECT_H
21 #define LIBMESH_DOF_OBJECT_H
22 
23 // Local includes
24 #include "libmesh/id_types.h"
25 #include "libmesh/libmesh_config.h"
26 #include "libmesh/libmesh_common.h"
27 #include "libmesh/libmesh.h" // libMesh::invalid_uint
28 #include "libmesh/reference_counted_object.h"
29 
30 // C++ includes
31 #include <cstddef>
32 #include <vector>
33 
34 namespace libMesh
35 {
36 
37 // Forward declarations
38 class DofObject;
39 
40 
51 class DofObject : public ReferenceCountedObject<DofObject>
52 {
53 #ifdef LIBMESH_IS_UNIT_TESTING
54 public:
55 #else
56 protected:
57 #endif
58 
63  DofObject ();
64 
69  ~DofObject ();
70 
71 public:
72 
73 #ifdef LIBMESH_ENABLE_AMR
74 
80 
84  void clear_old_dof_object ();
85 
89  void set_old_dof_object ();
90 
91 #endif
92 
100  void clear_dofs ();
101 
105  void invalidate_dofs (const unsigned int sys_num = libMesh::invalid_uint);
106 
110  void invalidate_id ();
111 
115  void invalidate_processor_id ();
116 
120  void invalidate ();
121 
127  unsigned int n_dofs (const unsigned int s,
128  const unsigned int var =
129  libMesh::invalid_uint) const;
130 
134  dof_id_type id () const;
135 
139  dof_id_type & set_id ();
140 
144  unique_id_type unique_id () const;
145 
150 
154  void set_id (const dof_id_type dofid)
155  { this->set_id() = dofid; }
156 
161  bool valid_id () const;
162 
167  bool valid_unique_id () const;
168 
177 
183 
187  void processor_id (const processor_id_type pid);
188 
193  bool valid_processor_id () const;
194 
199  unsigned int n_systems() const;
200 
206  unsigned int n_pseudo_systems() const;
207 
216  void set_n_systems (const unsigned int s);
217 
223  void set_extra_integer (const unsigned int index, const dof_id_type value);
224 
230  dof_id_type get_extra_integer (const unsigned int index) const;
231 
235  void add_system ();
236 
241  unsigned int n_var_groups(const unsigned int s) const;
242 
247  unsigned int n_vars(const unsigned int s,
248  const unsigned int vg) const;
249 
254  unsigned int n_vars(const unsigned int s) const;
255 
263  void set_n_vars_per_group(const unsigned int s,
264  const std::vector<unsigned int> & nvpg);
265 
275  unsigned int n_comp(const unsigned int s,
276  const unsigned int var) const;
277 
287  unsigned int n_comp_group(const unsigned int s,
288  const unsigned int vg) const;
289 
294  void set_n_comp(const unsigned int s,
295  const unsigned int var,
296  const unsigned int ncomp);
297 
302  void set_n_comp_group(const unsigned int s,
303  const unsigned int vg,
304  const unsigned int ncomp);
305 
314  dof_id_type dof_number(const unsigned int s,
315  const unsigned int var,
316  const unsigned int comp) const;
317 
326  dof_id_type dof_number(const unsigned int s,
327  const unsigned int vg,
328  const unsigned int vig,
329  const unsigned int comp,
330  const unsigned int n_comp) const;
331 
337  std::pair<unsigned int, unsigned int>
338  var_to_vg_and_offset(const unsigned int s,
339  const unsigned int var) const;
340 
345  void set_dof_number(const unsigned int s,
346  const unsigned int var,
347  const unsigned int comp,
348  const dof_id_type dn);
349 
354  bool has_dofs(const unsigned int s=libMesh::invalid_uint) const;
355 
361  void set_vg_dof_base(const unsigned int s,
362  const unsigned int vg,
363  const dof_id_type db);
364 
370  dof_id_type vg_dof_base(const unsigned int s,
371  const unsigned int vg) const;
372 
378  void add_extra_integers (const unsigned int n_integers);
379 
383  unsigned int n_extra_integers () const;
384 
388  bool has_extra_integers () const;
389 
393  static const dof_id_type invalid_id = static_cast<dof_id_type>(-1);
394 
398  static const unique_id_type invalid_unique_id = static_cast<unique_id_type>(-1);
399 
405 
410  unsigned int packed_indexing_size() const;
411 
416  static unsigned int unpackable_indexing_size
417  (std::vector<largest_id_type>::const_iterator begin);
418 
424  void unpack_indexing(std::vector<largest_id_type>::const_iterator begin);
425 
431  void pack_indexing(std::back_insert_iterator<std::vector<largest_id_type>> target) const;
432 
436  void debug_buffer () const;
437 
441  void print_dof_info() const;
442 
443  // Deep copy (or almost-copy) of DofObjects is now deprecated in
444  // derived classes; we keep these methods around solely for a couple
445  // tricky internal uses.
446 #ifndef LIBMESH_ENABLE_DEPRECATED
447 private:
448 #endif
449 
454  DofObject (const DofObject &);
455 
459  DofObject & operator= (const DofObject & dof_obj);
460 
461 private:
462 
467  unsigned int var_to_vg (const unsigned int s,
468  const unsigned int var) const;
469 
474  unsigned int system_var_to_vg_var (const unsigned int s,
475  const unsigned int vg,
476  const unsigned int var) const;
477 
481 #ifdef LIBMESH_ENABLE_UNIQUE_ID
483 #endif
484 
489 
500 
584  typedef std::vector<index_t> index_buffer_t;
586 
596  static const index_t ncv_magic = 256; // = 2^8, in case we want to manually bitshift
597  static const index_t ncv_magic_exp = 8; // Let's manually bitshift
598 
602  unsigned int start_idx(const unsigned int s) const;
603 
607  unsigned int end_idx(const unsigned int s) const;
608 
612  unsigned int start_idx_ints() const;
613 
617  unsigned int end_idx_ints() const;
618 
619  // methods only available for unit testing
620 #ifdef LIBMESH_IS_UNIT_TESTING
621 public:
622  void set_buffer (const std::vector<dof_id_type> & buf)
623  { _idx_buf = buf; }
624 #endif
625 };
626 
627 
628 
629 //------------------------------------------------------
630 // Inline functions
631 inline
633 #ifdef LIBMESH_ENABLE_AMR
634  old_dof_object(nullptr),
635 #endif
636 #ifdef LIBMESH_ENABLE_UNIQUE_ID
637  _unique_id (invalid_unique_id),
638 #endif
639  _id (invalid_id),
640  _processor_id (invalid_processor_id)
641 {
642  this->invalidate();
643 }
644 
645 
646 
647 
648 
649 inline
651 {
652  // Free all memory.
653 #ifdef LIBMESH_ENABLE_AMR
654  this->clear_old_dof_object ();
655 #endif
656  this->clear_dofs ();
657 }
658 
659 
660 
661 inline
662 void DofObject::invalidate_dofs (const unsigned int sys_num)
663 {
664  // If the user does not specify the system number...
665  if (sys_num >= this->n_systems())
666  {
667  for (unsigned int s=0; s<this->n_systems(); s++)
668  for (unsigned int vg=0; vg<this->n_var_groups(s); vg++)
669  if (this->n_comp_group(s,vg))
670  this->set_vg_dof_base(s,vg,invalid_id);
671  }
672  // ...otherwise invalidate the dofs for all systems
673  else
674  for (unsigned int vg=0; vg<this->n_var_groups(sys_num); vg++)
675  if (this->n_comp_group(sys_num,vg))
676  this->set_vg_dof_base(sys_num,vg,invalid_id);
677 }
678 
679 
680 
681 inline
683 {
684  this->set_id (invalid_id);
685 }
686 
687 
688 
689 inline
691 {
693 }
694 
695 
696 
697 inline
699 {
700  this->invalidate_dofs ();
701  this->invalidate_id ();
702  this->invalidate_processor_id ();
703 }
704 
705 
706 
707 inline
709 {
710  this->set_n_systems(0);
711 }
712 
713 
714 
715 inline
716 unsigned int DofObject::n_dofs (const unsigned int s,
717  const unsigned int var) const
718 {
719  libmesh_assert_less (s, this->n_systems());
720 
721  unsigned int num = 0;
722 
723  // Count all variables
724  if (var == libMesh::invalid_uint)
725  for (unsigned int v=0; v<this->n_vars(s); v++)
726  num += this->n_comp(s,v);
727 
728  // Only count specified variable
729  else
730  num = this->n_comp(s,var);
731 
732  return num;
733 }
734 
735 
736 
737 inline
739 {
740  libmesh_assert (this->valid_id());
741  return _id;
742 }
743 
744 
745 
746 inline
748 {
749  return _id;
750 }
751 
752 
753 
754 inline
756 {
757 #ifdef LIBMESH_ENABLE_UNIQUE_ID
758  libmesh_assert (this->valid_unique_id());
759  return _unique_id;
760 #else
761  return invalid_unique_id;
762 #endif
763 }
764 
765 
766 
767 inline
769 {
770 #ifdef LIBMESH_ENABLE_UNIQUE_ID
771  return _unique_id;
772 #else
773  libmesh_not_implemented();
774 #endif
775 }
776 
777 
778 
779 inline
780 bool DofObject::valid_id () const
781 {
782  return (DofObject::invalid_id != _id);
783 }
784 
785 
786 
787 inline
789 {
790 #ifdef LIBMESH_ENABLE_UNIQUE_ID
792 #else
793  return false;
794 #endif
795 }
796 
797 
798 
799 inline
801 {
802  return _processor_id;
803 }
804 
805 
806 
807 inline
809 {
810  return _processor_id;
811 }
812 
813 
814 
815 inline
817 {
818  this->processor_id() = pid;
819 }
820 
821 
822 
823 inline
825 {
827 }
828 
829 
830 
831 inline
832 unsigned int DofObject::n_systems () const
833 {
834  const int hdr = _idx_buf.empty() ?
835  0 : cast_int<int>(dof_id_signed_type(_idx_buf[0]));
836  return hdr >= 0 ? hdr : (-hdr-1);
837 }
838 
839 
840 
841 inline
842 unsigned int DofObject::n_pseudo_systems () const
843 {
844  const int hdr = _idx_buf.empty() ?
845  0 : cast_int<int>(dof_id_signed_type(_idx_buf[0]));
846  return std::abs(hdr);
847 }
848 
849 
850 
851 inline
852 unsigned int DofObject::n_var_groups(const unsigned int s) const
853 {
854  libmesh_assert_less (s, this->n_systems());
855 
856  return (this->end_idx(s) - this->start_idx(s)) / 2;
857 }
858 
859 
860 
861 inline
862 unsigned int DofObject::n_vars(const unsigned int s,
863  const unsigned int vg) const
864 {
865  libmesh_assert_less (s, this->n_systems());
866  libmesh_assert_less (vg, this->n_var_groups(s));
867 
868  const unsigned int start_idx_sys = this->start_idx(s);
869 
870  libmesh_assert_less ((start_idx_sys + 2*vg), _idx_buf.size());
871 
872  return (cast_int<unsigned int>
873  (_idx_buf[start_idx_sys + 2*vg]) >> ncv_magic_exp);
874 }
875 
876 
877 
878 inline
879 unsigned int DofObject::n_vars(const unsigned int s) const
880 {
881  libmesh_assert_less (s, this->n_systems());
882 
883  const unsigned int nvg = this->n_var_groups(s);
884 
885  unsigned int val=0;
886 
887  for (unsigned int vg=0; vg<nvg; vg++)
888  val += this->n_vars(s,vg);
889 
890  return val;
891 }
892 
893 
894 
895 
896 inline
897 unsigned int DofObject::n_comp(const unsigned int s,
898  const unsigned int var) const
899 {
900  libmesh_assert_less (s, this->n_systems());
901  libmesh_assert_less (var, this->n_vars(s));
902 
903  return this->n_comp_group(s,this->var_to_vg(s,var));
904 }
905 
906 
907 
908 
909 inline
910 unsigned int DofObject::n_comp_group(const unsigned int s,
911  const unsigned int vg) const
912 {
913  libmesh_assert_less (s, this->n_systems());
914  libmesh_assert_less (vg, this->n_var_groups(s));
915 
916  const unsigned int
917  start_idx_sys = this->start_idx(s);
918 
919  libmesh_assert_less ((start_idx_sys + 2*vg), _idx_buf.size());
920 
921  return (_idx_buf[start_idx_sys + 2*vg] % ncv_magic);
922 }
923 
924 
925 
926 inline
927 dof_id_type DofObject::dof_number(const unsigned int s,
928  const unsigned int var,
929  const unsigned int comp) const
930 {
931  libmesh_assert_less (s, this->n_systems());
932  libmesh_assert_less (var, this->n_vars(s));
933  libmesh_assert_less (comp, this->n_comp(s,var));
934 
935  const std::pair<unsigned int, unsigned int>
936  vg_vig = this->var_to_vg_and_offset(s,var);
937 
938  const unsigned int
939  n_comp = this->n_comp_group(s,vg_vig.first);
940 
941  return this->dof_number(s, vg_vig.first, vg_vig.second,
942  comp, n_comp);
943 }
944 
945 
946 
947 inline
948 dof_id_type DofObject::dof_number(const unsigned int s,
949  const unsigned int vg,
950  const unsigned int vig,
951  const unsigned int comp,
952  const unsigned int n_comp) const
953 {
954  libmesh_assert_less (s, this->n_systems());
955  libmesh_assert_less (vg, this->n_var_groups(s));
956  libmesh_assert_less (vig, this->n_vars(s,vg));
957 
958  const unsigned int
959  start_idx_sys = this->start_idx(s);
960 
961  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());
962 
963  const dof_id_type
964  base_idx = _idx_buf[start_idx_sys + 2*vg + 1];
965 
966  // if the first component is invalid, they
967  // are all invalid
968  if (base_idx == invalid_id)
969  return invalid_id;
970 
971  // otherwise the index is the first component
972  // index augmented by the component number
973  else
974  return cast_int<dof_id_type>(base_idx + vig*n_comp + comp);
975 }
976 
977 
978 
979 inline
980 void
981 DofObject::set_extra_integer(const unsigned int index,
982  const dof_id_type value)
983 {
984  libmesh_assert_less(index, this->n_extra_integers());
985  libmesh_assert_less(this->n_pseudo_systems(), _idx_buf.size());
986 
987  const unsigned int start_idx_i = this->start_idx_ints();
988 
989  libmesh_assert_less(start_idx_i+index, _idx_buf.size());
990  _idx_buf[start_idx_i+index] = value;
991 }
992 
993 
994 
995 inline
997 DofObject::get_extra_integer (const unsigned int index) const
998 {
999  libmesh_assert_less(index, this->n_extra_integers());
1000  libmesh_assert_less(this->n_systems(), _idx_buf.size());
1001 
1002  const unsigned int start_idx_i = this->start_idx_ints();
1003 
1004  libmesh_assert_less(start_idx_i+index, _idx_buf.size());
1005  return _idx_buf[start_idx_i+index];
1006 }
1007 
1008 
1009 
1010 inline
1011 unsigned int
1013 {
1014  if (_idx_buf.empty())
1015  return 0;
1016 
1017  const int hdr = dof_id_signed_type(_idx_buf[0]);
1018  if (hdr >= 0)
1019  return 0;
1020 
1021  const unsigned int start_idx_i = this->start_idx_ints();
1022 
1023  return _idx_buf.size() - start_idx_i;
1024 }
1025 
1026 
1027 
1028 inline
1029 bool
1031 {
1032  if (_idx_buf.empty())
1033  return 0;
1034 
1035  return (dof_id_signed_type(_idx_buf[0]) < 0);
1036 }
1037 
1038 
1039 
1040 inline
1041 std::pair<unsigned int, unsigned int>
1042 DofObject::var_to_vg_and_offset(const unsigned int s,
1043  const unsigned int var) const
1044 {
1045  std::pair<unsigned int, unsigned int> returnval(0,0);
1046 
1047  unsigned int & vg = returnval.first;
1048  unsigned int & offset = returnval.second;
1049 
1050  unsigned int vg_start = 0;
1051  for (; ; vg++)
1052  {
1053  libmesh_assert_less(vg, this->n_var_groups(s));
1054 
1055  const unsigned int vg_end = vg_start + this->n_vars(s,vg);
1056  if (var < vg_end)
1057  {
1058  offset = var - vg_start;
1059  return returnval;
1060  }
1061  vg_start = vg_end;
1062  }
1063 }
1064 
1065 
1066 
1067 inline
1068 bool DofObject::has_dofs (const unsigned int sys) const
1069 {
1070  if (sys == libMesh::invalid_uint)
1071  {
1072  for (unsigned int s=0; s<this->n_systems(); s++)
1073  if (this->n_vars(s))
1074  return true;
1075  }
1076 
1077  else
1078  {
1079  libmesh_assert_less (sys, this->n_systems());
1080 
1081  if (this->n_vars(sys))
1082  return true;
1083  }
1084 
1085  return false;
1086 }
1087 
1088 
1089 
1090 inline
1091 unsigned int DofObject::start_idx (const unsigned int s) const
1092 {
1093  libmesh_assert_less (s, this->n_systems());
1094  libmesh_assert_less (s, _idx_buf.size());
1095 
1096  return cast_int<unsigned int>(std::abs(dof_id_signed_type(_idx_buf[s])));
1097 }
1098 
1099 
1100 
1101 inline
1102 unsigned int DofObject::end_idx (const unsigned int s) const
1103 {
1104  libmesh_assert_less (s, this->n_systems());
1105  libmesh_assert_less (s, _idx_buf.size());
1106 
1107  return ((s+1) == this->n_pseudo_systems()) ?
1108  cast_int<unsigned int>(_idx_buf.size()) :
1109  cast_int<unsigned int>(_idx_buf[s+1]);
1110 }
1111 
1112 
1113 
1114 inline
1115 unsigned int DofObject::start_idx_ints () const
1116 {
1117  libmesh_assert (this->has_extra_integers());
1118 
1119  unsigned int n_sys = this->n_systems();
1120 
1121  libmesh_assert_less(this->n_systems(), _idx_buf.size());
1122  return n_sys ? cast_int<unsigned int>(_idx_buf[this->n_systems()]) :
1123  (n_sys+1);
1124 }
1125 
1126 
1127 
1128 inline
1129 unsigned int DofObject::end_idx_ints () const
1130 {
1131  libmesh_assert (this->has_extra_integers());
1132 
1133  return cast_int<unsigned int>(_idx_buf.size());
1134 }
1135 
1136 
1137 
1138 inline
1139 void DofObject::set_vg_dof_base(const unsigned int s,
1140  const unsigned int vg,
1141  const dof_id_type db)
1142 {
1143  libmesh_assert_less (s, this->n_systems());
1144  libmesh_assert_less (vg, this->n_var_groups(s));
1145 
1146  const unsigned int
1147  start_idx_sys = this->start_idx(s);
1148 
1149  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());
1150 
1151  _idx_buf[start_idx_sys + 2*vg + 1] = db;
1152 
1153  libmesh_assert_equal_to (this->vg_dof_base(s,vg), db);
1154 }
1155 
1156 
1157 
1158 inline
1160  const unsigned int vg) const
1161 {
1162  libmesh_assert_less (s, this->n_systems());
1163  libmesh_assert_less (vg, this->n_var_groups(s));
1164 
1165  const unsigned int
1166  start_idx_sys = this->start_idx(s);
1167 
1168  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());
1169 
1170  // #ifdef DEBUG
1171  // std::cout << " [ ";
1172  // for (std:size_t i=0; i<_idx_buf.size(); i++)
1173  // std::cout << _idx_buf[i] << " ";
1174  // std::cout << "]\n";
1175  // #endif
1176 
1177  return _idx_buf[start_idx_sys + 2*vg + 1];
1178 }
1179 
1180 
1181 
1182 inline
1183 unsigned int DofObject::var_to_vg (const unsigned int s,
1184  const unsigned int var) const
1185 {
1186  const unsigned int
1187  nvg = this->n_var_groups(s);
1188 
1189  for (unsigned int vg=0, vg_end=0; vg<nvg; vg++)
1190  {
1191  vg_end += this->n_vars(s,vg);
1192  if (var < vg_end) return vg;
1193  }
1194 
1195  libmesh_error_msg("Error: could not map variable " << var << " to variable group.");
1196 }
1197 
1198 
1199 
1200 inline
1201 unsigned int DofObject::system_var_to_vg_var (const unsigned int s,
1202  const unsigned int vg,
1203  const unsigned int var) const
1204 {
1205  unsigned int accumulated_sum=0;
1206 
1207  for (unsigned int vgc=0; vgc<vg; vgc++)
1208  accumulated_sum += this->n_vars(s,vgc);
1209 
1210  libmesh_assert_less_equal (accumulated_sum, var);
1211 
1212  return (var - accumulated_sum);
1213 }
1214 
1215 
1216 } // namespace libMesh
1217 
1218 
1219 #endif // #ifndef LIBMESH_DOF_OBJECT_H
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.
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:1201
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:1159
double abs(double a)
unique_id_type & set_unique_id()
Definition: dof_object.h:768
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Definition: dof_object.h:927
void set_old_dof_object()
Sets the old_dof_object to a copy of this.
void clear_dofs()
Clear the DofMap data structures holding degree of freedom data.
Definition: dof_object.h:708
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
Definition: libmesh.h:245
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:897
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:852
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:1183
void set_id(const dof_id_type dofid)
Sets the id for this DofObject.
Definition: dof_object.h:154
unsigned int n_pseudo_systems() const
Definition: dof_object.h:842
unique_id_type unique_id() const
Definition: dof_object.h:755
dof_id_type _id
The id of the DofObject.
Definition: dof_object.h:488
void invalidate()
Invalidates all the indices for this DofObject.
Definition: dof_object.h:698
~DofObject()
Destructor.
Definition: dof_object.h:650
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 ...
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:1139
The libMesh namespace provides an interface to certain functionality in the library.
bool has_dofs(const unsigned int s=libMesh::invalid_uint) const
Definition: dof_object.h:1068
uint8_t processor_id_type
Definition: id_types.h:104
dof_id_type & set_id()
Definition: dof_object.h:747
DofObject()
Constructor.
Definition: dof_object.h:632
unsigned int start_idx_ints() const
The starting index for an extra_integers pseudosystem.
Definition: dof_object.h:1115
dof_id_type index_t
DoF index information.
Definition: dof_object.h:583
unique_id_type _unique_id
A globally unique id, guaranteed not to change as the mesh is repartitioned or adapted.
Definition: dof_object.h:482
unsigned int n_dofs(const unsigned int s, const unsigned int var=libMesh::invalid_uint) const
Definition: dof_object.h:716
void add_system()
Adds an additional system to the DofObject.
unsigned int end_idx(const unsigned int s) const
The ending index for system s.
Definition: dof_object.h:1102
void set_buffer(const std::vector< dof_id_type > &buf)
Definition: dof_object.h:622
dof_id_type id() const
Definition: dof_object.h:738
static const unique_id_type invalid_unique_id
An invalid unique_id to distinguish an uninitialized DofObject.
Definition: dof_object.h:398
static const 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:404
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 wit...
unsigned int end_idx_ints() const
The ending index for an extra_integers pseudosystem.
Definition: dof_object.h:1129
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:862
unsigned int n_systems() const
Definition: dof_object.h:832
processor_id_type _processor_id
The local processor id.
void print_dof_info() const
Print out info for debugging.
bool valid_processor_id() const
Definition: dof_object.h:824
void clear_old_dof_object()
Sets the old_dof_object to nullptr.
void invalidate_id()
Sets the id to invalid_id.
Definition: dof_object.h:682
static const dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:393
int8_t dof_id_signed_type
Definition: id_types.h:68
bool valid_unique_id() const
Definition: dof_object.h:788
bool has_extra_integers() const
Returns whether extra integers are associated to the DofObject.
Definition: dof_object.h:1030
This class implements reference counting.
void invalidate_processor_id()
Sets the processor id to invalid_processor_id.
Definition: dof_object.h:690
std::vector< index_t > index_buffer_t
Definition: dof_object.h:584
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...
void set_n_systems(const unsigned int s)
Sets the number of systems for this DofObject.
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.
DofObject * old_dof_object
This object on the last mesh.
Definition: dof_object.h:79
bool valid_id() const
Definition: dof_object.h:780
unsigned int start_idx(const unsigned int s) const
The starting index for system s.
Definition: dof_object.h:1091
unsigned int packed_indexing_size() const
If we pack our indices into an buffer for communications, how many ints do we need?
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 o...
void invalidate_dofs(const unsigned int sys_num=libMesh::invalid_uint)
Sets all degree of freedom numbers to invalid_id.
Definition: dof_object.h:662
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 w...
The DofObject defines an abstract base class for objects that have degrees of freedom associated with...
Definition: dof_object.h:51
void add_extra_integers(const unsigned int n_integers)
Assigns a set of extra integers to this DofObject.
DofObject & operator=(const DofObject &dof_obj)
Deep-copying assignment operator.
std::pair< unsigned int, unsigned int > var_to_vg_and_offset(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:1042
unsigned int n_extra_integers() const
Returns how many extra integers are associated to the DofObject.
Definition: dof_object.h:1012
index_buffer_t _idx_buf
Definition: dof_object.h:585
void debug_buffer() const
Print our buffer for debugging.
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:910
processor_id_type processor_id() const
Definition: dof_object.h:800
uint8_t unique_id_type
Definition: id_types.h:86
processor_id_type _processor_id
The processor_id of the DofObject.
Definition: dof_object.h:499
static const index_t ncv_magic_exp
Definition: dof_object.h:597
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 obta...
Definition: dof_object.h:981
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:997
uint8_t dof_id_type
Definition: id_types.h:67
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:596