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

nach langer Fehlersuche ...

parent 3199b3b1
No related branches found
No related tags found
No related merge requests found
......@@ -81,17 +81,14 @@ void NCurveFile::Create( bool refers_to_data )
COlc f;
uint np = T.npar(CRef::_FP);
for( uint ip=0; ip<np; ip++ ){
f.PCo.push_back(CCoord("p" + strg(ip), ""));
f.PCo.push_back( CCoord("p" + strg(ip), "") );
f.Fixed.push_back( 0 );
f.weight_y_log = false;
f.expr = expr;
f.T = T;
f.lDoc.push_back( "cc " + expr );
}
f.weight_y_log = false;
f.expr = expr;
f.T = T;
f.lDoc.push_back( "cc " + expr );
vector<double> P( np, 1.0 );
cout << "DEB: " << P.size() << "\n";
cout << "DEB: " << T.tree_info() << "\n";
cout << "DEB: " << f.lDoc.size() << "\n";
// use f to create output file(s)
if( refers_to_data ){
......@@ -128,9 +125,6 @@ void NCurveFile::Create( bool refers_to_data )
fout.VC.push_back( sout );
NOlm::SelNew();
NOlm::OloAdd( &fout );
cout << "DEB: " << fout.VC[0].P.size() << "\n";
cout << "DEB: " << fout.T.tree_info() << "\n";
cout << "DEB: " << fout.lDoc.size() << "\n";
}
}
......@@ -543,9 +537,15 @@ void NCurveFile::Integrate(void)
}
NOlm::IterateC fiter;
bool reset_if_savable = true;
const COlc* fin;
while( (fin=fiter()) ){
if( fin->ZCo.size()>0 && reset_if_savable ){
NOlm::SelNew();
reset_if_savable = false;
}
if( isdigit(mode[0]) || mode=="*" ){ // extract parameter(s)
// decode list of parameter numbers
CList parsel( mode, CLimits( 0, fin->nPar()-1 ) );
......@@ -565,7 +565,6 @@ void NCurveFile::IntegrateFile( const COlc *fin, const int k,
const string mode, const int ip,
const string name )
{
NOlm::SelNew();
COld fout;
CScan S;
......@@ -649,10 +648,10 @@ double NCurveFile::NumericIntegral( const COlc *fc, const CCurve *c,
double low, hig;
if( numint_bound_low!="!" && !mystd::any2dbl( numint_bound_low, &low ) )
throw string( "invalid lower integration bound" );
if( numint_bound_hig!="!" && !mystd::any2dbl( numint_bound_hig, &hig ) )
throw string( "invalid upper integration bound" );
if( numint_bound_low!="!" && mystd::any2dbl( numint_bound_low, &low ) )
throw "invalid lower integration bound (" + numint_bound_low + ")";
if( numint_bound_hig!="!" && mystd::any2dbl( numint_bound_hig, &hig ) )
throw "invalid upper integration bound (" + numint_bound_hig + ")";
if ( numint_bound_low=="!" && numint_bound_hig=="!" )
gsl_integration_qagi( &F,
......
......@@ -36,6 +36,35 @@ int xaxerror( const char *s ) /* Called by yyparse on error */
//* (references, typically used as endpoints of CTree's) *//
//***************************************************************************//
//! Trivia, needed to manage objects that depend on CRef member pointers
void CRef::clean()
{
if (tk) delete tk;
if (tj) delete tj;
if (ti) delete ti;
}
void CRef::copy( const CRef& R2 )
{
var = R2.var;
num = R2.num;
if (R2.tk) { tk = new CTree (); *tk = *(R2.tk); } else tk=0;
if (R2.tj) { tj = new CTree (); *tj = *(R2.tj); } else tj=0;
if (R2.ti) { ti = new CTree (); *ti = *(R2.ti); } else ti=0;
}
CRef& CRef::operator=( const CRef& R2 )
{
if( this==&R2 )
return *this;
clean();
copy( R2 );
return *this;
}
CRef::CRef(string s,
class CTree *tk_in, class CTree *tj_in, class CTree *ti_in)
// NOTE: As long as this constructor is called by the parser and not
......@@ -99,23 +128,6 @@ CRef::CRef(string s,
}
}
CRef::~CRef()
{
if (tk) delete tk;
if (tj) delete tj;
if (ti) delete ti;
}
CRef& CRef::operator=(const CRef& R2)
{
var = R2.var;
num = R2.num;
if (R2.tk) { tk = new CTree (); *tk = *(R2.tk); } else tk=0;
if (R2.tj) { tj = new CTree (); *tj = *(R2.tj); } else tj=0;
if (R2.ti) { ti = new CTree (); *ti = *(R2.ti); } else ti=0;
return *this;
}
int CRef::ref_val(void *ret, const CContext *ctx ) const
{
uint i,j,k;
......@@ -432,7 +444,26 @@ string CRef::ref_info(void) const
//* class CTree *//
//***************************************************************************//
CTree& CTree::operator=( const CTree& T2 )
//! Trivia, needed to manage objects that depend on CTree member pointers
void CTree::clean()
{
switch(typ) {
case _TEROP:
delete arg3;
case _BINOP:
delete arg2;
case _MONOP:
delete arg1;
break;
case _REF:
delete ref;
default:
;
}
}
void CTree::copy( const CTree& T2 )
{
typ = T2.typ;
switch (typ) {
......@@ -466,11 +497,23 @@ CTree& CTree::operator=( const CTree& T2 )
ref = new CRef();
*ref = *(T2.ref);
break;
case _NOTREE: // reference
printf("PROGRAM ERROR: T2.typ=_NOTREE in CTree::operator=(T2)\n");
cout << "press RETURN, or ^C to return to gdb\n";
scanf("\n");
default:
printf("PROGRAM ERROR: T2.typ undefined in CTree::operator=(T2)\n");
printf("HARDCORE ERROR: T2.typ undefined in CTree::operator=(T2)\n");
cout << "press RETURN, or ^C to return to gdb\n";
scanf("\n");
}
}
CTree& CTree::operator=( const CTree& T2 )
{
if( this==&T2 )
return *this;
clean();
copy( T2 );
return *this;
}
......
......@@ -35,9 +35,13 @@ class CRef {
CRef( const string s="",
class CTree* tk_in=0, class CTree* tj_in=0, class CTree* ti_in=0);
~CRef();
CRef& operator=(const CRef&);
// pointer management trivia:
void clean();
void copy( const CRef& );
~CRef() { clean(); }
CRef( const CRef& R2 ) { copy(R2); };
CRef& operator=( const CRef& );
inline bool defined() const {
return var!=_NOREF; };
......@@ -139,23 +143,15 @@ class CTree {
: typ(_REF), fun(0), ref(ref_in) {};
inline CTree( CRef* ref_in, CTree* a1 )
: typ(_FRF), fun(0), ref(ref_in), arg1(a1) {};
inline ~CTree() {
switch(typ) {
case _TEROP:
delete arg3;
case _BINOP:
delete arg2;
case _MONOP:
delete arg1;
break;
case _REF:
delete ref;
default:
;
}
};
// pointer management trivia:
void clean();
void copy( const CTree& );
~CTree() { clean(); }
CTree( const CTree& T2 ) { copy(T2); };
CTree& operator=( const CTree& );
int tree_val( double *ret, const CContext *ctx ) const;
int tree_val(
double *ret, const class COlo* f=0,
......
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