14 #if !defined( _MSC_VER ) && !defined( __MINGW32__ )
16 #include <sys/ioctl.h>
31 static void print_usage(
const char* name, std::ostream& stream )
33 stream <<
"Usage: " << name <<
" <input_file> [<output_file>]" << std::endl;
36 int main(
int argc,
char* argv[] )
38 int proc_id = 0,
size = 1;
40 MPI_Init( &argc, &argv );
41 MPI_Comm_rank( MPI_COMM_WORLD, &proc_id );
42 MPI_Comm_size( MPI_COMM_WORLD, &
size );
44 if( argc < 2 && 0 == proc_id )
53 std::string read_options;
54 if(
size > 1 ) read_options =
"PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION;PARALLEL_RESOLVE_SHARED_ENTS";
56 if(
size > 1 && argc > 2 )
58 std::cerr <<
" cannot use verbose option in parallel \n";
70 std::cout <<
" write verbose output to a CSV file " << argv[2] <<
"\n";
76 fprintf( stderr,
"Error reading file: %s\n", argv[1] );
89 fprintf( stderr,
"Error getting entities from file %s\n", argv[1] );
96 Range allfaces, alledges;
101 fprintf( stderr,
"Error getting all faces" );
111 fprintf( stderr,
"Error getting all edges" );
122 if( !num_qualities )
continue;
124 std::map< QualityType, double > qualities, minq, maxq;
125 int ne_local = (int)owned.
size();
126 int ne_global = ne_local;
134 Range current = owned;
142 ne_local = (int)owned.
size();
143 mpi_err = MPI_Reduce( &ne_local, &ne_global, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD );
159 fprintf( stderr,
"Error getting quality for entity type %d with id %ld \n", et,
166 if( ofile.is_open() )
170 ofile <<
" There are " << ne_local <<
" entities of type " << vw.
entity_type_name( et ) <<
" with "
171 << qualities.size() <<
" qualities:\n"
173 for( std::map< QualityType, double >::iterator qit = qualities.begin(); qit != qualities.end();
180 for( std::map< QualityType, double >::iterator qit = qualities.begin(); qit != qualities.end();
183 ofile <<
", " << qit->second;
190 for( ; it != owned.
end(); ++it )
195 fprintf( stderr,
"Error getting quality for entity type %d with id %ld \n", et,
202 if( ofile.is_open() )
205 for( std::map< QualityType, double >::iterator qit = qualities.begin(); qit != qualities.end();
208 ofile <<
", " << qit->second;
212 std::map< QualityType, double >::iterator minit = minq.begin();
213 std::map< QualityType, double >::iterator maxit = maxq.begin();
214 for( std::map< QualityType, double >::iterator mit = qualities.begin(); mit != qualities.end();
215 ++mit, ++minit, ++maxit )
217 if( mit->second > maxit->second ) maxit->second = mit->second;
218 if( mit->second < minit->second ) minit->second = mit->second;
224 std::cout <<
" \n\n " << ne_global <<
" entities of type " << vw.
entity_type_name( et ) <<
"\n";
225 std::cout << std::setw( 30 ) <<
"Quality Name" << std::setw( 15 ) <<
" MIN" << std::setw( 15 )
231 for(
int i = 0; i < num_qualities; i++, quality_type = (
QualityType)( quality_type + 1 ) )
236 double local_min, global_min;
237 double local_max, global_max;
240 local_min = minq[quality_type];
241 local_max = maxq[quality_type];
249 mpi_err = MPI_Reduce( &local_min, &global_min, 1, MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD );
255 mpi_err = MPI_Reduce( &local_max, &global_max, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD );
262 global_min = local_min;
263 global_max = local_max;
267 std::cout << std::setw( 30 ) << name_q << std::setw( 15 ) << global_min << std::setw( 15 )
268 << global_max <<
"\n";
273 if( ofile.is_open() )