Overview
Comment:Rationalisation of solver code, beginning with algebraic solvers.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: b94fab9d42565e9d2563291ff1feefa40c1f4167d789b34fbca8d8013026082e
User & Date: geraint@users.sourceforge.net on 2001-08-08 02:15:00
Other Links: branch diff | manifest | tags
Context
2001-08-08
03:16:08
Rationalisation of solver code, fixed ctors. check-in: ddee3fea10 user: geraint@users.sourceforge.net tags: origin/master, trunk
02:15:00
Rationalisation of solver code, beginning with algebraic solvers. check-in: b94fab9d42 user: geraint@users.sourceforge.net tags: origin/master, trunk
2001-08-07
04:39:24
Consolidated dassl and residual functions. check-in: 73c9075b6a user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt from [e33b09b50e] to [7f08bc493b].

13
14
15
16
17
18
19



20
21
22
23
24
25
26
# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$



## Revision 1.321  2001/07/27 23:43:34  geraint
## Added -cc to usage options (required for use with xmtt).
##
## Revision 1.320  2001/07/27 23:38:38  geraint
## Changed comment below (# SUMMARY) - fixes xmtt.
##
## Revision 1.319  2001/07/27 23:29:10  geraint







>
>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.322  2001/08/01 04:06:07  geraint
## Added -i dassl for -cc and -oct.
##
## Revision 1.321  2001/07/27 23:43:34  geraint
## Added -cc to usage options (required for use with xmtt).
##
## Revision 1.320  2001/07/27 23:38:38  geraint
## Changed comment below (# SUMMARY) - fixes xmtt.
##
## Revision 1.319  2001/07/27 23:29:10  geraint
2352
2353
2354
2355
2356
2357
2358

2359
2360
2361
2362
2363
2364
2365
2366
2367
$1_ode2odes_dassl.o	: $1_ode.o	$1_odeo.o	mtt_dassl.o
	@echo "Creating \$@"
	ar -cr \$@ \$^
$1_ode2odes_dassl.oct	: $1_ode.oct	$1_odeo.oct	mtt_dassl.oct
	@echo > /dev/null

mtt_Solver.cc:	mtt_Solver.hh

$1_ode2odes_${algebraic_solver}.cc:	mtt_Solver.cc mtt_${algebraic_solver}.hh mtt_${algebraic_solver}.cc
$1_ode2odes_${algebraic_solver}.o:	mtt_Solver.o mtt_${algebraic_solver}.o
	@echo "Creating $1_ode2odes_${algebraic_solver}.o"
	ar -cr \$@ \$^

#SUMMARY numpar	numerical parameter declaration (m) 
$1_numpar.m:  $1_numpar.txt $1_sympars.txt
	mtt_txt2m $1 numpar








>
|
|







2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
$1_ode2odes_dassl.o	: $1_ode.o	$1_odeo.o	mtt_dassl.o
	@echo "Creating \$@"
	ar -cr \$@ \$^
$1_ode2odes_dassl.oct	: $1_ode.oct	$1_odeo.oct	mtt_dassl.oct
	@echo > /dev/null

mtt_Solver.cc:	mtt_Solver.hh
mtt_AlgebraicSolver.cc: mtt_AlgebraicSolver.hh
$1_ode2odes_${algebraic_solver}.cc:	mtt_Solver.cc mtt_AlgebraicSolver.cc mtt_${algebraic_solver}.hh mtt_${algebraic_solver}.cc
$1_ode2odes_${algebraic_solver}.o:	mtt_Solver.o  mtt_AlgebraicSolver.o  mtt_${algebraic_solver}.o
	@echo "Creating $1_ode2odes_${algebraic_solver}.o"
	ar -cr \$@ \$^

#SUMMARY numpar	numerical parameter declaration (m) 
$1_numpar.m:  $1_numpar.txt $1_sympars.txt
	mtt_txt2m $1 numpar

2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710

2711
2712
2713
2714
2715
2716
2717
$1_ode2odes.o: $1_ode2odes.cc $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o
	echo Creating $1_ode2odes.o
	${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $1_ode2odes.cc -DSTANDALONE

$1_ode2odes.oct: $1_ode2odes.cc $1_ode2odes_common.oct $1_ode2odes_${integration_method}.oct $1_ode2odes_${algebraic_solver}.o
	touch $1_ode2odes.m
	echo Creating $1_ode2odes.oct
	$MKOCTFILE $1_ode2odes.cc mtt_${algebraic_solver}.cc mtt_Solver.cc

$1_ode2odes.cc: $1_def.r $1_sympars.txt\
		$1_ode2odes_common.m $1_ode2odes_common.cc\
		$1_ode2odes_${integration_method}.m $1_ode2odes_${integration_method}.cc mtt_Solver.cc mtt_${algebraic_solver}.cc mtt_${algebraic_solver}.hh

	touch $1_ode2odes.m
	make_ode2odes $1 cc $integration_method $algebraic_solver

#Conversion of m to p to c
#SUMMARY ode	ordinary differential equations (c)
#SUMMARY ode	ordinary differential equations (p)
#SUMMARY state	state declaration (c) 







|



|
>







2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
$1_ode2odes.o: $1_ode2odes.cc $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o
	echo Creating $1_ode2odes.o
	${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $1_ode2odes.cc -DSTANDALONE

$1_ode2odes.oct: $1_ode2odes.cc $1_ode2odes_common.oct $1_ode2odes_${integration_method}.oct $1_ode2odes_${algebraic_solver}.o
	touch $1_ode2odes.m
	echo Creating $1_ode2odes.oct
	$MKOCTFILE $1_ode2odes.cc mtt_${algebraic_solver}.cc mtt_Solver.cc mtt_AlgebraicSolver.cc

$1_ode2odes.cc: $1_def.r $1_sympars.txt\
		$1_ode2odes_common.m $1_ode2odes_common.cc\
		$1_ode2odes_${integration_method}.m $1_ode2odes_${integration_method}.cc\
		mtt_Solver.cc mtt_AlgebraicSolver.cc mtt_${algebraic_solver}.cc mtt_${algebraic_solver}.hh
	touch $1_ode2odes.m
	make_ode2odes $1 cc $integration_method $algebraic_solver

#Conversion of m to p to c
#SUMMARY ode	ordinary differential equations (c)
#SUMMARY ode	ordinary differential equations (p)
#SUMMARY state	state declaration (c) 

Modified mttroot/mtt/bin/trans/make_ode2odes from [72d882798e] to [f3196ec53c].

1
2
3
4
5
6
7
8
9
10
11



12
13
14
15
16
17
18
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
    ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## Revision 1.62  2001/08/01 22:14:32  geraint
## Bug fix for dassl.
##
## Revision 1.61  2001/08/01 04:06:07  geraint
## Added -i dassl for -cc and -oct.
##
## Revision 1.60  2001/07/16 22:23:00  geraint











>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
    ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.63  2001/08/07 04:39:24  geraint
## Consolidated dassl and residual functions.
##
## Revision 1.62  2001/08/01 22:14:32  geraint
## Bug fix for dassl.
##
## Revision 1.61  2001/08/01 04:06:07  geraint
## Added -i dassl for -cc and -oct.
##
## Revision 1.60  2001/07/16 22:23:00  geraint
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547

inline ColumnVector
mtt_input (ColumnVector &x,
	   ColumnVector &y,
	   const double &t,
	   ColumnVector &par)
{
  static ${algebraic_solver} ae(mtt_ae,MTTNPAR,MTTNU,MTTNX,MTTNY,MTTNYZ);
  static ColumnVector u  (MTTNU);

#ifdef STANDALONE
  u = F${sys}_input (x, y, t, par);
#else
  static octave_value_list args, f;
  args (0) = octave_value (x);







|







536
537
538
539
540
541
542
543
544
545
546
547
548
549
550

inline ColumnVector
mtt_input (ColumnVector &x,
	   ColumnVector &y,
	   const double &t,
	   ColumnVector &par)
{
  static MTT::${algebraic_solver} ae(MTTNPAR,MTTNU,MTTNX,MTTNY,MTTNYZ);
  static ColumnVector u  (MTTNU);

#ifdef STANDALONE
  u = F${sys}_input (x, y, t, par);
#else
  static octave_value_list args, f;
  args (0) = octave_value (x);

Added mttroot/mtt/lib/cc/mtt_AlgebraicSolver.cc version [04698e6717].



































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

#include "mtt_AlgebraicSolver.hh"

ColumnVector
MTT::AlgebraicSolver::solve (const ColumnVector	&x,
			     const ColumnVector	&u,
			     const double	&t,
			     const ColumnVector	&par)
{
  if (_nyz > 0)
    {
      _x = x;
      _uui.insert(u,0);
      _t = t;
      _par = par;
      _ui = ColumnVector(_nyz,1.0);
      Solve();
      _uui.insert(_ui,_nu);
    }
  else
    {
      _uui = u;
    }
  return _uui;
}

ColumnVector
MTT::AlgebraicSolver::eval (const ColumnVector	&ui)
{
  if (_nyz > 0)
    _uui.insert(ui,_nu);
  return mtt_ae(_x,_uui,_t,_par);
}

Added mttroot/mtt/lib/cc/mtt_AlgebraicSolver.hh version [6b5fc39cda].



































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

#ifndef MTT_ALGEBRAICSOLVER
#define MTT_ALGEBRAICSOLVER


#include "mtt_Solver.hh"


namespace MTT
{
  class AlgebraicSolver : public MTT::Solver
  {
  public:

    AlgebraicSolver (const int npar,
		     const int nu,
		     const int nx,
		     const int ny,
		     const int nyz)
      : MTT::Solver (npar,nu,nx,ny,nyz)
    {;}

    ColumnVector
    solve (const ColumnVector	&x,
	   const ColumnVector	&u,
	   const double		&t,
	   const ColumnVector	&par);

    ColumnVector
    eval (const ColumnVector	&ui);

    virtual ~AlgebraicSolver (void) {};

  protected:

    virtual void
    Solve (void) = 0;
  };
}


extern ColumnVector
mtt_ae(ColumnVector	&x,
       ColumnVector	&u,
       const double	&t,
       ColumnVector	&par);


#endif // MTT_ALGEBRAICSOLVER

Modified mttroot/mtt/lib/cc/mtt_HJ_Solver.hh from [0452c911f4] to [c5aaf93148].

1




2
3



4
5
6
7
8
9
10
11
12
13
14
15
16
17

18


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53








#include "mtt_Solver.hh"




class HJ_Solver : public Solver {

  // http://www.netlib.org/opt/hooke.c
  // Hooke and Jeeves solution
  
public:
  
  HJ_Solver (sys_ae ae,
	     const int npar,
	     const int nu,
	     const int nx,
	     const int ny,
	     const int nyz)
    : Solver (ae,npar,nu,nx,ny,nyz)

  { static_ptr = this; VARS = nyz; };


  
  static double
  f (double tryUi[], int nyz);
  
  ~HJ_Solver (void) {};

protected:

  void
  Solve (void);

  double
  best_nearby (double    	delta[],
	       double   	point[],
	       double   	prevbest,
	       int      	nvars);
  
  int
  hooke (int	nvars,			  // MTTNYZ
	 double	startpt[],		  // user's initial guess
	 double	endpt[],		  // result
	 double	rho		= 0.05,	  // geometric shrink factor
	 double	epsilon		= 1e-3,	  // end value stepsize
	 int	itermax		= 5000);  // max # iterations 

private:

  int VARS;

public:

  static HJ_Solver *static_ptr;

};





>
>
>
>
|

>
>
>
|
|
|
|
|
|

<
|
|
|
|
|
|
>
|
>
>

|
|

|

|

|
|

|
|
|
|
|

|
|
|
|
|
|
|

|

|
|
|

|
|
|
|
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

#ifndef MTT_HJSOLVER
#define MTT_HJSOLVER


#include "mtt_AlgebraicSolver.hh"


namespace MTT
{
  class HJ_Solver : public MTT::AlgebraicSolver
  {
    // http://www.netlib.org/opt/hooke.c
    // Hooke and Jeeves solution

  public:
  

    HJ_Solver (const int npar,
	       const int nu,
	       const int nx,
	       const int ny,
	       const int nyz)
      : MTT::AlgebraicSolver (npar,nu,nx,ny,nyz)
    {
      static_ptr = this;
      VARS = nyz;
    }
  
    static double
    f (double tryUi[], int nyz);
  
    ~HJ_Solver (void) {};

  protected:

    void
    Solve (void);

    double
    best_nearby (double    	delta[],
		 double   	point[],
		 double   	prevbest,
		 int      	nvars);
  
    int
    hooke (int		nvars,			  // MTTNYZ
	   double	startpt[],		  // user's initial guess
	   double	endpt[],		  // result
	   double	rho		= 0.05,	  // geometric shrink factor
	   double	epsilon		= 1e-3,	  // end value stepsize
	   int		itermax		= 5000);  // max # iterations 

  private:

    int VARS;
    
  public:

    static HJ_Solver *static_ptr;
    
  };
}


#endif // MTT_HJSOLVER

Modified mttroot/mtt/lib/cc/mtt_Hybrd_Solver.cc from [db6613b9c5] to [c09f3d3f20].

1
2
3
4
5
6


7




8



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

#include "mtt_Hybrd_Solver.hh"

// http://www.netlib.org/minpack/hybrd.f
// used by Octave's fsolve
  


Hybrd_Solver *Hybrd_Solver::static_ptr;








ColumnVector
Hybrd_Solver::f_hybrd (const ColumnVector &tryUi)
{
  Hybrd_Solver::static_ptr->_yz = Hybrd_Solver::static_ptr->eval(tryUi);
  return Hybrd_Solver::static_ptr->_yz;
}

void
Hybrd_Solver::Solve (void)
{    
  int info;
  static int input_errors;
  static int user_errors;
  static int convergences;
  static int progress_errors;
  static int limit_errors;





|
>
>
|
>
>
>
>
|
>
>
>

|

|
|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

#include "mtt_Hybrd_Solver.hh"

// http://www.netlib.org/minpack/hybrd.f
// used by Octave's fsolve

MTT::Hybrd_Solver *MTT::Hybrd_Solver::static_ptr;

MTT::Hybrd_Solver (const int npar,
		   const int nu,
		   const int nx,
		   const int ny,
		   const int nyz)
{
  static_ptr = this;
}

ColumnVector
MTT::Hybrd_Solver::f_hybrd (const ColumnVector &tryUi)
{
  MTT::Hybrd_Solver::static_ptr->_yz = MTT::Hybrd_Solver::static_ptr->eval(tryUi);
  return MTT::Hybrd_Solver::static_ptr->_yz;
}

void
MTT::Hybrd_Solver::Solve (void)
{    
  int info;
  static int input_errors;
  static int user_errors;
  static int convergences;
  static int progress_errors;
  static int limit_errors;
60
61
62
63
64
65
66
67
		<< "  converge (" << convergences << ") "
		<< "  progress (" << progress_errors << ") "
		<< "  limit (" << limit_errors << ")"
		<< "  unknown (" << unknown_errors << ")"
		<< "  (max error = " << std::abs(eval(_ui).max()) << ")" << std::endl;
    }
}








<
69
70
71
72
73
74
75

		<< "  converge (" << convergences << ") "
		<< "  progress (" << progress_errors << ") "
		<< "  limit (" << limit_errors << ")"
		<< "  unknown (" << unknown_errors << ")"
		<< "  (max error = " << std::abs(eval(_ui).max()) << ")" << std::endl;
    }
}

Modified mttroot/mtt/lib/cc/mtt_Hybrd_Solver.hh from [a398dadfdb] to [3fc28c8a1a].

1


2

3

4



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

36
37
38




#include "mtt_Solver.hh"

#include <octave/NLEqn.h>





class Hybrd_Solver : public Solver {

  // http://www.netlib.org/minpack/hybrd.f
  // used by Octave's fsolve
  
public:

  Hybrd_Solver (sys_ae ae,
		const int npar,
		const int nu,
		const int nx,
		const int ny,
		const int nyz)
  : Solver (ae,npar,nu,nx,ny,nyz)
  {
    static_ptr = this;
  }

  static ColumnVector
  f_hybrd (const ColumnVector &tryUi);

  ~Hybrd_Solver (void) {};

protected:

  void
  Solve (void);

public:

  static Hybrd_Solver *static_ptr;


};



>
>
|
>

>

>
>
>
|
|
|
|
|
|

|
<
|
|
|
|
|
<
<
<

|
|

|

|

|
|
|
|
|
|
>
|
|

>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
23
24



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

#ifndef MTT_HYBRDSOLVER
#define MTT_HYBRDSOLVER


#include <octave/NLEqn.h>
#include "mtt_AlgebraicSolver.hh"


namespace MTT
{
  class Hybrd_Solver : public MTT::AlgebraicSolver
  {
    // http://www.netlib.org/minpack/hybrd.f
    // used by Octave's fsolve
    
  public:

    Hybrd_Solver (const int npar,

		  const int nu,
		  const int nx,
		  const int ny,
		  const int nyz)
      : MTT::AlgebraicSolver (npar,nu,nx,ny,nyz);




    static ColumnVector
    f_hybrd (const ColumnVector &tryUi);

    ~Hybrd_Solver (void) {};

  protected:

    void
    Solve (void);
    
  public:
    
    static Hybrd_Solver *static_ptr;
  };
}


#endif // MTT_HYBRDSOLVER

Modified mttroot/mtt/lib/cc/mtt_Reduce_Solver.cc from [f538a6f60b] to [b7f38e13b6].

1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20

#include "mtt_Reduce_Solver.hh"


void
Reduce_Solver::Solve (void)
{
  //  std::cerr << "Error:"
  //	    << " Symbolic solution of equations failed during model build" << std::endl
  //	    << "       Try using one of the other algebraic solution methods" << std::endl;

}

ColumnVector
Reduce_Solver::solve (const ColumnVector	&x,
		      const ColumnVector	&u,
		      const double		&t,
		      const ColumnVector	&par)
{
  return u;
}



<

|

<
<
<
>



|
|
|
|



1
2
3

4
5
6



7
8
9
10
11
12
13
14
15
16
17

#include "mtt_Reduce_Solver.hh"


void
MTT::Reduce_Solver::Solve (void)
{



  ;
}

ColumnVector
MTT::Reduce_Solver::solve (const ColumnVector	&x,
			   const ColumnVector	&u,
			   const double		&t,
			   const ColumnVector	&par)
{
  return u;
}

Modified mttroot/mtt/lib/cc/mtt_Reduce_Solver.hh from [69ab00e508] to [635ef51478].

1




2
3



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

31
32
33






#include "mtt_Solver.hh"




class Reduce_Solver : public Solver {

  // Dummy class
  // This will not be used unless the Reduce solver has failed earlier
  // in the model build process

public:

  Reduce_Solver (sys_ae ae,
		 const int npar,
		 const int nu,
		 const int nx,
		 const int ny,
		 const int nyz)
    : Solver (ae,npar,nu,nx,ny,nyz)
  { ; };
	
  void
  Solve (void);

  ColumnVector
  solve (const ColumnVector	&x,
	 const ColumnVector	&u,
	 const double		&t,
	 const ColumnVector	&par);

  ~Reduce_Solver (void) {};


};
   


>
>
>
>
|

>
>
>
|
|
|
|
|

|
|
|
<
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
>
|
|
|
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

#ifndef MTT_REDUCESOLVER
#define MTT_REDUCESOLVER


#include "mtt_AlgebraicSolver.hh"


namespace MTT
{
  class Reduce_Solver : public MTT::AlgebraicSolver
  {
    // Dummy class
    // This will not be used unless the Reduce solver has failed earlier
    // in the model build process

  public:
    
    Reduce_Solver (const int npar,

		   const int nu,
		   const int nx,
		   const int ny,
		   const int nyz)
      : AlgebraicSolver (npar,nu,nx,ny,nyz)
    {;}
	
    void
    Solve (void);
    
    ColumnVector
    solve (const ColumnVector	&x,
	   const ColumnVector	&u,
	   const double		&t,
	   const ColumnVector	&par);
    
    ~Reduce_Solver (void) {};
  };
}


#endif // MTT_REDUCESOLVER 

Modified mttroot/mtt/lib/cc/mtt_Solver.cc from [3335bb6d91] to [effe0746c4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

#include "mtt_Solver.hh"

Solver::Solver (sys_ae ae,
		const int npar,
		const int nu,
		const int nx,
		const int ny,
		const int nyz)
{
  _ae  = ae;
  _np  = npar; 
  _nu  = nu;
  _nx  = nx;
  _ny  = ny;
  _nyz = nyz;

  _uui = ColumnVector (_nu+_nyz);
};

ColumnVector
Solver::solve (const ColumnVector	&x,
	       const ColumnVector	&u,
	       const double		&t,
	       const ColumnVector	&par)
{
  _x = x;
  _uui.insert(u,0);
  _t = t;
  _par = par;
  _ui = ColumnVector(_nyz,1.0);
  Solve ();
  _uui.insert(_ui,_nu);
  return _uui;
}    

ColumnVector
Solver::eval (const ColumnVector &ui)
{
  _uui.insert(ui,_nu);
  return _ae (_x, _uui, _t, _par);
}



<
|
|
|
|
|

<





<


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
1
2
3

4
5
6
7
8
9

10
11
12
13
14

15
16
























#include "mtt_Solver.hh"


MTT::Solver::Solver (const int npar,
		     const int nu,
		     const int nx,
		     const int ny,
		     const int nyz)
{

  _np  = npar; 
  _nu  = nu;
  _nx  = nx;
  _ny  = ny;
  _nyz = nyz;

  _uui = ColumnVector (_nu+_nyz);
};























Modified mttroot/mtt/lib/cc/mtt_Solver.hh from [12e52b9aa6] to [2a39ed71ca].

1
2
3

4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63

#ifndef MTT_SOLVER
#define MTT_SOLVER


#include <cmath>
#include <cstdlib>
#include <iostream>

#include <octave/oct.h>

class Solver {


protected:
  typedef ColumnVector (*sys_ae) // pointer to F${sys}_ae function
    (ColumnVector &,ColumnVector &,const double &t,ColumnVector &);

public:

  Solver (sys_ae ae,
	  const int npar,
	  const int nu,
	  const int nx,
	  const int ny,
	  const int nyz);

  ColumnVector
  solve (const ColumnVector	&x,
	 const ColumnVector	&u,
	 const double		&t,
	 const ColumnVector	&par);
  
  ColumnVector
  eval (const ColumnVector	&ui);

  virtual ~Solver (void) {};
  
protected:
  
  virtual void
  Solve (void) = 0;

protected:

  ColumnVector			_x;
  ColumnVector			_uui;
  double			_t;
  ColumnVector			_par;

  ColumnVector  		_ui;
  ColumnVector          	_yz;

  int   			_nu;
  int				_np;
  int				_nx;
  int				_ny;
  int				_nyz;

  
  sys_ae			_ae;

};

#endif // MTT_SOLVER




>







|
>
|
<
|
<
|
|

<
|
|
|
|
|

<
<
<
<
<
<
<
<
<
|

|
|
<
<
<
<
<
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
<

<
|


1
2
3
4
5
6
7
8
9
10
11
12
13
14

15

16
17
18

19
20
21
22
23
24









25
26
27
28





29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

44

45
46
47

#ifndef MTT_SOLVER
#define MTT_SOLVER


#include <cmath>
#include <cstdlib>
#include <iostream>

#include <octave/oct.h>


namespace MTT
{

  class Solver

  {
  public:


    Solver (const int npar,
	    const int nu,
	    const int nx,
	    const int ny,
	    const int nyz);










    virtual ~Solver (void) {};
  
  protected:
    





    ColumnVector       		_x;
    ColumnVector	       	_uui;
    double			_t;
    ColumnVector	       	_par;
    
    ColumnVector  		_ui;
    ColumnVector          	_yz;
    
    int   			_nu;
    int				_np;
    int				_nx;
    int				_ny;
    int				_nyz;
  };
}



  
#endif // MTT_SOLVER


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]