3 #include <libmesh/parallel_ghost_sync.h> 4 #include <libmesh/mesh.h> 5 #include <libmesh/mesh_generation.h> 16 typedef std::vector<Real> datum;
20 std::unordered_set<dof_id_type> answered_ids;
26 for (
const Node * node :
mesh.node_ptr_range())
28 CPPUNIT_ASSERT(answered_ids.count(node->id()));
31 void gather_data (
const std::vector<dof_id_type> & ids,
32 std::vector<datum> & data)
34 data.resize(ids.size());
44 data[i] = {(*node)(2), (*node)(1), (*node)(0)};
48 void act_on_data (
const std::vector<dof_id_type> & ids,
49 const std::vector<datum> & data)
51 CPPUNIT_ASSERT_EQUAL(ids.size(), data.size());
55 answered_ids.insert(ids[i]);
62 CPPUNIT_ASSERT_EQUAL(data[i].size(), std::size_t(3));
63 CPPUNIT_ASSERT_EQUAL(data[i][0], (*node)(2));
64 CPPUNIT_ASSERT_EQUAL(data[i][1], (*node)(1));
65 CPPUNIT_ASSERT_EQUAL(data[i][2], (*node)(0));
78 CPPUNIT_TEST( testByXYZ );
80 CPPUNIT_TEST_SUITE_END();
88 _mesh = std::make_unique<Mesh>(*TestCommWorld);
89 constexpr
unsigned int n = 3;
90 MeshTools::Generation::build_cube (*_mesh, n, n, n, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0,
HEX27);
100 SyncAndTest sync(*_mesh);
102 loc_map.
init(*_mesh);
A Node is like a Point, but with more information.
libMesh::Parallel::Communicator * TestCommWorld
The libMesh namespace provides an interface to certain functionality in the library.
void sync_dofobject_data_by_xyz(const Communicator &comm, const Iterator &range_begin, const Iterator &range_end, LocationMap< DofObjType > &location_map, SyncFunctor &sync)
Request data about a range of ghost nodes uniquely identified by their xyz location or a range of act...
This is the MeshBase class.
std::unique_ptr< Mesh > _mesh
virtual const Node * query_node_ptr(const dof_id_type i) const =0
Data structures that enable location-based lookups The key is a hash of the Point location...
CPPUNIT_TEST_SUITE_REGISTRATION(ParallelGhostSyncTest)
processor_id_type processor_id() const
processor_id_type processor_id() const
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...