28 #include "rheolef/branch.h"
29 #include "rheolef/rheostream.h"
30 #include "rheolef/basis_on_pointset.h"
43 ostream&
out = ops.
os();
44 delete_macro (
b._p_ctrl_out);
45 delete_macro (
b._p_data_out);
48 bool do_verbose = iorheo::getverbose(clog);
49 bool do_execute = iorheo::getexecute(clog);
50 bool do_clean = iorheo::getclean (clog);
54 string param_name =
tmp+
basename +
"-visu-param.plot";
55 b._to_clean = plot_name;
56 b._p_ctrl_out = new_macro (ofstream(plot_name.c_str()));
57 do_verbose && clog <<
"! file `" << plot_name <<
"' created" << endl;
59 << setprecision(numeric_limits<T>::digits10)
60 <<
"load \"" << param_name <<
"\"" << endl;
61 b._have_u_range.first = (
b._u_range.first != std::numeric_limits<T>::max());
62 b._have_u_range.second = (
b._u_range.second != -std::numeric_limits<T>::max());
69 bool do_verbose = iorheo::getverbose(clog);
70 size_t nfld =
b.n_field();
71 if (nfld == 0)
return;
77 bool do_clean = iorheo::getclean (clog);
78 string basename = iorheo::getbasename(ops.
os());
84 if (
b._count_value == 0) {
85 *(
b._p_ctrl_out) <<
"set xrange [" << omega.
xmin()[0] <<
":" << omega.
xmax()[0] <<
"]" << endl;
87 if (!
b._have_u_range.first || !
b._have_u_range.second) {
88 for (
size_t ifld = 0; ifld < nfld; ifld++) {
90 if (!
b._have_u_range.first) {
91 b._u_range.first = std::min (
b._u_range.first,
u.min());
93 if (!
b._have_u_range.second) {
94 b._u_range.second = std::max (
b._u_range.second,
u.max());
101 const string& pname =
b.parameter_name() +
" = " +
ftos(
b.parameter());
102 *(
b._p_ctrl_out) <<
"set title \"i = " <<
b._count_value <<
": " << pname <<
"\" font \"arial,20\"" << endl
103 <<
"plot \\" << endl;
104 for (
size_t ifld = 0; ifld < nfld; ifld++) {
105 const string& uname =
b[ifld].first;
106 string gdat_name =
tmp +
basename +
"_" + uname +
"_" +
itos(
b._count_value) +
".gdat";
107 *(
b._p_ctrl_out) << (ifld == 0 ?
" " :
",")
108 <<
" \"" << gdat_name <<
"\""
110 <<
" t \"" << uname <<
"\""
112 << (ifld < nfld-1 ?
" \\" :
"")
115 *(
b._p_ctrl_out) <<
"pause dt_pause" << endl;
120 size_type subdivide = iorheo::getsubdivide(ops.
os());
121 bool fill = iorheo::getfill(ops.
os());
122 for (
size_t ifld = 0; ifld < nfld; ifld++) {
123 const string& uname =
b[ifld].first;
125 string gdat_name =
tmp +
basename +
"_" + uname +
"_" +
itos(
b._count_value) +
".gdat";
126 ofstream gdat (gdat_name.c_str());
127 b._to_clean =
b._to_clean +
" " + gdat_name;
128 if (do_verbose) clog <<
"! file \"" << gdat_name <<
"\" created.\n";
129 gdat << setprecision(numeric_limits<T>::digits10);
132 if (subdivide == 0) {
133 subdivide = std::max(omega.
order(), subdivide);
134 subdivide = std::max(b_fem.
degree (), subdivide);
146 for (
size_type ie = 0, ne = omega.
size(used_dim); ie < ne; ie++) {
148 put (gdat, omega, K, uh, fops, subdivide, bbox);
158 string basename = iorheo::getbasename(ops.
os());
160 bool do_verbose = iorheo::getverbose(clog);
161 bool do_execute = iorheo::getexecute(clog);
162 bool do_clean = iorheo::getclean(clog);
163 bool reader_on_stdin = iorheo::getreader_on_stdin(ops.
os());
164 if (! reader_on_stdin) {
165 *(
b._p_ctrl_out) <<
"pause -1 \"<end>\"" << endl;
171 string param_name =
tmp+
basename +
"-visu-param.plot";
172 ofstream param (param_name.c_str());
173 if (do_verbose) clog <<
"! file \"" << param_name <<
"\" created.\n";
174 b._to_clean =
b._to_clean +
" " + param_name;
175 param <<
"duration = 30 # in seconds" << endl
176 <<
"n_step = " <<
b._count_value << endl
177 <<
"dt_pause = 1.0*duration/n_step" << endl;
178 if (
b._u_range.second -
b._u_range.first < 1e-7) {
180 b._u_range.second =
b._u_range.first + 1;
182 param <<
"set yrange [" <<
b._u_range.first <<
":" <<
b._u_range.second <<
"]" << endl;
191 if (reader_on_stdin)
command +=
"-persist ";
193 if (do_verbose) clog <<
"! " <<
command << endl;
202 if (!do_clean)
tmp =
"";
203 string command =
"/bin/rm -f " +
b._to_clean;
206 do_verbose && clog <<
"! cleaning temporary .plot and .gdat files" << endl;
209 delete_macro (
b._p_ctrl_out);
210 delete_macro (
b._p_data_out);
field::size_type size_type
base::size_type size_type
see the disarray page for the full documentation
void initialize(const basis_basic< T > &fem_basis, const piola_on_pointset< T > &pops)
const space_type & get_space() const
const geo_type & get_geo() const
const basis_basic< T > & get_piola_basis() const
const node_type & xmin() const
size_type size(size_type dim) const
size_type map_dimension() const
const node_type & xmax() const
const_reference get_geo_element(size_type dim, size_type ige) const
see the geo_element page for the full documentation
see the integrate_option page for the full documentation
odiststream: see the diststream page for the full documentation
void initialize(const basis_basic< T > &piola_basis, const quadrature< T > &quad, const integrate_option &iopt)
const geo_basic< T, sequential > & get_geo() const
const disarray< point_basic< T >, sequential > & get_xdofs() const
This file is part of Rheolef.
void put(std::ostream &out, std::string name, const tiny_matrix< T > &a)
void put_header_gnuplot(odiststream &ops, const branch_basic< T, sequential > &b)
void put_finalize_gnuplot(odiststream &ops, const branch_basic< T, sequential > &b)
std::string itos(std::string::size_type i)
itos: see the rheostream page for the full documentation
string ftos(const Float &x)
itof: see the rheostream page for the full documentation
std::string get_tmpdir()
get_tmpdir: see the rheostream page for the full documentation
void put_event_gnuplot(odiststream &ops, const branch_basic< T, sequential > &b)