MOAB: Mesh Oriented datABase  (version 5.4.1)
pcomm_serial.cpp File Reference
#include "moab/ParallelComm.hpp"
#include "MBParallelConventions.h"
#include "MBTagConventions.hpp"
#include "moab/Core.hpp"
#include "moab/FileOptions.hpp"
#include "ReadParallel.hpp"
#include "TestUtil.hpp"
#include <vector>
+ Include dependency graph for pcomm_serial.cpp:

Go to the source code of this file.

Defines

#define MPI_COMM_WORLD   0

Functions

void print_usage (char *argv)
int main (int argc, char *argv[])

Define Documentation

#define MPI_COMM_WORLD   0
Examples:
ComputeTriDual.cpp, CrystalRouterExample.cpp, DeformMeshRemap.cpp, ErrorHandlingSimulation.cpp, GenLargeMesh.cpp, HelloParMOAB.cpp, LaplacianSmoother.cpp, LloydRelaxation.cpp, ReadWriteTest.cpp, ReduceExchangeTags.cpp, and StructuredMeshSimple.cpp.

Referenced by add_field_value(), adj_perf(), ahf_test(), moab::IODebugTrack::all_reduce(), PartMap::build_map(), check_consistent_ids(), closedsurface_uref_hirec_convergence_study(), commgraphtest(), compute_dual_mesh(), moab::ScdInterface::construct_box(), create_group_and_comm(), create_joint_comm_group(), create_mesh_in_memory(), create_parallel_mesh(), moab::Coupler::do_normalization(), do_rank_subst(), generate_mesh(), GenerateTestMatrixAndVectors(), moab::Coupler::get_matching_entities(), get_max_volume(), get_num_adj_all(), get_read_options(), handle_error_code(), iMeshP_loadAll(), iMOAB_Initialize(), interface_verts(), moab::IODebugTrack::IODebugTrack(), is_any_proc_error(), moab::ReadDamsel::load_file(), moab::ReadParallel::load_file(), load_meshset_hirec(), main(), moab::MBError(), MPI_swap(), moab::WriteHDF5Parallel::parallel_create_file(), parallel_create_mesh(), moab::ReadNC::parse_options(), moab::WriteNC::parse_options(), PartMap::part_from_coords(), PartitionerBase< T >::PartitionerBase(), perf_inmesh(), print_output(), print_partitioned_entities(), read_buffered_map(), read_file(), read_map_from_disk(), moab::ReadParallel::ReadParallel(), moab::RefinerTagManager::RefinerTagManager(), report_iface_ents(), report_nsets(), report_sets(), run_test(), runner_run_tests(), save_and_load_on_root(), moab::ReadHDF5::set_up_read(), test_assign_global_ids(), test_closedsurface_mesh(), test_correct_ghost(), test_entity_copies(), test_entity_copy_parts(), test_entity_owner(), test_entity_status(), test_eul_check_across_files(), test_eul_check_append(), test_eul_check_T(), test_eul_check_timestep(), test_eul_read_write_across_files(), test_eul_read_write_append(), test_eul_read_write_T(), test_eul_read_write_timestep(), test_exchange_ents(), test_fv_check_T(), test_fv_read_write_T(), test_gcrm_check_vars(), test_gcrm_read_write_vars(), test_get_neighbors(), test_get_part_boundary(), test_get_partitions(), test_get_parts(), test_ghosted_entity_shared_data(), test_homme_check_T(), test_homme_read_write_T(), test_interface_owners_common(), test_mesh(), test_mpas_check_vars(), test_mpas_read_write_vars(), test_packing(), test_part_boundary_iter(), test_part_id_handle(), test_part_rank(), test_push_tag_data_common(), test_read_and_ghost_after(), test_read_bc_sets(), test_read_elements_common(), test_read_global_tags(), test_read_non_adjs_side(), test_read_sets_common(), test_read_tags(), test_read_time(), test_read_with_ghost(), test_read_with_ghost_no_augment(), test_read_with_thin_ghost_layer(), test_reduce_tag_explicit_dest(), test_reduce_tag_failures(), test_reduce_tags(), test_shared_sets(), test_string_rank_subst(), test_tempest_map_bcast(), test_tempest_to_moab_convert(), test_trivial_partition(), test_var_length_parallel(), test_write_dense_tags(), test_write_different_element_types(), test_write_different_tags(), test_write_elements(), test_write_shared_sets(), test_write_unbalanced(), TestMeshRefiner(), tprint(), moab::Intx2MeshOnSphere::update_tracer_data(), moab::ErrorOutput::use_world_rank(), moab::DebugOutput::use_world_rank(), and moab::WriteDamsel::write_file().


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 17 of file pcomm_serial.cpp.

