28 #include "rheolef/field_expr.h"
29 #include "rheolef/piola_util.h"
30 #include "rheolef/rheostream.h"
31 #include "rheolef/iorheo.h"
32 #include "rheolef/iofem.h"
33 #include "rheolef/interpolate.h"
44 field_put_gmsh (odiststream& ods,
const field_basic<T,sequential>& uh, std::string
name);
56 ostream& os = ops.
os();
58 bool is_scalar = (valued ==
"scalar");
59 bool verbose = iorheo::getverbose(os);
60 bool clean = iorheo::getclean(os);
61 bool execute = iorheo::getexecute(os);
62 string basename = iorheo::getbasename(os);
65 bool fill = iorheo::getfill(os);
66 size_type n_isovalue = iorheo::getn_isovalue(os);
67 size_type n_isovalue_negative = iorheo::getn_isovalue_negative(os);
69 size_type subdivide = iorheo::getsubdivide(os);
71 subdivide = std::max(omega.order(), subdivide);
72 subdivide = std::max(uh.
get_space().get_basis().degree (), subdivide);
74 bool elevation = iorheo::getelevation(os);
75 bool iso = iorheo::getiso(os);
76 T isovalue = iorheo::getisovalue(os);
77 bool color = iorheo::getcolor(os);
78 bool gray = iorheo::getgray(os);
79 bool black_and_white = iorheo::getblack_and_white(os);
80 if (black_and_white) fill =
false;
81 string format = iorheo::getimage_format(os);
82 if (format ==
"tiff") format =
"tif";
83 if (format ==
"jpeg") format =
"jpg";
85 string mark = iorheo::getmark(os);
87 bool label = iorheo::getshowlabel(os);
88 bool stereo = iorheo::getstereo(os);
89 bool volume = iorheo::getvolume(os);
90 bool cut = iorheo::getcut(os);
91 bool grid = iorheo::getgrid(os);
92 if (mark !=
"" && !is_scalar) mark =
"|"+mark +
"|";
93 bool velocity = iorheo::getvelocity(os);
94 bool deformation = iorheo::getdeformation(os);
95 Float vscale = iorheo::getvectorscale(os);
99 string outfile_fmt =
"";
103 size_type nv = omega.sizes().ownership_by_dimension[0].size();
104 size_type nedg = omega.sizes().ownership_by_dimension[1].size();
105 size_type nfac = omega.sizes().ownership_by_dimension[2].size();
106 size_type nvol = omega.sizes().ownership_by_dimension[3].size();
117 filelist = filelist +
" " + msh_name;
118 ofstream msh_os (msh_name.c_str());
120 if (
verbose) clog <<
"! file \"" << msh_name <<
"\" created.\n";
127 filelist = filelist +
" " + opt_name;
128 ofstream opt (opt_name.c_str());
129 if (
verbose) clog <<
"! file \"" << opt_name <<
"\" created.\n";
134 Float xy_delta = std::max(omega.xmax()[0]-omega.xmin()[0],
135 omega.xmax()[1]-omega.xmin()[1]);
136 Float z_delta = umax-umin;
137 z_scale = (fabs(z_delta)+1 == 1) ? 0 : xy_delta/(umax-umin);
139 opt <<
"View.Color.Background2D={255,255,255};" << endl
140 <<
"General.SmallAxes = 0; // no small xyz axes" << endl
141 <<
"General.BackgroundGradient = 0; // no color bg grad" << endl
142 <<
"Mesh.ColorCarousel = 0; // 0: by element type, 1: by elementary entity, 2: by physical entity, 3: by partition" << endl
143 <<
"gray = 125;" << endl
144 <<
"Mesh.Color.Triangles = {gray,gray,gray};" << endl
145 <<
"View.Type=1; // 1: 3D, 2: 2D space, 3: 2D time, 4: 2D" << endl
146 <<
"View.RaiseZ=" << z_scale <<
"; // elevation view" << endl
148 if (n_isovalue_negative != 0) {
149 n_isovalue = 2*n_isovalue_negative;
150 if (!fill) n_isovalue++;
151 Float z_delta = std::max(umax, -umin);
155 opt <<
"View.CustomMin = " << umin <<
";" << endl
156 <<
"View.CustomMax = " << umax <<
";" << endl
157 <<
"View.NbIso = " << n_isovalue <<
";" << endl
158 <<
"View.IntervalsType = " << (fill ? 3 : 1) <<
"; // 1: iso, 2: continuous, 3=discrete(bandes), 4=nums(?)" << endl
159 <<
"View.RangeType = 2; // 1: default, 2: custom, 3: per time step" << endl
160 <<
"View.SaturateValues = 1;" << endl
162 if (black_and_white) {
163 opt <<
"View.ColorTable = { Gray, Black };" << endl
164 <<
"View.LineWidth=3;" << endl
165 <<
"View.ShowScale=0;" << endl
168 opt <<
"View.ColormapNumber = 9; // grayscale" << endl
172 opt <<
"nsub = " << subdivide <<
";" << endl
173 <<
"View.AdaptVisualizationGrid = 1; // quand degree > 1" << endl
174 <<
"View.MaxRecursionLevel = nsub; // quand degree > 1" << endl
175 <<
"View.TargetError = 1e-7;" << endl
176 <<
"Mesh.NumSubEdges = nsub; // quand order > 1" << endl
186 filelist = filelist +
" " + sav_name;
187 ofstream sav (sav_name.c_str());
188 if (
verbose) clog <<
"! file \"" << sav_name <<
"\" created.\n";
189 sav <<
"Print.Height = 768;" << endl
190 <<
"Print.Width = 1024;" << endl
192 <<
"Print \"" <<
basename <<
"." << format <<
"\";" << endl
193 <<
"Printf(\"! output written to " <<
basename <<
"." << format <<
"\") > \"/dev/stderr\";" << endl
194 <<
"Exit; // no true batch mode, will open the GL window...\";" << endl
204 command =
"gmsh -option " + opt_name +
" " + msh_name;
213 command =
"/bin/rm -f " + filelist;
field::size_type size_type
see the Float page for the full documentation
const space_type & get_space() const
const geo_type & get_geo() const
typename float_traits< T >::type float_type
generic mesh with rerefence counting
odiststream: see the diststream page for the full documentation
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin gray
This file is part of Rheolef.
odiststream & field_put_gmsh(odiststream &, const field_basic< T, sequential > &, std::string)
template odiststream & visu_gmsh< Float >(odiststream &, const field_basic< Float, sequential > &)
std::string get_tmpdir()
get_tmpdir: see the rheostream page for the full documentation
odiststream & visu_gmsh(odiststream &, const field_basic< T, sequential > &)
details::field_expr_v2_nonlinear_terminal_function< details::normal_pseudo_function< Float > > normal()
normal: see the expression page for the full documentation