00001
00002
00003 #ifndef TessToolSender_h
00004 #define TessToolSender_h
00005
00006 #include <vector>
00007 #include <string>
00008 #include "mpi.h"
00009 #include "MPIStreamFilter.h"
00010 #include "MPICommunicationSession.h"
00011 #include "RecordType.h"
00012 #include "RecordOutputStream.h"
00013 #include "Tessellation.h"
00014
00015
00016
00017 namespace BIE {
00018
00019 class LikelihoodComputation;
00020
00021
00023 class TessToolSender {
00024 public:
00025
00027 TessToolSender(string name, bool remote=false);
00028
00029
00031 TessToolSender(bool remote);
00032
00033
00035 TessToolSender();
00036
00038 ~TessToolSender();
00039
00040 void Synchronize();
00041 void Detach();
00042 void SetSessionId(int level, int step);
00043 void SetLikelihoodComputation(LikelihoodComputation *);
00044 MPI_Comm GetMPIComm();
00045
00046 void SetRecordType(RecordType *rt);
00047 void SetMPIStream(RecordOutputStream *mpistrm);
00048 void SetMPIFilter(MPIStreamFilter *filter);
00049 void SetMPISession(MPICommunicationSession *session) {_session = session;};
00050
00051 RecordType *GetRecordType();
00052 RecordOutputStream *GetMPIStream();
00053 MPIStreamFilter *GetMPIFilter();
00054 MPICommunicationSession *GetMPISession() {return _session; };
00055 void persistTessellation();
00056 bool attachFilter(RecordStreamFilter* fil, int stackindex);
00057 bool attachFilter(RecordStreamFilter* fil);
00058 bool attachSelectionFilter(vector<string> fil, int stackindex);
00059 bool attachSelectionFilter(vector<string> fil);
00060 bool printFilterChain();
00061 bool reinitializeFilterChain();
00062 bool attachMPIFilter();
00063 bool replaceFilter(RecordStreamFilter* fil, int stackindex);
00064 bool attachDefaultFunctionSelectionFilter();
00065
00066 private:
00067 bool _remote;
00068
00069 void init();
00070 void writeTessellationStore(Tessellation *tess);
00071 template<class T> void insertInVector(vector<T>& vec, int index, T item);
00072
00073 char *_port;
00074 char *_name;
00075 MPI_Comm _tessComm;
00076 LikelihoodComputation *_likely;
00077
00078
00079 RecordType *_rt;
00080 RecordOutputStream *_mpistrm;
00081 MPIStreamFilter *_filter;
00082
00083 vector <RecordOutputStream*> _inputStreams;
00084 vector <RecordStreamFilter*> _filters;
00085 vector < vector<string> > _selectionFilters;
00086 vector <bool> _isSelectionFilter;
00087 vector <RecordOutputStream*> _filteredStreams;
00088 bool _mpiStreamCreated, _mpiFilterAttached,
00089 _defaultFunctionSelectionFilterAttached;
00090
00091 MPICommunicationSession *_session;
00092
00093 int _sessionId;
00094 int _level, _step, _iter;
00095
00096
00097 bool _persistedTessellation;
00098 };
00099 }
00100
00101 #endif