MOAB: Mesh Oriented datABase  (version 5.4.1)
mgen_test.cpp
Go to the documentation of this file.
00001 #include "moab/Core.hpp"
00002 #include "moab/MeshGeneration.hpp"
00003 #include "TestUtil.hpp"
00004 #include "moab/ProgOptions.hpp"
00005 
00006 #ifdef MOAB_HAVE_MPI
00007 #include "moab_mpi.h"
00008 #include "moab/ParallelComm.hpp"
00009 #include "MBParallelConventions.h"
00010 #endif
00011 
00012 using namespace moab;
00013 using std::string;
00014 
00015 int main( int argc, char* argv[] )
00016 {
00017 #ifdef MOAB_HAVE_MPI
00018     MPI_Init( &argc, &argv );
00019 #endif
00020     Core mcore;
00021     Interface* mb = &mcore;
00022     EntityHandle fileset;
00023     MeshGeneration::BrickOpts opts;
00024     // default options
00025     opts.A = opts.B = opts.C = 2;
00026     opts.M = opts.N = opts.K = 1;
00027     opts.blockSize           = 4;
00028     opts.xsize = opts.ysize = opts.zsize = 1.;
00029     opts.ui                              = CartVect( 1., 0, 0. );
00030     opts.uj                              = CartVect( 0., 1., 0. );
00031     opts.uk                              = CartVect( 0., 0., 1. );
00032     opts.newMergeMethod = opts.quadratic = opts.keep_skins = opts.tetra = false;
00033     opts.adjEnts = opts.parmerge = false;
00034     opts.GL                      = 0;
00035 
00036     ProgOptions popts;
00037 
00038     popts.addOpt< int >( string( "blockSize,b" ), string( "Block size of mesh (default=4)" ), &opts.blockSize );
00039     popts.addOpt< int >( string( "xproc,M" ), string( "Number of processors in x dir (default=1)" ), &opts.M );
00040     popts.addOpt< int >( string( "yproc,N" ), string( "Number of processors in y dir (default=1)" ), &opts.N );
00041     popts.addOpt< int >( string( "zproc,K" ), string( "Number of processors in z dir (default=1)" ), &opts.K );
00042 
00043     popts.addOpt< int >( string( "xblocks,A" ), string( "Number of blocks on a task in x dir (default=2)" ), &opts.A );
00044     popts.addOpt< int >( string( "yblocks,B" ), string( "Number of blocks on a task in y dir (default=2)" ), &opts.B );
00045     popts.addOpt< int >( string( "zblocks,C" ), string( "Number of blocks on a task in x dir (default=2)" ), &opts.C );
00046 
00047     popts.addOpt< double >( string( "xsize,x" ), string( "Total size in x direction (default=1.)" ), &opts.xsize );
00048     popts.addOpt< double >( string( "ysize,y" ), string( "Total size in y direction (default=1.)" ), &opts.ysize );
00049     popts.addOpt< double >( string( "zsize,z" ), string( "Total size in z direction (default=1.)" ), &opts.zsize );
00050 
00051     popts.addOpt< void >( "newMerge,w", "use new merging method", &opts.newMergeMethod );
00052 
00053     popts.addOpt< void >( "quadratic,q", "use hex 27 elements", &opts.quadratic );
00054 
00055     popts.addOpt< void >( "keep_skins,k", "keep skins with shared entities", &opts.keep_skins );
00056 
00057     popts.addOpt< void >( "tetrahedrons,t", "generate tetrahedrons", &opts.tetra );
00058 
00059     popts.addOpt< void >( "faces_edges,f", "create all faces and edges", &opts.adjEnts );
00060 
00061     popts.addOpt< int >( string( "ghost_layers,g" ), string( "Number of ghost layers (default=0)" ), &opts.GL );
00062 
00063     popts.addOpt< void >( "parallel_merge,p", "use parallel mesh merge, not vertex ID based merge", &opts.parmerge );
00064 
00065     popts.parseCommandLine( argc, argv );
00066 
00067     ErrorCode rval = mb->create_meshset( MESHSET_SET, fileset );MB_CHK_ERR( rval );
00068 
00069 #ifdef MOAB_HAVE_MPI
00070     ParallelComm* pc     = new ParallelComm( mb, MPI_COMM_WORLD );
00071     MeshGeneration* mgen = new MeshGeneration( mb, pc, fileset );
00072 #else
00073     MeshGeneration* mgen = new MeshGeneration( mb, fileset );
00074 #endif
00075 
00076     rval = mgen->BrickInstance( opts );MB_CHK_ERR( rval );
00077 
00078     return 0;
00079 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines