00001
00002
00003
00004 #ifndef Integration_h
00005 #define Integration_h
00006
00007 #include "Model.h"
00008 #include "Tile.h"
00009 #include "Distribution.h"
00010
00011
00012 #include <mpi.h>
00013
00014 #include "Serializable.h"
00015
00016
00017 namespace BIE {
00018
00019 class LikelihoodComputation;
00020
00021
00029 class Integration: public Serializable
00030 {
00031
00032 public:
00033
00037 Integration() {
00038 Setup();
00039 }
00040
00042 virtual ~Integration() {};
00043
00047 void Setup() {};
00048
00050 virtual double NormValue(Model* m, Tile* t, SampleDistribution* d) = 0;
00051
00053 virtual vector<double> Value(Model* m, Tile *t, SampleDistribution* d) = 0;
00054
00056 virtual double NormValue(LikelihoodComputation* p_likelihoodCompuation,
00057 Model* p_model, Tile* p_tile,
00058 SampleDistribution* p_dist)
00059 {cout << "This integrator has not been added into the tile-point parallelization framework yet\n";
00060 exit(1);
00061 }
00062
00064 virtual vector<double> Value(LikelihoodComputation* p_likelihoodCompuation,
00065 Model* p_model, Tile* p_tile,
00066 SampleDistribution* p_dist)
00067 {cout << "This integrator has not been added into the tile-point parallelization framework yet\n";
00068 exit(1);
00069 }
00070
00072
00073 virtual double NormValue(Model* m, Tile* t, SampleDistribution* d,
00074 int irank, int nrank) = 0;
00075
00077 virtual vector<double> Value(Model* m, Tile *t, SampleDistribution* d,
00078 int irank, int nrank, MPI_Comm& comm) = 0;
00079
00081
00082 protected:
00084 vector<double> absError;
00086 vector<double> relativeError;
00087
00088
00089 private:
00090 friend class boost::serialization::access;
00091 template<class Archive>
00092 void serialize(Archive & ar, const unsigned int version) {
00093 this->pre_serialize(ar, version);
00094 try {
00095 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Serializable);
00096 BIE_CATCH_BOOST_SERIALIZATION_EXCEPTION;
00097 }
00098 try {
00099 ar & BOOST_SERIALIZATION_NVP(absError);
00100 BIE_CATCH_BOOST_SERIALIZATION_EXCEPTION;
00101 }
00102 try {
00103 ar & BOOST_SERIALIZATION_NVP(relativeError);
00104 BIE_CATCH_BOOST_SERIALIZATION_EXCEPTION;
00105 }
00106 this->post_serialize(ar, version);
00107 }
00108
00109 };
00110 }
00111
00112 BIE_CLASS_EXPORT_KEY(BIE::Integration)
00113 #endif