//-------------------------------------------------------------------------------------------------
double BenchMTParser::DoBenchmark(const std::string& sExpr, long iCount)
{
   double a = 1.1;
   double b = 2.2;
   double c = 3.3;
   double x = 2.123456;
   double y = 3.123456;
   double z = 4.123456;
   double w = 5.123456;

   MTParser p;
   p.defineVar("a", &a);
   p.defineVar("b", &b);
   p.defineVar("c", &b);

   p.defineVar("x", &x);
   p.defineVar("y", &y);
   p.defineVar("z", &z);
   p.defineVar("w", &w);

   p.defineConst("e", M_E);
   p.defineConst("pi", M_PI);

   double fTime = 0;
   double fRes = 0;
   double fSum = 0;

   try
   {
      p.compile(sExpr.c_str());
      fRes = p.evaluate();

      StartTimer();

      for (int j = 0;j<iCount; ++j)
      {
         fSum += p.evaluate();
         std::swap(a,b);
         std::swap(x,y);
      }

      StopTimer(fRes, fSum, iCount);
   }
   catch(MTParserException &e)
   {
      StopTimerAndReport(e.getDesc(0).c_str());
   }

   return m_fTime1;
}
	ERMsg COutputGridCtrl::Execute(const CModelInput& modelInput)
	{
		ERMsg msg;

		for (size_t i = 0; i < m_functionVector.size(); i++)
		{
			MTParser parser;
			parser.defineFunc(CreateGetJDayFct());
			parser.defineFunc(CreateDropYearFct());
			parser.defineConst(_T("VMISS"), VMISS);
			parser.enableAutoVarDefinition(true);
			parser.compile(UtilWin::Convert(m_functionVector[i].m_equation));

			vector<double> vars(parser.getNbUsedVars());

			for (unsigned int t = 0; t < parser.getNbUsedVars(); t++)
			{
				int pos = modelInput.FindVariable(UtilWin::ToUTF8(parser.getUsedVar(t)));
				ASSERT(pos >= 0);

				vars[t] = modelInput[pos].GetDouble();
				parser.redefineVar(parser.getUsedVar(t).c_str(), &(vars[t]));
			}

			double value = parser.evaluate();

			QuickSetText(0, (int)i, UtilWin::ToCString(value));
		}


		RedrawAll();

		return msg;
	}