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