Ejemplo n.º 1
0
void TagVertexMesh::copy_all_coordinates( MsqError& err )
{
  if (!haveTagHandle) {
    tagHandle = get_mesh()->tag_create( tagName, Mesh::DOUBLE, 3, 0, err ); 
    MSQ_ERRRTN(err);
    haveTagHandle = true;
  }

  std::vector<Mesh::VertexHandle> handles;
  get_all_vertices( handles, err ); 
  MSQ_ERRRTN(err);
  if (handles.empty())
    return;
  
  std::vector<MsqVertex> coords(handles.size());
  get_mesh()->vertices_get_coordinates( arrptr(handles), arrptr(coords), handles.size(), err );
  MSQ_ERRRTN(err);
  
  std::vector<double> data( 3*handles.size() );
  std::vector<double>::iterator j = data.begin();
  std::vector<MsqVertex>::const_iterator i = coords.begin();
  while (i != coords.end()) {
    i->get_coordinates( &*j );
    ++i;
    j += 3;
  }
  
  tag_set_vertex_data( tagHandle, handles.size(), arrptr(handles), arrptr(data), err );
  MSQ_ERRRTN(err);
}
Ejemplo n.º 2
0
void ParallelMeshImpl::vertices_set_global_id(const VertexHandle vert_array[],
					      size_t gid[],
					      size_t num_vtx,
					      MsqError& err)
{
  if (gid_tag == 0)
  {
    const char GLOBAL_ID_NAME[] = "GLOBAL_ID";

    int default_gid = -1;
    gid_tag = tag_create( GLOBAL_ID_NAME, HANDLE, 1, &default_gid, err );
      // the 'HANDLE' is the type of data to store
      // the '1' is for one value per vertex
      // NULL for no default value, if you want them all
      // initialized to something, pass in a pointer to an int
      // with the value.
    MSQ_CHKERR(err);
  }

  tag_set_vertex_data( gid_tag, num_vtx, vert_array, gid, err );
  MSQ_CHKERR(err);
}
Ejemplo n.º 3
0
void ParallelMeshImpl::vertices_set_processor_id(const VertexHandle vert_array[],
						 int pid[],
						 size_t num_vtx,
						 MsqError& err)
{
  if (pid_tag == 0)
  {
    const char PROCESSOR_ID_NAME[] = "PROCESSOR_ID";

    int default_pid = -1;
    pid_tag = tag_create( PROCESSOR_ID_NAME, INT, 1, &default_pid, err );
      // the 'INT' is the type of data to store
      // the '1' is for one value per vertex
      // NULL for no default value, if you want them all
      // initialized to something, pass in a pointer to an int
      // with the value.
    MSQ_CHKERR(err);
  }

  tag_set_vertex_data( pid_tag, num_vtx, vert_array, pid, err );
  MSQ_CHKERR(err); 
}