|
MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include "TestUtil.hpp"#include "moab/Core.hpp"#include "moab/ParallelComm.hpp"#include "moab/ProgOptions.hpp"#include "MBParallelConventions.h"#include "moab/ReadUtilIface.hpp"
Include dependency graph for ucdtrvpart.cpp:Go to the source code of this file.
Functions | |
| void | test_read_parallel_ucd_trivial () |
| void | test_read_parallel_ucd_trivial_spectral () |
| void | test_read_parallel (int num_verts, bool test_nb_nodes) |
| void | test_multiple_loads_of_same_file () |
| int | main (int argc, char *argv[]) |
Variables | |
| std::string | example = "unittest/io/homme3x3458.t.3.nc" |
| std::string | partition_method |
| const int | levels = 3 |
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 21 of file ucdtrvpart.cpp.
References RUN_TEST, test_multiple_loads_of_same_file(), test_read_parallel_ucd_trivial(), and test_read_parallel_ucd_trivial_spectral().
{
MPI_Init( &argc, &argv );
int result = 0;
result += RUN_TEST( test_read_parallel_ucd_trivial );
result += RUN_TEST( test_read_parallel_ucd_trivial_spectral );
result += RUN_TEST( test_multiple_loads_of_same_file );
MPI_Finalize();
return result;
}
| void test_multiple_loads_of_same_file | ( | ) |
| void test_read_parallel | ( | int | num_verts, |
| bool | test_nb_nodes | ||
| ) |
Definition at line 46 of file ucdtrvpart.cpp.
References moab::ParallelComm::check_all_shared_handles(), CHECK_EQUAL, CHECK_ERR, moab::Interface::create_meshset(), ErrorCode, example, moab::ParallelComm::filter_pstatus(), moab::Interface::get_entities_by_handle(), moab::Interface::get_entities_by_type(), moab::ReadUtilIface::get_gather_set(), moab::ParallelComm::get_pcomm(), moab::Interface::load_file(), mb, MBVERTEX, MESHSET_SET, partition_method, moab::ProcConfig::proc_comm(), moab::ParallelComm::proc_config(), moab::ProcConfig::proc_rank(), moab::ProcConfig::proc_size(), PSTATUS_NOT, PSTATUS_NOT_OWNED, moab::Interface::query_interface(), rank, moab::Range::size(), moab::subtract(), and moab::Interface::write_file().
{
Core moab;
Interface& mb = moab;
EntityHandle file_set;
ErrorCode rval;
rval = mb.create_meshset( MESHSET_SET, file_set );CHECK_ERR( rval );
std::string opt = std::string( "PARALLEL=READ_PART" ) + partition_method;
// Create gather set in processor 0
opt += std::string( ";GATHER_SET=0" );
rval = mb.load_file( example.c_str(), &file_set, opt.c_str() );CHECK_ERR( rval );
ParallelComm* pcomm = ParallelComm::get_pcomm( &mb, 0 );
int procs = pcomm->proc_config().proc_size();
int rank = pcomm->proc_config().proc_rank();
rval = pcomm->check_all_shared_handles();CHECK_ERR( rval );
// Get the total # owned verts
Range verts;
rval = mb.get_entities_by_type( 0, MBVERTEX, verts );CHECK_ERR( rval );
int my_num = verts.size();
if( test_nb_nodes && 2 == procs )
{
if( 0 == rank )
CHECK_EQUAL( 5283, my_num ); // Gather set vertices included
else if( 1 == rank )
CHECK_EQUAL( 1825, my_num ); // Not owned vertices included
}
rval = pcomm->filter_pstatus( verts, PSTATUS_NOT_OWNED, PSTATUS_NOT );CHECK_ERR( rval );
my_num = verts.size();
if( test_nb_nodes && 2 == procs )
{
if( 0 == rank )
CHECK_EQUAL( 5283, my_num ); // Gather set vertices included
else if( 1 == rank )
CHECK_EQUAL( 1633, my_num ); // Not owned vertices excluded
}
if( 0 == rank )
{
// Get gather set
EntityHandle gather_set;
ReadUtilIface* readUtilIface;
rval = mb.query_interface( readUtilIface );CHECK_ERR( rval );
rval = readUtilIface->get_gather_set( gather_set );CHECK_ERR( rval );
// Get gather set entities
Range gather_ents;
rval = mb.get_entities_by_handle( gather_set, gather_ents );CHECK_ERR( rval );
// Remove gather set vertices in processor 0
verts = subtract( verts, gather_ents );
}
my_num = verts.size();
if( test_nb_nodes && 2 == procs )
{
if( 0 == rank )
CHECK_EQUAL( 1825, my_num ); // Gather set vertices excluded
else if( 1 == rank )
CHECK_EQUAL( 1633, my_num ); // Not owned vertices excluded
}
std::cout << "proc: " << rank << " verts:" << my_num << "\n";
int total_verts;
MPI_Reduce( &my_num, &total_verts, 1, MPI_INT, MPI_SUM, 0, pcomm->proc_config().proc_comm() );
if( 0 == rank )
{
std::cout << "total vertices: " << total_verts << "\n";
if( test_nb_nodes ) CHECK_EQUAL( total_verts, num_verts );
}
#ifdef MOAB_HAVE_HDF5_PARALLEL
std::string write_options( "PARALLEL=WRITE_PART;" );
mb.write_file( "test.h5m", NULL, write_options.c_str() );
#endif
}
| void test_read_parallel_ucd_trivial | ( | ) |
Definition at line 34 of file ucdtrvpart.cpp.
References partition_method, and test_read_parallel().
Referenced by main().
{
partition_method = std::string( ";PARTITION_METHOD=TRIVIAL;PARALLEL_RESOLVE_SHARED_ENTS" );
test_read_parallel( 3458, true );
}
Definition at line 40 of file ucdtrvpart.cpp.
References partition_method, and test_read_parallel().
Referenced by main().
{
partition_method = std::string( ";PARTITION_METHOD=TRIVIAL;SPECTRAL_MESH;PARALLEL_RESOLVE_SHARED_ENTS" );
test_read_parallel( 3458, false );
}
| std::string example = "unittest/io/homme3x3458.t.3.nc" |
Definition at line 10 of file ucdtrvpart.cpp.
| const int levels = 3 |
Definition at line 19 of file ucdtrvpart.cpp.
| std::string partition_method |
Definition at line 18 of file ucdtrvpart.cpp.