void CFunctionAnalysisTestDlg::SetFunctionArray(CFunctionDefArray& functionVector)
	{

		//Set Function Array
		m_outputCtrl.m_functionVector = functionVector;

		//Set Input Variables
		m_inputCtrl.m_variableVector.clear();

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

			for (unsigned int t = 0; t < parser.getNbUsedVars(); t++)
			{
				string name = UTF8(parser.getUsedVar(t));
				MakeUpper(name);

				//if (nameList.Lookup(name) == -1)
				if (std::find(nameList.begin(), nameList.end(), name) == nameList.end())
				{
					nameList.push_back(name);
					m_inputCtrl.m_variableVector.push_back(UtilWin::ToUTF8(parser.getUsedVar(t)));
				}
			}
		}
	}
	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;
	}