Browse Source

добавил шаг

master
gvitbsord 1 month ago
parent
commit
3119c4c045
4 changed files with 10 additions and 7 deletions
  1. 1
    1
      draghilevinout.cpp
  2. 1
    0
      solver.cpp
  3. 6
    5
      sysdiffeqn.cpp
  4. 2
    1
      virteqn.h

+ 1
- 1
draghilevinout.cpp View File

@@ -27,7 +27,7 @@ draghilevinout::draghilevinout(int argc, char *argv[]) :

void draghilevinout::checkdel()
{
if ( !nodel.getValue() && !oct_file.isSet() )
if ( !( nodel.getValue() || nocpp.getValue() ) && !oct_file.isSet() )
if ( std::remove("test.cpp") || std::remove("test.so") )
std::cout<<"Ошибка при удалении сду"<< std::flush;
}

+ 1
- 0
solver.cpp View File

@@ -45,6 +45,7 @@ solver_diff_eqn::solver_diff_eqn(sys_osn_dan &sod_):sod(&sod_)
rk.do_step( std::ref(func[k]) , x , l_dt , r_dt );
coordinate.insert(coordinate.end(), x.begin(), x.end());

func_sys->set_shag(i);
for (size_t j = 0; j < sod->get_par_diff().up.size(); j++)
_upr_par.push_back(func_sys->get_upr_par()[j]);


+ 6
- 5
sysdiffeqn.cpp View File

@@ -116,18 +116,18 @@ void sys_diff_equation::det_comp()
ofst << "#include \"virteqn.h\"" << '\n' << std::endl;
ofst << "class funcinst : public diffeqninterface {" << std::endl << "public:" <<std::endl;
ofst << "virtual std::vector<syseqn> funcv();" << std::endl;
ofst << "virtual state_type get_upr_par()";
ofst << "virtual state_type get_upr_par();" << std::endl;
ofst << "virtual void set_shag(double &_i) {i=_i;}" <<std::endl;
// if (!est_uprav)
// ofst << " {return {};}" << std::endl;
//else
ofst << ";" << std::endl;

ofst << "private:" << std::endl;
ofst << "static double i;" << std::endl;

for (auto it = uprav_par_naz.begin(); it != uprav_par_naz.end(); it++)
ofst << "static double "<< *it <<";" << std::endl;
//ofst << "virtual void set_par_a(double &_a) {a=_a;}" <<std::endl;

GiNaC::ex temp_1=expr_in.back();
//bool check_t=false;
@@ -144,6 +144,7 @@ void sys_diff_equation::det_comp()
ofst << "extern \"C\" diffeqninterface* create() {" << "return new funcinst;" << "}"<<std::endl;

ofst << "extern \"C\" void destroy(diffeqninterface *p) {" << "delete p;" << "}"<<std::endl <<std::endl;
ofst << "double funcinst::i=1;" << std::endl;
for (auto it = uprav_par_naz.begin(); it != uprav_par_naz.end(); it++)
ofst << "double funcinst::"<< *it << "=0;" << std::endl;

@@ -187,7 +188,7 @@ void sys_diff_equation::det_comp()
A_mat(count,i)=b_mat(0,i);
}
std::stringstream prav_ch; //правая часть
GiNaC::determinant(A_mat).print(GiNaC::print_csrc_double(prav_ch));
GiNaC::determinant(A_mat).print(GiNaC::print_csrc_double(prav_ch));//GiNaC::determinant_algo::bareiss в ginac matrix cpp есть флаги, если expand() удалить правая часть будет значительно меньше
ofst << vnut_pred(prav_ch).rdbuf() << ");" << std::endl;
for (int i=0; i<N_var-1;i++)
A_mat(count,i)=b_temp(0,i);

+ 2
- 1
virteqn.h View File

@@ -8,10 +8,11 @@ typedef void (*syseqn)(const state_type &, state_type &, const double );

class diffeqninterface {
public:
// virtual void set_upr_par(double &) {}
virtual void set_shag(double &) {}
virtual ~diffeqninterface() {}
virtual state_type get_upr_par() = 0;
virtual std::vector<syseqn> funcv() = 0;
double i;
};

typedef diffeqninterface* create_t();

Loading…
Cancel
Save