00001 #ifndef SUNDANCECOMPUTETHREAD_H 00002 #define SUNDANCECOMPUTETHREAD_H 00003 00004 #include "SundanceDefs.h" 00005 00006 #include "ComputeThread.h" 00007 #include "SundanceHandler.h" 00008 #include "XMLInterface.h" 00009 #include "StaticLinearProblem.h" 00010 #include "ExprHashtable.h" 00011 #include "Mutex.h" 00012 00013 00014 namespace Sundance 00015 { 00016 00017 using namespace TSF; 00018 using std::string; 00019 00020 using std::ostream; 00021 00022 00023 class SundanceComputeThread : public ComputeThread 00024 { 00025 public: 00026 SundanceComputeThread(); 00027 00028 virtual void go(); 00029 00030 virtual string name() {return "Sundance";} 00031 00032 void setupLinearSystem(const XMLObject& in, XMLObject& out); 00033 00034 void getInitialGuess(const XMLObject& in, XMLObject& out); 00035 00036 void solveLinearSystem(const XMLObject& in, XMLObject& out); 00037 00038 void norm(const XMLObject& in, XMLObject& out); 00039 00040 void daxpy(const XMLObject& in, XMLObject& out); 00041 00042 void assignVector(const XMLObject& in, XMLObject& out); 00043 00044 void writeVector(const XMLObject& in, XMLObject& out); 00045 00046 void killVector(const XMLObject& in, XMLObject& out); 00047 00048 void terminate(const XMLObject& in, XMLObject& out); 00049 00050 protected: 00051 00052 const Expr& getExpr(const string& name) const ; 00053 void putExpr(const string& name, const Expr& e); 00054 void removeExpr(const string& name); 00055 00056 StaticLinearProblem prob_; 00057 int fidCounter_; 00058 Mutex exprLock_; 00059 ExprHashtable exprTable_; 00060 }; 00061 00062 extern "C" 00063 { 00064 ComputeThread* createEmptySundanceComputeThread(); 00065 } 00066 00067 } 00068 #endif