References CHECK_ERR, ErrorCode, moab::ParallelComm::exchange_ghost_cells(), filename, moab::ReadParallel::load_file(), MPI_COMM_WORLD, moab::ReadParallel::PA_DELETE_NONLOCAL, moab::ReadParallel::PA_GET_FILESET_ENTS, moab::ReadParallel::PA_READ, moab::ReadParallel::POPT_READ_DELETE, print_usage(), and moab::ParallelComm::resolve_shared_ents().

{
#ifdef MOAB_HAVE_MPI
    MPI_Init( &argc, &argv );
#else
#define MPI_COMM_WORLD 0
#endif

    if( 1 < argc && !strcmp( argv[1], "-h" ) )
    {
        print_usage( argv[0] );
        return 0;
    }

    int nprocs = 2;
    std::string ptag_name( "GEOM_DIMENSION" );
    std::vector< int > partition_tag_vals;
    std::string filename = TestDir + "unittest/ptest.cub";
    if( argc > 1 ) nprocs = atoi( argv[1] );
    if( argc > 2 ) filename = std::string( argv[2] );
    if( argc > 3 )
    {
        ptag_name = argv[3];
        if( argc > 4 ) partition_tag_vals.push_back( atoi( argv[4] ) );
    }
    else
        partition_tag_vals.push_back( 3 );

    if( 0 == nprocs )
    {
        print_usage( argv[0] );
        return 1;
    }

    ErrorCode rval;
    Core* moab = new Core[nprocs]();
    std::vector< ParallelComm* > pc( nprocs );
    for( int i = 0; i < nprocs; i++ )
    {
        pc[i] = new ParallelComm( &moab[i], MPI_COMM_WORLD );
        pc[i]->set_rank( i );
        pc[i]->set_size( nprocs );
    }

    std::vector< int > pa_vec;
    pa_vec.push_back( ReadParallel::PA_READ );
    pa_vec.push_back( ReadParallel::PA_GET_FILESET_ENTS );
    pa_vec.push_back( ReadParallel::PA_DELETE_NONLOCAL );
    bool partition_distrib = true;

    FileOptions fopts( NULL );

    const char* fnames = filename.c_str();
    for( int i = 0; i < nprocs; i++ )
    {
        ReadParallel rp( moab + i, pc[i] );
        rval = rp.load_file( &fnames, 1, 0, ReadParallel::POPT_READ_DELETE, ptag_name, partition_tag_vals,
                             partition_distrib, false, pa_vec, fopts, NULL, NULL, i, false, -1, -1, -1, -1, 0, 0 );CHECK_ERR( rval );
    }

    rval = ParallelComm::resolve_shared_ents( &pc[0], nprocs, 0, 3 );CHECK_ERR( rval );

    // exchange interface cells
    rval = ParallelComm::exchange_ghost_cells( &pc[0], nprocs, -1, -1, 0, 0, true );CHECK_ERR( rval );

    // now 1 layer of hex ghosts
    rval = ParallelComm::exchange_ghost_cells( &pc[0], nprocs, 3, 2, 1, 0, true );CHECK_ERR( rval );

    // now 1 layer of hex ghosts with face/edges
    rval = ParallelComm::exchange_ghost_cells( &pc[0], nprocs, 3, 2, 1, 3, true );CHECK_ERR( rval );

    for( int i = 0; i < nprocs; i++ )
        delete pc[i];

    delete[] moab;

#ifdef MOAB_HAVE_MPI
    MPI_Finalize();
#endif

    return 0;
}
void print_usage ( char *  argv)

Definition at line 12 of file pcomm_serial.cpp.

{
    std::cout << "Usage: " << argv << " nprocs filename" << std::endl;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines