diff --git a/DynamicModel.cc b/DynamicModel.cc index 6d68eb425167406201447388941225f7b8c08c30..20f8eb2cb3711f1075a02ff20d451f9763c692f0 100644 --- a/DynamicModel.cc +++ b/DynamicModel.cc @@ -1731,6 +1731,24 @@ DynamicModel::reform(const string name1) const return (name); } +void +DynamicModel::getNonZeroHessianEquations(map<int, string> &eqs) const +{ + for (second_derivatives_t::const_iterator it = second_derivatives.begin(); + it != second_derivatives.end(); it++) + if (eqs.find(it->first.first) == eqs.end()) + { + eqs[it->first.first] = ""; + for (size_t i = 0; i < equation_tags.size(); i++) + if (equation_tags[i].first == it->first.first) + if (equation_tags[i].second.first == "name") + { + eqs[it->first.first] = equation_tags[i].second.second; + break; + } + } +} + void DynamicModel::Write_Inf_To_Bin_File_Block(const string &dynamic_basename, const string &bin_basename, const int &num, int &u_count_int, bool &file_open, bool is_two_boundaries) const diff --git a/DynamicModel.hh b/DynamicModel.hh index 9c0e670ff2c0c48d5b3eb51bd573302847da8b48..6b99423c705da7b71e4944a1a8792c82a4878e00 100644 --- a/DynamicModel.hh +++ b/DynamicModel.hh @@ -220,6 +220,9 @@ public: //! Return true if the hessian is equal to zero inline bool checkHessianZero() const; + //! Return equations that have non-zero second derivatives + void getNonZeroHessianEquations(map<int, string> &eqs) const; + //! Adds informations for simulation in a binary file void Write_Inf_To_Bin_File_Block(const string &dynamic_basename, const string &bin_basename, const int &num, int &u_count_int, bool &file_open, bool is_two_boundaries) const; diff --git a/ModFile.cc b/ModFile.cc index 414a51308b9eb330998240011dbff77f185f1fef..e828fa45e8a3d4282dbf4a7ee2a419de8644d09a 100644 --- a/ModFile.cc +++ b/ModFile.cc @@ -536,7 +536,17 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, bool compute_xr if (linear && !dynamic_model.checkHessianZero()) { - cerr << "ERROR: If the model is declared linear the second derivatives must be equal to zero." << endl; + map<int, string> eqs; + dynamic_model.getNonZeroHessianEquations(eqs); + cerr << "ERROR: If the model is declared linear the second derivatives must be equal to zero." << endl + << " The following equations had non-zero second derivatives:" << endl; + for (map<int, string >::const_iterator it = eqs.begin(); it != eqs.end(); it++) + { + cerr << " * Eq # " << it->first+1; + if (!it->second.empty()) + cerr << " [" << it->second << "]"; + cerr << endl; + } exit(EXIT_FAILURE); } }