1 #ifndef _RHEOLEF_BASIS_VISU_GNUPLOT_ICC
2 #define _RHEOLEF_BASIS_VISU_GNUPLOT_ICC
24 #include "rheolef/basis_raw.h"
25 #include "rheolef/iorheo.h"
26 #include "rheolef/rheostream.h"
27 namespace rheolef {
namespace details {
35 typedef typename Basis::value_type
T;
36 bool verbose = iorheo::getverbose(os);
37 bool clean = iorheo::getclean(os);
38 bool execute = iorheo::getexecute(os);
39 size_type nsub = iorheo::getsubdivide(os);
40 if (nsub <= 1) nsub = 20;
48 string plot_name =
basename +
".plot";
49 string gdat_name =
basename +
".gdat";
50 ofstream plot (plot_name.c_str());
51 cerr <<
"! file \"" << plot_name <<
"\" created" << endl;
52 filelist +=
" " + plot_name;
55 plot <<
"gdat = \"" << gdat_name <<
"\"" << endl
56 <<
"set colors classic" << endl
57 <<
"set size square" << endl
60 plot <<
"plot \\" << endl
62 for (
size_t loc_idof = 0; loc_idof < loc_ndof; ++loc_idof) {
63 plot <<
" gdat u 1:"<<loc_idof+2 <<
" t \"L" << loc_idof+1 <<
"\" w l";
64 if (loc_idof+1 != loc_ndof) {
70 plot <<
"pause_duration = 0.5" << endl
73 <<
"imax = d+" << loc_ndof << endl
74 <<
"set hidden3d back # offset 1 trianglepattern 3 undefined 1 altdiagonal bentover" << endl
75 <<
"set linetype 1 lw 1 lc rgb \"#000000\"" << endl
76 <<
"set linetype 2 lw 1 lc rgb \"#0000ff\"" << endl
77 <<
"splot gdat u 1:2:i t sprintf(\"P%d\",i-d) w l lc 0" << endl
78 <<
"load \"" <<
basename <<
".loop\"" << endl
80 string loop_name =
basename +
".loop";
81 ofstream loop (loop_name.c_str());
82 cerr <<
"! file \"" << loop_name <<
"\" created" << endl;
83 filelist +=
" " + loop_name;
84 loop <<
"i = i+1" << endl
85 <<
"if (i <= imax) \\" << endl
86 <<
" pause pause_duration; \\" << endl
87 <<
" replot; \\" << endl
91 plot <<
"pause -1 \"<return>\"" << endl;
97 ofstream gdat (gdat_name.c_str());
98 cerr <<
"! file \"" << gdat_name <<
"\" created" << endl;
99 filelist +=
" " + gdat_name;
100 gdat << setprecision(std::numeric_limits<T>::digits10)
101 <<
"# basis " <<
b.name() << endl
102 <<
"# element " << hat_K.
name() << endl
103 <<
"# degree " <<
b.degree() << endl
105 Eigen::Matrix<T,Eigen::Dynamic,1>
value;
111 gdat <<
"# size " << loc_ndof << endl
113 for (
size_t loc_idof = 0; loc_idof < loc_ndof; ++loc_idof) {
114 gdat <<
" L" << loc_idof+1;
119 b.evaluate (hat_K, hat_x,
value);
121 for (
size_t loc_idof = 0, loc_ndof =
value.size(); loc_idof < loc_ndof; ++loc_idof) {
122 gdat <<
" " <<
value[loc_idof];
130 for (
size_type i1 = 0; i1 <= nsub; i1++) {
133 b.evaluate (hat_K, hat_x,
value);
134 gdat << hat_x[0] <<
" " << hat_x[1];
135 for (
size_t loc_idof = 0, loc_ndof =
value.size(); loc_idof < loc_ndof; ++loc_idof) {
136 gdat <<
" " <<
value[loc_idof];
148 b.evaluate (hat_K, hat_x,
value);
149 gdat << hat_x[0] <<
" " << hat_x[1];
150 for (
size_t loc_idof = 0, loc_ndof =
value.size(); loc_idof < loc_ndof; ++loc_idof) {
151 gdat <<
" " <<
value[loc_idof];
162 for (
size_type j = 0; j+k <= nsub; j++) {
163 for (
size_type i = 0; i+j+k <= nsub; i++) {
165 b.eval_lagrange (hat_x, hat_K, degree, sopt, inv_vdm,
value);
173 for (
size_type k = 0; k <= degree; k++) {
174 for (
size_type j = 0; j <= degree; j++) {
175 for (
size_type i = 0; i+j <= degree; i++) {
177 b.eval_lagrange (hat_x, hat_K, degree, sopt, inv_vdm,
value);
185 for (
size_type k = 0; k <= degree; k++) {
186 for (
size_type j = 0; j <= degree; j++) {
187 for (
size_type i = 0; i <= degree; i++) {
189 b.eval_lagrange (hat_x, hat_K, degree, sopt, inv_vdm,
value);
198 error_macro (
"unexpected element type `"<<hat_K.
name()<<
"'");
203 string command =
"gnuplot " + plot_name;
210 string command =
"/bin/rm -f " + filelist;
field::size_type size_type
see the reference_element page for the full documentation
static const variant_type H
static const variant_type q
static const variant_type e
size_type dimension() const
static const variant_type p
variant_type variant() const
static size_type n_node(variant_type variant, size_type order)
static const variant_type T
static const variant_type P
static const variant_type t
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
void put(const Basis &b, ostream &os, reference_element hat_K)
This file is part of Rheolef.
T norm(const vec< T, M > &x)
norm(x): see the expression page for the full documentation