436 # include "rheolef/iofem.h"
446 typename std::enable_if<
450 <std::ostream& (*)(std::ostream&,
const T&)>
458 if (s.
nop())
return s;
469 <<
"geo: usage:" << std::endl
471 <<
"{-|file[.geo[.gz]]}"
475 <<
"[-subdivide int] "
476 <<
"[-if {geo,bamg,vtk}] "
477 <<
"[-geo|-gmsh|-gnuplot|-paraview] "
479 <<
"[-[no]full|-[no]fill|-[no]lattice] "
480 <<
"[-[no]stereo|-[no]full|-[no]cut|-[no]shrink|-[no]showlabel] "
481 <<
"[-image-format string] "
482 <<
"[-resolution int [int]] "
483 <<
"[-add-boundary] "
485 <<
"[-size] [-n-vertex] "
486 <<
"[-hmin] [-hmax] "
487 <<
"[-[min|max]-element-measure] "
488 <<
"[-round [float]] "
489 <<
"[-[no]clean] [-[no]execute] [-[no]verbose] "
495 if (input_format ==
"bamg") in.
is() >>
bamg;
496 else if (input_format ==
"vtk") in.
is() >>
vtk;
497 else if (input_format ==
"geo") in.
is() >>
rheo;
499 std::cerr <<
"geo: invalid input format \""<<input_format<<
"\"" << std::endl;
518 hmin = std::numeric_limits<Float>::max();
520 for (
size_t iedg = 0, nedg = omega.geo_element_ownership(1).size(); iedg < nedg; ++iedg) {
521 const geo_element& E = omega.get_geo_element (1, iedg);
522 const point& x0 = omega.dis_node(E[0]);
523 const point& x1 = omega.dis_node(E[1]);
526 hmax = max(hmax, hloc);
530 #ifdef _RHEOLEF_HAVE_MPI
531 hmin = mpi::all_reduce (comm(),
hmin, mpi::minimum<Float>());
532 hmax = mpi::all_reduce (comm(), hmax, mpi::maximum<Float>());
543 return is_min ? (
m*one).min_abs() : (
m*one).
max_abs();
545 int main(
int argc,
char**argv) {
547 check_macro (communicator().size() == 1,
"geo: command may be used as mono-process only");
551 bool do_upgrade = false ;
552 bool do_check = false ;
553 bool do_add_bdry = false ;
554 bool do_stereo = false ;
555 bool show_n_element = false ;
556 bool show_n_vertex = false ;
557 bool show_sys_coord = false ;
558 bool show_hmin = false ;
559 bool show_hmax = false ;
560 bool show_xmin = false ;
561 bool show_xmax = false ;
562 bool show_min_element_measure = false ;
563 bool show_max_element_measure = false ;
564 bool do_round = false ;
565 Float round_prec =
pow(10., -std::numeric_limits<Float>::digits10/2);
566 std::string
name =
"output";
575 dout.
os() << setnormal(
point(-0.015940197423022637, -0.9771157601293953, -0.21211011624358989));
576 dout.
os() << setorigin(
point(std::numeric_limits<Float>::max()));
577 std::string filename;
578 std::string input_format =
"geo";
583 for (
int i = 1; i < argc; i++) {
586 if (strcmp (argv[i],
"-clean") == 0)
dout.
os() <<
clean;
587 else if (strcmp (argv[i],
"-noclean") == 0)
dout.
os() << noclean;
588 else if (strcmp (argv[i],
"-execute") == 0)
dout.
os() << execute;
589 else if (strcmp (argv[i],
"-noexecute") == 0)
dout.
os() << noexecute;
590 else if (strcmp (argv[i],
"-verbose") == 0) { bverbose =
true;
dout.
os() <<
verbose; }
591 else if (strcmp (argv[i],
"-noverbose") == 0) { bverbose =
false;
dout.
os() << noverbose; }
592 else if (strcmp (argv[i],
"-add-boundary") == 0) { do_add_bdry =
true; }
593 else if (strcmp (argv[i],
"-rz") == 0) {
sys_coord =
"rz"; }
594 else if (strcmp (argv[i],
"-zr") == 0) {
sys_coord =
"zr"; }
595 else if (strcmp (argv[i],
"-size") == 0) { show_n_element =
true; }
596 else if (strcmp (argv[i],
"-n-element") == 0) { show_n_element =
true; }
597 else if (strcmp (argv[i],
"-n-vertex") == 0) { show_n_vertex =
true; }
598 else if (strcmp (argv[i],
"-sys-coord") == 0) { show_sys_coord =
true; }
599 else if (strcmp (argv[i],
"-hmin") == 0) { show_hmin =
true; }
600 else if (strcmp (argv[i],
"-hmax") == 0) { show_hmax =
true; }
601 else if (strcmp (argv[i],
"-xmin") == 0) { show_xmin =
true; }
602 else if (strcmp (argv[i],
"-xmax") == 0) { show_xmax =
true; }
603 else if (strcmp (argv[i],
"-min-element-measure") == 0) { show_min_element_measure =
true; }
604 else if (strcmp (argv[i],
"-max-element-measure") == 0) { show_max_element_measure =
true; }
605 else if (strcmp (argv[i],
"-I") == 0) {
606 if (i == argc-1) { std::cerr <<
"geo -I: option argument missing" << std::endl;
usage(); }
619 else if (strcmp (argv[i],
"-full") == 0) {
dout.
os() << full; }
620 else if (strcmp (argv[i],
"-nofull") == 0) {
dout.
os() << nofull; }
621 else if (strcmp (argv[i],
"-fill") == 0) {
dout.
os() << fill; }
622 else if (strcmp (argv[i],
"-nofill") == 0) {
dout.
os() << nofill; }
623 else if (strcmp (argv[i],
"-stereo") == 0) {
dout.
os() << stereo; do_stereo =
true; }
624 else if (strcmp (argv[i],
"-nostereo") == 0) {
dout.
os() << nostereo; }
625 else if (strcmp (argv[i],
"-cut") == 0) {
dout.
os() << cut; }
626 else if (strcmp (argv[i],
"-nocut") == 0) {
dout.
os() << nocut; }
627 else if (strcmp (argv[i],
"-shrink") == 0) {
dout.
os() << shrink; }
628 else if (strcmp (argv[i],
"-noshrink") == 0) {
dout.
os() << noshrink; }
629 else if (strcmp (argv[i],
"-lattice") == 0) {
dout.
os() << lattice; }
630 else if (strcmp (argv[i],
"-nolattice") == 0) {
dout.
os() << nolattice; }
631 else if (strcmp (argv[i],
"-showlabel") == 0) {
dout.
os() << showlabel; }
632 else if (strcmp (argv[i],
"-noshowlabel") == 0){
dout.
os() << noshowlabel; }
633 else if (strcmp (argv[i],
"-subdivide") == 0) {
634 if (i == argc-1) { std::cerr <<
"geo -subdivide: option argument missing" << std::endl;
usage(); }
635 size_t nsub = atoi(argv[++i]);
636 dout.
os() << setsubdivide (nsub);
638 else if (strcmp (argv[i],
"-image-format") == 0) {
639 if (i == argc-1) { std::cerr <<
"geo -image-format: option argument missing" << std::endl;
usage(); }
640 std::string format = argv[++i];
641 if (format ==
"jpeg") format =
"jpg";
642 if (format ==
"postscript") format =
"ps";
643 dout.
os() << setimage_format(format);
645 else if (strcmp (argv[i],
"-resolution") == 0) {
646 if (i == argc-1 || !isdigit(argv[i+1][0])) { std::cerr <<
"geo -resolution: option argument missing" << std::endl;
usage(); }
647 size_t nx = atoi(argv[++i]);
648 size_t ny = (i < argc-1 && isdigit(argv[i+1][0])) ? atoi(argv[++i]) :
nx;
651 else if (strcmp (argv[i],
"-round") == 0) {
654 if (i+1 < argc &&
is_float(argv[i+1])) {
659 else if (strcmp (argv[i],
"-upgrade") == 0) { do_upgrade =
true;
dout.
os() <<
rheo; render =
file_render; }
660 else if (strcmp (argv[i],
"-check") == 0) { do_check =
true; }
661 else if (strcmp (argv[i],
"-name") == 0) {
662 if (i == argc-1) { std::cerr <<
"geo -name: option argument missing" << std::endl;
usage(); }
665 else if (strcmp (argv[i],
"-if") == 0 ||
666 strcmp (argv[i],
"-input-format") == 0) {
667 if (i == argc-1) { std::cerr <<
"geo "<<argv[i]<<
": option argument missing" << std::endl;
usage(); }
668 input_format = argv[++i];
670 else if (strcmp (argv[i],
"-") == 0) {
673 else if (argv[i][0] !=
'-') {
681 if (filename ==
"") {
682 std::cerr <<
"geo: no input file specified" << std::endl;
684 }
else if (filename ==
"-") {
686 if (do_upgrade) std::cin >> upgrade;
688 if (
name !=
"output") thename =
name;
689 std::cin >> setbasename(thename);
692 dout.
os() << setbasename(
name) << reader_on_stdin;
695 std::string suffix = input_format;
696 if (
name ==
"output") {
700 ips.
open (filename, suffix);
701 check_macro(ips.
good(),
"\"" << filename <<
"[."<<suffix<<
"[.gz]]\" not found.");
702 if (do_upgrade) ips.
is() >> upgrade;
705 ips.
is() >> setbasename(
name);
711 if (do_add_bdry) { omega.boundary(); }
714 size_t nsub = iorheo::getsubdivide (std::cout);
717 new_omega.build_by_subdividing (omega, nsub);
722 check_macro (omega.check(bverbose),
"geo check failed");
724 bool show = show_min_element_measure
725 || show_max_element_measure
726 || show_hmin || show_hmax
727 || show_xmin || show_xmax
728 || show_n_element || show_n_vertex || show_sys_coord;
730 if (show_hmin) {
dout <<
"hmin = " << omega.hmin() << std::endl; }
731 if (show_hmax) {
dout <<
"hmax = " << omega.hmax() << std::endl; }
732 if (show_xmin) {
dout <<
"xmin = " << omega.xmin() << std::endl; }
733 if (show_xmax) {
dout <<
"xmax = " << omega.xmax() << std::endl; }
734 if (show_n_element) {
dout <<
"size = " << omega.dis_size() << std::endl; }
735 if (show_n_vertex) {
dout <<
"n_vertex = " << omega.dis_size(0) << std::endl; }
736 if (show_sys_coord) {
dout <<
"sys_coord = " << omega.coordinate_system_name() << std::endl; }
737 if (show_min_element_measure) {
740 if (show_max_element_measure) {
746 dout.
os() << setrounding_precision(round_prec);
750 #if (_RHEOLEF_PARAVIEW_VERSION_MAJOR >= 5) && (_RHEOLEF_PARAVIEW_VERSION_MINOR >= 5)
752 if (do_stereo || omega.dimension() >= 2) {
754 if (do_stereo || omega.dimension() == 3) {
int main(int argc, char **argv)
void set_input_format(idiststream &in, std::string input_format)
Float extrema_element_measure(const geo_basic< Float, sequential > &omega, bool is_min)
see the Float page for the full documentation
see the point page for the full documentation
see the environment page for the full documentation
generic mesh with rerefence counting
see the geo_element page for the full documentation
idiststream: see the diststream page for the full documentation
void open(std::string filename, std::string suffix="", const communicator &comm=communicator())
This routine opens a physical input file.
odiststream: see the diststream page for the full documentation
point_basic< Float > point
idiststream din(cin)
see the diststream page for the full documentation
odiststream dout(cout)
see the diststream page for the full documentation
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color format format bamg
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color format format format format format format format format format format format format format format format format format format format format format paraview
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color format format format format format format format format format format format format format format format format format format format gnuplot
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color format format format format format format format format format format format format format format format format vtk
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color rheo
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color format format format format format format gmsh
This file is part of Rheolef.
T dist(const point_basic< T > &x, const point_basic< T > &y)
string delete_suffix(const string &name, const string &suffix)
delete_suffix: see the rheostream page for the full documentation
string get_basename(const string &name)
get_basename: see the rheostream page for the full documentation
bool is_float(const string &s)
is_float: see the rheostream page for the full documentation
void append_dir_to_rheo_path(const string &dir)
append_dir_to_rheo_path: see the rheostream page for the full documentation
std::ostream & operator<<(std::ostream &os, const catchmark &m)
space_mult_list< T, M > pow(const space_basic< T, M > &X, size_t n)
Float to_float(const string &s)
to_float: see the rheostream page for the full documentation
rheolef - reference manual