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/int_range.h"
26 #include "libmesh/libmesh_config.h"
27 #include "libmesh/libmesh_common.h"
28 #include "libmesh/libmesh.h" // libMesh::invalid_uint
29 #include "libmesh/reference_counted_object.h"
30 
31 // C++ includes
32 #include <cstddef>
33 #include <cstring>
34 #include <vector>
35 
36 namespace libMesh
37 {
38 
39 // Forward declarations
40 class DofObject;
41 
42 
53 class DofObject : public ReferenceCountedObject<DofObject>
54 {
55 #ifdef LIBMESH_IS_UNIT_TESTING
56 public:
57 #else
58 protected:
59 #endif
60 
65  DofObject ();
66 
71  ~DofObject ();
72 
73 public:
74 
75 #ifdef LIBMESH_ENABLE_AMR
76 
82 
86  void clear_old_dof_object ();
87 
91  void set_old_dof_object ();
92 
93 #endif
94 
102  void clear_dofs ();
103 
107  void invalidate_dofs (const unsigned int sys_num = libMesh::invalid_uint);
108 
112  void invalidate_id ();
113 
117  void invalidate_processor_id ();
118 
122  void invalidate ();
123 
129  unsigned int n_dofs (const unsigned int s,
130  const unsigned int var =
131  libMesh::invalid_uint) const;
132 
136  dof_id_type id () const;
137 
141  dof_id_type & set_id ();
142 
146  unique_id_type unique_id () const;
147 
152 
156  void set_id (const dof_id_type dofid)
157  { this->set_id() = dofid; }
158 
163  bool valid_id () const;
164 
169  bool valid_unique_id () const;
170 
179 
185 
189  void processor_id (const processor_id_type pid);
190 
195  bool valid_processor_id () const;
196 
201  unsigned int n_systems() const;
202 
208  unsigned int n_pseudo_systems() const;
209 
218  void set_n_systems (const unsigned int s);
219 
225  void set_extra_integer (const unsigned int index, const dof_id_type value);
226 
232  dof_id_type get_extra_integer (const unsigned int index) const;
233 
240  template <typename T>
241  void set_extra_datum (const unsigned int index, const T value);
242 
249  template <typename T>
250  T get_extra_datum (const unsigned int index) const;
251 
252 
256  void add_system ();
257 
262  unsigned int n_var_groups(const unsigned int s) const;
263 
268  unsigned int n_vars(const unsigned int s,
269  const unsigned int vg) const;
270 
275  unsigned int n_vars(const unsigned int s) const;
276 
284  void set_n_vars_per_group(const unsigned int s,
285  const std::vector<unsigned int> & nvpg);
286 
296  unsigned int n_comp(const unsigned int s,
297  const unsigned int var) const;
298 
308  unsigned int n_comp_group(const unsigned int s,
309  const unsigned int vg) const;
310 
315  void set_n_comp(const unsigned int s,
316  const unsigned int var,
317  const unsigned int ncomp);
318 
323  void set_n_comp_group(const unsigned int s,
324  const unsigned int vg,
325  const unsigned int ncomp);
326 
335  dof_id_type dof_number(const unsigned int s,
336  const unsigned int var,
337  const unsigned int comp) const;
338 
347  dof_id_type dof_number(const unsigned int s,
348  const unsigned int vg,
349  const unsigned int vig,
350  const unsigned int comp,
351  const unsigned int n_comp) const;
352 
358  std::pair<unsigned int, unsigned int>
359  var_to_vg_and_offset(const unsigned int s,
360  const unsigned int var) const;
361 
366  void set_dof_number(const unsigned int s,
367  const unsigned int var,
368  const unsigned int comp,
369  const dof_id_type dn);
370 
375  bool has_dofs(const unsigned int s=libMesh::invalid_uint) const;
376 
382  void set_vg_dof_base(const unsigned int s,
383  const unsigned int vg,
384  const dof_id_type db);
385 
391  dof_id_type vg_dof_base(const unsigned int s,
392  const unsigned int vg) const;
393 
402  void add_extra_integers (const unsigned int n_integers);
403 
411  unsigned int n_extra_integers () const;
412 
416  bool has_extra_integers () const;
417 
421  static const dof_id_type invalid_id = static_cast<dof_id_type>(-1);
422 
426  static const unique_id_type invalid_unique_id = static_cast<unique_id_type>(-1);
427 
432  static const processor_id_type invalid_processor_id = static_cast<processor_id_type>(-1);
433 
438  unsigned int packed_indexing_size() const;
439 
444  static unsigned int unpackable_indexing_size
445  (std::vector<largest_id_type>::const_iterator begin);
446 
452  void unpack_indexing(std::vector<largest_id_type>::const_iterator begin);
453 
459  void pack_indexing(std::back_insert_iterator<std::vector<largest_id_type>> target) const;
460 
464  void debug_buffer () const;
465 
469  void print_dof_info() const;
470 
471  // Deep copy (or almost-copy) of DofObjects is now deprecated in
472  // derived classes; we keep these methods around solely for a couple
473  // tricky internal uses.
474 #ifndef LIBMESH_ENABLE_DEPRECATED
475 private:
476 #endif
477 
482  DofObject (const DofObject &);
483 
487  DofObject & operator= (const DofObject & dof_obj);
488 
489 private:
490 
495  unsigned int var_to_vg (const unsigned int s,
496  const unsigned int var) const;
497 
502  unsigned int system_var_to_vg_var (const unsigned int s,
503  const unsigned int vg,
504  const unsigned int var) const;
505 
509 #ifdef LIBMESH_ENABLE_UNIQUE_ID
511 #endif
512 
517 
528 
612  typedef std::vector<index_t> index_buffer_t;
614 
624  static const index_t ncv_magic = 256; // = 2^8, in case we want to manually bitshift
625  static const index_t ncv_magic_exp = 8; // Let's manually bitshift
626 
630  unsigned int start_idx(const unsigned int s) const;
631 
635  unsigned int end_idx(const unsigned int s) const;
636 
640  unsigned int start_idx_ints() const;
641 
645  unsigned int end_idx_ints() const;
646 
647  // methods only available for unit testing
648 #ifdef LIBMESH_IS_UNIT_TESTING
649 public:
650  void set_buffer (const std::vector<dof_id_type> & buf)
651  { _idx_buf = buf; }
652 #endif
653 };
654 
655 
656 
657 //------------------------------------------------------
658 // Inline functions
659 inline
661 #ifdef LIBMESH_ENABLE_AMR
662  old_dof_object(nullptr),
663 #endif
664 #ifdef LIBMESH_ENABLE_UNIQUE_ID
665  _unique_id (invalid_unique_id),
666 #endif
667  _id (invalid_id),
668  _processor_id (invalid_processor_id)
669 {
670  this->invalidate();
671 }
672 
673 
674 
675 
676 
677 inline
679 {
680  // Free all memory.
681 #ifdef LIBMESH_ENABLE_AMR
682  this->clear_old_dof_object ();
683 #endif
684  this->clear_dofs ();
685 }
686 
687 
688 
689 inline
690 void DofObject::invalidate_dofs (const unsigned int sys_num)
691 {
692  const unsigned int n_sys = this->n_systems();
693  // If the user does not specify the system number...
694  if (sys_num >= n_sys)
695  {
696  for (auto s : IntRange<unsigned int>(0, n_sys))
697  for (auto vg : IntRange<unsigned int>(0, this->n_var_groups(s)))
698  if (this->n_comp_group(s,vg))
699  this->set_vg_dof_base(s,vg,invalid_id);
700  }
701  // ...otherwise invalidate the dofs for all systems
702  else
703  for (auto vg : IntRange<unsigned int>(0, this->n_var_groups(sys_num)))
704  if (this->n_comp_group(sys_num,vg))
705  this->set_vg_dof_base(sys_num,vg,invalid_id);
706 }
707 
708 
709 
710 inline
712 {
713  this->set_id (invalid_id);
714 }
715 
716 
717 
718 inline
720 {
722 }
723 
724 
725 
726 inline
728 {
729  this->invalidate_dofs ();
730  this->invalidate_id ();
731  this->invalidate_processor_id ();
732 }
733 
734 
735 
736 inline
738 {
739  this->set_n_systems(0);
740 }
741 
742 
743 
744 inline
745 unsigned int DofObject::n_dofs (const unsigned int s,
746  const unsigned int var) const
747 {
748  libmesh_assert_less (s, this->n_systems());
749 
750  unsigned int num = 0;
751 
752  // Count all variables
753  if (var == libMesh::invalid_uint)
754  for (auto v : IntRange<unsigned int>(0, this->n_vars(s)))
755  num += this->n_comp(s,v);
756 
757  // Only count specified variable
758  else
759  num = this->n_comp(s,var);
760 
761  return num;
762 }
763 
764 
765 
766 inline
768 {
769  libmesh_assert (this->valid_id());
770  return _id;
771 }
772 
773 
774 
775 inline
777 {
778  return _id;
779 }
780 
781 
782 
783 inline
785 {
786 #ifdef LIBMESH_ENABLE_UNIQUE_ID
788  return _unique_id;
789 #else
790  return invalid_unique_id;
791 #endif
792 }
793 
794 
795 
796 inline
798 {
799 #ifdef LIBMESH_ENABLE_UNIQUE_ID
800  return _unique_id;
801 #else
802  libmesh_not_implemented();
803 #endif
804 }
805 
806 
807 
808 inline
809 bool DofObject::valid_id () const
810 {
811  return (DofObject::invalid_id != _id);
812 }
813 
814 
815 
816 inline
818 {
819 #ifdef LIBMESH_ENABLE_UNIQUE_ID
821 #else
822  return false;
823 #endif
824 }
825 
826 
827 
828 inline
830 {
831  return _processor_id;
832 }
833 
834 
835 
836 inline
838 {
839  return _processor_id;
840 }
841 
842 
843 
844 inline
846 {
847  this->processor_id() = pid;
848 }
849 
850 
851 
852 inline
854 {
856 }
857 
858 
859 
860 inline
861 unsigned int DofObject::n_systems () const
862 {
863  const int hdr = _idx_buf.empty() ?
864  0 : cast_int<int>(dof_id_signed_type(_idx_buf[0]));
865  return hdr >= 0 ? hdr : (-hdr-1);
866 }
867 
868 
869 
870 inline
871 unsigned int DofObject::n_pseudo_systems () const
872 {
873  const int hdr = _idx_buf.empty() ?
874  0 : cast_int<int>(dof_id_signed_type(_idx_buf[0]));
875  return std::abs(hdr);
876 }
877 
878 
879 
880 inline
881 unsigned int DofObject::n_var_groups(const unsigned int s) const
882 {
883  libmesh_assert_less (s, this->n_systems());
884 
885  return (this->end_idx(s) - this->start_idx(s)) / 2;
886 }
887 
888 
889 
890 inline
891 unsigned int DofObject::n_vars(const unsigned int s,
892  const unsigned int vg) const
893 {
894  libmesh_assert_less (s, this->n_systems());
895  libmesh_assert_less (vg, this->n_var_groups(s));
896 
897  const unsigned int start_idx_sys = this->start_idx(s);
898 
899  libmesh_assert_less ((start_idx_sys + 2*vg), _idx_buf.size());
900 
901  return (cast_int<unsigned int>
902  (_idx_buf[start_idx_sys + 2*vg]) >> ncv_magic_exp);
903 }
904 
905 
906 
907 inline
908 unsigned int DofObject::n_vars(const unsigned int s) const
909 {
910  libmesh_assert_less (s, this->n_systems());
911 
912  const unsigned int nvg = this->n_var_groups(s);
913 
914  unsigned int val=0;
915 
916  for (unsigned int vg=0; vg<nvg; vg++)
917  val += this->n_vars(s,vg);
918 
919  return val;
920 }
921 
922 
923 
924 
925 inline
926 unsigned int DofObject::n_comp(const unsigned int s,
927  const unsigned int var) const
928 {
929  libmesh_assert_less (s, this->n_systems());
930  libmesh_assert_less (var, this->n_vars(s));
931 
932  return this->n_comp_group(s,this->var_to_vg(s,var));
933 }
934 
935 
936 
937 
938 inline
939 unsigned int DofObject::n_comp_group(const unsigned int s,
940  const unsigned int vg) const
941 {
942  libmesh_assert_less (s, this->n_systems());
943  libmesh_assert_less (vg, this->n_var_groups(s));
944 
945  const unsigned int
946  start_idx_sys = this->start_idx(s);
947 
948  libmesh_assert_less ((start_idx_sys + 2*vg), _idx_buf.size());
949 
950  return (_idx_buf[start_idx_sys + 2*vg] % ncv_magic);
951 }
952 
953 
954 
955 inline
956 dof_id_type DofObject::dof_number(const unsigned int s,
957  const unsigned int var,
958  const unsigned int comp) const
959 {
960  libmesh_assert_less (s, this->n_systems());
961  libmesh_assert_less (var, this->n_vars(s));
962  libmesh_assert_less (comp, this->n_comp(s,var));
963 
964  const std::pair<unsigned int, unsigned int>
965  vg_vig = this->var_to_vg_and_offset(s,var);
966 
967  const unsigned int
968  n_comp = this->n_comp_group(s,vg_vig.first);
969 
970  return this->dof_number(s, vg_vig.first, vg_vig.second,
971  comp, n_comp);
972 }
973 
974 
975 
976 inline
977 dof_id_type DofObject::dof_number(const unsigned int s,
978  const unsigned int vg,
979  const unsigned int vig,
980  const unsigned int comp,
981  const unsigned int n_comp) const
982 {
983  libmesh_assert_less (s, this->n_systems());
984  libmesh_assert_less (vg, this->n_var_groups(s));
985  libmesh_assert_less (vig, this->n_vars(s,vg));
986 
987  const unsigned int
988  start_idx_sys = this->start_idx(s);
989 
990  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());
991 
992  const dof_id_type
993  base_idx = _idx_buf[start_idx_sys + 2*vg + 1];
994 
995  // if the first component is invalid, they
996  // are all invalid
997  if (base_idx == invalid_id)
998  return invalid_id;
999 
1000  // otherwise the index is the first component
1001  // index augmented by the component number
1002  else
1003  return cast_int<dof_id_type>(base_idx + vig*n_comp + comp);
1004 }
1005 
1006 
1007 
1008 inline
1009 void
1010 DofObject::set_extra_integer(const unsigned int index,
1011  const dof_id_type value)
1012 {
1013  libmesh_assert_less(index, this->n_extra_integers());
1014  libmesh_assert_less(this->n_pseudo_systems(), _idx_buf.size());
1015 
1016  const unsigned int start_idx_i = this->start_idx_ints();
1017 
1018  libmesh_assert_less(start_idx_i+index, _idx_buf.size());
1019  _idx_buf[start_idx_i+index] = value;
1020 }
1021 
1022 
1023 
1024 inline
1026 DofObject::get_extra_integer (const unsigned int index) const
1027 {
1028  libmesh_assert_less(index, this->n_extra_integers());
1029  libmesh_assert_less(this->n_systems(), _idx_buf.size());
1030 
1031  const unsigned int start_idx_i = this->start_idx_ints();
1032 
1033  libmesh_assert_less(start_idx_i+index, _idx_buf.size());
1034  return _idx_buf[start_idx_i+index];
1035 }
1036 
1037 
1038 
1039 template <typename T>
1040 inline
1041 void
1042 DofObject::set_extra_datum(const unsigned int index,
1043  const T value)
1044 {
1045 #ifndef NDEBUG
1046  const unsigned int n_more_integers = (sizeof(T)-1)/sizeof(dof_id_type);
1047 #endif
1048  libmesh_assert_less(index+n_more_integers, this->n_extra_integers());
1049  libmesh_assert_less(this->n_pseudo_systems(), _idx_buf.size());
1050 
1051  const unsigned int start_idx_i = this->start_idx_ints();
1052 
1053  libmesh_assert_less(start_idx_i+index+n_more_integers, _idx_buf.size());
1054  std::memcpy(&_idx_buf[start_idx_i+index], &value, sizeof(T));
1055 }
1056 
1057 
1058 
1059 template <typename T>
1060 inline
1061 T
1062 DofObject::get_extra_datum (const unsigned int index) const
1063 {
1064 #ifndef NDEBUG
1065  const unsigned int n_more_integers = (sizeof(T)-1)/sizeof(dof_id_type);
1066 #endif
1067  libmesh_assert_less(index+n_more_integers, this->n_extra_integers());
1068  libmesh_assert_less(this->n_systems(), _idx_buf.size());
1069 
1070  const unsigned int start_idx_i = this->start_idx_ints();
1071 
1072  libmesh_assert_less(start_idx_i+index+n_more_integers, _idx_buf.size());
1073  T returnval;
1074  std::memcpy(&returnval, &_idx_buf[start_idx_i+index], sizeof(T));
1075  return returnval;
1076 }
1077 
1078 
1079 
1080 inline
1081 unsigned int
1083 {
1084  if (_idx_buf.empty())
1085  return 0;
1086 
1087  const int hdr = dof_id_signed_type(_idx_buf[0]);
1088  if (hdr >= 0)
1089  return 0;
1090 
1091  const unsigned int start_idx_i = this->start_idx_ints();
1092 
1093  return _idx_buf.size() - start_idx_i;
1094 }
1095 
1096 
1097 
1098 inline
1099 bool
1101 {
1102  if (_idx_buf.empty())
1103  return 0;
1104 
1105  return (dof_id_signed_type(_idx_buf[0]) < 0);
1106 }
1107 
1108 
1109 
1110 inline
1111 std::pair<unsigned int, unsigned int>
1112 DofObject::var_to_vg_and_offset(const unsigned int s,
1113  const unsigned int var) const
1114 {
1115  std::pair<unsigned int, unsigned int> returnval(0,0);
1116 
1117  unsigned int & vg = returnval.first;
1118  unsigned int & offset = returnval.second;
1119 
1120  unsigned int vg_start = 0;
1121  for (; ; vg++)
1122  {
1123  libmesh_assert_less(vg, this->n_var_groups(s));
1124 
1125  const unsigned int vg_end = vg_start + this->n_vars(s,vg);
1126  if (var < vg_end)
1127  {
1128  offset = var - vg_start;
1129  return returnval;
1130  }
1131  vg_start = vg_end;
1132  }
1133 }
1134 
1135 
1136 
1137 inline
1138 bool DofObject::has_dofs (const unsigned int sys) const
1139 {
1140  if (sys == libMesh::invalid_uint)
1141  {
1142  for (auto s : IntRange<unsigned int>(0, this->n_systems()))
1143  if (this->n_vars(s))
1144  return true;
1145  }
1146 
1147  else
1148  {
1149  libmesh_assert_less (sys, this->n_systems());
1150 
1151  if (this->n_vars(sys))
1152  return true;
1153  }
1154 
1155  return false;
1156 }
1157 
1158 
1159 
1160 inline
1161 unsigned int DofObject::start_idx (const unsigned int s) const
1162 {
1163  libmesh_assert_less (s, this->n_systems());
1164  libmesh_assert_less (s, _idx_buf.size());
1165 
1166  return cast_int<unsigned int>(std::abs(dof_id_signed_type(_idx_buf[s])));
1167 }
1168 
1169 
1170 
1171 inline
1172 unsigned int DofObject::end_idx (const unsigned int s) const
1173 {
1174  libmesh_assert_less (s, this->n_systems());
1175  libmesh_assert_less (s, _idx_buf.size());
1176 
1177  return ((s+1) == this->n_pseudo_systems()) ?
1178  cast_int<unsigned int>(_idx_buf.size()) :
1179  cast_int<unsigned int>(_idx_buf[s+1]);
1180 }
1181 
1182 
1183 
1184 inline
1185 unsigned int DofObject::start_idx_ints () const
1186 {
1188 
1189  unsigned int n_sys = this->n_systems();
1190 
1191  libmesh_assert_less(this->n_systems(), _idx_buf.size());
1192  return n_sys ? cast_int<unsigned int>(_idx_buf[this->n_systems()]) :
1193  (n_sys+1);
1194 }
1195 
1196 
1197 
1198 inline
1199 unsigned int DofObject::end_idx_ints () const
1200 {
1202 
1203  return cast_int<unsigned int>(_idx_buf.size());
1204 }
1205 
1206 
1207 
1208 inline
1209 void DofObject::set_vg_dof_base(const unsigned int s,
1210  const unsigned int vg,
1211  const dof_id_type db)
1212 {
1213  libmesh_assert_less (s, this->n_systems());
1214  libmesh_assert_less (vg, this->n_var_groups(s));
1215 
1216  const unsigned int
1217  start_idx_sys = this->start_idx(s);
1218 
1219  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());
1220 
1221  _idx_buf[start_idx_sys + 2*vg + 1] = db;
1222 
1223  libmesh_assert_equal_to (this->vg_dof_base(s,vg), db);
1224 }
1225 
1226 
1227 
1228 inline
1230  const unsigned int vg) const
1231 {
1232  libmesh_assert_less (s, this->n_systems());
1233  libmesh_assert_less (vg, this->n_var_groups(s));
1234 
1235  const unsigned int
1236  start_idx_sys = this->start_idx(s);
1237 
1238  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());
1239 
1240  // #ifdef DEBUG
1241  // std::cout << " [ ";
1242  // for (auto i : _idx_buf)
1243  // std::cout << i << " ";
1244  // std::cout << "]\n";
1245  // #endif
1246 
1247  return _idx_buf[start_idx_sys + 2*vg + 1];
1248 }
1249 
1250 
1251 
1252 inline
1253 unsigned int DofObject::var_to_vg (const unsigned int s,
1254  const unsigned int var) const
1255 {
1256  const unsigned int
1257  nvg = this->n_var_groups(s);
1258 
1259  for (unsigned int vg=0, vg_end=0; vg<nvg; vg++)
1260  {
1261  vg_end += this->n_vars(s,vg);
1262  if (var < vg_end) return vg;
1263  }
1264 
1265  libmesh_error_msg("Error: could not map variable " << var << " to variable group.");
1266 }
1267 
1268 
1269 
1270 inline
1271 unsigned int DofObject::system_var_to_vg_var (const unsigned int s,
1272  const unsigned int vg,
1273  const unsigned int var) const
1274 {
1275  unsigned int accumulated_sum=0;
1276 
1277  for (unsigned int vgc=0; vgc<vg; vgc++)
1278  accumulated_sum += this->n_vars(s,vgc);
1279 
1280  libmesh_assert_less_equal (accumulated_sum, var);
1281 
1282  return (var - accumulated_sum);
1283 }
1284 
1285 
1286 } // namespace libMesh
1287 
1288 
1289 #endif // #ifndef LIBMESH_DOF_OBJECT_H
libMesh::DofObject::valid_id
bool valid_id() const
Definition: dof_object.h:809
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
libMesh::DofObject::n_dofs
unsigned int n_dofs(const unsigned int s, const unsigned int var=libMesh::invalid_uint) const
Definition: dof_object.h:745
libMesh::DofObject::end_idx
unsigned int end_idx(const unsigned int s) const
The ending index for system s.
Definition: dof_object.h:1172
libMesh::invalid_uint
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
Definition: libmesh.h:249
libMesh::DofObject::set_extra_datum
void set_extra_datum(const unsigned int index, const T value)
Sets the value on this object of the extra datum associated with index, which should have been obtain...
Definition: dof_object.h:1042
libMesh::DofObject::_processor_id
processor_id_type _processor_id
The processor_id of the DofObject.
Definition: dof_object.h:527
libMesh::DofObject::n_systems
unsigned int n_systems() const
Definition: dof_object.h:861
libMesh::unique_id_type
uint8_t unique_id_type
Definition: id_types.h:86
libMesh::libMeshPrivateData::_processor_id
processor_id_type _processor_id
The local processor id.
Definition: libmesh.C:243
libMesh::DofObject::old_dof_object
DofObject * old_dof_object
This object on the last mesh.
Definition: dof_object.h:81
libMesh::DofObject::unpack_indexing
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...
Definition: dof_object.C:589
libMesh::DofObject::unpackable_indexing_size
static unsigned int unpackable_indexing_size(std::vector< largest_id_type >::const_iterator begin)
If we have indices packed into an buffer for communications, how much of that buffer applies to this ...
Definition: dof_object.C:569
libMesh::DofObject::ncv_magic
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:624
libMesh::DofObject::start_idx
unsigned int start_idx(const unsigned int s) const
The starting index for system s.
Definition: dof_object.h:1161
libMesh::DofObject::operator=
DofObject & operator=(const DofObject &dof_obj)
Deep-copying assignment operator.
Definition: dof_object.C:90
libMesh::DofObject::set_id
dof_id_type & set_id()
Definition: dof_object.h:776
libMesh::ReferenceCountedObject
This class implements reference counting.
Definition: reference_counted_object.h:65
libMesh::DofObject::var_to_vg
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:1253
libMesh::DofObject::valid_processor_id
bool valid_processor_id() const
Definition: dof_object.h:853
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::DofObject::start_idx_ints
unsigned int start_idx_ints() const
The starting index for an extra_integers pseudosystem.
Definition: dof_object.h:1185
libMesh::DofObject::_idx_buf
index_buffer_t _idx_buf
Definition: dof_object.h:613
libMesh::DofObject::add_extra_integers
void add_extra_integers(const unsigned int n_integers)
Assigns a set of extra integers to this DofObject.
Definition: dof_object.C:503
libMesh::DofObject::set_n_vars_per_group
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.
Definition: dof_object.C:260
libMesh::DofObject::set_n_comp_group
void set_n_comp_group(const unsigned int s, const unsigned int vg, const unsigned int ncomp)
Sets the number of components for VariableGroup vg of system s associated with this DofObject.
Definition: dof_object.C:410
libMesh::DofObject::n_var_groups
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:881
libMesh::DofObject::set_vg_dof_base
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:1209
libMesh::DofObject::set_unique_id
unique_id_type & set_unique_id()
Definition: dof_object.h:797
libMesh::DofObject::valid_unique_id
bool valid_unique_id() const
Definition: dof_object.h:817
libMesh::DofObject::ncv_magic_exp
static const index_t ncv_magic_exp
Definition: dof_object.h:625
libMesh::DofObject::processor_id
processor_id_type processor_id() const
Definition: dof_object.h:829
libMesh::DofObject
The DofObject defines an abstract base class for objects that have degrees of freedom associated with...
Definition: dof_object.h:53
libMesh::DofObject::system_var_to_vg_var
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:1271
libMesh::DofObject::packed_indexing_size
unsigned int packed_indexing_size() const
If we pack our indices into an buffer for communications, how many ints do we need?
Definition: dof_object.C:554
libMesh::DofObject::debug_buffer
void debug_buffer() const
Print our buffer for debugging.
Definition: dof_object.C:654
libMesh::DofObject::dof_number
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Definition: dof_object.h:956
libMesh::DofObject::set_id
void set_id(const dof_id_type dofid)
Sets the id for this DofObject.
Definition: dof_object.h:156
libMesh::libmesh_assert
libmesh_assert(ctx)
libMesh::IntRange
The IntRange templated class is intended to make it easy to loop over integers which are indices of a...
Definition: int_range.h:53
libMesh::DofObject::invalid_unique_id
static const unique_id_type invalid_unique_id
An invalid unique_id to distinguish an uninitialized DofObject.
Definition: dof_object.h:426
libMesh::DofObject::get_extra_datum
T get_extra_datum(const unsigned int index) const
Gets the value on this object of the extra datum associated with index, which should have been obtain...
Definition: dof_object.h:1062
libMesh::DofObject::n_extra_integers
unsigned int n_extra_integers() const
Returns how many extra integers are associated to the DofObject.
Definition: dof_object.h:1082
std::abs
MetaPhysicL::DualNumber< T, D > abs(const MetaPhysicL::DualNumber< T, D > &in)
libMesh::DofObject::clear_old_dof_object
void clear_old_dof_object()
Sets the old_dof_object to nullptr.
Definition: dof_object.C:142
libMesh::DofObject::n_comp
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:926
libMesh::DofObject::print_dof_info
void print_dof_info() const
Print out info for debugging.
Definition: dof_object.C:664
libMesh::DofObject::end_idx_ints
unsigned int end_idx_ints() const
The ending index for an extra_integers pseudosystem.
Definition: dof_object.h:1199
libMesh::DofObject::invalid_id
static const dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:421
libMesh::dof_id_signed_type
int8_t dof_id_signed_type
Definition: id_types.h:68
libMesh::DofObject::set_old_dof_object
void set_old_dof_object()
Sets the old_dof_object to a copy of this.
Definition: dof_object.C:150
libMesh::processor_id_type
uint8_t processor_id_type
Definition: id_types.h:104
libMesh::DofObject::var_to_vg_and_offset
std::pair< unsigned int, unsigned int > var_to_vg_and_offset(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:1112
libMesh::DofObject::set_n_systems
void set_n_systems(const unsigned int s)
Sets the number of systems for this DofObject.
Definition: dof_object.C:165
libMesh::DofObject::has_extra_integers
bool has_extra_integers() const
Returns whether extra integers are associated to the DofObject.
Definition: dof_object.h:1100
libMesh::DofObject::invalidate
void invalidate()
Invalidates all the indices for this DofObject.
Definition: dof_object.h:727
libMesh::DofObject::unique_id
unique_id_type unique_id() const
Definition: dof_object.h:784
libMesh::DofObject::pack_indexing
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...
Definition: dof_object.C:636
libMesh::DofObject::add_system
void add_system()
Adds an additional system to the DofObject.
Definition: dof_object.C:208
libMesh::DofObject::n_vars
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:891
libMesh::DofObject::set_n_comp
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.
Definition: dof_object.C:398
libMesh::DofObject::get_extra_integer
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:1026
value
static const bool value
Definition: xdr_io.C:56
libMesh::DofObject::id
dof_id_type id() const
Definition: dof_object.h:767
libMesh::DofObject::_id
dof_id_type _id
The id of the DofObject.
Definition: dof_object.h:516
libMesh::DofObject::invalid_processor_id
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:432
libMesh::DofObject::~DofObject
~DofObject()
Destructor.
Definition: dof_object.h:678
libMesh::DofObject::clear_dofs
void clear_dofs()
Clear the DofMap data structures holding degree of freedom data.
Definition: dof_object.h:737
libMesh::DofObject::set_buffer
void set_buffer(const std::vector< dof_id_type > &buf)
Definition: dof_object.h:650
libMesh::DofObject::index_t
dof_id_type index_t
DoF index information.
Definition: dof_object.h:611
libMesh::DofObject::invalidate_processor_id
void invalidate_processor_id()
Sets the processor id to invalid_processor_id.
Definition: dof_object.h:719
libMesh::DofObject::n_comp_group
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:939
libMesh::DofObject::_unique_id
unique_id_type _unique_id
A globally unique id, guaranteed not to change as the mesh is repartitioned or adapted.
Definition: dof_object.h:510
libMesh::DofObject::invalidate_dofs
void invalidate_dofs(const unsigned int sys_num=libMesh::invalid_uint)
Sets all degree of freedom numbers to invalid_id.
Definition: dof_object.h:690
libMesh::DofObject::set_dof_number
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...
Definition: dof_object.C:467
libMesh::DofObject::has_dofs
bool has_dofs(const unsigned int s=libMesh::invalid_uint) const
Definition: dof_object.h:1138
libMesh::DofObject::set_extra_integer
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:1010
libMesh::DofObject::index_buffer_t
std::vector< index_t > index_buffer_t
Definition: dof_object.h:612
libMesh::DofObject::vg_dof_base
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:1229
libMesh::DofObject::DofObject
DofObject()
Constructor.
Definition: dof_object.h:660
libMesh::DofObject::invalidate_id
void invalidate_id()
Sets the id to invalid_id.
Definition: dof_object.h:711
libMesh::DofObject::n_pseudo_systems
unsigned int n_pseudo_systems() const
Definition: dof_object.h:871