6 #if defined( __MINGW32__ )
49 void compute_linear_coords(
const int nvpe,
double* elemcoords,
double* naturals,
double* linearcoords );
53 std::cout <<
"usage: mpirun -np <number of processors> ./hireconst_test_parallel <mesh file> "
54 "-degree <degree> -interp <0=least square, 1=interpolation> -dim <mesh dimension>"
58 int main(
int argc,
char* argv[] )
61 MPI_Init( &argc, &argv );
66 int degree = 3,
dim = 2;
71 std::string infile = TestDir +
"unittest/mbcslam/fine4.h5m";
73 std::string infile = TestDir +
"unittest/sphere_quads_20.vtk";
79 std::cout <<
"Using default arguments: ./hireconst_test_parallel " << infile <<
" -degree 3 -interp 0 -dim 2"
87 for(
int i = 2; i < argc; ++i )
91 if( std::string( argv[i] ) ==
"-degree" )
93 degree = atoi( argv[++i] );
95 else if( std::string( argv[i] ) ==
"-interp" )
97 interp = atoi( argv[++i] );
99 else if( std::string( argv[i] ) ==
"-dim" )
101 dim = atoi( argv[++i] );
128 std::cout <<
"Dimension of input mesh should be provided, positive and less than 3" << std::endl;
132 std::cout <<
"Dimension of input mesh should be provided, positive and less than 3" << std::endl;
137 if( degree <= 0 || dim > 2 ||
dim <= 0 )
143 std::cout <<
"Input degree should be positive number;\n";
144 std::cout <<
"Input dimesion should be positive and less than 3;" << std::endl;
148 std::cout <<
"Input degree should be positive number;\n";
149 std::cout <<
"Input dimesion should be positive and less than 3;" << std::endl;
158 std::cout <<
"Testing on " << infile <<
" with dimension " <<
dim <<
"\n";
159 std::string opts = interp ?
"interpolation" :
"least square fitting";
160 std::cout <<
"High order reconstruction with degree " << degree <<
" " << opts << std::endl;
164 std::cout <<
"Testing on " << infile <<
" with dimension " <<
dim <<
"\n";
165 std::string opts = interp ?
"interpolation" :
"least square fitting";
166 std::cout <<
"High order reconstruction with degree " << degree <<
" " << opts << std::endl;
189 MPI_Comm_size( comm, &nprocs );
190 MPI_Comm_rank( comm, &
rank );
202 std::string part_method =
"PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION;";
203 #ifndef MOAB_HAVE_HDF5
204 part_method =
"PARALLEL=BCAST_DELETE;PARTITION=TRIVIAL;";
212 read_options = part_method +
";PARALLEL_RESOLVE_SHARED_ENTS;PARALLEL_GHOSTS=2.0.";
216 read_options = part_method +
";PARALLEL_RESOLVE_SHARED_ENTS;PARALLEL_GHOSTS=1.0.";
220 MB_SET_ERR( MB_FAILURE,
"unsupported dimension" );
227 read_options = part_method +
";PARALLEL_RESOLVE_SHARED_ENTS;";
238 assert( !pc && degree &&
dim );
253 MPI_Comm_size( comm, &nprocs );
254 MPI_Comm_rank( comm, &
rank );
262 Range elems, elems_owned;
264 int nelems = elems.
size();
280 std::cout <<
"Mesh has " << nelems <<
" elements on Processor " <<
rank <<
" in total;";
281 std::cout << elems_owned.
size() <<
" of which are locally owned elements" << std::endl;
283 std::cout <<
"Mesh has " << nelems <<
" elements" << std::endl;
297 std::cout <<
"HiRec has been done on Processor " <<
rank << std::endl;
299 std::cout <<
"HiRec has been done " << std::endl;
309 double w = 1.0 / (double)nvpe;
310 std::vector< double > naturalcoords2fit( nvpe, w );
314 if( MB_FAILURE ==
error )
319 std::vector< double > coords( 3 * nvpe );
322 CartVect nlcoords = newcoords - linearcoords;
323 mxdist = std::max( mxdist, nlcoords.
length() );
331 std::cout <<
"Maximum projection lift is " << mxdist <<
" on Processor " <<
rank << std::endl;
333 std::cout <<
"Maximum projection lift is " << mxdist << std::endl;
340 assert( elemcoords && linearcoords );
342 for(
int i = 0; i < 3; ++i )
346 for(
int j = 0; j < nvpe; ++j )
348 linearcoords[i] += naturals[j] * elemcoords[3 * j + i];