Add PEO for the tag, and update main CMakeLists and findParadisEO
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2726 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
aca78b998a
commit
009d0cda1f
188 changed files with 18942 additions and 9 deletions
|
|
@ -63,6 +63,9 @@ set(MOEO_BIN_DIR "${CMAKE_BINARY_DIR}/moeo" CACHE PATH "ParadisEO-MOEO binary di
|
|||
set(SMP_SRC_DIR "${CMAKE_SOURCE_DIR}/smp" CACHE PATH "ParadisEO-SMP source directory" FORCE)
|
||||
set(SMP_BIN_DIR "${CMAKE_BINARY_DIR}/smp" CACHE PATH "ParadisEO-SMP binary directory" FORCE)
|
||||
|
||||
set(PEO_SRC_DIR "${CMAKE_SOURCE_DIR}/peo" CACHE PATH "ParadisEO-PEO source directory" FORCE)
|
||||
set(PEO_BIN_DIR "${CMAKE_BINARY_DIR}/peo" CACHE PATH "ParadisEO-PEO binary directory" FORCE)
|
||||
|
||||
set(PROBLEMS_SRC_DIR "${CMAKE_SOURCE_DIR}/problems" CACHE PATH "Problems dependant source directory" FORCE)
|
||||
|
||||
set(CMAKE_BASE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
|
||||
|
|
@ -89,6 +92,13 @@ if(NOT EO_ONLY)
|
|||
set(CMAKE_SOURCE_DIR ${SMP_SRC_DIR})
|
||||
add_subdirectory(${SMP_SRC_DIR})
|
||||
endif()
|
||||
|
||||
## PEO Module
|
||||
if(PEO)
|
||||
set(PEO_MODULE_NAME "ParadisEO-PEO")
|
||||
set(CMAKE_SOURCE_DIR ${PEO_SRC_DIR})
|
||||
add_subdirectory(${PEO_SRC_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
######################################################################################
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
# - flowshop
|
||||
# - moeo
|
||||
# - smp
|
||||
# - peo
|
||||
# You can use find_package(Paradiseo COMPONENTS ... ) to enable one or several components. If you not specifie component, all components will be load except SMP for compatibility reasons.
|
||||
#
|
||||
# Output
|
||||
|
|
@ -56,7 +57,7 @@ set(PARADISEO_SRC_PATHS
|
|||
/opt/csw/ # Blastwave
|
||||
/opt/
|
||||
[KEY_CURRENT_USER\\Software\\Inria\\ParadisEO]
|
||||
[HKEY_LOCAL_MACHINE\\Software\\Inria\\ParadiseEO]
|
||||
[HKEY_LOCAL_MACHINE\\Software\\Inria\\ParadisEO]
|
||||
)
|
||||
|
||||
find_path(EO_INCLUDE_DIR eo
|
||||
|
|
@ -71,20 +72,29 @@ find_path(MOEO_INCLUDE_DIR moeo
|
|||
PATH_SUFFIXES include${INSTALL_SUB_DIR}/moeo moeo/src
|
||||
PATHS ${PARADISEO_SRC_PATHS})
|
||||
|
||||
# Specific for SMP
|
||||
# Specific for SMP and PEO
|
||||
foreach(COMP ${PARADISEO_LIBRARIES_TO_FIND})
|
||||
if(${COMP} STREQUAL "smp")
|
||||
set(SMP_FOUND true)
|
||||
find_path(SMP_INCLUDE_DIR smp
|
||||
PATH_SUFFIXES include${INSTALL_SUB_DIR}/smp smp/src
|
||||
PATHS ${PARADISEO_SRC_PATHS})
|
||||
elseif(${COMP} STREQUAL "peo")
|
||||
set(PEO_FOUND true)
|
||||
find_path(PEO_INCLUDE_DIR peo
|
||||
PATH_SUFFIXES include${INSTALL_SUB_DIR}/peo peo/src
|
||||
PATHS ${PARADISEO_SRC_PATHS})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
||||
set(PARADISEO_INCLUDE_DIR ${EO_INCLUDE_DIR} ${MO_INCLUDE_DIR} ${MOEO_INCLUDE_DIR})
|
||||
|
||||
if(SMP_FOUND)
|
||||
set(PARADISEO_INCLUDE_DIR ${EO_INCLUDE_DIR} ${MO_INCLUDE_DIR} ${MOEO_INCLUDE_DIR} ${SMP_INCLUDE_DIR})
|
||||
else()
|
||||
set(PARADISEO_INCLUDE_DIR ${EO_INCLUDE_DIR} ${MO_INCLUDE_DIR} ${MOEO_INCLUDE_DIR})
|
||||
set(PARADISEO_INCLUDE_DIR ${PARADISEO_INCLUDE_DIR} ${SMP_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if(PEO_FOUND)
|
||||
set(PARADISEO_INCLUDE_DIR ${PARADISEO_INCLUDE_DIR} ${PEO_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
# find the requested modules
|
||||
|
|
@ -100,7 +110,7 @@ set(FIND_PARADISEO_LIB_PATHS
|
|||
/opt/csw/ # Blastwave
|
||||
/opt/
|
||||
[KEY_CURRENT_USER\\Software\\Inria\\ParadisEO]
|
||||
[HKEY_LOCAL_MACHINE\\Software\\Inria\\ParadiseEO]
|
||||
[HKEY_LOCAL_MACHINE\\Software\\Inria\\ParadisEO]
|
||||
)
|
||||
|
||||
#Suffixes
|
||||
|
|
@ -110,6 +120,7 @@ set(PARADISEO_LIB_PATHS_SUFFIXES
|
|||
moeo/lib
|
||||
moeo/tutorial/examples/flowshop/lib #For flowshop library
|
||||
smp/lib
|
||||
peo/lib
|
||||
lib
|
||||
lib32
|
||||
lib64
|
||||
|
|
@ -140,9 +151,12 @@ if(PARADISEO_FOUND)
|
|||
message(${EO_INCLUDE_DIR})
|
||||
message(${MO_INCLUDE_DIR})
|
||||
message(${MOEO_INCLUDE_DIR})
|
||||
if(${SMP_FOUND})
|
||||
if(SMP_FOUND)
|
||||
message(${SMP_INCLUDE_DIR})
|
||||
endif()
|
||||
if(PEO_FOUND)
|
||||
message(${PEO_INCLUDE_DIR})
|
||||
endif()
|
||||
else()
|
||||
# include directory or library not found
|
||||
message(FATAL_ERROR "Could NOT find ParadisEO (missing : ${FIND_PARADISEO_MISSING})")
|
||||
|
|
|
|||
3
trunk/peo/AUTHORS
Normal file
3
trunk/peo/AUTHORS
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Alexandru-Adrian Tantar
|
||||
Clive Canape
|
||||
Sébastien Cahon
|
||||
23
trunk/peo/CMakeLists.txt
Normal file
23
trunk/peo/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
######################################################################################
|
||||
### 0) Include dependencies
|
||||
######################################################################################
|
||||
|
||||
find_package(LibXml2 REQUIRED)
|
||||
|
||||
######################################################################################
|
||||
### 0) Include subdirectories
|
||||
######################################################################################
|
||||
|
||||
add_subdirectory(doc)
|
||||
add_subdirectory(src)
|
||||
|
||||
if(ENABLE_CMAKE_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif(ENABLE_CMAKE_TESTING)
|
||||
|
||||
if(ENABLE_CMAKE_EXAMPLE)
|
||||
if(${CMAKE_VERBOSE_MAKEFILE})
|
||||
message("PEO Examples :")
|
||||
endif(${CMAKE_VERBOSE_MAKEFILE})
|
||||
add_subdirectory(tutorial)
|
||||
endif(ENABLE_CMAKE_EXAMPLE)
|
||||
7
trunk/peo/CTestConfig.cmake
Normal file
7
trunk/peo/CTestConfig.cmake
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
set(CTEST_PROJECT_NAME "ParadisEO")
|
||||
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
|
||||
|
||||
set(CTEST_DROP_METHOD "http")
|
||||
set(CTEST_DROP_SITE "cdash.inria.fr")
|
||||
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=ParadisEO")
|
||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||
38
trunk/peo/doc/CMakeLists.txt
Normal file
38
trunk/peo/doc/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
######################################################################################
|
||||
### 0) Documentation
|
||||
######################################################################################
|
||||
|
||||
if(DOXYGEN_FOUND)
|
||||
# Directory where the generation will be launched
|
||||
set(PEO_DOC_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Documentation directory")
|
||||
# Name of the doxygene configuration file
|
||||
set(PEO_DOC_CONFIG_FILE "peo.doxyfile" CACHE PATH "Documentation configuration file")
|
||||
if(DOXYGEN_EXECUTABLE)
|
||||
# Creating the custom target
|
||||
if(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE})
|
||||
add_custom_target(doc-peo
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${PEO_DOC_CONFIG_FILE} 2> /dev/null > /dev/null
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
else(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE})
|
||||
add_custom_target(doc-peo
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${PEO_DOC_CONFIG_FILE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE})
|
||||
endif(DOXYGEN_EXECUTABLE)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${PEO_DOC_CONFIG_FILE}.cmake"
|
||||
"${PEO_DOC_DIR}/${PEO_DOC_CONFIG_FILE}")
|
||||
|
||||
install(
|
||||
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DESTINATION local/share${INSTALL_SUB_DIR}/peo COMPONENT doc
|
||||
PATTERN "CMakeFiles" EXCLUDE
|
||||
PATTERN "cmake_install.cmake" EXCLUDE
|
||||
PATTERN "CTestTestfile.cmake" EXCLUDE
|
||||
PATTERN "Makefile" EXCLUDE
|
||||
PATTERN "peo.cfg" EXCLUDE
|
||||
PATTERN "peo.doxytag" EXCLUDE
|
||||
)
|
||||
else(DOXYGEN_FOUND)
|
||||
message(STATUS "Unable to generate the documentation, Doxygen package not found")
|
||||
endif(DOXYGEN_FOUND)
|
||||
|
||||
239
trunk/peo/doc/peo.doxyfile.cmake
Normal file
239
trunk/peo/doc/peo.doxyfile.cmake
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
# Doxyfile 1.4.7
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = @PACKAGE_NAME@
|
||||
PROJECT_NUMBER = @PACKAGE_VERSION@
|
||||
OUTPUT_DIRECTORY = @CMAKE_BINARY_DIR@/doc
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = NO
|
||||
STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = YES
|
||||
WARNINGS = NO
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = @CMAKE_SOURCE_DIR@
|
||||
FILE_PATTERNS = *.cpp \
|
||||
*.h \
|
||||
NEWS \
|
||||
README
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 3
|
||||
IGNORE_PREFIX = peo
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = YES
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = @EO_BIN_DIR@/doc/eo.doxytag=http://eodev.sourceforge.net/eo/doc/html \
|
||||
@MO_BIN_DIR@/doc/mo.doxytag=@MO_BIN_DIR@/doc/html
|
||||
GENERATE_TAGFILE = @CMAKE_BINARY_DIR@/doc/peo.doxytag
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
||||
24
trunk/peo/src/CMakeLists.txt
Normal file
24
trunk/peo/src/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
######################################################################################
|
||||
### 0) Where must cmake go now ?
|
||||
######################################################################################
|
||||
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(rmc)
|
||||
|
||||
######################################################################################
|
||||
### 3) Look for headers
|
||||
######################################################################################
|
||||
|
||||
file(GLOB HDRS peo)
|
||||
install(FILES ${HDRS} DESTINATION local/include${INSTALL_SUB_DIR}/peo COMPONENT headers)
|
||||
|
||||
######################################################################################
|
||||
### 2) Install directories
|
||||
######################################################################################
|
||||
|
||||
install(DIRECTORY core rmc
|
||||
DESTINATION local/include${INSTALL_SUB_DIR}/peo
|
||||
COMPONENT headers
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
33
trunk/peo/src/core/CMakeLists.txt
Normal file
33
trunk/peo/src/core/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
######################################################################################
|
||||
### 0) Include the sources
|
||||
######################################################################################
|
||||
|
||||
include_directories(${EO_SRC_DIR}/src)
|
||||
include_directories(${MOEO_SRC_DIR}/src)
|
||||
|
||||
######################################################################################
|
||||
### 2) Define your target(s): just the peo library here
|
||||
######################################################################################
|
||||
|
||||
set(CORE_LIB_OUTPUT_PATH ${PEO_BIN_DIR}/lib)
|
||||
set(LIBRARY_OUTPUT_PATH ${CORE_LIB_OUTPUT_PATH})
|
||||
|
||||
set(CORE_SOURCES peo_init.cpp
|
||||
peo_fin.cpp
|
||||
peo_run.cpp
|
||||
peo_param.cpp
|
||||
peo_debug.cpp
|
||||
thread.cpp
|
||||
reac_thread.cpp
|
||||
service.cpp
|
||||
runner.cpp
|
||||
communicable.cpp
|
||||
topology.cpp
|
||||
ring_topo.cpp
|
||||
star_topo.cpp
|
||||
random_topo.cpp
|
||||
complete_topo.cpp)
|
||||
|
||||
add_library(peo STATIC ${CORE_SOURCES})
|
||||
|
||||
install(TARGETS peo ARCHIVE DESTINATION local/${LIB} COMPONENT libraries)
|
||||
111
trunk/peo/src/core/communicable.cpp
Normal file
111
trunk/peo/src/core/communicable.cpp
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* <communicable.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar, Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <cassert>
|
||||
|
||||
#include "communicable.h"
|
||||
|
||||
static std :: vector <Communicable *> key_to_comm (1); /* Vector of registered cooperators */
|
||||
|
||||
static std :: map <const Communicable *, unsigned> comm_to_key; /* Map of registered cooperators */
|
||||
|
||||
unsigned Communicable :: num_comm = 0;
|
||||
|
||||
|
||||
Communicable :: Communicable ()
|
||||
{
|
||||
|
||||
comm_to_key [this] = key = ++ num_comm;
|
||||
key_to_comm.push_back (this);
|
||||
sem_init (& sem_lock, 0, 1);
|
||||
sem_init (& sem_stop, 0, 0);
|
||||
}
|
||||
|
||||
Communicable :: ~ Communicable ()
|
||||
{
|
||||
}
|
||||
|
||||
COMM_ID Communicable :: getKey ()
|
||||
{
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
Communicable * getCommunicable (COMM_ID __key)
|
||||
{
|
||||
|
||||
assert (__key < key_to_comm.size ());
|
||||
return key_to_comm [__key];
|
||||
}
|
||||
|
||||
COMM_ID getKey (const Communicable * __comm)
|
||||
{
|
||||
|
||||
return comm_to_key [__comm];
|
||||
}
|
||||
|
||||
void Communicable :: lock ()
|
||||
{
|
||||
|
||||
sem_wait (& sem_lock);
|
||||
}
|
||||
|
||||
void Communicable :: unlock ()
|
||||
{
|
||||
|
||||
sem_post (& sem_lock);
|
||||
}
|
||||
|
||||
void Communicable :: stop ()
|
||||
{
|
||||
sem_wait (& sem_stop);
|
||||
}
|
||||
|
||||
void Communicable :: resume ()
|
||||
{
|
||||
|
||||
sem_post (& sem_stop);
|
||||
}
|
||||
|
||||
void initCommunicableEnv ()
|
||||
{
|
||||
|
||||
key_to_comm.resize (1);
|
||||
comm_to_key.clear ();
|
||||
Communicable :: num_comm = 0;
|
||||
}
|
||||
79
trunk/peo/src/core/communicable.h
Normal file
79
trunk/peo/src/core/communicable.h
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* <communicable.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar, Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __communicable_h
|
||||
#define __communicable_h
|
||||
|
||||
#include <semaphore.h>
|
||||
|
||||
|
||||
typedef unsigned COMM_ID;
|
||||
|
||||
class Communicable
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
Communicable ();
|
||||
|
||||
virtual ~ Communicable ();
|
||||
|
||||
COMM_ID getKey ();
|
||||
|
||||
void lock (); /* It suspends the current process if the semaphore is locked */
|
||||
void unlock (); /* It unlocks the shared semaphore */
|
||||
|
||||
void stop (); /* It suspends the current process */
|
||||
void resume (); /* It resumes ___________ */
|
||||
|
||||
public :
|
||||
|
||||
static unsigned num_comm;
|
||||
|
||||
protected :
|
||||
|
||||
COMM_ID key;
|
||||
|
||||
sem_t sem_lock;
|
||||
|
||||
sem_t sem_stop;
|
||||
};
|
||||
|
||||
extern void initCommunicableEnv ();
|
||||
|
||||
extern Communicable * getCommunicable (COMM_ID __key);
|
||||
|
||||
#endif
|
||||
56
trunk/peo/src/core/complete_topo.cpp
Normal file
56
trunk/peo/src/core/complete_topo.cpp
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* <complete_topo.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar, Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include "complete_topo.h"
|
||||
|
||||
void CompleteTopology :: setNeighbors (Cooperative * __mig,
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to)
|
||||
{
|
||||
|
||||
__from.clear () ;
|
||||
__to.clear () ;
|
||||
|
||||
for (unsigned i = 0; i < mig.size (); i ++)
|
||||
{
|
||||
if (mig [i] != __mig)
|
||||
{
|
||||
__from.push_back (mig [i]);
|
||||
__to.push_back (mig [i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
52
trunk/peo/src/core/complete_topo.h
Normal file
52
trunk/peo/src/core/complete_topo.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* <complete_topo.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar, Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __complete_topo_h
|
||||
#define __complete_topo_h
|
||||
|
||||
#include "topology.h"
|
||||
|
||||
class CompleteTopology : public Topology
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
void setNeighbors (Cooperative * __mig,
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to);
|
||||
};
|
||||
|
||||
#endif
|
||||
81
trunk/peo/src/core/cooperative.h
Normal file
81
trunk/peo/src/core/cooperative.h
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* <cooperative.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar, Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __cooperative_h
|
||||
#define __cooperative_h
|
||||
|
||||
#include <vector>
|
||||
#include "communicable.h"
|
||||
#include "runner.h"
|
||||
|
||||
typedef unsigned COOP_ID;
|
||||
|
||||
class Cooperative : public Communicable
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
Runner * getOwner ();
|
||||
|
||||
void setOwner (Runner & __runner);
|
||||
|
||||
virtual void pack () = 0;
|
||||
|
||||
virtual void unpack () = 0;
|
||||
|
||||
virtual void packSynchronizeReq () = 0;
|
||||
|
||||
void send (Cooperative * __coop);
|
||||
|
||||
void synchronizeCoopEx ();
|
||||
|
||||
virtual void notifySending ();
|
||||
|
||||
virtual void notifyReceiving ();
|
||||
|
||||
virtual void notifySendingSyncReq ();
|
||||
|
||||
virtual void notifySynchronized ();
|
||||
|
||||
private :
|
||||
|
||||
Runner * owner;
|
||||
|
||||
};
|
||||
|
||||
extern Cooperative * getCooperative (COOP_ID __key);
|
||||
|
||||
#endif
|
||||
83
trunk/peo/src/core/eoPop_mesg.h
Normal file
83
trunk/peo/src/core/eoPop_mesg.h
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* <eoPop_comm.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar, Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __eoPop_mesg_h
|
||||
#define __eoPop_mesg_h
|
||||
|
||||
#include <eoPop.h>
|
||||
|
||||
#include "messaging.h"
|
||||
|
||||
|
||||
template <class EOT> void pack (eoPop <EOT> & __pop)
|
||||
{
|
||||
|
||||
pack ((unsigned) __pop.size ());
|
||||
for (unsigned i = 0; i < __pop.size (); i ++)
|
||||
pack (__pop [i]);
|
||||
}
|
||||
|
||||
template <class EOT> void unpack (eoPop <EOT> & __pop)
|
||||
{
|
||||
|
||||
unsigned n;
|
||||
|
||||
unpack (n);
|
||||
__pop.resize (n);
|
||||
for (unsigned i = 0; i < n; i ++)
|
||||
unpack (__pop [i]);
|
||||
}
|
||||
|
||||
template <class MOEOT> void pack (moeoArchive < MOEOT > & __pop)
|
||||
{
|
||||
|
||||
pack ((unsigned) __pop.size ());
|
||||
for (unsigned i = 0; i < __pop.size (); i ++)
|
||||
pack (__pop [i]);
|
||||
}
|
||||
|
||||
template <class MOEOT> void unpack (moeoArchive < MOEOT > & __pop)
|
||||
{
|
||||
|
||||
unsigned n;
|
||||
|
||||
unpack (n);
|
||||
__pop.resize (n);
|
||||
for (unsigned i = 0; i < n; i ++)
|
||||
unpack (__pop [i]);
|
||||
}
|
||||
|
||||
#endif
|
||||
244
trunk/peo/src/core/eoVector_mesg.h
Normal file
244
trunk/peo/src/core/eoVector_mesg.h
Normal file
|
|
@ -0,0 +1,244 @@
|
|||
/*
|
||||
* <eoVector_comm.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar, Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __eoVector_mesg_h
|
||||
#define __eoVector_mesg_h
|
||||
|
||||
#include <eoVector.h>
|
||||
|
||||
#include <core/moeoVector.h>
|
||||
#include <core/moeoObjectiveVector.h>
|
||||
|
||||
#include "messaging.h"
|
||||
|
||||
|
||||
|
||||
template <class F, class T> void pack (const eoVector <F, T> & __v)
|
||||
{
|
||||
|
||||
if (__v.invalid())
|
||||
{
|
||||
pack((unsigned)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
pack((unsigned)1);
|
||||
pack (__v.fitness ());
|
||||
}
|
||||
|
||||
unsigned len = __v.size ();
|
||||
pack (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
pack (__v [i]);
|
||||
}
|
||||
|
||||
template <class F, class T> void unpack (eoVector <F, T> & __v)
|
||||
{
|
||||
|
||||
unsigned valid;
|
||||
unpack(valid);
|
||||
|
||||
if (! valid)
|
||||
{
|
||||
__v.invalidate();
|
||||
}
|
||||
else
|
||||
{
|
||||
F fit;
|
||||
unpack (fit);
|
||||
__v.fitness (fit);
|
||||
}
|
||||
|
||||
unsigned len;
|
||||
unpack (len);
|
||||
__v.resize (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
unpack (__v [i]);
|
||||
}
|
||||
|
||||
template <class F, class T, class V> void pack (const eoVectorParticle <F, T, V> & __v)
|
||||
{
|
||||
|
||||
if (__v.invalid())
|
||||
{
|
||||
pack((unsigned)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
pack((unsigned)1);
|
||||
pack (__v.fitness ());
|
||||
pack (__v.best());
|
||||
}
|
||||
|
||||
unsigned len = __v.size ();
|
||||
pack (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
pack (__v [i]);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
pack (__v.bestPositions[i]);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
pack (__v.velocities[i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <class F, class T, class V> void unpack (eoVectorParticle <F, T, V> & __v)
|
||||
{
|
||||
|
||||
unsigned valid;
|
||||
unpack(valid);
|
||||
|
||||
if (! valid)
|
||||
{
|
||||
__v.invalidate();
|
||||
}
|
||||
else
|
||||
{
|
||||
F fit;
|
||||
unpack (fit);
|
||||
__v.fitness (fit);
|
||||
unpack(fit);
|
||||
__v.best(fit);
|
||||
|
||||
}
|
||||
unsigned len;
|
||||
unpack (len);
|
||||
__v.resize (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
unpack (__v [i]);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
unpack (__v.bestPositions[i]);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
unpack (__v.velocities[i]);
|
||||
}
|
||||
|
||||
|
||||
template <class Traits, class Type> void unpack (moeoObjectiveVector<Traits,Type> _objVec)
|
||||
{
|
||||
unsigned int len;
|
||||
|
||||
unpack (len);
|
||||
_objVec.resize(len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
unpack (_objVec[i]);
|
||||
}
|
||||
|
||||
|
||||
template <class Traits, class Type> void pack (const moeoObjectiveVector<Traits,Type> & _objVec)
|
||||
{
|
||||
unsigned int len = _objVec.nObjectives();
|
||||
pack(len);
|
||||
for (unsigned i=0; i<len; i++)
|
||||
pack(_objVec[i]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
template <class F, class T, class V, class W> void pack (moeoVector <F,T,V,W> &_v)
|
||||
{
|
||||
if (_v.invalid())
|
||||
pack((unsigned)0);
|
||||
else
|
||||
{
|
||||
pack((unsigned)1);
|
||||
pack (_v.fitness ());
|
||||
}
|
||||
if (_v.invalidDiversity())
|
||||
pack((unsigned)0);
|
||||
else
|
||||
{
|
||||
pack((unsigned)1);
|
||||
pack(_v.diversity());
|
||||
}
|
||||
unsigned len = _v.size ();
|
||||
pack (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
pack (_v[i]);
|
||||
if (_v.invalidObjectiveVector())
|
||||
pack((unsigned)0);
|
||||
else
|
||||
{
|
||||
pack((unsigned)1);
|
||||
F object;
|
||||
object=_v.objectiveVector();
|
||||
len=object.nObjectives();
|
||||
pack (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
pack (object[i]);
|
||||
}
|
||||
}
|
||||
|
||||
template <class F, class T, class V, class W> void unpack (moeoVector <F,T,V,W> &_v)
|
||||
{
|
||||
unsigned valid;
|
||||
unpack(valid);
|
||||
if (! valid)
|
||||
_v.invalidate();
|
||||
else
|
||||
{
|
||||
T fit;
|
||||
unpack (fit);
|
||||
_v.fitness (fit);
|
||||
}
|
||||
unpack(valid);
|
||||
if (! valid)
|
||||
_v.invalidateDiversity();
|
||||
else
|
||||
{
|
||||
V diver;
|
||||
unpack(diver);
|
||||
_v.diversity(diver);
|
||||
}
|
||||
unsigned len;
|
||||
unpack (len);
|
||||
_v.resize (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
unpack (_v [i]);
|
||||
unpack(valid);
|
||||
if (! valid)
|
||||
_v.invalidateObjectiveVector();
|
||||
else
|
||||
{
|
||||
F object;
|
||||
unpack (len);
|
||||
object.resize(len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
unpack (object[i]);
|
||||
_v.objectiveVector(object);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
145
trunk/peo/src/core/messaging.h
Normal file
145
trunk/peo/src/core/messaging.h
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
* <messaging.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar, Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __mess_h
|
||||
#define __mess_h
|
||||
|
||||
#include <utility>
|
||||
#include <string>
|
||||
|
||||
/* Char */
|
||||
extern void pack (const char & __c);
|
||||
|
||||
/* Boolean */
|
||||
extern void pack (const bool & __b, int __nitem = 1);
|
||||
|
||||
/* Float */
|
||||
extern void pack (const float & __f, int __nitem = 1);
|
||||
|
||||
/* Double */
|
||||
extern void pack (const double & __d, int __nitem = 1);
|
||||
|
||||
/* Integer */
|
||||
extern void pack (const int & __i, int __nitem = 1);
|
||||
|
||||
/* Unsigned int. */
|
||||
extern void pack (const unsigned int & __ui, int __nitem = 1);
|
||||
|
||||
/* Short int. */
|
||||
extern void pack (const short & __sh, int __nitem = 1);
|
||||
|
||||
/* Unsigned short */
|
||||
extern void pack (const unsigned short & __ush, int __nitem = 1);
|
||||
|
||||
/* Long */
|
||||
extern void pack (const long & __l, int __nitem = 1);
|
||||
|
||||
/* Unsigned long */
|
||||
extern void pack (const unsigned long & __ul, int __nitem = 1);
|
||||
|
||||
/* String */
|
||||
extern void pack (const char * __str);
|
||||
extern void pack (const std::string & __str);
|
||||
|
||||
/* Pointer */
|
||||
template <class T> void pack (const T * __ptr)
|
||||
{
|
||||
|
||||
pack ((unsigned long) __ptr);
|
||||
}
|
||||
|
||||
/* Pair */
|
||||
template <class U, class V> void pack (const std :: pair <U, V> & __pair)
|
||||
{
|
||||
|
||||
pack (__pair.first);
|
||||
pack (__pair.second);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Char */
|
||||
extern void unpack (char & __c);
|
||||
|
||||
/* Boolean */
|
||||
extern void unpack (bool & __b, int __nitem = 1);
|
||||
|
||||
/* Float */
|
||||
extern void unpack (float & __f, int __nitem = 1);
|
||||
|
||||
/* Double */
|
||||
extern void unpack (double & __d, int __nitem = 1);
|
||||
|
||||
/* Integer */
|
||||
extern void unpack (int & __i, int __nitem = 1);
|
||||
|
||||
/* Unsigned int. */
|
||||
extern void unpack (unsigned int & __ui, int __nitem = 1);
|
||||
|
||||
/* Short int. */
|
||||
extern void unpack (short & __sh, int __nitem = 1);
|
||||
|
||||
/* Unsigned short */
|
||||
extern void unpack (unsigned short & __ush, int __nitem = 1);
|
||||
|
||||
/* Long */
|
||||
extern void unpack (long & __l, int __nitem = 1);
|
||||
|
||||
/* Unsigned long */
|
||||
extern void unpack (unsigned long & __ul, int __nitem = 1);
|
||||
|
||||
/* String */
|
||||
extern void unpack (char * __str);
|
||||
extern void unpack (std::string & __str);
|
||||
|
||||
/* Pointer */
|
||||
template <class T> void unpack (T * & __ptr)
|
||||
{
|
||||
|
||||
unsigned long p;
|
||||
unpack (p);
|
||||
__ptr = (T *) p;
|
||||
}
|
||||
|
||||
/* Pair */
|
||||
template <class U, class V> void unpack (std :: pair <U, V> & __pair)
|
||||
{
|
||||
|
||||
unpack (__pair.first);
|
||||
unpack (__pair.second);
|
||||
}
|
||||
|
||||
#endif
|
||||
289
trunk/peo/src/core/peoAbstractDefs.h
Executable file
289
trunk/peo/src/core/peoAbstractDefs.h
Executable file
|
|
@ -0,0 +1,289 @@
|
|||
/*
|
||||
* <peoAbstractDefs.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Alexandru-Adrian TANTAR
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined __peoAbstractDefs_h
|
||||
#define __peoAbstractDefs_h
|
||||
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "core/messaging.h"
|
||||
|
||||
|
||||
|
||||
template < typename Type > struct Entity;
|
||||
|
||||
struct AbstractEntity
|
||||
{
|
||||
|
||||
virtual ~AbstractEntity() {}
|
||||
|
||||
template < typename EntityType > operator EntityType& ()
|
||||
{
|
||||
|
||||
return ( reinterpret_cast< Entity< EntityType >& >( *this ) ).entity;
|
||||
}
|
||||
};
|
||||
|
||||
struct AbstractFunctor : virtual public AbstractEntity
|
||||
{
|
||||
|
||||
virtual ~AbstractFunctor() {}
|
||||
|
||||
virtual void operator()() {}
|
||||
};
|
||||
|
||||
struct AbstractUnaryFunctor : virtual public AbstractEntity
|
||||
{
|
||||
|
||||
virtual ~AbstractUnaryFunctor() {}
|
||||
|
||||
virtual void operator()( AbstractEntity& dataEntity ) {}
|
||||
};
|
||||
|
||||
struct AbstractBinaryFunctor : virtual public AbstractEntity
|
||||
{
|
||||
|
||||
virtual ~AbstractBinaryFunctor() {}
|
||||
|
||||
virtual void operator()( AbstractEntity& dataEntityA, AbstractEntity& dataEntityB ) {};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template < typename EntityType > struct Entity : virtual public AbstractEntity
|
||||
{
|
||||
|
||||
Entity( EntityType& externalEntityRef ) : entity( externalEntityRef ) {}
|
||||
|
||||
EntityType& entity;
|
||||
};
|
||||
|
||||
template < typename FunctorType, typename DataType > struct FunctorEx : public Entity< DataType >, public AbstractFunctor
|
||||
{
|
||||
|
||||
FunctorEx( FunctorType& externalFunctorRef, DataType& externalDataRef )
|
||||
: externalFunctor( externalFunctorRef ), Entity< DataType >( externalDataRef ) {}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
|
||||
externalFunctor( Entity< DataType > :: entity );
|
||||
}
|
||||
|
||||
FunctorType& externalFunctor;
|
||||
};
|
||||
|
||||
template < typename FunctorType > struct FunctorEx< FunctorType, void > : public Entity< AbstractEntity >, public AbstractFunctor
|
||||
{
|
||||
|
||||
FunctorEx( FunctorType& externalFunctorRef )
|
||||
: externalFunctor( externalFunctorRef ), Entity< AbstractEntity >( *this ) {}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
|
||||
externalFunctor();
|
||||
}
|
||||
|
||||
FunctorType& externalFunctor;
|
||||
};
|
||||
|
||||
template < typename ReturnType, typename DataType > struct FnFunctorEx
|
||||
: public Entity< DataType >, public AbstractFunctor
|
||||
{
|
||||
|
||||
FnFunctorEx( ReturnType (*externalFunctorRef)( DataType& ), DataType& externalDataRef )
|
||||
: externalFunctor( externalFunctorRef ), Entity< DataType >( externalDataRef ) {}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
|
||||
externalFunctor( Entity< DataType > :: entity );
|
||||
}
|
||||
|
||||
ReturnType (*externalFunctor)( DataType& );
|
||||
};
|
||||
|
||||
template < typename ReturnType > struct FnFunctorEx< ReturnType, void >
|
||||
: public Entity< AbstractEntity >, public AbstractFunctor
|
||||
{
|
||||
|
||||
FnFunctorEx( ReturnType (*externalFunctorRef)() )
|
||||
: externalFunctor( externalFunctorRef ), Entity< AbstractEntity >( *this ) {}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
|
||||
externalFunctor();
|
||||
}
|
||||
|
||||
ReturnType (*externalFunctor)();
|
||||
};
|
||||
|
||||
|
||||
|
||||
template < typename FunctorType > struct UnaryFunctor : public Entity< FunctorType >, public AbstractUnaryFunctor
|
||||
{
|
||||
|
||||
UnaryFunctor( FunctorType& externalFunctorRef ) : Entity< FunctorType >( externalFunctorRef ) {}
|
||||
|
||||
void operator()( AbstractEntity& dataEntity )
|
||||
{
|
||||
|
||||
Entity< FunctorType > :: entity( dataEntity );
|
||||
}
|
||||
};
|
||||
|
||||
template < typename ReturnType, typename DataType > struct UnaryFnFunctor
|
||||
: public Entity< AbstractEntity >, public AbstractUnaryFunctor
|
||||
{
|
||||
|
||||
UnaryFnFunctor( ReturnType (*externalFnRef)( DataType& ) ) : Entity< AbstractEntity >( *this ), externalFn( externalFnRef )
|
||||
{
|
||||
}
|
||||
|
||||
void operator()( AbstractEntity& dataEntity )
|
||||
{
|
||||
|
||||
externalFn( dataEntity );
|
||||
}
|
||||
|
||||
ReturnType (*externalFn)( DataType& );
|
||||
};
|
||||
|
||||
template < typename FunctorType > struct BinaryFunctor : public Entity< FunctorType >, public AbstractBinaryFunctor
|
||||
{
|
||||
|
||||
BinaryFunctor( FunctorType& externalFunctorRef ) : Entity< FunctorType >( externalFunctorRef ) {}
|
||||
|
||||
void operator()( AbstractEntity& dataEntityA, AbstractEntity& dataEntityB )
|
||||
{
|
||||
|
||||
Entity< FunctorType > :: entity( dataEntityA, dataEntityB );
|
||||
}
|
||||
};
|
||||
|
||||
struct AbstractMsgTransferQueue : virtual public AbstractEntity
|
||||
{
|
||||
|
||||
virtual ~AbstractMsgTransferQueue() {}
|
||||
|
||||
virtual void pushMessage() {}
|
||||
virtual void popMessage() {}
|
||||
|
||||
virtual bool empty()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void packMessage() {}
|
||||
virtual void unpackMessage() {}
|
||||
};
|
||||
|
||||
template < typename EntityType > struct MsgTransferQueue : public Entity< EntityType >, public AbstractMsgTransferQueue
|
||||
{
|
||||
|
||||
MsgTransferQueue( EntityType& externalDataRef )
|
||||
: Entity< EntityType >( externalDataRef )
|
||||
{
|
||||
|
||||
aggregationFunctor = new BinaryFunctor< AssignmentFunctor >( assignmentFunctor );
|
||||
}
|
||||
|
||||
template < typename FunctorType >
|
||||
MsgTransferQueue( EntityType& externalDataRef, FunctorType& externalFunctorRef )
|
||||
: Entity< EntityType >( externalDataRef )
|
||||
{
|
||||
|
||||
aggregationFunctor = new BinaryFunctor< FunctorType >( externalFunctorRef );
|
||||
}
|
||||
|
||||
~MsgTransferQueue()
|
||||
{
|
||||
delete aggregationFunctor;
|
||||
}
|
||||
|
||||
void pushMessage()
|
||||
{
|
||||
|
||||
transferQueue.push( Entity< EntityType > :: entity );
|
||||
}
|
||||
|
||||
void popMessage()
|
||||
{
|
||||
|
||||
Entity< EntityType > message( transferQueue.front() );
|
||||
aggregationFunctor->operator()( *this, message );
|
||||
|
||||
transferQueue.pop();
|
||||
}
|
||||
|
||||
bool empty()
|
||||
{
|
||||
return transferQueue.empty();
|
||||
}
|
||||
|
||||
void packMessage()
|
||||
{
|
||||
|
||||
pack( transferQueue.front() );
|
||||
transferQueue.pop();
|
||||
}
|
||||
|
||||
void unpackMessage()
|
||||
{
|
||||
|
||||
EntityType transferredData;
|
||||
unpack( transferredData );
|
||||
transferQueue.push( transferredData );
|
||||
}
|
||||
|
||||
struct AssignmentFunctor
|
||||
{
|
||||
void operator()( EntityType& A, EntityType& B )
|
||||
{
|
||||
A = B;
|
||||
}
|
||||
} assignmentFunctor;
|
||||
|
||||
std::queue< EntityType > transferQueue;
|
||||
AbstractBinaryFunctor* aggregationFunctor;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
117
trunk/peo/src/core/peo_debug.cpp
Normal file
117
trunk/peo/src/core/peo_debug.cpp
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* <peo_debug.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar, Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#include "peo_debug.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <vector>
|
||||
|
||||
#include "peo_debug.h"
|
||||
|
||||
#define MAX_BUFF_SIZE 1000
|
||||
|
||||
#define DEBUG_PATH "./log/"
|
||||
|
||||
|
||||
static bool debug = false;
|
||||
|
||||
static char host [MAX_BUFF_SIZE];
|
||||
|
||||
std :: vector <FILE *> files;
|
||||
|
||||
|
||||
void setDebugMode (bool __dbg)
|
||||
{
|
||||
|
||||
debug = __dbg;
|
||||
gethostname (host, MAX_BUFF_SIZE);
|
||||
}
|
||||
|
||||
extern int getNodeRank ();
|
||||
|
||||
void initDebugging ()
|
||||
{
|
||||
|
||||
mkdir (DEBUG_PATH, S_IRWXU);
|
||||
// files.push_back (stdout);
|
||||
char buff [MAX_BUFF_SIZE];
|
||||
sprintf (buff, "%s/%d", DEBUG_PATH, getNodeRank ());
|
||||
files.push_back (fopen (buff, "w"));
|
||||
}
|
||||
|
||||
void endDebugging ()
|
||||
{
|
||||
|
||||
for (unsigned i = 0; i < files.size (); i ++)
|
||||
if (files [i] != stdout)
|
||||
fclose (files [i]);
|
||||
files.clear();
|
||||
}
|
||||
|
||||
void printDebugMessage (const char * __mess)
|
||||
{
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
||||
char buff [MAX_BUFF_SIZE];
|
||||
char localTime [MAX_BUFF_SIZE];
|
||||
time_t t = time (0);
|
||||
|
||||
/* Date */
|
||||
strcpy( localTime, ctime (& t) );
|
||||
localTime[ strlen( localTime )-1 ] = ']';
|
||||
sprintf (buff, "[%s][%s: ", host, localTime );
|
||||
|
||||
for (unsigned i = 0; i < files.size (); i ++)
|
||||
fprintf (files [i],"%s" ,buff);
|
||||
|
||||
/* Message */
|
||||
sprintf (buff, "%s", __mess);
|
||||
|
||||
for (unsigned i = 0; i < files.size (); i ++)
|
||||
{
|
||||
fputs (buff, files [i]);
|
||||
fputs ("\n", files [i]);
|
||||
fflush (files [i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
50
trunk/peo/src/core/peo_debug.h
Normal file
50
trunk/peo/src/core/peo_debug.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* <peo_debug.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar, Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __peo_debug_h
|
||||
#define __peo_debug_h
|
||||
|
||||
extern void initDebugging ();
|
||||
|
||||
extern void endDebugging ();
|
||||
|
||||
extern void setDebugMode (bool __dbg = true); /* (Des)activating the Debugging mode */
|
||||
|
||||
extern void printDebugMessage (const char * __mess); /* Print a new message both on the
|
||||
standard output and a target
|
||||
text-file in a subdirectory) */
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue