Skip to content
Snippets Groups Projects
Commit 0fc169b8 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

calculator: k-dependent list iff appropriate

parent d74191ea
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ Release 2.1.3a ...@@ -2,7 +2,7 @@ Release 2.1.3a
- interface changes: - interface changes:
- command modifier "=" (overwrite) must now be appended - command modifier "=" (overwrite) must now be appended
- calculator mode no longer separate: FRIDA _is_ a pocket calculator - calculator mode merged with main menu: FRIDA _is_ now a pocket calculator
Release 2.1.2a of 20feb11: Release 2.1.2a of 20feb11:
......
...@@ -30,7 +30,7 @@ void NCalc::Calculator( string s ) ...@@ -30,7 +30,7 @@ void NCalc::Calculator( string s )
user_xaxparse( s.c_str(), &T ); user_xaxparse( s.c_str(), &T );
NOlm::IterateO fiter; NOlm::IterateO fiter;
if( fiter.size()==0 ) { if( fiter.size()==0 || !T->k_dependent() ) {
T->tree_point_val( &ret, &dret ); T->tree_point_val( &ret, &dret );
printf("%.12g", ret); printf("%.12g", ret);
if( dret ) if( dret )
......
...@@ -858,7 +858,7 @@ void NEdif::MakeGrid() ...@@ -858,7 +858,7 @@ void NEdif::MakeGrid()
S->x.resize(ni); S->x.resize(ni);
for( uint i=0; i<ni; ++i ) for( uint i=0; i<ni; ++i )
S->x[i] = ((double)i)/(ni+1); S->x[i] = ((double)i)/ni;
S->y.clear(); S->y.clear();
S->y.resize( ni, 0. ); S->y.resize( ni, 0. );
......
...@@ -465,6 +465,32 @@ void CTree::npar_exec( uint *np ) const ...@@ -465,6 +465,32 @@ void CTree::npar_exec( uint *np ) const
} }
//! Does the result depend on k?
bool CTree::k_dependent() const
{
bool kd=false;
kdep_exec( &kd );
return kd;
}
//! Implementation with pointer argument to allow recursion.
void CTree::kdep_exec( bool *kd ) const
{
if ( typ == _OP || typ == _CONV || typ == _DIRAC )
for ( uint iarg=0; iarg<narg; ++iarg )
arg[iarg]->kdep_exec( kd );
else if ( typ == _VAL || typ == _DUMMY || typ == _CEV )
; // do nothing
else if ( typ == _REF ) {
*kd = true;
} else
throw string( "BUG: kdep(UNDEF)" );
}
//! Does expression contain dummy argument t ? //! Does expression contain dummy argument t ?
bool CTree::has_dummy() const bool CTree::has_dummy() const
......
...@@ -108,6 +108,7 @@ class CTree { ...@@ -108,6 +108,7 @@ class CTree {
static void setConv( uint& kconv, uint& jconv, uint k, uint j ); static void setConv( uint& kconv, uint& jconv, uint k, uint j );
uint npar() const; uint npar() const;
bool k_dependent() const;
bool has_dummy() const; bool has_dummy() const;
void tree_val ( CResult& ret, const CContext& ctx ) const; void tree_val ( CResult& ret, const CContext& ctx ) const;
...@@ -125,4 +126,5 @@ class CTree { ...@@ -125,4 +126,5 @@ class CTree {
private: private:
void npar_exec( uint *np ) const; void npar_exec( uint *np ) const;
void kdep_exec( bool *kd ) const;
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment