MOAB: Mesh Oriented datABase  (version 5.2.1)
hireconst_test_parallel.cpp File Reference
#include <iostream>
#include <string>
#include <sstream>
#include <sys/time.h>
#include <vector>
#include <algorithm>
#include "moab/Core.hpp"
#include "moab/Range.hpp"
#include "moab/CartVect.hpp"
#include "moab/MeshTopoUtil.hpp"
#include "moab/NestedRefine.hpp"
#include "moab/DiscreteGeometry/HiReconstruction.hpp"
#include "TestUtil.hpp"
#include <math.h>
+ Include dependency graph for hireconst_test_parallel.cpp:

Go to the source code of this file.

Functions

ErrorCode load_meshset_hirec (const char *infile, Interface *mbimpl, EntityHandle &meshset, ParallelComm *&pc, const int degree=0, const int dim=2)
ErrorCode test_mesh (const char *infile, const int degree, const bool interp, const int dim)
void compute_linear_coords (const int nvpe, double *elemcoords, double *naturals, double *linearcoords)
void usage ()
int main (int argc, char *argv[])

Function Documentation

void compute_linear_coords ( const int  nvpe,
double *  elemcoords,
double *  naturals,
double *  linearcoords 
)
ErrorCode load_meshset_hirec ( const char *  infile,
Interface *  mbimpl,
EntityHandle meshset,
ParallelComm *&  pc,
const int  degree = 0,
const int  dim = 2 
)
int main ( int  argc,
char *  argv[] 
)

Definition at line 49 of file hireconst_test_parallel.cpp.

References dim, moab::error(), MB_CHK_ERR, MPI_COMM_WORLD, rank, test_mesh(), and usage.

{
#ifdef MOAB_HAVE_MPI
    MPI_Init( &argc, &argv );
    int nprocs, rank;
    MPI_Comm_size( MPI_COMM_WORLD, &nprocs );
    MPI_Comm_rank( MPI_COMM_WORLD, &rank );
#endif
    int degree = 3, dim = 2;
    bool interp = false;
    ErrorCode error;

#ifdef MOAB_HAVE_HDF5
    std::string infile = TestDir + "/mbcslam/fine4.h5m";
#else
    std::string infile = TestDir + "/sphere_quads_20.vtk";
#endif

    if( argc == 1 )
    {
        usage();
        std::cout << "Using default arguments: ./hireconst_test_parallel " << infile << " -degree 3 -interp 0 -dim 2"
                  << std::endl;
    }
    else
    {
        infile      = argv[1];
        bool hasdim = false;

        for( int i = 2; i < argc; ++i )
        {
            if( i + 1 != argc )
            {
                if( std::string( argv[i] ) == "-degree" ) { degree = atoi( argv[++i] ); }
                else if( std::string( argv[i] ) == "-interp" )
                {
                    interp = atoi( argv[++i] );
                }
                else if( std::string( argv[i] ) == "-dim" )
                {
                    dim    = atoi( argv[++i] );
                    hasdim = true;
                }
                else
                {
#ifdef MOAB_HAVE_MPI

                    if( 0 == rank ) { usage(); }

                    MPI_Finalize();
#else
                    usage();
#endif
                    return 0;
                }
            }
        }

        if( !hasdim )
        {
#ifdef MOAB_HAVE_MPI

            if( 0 == rank )
            { std::cout << "Dimension of input mesh should be provided, positive and less than 3" << std::endl; }

#else
            std::cout << "Dimension of input mesh should be provided, positive and less than 3" << std::endl;
#endif
            return 0;
        }

        if( degree <= 0 || dim > 2 || dim <= 0 )
        {
#ifdef MOAB_HAVE_MPI

            if( 0 == rank )
            {
                std::cout << "Input degree should be positive number;\n";
                std::cout << "Input dimesion should be positive and less than 3;" << std::endl;
            }

#else
            std::cout << "Input degree should be positive number;\n";
            std::cout << "Input dimesion should be positive and less than 3;" << std::endl;
#endif
            return 0;
        }

#ifdef MOAB_HAVE_MPI

        if( 0 == rank )
        {
            std::cout << "Testing on " << infile << " with dimension " << dim << "\n";
            std::string opts = interp ? "interpolation" : "least square fitting";
            std::cout << "High order reconstruction with degree " << degree << " " << opts << std::endl;
        }

#else
        std::cout << "Testing on " << infile << " with dimension " << dim << "\n";
        std::string opts = interp ? "interpolation" : "least square fitting";
        std::cout << "High order reconstruction with degree " << degree << " " << opts << std::endl;
#endif
    }

    error = test_mesh( infile.c_str(), degree, interp, dim );MB_CHK_ERR( error );

#ifdef MOAB_HAVE_MPI
    MPI_Finalize();
#endif
}
ErrorCode test_mesh ( const char *  infile,
const int  degree,
const bool  interp,
const int  dim 
)
void usage ( )

Definition at line 42 of file hireconst_test_parallel.cpp.

{
    std::cout << "usage: mpirun -np <number of processors> ./hireconst_test_parallel <mesh file> "
                 "-degree <degree> -interp <0=least square, 1=interpolation> -dim <mesh dimension>"
              << std::endl;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines