preprocessor: clean up writePowerDeriv code. it only writes C code, so no need for use_dll argument

issue#70
Houtan Bastani 2016-10-14 14:30:14 +02:00
parent 9ec4037fc8
commit 2385b7b5c1
4 changed files with 12 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2015 Dynare Team
* Copyright (C) 2003-2016 Dynare Team
*
* This file is part of Dynare.
*
@ -684,9 +684,9 @@ DataTree::writePowerDerivCHeader(ostream &output) const
}
void
DataTree::writePowerDeriv(ostream &output, bool use_dll) const
DataTree::writePowerDeriv(ostream &output) const
{
if (use_dll && isBinaryOpUsed(oPowerDeriv))
if (isBinaryOpUsed(oPowerDeriv))
output << "/*" << endl
<< " * The k-th derivative of x^p" << endl
<< " */" << endl

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2015 Dynare Team
* Copyright (C) 2003-2016 Dynare Team
*
* This file is part of Dynare.
*
@ -235,10 +235,10 @@ public:
//! Returns the minimum lag (as a negative number) of the given symbol in the whole data tree (and not only in the equations !!)
/*! Returns 0 if the symbol is not used */
int minLagForSymbol(int symb_id) const;
//! Write the Header for getPowerDeriv when use_dll is used
//! Write the C Header for getPowerDeriv when use_dll is used
void writePowerDerivCHeader(ostream &output) const;
//! Write getPowerDeriv
void writePowerDeriv(ostream &output, bool use_dll) const;
//! Write getPowerDeriv in C
void writePowerDeriv(ostream &output) const;
//! Thrown when trying to access an unknown variable by deriv_id
class UnknownDerivIDException
{

View File

@ -1624,7 +1624,7 @@ DynamicModel::writeDynamicCFile(const string &dynamic_basename, const int order)
// Writing the function body
writeDynamicModel(mDynamicModelFile, true, false);
writePowerDeriv(mDynamicModelFile, true);
writePowerDeriv(mDynamicModelFile);
mDynamicModelFile.close();
mDynamicMexFile.open(filename_mex.c_str(), ios::out | ios::binary);
@ -4823,7 +4823,7 @@ DynamicModel::writeResidualsC(const string &basename, bool cuda) const
<< model_output.str()
<< "}" << endl;
writePowerDeriv(mDynamicModelFile, true);
writePowerDeriv(mDynamicModelFile);
mDynamicModelFile.close();
}
@ -4880,8 +4880,6 @@ DynamicModel::writeFirstDerivativesC(const string &basename, bool cuda) const
mDynamicModelFile << "}" << endl;
// already written in writeResidualsC()
// writePowerDeriv(mDynamicModelFile, true);
mDynamicModelFile.close();
}
@ -4984,7 +4982,6 @@ DynamicModel::writeFirstDerivativesC_csr(const string &basename, bool cuda) cons
<< "for (i=0; i < " << row_ptr.size() + 1 << "; i++) row_ptr[i] = row_ptr_data[i];" << endl;
mDynamicModelFile << "}" << endl;
// writePowerDeriv(mDynamicModelFile, true);
mDynamicModelFile.close();
}
@ -5077,7 +5074,7 @@ DynamicModel::writeSecondDerivativesC_csr(const string &basename, bool cuda) con
mDynamicModelFile << "}" << endl;
writePowerDeriv(mDynamicModelFile, true);
writePowerDeriv(mDynamicModelFile);
mDynamicModelFile.close();
}
@ -5203,7 +5200,7 @@ DynamicModel::writeThirdDerivativesC_csr(const string &basename, bool cuda) cons
mDynamicModelFile << "}" << endl;
writePowerDeriv(mDynamicModelFile, true);
writePowerDeriv(mDynamicModelFile);
mDynamicModelFile.close();
}

View File

@ -1616,7 +1616,7 @@ StaticModel::writeStaticCFile(const string &func_name) const
writeStaticModel(output, true, false);
output << "}" << endl << endl;
writePowerDeriv(output, true);
writePowerDeriv(output);
output.close();
output.open(filename_mex.c_str(), ios::out | ios::binary);