Commit 8073b588 authored by Radek Fučík's avatar Radek Fučík
Browse files

Improved Maxima output of pdes

	modified:   src/export_latex.cpp
	modified:   src/lbm.h
	modified:   src/tpde.hpp
parent 396c7d7e
......@@ -62,7 +62,7 @@ void export_latex(const char *dirname, int MO=4, int MFCO=2)
S.allocate(bas, MO, MFCO, lbm.t, lbm.x, lbm.y, lbm.z);
S.load(subdir, table);
S.save_tex2(dirname, "spatial_EPDE","pde_%02d", pi);
// S.save_raw(dirname, "spatial_EPDE","pde_%02d", pi);
S.save_raw(dirname, "spatial_EPDE","pde_%02d", pi);
}
}
}
......
......@@ -18,9 +18,9 @@ struct LBM
matrix M, Mi, E[MQ], I;
symbol sym_o=symbol("o","\\omega");
symbol sym_o=symbol("omega","\\omega");
symbol sym_os[MQ];
symbol sym_cs=symbol("cs","c_s");
symbol sym_cs=symbol("c_s","c_s");
symbol x=symbol("x","\\x"),y=symbol("y","\\y"),z=symbol("z","\\z"),t=symbol("t");
symbol dl=symbol("dl","\\dl"), dt=symbol("dt","\\dt");
......@@ -141,7 +141,7 @@ struct LBM
char desc[100], desc_tex[100];
for (int q=0;q<MQ;q++)
{
sprintf(desc,"o_%d",q+1);
sprintf(desc,"omega_%d",q+1);
sprintf(desc_tex,"\\omega_{%d}",q+1);
sym_os[q]=symbol(desc,desc_tex);
}
......
......@@ -99,7 +99,7 @@ void TPDE::print(ostringstream &out)
if (data0D!=0)
{
sout << "1" << endl;
sout << "...." << data0D << endl;
sout << "\t" << data0D << endl;
}
// 1D
for (int oi=1;oi<=MO;oi++) for (int i0=0;i0<=oi;i0++) for (int i1=0;i1<=oi;i1++) for (int i2=0;i2<=oi;i2++) for (int i3=0;i3<=oi;i3++) if (i0+i1+i2+i3==oi)
......@@ -107,7 +107,7 @@ void TPDE::print(ostringstream &out)
if (data_r( bi,i0,i1,i2,i3 )!=0)
{
sout << basders[ind(bi,i0,i1,i2,i3)] << endl;
sout << "...." << data_r( bi,i0,i1,i2,i3 ) <<endl;
sout << "\t" << data_r( bi,i0,i1,i2,i3 ) <<endl;
}
// 2D
......@@ -119,7 +119,7 @@ void TPDE::print(ostringstream &out)
if (data_r( bi,i0,i1,i2,i3, bj,j0,j1,j2,j3 )!=0)
{
sout << basders[ind(bi,i0,i1,i2,i3)] << " * " << basders[ind(bj,j0,j1,j2,j3)] << endl;
sout << "...." << data_r( bi,i0,i1,i2,i3, bj,j0,j1,j2,j3 ) <<endl;
sout << "\t" << data_r( bi,i0,i1,i2,i3, bj,j0,j1,j2,j3 ) <<endl;
}
string str1 = sout.str();
......@@ -405,12 +405,25 @@ void TPDE::save_raw(const char* dirname, const char* subdirname, const char*fmt,
// raw output
ostringstream sout;
print(sout);
sprintf(fn,"%s/%s/%s_raw",dirname,subdirname,name);
// sprintf(fn,"%s/%s/%s_output_raw_pde",dirname,subdirname,name);
// sprintf(fn,"%s/%s/%s_output_raw_pde",dirname,name,name);
sprintf(fn,"%s/%s/%s.txt",dirname,subdirname,name);
ostringstream sout_all;
sout_all << "Complete PDE that can be directly imported to Maxima:" << endl;
sout_all << raw() << endl << endl;
sout_all << "List of all coefficients of each partial derivatives:" << endl;
sout_all << sout.str() << endl;
string str1 = sout_all.str();
// str1 = ReplaceString( str1, "(t,x,y,z)", "");
// str1 = ReplaceString( str1, "(t,\\x,\\y,\\z)", "");
str1 = ReplaceString( str1, "fu", "u");
str1 = ReplaceString( str1, "fv", "v");
str1 = ReplaceString( str1, "fw", "w");
str1 = ReplaceString( str1, "frho", "rho");
ofstream fout(fn);
fout << raw() << endl<<endl;
fout << sout.str() << endl;
fout << str1;
fout.close();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment