13 #include "libmesh/dense_vector.h" 20 :
libMesh::ParallelObject(comm_in), _closed(false), _n_local_entries(0)
42 _n_local_entries = n_local_entries;
43 _local_entries.resize(_n_local_entries);
44 _local_entry_ids.resize(_n_local_entries);
48 for (
unsigned int entry_i = local_entry_begin; entry_i < (
unsigned int)local_entry_end; ++entry_i)
50 _local_entry_ids[entry_i] = entry_i;
58 auto it = std::find(_local_entry_ids.begin(), _local_entry_ids.end(), glob_i);
59 if (it != _local_entry_ids.end())
60 ::
mooseError(
"Local object ID (", glob_i,
") already exists!");
62 ::mooseError(
"DistributeData has already been closed, cannot add new elements!");
64 _local_entries.push_back(entry);
65 _local_entry_ids.push_back(glob_i);
66 _n_local_entries += 1;
73 auto it = std::find(_local_entry_ids.begin(), _local_entry_ids.end(), glob_i);
74 if (it == _local_entry_ids.end())
75 ::
mooseError(
"Local object ID (", glob_i,
") does not exists!");
77 ::mooseError(
"DistributeData has already been closed, cannot change elements!");
79 _local_entries[std::distance(_local_entry_ids.begin(), it)] = entry;
86 auto it = std::find(_local_entry_ids.begin(), _local_entry_ids.end(), glob_i);
87 if (it == _local_entry_ids.end())
88 ::
mooseError(
"Local object ID (", glob_i,
") does not exists!");
90 return _local_entries[std::distance(_local_entry_ids.begin(), it)];
97 if (loc_i > _n_local_entries - 1)
98 ::mooseError(
"The requested local index (",
100 ") is greater than the size (",
102 ") of the locally stored vector!");
104 return _local_entries[loc_i];
107 template <
typename T>
111 unsigned int val = _n_local_entries;
112 _communicator.sum(val);
116 template <
typename T>
120 const auto it = std::find(_local_entry_ids.begin(), _local_entry_ids.end(), glob_i);
121 if (it != _local_entry_ids.end())
127 template <
typename T>
131 const auto it = std::find(_local_entry_ids.begin(), _local_entry_ids.end(), glob_i);
132 if (it == _local_entry_ids.end())
133 ::
mooseError(
"Local object ID (", glob_i,
") does not exists!");
135 return std::distance(_local_entry_ids.begin(), it);
138 template <
typename T>
142 if (loc_i > _n_local_entries - 1)
143 ::mooseError(
"The requested local index (",
145 ") is greater than the size (",
147 ") of the locally stored vector!");
149 return _local_entry_ids[loc_i];
void mooseError(Args &&... args)
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
void linearPartitionItems(dof_id_type num_items, dof_id_type num_chunks, dof_id_type chunk_id, dof_id_type &num_local_items, dof_id_type &local_items_begin, dof_id_type &local_items_end)
void ErrorVector unsigned int