![]() |
Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
00001 #include "SplitVertices.hpp"
00002 #include "RefinerTagManager.hpp"
00003
00004 #include "MBParallelConventions.h"
00005
00006 namespace moab
00007 {
00008
00009 SplitVerticesBase::SplitVerticesBase( RefinerTagManager* tag_mgr )
00010 {
00011 this->tag_manager = tag_mgr;
00012 this->mesh_out = tag_mgr->get_output_mesh();
00013 }
00014
00015 SplitVerticesBase::~SplitVerticesBase() {}
00016
00017 EntitySource::EntitySource( int nc, RefinerTagManager* tag_mgr )
00018 {
00019 this->tag_manager = tag_mgr;
00020 this->mesh_out = tag_mgr->get_output_mesh();
00021 this->num_corners = nc;
00022 }
00023
00024 EntitySource::~EntitySource() {}
00025
00026 bool EntitySource::create_element( EntityType etyp,
00027 int nconn,
00028 const EntityHandle* elem_verts,
00029 EntityHandle& elem_handle,
00030 std::map< ProcessSet, int >& proc_partition_counts )
00031 {
00032 // Get the global IDs of the input vertices
00033 // int stat;
00034 proc_partition_counts[this->tag_manager->get_element_procs()]++;
00035 if( this->mesh_out->create_element( etyp, elem_verts, nconn, elem_handle ) != MB_SUCCESS )
00036 {
00037 return false;
00038 }
00039 this->push_back( EntitySourceRecord( this->num_corners, elem_handle, this->tag_manager->get_element_procs() ) );
00040 this->tag_manager->set_sharing( elem_handle, this->tag_manager->get_element_procs() );
00041 return true;
00042 }
00043
00044 void EntitySource::assign_global_ids( std::map< ProcessSet, int >& gids )
00045 {
00046 std::vector< EntityHandle > adjacencies;
00047 adjacencies.resize( this->num_corners );
00048 std::vector< EntitySourceRecord >::iterator it;
00049 for( it = this->begin(); it != this->end(); ++it )
00050 {
00051 int num_nodes;
00052 const EntityHandle* conn;
00053 this->mesh_out->get_connectivity( it->handle, conn, num_nodes );
00054 this->tag_manager->get_output_gids( this->num_corners, conn, it->ids );
00055 std::sort( it->ids.begin(), it->ids.end() );
00056 }
00057 std::sort( this->begin(), this->end() );
00058 for( it = this->begin(); it != this->end(); ++it )
00059 {
00060 int gid = gids[it->process_set]++;
00061 this->tag_manager->set_gid( it->handle, gid );
00062 #ifdef MB_DEBUG
00063 std::cout << "Assigning entity: " << it->handle << " GID: " << gid << "\n";
00064 #endif // MB_DEBUG
00065 }
00066 }
00067
00068 } // namespace moab