335# include "rheolef/iofem.h"
339 cerr <<
"field: usage:" << endl
341 <<
"{-|file[.field[.gz]]}"
343 <<
"[-min|-max|-get-geo] "
345 <<
"[-[catch]mark string] "
347 <<
"[-domain string] "
348 <<
"[-round [float]] "
349 <<
"[-proj [string]] "
351 <<
"[-paraview|-gnuplot] "
352 <<
"[-field|-text|-gmsh|-gmsh-pos|-bamg-bb] "
353 <<
"[-[no]clean] [-[no]execute] [-[no]verbose] "
354 <<
"[-color|-gray|-black-and-white|-bw] "
355 <<
"[-[no]elevation] "
358 <<
"[-[no]showlabel] "
359 <<
"[-label string] "
362 <<
"[-normal x [y [z]]] "
363 <<
"[-origin x [y [z]]] "
365 <<
"[-iso[value] float|-noiso[value]] "
367 <<
"[-n-iso-negative int] "
368 <<
"[-velocity|-deformation] "
369 <<
"[-image-format string] "
370 <<
"[-resolution int [int]] "
371 <<
"[-subdivide int] "
409int main(
int argc,
char**argv) {
414 check_macro (communicator().size() == 1,
"field: command may be used as mono-process only");
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 =
"";
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);
int main(int argc, char **argv)
see the Float page for the full documentation
see the point page for the full documentation
see the catchmark page for the full documentation
see the environment page for the full documentation
valued_type valued_tag() const
std::string get_approx() const
const geo_type & get_geo() const
const space_type & get_space() const
const std::string & valued() const
generic mesh with rerefence counting
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.
see the integrate_option page for the full documentation
odiststream: see the diststream page for the full documentation
vec< T, M > solve(const vec< T, M > &b) const
#define error_macro(message)
#define warning_macro(message)
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 gmsh_pos
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
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin gray
rheolef::details::is_vec dot
This file is part of Rheolef.
string delete_suffix(const string &name, const string &suffix)
delete_suffix: see the rheostream page for the full documentation
std::enable_if< details::is_field_expr_affine_homogeneous< Expr >::value, field_basic< typenameExpr::scalar_type, typenameExpr::memory_type > >::type round(const Expr &expr, const T2 &prec)
geo_basic< T, sequential > paraview_extract_isosurface(const field_basic< T, sequential > &uh)
Float to_float(const string &s)
to_float: see the rheostream page for the full documentation
T ddot(const tensor_basic< T > &a, const tensor_basic< T > &b)
ddot(x,y): see the expression page for the full documentation
string get_basename(const string &name)
get_basename: see the rheostream page for the full documentation
field_basic< T, sequential > paraview_plane_cut(const field_basic< T, sequential > &uh, const point_basic< T > &origin, const point_basic< T > &normal)
details::field_expr_v2_nonlinear_terminal_function< details::normal_pseudo_function< Float > > normal()
normal: see the expression 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::enable_if< details::is_field_expr_v2_nonlinear_arg< Expr >::value &&!is_undeterminated< Result >::value, Result >::type integrate(const geo_basic< T, M > &omega, const Expr &expr, const integrate_option &iopt, Result dummy=Result())
see the integrate page for the full documentation
field_basic< T, M > interpolate(const space_basic< T, M > &V2h, const field_basic< T, M > &u1h)
see the interpolate page for the full documentation
bool is_float(const string &s)
is_float: see the rheostream page for the full documentation
rheolef - reference manual