preprocessor: clean up writePowerDeriv code. it only writes C code, so no need for use_dll argument
parent
9ec4037fc8
commit
2385b7b5c1
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2003-2015 Dynare Team
|
* Copyright (C) 2003-2016 Dynare Team
|
||||||
*
|
*
|
||||||
* This file is part of Dynare.
|
* This file is part of Dynare.
|
||||||
*
|
*
|
||||||
|
@ -684,9 +684,9 @@ DataTree::writePowerDerivCHeader(ostream &output) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DataTree::writePowerDeriv(ostream &output, bool use_dll) const
|
DataTree::writePowerDeriv(ostream &output) const
|
||||||
{
|
{
|
||||||
if (use_dll && isBinaryOpUsed(oPowerDeriv))
|
if (isBinaryOpUsed(oPowerDeriv))
|
||||||
output << "/*" << endl
|
output << "/*" << endl
|
||||||
<< " * The k-th derivative of x^p" << endl
|
<< " * The k-th derivative of x^p" << endl
|
||||||
<< " */" << endl
|
<< " */" << endl
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2003-2015 Dynare Team
|
* Copyright (C) 2003-2016 Dynare Team
|
||||||
*
|
*
|
||||||
* This file is part of Dynare.
|
* 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 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 */
|
/*! Returns 0 if the symbol is not used */
|
||||||
int minLagForSymbol(int symb_id) const;
|
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;
|
void writePowerDerivCHeader(ostream &output) const;
|
||||||
//! Write getPowerDeriv
|
//! Write getPowerDeriv in C
|
||||||
void writePowerDeriv(ostream &output, bool use_dll) const;
|
void writePowerDeriv(ostream &output) const;
|
||||||
//! Thrown when trying to access an unknown variable by deriv_id
|
//! Thrown when trying to access an unknown variable by deriv_id
|
||||||
class UnknownDerivIDException
|
class UnknownDerivIDException
|
||||||
{
|
{
|
||||||
|
|
|
@ -1624,7 +1624,7 @@ DynamicModel::writeDynamicCFile(const string &dynamic_basename, const int order)
|
||||||
// Writing the function body
|
// Writing the function body
|
||||||
writeDynamicModel(mDynamicModelFile, true, false);
|
writeDynamicModel(mDynamicModelFile, true, false);
|
||||||
|
|
||||||
writePowerDeriv(mDynamicModelFile, true);
|
writePowerDeriv(mDynamicModelFile);
|
||||||
mDynamicModelFile.close();
|
mDynamicModelFile.close();
|
||||||
|
|
||||||
mDynamicMexFile.open(filename_mex.c_str(), ios::out | ios::binary);
|
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()
|
<< model_output.str()
|
||||||
<< "}" << endl;
|
<< "}" << endl;
|
||||||
|
|
||||||
writePowerDeriv(mDynamicModelFile, true);
|
writePowerDeriv(mDynamicModelFile);
|
||||||
mDynamicModelFile.close();
|
mDynamicModelFile.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4880,8 +4880,6 @@ DynamicModel::writeFirstDerivativesC(const string &basename, bool cuda) const
|
||||||
|
|
||||||
mDynamicModelFile << "}" << endl;
|
mDynamicModelFile << "}" << endl;
|
||||||
|
|
||||||
// already written in writeResidualsC()
|
|
||||||
// writePowerDeriv(mDynamicModelFile, true);
|
|
||||||
mDynamicModelFile.close();
|
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;
|
<< "for (i=0; i < " << row_ptr.size() + 1 << "; i++) row_ptr[i] = row_ptr_data[i];" << endl;
|
||||||
mDynamicModelFile << "}" << endl;
|
mDynamicModelFile << "}" << endl;
|
||||||
|
|
||||||
// writePowerDeriv(mDynamicModelFile, true);
|
|
||||||
mDynamicModelFile.close();
|
mDynamicModelFile.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5077,7 +5074,7 @@ DynamicModel::writeSecondDerivativesC_csr(const string &basename, bool cuda) con
|
||||||
|
|
||||||
mDynamicModelFile << "}" << endl;
|
mDynamicModelFile << "}" << endl;
|
||||||
|
|
||||||
writePowerDeriv(mDynamicModelFile, true);
|
writePowerDeriv(mDynamicModelFile);
|
||||||
mDynamicModelFile.close();
|
mDynamicModelFile.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5203,7 +5200,7 @@ DynamicModel::writeThirdDerivativesC_csr(const string &basename, bool cuda) cons
|
||||||
|
|
||||||
mDynamicModelFile << "}" << endl;
|
mDynamicModelFile << "}" << endl;
|
||||||
|
|
||||||
writePowerDeriv(mDynamicModelFile, true);
|
writePowerDeriv(mDynamicModelFile);
|
||||||
mDynamicModelFile.close();
|
mDynamicModelFile.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1616,7 +1616,7 @@ StaticModel::writeStaticCFile(const string &func_name) const
|
||||||
writeStaticModel(output, true, false);
|
writeStaticModel(output, true, false);
|
||||||
output << "}" << endl << endl;
|
output << "}" << endl << endl;
|
||||||
|
|
||||||
writePowerDeriv(output, true);
|
writePowerDeriv(output);
|
||||||
output.close();
|
output.close();
|
||||||
|
|
||||||
output.open(filename_mex.c_str(), ios::out | ios::binary);
|
output.open(filename_mex.c_str(), ios::out | ios::binary);
|
||||||
|
|
Loading…
Reference in New Issue