pontron 3 years ago
parent
commit
99510195f5
4 changed files with 20 additions and 14 deletions
  1. 12
    8
      main.cpp
  2. 7
    4
      solver.cpp
  3. 1
    1
      solver.h
  4. 0
    1
      sysosndan.cpp

+ 12
- 8
main.cpp View File

@@ -10,11 +10,11 @@
int main(int argc, char* argv[])
{
draghilevinout Dinout(argc, argv);
sys_osn_dan DATA(Dinout.mystreamin);
sys_diff_equation A(DATA);
sys_osn_dan DATA(Dinout.mystreamin);
sys_diff_equation A(DATA);
//double t0=clock();//START_TIMER;

solver_diff_eqn B(DATA, Dinout.nocomp.getValue(), true, Dinout.exit.getValue());
solver_diff_eqn B(DATA, Dinout.nocomp.getValue(), Dinout.exit.getValue());
Dinout.checkdel();
//STOP_TIMER
@@ -53,12 +53,16 @@ DEFUN_DLD (draghilev_oct, args, , "Draghilev method")
}
bool not_comp=args.length() == 0 || (args.length() != 0 && args(0).int_value() != 1);

bool exit_=false;
if ( args.length() == 3)
exit_=true;
solver_diff_eqn B(DATA, not_comp, false, exit_);//false, уже файл сформировали
if ( exit_ )
N=B.get_coord().size();
double exit_tol;
if ( args.length() == 3)
{
exit_=true;
exit_tol=args(2).double_value();
}
solver_diff_eqn B(DATA, not_comp, exit_, exit_tol);
int nrow=B.get_coord().size()/N_var;
int t=0;
Matrix res_matrix(nrow, N_var);

+ 7
- 4
solver.cpp View File

@@ -1,6 +1,6 @@
#include "solver.h"

solver_diff_eqn::solver_diff_eqn(sys_osn_dan &sod_, const bool not_comp_, const bool not_octave_, const bool exit_):sod(&sod_)
solver_diff_eqn::solver_diff_eqn(sys_osn_dan &sod_, const bool not_comp_, const bool exit_, double exit_tol):sod(&sod_)
{
N=sod->get_par_diff().N;
dt=sod->get_par_diff().dt;
@@ -54,9 +54,12 @@ solver_diff_eqn::solver_diff_eqn(sys_osn_dan &sod_, const bool not_comp_, const
}
m_diff=std::max_element(c_diff.begin(), c_diff.end());
m_pos=std::distance(c_diff.begin(), m_diff);
if ( *m_diff < 2e-3*max_x[m_pos] )
i=N;

if ( *m_diff < exit_tol*max_x[m_pos] )
{
i=N;
sod->set_par_diff(i,dt);
}
}
}


+ 1
- 1
solver.h View File

@@ -13,7 +13,7 @@ typedef void (*func_t)(const state_type &, state_type &, const double );
class solver_diff_eqn
{
public:
solver_diff_eqn(sys_osn_dan &, const bool, const bool, const bool);
solver_diff_eqn(sys_osn_dan &, const bool, const bool, double exit_tol=2e-3);
~solver_diff_eqn();
const state_type &get_coord() { return coordinate; }


+ 0
- 1
sysosndan.cpp View File

@@ -30,7 +30,6 @@ sys_osn_dan::sys_osn_dan(std::stringstream &mystreamin_)
equations.push_back(str);
}


N_var=x.size(); //число переменных
int N_ex=equations.size(); //число уравнений
n_svob=1; //число свободных переменных

Loading…
Cancel
Save