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 =
"";
101 size_type map_dim = omega.map_dimension();
102 size_type nv = omega.sizes().ownership_by_dimension[0].size();
103 size_type nedg = omega.sizes().ownership_by_dimension[1].size();
104 size_type nfac = omega.sizes().ownership_by_dimension[2].size();
105 size_type nvol = omega.sizes().ownership_by_dimension[3].size();
106 size_type ne = omega.sizes().ownership_by_dimension[map_dim].size();
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;
118 string filename = tmp+basename +
".vtk";
119 filelist = filelist +
" " + filename;
120 ofstream vtk_os (filename.c_str());
122 if (verbose) clog <<
"! file \"" << filename <<
"\" created.\n";
123 size_type out_dim = high_order ? std::min (
size_type(1),omega.map_dimension()) : omega.map_dimension();
124 geo_put_vtk (
vtk, omega, omega.get_piola_basis(), omega.get_nodes(),
true, out_dim);
129 for (
size_type idom = 0, ndom = omega.n_domain(); idom < ndom; ++idom) {
131 string filename = tmp+basename +
"." + dom.name() +
".vtk";
132 filelist = filelist +
" " + filename;
133 ofstream vtk_os_dom (filename.c_str());
135 if (verbose) clog <<
"! file \"" << filename <<
"\" created.\n";
136 out_dim = high_order && !fill ? std::min (
size_type(1),dom.map_dimension()) : dom.map_dimension();
138 = high_order && !fill && dom.map_dimension() > 1 ?
140 geo_put_vtk (vtk_dom, dom_reduced_edges, dom_reduced_edges.get_piola_basis(), dom_reduced_edges.get_nodes(),
true, out_dim);
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
160 py <<
"d = [ '" << tmp+basename <<
"'";
161 for (
size_type idom = 0, ndom = omega.n_domain(); idom < ndom; ++idom) {
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);
169 point xmin = omega.xmin(),
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 ";
209 if (format !=
"") command =
"DISPLAY=:0.0 " + command;
210 if (stereo && format ==
"") command = command +
" --stereo";
211 if (verbose) clog <<
"! " << command << endl;
212 status = system (command.c_str());
218 command =
"/bin/rm -f " + filelist;
219 if (verbose) clog <<
"! " << command << endl;
220 status = system (command.c_str());
odiststream & geo_put_vtk(odiststream &ops, const geo_basic< T, sequential > &omega, const basis_basic< T > &my_numb, const disarray< point_basic< T >, sequential > &my_node, bool append_data, size_t subgeo_dim)