161 {
163 Base & v = *v_ptr;
164
166 first = v.first_local_index(),
167 last = v.last_local_index();
168
169 const unsigned int sub_local_size =
block_size/2;
170 const unsigned int sub_global_size = sub_local_size *
my_comm->
size();
171
172 for (auto supplying_global_rows : {false, true})
173 for (auto get_not_create : {false, true})
174 {
175
176 if (get_not_create && supplying_global_rows)
177 continue;
178
181 v.close();
182
183 std::unique_ptr<Base> s_ptr =
184 std::make_unique<Derived>(*
my_comm, sub_global_size,
185 sub_local_size);
186
188 sub_first = s_ptr->first_local_index(),
189 sub_last = s_ptr->last_local_index();
190
191 CPPUNIT_ASSERT_EQUAL
194
195 CPPUNIT_ASSERT_EQUAL
198
199 std::vector<libMesh::dof_id_type> rows;
201 rows.push_back(first+2*i);
202
203 if (supplying_global_rows)
205
206 if (get_not_create)
207 {
210 s_ptr.reset(dynamic_cast<Base *>(subvec_ptr));
211 }
212 else
213 v.create_subvector(*s_ptr, rows, supplying_global_rows);
214
215 Base & s = *s_ptr;
216
218 LIBMESH_ASSERT_NUMBERS_EQUAL
221
224 s.close();
225
226
227
228 if (!get_not_create)
229 continue;
230
231 v.restore_subvector(std::move(s_ptr), rows);
232
234 {
236 if (offset < 2*sub_local_size && !(offset%2))
237 LIBMESH_ASSERT_NUMBERS_EQUAL
238 (v(n),
240 ((offset/2) + sub_first)),
242 else
243 LIBMESH_ASSERT_NUMBERS_EQUAL
246 }
247 }
248 }
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
virtual std::unique_ptr< NumericVector< T > > get_subvector(const std::vector< numeric_index_type > &)
Creates a view into this vector using the indices in rows.
The libMesh namespace provides an interface to certain functionality in the library.
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...