409int main(
int argc,
char**argv) {
418 string filename =
"";
419 string name =
"output";
420 dout.os() << setbasename(name);
422 dout.os() << verbose;
bool bverbose =
true;
423 std::string mark =
"";
427 bool def_fill_opt =
false;
428 bool do_iso3d =
false;
429 std::string i_comp_name =
"";
430 bool do_proj =
false;
431 string use_proj_approx =
"";
432 bool do_lumped_mass =
false;
434 bool do_round =
false;
435 std::string reduce_to_domain =
"";
436 Float round_prec = sqrt(std::numeric_limits<Float>::epsilon());
438 dout.os() << showlabel;
441 cout << setnormal(
point(-0.015940197423022637, -0.9771157601293953, -0.21211011624358989));
442 cout << setorigin(
point(std::numeric_limits<Float>::max()));
446 for (
int i = 1; i < argc; i++) {
449 if (strcmp (argv[i],
"-clean") == 0) dout.os() << clean;
450 else if (strcmp (argv[i],
"-noclean") == 0) dout.os() << noclean;
451 else if (strcmp (argv[i],
"-execute") == 0) dout.os() << execute;
452 else if (strcmp (argv[i],
"-noexecute") == 0) dout.os() << noexecute;
453 else if (strcmp (argv[i],
"-verbose") == 0) { bverbose =
true; dout.os() << verbose; }
454 else if (strcmp (argv[i],
"-noverbose") == 0) { bverbose =
false; dout.os() << noverbose; }
455 else if (strcmp (argv[i],
"-I") == 0) {
456 if (i+1 == argc) { cerr <<
"geo -I: option argument missing" << endl;
usage(); }
461 else if (strcmp (argv[i],
"-field") == 0) { dout.os() <<
rheo; render =
file_render; }
462 else if (strcmp (argv[i],
"-text") == 0) { dout.os() <<
rheo; render =
file_render; }
463 else if (strcmp (argv[i],
"-gmsh") == 0) { dout.os() <<
gmsh; render =
file_render; }
464 else if (strcmp (argv[i],
"-gmsh-pos") == 0) { dout.os() <<
gmsh_pos; render =
file_render; }
465 else if (strcmp (argv[i],
"-bamg-bb") == 0) { dout.os() <<
bamg; render =
file_render; }
466 else if (strcmp (argv[i],
"-name") == 0) {
467 if (i+1 == argc) { std::cerr <<
"field -name: option argument missing" << std::endl;
usage(); }
470 else if (strcmp (argv[i],
"-label") == 0) {
471 if (i+1 == argc) { std::cerr <<
"field -label: option argument missing" << std::endl;
usage(); }
473 dout.os() << setlabel(label);
480 else if (strcmp (argv[i],
"-proj") == 0) {
482 if (i+1 < argc && argv[i+1][0] !=
'-') {
483 use_proj_approx = argv[++i];
486 else if (strcmp (argv[i],
"-lumped-proj") == 0) {
488 do_lumped_mass =
true;
489 use_proj_approx =
"P1";
492 else if (strcmp (argv[i],
"-min") == 0) { show =
show_min; }
493 else if (strcmp (argv[i],
"-max") == 0) { show =
show_max; }
494 else if (strcmp (argv[i],
"-get-geo") == 0) { show =
show_geo; }
497 else if (strcmp (argv[i],
"-velocity") == 0) { dout.os() << velocity; vector_style =
velocity_style; }
498 else if (strcmp (argv[i],
"-deformation") == 0) { dout.os() << deformation; vector_style =
deformation_style; }
499 else if (strcmp (argv[i],
"-fill") == 0) { dout.os() << fill; def_fill_opt =
true; }
500 else if (strcmp (argv[i],
"-nofill") == 0) { dout.os() << nofill; def_fill_opt =
false; }
501 else if (strcmp (argv[i],
"-elevation") == 0) { dout.os() << elevation; }
502 else if (strcmp (argv[i],
"-noelevation") == 0) { dout.os() << noelevation; }
503 else if (strcmp (argv[i],
"-color") == 0) { dout.os() << color; }
504 else if (strcmp (argv[i],
"-gray") == 0) { dout.os() <<
gray; }
505 else if (strcmp (argv[i],
"-black-and-white") == 0) { dout.os() << black_and_white; }
506 else if (strcmp (argv[i],
"-bw") == 0) { dout.os() << black_and_white; }
507 else if (strcmp (argv[i],
"-showlabel") == 0) { dout.os() << showlabel; }
508 else if (strcmp (argv[i],
"-noshowlabel") == 0) { dout.os() << noshowlabel; }
509 else if (strcmp (argv[i],
"-stereo") == 0) { dout.os() << stereo;
515 else if (strcmp (argv[i],
"-nostereo") == 0) { dout.os() << nostereo; }
516 else if (strcmp (argv[i],
"-volume") == 0) { dout.os() <<
paraview << volume;
518 else if (strcmp (argv[i],
"-novolume") == 0) { dout.os() << novolume; }
519 else if (strcmp (argv[i],
"-cut") == 0) { do_cut =
true; }
520 else if (strcmp (argv[i],
"-nocut") == 0) { do_cut =
false; }
521 else if (strcmp (argv[i],
"-noisovalue") == 0) { dout.os() << noiso; do_iso3d =
false; }
522 else if (strcmp (argv[i],
"-isovalue") == 0 || strcmp (argv[i],
"-iso") == 0) {
526 if (i+1 < argc &&
is_float(argv[i+1])) {
528 dout.os() << setisovalue(iso_value);
530 }
else if (strcmp (argv[i],
"-n-iso") == 0) {
532 if (i+1 == argc || !isdigit(argv[i+1][0]))
usage();
533 size_t idx = atoi (argv[++i]);
534 dout.os() << setn_isovalue(idx);
536 }
else if (strcmp (argv[i],
"-n-iso-negative") == 0) {
538 if (i+1 == argc || !isdigit(argv[i+1][0]))
usage();
539 size_t idx = atoi (argv[++i]);
540 dout.os() << setn_isovalue_negative(idx);
542 }
else if (strcmp (argv[i],
"-scale") == 0) {
546 cout << setvectorscale (scale);
548 }
else if (strcmp (argv[i],
"-image-format") == 0) {
550 cerr <<
"field -image-format: option argument missing" << endl;
553 string format = argv[++i];
554 if (format ==
"jpeg") format =
"jpg";
555 if (format ==
"postscript") format =
"ps";
556 dout.os() << setimage_format(format);
558 else if (strcmp (argv[i],
"-resolution") == 0) {
559 if (i == argc-1 || !isdigit(argv[i+1][0])) { std::cerr <<
"geo -resolution: option argument missing" << std::endl;
usage(); }
560 size_t nx = atoi(argv[++i]);
561 size_t ny = (i < argc-1 && isdigit(argv[i+1][0])) ? atoi(argv[++i]) : nx;
564 else if (strcmp (argv[i],
"-mark") == 0 || strcmp (argv[i],
"-catch") == 0 || strcmp (argv[i],
"-catchmark") == 0) {
566 cerr <<
"field -mark: option argument missing" << endl;
571 else if (strcmp (argv[i],
"-subdivide") == 0) {
572 if (i == argc-1) { cerr <<
"field -subdivide: option argument missing" << endl;
usage(); }
573 size_t nsub = atoi(argv[++i]);
574 dout.os() << setsubdivide (nsub);
576 else if (strcmp (argv[i],
"-comp") == 0) {
578 if (i+1 == argc || !isdigit(argv[i+1][0]))
usage();
579 i_comp_name = argv[++i];
581 else if (strcmp (argv[i],
"-domain") == 0) {
583 if (i+1 == argc)
usage();
584 reduce_to_domain = argv[++i];
586 else if (strcmp (argv[i],
"-round") == 0) {
589 if (i+1 < argc &&
is_float(argv[i+1])) {
593 else if ((strcmp (argv[i],
"-origin") == 0) || (strcmp (argv[i],
"-normal") == 0)) {
597 if (i+1 == argc || !
is_float(argv[i+1])) {
602 if (i+1 < argc &&
is_float(argv[i+1])) {
604 if (i+1 < argc &&
is_float(argv[i+1])) {
608 if (strcmp (argv[io],
"-origin") == 0) {
609 cout << setorigin(x);
611 cout << setnormal(x);
615 else if (strcmp (argv[i],
"-") == 0) {
620 else if (argv[i][0] !=
'-') {
625 cerr <<
"field: unknown option `" << argv[i] <<
"'" << endl;
632 if (filename ==
"") {
633 cerr <<
"field: no input file specified" << endl;
635 }
else if (filename ==
"-") {
638 if (name !=
"output") thename = name;
639 std::cin >> setbasename(thename);
641 dout.os() << setbasename(name) << reader_on_stdin;
645 ids.
open (filename,
"field");
646 check_macro(ids.
good(),
"\"" << filename <<
"[.field[.gz]]\" not found.");
651 dout.os() << setbasename(name);
661 if (uh.
get_geo().map_dimension() >= 2 ||
662 uh.
get_geo().dimension() == 3) {
668 if (uh.
get_geo().map_dimension() == 3) {
670 if (!def_fill_opt) dout.os() << nofill;
672 if (reduce_to_domain !=
"") {
675 if (uh.
get_space().get_basis().is_discontinuous() && dom.map_dimension()+1 == uh.
get_geo().map_dimension()) {
678 uh.
get_geo().neighbour_guard();
681 vh = uh[reduce_to_domain];
690 if (do_proj && uh.
get_space().get_basis().have_compact_support_inside_element()) {
692 size_t k = Uh.degree();
694 std::string approx = (do_lumped_mass || use_proj_approx ==
"") ?
"P1" : use_proj_approx;
699 fopt.
lump = do_lumped_mass;
701 switch (Uh.valued_tag()) {
716 error_macro (
"proj: unexpected valued field: " << Uh.valued());
723 if (i_comp_name !=
"") {
728 size_t i_comp = atoi (i_comp_name.c_str());
735 check_macro (i_comp_name.size() == 2,
"invalid component `"<<i_comp_name<<
"'");
736 size_t i = i_comp_name[0] -
'0';
737 size_t j = i_comp_name[1] -
'0';
746 point origin = iofem::getorigin(cout);
756 uh =
round (uh, round_prec);
759 cout << std::setprecision(std::numeric_limits<Float>::digits10)
764 cout << std::setprecision(std::numeric_limits<Float>::digits10)
769 cout << uh.
get_geo().name() << endl;
775 dout << uh_iso_surface;
780 string root_filename = iorheo::getbasename(dout.os());
781 label = (root_filename ==
"output") ?
"" : root_filename;
782 if (mark !=
"") label = mark;
783 if (i_comp_name !=
"") {
784 label = (label ==
"") ?
"value" : label;
785 label = label +
"[" + i_comp_name +
"]";
787 if (reduce_to_domain !=
"") {
788 label = (label ==
"") ?
"value" : label;
789 label = label +
"[" + reduce_to_domain +
"]";
791 dout.os() << setlabel (label);