MOAB: Mesh Oriented datABase  (version 5.2.1)
ghost_thin_layers.cpp File Reference
#include "moab/ParallelComm.hpp"
#include "moab/Core.hpp"
#include "moab_mpi.h"
#include "TestUtil.hpp"
#include "MBTagConventions.hpp"
#include <iostream>
#include <sstream>
+ Include dependency graph for ghost_thin_layers.cpp:

Go to the source code of this file.

Functions

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

Variables

std::string filename = "/io/ln4.h5m"

Function Documentation

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

Definition at line 73 of file ghost_thin_layers.cpp.

References filename, MPI_COMM_WORLD, rank, RUN_TEST, test_correct_ghost(), and test_read_with_thin_ghost_layer().

{
    MPI_Init( &argc, &argv );
    int nproc, rank;
    MPI_Comm_size( MPI_COMM_WORLD, &nproc );
    MPI_Comm_rank( MPI_COMM_WORLD, &rank );
    if( nproc <= 3 )
    {
        std::cout << " launch it on at least 4 processes. \n";
        MPI_Finalize();
        return 0;
    }

    int result = 0;
    if( argc >= 2 ) filename = argv[1];  // to be able to test other files too

    result += RUN_TEST( test_read_with_thin_ghost_layer );
    result += RUN_TEST( test_correct_ghost );

    MPI_Finalize();
    return 0;
}

Definition at line 14 of file ghost_thin_layers.cpp.

References CHECK_ERR, moab::ParallelComm::correct_thin_ghost_layers(), moab::ParallelComm::exchange_ghost_cells(), filename, mb, MB_SUCCESS, MPI_COMM_WORLD, outfile, and rank.

Referenced by main().

{
    int nproc, rank;
    MPI_Comm_size( MPI_COMM_WORLD, &nproc );
    MPI_Comm_rank( MPI_COMM_WORLD, &rank );
    // Get MOAB instance
    Interface* mb = new( std::nothrow ) Core;

    ErrorCode rval = MB_SUCCESS;

    // Get the ParallelComm instance
    ParallelComm* pcomm = new ParallelComm( mb, MPI_COMM_WORLD );

    char read_opts[] = "PARALLEL=READ_PART;PARALLEL_RESOLVE_SHARED_ENTS;PARTITION=PARALLEL_"
                       "PARTITION;PARALLEL_GHOSTS=2.0.1";
    rval = mb->load_file( filename.c_str(), 0, read_opts );CHECK_ERR( rval );

    if( nproc >= 3 )
    {
        rval = pcomm->correct_thin_ghost_layers();CHECK_ERR( rval );
    }

    rval = pcomm->exchange_ghost_cells( 2, 0, 2, 0, true );CHECK_ERR( rval );  // true to store remote handles

    // write in serial the database , on each rank
    std::ostringstream outfile;
    outfile << "testReadThin_n" << nproc << "." << rank << ".h5m";

    rval = mb->write_file( outfile.str().c_str() );  // everything on local root
    CHECK_ERR( rval );
    delete mb;
}

Definition at line 47 of file ghost_thin_layers.cpp.

References CHECK_ERR, moab::ParallelComm::exchange_ghost_cells(), filename, moab::Core::load_file(), mb, MB_SUCCESS, MPI_COMM_WORLD, outfile, rank, and moab::Core::write_file().

Referenced by main().

{
    int nproc, rank;
    MPI_Comm_size( MPI_COMM_WORLD, &nproc );
    MPI_Comm_rank( MPI_COMM_WORLD, &rank );
    moab::Core* mb = new moab::Core();

    ErrorCode rval = MB_SUCCESS;
    // Get the ParallelComm instance
    ParallelComm* pcomm = new ParallelComm( mb, MPI_COMM_WORLD );

    char read_opts[] = "PARALLEL=READ_PART;PARALLEL_RESOLVE_SHARED_ENTS;PARTITION=PARALLEL_"
                       "PARTITION;PARALLEL_GHOSTS=2.0.1;PARALLEL_THIN_GHOST_LAYER;";
    rval = mb->load_file( filename.c_str(), 0, read_opts );CHECK_ERR( rval );

    rval = pcomm->exchange_ghost_cells( 2, 0, 2, 0, true );CHECK_ERR( rval );  // true to store remote handles

    // write in serial the database , on each rank
    std::ostringstream outfile;
    outfile << "testReadGhost_n" << nproc << "." << rank << ".h5m";

    rval = mb->write_file( outfile.str().c_str() );  // everything on local root
    CHECK_ERR( rval );
    delete mb;
}

Variable Documentation

std::string filename = "/io/ln4.h5m"

Definition at line 10 of file ghost_thin_layers.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines