LibCudaOptimize  1.0
FitnessSet.h
Go to the documentation of this file.
00001 //*************************************************************************//
00002 //                                                                         //
00003 //  LibCudaOptimize                                                        //
00004 //  Copyright (C) 2012 Ibislab, University of Parma                        //
00005 //  Authors: Youssef S.G. Nashed, Roberto Ugolotti                         //
00006 //                                                                         //
00007 //  You should have received a copy of the GNU General Public License      //
00008 //  along with this program.  If not, see <http://www.gnu.org/licenses/>   //
00009 //                                                                         //
00010 //*************************************************************************//
00011 
00012 #ifndef FITNESS_SET_H
00013 #define FITNESS_SET_H
00014 
00017 #include "utilities.h"
00018 
00021 #define LIBCUDAOPTIMIZE_NAMESPACE CudaOptimize
00022 
00023 #define OPEN_NAMESPACE namespace LIBCUDAOPTIMIZE_NAMESPACE {
00024 
00025 #define CLOSE_NAMESPACE }
00026 
00027 #ifdef LIBCUDAOPTIMIZE_NAMESPACE
00028 OPEN_NAMESPACE
00029 #endif
00030 
00032 typedef enum
00033 {
00034         DEVICE_POINTER, 
00035         HOST_POINTER    
00036 } POINTER_LOCATION;
00037 
00039 #define ALL_SETS (unsigned int)-1
00040 
00041 #define ALL_SOLUTIONS (unsigned int)-1
00042 
00049 class FitnessSet
00050 {
00051 
00052 private:
00053 
00054     float*       m_dFitnesses;
00055     unsigned int m_setNumber;
00056     unsigned int m_solutionNumber;
00057 
00058     std::string  m_loggerFile;
00059 
00060 public:
00061 
00062     FitnessSet();
00066     FitnessSet(unsigned int sn, unsigned int pn);
00067     ~FitnessSet();
00068 
00075     void set(float* ptr, POINTER_LOCATION loc = HOST_POINTER, unsigned int sid = ALL_SETS, unsigned int pid = ALL_SOLUTIONS);
00079         void setPtr(float* ptr) {m_dFitnesses = ptr;}
00085     float* get(unsigned int sid = ALL_SETS, unsigned int pid = ALL_SOLUTIONS);
00091     const float* get(unsigned int sid = ALL_SETS, unsigned int pid = ALL_SOLUTIONS) const;
00097     void init(unsigned int sn, unsigned int pn, std::string logger="");
00100     void free();
00101 
00102 };
00103 
00104 #ifdef LIBCUDAOPTIMIZE_NAMESPACE
00105 CLOSE_NAMESPACE
00106 #endif
00107 
00108 #endif
 All Classes Files Functions Variables Enumerations Enumerator Defines