libMesh
dof_object.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2024 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 // Local includes
21 #include "libmesh/dof_object.h"
22 
23 namespace libMesh
24 {
25 
26 // ------------------------------------------------------------
27 // DofObject class static member -now initialized in header
31 
32 
33 
34 // Copy Constructor
35 DofObject::DofObject (const DofObject & dof_obj) :
37 #ifdef LIBMESH_ENABLE_UNIQUE_ID
38  _unique_id (dof_obj._unique_id),
39 #endif
40  _id (dof_obj._id),
41  _processor_id (dof_obj._processor_id),
42  _idx_buf (dof_obj._idx_buf)
43 {
44  // DO NOT copy old_dof_object, because this isn't a *real* copy
45  // constructor, it's a "copy almost everything" constructor that
46  // is intended to be used solely for internal construction of
47  // old_dof_object, never for a true deep copy where the newly
48  // created object really matches the source object.
49 
50  // Check that everything worked
51 #ifdef DEBUG
52 
53  libmesh_assert_equal_to (this->n_systems(), dof_obj.n_systems());
54 
55  for (auto s : make_range(this->n_systems()))
56  {
57  libmesh_assert_equal_to (this->n_vars(s), dof_obj.n_vars(s));
58  libmesh_assert_equal_to (this->n_var_groups(s), dof_obj.n_var_groups(s));
59 
60  for (auto vg : make_range(this->n_var_groups(s)))
61  libmesh_assert_equal_to (this->n_vars(s,vg), dof_obj.n_vars(s,vg));
62 
63  for (auto v : make_range(this->n_vars(s)))
64  {
65  libmesh_assert_equal_to (this->n_comp(s,v), dof_obj.n_comp(s,v));
66 
67  for (auto c : make_range(this->n_comp(s,v)))
68  libmesh_assert_equal_to (this->dof_number(s,v,c), dof_obj.dof_number(s,v,c));
69  }
70  }
71 
72 #endif
73 }
74 
75 
76 // Deep-copying assignment operator
78 {
79  if (&dof_obj == this)
80  return *this;
81 
82 #ifdef LIBMESH_ENABLE_AMR
83  this->clear_old_dof_object();
84  this->old_dof_object = this->construct(dof_obj.get_old_dof_object());
85 #endif
86 
87  _id = dof_obj._id;
88 #ifdef LIBMESH_ENABLE_UNIQUE_ID
89  _unique_id = dof_obj._unique_id;
90 #endif
91  _processor_id = dof_obj._processor_id;
92  _idx_buf = dof_obj._idx_buf;
93 
94 
95  // Check that everything worked
96 #ifdef DEBUG
97 
98  libmesh_assert_equal_to (this->n_systems(), dof_obj.n_systems());
99 
100  for (auto s : make_range(this->n_systems()))
101  {
102  libmesh_assert_equal_to (this->n_vars(s), dof_obj.n_vars(s));
103  libmesh_assert_equal_to (this->n_var_groups(s), dof_obj.n_var_groups(s));
104 
105  for (auto vg : make_range(this->n_var_groups(s)))
106  libmesh_assert_equal_to (this->n_vars(s,vg), dof_obj.n_vars(s,vg));
107 
108  for (auto v : make_range(this->n_vars(s)))
109  {
110  libmesh_assert_equal_to (this->n_comp(s,v), dof_obj.n_comp(s,v));
111 
112  for (auto c : make_range(this->n_comp(s,v)))
113  libmesh_assert_equal_to (this->dof_number(s,v,c), dof_obj.dof_number(s,v,c));
114  }
115  }
116 
117 #endif
118 
119  return *this;
120 }
121 
122 
123 
124 
125 
126 #ifdef LIBMESH_ENABLE_AMR
127 
129 {
130  this->old_dof_object.reset(nullptr);
131 }
132 
133 
134 
136 {
137  this->clear_old_dof_object();
138 
140 
141  // Make a new DofObject, assign a copy of \p this.
142  // Make sure the copy ctor for DofObject works!!
143  this->old_dof_object = this->construct(this);
144 }
145 
146 #endif
147 
148 
149 
150 void DofObject::set_n_systems (const unsigned int ns)
151 {
152  const unsigned int old_ns = this->n_systems();
153 
154  // Check for trivial return
155  if (ns == old_ns)
156  return;
157 
158  const unsigned int nei = this->n_extra_integers();
159  const dof_id_type header_size = ns + bool(nei);
160  const dof_id_type hdr = nei ?
161  static_cast<dof_id_type>(-static_cast<std::ptrdiff_t>(header_size))
162  : header_size;
163  index_buffer_t new_buf(header_size + nei, hdr);
164  if (nei)
165  {
166  const unsigned int start_idx_ints = old_ns ?
167  cast_int<unsigned int>(_idx_buf[old_ns]) :
168  1;
169  libmesh_assert_less(start_idx_ints, _idx_buf.size());
170  std::copy(_idx_buf.begin()+start_idx_ints,
171  _idx_buf.end(),
172  new_buf.begin()+header_size);
173  if (ns)
174  std::fill(new_buf.begin()+1, new_buf.begin()+ns+1, ns+1);
175  }
176 
177  // vector swap trick to force deallocation when shrinking
178  new_buf.swap(_idx_buf);
179 
180 #ifdef DEBUG
181  libmesh_assert_equal_to(nei, this->n_extra_integers());
182 
183  // check that all systems now exist and that they have 0 size
184  libmesh_assert_equal_to (ns, this->n_systems());
185  for (auto s : make_range(this->n_systems()))
186  {
187  libmesh_assert_equal_to (this->n_vars(s), 0);
188  libmesh_assert_equal_to (this->n_var_groups(s), 0);
189  }
190 #endif
191 }
192 
193 
194 
196 {
197  // quick return?
198  if (this->n_systems() == 0)
199  {
200  this->set_n_systems(1);
201  return;
202  }
203 
204  // cache this value before we screw it up!
205  const unsigned int ns_orig = this->n_systems();
206 
207  DofObject::index_buffer_t::iterator it = _idx_buf.begin() + ns_orig;
208 
209  // Create the entry for the new system indicating 0 variables.
210  //
211  // increment the number of systems and the offsets for each of
212  // the systems including the new one we just added.
213  if (this->has_extra_integers())
214  {
215  // this inserts the extra_integers' start position as the start
216  // position for the new system. We'll increment all those
217  // counts in one sweep next, to account for header expansion.
218  _idx_buf.insert(it, *it);
219 
220  _idx_buf[0]--;
221  for (unsigned int i=1; i<ns_orig+2; i++)
222  {
223  libmesh_assert_less(i, _idx_buf.size());
224  _idx_buf[i]++;
225  }
226  }
227  else
228  {
229  // this inserts the current vector size at the position for the
230  // new system
231  _idx_buf.insert(it, cast_int<dof_id_type>(_idx_buf.size()));
232 
233  for (unsigned int i=0; i<ns_orig+1; i++)
234  {
235  libmesh_assert_less(i, _idx_buf.size());
236  _idx_buf[i]++;
237  }
238  }
239 
240  libmesh_assert_equal_to (this->n_systems(), (ns_orig+1));
241  libmesh_assert_equal_to (this->n_vars(ns_orig), 0);
242  libmesh_assert_equal_to (this->n_var_groups(ns_orig), 0);
243 }
244 
245 
246 
247 void DofObject::set_n_vars_per_group(const unsigned int s,
248  const std::vector<unsigned int> & nvpg)
249 {
250  const unsigned int n_sys = this->n_systems();
251 
252  libmesh_assert_less (s, n_sys);
253 
254  // number of variable groups for this system - inferred
255  const unsigned int nvg = cast_int<unsigned int>(nvpg.size());
256 
257  // BSK - note that for compatibility with the previous implementation
258  // calling this method when (nvars == this->n_vars()) requires that
259  // we invalidate the DOF indices and set the number of components to 0.
260  // Note this was a bit of a surprise to me - there was no quick return in
261  // the old method, which caused removal and readdition of the DOF indices
262  // even in the case of (nvars == this->n_vars()), resulting in n_comp(s,v)
263  // implicitly becoming 0 regardless of any previous value.
264  // quick return?
265  if (nvg == this->n_var_groups(s))
266  {
267  for (unsigned int vg=0; vg<nvg; vg++)
268  {
269  this->set_n_comp_group(s,vg,0);
270  libmesh_assert_equal_to (this->n_vars(s,vg), nvpg[vg]);
271  }
272  return;
273  }
274 
275  const bool hei = this->has_extra_integers();
276 
277  // since there is ample opportunity to screw up other systems, let us
278  // cache their current sizes and later assert that they are unchanged.
279 #ifdef DEBUG
280  const unsigned int nei = this->n_extra_integers();
281 
282  DofObject::index_buffer_t old_system_sizes, old_extra_integers;
283  old_system_sizes.reserve(n_sys);
284  old_extra_integers.reserve(nei);
285 
286  for (unsigned int s_ctr=0; s_ctr<n_sys; s_ctr++)
287  old_system_sizes.push_back(this->n_var_groups(s_ctr));
288 
289  for (unsigned int ei=0; ei != nei; ++ei)
290  old_extra_integers.push_back(this->get_extra_integer(ei));
291 #endif
292 
293  // remove current indices if we have some
294  if (this->n_var_groups(s) != 0)
295  {
296  const unsigned int old_nvg_s = this->n_var_groups(s);
297 
298  DofObject::index_buffer_t::iterator
299  it = _idx_buf.begin(),
300  end = _idx_buf.begin();
301 
302  std::advance(it, this->start_idx(s));
303  std::advance(end, this->end_idx(s));
304  _idx_buf.erase(it,end);
305 
306  for (unsigned int ctr=(s+1); ctr<n_sys; ctr++)
307  _idx_buf[ctr] -= 2*old_nvg_s;
308 
309  if (hei)
310  _idx_buf[n_sys] -= 2*old_nvg_s;
311  }
312 
313  // better not have any now!
314  libmesh_assert_equal_to (this->n_var_groups(s), 0);
315 
316  // Make sure we didn't screw up any of our sizes!
317 #ifdef DEBUG
318  for (auto s_ctr : make_range(this->n_systems()))
319  if (s_ctr != s)
320  libmesh_assert_equal_to (this->n_var_groups(s_ctr), old_system_sizes[s_ctr]);
321 
322  libmesh_assert_equal_to (nei, this->n_extra_integers());
323 
324  for (unsigned int ei=0; ei != nei; ++ei)
325  libmesh_assert_equal_to(old_extra_integers[ei], this->get_extra_integer(ei));
326 #endif
327 
328  // OK, if the user requested 0 that is what we have
329  if (nvg == 0)
330  return;
331 
332  {
333  // array to hold new indices
334  DofObject::index_buffer_t var_idxs(2*nvg);
335  for (unsigned int vg=0; vg<nvg; vg++)
336  {
337  var_idxs[2*vg ] = ncv_magic*nvpg[vg] + 0;
338  var_idxs[2*vg + 1] = invalid_id - 1;
339  }
340 
341  DofObject::index_buffer_t::iterator it = _idx_buf.begin();
342  std::advance(it, this->end_idx(s));
343  _idx_buf.insert(it, var_idxs.begin(), var_idxs.end());
344 
345  for (unsigned int ctr=(s+1); ctr<n_sys; ctr++)
346  _idx_buf[ctr] += 2*nvg;
347 
348  if (hei)
349  _idx_buf[n_sys] += 2*nvg;
350 
351  // resize _idx_buf to fit so no memory is wasted.
353  }
354 
355  libmesh_assert_equal_to (nvg, this->n_var_groups(s));
356 
357 #ifdef DEBUG
358 
359  libmesh_assert_equal_to (this->n_var_groups(s), nvpg.size());
360 
361  for (auto vg : make_range(this->n_var_groups(s)))
362  {
363  libmesh_assert_equal_to (this->n_vars(s,vg), nvpg[vg]);
364  libmesh_assert_equal_to (this->n_comp_group(s,vg), 0);
365  }
366 
367  for (auto v : make_range(this->n_vars(s)))
368  libmesh_assert_equal_to (this->n_comp(s,v), 0);
369 
370  // again, all other system sizes should be unchanged!
371  for (auto s_ctr : make_range(this->n_systems()))
372  if (s_ctr != s)
373  libmesh_assert_equal_to (this->n_var_groups(s_ctr), old_system_sizes[s_ctr]);
374 
375  // Extra integers count and values should also be unchanged!
376  libmesh_assert_equal_to (nei, this->n_extra_integers());
377 
378  for (unsigned int ei=0; ei != nei; ++ei)
379  libmesh_assert_equal_to(old_extra_integers[ei], this->get_extra_integer(ei));
380 #endif
381 }
382 
383 
384 
385 void DofObject::set_n_comp(const unsigned int s,
386  const unsigned int var,
387  const unsigned int ncomp)
388 {
389  libmesh_assert_less (s, this->n_systems());
390  libmesh_assert_less (var, this->n_vars(s));
391 
392  this->set_n_comp_group(s, this->var_to_vg(s,var), ncomp);
393 }
394 
395 
396 
397 void DofObject::set_n_comp_group(const unsigned int s,
398  const unsigned int vg,
399  const unsigned int ncomp)
400 {
401  libmesh_assert_less (s, this->n_systems());
402  libmesh_assert_less (vg, this->n_var_groups(s));
403 
404  // Check for trivial return
405  if (ncomp == this->n_comp_group(s,vg)) return;
406 
407 #ifndef NDEBUG
408  if (ncomp >= ncv_magic)
409  {
410  const index_t ncvm = ncv_magic;
411  libmesh_error_msg("ERROR: ncomp must be less than DofObject::ncv_magic!\n" \
412  << "ncomp = " \
413  << ncomp \
414  << ", ncv_magic = " \
415  << ncvm \
416  << "\nrecompile and try again!");
417  }
418 #endif
419 
420  const unsigned int
421  start_idx_sys = this->start_idx(s),
422  n_vars_group = this->n_vars(s,vg),
423  base_offset = start_idx_sys + 2*vg;
424 
425  libmesh_assert_less ((base_offset + 1), _idx_buf.size());
426 
427  // if (ncomp)
428  // libMesh::out << "s,vg,ncomp="
429  // << s << ","
430  // << vg << ","
431  // << ncomp << '\n';
432 
433  // set the number of components, maintaining the number
434  // of variables in the group
435  _idx_buf[base_offset] = ncv_magic*n_vars_group + ncomp;
436 
437  // We use (invalid_id - 1) to signify no
438  // components for this object
439  _idx_buf[base_offset + 1] = (ncomp == 0) ? invalid_id - 1 : invalid_id;
440 
441  // this->debug_buffer();
442  // libMesh::out << "s,vg = " << s << "," << vg << '\n'
443  // << "base_offset=" << base_offset << '\n'
444  // << "this->n_comp(s,vg)=" << this->n_comp(s,vg) << '\n'
445  // << "this->n_comp_group(s,vg)=" << this->n_comp_group(s,vg) << '\n'
446  // << "this->n_vars(s,vg)=" << this->n_vars(s,vg) << '\n'
447  // << "this->n_var_groups(s)=" << this->n_var_groups(s) << '\n';
448 
449  libmesh_assert_equal_to (ncomp, this->n_comp_group(s,vg));
450 }
451 
452 
453 
454 void DofObject::set_dof_number(const unsigned int s,
455  const unsigned int var,
456  const unsigned int comp,
457  const dof_id_type dn)
458 {
459  libmesh_assert_less (s, this->n_systems());
460  libmesh_assert_less (var, this->n_vars(s));
461  libmesh_assert_less (comp, this->n_comp(s,var));
462 
463  const unsigned int
464  vg = this->var_to_vg(s,var),
465 #ifndef NDEBUG
466  ncg = this->n_comp_group(s,vg),
467 #endif
468  vig = this->system_var_to_vg_var(s,vg,var),
469  start_idx_sys = this->start_idx(s);
470 
471  libmesh_assert_less ((start_idx_sys + 2*vg + 1), _idx_buf.size());
472 
473  dof_id_type & base_idx = _idx_buf[start_idx_sys + 2*vg + 1];
474 
475  // We intend to change all dof numbers together or not at all
476  if (comp || vig)
477  libmesh_assert ((dn == invalid_id && base_idx == invalid_id) ||
478  (dn == base_idx + vig*ncg + comp));
479 
480  // only explicitly store the base index for vig==0, comp==0
481  else
482  base_idx = dn;
483 
484  libmesh_assert_equal_to (this->dof_number(s, var, comp), dn);
485 }
486 
487 
488 
489 void
490 DofObject::add_extra_integers (const unsigned int n_integers)
491 {
492  if (_idx_buf.empty())
493  {
494  if (n_integers)
495  {
496  _idx_buf.resize(n_integers+1, DofObject::invalid_id);
497  _idx_buf[0] = dof_id_type(-1);
498  }
499  return;
500  }
501  else
502  {
503  const int hdr = dof_id_signed_type(_idx_buf[0]);
504 
505  // We already have some extra integers, but may need more or
506  // less now.
507  if (hdr < 0)
508  {
509  const unsigned int old_n_integers = this->n_extra_integers();
510  if (n_integers != old_n_integers)
511  {
512  // Make or remove space as needed by count change
513  _idx_buf.resize(_idx_buf.size()+n_integers-old_n_integers, DofObject::invalid_id);
514 
515  // The start index for the extra integers is unchanged.
516  }
517  }
518  else if (n_integers)
519  // We had no extra integers, but need to add some
520  {
521  // Mark the DofObject as holding extra integers
522  _idx_buf[0] = dof_id_type(-hdr-1);
523 
524  // Insert the integer start position
525  DofObject::index_buffer_t::iterator it = _idx_buf.begin() + hdr;
526  _idx_buf.insert(it, _idx_buf.size()+1);
527 
528  // Increment the previous system start positions to account
529  // for the new header entry creating an offset
530  for (int i=1; i<hdr; i++)
531  _idx_buf[i]++;
532 
533  // Append space for extra integers
534  _idx_buf.resize(_idx_buf.size()+n_integers, DofObject::invalid_id);
535  }
536  }
537 }
538 
539 
540 
541 void
542 DofObject::add_extra_integers (const unsigned int n_integers,
543  const std::vector<dof_id_type> & default_values)
544 {
545  libmesh_assert_equal_to(n_integers, default_values.size());
546 
547  const unsigned int n_old_integers = this->n_extra_integers();
548  this->add_extra_integers(n_integers);
549  if (n_integers > n_old_integers)
550  {
551  const unsigned int n_more_integers = n_integers - n_old_integers;
552  std::copy(default_values.begin()+n_old_integers,
553  default_values.end(),
554  _idx_buf.end()-n_more_integers);
555  }
556 }
557 
558 
559 
561 {
562  return
563  cast_int<unsigned int> (
564 #ifdef LIBMESH_ENABLE_AMR
565  ((old_dof_object == nullptr) ? 0 : old_dof_object->packed_indexing_size()) + 2 +
566 #else
567  1 +
568 #endif
569  _idx_buf.size());
570 }
571 
572 
573 
574 unsigned int
575 DofObject::unpackable_indexing_size(std::vector<largest_id_type>::const_iterator begin)
576 {
577 #ifdef LIBMESH_ENABLE_AMR
578  const bool has_old_dof_object = cast_int<bool>(*begin++);
579 
580  static const int dof_header_size = 2;
581 #else
582  static const bool has_old_dof_object = false;
583  static const int dof_header_size = 1;
584 #endif
585 
586  const largest_id_type this_indexing_size = *begin++;
587 
588  return cast_int<unsigned int>
589  (dof_header_size + this_indexing_size +
590  (has_old_dof_object ?
591  unpackable_indexing_size(begin+this_indexing_size) : 0));
592 }
593 
594 
595 void DofObject::unpack_indexing(std::vector<largest_id_type>::const_iterator begin)
596 {
597  _idx_buf.clear();
598 
599 #ifdef LIBMESH_ENABLE_AMR
600  this->clear_old_dof_object();
601  const bool has_old_dof_object = cast_int<bool>(*begin++);
602 #endif
603 
604  const largest_id_type size = *begin++;
605  _idx_buf.reserve(size);
606  std::copy(begin, begin+size, back_inserter(_idx_buf));
607 
608  // Check as best we can for internal consistency now
609  libmesh_assert(_idx_buf.empty() ||
611  cast_int<dof_id_signed_type>(_idx_buf.size())));
612 #ifdef DEBUG
613  if (!_idx_buf.empty())
614  {
615  const int hdr = cast_int<int>(dof_id_signed_type(_idx_buf[0]));
616  const unsigned int ns = hdr >= 0 ? hdr : (-hdr-1);
617  for (unsigned int i=1; i < ns; ++i)
618  {
619  if (hdr > 0 || i > 1)
620  libmesh_assert_greater_equal (_idx_buf[i], _idx_buf[i-1]);
621  else
622  libmesh_assert_greater_equal (_idx_buf[i], ns);
623  libmesh_assert_equal_to ((_idx_buf[i] - _idx_buf[i-1])%2, 0);
624  libmesh_assert_less_equal (_idx_buf[i], _idx_buf.size());
625  }
626  if (hdr < 0 && ns > 0)
627  libmesh_assert_less_equal(_idx_buf[ns], _idx_buf.size());
628  }
629 #endif
630 
631 #ifdef LIBMESH_ENABLE_AMR
632  if (has_old_dof_object)
633  {
634  this->old_dof_object = this->construct();
635  this->old_dof_object->unpack_indexing(begin+size);
636  }
637 #endif
638 }
639 
640 
641 void
642 DofObject::pack_indexing(std::back_insert_iterator<std::vector<largest_id_type>> target) const
643 {
644 #ifdef LIBMESH_ENABLE_AMR
645  // We might need to pack old_dof_object too
646  *target++ = (old_dof_object == nullptr) ? 0 : 1;
647 #endif
648 
649  *target++ = _idx_buf.size();
650  std::copy(_idx_buf.begin(), _idx_buf.end(), target);
651 
652 #ifdef LIBMESH_ENABLE_AMR
653  if (old_dof_object)
654  old_dof_object->pack_indexing(target);
655 #endif
656 }
657 
658 
659 
661 {
662  libMesh::out << " [ ";
663  for (const auto & idx : _idx_buf)
664  libMesh::out << idx << " ";
665  libMesh::out << "]\n";
666 }
667 
668 
669 
671 {
672  libMesh::out << this->id() << " [ ";
673 
674  for (auto s : make_range(this->n_systems()))
675  {
676  libMesh::out << "s:" << s << " ";
677  for (auto var : make_range(this->n_vars(s)))
678  {
679  libMesh::out << "v:" << var << " ";
680  for (auto comp : make_range(this->n_comp(s,var)))
681  {
682  libMesh::out << "c:" << comp << " dof:" << this->dof_number(s,var,comp) << " ";
683  }
684  }
685  }
686 
687  libMesh::out << "]\n";
688 }
689 
690 
691 
692 } // namespace libMesh
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:385
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:1352
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Definition: dof_object.h:1025
std::unique_ptr< DofObject > construct(const DofObject *other=nullptr)
Convenient factory function that calls either the (deep) copy constructor or the default constructor ...
Definition: dof_object.h:736
void set_old_dof_object()
Sets the old_dof_object to a copy of this.
Definition: dof_object.C:135
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:575
unsigned int n_comp(const unsigned int s, const unsigned int var) const
Definition: dof_object.h:995
unsigned int n_var_groups(const unsigned int s) const
Definition: dof_object.h:950
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:1334
uint64_t largest_id_type
Definition: id_types.h:148
dof_id_type _id
The id of the DofObject.
Definition: dof_object.h:578
The libMesh namespace provides an interface to certain functionality in the library.
DofObject()
Constructor.
Definition: dof_object.h:722
unsigned int start_idx_ints() const
The starting index for an extra_integers pseudosystem.
Definition: dof_object.h:1266
dof_id_type index_t
DoF index information.
Definition: dof_object.h:673
unique_id_type _unique_id
A globally unique id, guaranteed not to change as the mesh is repartitioned or adapted.
Definition: dof_object.h:572
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
Definition: type_vector.h:57
void add_system()
Adds an additional system to the DofObject.
Definition: dof_object.C:195
unsigned int end_idx(const unsigned int s) const
The ending index for system s.
Definition: dof_object.h:1253
uint8_t processor_id_type
dof_id_type id() const
Definition: dof_object.h:823
DofObject & operator=(const DofObject &dof_obj)
Deep-copying assignment operator.
Definition: dof_object.C:77
static const unique_id_type invalid_unique_id
An invalid unique_id to distinguish an uninitialized DofObject.
Definition: dof_object.h:482
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:488
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:454
unsigned int n_vars(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:960
unsigned int n_systems() const
Definition: dof_object.h:930
processor_id_type _processor_id
The local processor id.
Definition: libmesh.C:244
void print_dof_info() const
Print out info for debugging.
Definition: dof_object.C:670
void clear_old_dof_object()
Sets the old_dof_object to nullptr.
Definition: dof_object.C:128
libmesh_assert(ctx)
static const dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:477
int8_t dof_id_signed_type
Definition: id_types.h:68
DofObject * get_old_dof_object()
Pointer accessor for previously public old_dof_object.
Definition: dof_object.h:96
bool has_extra_integers() const
Returns whether extra integers are associated to the DofObject.
Definition: dof_object.h:1181
This class implements reference counting.
std::vector< index_t > index_buffer_t
Definition: dof_object.h:674
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:397
void set_n_systems(const unsigned int s)
Sets the number of systems for this DofObject.
Definition: dof_object.C:150
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:247
unsigned int start_idx(const unsigned int s) const
The starting index for system s.
Definition: dof_object.h:1242
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:560
std::unique_ptr< DofObject > old_dof_object
This object on the last mesh.
Definition: dof_object.h:88
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:642
OStreamProxy out
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:134
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:595
The DofObject defines an abstract base class for objects that have degrees of freedom associated with...
Definition: dof_object.h:54
void add_extra_integers(const unsigned int n_integers)
Assigns a set of extra integers to this DofObject.
Definition: dof_object.C:490
unsigned int n_extra_integers() const
Returns how many extra integers are associated to the DofObject.
Definition: dof_object.h:1163
index_buffer_t _idx_buf
Definition: dof_object.h:675
void debug_buffer() const
Print our buffer for debugging.
Definition: dof_object.C:660
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
Definition: dof_object.h:1008
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:589
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:1095
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)
A useful inline function which replaces the macros used previously.
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:686