|
MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include <string>#include <iomanip>#include <iostream>#include <cassert>#include "moab/Core.hpp"#include "moab/ParallelComm.hpp"#include "moab/HomXform.hpp"#include "MBParallelConventions.h"#include "MBTagConventions.hpp"
Include dependency graph for scdtest.cpp:Go to the source code of this file.
Functions | |
| void | set_local_domain_bounds () |
| void | create_hexes_and_verts () |
| void | resolve_and_exchange () |
| void | error (ErrorCode err) |
| int | main (int argc, char *argv[]) |
Variables | |
| const int | NI = 2 |
| const int | NJ = 2 |
| const int | NK = 1 |
| Interface * | mbint = NULL |
| ParallelComm * | mbpc = NULL |
| int | is |
| int | js |
| int | ks |
| int | ie |
| int | je |
| int | ke |
| int | rank |
| int | size |
| void create_hexes_and_verts | ( | ) |
Definition at line 140 of file scdtest.cpp.
References moab::Core::add_vsequence(), moab::Core::create_scd_sequence(), moab::error(), ErrorCode, moab::Interface::globalId_tag(), ie, is, je, js, ke, ks, MB_SUCCESS, mbcore, MBHEX, mbint, MBVERTEX, NI, NJ, and moab::Interface::tag_set_data().
Referenced by main().
{
Core* mbcore = dynamic_cast< Core* >( mbint );
HomCoord coord_min( 0, 0, 0 );
HomCoord coord_max( ie - is, je - js, ke - ks );
EntitySequence* vertex_seq = NULL;
EntitySequence* cell_seq = NULL;
EntityHandle vs, cs;
error( mbcore->create_scd_sequence( coord_min, coord_max, MBVERTEX, 1, vs, vertex_seq ) );
error( mbcore->create_scd_sequence( coord_min, coord_max, MBHEX, 1, cs, cell_seq ) );
HomCoord p1( 0, 0, 0 );
HomCoord p2( 1, 0, 0 );
HomCoord p3( 0, 1, 0 );
error( mbcore->add_vsequence( vertex_seq, cell_seq, p1, p1, p2, p2, p3, p3 ) );
// Set global id's:
int gid;
Tag global_id_tag = mbint->globalId_tag();
EntityHandle handle = vs;
int i, j, k;
ErrorCode err;
for( k = ks; k < ke + 1; k++ )
for( j = js; j < je + 1; j++ )
for( i = is; i < ie + 1; i++ )
{
gid = 1 + i + j * ( NI + 1 ) + k * ( NI + 1 ) * ( NJ + 1 );
err = mbint->tag_set_data( global_id_tag, &handle, 1, &gid );
if( err != MB_SUCCESS )
{
exit( 1 );
}
handle++;
}
handle = cs;
for( k = ks; k < ke; k++ )
for( j = js; j < je; j++ )
for( i = is; i < ie; i++ )
{
gid = 1 + i + j * NI + k * NI * NJ;
error( mbint->tag_set_data( global_id_tag, &handle, 1, &gid ) );
handle++;
}
}
Definition at line 219 of file scdtest.cpp.
References MB_SUCCESS.
{
if( err != MB_SUCCESS )
{
std::cerr << "Error: MOAB function failed\n";
assert( 0 );
}
}
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 44 of file scdtest.cpp.
References create_hexes_and_verts(), mbint, mbpc, MPI_COMM_WORLD, rank, resolve_and_exchange(), set_local_domain_bounds(), and size.
{
MPI_Init( &argc, &argv );
MPI_Comm_rank( MPI_COMM_WORLD, &rank );
MPI_Comm_size( MPI_COMM_WORLD, &size );
if( size != 4 && size != 2 )
{
std::cerr << "Run this with 2 or 4 processes\n";
MPI_Finalize();
exit( 1 );
}
mbint = new Core();
mbpc = new ParallelComm( mbint, MPI_COMM_WORLD );
set_local_domain_bounds();
create_hexes_and_verts();
resolve_and_exchange();
delete mbpc; // ParallelComm instance should be deleted before MOAB instance is deleted
delete mbint;
MPI_Finalize();
return 0;
}
| void resolve_and_exchange | ( | ) |
Definition at line 190 of file scdtest.cpp.
References moab::Interface::add_entities(), moab::Interface::create_meshset(), moab::error(), moab::ParallelComm::exchange_ghost_cells(), moab::Interface::get_entities_by_type(), moab::Interface::get_entities_by_type_and_tag(), MATERIAL_SET_TAG_NAME, MB_TYPE_INTEGER, MBENTITYSET, MBHEX, mbint, mbpc, MESHSET_SET, moab::ParallelComm::partition_sets(), rank, moab::ParallelComm::resolve_shared_ents(), moab::Interface::tag_get_handle(), and moab::Interface::tag_set_data().
Referenced by main().
{
EntityHandle entity_set;
// Create the entity set:
error( mbint->create_meshset( MESHSET_SET, entity_set ) );
// Get a list of hexes:
Range range;
error( mbint->get_entities_by_type( 0, MBHEX, range ) );
// Add entities to the entity set:
error( mbint->add_entities( entity_set, range ) );
// Add the MATERIAL_SET tag to the entity set:
Tag tag;
error( mbint->tag_get_handle( MATERIAL_SET_TAG_NAME, 1, MB_TYPE_INTEGER, tag ) );
error( mbint->tag_set_data( tag, &entity_set, 1, &rank ) );
// Set up partition sets. This is where MOAB is actually told what
// entities each process owns:
error( mbint->get_entities_by_type_and_tag( 0, MBENTITYSET, &tag, NULL, 1, mbpc->partition_sets() ) );
// Finally, determine which entites are shared and exchange the
// ghosted entities:
error( mbpc->resolve_shared_ents( 0, -1, -1 ) );
error( mbpc->exchange_ghost_cells( -1, 0, 1, 0, true ) );
}
| void set_local_domain_bounds | ( | ) |
Definition at line 70 of file scdtest.cpp.
References ie, is, je, js, ke, ks, NI, NJ, NK, rank, and size.
Referenced by main().
{
switch( size )
{
case 2:
switch( rank )
{
case 0:
is = 0;
ie = NI / 2;
js = 0;
je = NJ;
ks = 0;
ke = NK;
break;
case 1:
is = NI / 2;
ie = NI;
js = 0;
je = NJ;
ks = 0;
ke = NK;
break;
}
break;
case 4:
switch( rank )
{
case 0:
is = 0;
ie = NI / 2;
js = 0;
je = NJ / 2;
ks = 0;
ke = NK;
break;
case 1:
is = NI / 2;
ie = NI;
js = 0;
je = NJ / 2;
ks = 0;
ke = NK;
break;
case 2:
is = 0;
ie = NI / 2;
js = NJ / 2;
je = NJ;
ks = 0;
ke = NK;
break;
case 3:
is = NI / 2;
ie = NI;
js = NJ / 2;
je = NJ;
ks = 0;
ke = NK;
break;
}
break;
default:
std::cerr << "Run this with 4 processes\n";
exit( 1 );
}
}
| int ie |
Definition at line 33 of file scdtest.cpp.
Referenced by moab::IntxAreaUtils::area_on_sphere(), moab::MeshGeneration::BrickInstance(), moab::TempestRemapper::ComputeGlobalLocalMaps(), moab::TempestRemapper::ComputeOverlapMesh(), moab::TempestRemapper::ConstructCoveringSet(), moab::TempestRemapper::convert_overlap_mesh_sorted_by_source(), create_fine_mesh(), create_hexes_and_verts(), moab::IntxUtils::deep_copy_set_with_quads(), main(), and set_local_domain_bounds().
| int is |
Definition at line 32 of file scdtest.cpp.
Referenced by create_hexes_and_verts(), get_vartag_data(), and set_local_domain_bounds().
| int je |
Definition at line 33 of file scdtest.cpp.
Referenced by create_hexes_and_verts(), and set_local_domain_bounds().
| int js |
Definition at line 32 of file scdtest.cpp.
Referenced by create_hexes_and_verts(), and set_local_domain_bounds().
| int ke |
Definition at line 33 of file scdtest.cpp.
Referenced by create_hexes_and_verts(), and set_local_domain_bounds().
| int ks |
Definition at line 32 of file scdtest.cpp.
Referenced by create_hexes_and_verts(), and set_local_domain_bounds().
Definition at line 28 of file scdtest.cpp.
Referenced by create_hexes_and_verts(), create_parallel_mesh(), main(), and resolve_and_exchange().
| ParallelComm* mbpc = NULL |
Definition at line 29 of file scdtest.cpp.
Referenced by MetisPartitioner::assemble_graph(), ZoltanPartitioner::assemble_graph(), ZoltanPartitioner::balance_mesh(), main(), ZoltanPartitioner::mbFinalizePoints(), ZoltanPartitioner::mbGlobalSuccess(), ZoltanPartitioner::mbInitializePoints(), ZoltanPartitioner::mbPrintGlobalResult(), ZoltanPartitioner::mbShowError(), ZoltanPartitioner::partition_inferred_mesh(), MetisPartitioner::partition_mesh(), ZoltanPartitioner::partition_mesh_and_geometry(), ZoltanPartitioner::partition_owned_cells(), PartitionerBase< T >::PartitionerBase(), ZoltanPartitioner::repartition(), resolve_and_exchange(), ZoltanPartitioner::SetHSFC_Parameters(), ZoltanPartitioner::SetHypergraph_Parameters(), ZoltanPartitioner::SetOCTPART_Parameters(), ZoltanPartitioner::SetPARMETIS_Parameters(), ZoltanPartitioner::SetRCB_Parameters(), ZoltanPartitioner::SetRIB_Parameters(), and PartitionerBase< T >::~PartitionerBase().
| const int NI = 2 |
Definition at line 17 of file scdtest.cpp.
Referenced by create_hexes_and_verts(), main(), and set_local_domain_bounds().
| const int NJ = 2 |
Definition at line 18 of file scdtest.cpp.
Referenced by create_hexes_and_verts(), main(), and set_local_domain_bounds().
| const int NK = 1 |
Definition at line 19 of file scdtest.cpp.
Referenced by set_local_domain_bounds().
| int rank |
Definition at line 36 of file scdtest.cpp.
| int size |
Definition at line 37 of file scdtest.cpp.