28 #include "rheolef/geo.h"
29 #include "rheolef/piola_util.h"
30 #include "rheolef/rheostream.h"
31 #include "rheolef/iorheo.h"
32 #include "rheolef/iofem.h"
46 python (
const point_basic<T>& x,
size_t d=3)
48 std::ostringstream os;
50 for (
size_t i = 1; i <
d; i++)
52 os <<
"]" << std::flush;
53 string buffer = os.str();
69 ostream& os = ops.
os();
70 bool verbose = iorheo::getverbose(os);
71 bool clean = iorheo::getclean(os);
72 bool execute = iorheo::getexecute(os);
73 bool fill = iorheo::getfill(os);
74 bool elevation = iorheo::getelevation(os);
75 bool color = iorheo::getcolor(os);
76 bool gray = iorheo::getgray(os);
77 bool black_and_white = iorheo::getblack_and_white(os);
78 bool stereo = iorheo::getstereo(os);
79 bool full = iorheo::getfull(os);
81 bool cut = iorheo::getcut(os);
82 bool volume = iorheo::getvolume(os);
83 bool grid = iorheo::getgrid(os);
84 bool lattice = iorheo::getlattice(os);
85 bool shrink = iorheo::getshrink(os);
86 bool showlabel = iorheo::getshowlabel(os);
87 bool tube = iorheo::gettube(os);
88 bool ball = iorheo::getball(os);
89 string format = iorheo::getimage_format(os);
90 if (format ==
"tiff") format =
"tif";
91 if (format ==
"jpeg") format =
"jpg";
92 string basename = iorheo::getbasename(os);
96 string outfile_fmt =
"";
108 #if (_RHEOLEF_PARAVIEW_VERSION_MAJOR >= 5) && (_RHEOLEF_PARAVIEW_VERSION_MINOR >= 5)
110 bool high_order = omega.
order() > 1 && !cut && !shrink;
112 bool high_order =
false;
119 filelist = filelist +
" " + filename;
120 ofstream vtk_os (filename.c_str());
122 if (
verbose) clog <<
"! file \"" << filename <<
"\" created.\n";
132 filelist = filelist +
" " + filename;
133 ofstream vtk_os_dom (filename.c_str());
135 if (
verbose) clog <<
"! file \"" << filename <<
"\" created.\n";
146 std::string py_name = filename =
tmp+
basename +
".py";
147 filelist = filelist +
" " + filename;
148 ofstream py (filename.c_str());
149 if (
verbose) clog <<
"! file \"" << filename <<
"\" created.\n";
150 py <<
"#!/usr/bin/env paraview --script=" << endl
151 <<
"# This is a paraview script for the visualization of " <<
basename <<
".vtk" << endl
152 <<
"# automatically generated by rheolef." << endl
156 py <<
"from paraview.simple import *" << endl
157 <<
"from paraview_rheolef import * # load rheolef specific functions" << endl
163 py <<
", '" << dom.
name() <<
"'";
167 bool has_origin = (origin[0] != numeric_limits<Float>::max());
168 bool view_2d = (omega.
xmax()[2] - omega.
xmin()[2] == 0);
171 py <<
"opt = { \\" << endl
172 <<
" 'format' : '" << format <<
"', \\" << endl
173 <<
" 'resolution' : [" << resolution[0] <<
"," << resolution[1] <<
"], \\" << endl
174 <<
" 'showlabel': " << showlabel <<
"," << endl
175 <<
" 'axis' : 1," << endl
176 <<
" 'view_1d' : 0," << endl
177 <<
" 'view_2d' : " << view_2d <<
"," << endl
178 <<
" 'color' : '" << (color ?
"color" : (
gray ?
"gray" :
"black_and_white")) <<
"'," << endl
179 <<
" 'stereo' : " << stereo <<
", \\" << endl
180 <<
" 'bbox' : [[" << xmin[0] <<
"," << xmin[1] <<
"," << xmin[2] <<
"],["
181 << xmax[0] <<
"," << xmax[1] <<
"," << xmax[2] <<
"]], \\" << endl
182 <<
" 'ball' : " << ball <<
", \\" << endl
183 <<
" 'cut' : " << cut <<
", \\" << endl
184 <<
" 'fill' : " << fill <<
", \\" << endl
185 <<
" 'full' : " << full <<
", \\" << endl
186 <<
" 'lattice' : " << lattice <<
", \\" << endl
187 <<
" 'shrink' : " << shrink <<
", \\" << endl
188 <<
" 'tube' : " << tube <<
", \\" << endl
189 <<
" 'volume' : " << 0 <<
", \\" << endl
190 <<
" 'has_origin' : " << has_origin <<
", \\" << endl
191 <<
" 'origin' : " <<
python(origin) <<
", \\" << endl
193 <<
" 'elevation' : 0, \\" << endl
194 <<
" 'high_order' : "<< high_order <<
" \\" << endl
198 py <<
"paraview_geo(paraview, opt, d)" << endl
207 string prog = (format ==
"") ?
"paraview --script=" :
"pvbatch --use-offscreen-rendering ";
218 command =
"/bin/rm -f " + filelist;
227 template odiststream& visu_vtk_paraview<Float> (odiststream&,
const geo_basic<Float,sequential>&);