parallel_ghost_sync.C
Go to the documentation of this file.
2 
3 
4 SyncNodalPositions::SyncNodalPositions(MeshBase& m)
5  : mesh(m)
6 {}
7 
8 
9 
10 void SyncNodalPositions::gather_data (const std::vector<dof_id_type>& ids, std::vector<datum>& data)
11 {
12  data.resize(ids.size());
13 
14  // Gather (x,y,z) data for all node IDs in the ids vector
15  for (std::size_t i=0; i<ids.size(); ++i)
16  {
17  // Look for this node in the mesh
18  Node *node = mesh.node_ptr(ids[i]);
19 
20  if (node == NULL)
21  {
22  libMesh::err << "Error! Mesh returned a NULL node pointer in SyncNodalPosition::gather_data()." << std::endl;
23  libmesh_error();
24  }
25 
26  // Store this node's position in the data array.
27  // This should call Point::op=
28  data[i] = *node;
29  } // end for
30 } // gather_data()
31 
32 
33 
34 void SyncNodalPositions::act_on_data (const std::vector<dof_id_type>& ids, std::vector<datum>& data)
35 {
36  for (std::size_t i=0; i<ids.size(); ++i)
37  {
38 
39  // Get a pointer to the node whose position is to be updated.
40  Node* node = mesh.node_ptr(ids[i]);
41 
42  if (node == NULL)
43  {
44  libMesh::err << "Error! Mesh returned a NULL node pointer in SyncNodalPosition::act_on_data()." << std::endl;
45  libmesh_error();
46  }
47 
48  // Update this node's position. Should call Point::op=
49  *node = data[i];
50  } // end for
51 } // act_on_data()

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:06 UTC

Hosted By:
SourceForge.net Logo