$extrastylesheet
00001 #include "libmesh/parallel_ghost_sync.h" 00002 00003 namespace libMesh 00004 { 00005 00006 SyncNodalPositions::SyncNodalPositions(MeshBase& m) 00007 : mesh(m) 00008 {} 00009 00010 00011 00012 void SyncNodalPositions::gather_data (const std::vector<dof_id_type>& ids, std::vector<datum>& data) 00013 { 00014 data.resize(ids.size()); 00015 00016 // Gather (x,y,z) data for all node IDs in the ids vector 00017 for (std::size_t i=0; i<ids.size(); ++i) 00018 { 00019 // Look for this node in the mesh 00020 Node *node = mesh.node_ptr(ids[i]); 00021 00022 if (node == NULL) 00023 libmesh_error_msg("Error! Mesh returned a NULL node pointer in SyncNodalPosition::gather_data()."); 00024 00025 // Store this node's position in the data array. 00026 // This should call Point::op= 00027 data[i] = *node; 00028 } // end for 00029 } // gather_data() 00030 00031 00032 00033 void SyncNodalPositions::act_on_data (const std::vector<dof_id_type>& ids, std::vector<datum>& data) 00034 { 00035 for (std::size_t i=0; i<ids.size(); ++i) 00036 { 00037 00038 // Get a pointer to the node whose position is to be updated. 00039 Node* node = mesh.node_ptr(ids[i]); 00040 00041 if (node == NULL) 00042 libmesh_error_msg("Error! Mesh returned a NULL node pointer in SyncNodalPosition::act_on_data()."); 00043 00044 // Update this node's position. Should call Point::op= 00045 *node = data[i]; 00046 } // end for 00047 } // act_on_data() 00048 00049 } // namespace