AppLauncher.h

00001 #ifndef APPLAUNCHER_H
00002 #define APPLAUNCHER_H
00003 
00004 #ifdef HAVE_CONFIG_H
00005 #include "OPT++_config.h"
00006 #endif
00007 
00008 #include <iostream>
00009 #include <string>
00010 
00011 #include <dlfcn.h>
00012 #include <unistd.h>
00013 #include <sys/wait.h>
00014 #ifdef HAVE_STD
00015 #include <cstdio>
00016 #include <cstring>
00017 #else
00018 #include <stdio.h>
00019 #include <string.h>
00020 #endif
00021 
00022 #include "xercesc/dom/DOM.hpp"
00023 #include "xercesc/util/PlatformUtils.hpp"
00024 
00025 #include "BoundConstraint.h"
00026 #include "NonLinearEquation.h"
00027 #include "CompoundConstraint.h"
00028 #include "VariableList.h"
00029 
00030 using std::string;
00031 
00032 namespace OPTPP {
00033 
00034 class AppLauncher
00035 {
00036         private: 
00037 
00038                 string appName_;
00039                  string appInput_;
00040                  string appOutput_;
00041                  static string appDir_;
00042                  VariableList * variables_;
00043 
00044         public:
00046                 AppLauncher(){;}
00047 
00049                 AppLauncher(DOMElement* appXML, bool createDir);
00050 
00052                 AppLauncher(DOMElement* appXML,
00053                             VariableList& variables, bool createDir);
00054                 
00055                 
00057                 void init_app(int ndim, NEWMAT::ColumnVector& x);
00058 
00060                 static void init_app(int ndim, NEWMAT::ColumnVector& x, AppLauncher * launcher)
00061                 {
00062                         launcher->init_app(ndim, x);
00063                 }
00064 
00066                 void run_app(int ndim, const NEWMAT::ColumnVector& x, double& fx, int& result);
00067                 
00069                 static void run_app(int ndim, const NEWMAT::ColumnVector& x, double& fx, 
00070                                         int& result, AppLauncher * launcher)
00071                 {
00072                         launcher->run_app(ndim, x, fx, result);
00073                 }
00074 
00076                 void run_app_nlncon(int ndim, int nlncons, const NEWMAT::ColumnVector& x, NEWMAT::ColumnVector& fx, int& result);
00077 
00079                 static void run_app_nlncon(int ndim, int nlncons, const NEWMAT::ColumnVector& x, NEWMAT::ColumnVector& fx, 
00080                                         int& result, AppLauncher * launcher)
00081                 {
00082                         launcher->run_app_nlncon(ndim, nlncons, x, fx, result);
00083                 }
00084 
00086                 void RunFunctionEvaluation(int ndim, const NEWMAT::ColumnVector & x);
00087                 int setupin(int ndim, const NEWMAT::ColumnVector& x,
00088                             const char *fileName);
00089                 int substitute_value(char *newLine, char *line,
00090                                      const char *pattern, double value);
00091 };      
00092 
00093 } // namespace OPTPP
00094 #endif
Generated on Mon Jan 24 12:04:37 2011 for FASTlib by  doxygen 1.6.3