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