diff --git a/library/talipot-core/include/talipot/TLPParser.h b/library/talipot-core/include/talipot/TLPParser.h index bf44eca7d5..ce0ae0d629 100644 --- a/library/talipot-core/include/talipot/TLPParser.h +++ b/library/talipot-core/include/talipot/TLPParser.h @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -243,7 +243,7 @@ struct TLPTokenParser { return ERRORINFILE; } - unsigned long strlength = val.str.length(); + ulong strlength = val.str.length(); if (endPtr == (cstr + strlength)) { val.integer = resultl; diff --git a/library/talipot-core/include/talipot/TlpTools.h b/library/talipot-core/include/talipot/TlpTools.h index 9681d1c4f3..dbc9606462 100644 --- a/library/talipot-core/include/talipot/TlpTools.h +++ b/library/talipot-core/include/talipot/TlpTools.h @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -135,17 +135,22 @@ TLP_SCOPE std::mt19937 &getRandomNumberGenerator(); * @brief Returns a random integer in the range [0, max] if max is positive or in the range [max, 0] * if max is negative */ -TLP_SCOPE int randomInteger(int max); +TLP_SCOPE int randomNumber(int max); /** * @brief Returns a random unsigned integer in the range [0, max] */ -TLP_SCOPE uint randomUnsignedInteger(uint max); +TLP_SCOPE uint randomNumber(uint max); + +/** + * @brief Returns a random unsigned long in the range [0, max] + */ +TLP_SCOPE ulong randomNumber(ulong max); /** * @brief Returns a random double in the range [0, max] */ -TLP_SCOPE double randomDouble(double max = 1.0); +TLP_SCOPE double randomNumber(double max = 1.0); /** * @brief Cross-platform function to stat a path on a filesystem. diff --git a/library/talipot-core/include/talipot/cxx/Circle.cxx b/library/talipot-core/include/talipot/cxx/Circle.cxx index e024cfce06..26aff66d4e 100644 --- a/library/talipot-core/include/talipot/cxx/Circle.cxx +++ b/library/talipot-core/include/talipot/cxx/Circle.cxx @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2020 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -320,7 +320,7 @@ tlp::Circle tlp::enclosingCircle(const std::vector 0;) { - unsigned idx = tlp::randomUnsignedInteger(i - 1); + unsigned idx = tlp::randomNumber(i - 1); --i; std::swap(enclosedCircles[idx], enclosedCircles[i]); } diff --git a/library/talipot-core/src/GraphAbstract.cpp b/library/talipot-core/src/GraphAbstract.cpp index 1516646225..ae03e43457 100644 --- a/library/talipot-core/src/GraphAbstract.cpp +++ b/library/talipot-core/src/GraphAbstract.cpp @@ -280,7 +280,7 @@ node GraphAbstract::getRandomNode() const { const std::vector &vNodes = nodes(); if (!vNodes.empty()) { - return vNodes[randomUnsignedInteger(vNodes.size() - 1)]; + return vNodes[randomNumber(vNodes.size() - 1)]; } return node(); @@ -295,7 +295,7 @@ edge GraphAbstract::getRandomEdge() const { const std::vector &vEdges = edges(); if (!vEdges.empty()) { - return vEdges[randomUnsignedInteger(vEdges.size() - 1)]; + return vEdges[randomNumber(vEdges.size() - 1)]; } return edge(); diff --git a/library/talipot-core/src/PluginLibraryLoader.cpp b/library/talipot-core/src/PluginLibraryLoader.cpp index e166d19d5d..fa69bf5b23 100644 --- a/library/talipot-core/src/PluginLibraryLoader.cpp +++ b/library/talipot-core/src/PluginLibraryLoader.cpp @@ -186,10 +186,10 @@ int __talipot_select_libs(struct dirent *ent) { #endif #if !defined(__APPLE__) const char *suffix = ".so"; - const unsigned long suffix_len = 3; + const ulong suffix_len = 3; #else const char *suffix = ".dylib"; - const unsigned long suffix_len = 6; + const ulong suffix_len = 6; #endif int idx = strlen(ent->d_name) - suffix_len; @@ -197,7 +197,7 @@ int __talipot_select_libs(struct dirent *ent) { return 0; } - for (unsigned long i = 0; i < suffix_len; ++i) { + for (ulong i = 0; i < suffix_len; ++i) { if ((ent->d_name[idx + i]) != suffix[i]) { return 0; } @@ -263,7 +263,7 @@ bool PluginLibraryLoader::initPluginDir(PluginLoader *loader, bool recursive, if (loader != nullptr) { // count files loop - unsigned long nbFiles = 0; + ulong nbFiles = 0; if (hFind != INVALID_HANDLE_VALUE) { nbFiles = 1; diff --git a/library/talipot-core/src/TlpTools.cpp b/library/talipot-core/src/TlpTools.cpp index 30b8cac680..1159194fe4 100644 --- a/library/talipot-core/src/TlpTools.cpp +++ b/library/talipot-core/src/TlpTools.cpp @@ -333,7 +333,7 @@ TLP_SCOPE std::mt19937 &tlp::getRandomNumberGenerator() { return mt; } -int tlp::randomInteger(int max) { +int tlp::randomNumber(int max) { if (max == 0) { return 0; } else if (max > 0) { @@ -345,7 +345,7 @@ int tlp::randomInteger(int max) { } } -uint tlp::randomUnsignedInteger(uint max) { +uint tlp::randomNumber(uint max) { if (max == 0) { return 0; } else { @@ -354,7 +354,16 @@ uint tlp::randomUnsignedInteger(uint max) { } } -double tlp::randomDouble(double max) { +ulong tlp::randomNumber(ulong max) { + if (max == 0) { + return 0; + } else { + std::uniform_int_distribution dist(0, max); + return dist(mt); + } +} + +double tlp::randomNumber(double max) { std::uniform_real_distribution dist(0, std::nextafter(max, DBL_MAX)); return dist(mt); } diff --git a/library/talipot-gui/src/CSVParser.cpp b/library/talipot-gui/src/CSVParser.cpp index 2d17ea8415..5e6311f407 100644 --- a/library/talipot-gui/src/CSVParser.cpp +++ b/library/talipot-gui/src/CSVParser.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -57,7 +57,7 @@ bool CSVSimpleParser::parse(CSVContentHandler *handler, PluginProgress *progress csvFile->seekg(0, std::ios_base::end); // get position = file size - unsigned long fileSize = csvFile->tellg(), readSize = 0; + ulong fileSize = csvFile->tellg(), readSize = 0; // reset position csvFile->seekg(0, std::ios_base::beg); string line; diff --git a/library/talipot-ogl/include/talipot/GlQuantitativeAxis.h b/library/talipot-ogl/include/talipot/GlQuantitativeAxis.h index ea3e619ef6..42b74e5d0f 100644 --- a/library/talipot-ogl/include/talipot/GlQuantitativeAxis.h +++ b/library/talipot-ogl/include/talipot/GlQuantitativeAxis.h @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -66,8 +66,7 @@ class TLP_GL_SCOPE GlQuantitativeAxis : public GlAxis { const LabelPosition &axisGradsLabelsPosition = LEFT_OR_BELOW, const bool drawFirstLabel = true); - void setAxisParameters(const long long min, const long long max, - const unsigned long long incrementStep, + void setAxisParameters(const long long min, const long long max, const ulong incrementStep, const LabelPosition &axisGradsLabelsPosition = LEFT_OR_BELOW, const bool drawFirstLabel = true); @@ -75,8 +74,7 @@ class TLP_GL_SCOPE GlQuantitativeAxis : public GlAxis { const LabelPosition &axisGradsLabelsPosition = LEFT_OR_BELOW, const bool drawFirstLabel = true) { setAxisParameters(static_cast(min), static_cast(max), - static_cast(incrementStep), axisGradsLabelsPosition, - drawFirstLabel); + static_cast(incrementStep), axisGradsLabelsPosition, drawFirstLabel); } void setNbGraduations(const uint nbGraduations) { @@ -151,7 +149,7 @@ class TLP_GL_SCOPE GlQuantitativeAxis : public GlAxis { bool logScale; uint logBase; bool integerScale; - unsigned long long incrementStep; + ulong incrementStep; bool minMaxSet; }; } diff --git a/library/talipot-ogl/src/GlQuantitativeAxis.cpp b/library/talipot-ogl/src/GlQuantitativeAxis.cpp index 5339700be2..272d67517e 100644 --- a/library/talipot-ogl/src/GlQuantitativeAxis.cpp +++ b/library/talipot-ogl/src/GlQuantitativeAxis.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -62,7 +62,7 @@ void GlQuantitativeAxis::setAxisParameters(const double minV, const double maxV, } void GlQuantitativeAxis::setAxisParameters(const long long minV, const long long maxV, - const unsigned long long incrementStepV, + const ulong incrementStepV, const LabelPosition &axisGradsLabelsPos, const bool firstLabel) { integerScale = true; diff --git a/library/talipot-python/bindings/stl/std_list.sip b/library/talipot-python/bindings/stl/std_list.sip index de3367c02d..ac62a2ccf4 100644 --- a/library/talipot-python/bindings/stl/std_list.sip +++ b/library/talipot-python/bindings/stl/std_list.sip @@ -470,10 +470,10 @@ return sipGetState(sipTransferObj); }; // **************************************************** -// Specialization for std::list +// Specialization for std::list // **************************************************** -%MappedType std::list /TypeHint="List[int]"/ { +%MappedType std::list /TypeHint="List[int]"/ { %TypeHeaderCode #include %End @@ -514,7 +514,7 @@ if (sipIsErr == NULL) { } // Convert Python list of integers to a std::vector -std::list *v = new std::list(); +std::list *v = new std::list(); for (Py_ssize_t i = 0; i < PyList_GET_SIZE(sipPy); ++i) { v->push_back(PyLong_AsUnsignedLong(PyList_GET_ITEM(sipPy, i))); } diff --git a/library/talipot-python/bindings/stl/std_set.sip b/library/talipot-python/bindings/stl/std_set.sip index d43eccd8a7..9e9a327081 100644 --- a/library/talipot-python/bindings/stl/std_set.sip +++ b/library/talipot-python/bindings/stl/std_set.sip @@ -517,7 +517,7 @@ return sipGetState(sipTransferObj); }; -%MappedType std::set /TypeHint="Set[int]"/ { +%MappedType std::set /TypeHint="Set[int]"/ { %TypeHeaderCode #include %End @@ -532,7 +532,7 @@ if ((l = PySet_New(NULL)) == NULL) { // Go through each element in the C++ instance and convert it to a // wrapper object. -for (unsigned long n : *sipCpp) { +for (ulong n : *sipCpp) { // Add the wrapper to the list. PySet_Add(l, PyLong_FromUnsignedLong(n)); } @@ -561,8 +561,8 @@ if (sipIsErr == NULL) { return 1; } -// Convert Python set of integers to a std::set -std::set *s = new std::set(); +// Convert Python set of integers to a std::set +std::set *s = new std::set(); PyObject *iterator = PyObject_GetIter(sipPy); PyObject *item = NULL; diff --git a/library/talipot-python/bindings/stl/std_vector.sip b/library/talipot-python/bindings/stl/std_vector.sip index 5b552d28bc..f83e4aaf26 100644 --- a/library/talipot-python/bindings/stl/std_vector.sip +++ b/library/talipot-python/bindings/stl/std_vector.sip @@ -480,10 +480,10 @@ return sipGetState(sipTransferObj); }; // **************************************************** -// Specialization for std::vector +// Specialization for std::vector // **************************************************** -%MappedType std::vector /TypeHint="List[int]"/ { +%MappedType std::vector /TypeHint="List[int]"/ { %TypeHeaderCode #include %End @@ -523,7 +523,7 @@ if (sipIsErr == NULL) { } // Convert Python list of integers to a std::vector -std::vector *v = new std::vector(); +std::vector *v = new std::vector(); v->reserve(PyList_GET_SIZE(sipPy)); for (Py_ssize_t i = 0; i < PyList_GET_SIZE(sipPy); ++i) { v->push_back(PyLong_AsUnsignedLong(PyList_GET_ITEM(sipPy, i))); diff --git a/library/talipot-python/include/talipot/PythonCppTypesConverter.h b/library/talipot-python/include/talipot/PythonCppTypesConverter.h index a0541a1705..6c78436473 100644 --- a/library/talipot-python/include/talipot/PythonCppTypesConverter.h +++ b/library/talipot-python/include/talipot/PythonCppTypesConverter.h @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -46,8 +46,8 @@ TLP_PYTHON_SCOPE PyObject *convertDoubleToPyObject(double cppObject); TLP_PYTHON_SCOPE bool convertPyObjectToLong(PyObject *pyObject, long &cppObject); TLP_PYTHON_SCOPE PyObject *convertLongToPyObject(long cppObject); -TLP_PYTHON_SCOPE bool convertPyObjectToUnsignedLong(PyObject *pyObject, unsigned long &cppObject); -TLP_PYTHON_SCOPE PyObject *convertUnsignedLongToPyObject(unsigned long cppObject); +TLP_PYTHON_SCOPE bool convertPyObjectToUnsignedLong(PyObject *pyObject, ulong &cppObject); +TLP_PYTHON_SCOPE PyObject *convertUnsignedLongToPyObject(ulong cppObject); class TLP_PYTHON_SCOPE ValueSetter { @@ -176,9 +176,9 @@ class PyObjectToCppObjectConverter { }; template <> -class PyObjectToCppObjectConverter { +class PyObjectToCppObjectConverter { public: - bool convert(PyObject *pyObject, unsigned long &cppObject) { + bool convert(PyObject *pyObject, ulong &cppObject) { return convertPyObjectToUnsignedLong(pyObject, cppObject); } }; @@ -187,8 +187,8 @@ template <> class PyObjectToCppObjectConverter { public: bool convert(PyObject *pyObject, uint &cppObject) { - unsigned long val = 0; - PyObjectToCppObjectConverter converter; + ulong val = 0; + PyObjectToCppObjectConverter converter; bool ok = converter.convert(pyObject, val); cppObject = val; return ok; @@ -280,9 +280,9 @@ class CppObjectToPyObjectConverter { }; template <> -class CppObjectToPyObjectConverter { +class CppObjectToPyObjectConverter { public: - bool convert(const unsigned long &cppObject, PyObject *&pyObject) { + bool convert(const ulong &cppObject, PyObject *&pyObject) { pyObject = convertUnsignedLongToPyObject(cppObject); return true; } diff --git a/library/talipot-python/src/PythonCppTypesConverter.cpp b/library/talipot-python/src/PythonCppTypesConverter.cpp index e32eb77e6f..0794982a11 100644 --- a/library/talipot-python/src/PythonCppTypesConverter.cpp +++ b/library/talipot-python/src/PythonCppTypesConverter.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -171,7 +171,7 @@ bool convertPyObjectToLong(PyObject *pyObject, long &cppObject) { return false; } -bool convertPyObjectToUnsignedLong(PyObject *pyObject, unsigned long &cppObject) { +bool convertPyObjectToUnsignedLong(PyObject *pyObject, ulong &cppObject) { if (PyLong_Check(pyObject)) { cppObject = PyLong_AsUnsignedLong(pyObject); return true; @@ -184,7 +184,7 @@ PyObject *convertLongToPyObject(long cppObject) { return PyLong_FromLong(cppObject); } -PyObject *convertUnsignedLongToPyObject(unsigned long cppObject) { +PyObject *convertUnsignedLongToPyObject(ulong cppObject) { return PyLong_FromUnsignedLong(cppObject); } @@ -245,7 +245,7 @@ PyObject *getPyObjectFromDataType(const DataType *dataType, bool noCopy) { CHECK_BASE_CPP_TYPE_CONVERSION(int) CHECK_BASE_CPP_TYPE_CONVERSION(long) CHECK_BASE_CPP_TYPE_CONVERSION(uint) - CHECK_BASE_CPP_TYPE_CONVERSION(unsigned long) + CHECK_BASE_CPP_TYPE_CONVERSION(ulong) CHECK_BASE_CPP_TYPE_CONVERSION(double) CHECK_BASE_CPP_TYPE_CONVERSION(float) CHECK_BASE_CPP_TYPE_CONVERSION(string) @@ -296,7 +296,7 @@ PyObject *getPyObjectFromDataType(const DataType *dataType, bool noCopy) { CHECK_SIP_CPP_TYPE_CONVERSION(vector) CHECK_SIP_CPP_TYPE_CONVERSION(vector) CHECK_SIP_CPP_TYPE_CONVERSION(vector) - CHECK_SIP_CPP_TYPE_CONVERSION(vector) + CHECK_SIP_CPP_TYPE_CONVERSION(vector) CHECK_SIP_CPP_TYPE_CONVERSION(vector) CHECK_SIP_CPP_TYPE_CONVERSION(vector) CHECK_SIP_CPP_TYPE_CONVERSION(set) @@ -309,7 +309,7 @@ PyObject *getPyObjectFromDataType(const DataType *dataType, bool noCopy) { CHECK_SIP_CPP_TYPE_CONVERSION(set) CHECK_SIP_CPP_TYPE_CONVERSION(set) CHECK_SIP_CPP_TYPE_CONVERSION(set) - CHECK_SIP_CPP_TYPE_CONVERSION(set) + CHECK_SIP_CPP_TYPE_CONVERSION(set) CHECK_SIP_CPP_TYPE_CONVERSION(set) CHECK_SIP_CPP_TYPE_CONVERSION(set) CHECK_SIP_CPP_TYPE_CONVERSION(list) @@ -333,7 +333,7 @@ PyObject *getPyObjectFromDataType(const DataType *dataType, bool noCopy) { CHECK_SIP_CPP_TYPE_CONVERSION(list) CHECK_SIP_CPP_TYPE_CONVERSION(list) CHECK_SIP_CPP_TYPE_CONVERSION(list) - CHECK_SIP_CPP_TYPE_CONVERSION(list) + CHECK_SIP_CPP_TYPE_CONVERSION(list) CHECK_SIP_CPP_TYPE_CONVERSION(list) CHECK_SIP_CPP_TYPE_CONVERSION(list) return pyObj; @@ -383,8 +383,8 @@ bool setCppValueFromPyObject(PyObject *pyObj, ValueSetter &valSetter, DataType * valSetter.setValue(getCppObjectFromPyObject(pyObj)); } else if (dataType && dataType->getTypeName() == string(typeid(long).name())) { valSetter.setValue(val); - } else if (dataType && dataType->getTypeName() == string(typeid(unsigned long).name())) { - valSetter.setValue(getCppObjectFromPyObject(pyObj)); + } else if (dataType && dataType->getTypeName() == string(typeid(ulong).name())) { + valSetter.setValue(getCppObjectFromPyObject(pyObj)); } else if (dataType && dataType->getTypeName() == string(typeid(float).name())) { valSetter.setValue(float(val)); } else if (dataType && dataType->getTypeName() == string(typeid(double).name())) { @@ -415,9 +415,8 @@ bool setCppValueFromPyObject(PyObject *pyObj, ValueSetter &valSetter, DataType * valSetter.setValue(getCppObjectFromPyObject>(pyObj)); } else if (dataType && dataType->getTypeName() == string(typeid(vector).name())) { valSetter.setValue(getCppObjectFromPyObject>(pyObj)); - } else if (dataType && - dataType->getTypeName() == string(typeid(vector).name())) { - valSetter.setValue(getCppObjectFromPyObject>(pyObj)); + } else if (dataType && dataType->getTypeName() == string(typeid(vector).name())) { + valSetter.setValue(getCppObjectFromPyObject>(pyObj)); } else if (dataType && dataType->getTypeName() == string(typeid(vector).name())) { valSetter.setValue(getCppObjectFromPyObject>(pyObj)); } else if (dataType && dataType->getTypeName() == string(typeid(vector).name())) { @@ -429,8 +428,8 @@ bool setCppValueFromPyObject(PyObject *pyObj, ValueSetter &valSetter, DataType * valSetter.setValue(getCppObjectFromPyObject>(pyObj)); } else if (dataType && dataType->getTypeName() == string(typeid(list).name())) { valSetter.setValue(getCppObjectFromPyObject>(pyObj)); - } else if (dataType && dataType->getTypeName() == string(typeid(list).name())) { - valSetter.setValue(getCppObjectFromPyObject>(pyObj)); + } else if (dataType && dataType->getTypeName() == string(typeid(list).name())) { + valSetter.setValue(getCppObjectFromPyObject>(pyObj)); } else if (dataType && dataType->getTypeName() == string(typeid(list).name())) { valSetter.setValue(getCppObjectFromPyObject>(pyObj)); } else if (dataType && dataType->getTypeName() == string(typeid(list).name())) { @@ -463,8 +462,8 @@ bool setCppValueFromPyObject(PyObject *pyObj, ValueSetter &valSetter, DataType * valSetter.setValue(getCppObjectFromPyObject>(pyObj)); } else if (dataType && dataType->getTypeName() == string(typeid(set).name())) { valSetter.setValue(getCppObjectFromPyObject>(pyObj)); - } else if (dataType && dataType->getTypeName() == string(typeid(set).name())) { - valSetter.setValue(getCppObjectFromPyObject>(pyObj)); + } else if (dataType && dataType->getTypeName() == string(typeid(set).name())) { + valSetter.setValue(getCppObjectFromPyObject>(pyObj)); } else if (dataType && dataType->getTypeName() == string(typeid(set).name())) { valSetter.setValue(getCppObjectFromPyObject>(pyObj)); } else if (dataType && dataType->getTypeName() == string(typeid(set).name())) { diff --git a/library/talipot-python/src/PythonInterpreter.cpp b/library/talipot-python/src/PythonInterpreter.cpp index fb051fe716..b9669cafb4 100644 --- a/library/talipot-python/src/PythonInterpreter.cpp +++ b/library/talipot-python/src/PythonInterpreter.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -96,7 +96,7 @@ class SleepSimulator { localMutex.unlock(); } - void sleep(unsigned long sleepMS) { + void sleep(ulong sleepMS) { sleepSimulator.wait(&localMutex, sleepMS); } }; diff --git a/plugins/import/ERRandomGraph.cpp b/plugins/import/ERRandomGraph.cpp index 26981d917d..dc092dcbac 100644 --- a/plugins/import/ERRandomGraph.cpp +++ b/plugins/import/ERRandomGraph.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -110,7 +110,7 @@ class ERRandomGraph : public ImportModule { continue; } - if (tlp::randomDouble() < proba) { + if (tlp::randomNumber() < proba) { graph->addEdge(u, v); } } diff --git a/plugins/import/PlanarGraph.cpp b/plugins/import/PlanarGraph.cpp index ba8727d211..43a7e54179 100644 --- a/plugins/import/PlanarGraph.cpp +++ b/plugins/import/PlanarGraph.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -78,7 +78,7 @@ class PlanarGraph : public ImportModule { while (nb < nbNodes) { // choose a Triangle randomly - uint i = randomUnsignedInteger(faces.size() - 1); + uint i = randomNumber(faces.size() - 1); Triangle f = faces[i]; node n = graph->addNode(); Coord tmp = newLayout->getNodeValue(f.a) + newLayout->getNodeValue(f.b) + diff --git a/plugins/import/RandomGraph.cpp b/plugins/import/RandomGraph.cpp index caca2329a4..9cc50b8e2d 100644 --- a/plugins/import/RandomGraph.cpp +++ b/plugins/import/RandomGraph.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -149,12 +149,12 @@ class RandomGraph : public ImportModule { } edgeS tmp; - tmp.source = randomUnsignedInteger(nbNodes - 1); - tmp.target = randomUnsignedInteger(nbNodes - 1); + tmp.source = randomNumber(nbNodes - 1); + tmp.target = randomNumber(nbNodes - 1); while (tmp.source == tmp.target) { - tmp.source = randomUnsignedInteger(nbNodes - 1); - tmp.target = randomUnsignedInteger(nbNodes - 1); + tmp.source = randomNumber(nbNodes - 1); + tmp.target = randomNumber(nbNodes - 1); } if ((myGraph.find(tmp) == myGraph.end()) && (myGraph.size() < nbEdges)) { diff --git a/plugins/import/RandomTree.cpp b/plugins/import/RandomTree.cpp index c760b22737..797f6934e4 100644 --- a/plugins/import/RandomTree.cpp +++ b/plugins/import/RandomTree.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -39,7 +39,7 @@ class RandomTree : public ImportModule { } bool result = true; - int randNumber = randomInteger(RAND_MAX); + int randNumber = randomNumber(RAND_MAX); if (randNumber > RAND_MAX / 2) { node n1, n2; diff --git a/plugins/import/RandomTreeGeneral.cpp b/plugins/import/RandomTreeGeneral.cpp index 27ca4b493a..ebbcb0b8cb 100644 --- a/plugins/import/RandomTreeGeneral.cpp +++ b/plugins/import/RandomTreeGeneral.cpp @@ -102,7 +102,7 @@ class RandomTreeGeneral : public ImportModule { graph->clear(); - uint n = sizeMin + randomUnsignedInteger(sizeMax - sizeMin); + uint n = sizeMin + randomNumber(sizeMax - sizeMin); uint max = 0; vector possible(n); @@ -110,7 +110,7 @@ class RandomTreeGeneral : public ImportModule { --n; while (n > 0) { - uint i = randomUnsignedInteger(max); + uint i = randomNumber(max); node v = possible[i]; if (v.isValid() && graph->outdeg(v) + 1 == arityMax) { diff --git a/plugins/import/SmallWorldGraph.cpp b/plugins/import/SmallWorldGraph.cpp index 432b10ff18..0eecbc980c 100644 --- a/plugins/import/SmallWorldGraph.cpp +++ b/plugins/import/SmallWorldGraph.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -91,8 +91,7 @@ class SmallWorldGraph : public ImportModule { const vector &nodes = graph->nodes(); for (auto n : nodes) { - newLayout->setNodeValue(n, - Coord(float(randomInteger(WIDTH)), float(randomInteger(HEIGHT)), 0)); + newLayout->setNodeValue(n, Coord(float(randomNumber(WIDTH)), float(randomNumber(HEIGHT)), 0)); } // double minSize = DBL_MAX; @@ -110,7 +109,7 @@ class SmallWorldGraph : public ImportModule { if (distance < maxDistance) { graph->addEdge(nodes[i], nodes[j]); } else if (!longEdge && enableLongEdge) { - double distrand = randomDouble(); + double distrand = randomNumber(); if (distrand < 1.0 / (2.0 + double(nbNodes - i - 1))) { longEdge = true; diff --git a/plugins/import/SocialNetwork/AttractAndIntroduce.cpp b/plugins/import/SocialNetwork/AttractAndIntroduce.cpp index 5a57a55c9e..ce61b66036 100644 --- a/plugins/import/SocialNetwork/AttractAndIntroduce.cpp +++ b/plugins/import/SocialNetwork/AttractAndIntroduce.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -95,8 +95,8 @@ class AttractAndIntroduce : public ImportModule { NodeVectorProperty pIntroduceProperty(graph); for (uint i = 0; i < nbNodes; ++i) { - pAttractProperty[i] = ((1 - alpha) > randomDouble(1.0)) ? 0 : randomDouble(1.0); - pIntroduceProperty[i] = (beta > randomDouble(1.0)) ? 1 : 0; + pAttractProperty[i] = ((1 - alpha) > randomNumber(1.0)) ? 0 : randomNumber(1.0); + pIntroduceProperty[i] = (beta > randomNumber(1.0)) ? 1 : 0; if (i++ % 1000 == 0) { if (pluginProgress->progress(i, iterations) != ProgressState::TLP_CONTINUE) { @@ -109,31 +109,31 @@ class AttractAndIntroduce : public ImportModule { const vector &nodes = graph->nodes(); while (tmpE < nbEdges) { - uint i = randomInteger(nbNodes - 1); + uint i = randomNumber(nbNodes - 1); uint j; do { - j = randomInteger(nbNodes - 1); + j = randomNumber(nbNodes - 1); } while (i == j); node nj = nodes[j]; - if (pAttractProperty[j] > randomDouble(1.0)) { + if (pAttractProperty[j] > randomNumber(1.0)) { node ni = nodes[i]; - if (pIntroduceProperty[i] > randomDouble(1.0)) { + if (pIntroduceProperty[i] > randomNumber(1.0)) { for (auto fd : graph->getInOutNodes(ni)) { if (fd == nj || graph->hasEdge(fd, nj, false)) { continue; } - if (pAttractProperty[j] > randomDouble(1.0)) { + if (pAttractProperty[j] > randomNumber(1.0)) { graph->addEdge(fd, nj); ++tmpE; continue; } - if (pAttractProperty[fd] > randomDouble(1.0)) { + if (pAttractProperty[fd] > randomNumber(1.0)) { graph->addEdge(nj, fd); ++tmpE; } diff --git a/plugins/import/SocialNetwork/BollobasModel.cpp b/plugins/import/SocialNetwork/BollobasModel.cpp index 930a6a124e..d81ded2bf1 100644 --- a/plugins/import/SocialNetwork/BollobasModel.cpp +++ b/plugins/import/SocialNetwork/BollobasModel.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -73,7 +73,7 @@ struct BollobasModel : public ImportModule { for (uint v = 0; v < n; ++v) { for (uint i = 0; i < d; ++i) { M[2 * (v * d + i)] = v; - int r = tlp::randomInteger(2 * (v * d + i) + 1); + int r = tlp::randomNumber(2 * (v * d + i) + 1); M[2 * (v * d + i) + 1] = M[r]; } diff --git a/plugins/import/SocialNetwork/BuWangZhouModel.cpp b/plugins/import/SocialNetwork/BuWangZhouModel.cpp index 98a5599e00..6f9081ec82 100644 --- a/plugins/import/SocialNetwork/BuWangZhouModel.cpp +++ b/plugins/import/SocialNetwork/BuWangZhouModel.cpp @@ -97,7 +97,7 @@ class BuWangZhouModel : public ImportModule { // Random type do { - random_type = tlp::randomUnsignedInteger(types_of_nodes - 1); + random_type = tlp::randomNumber(types_of_nodes - 1); } while (random_type == i % types_of_nodes); // Random node @@ -108,7 +108,7 @@ class BuWangZhouModel : public ImportModule { k_sum += graph->deg(nodes[random_type][random_node]); } - pr = tlp::randomDouble(); + pr = tlp::randomNumber(); random_node = 0; while (pr_sum < pr && nodes[random_type].size() > (random_node + 1)) { diff --git a/plugins/import/SocialNetwork/Catanzaro.cpp b/plugins/import/SocialNetwork/Catanzaro.cpp index 468c41297e..7bcebe9e2e 100644 --- a/plugins/import/SocialNetwork/Catanzaro.cpp +++ b/plugins/import/SocialNetwork/Catanzaro.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -99,7 +99,7 @@ struct Catanzaro : public ImportModule { for (j = 0; j < m; j++) { - double pr = tlp::randomDouble(); + double pr = tlp::randomNumber(); double pr_sum = 0; uint u = 0; @@ -108,7 +108,7 @@ struct Catanzaro : public ImportModule { ++u; } - if (tlp::randomDouble() <= p) { // PA + if (tlp::randomNumber() <= p) { // PA if (!graph->hasEdge(nodes[i], nodes[u], false)) { graph->addEdge(nodes[i], nodes[u]); } @@ -124,7 +124,7 @@ struct Catanzaro : public ImportModule { } } - pr = tlp::randomDouble(ceil(k_sum)); + pr = tlp::randomNumber(ceil(k_sum)); for (k = 0; k < i; ++k) { for (l = 0; l < k; ++l) { diff --git a/plugins/import/SocialNetwork/FuLiao.cpp b/plugins/import/SocialNetwork/FuLiao.cpp index 63dd8c378c..f419cbea85 100644 --- a/plugins/import/SocialNetwork/FuLiao.cpp +++ b/plugins/import/SocialNetwork/FuLiao.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -95,7 +95,7 @@ struct FuLiao : public ImportModule { // add first edge double pr_sum = 0; uint rn = 0; - double pr = tlp::randomDouble(); + double pr = tlp::randomNumber(); while (pr_sum < pr && rn < (i - 1)) { if (!graph->hasEdge(nodes[i], nodes[rn])) { @@ -126,7 +126,7 @@ struct FuLiao : public ImportModule { pr_sum = 0; rn = 0; - pr = tlp::randomDouble(); + pr = tlp::randomNumber(); while (pr_sum < pr && rn < (i - 1)) { if (!graph->hasEdge(nodes[i], nodes[rn])) { diff --git a/plugins/import/SocialNetwork/GuillaumeLatapyModel.cpp b/plugins/import/SocialNetwork/GuillaumeLatapyModel.cpp index ab1565ee67..dbf28b4563 100644 --- a/plugins/import/SocialNetwork/GuillaumeLatapyModel.cpp +++ b/plugins/import/SocialNetwork/GuillaumeLatapyModel.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -128,7 +128,7 @@ struct GuillaumeLatapyModel : public ImportModule { } for (j = 0; j < vec_top_nodes[i].degree; ++j) { - int bottom_id = tlp::randomInteger(vec_bottom_nodes.size() - 1); + int bottom_id = tlp::randomNumber(vec_bottom_nodes.size() - 1); if (isNotNodeInVector(vec_top_nodes[i].bottom_nodes, vec_bottom_nodes[bottom_id].n)) { vec_top_nodes[i].bottom_nodes.push_back(vec_bottom_nodes[bottom_id].n); diff --git a/plugins/import/SocialNetwork/HolmeKim.cpp b/plugins/import/SocialNetwork/HolmeKim.cpp index 89b6a84145..fe25a3d1a2 100644 --- a/plugins/import/SocialNetwork/HolmeKim.cpp +++ b/plugins/import/SocialNetwork/HolmeKim.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -97,11 +97,11 @@ struct HolmeKim : public ImportModule { k_sum += graph->deg(nodes[j]); } - double proba = tlp::randomDouble(); + double proba = tlp::randomNumber(); for (uint j = 0; j < m; ++j) { // Preferential attachment - double pr = tlp::randomDouble(); + double pr = tlp::randomNumber(); double pr_sum = 0; double firstNeighbour = 0; @@ -125,14 +125,14 @@ struct HolmeKim : public ImportModule { if (!freeNeighbours.empty()) { // randomly choose one of the free neighbours to connect with - uint randomNeighbour = tlp::randomUnsignedInteger(freeNeighbours.size() - 1); + uint randomNeighbour = tlp::randomNumber(freeNeighbours.size() - 1); graph->addEdge(nodes[i], freeNeighbours[randomNeighbour]); continue; } } // Preferential attachment - pr = tlp::randomDouble(); + pr = tlp::randomNumber(); pr_sum = 0; uint rn = 0; diff --git a/plugins/import/SocialNetwork/KlemmEguiluzModel.cpp b/plugins/import/SocialNetwork/KlemmEguiluzModel.cpp index fadc934e03..5036cba7fe 100644 --- a/plugins/import/SocialNetwork/KlemmEguiluzModel.cpp +++ b/plugins/import/SocialNetwork/KlemmEguiluzModel.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -105,10 +105,10 @@ struct KlemmEguiluzModel : public ImportModule { // the new node is connected to m nodes for (uint j = 0; j < i; ++j) { if (activated[j]) { - double proba = tlp::randomDouble(); + double proba = tlp::randomNumber(); if (proba < mu) { // rewire the edge to a random node chosen with preferential attachment - pr = tlp::randomDouble(); + pr = tlp::randomNumber(); pr_sum = 0; uint sn = 0; @@ -136,7 +136,7 @@ struct KlemmEguiluzModel : public ImportModule { } } - pr = tlp::randomDouble(); + pr = tlp::randomNumber(); pr_sum = 0; uint sn = 0; diff --git a/plugins/import/SocialNetwork/LiuEtAl.cpp b/plugins/import/SocialNetwork/LiuEtAl.cpp index 0955a15313..d2b2749d81 100644 --- a/plugins/import/SocialNetwork/LiuEtAl.cpp +++ b/plugins/import/SocialNetwork/LiuEtAl.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -92,7 +92,7 @@ struct LiuEtAl : public ImportModule { * Preferential attachment */ for (j = 0; j < m / 2; ++j) { - double pr = tlp::randomDouble(); + double pr = tlp::randomNumber(); double pr_sum = 0; uint rn = 0; @@ -111,7 +111,7 @@ struct LiuEtAl : public ImportModule { for (auto n : graph->getInOutNodes(nodes[rn])) { k2_sum += graph->deg(n); } - pr = tlp::randomDouble(); + pr = tlp::randomNumber(); pr_sum = 0; node v; diff --git a/plugins/import/SocialNetwork/WangEtAl.cpp b/plugins/import/SocialNetwork/WangEtAl.cpp index 95dff5dd50..5c8a1d1e9f 100644 --- a/plugins/import/SocialNetwork/WangEtAl.cpp +++ b/plugins/import/SocialNetwork/WangEtAl.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -69,7 +69,7 @@ struct WangEtAl : public ImportModule { } } - int id = tlp::randomInteger(nbe - 1); + int id = tlp::randomNumber(nbe - 1); auto [src, tgt] = graph->ends(e[id]); e[nbe] = graph->addEdge(src, nodes[i]); e[nbe + 1] = graph->addEdge(tgt, nodes[i]); diff --git a/plugins/import/SocialNetwork/WangRong.cpp b/plugins/import/SocialNetwork/WangRong.cpp index f6a583c270..a81a4a3f7e 100644 --- a/plugins/import/SocialNetwork/WangRong.cpp +++ b/plugins/import/SocialNetwork/WangRong.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -115,7 +115,7 @@ struct WangRong : public ImportModule { double k_sum = 2 * graph->numberOfEdges(); for (i = nbNodes; i < (nbNodes + m); ++i) { - double pr = tlp::randomDouble(); + double pr = tlp::randomNumber(); double pr_sum = 0; uint rn = 0; diff --git a/plugins/import/SocialNetwork/WattsStrotgatzModel.cpp b/plugins/import/SocialNetwork/WattsStrotgatzModel.cpp index 8bb3e7d17a..18d74c8cb7 100644 --- a/plugins/import/SocialNetwork/WattsStrotgatzModel.cpp +++ b/plugins/import/SocialNetwork/WattsStrotgatzModel.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -130,11 +130,11 @@ struct WattsStrogatzModel : public ImportModule { if (original_model) { for (auto e : graph->edges()) { - if (tlp::randomDouble() < p) { + if (tlp::randomNumber() < p) { n1 = graph->source(e); do { - n2 = nodes[tlp::randomInteger(nbNodes - 1)]; + n2 = nodes[tlp::randomNumber(nbNodes - 1)]; } while (graph->hasEdge(n1, n2, false)); // only reroute target; ensure to keep the graph connected @@ -143,10 +143,10 @@ struct WattsStrogatzModel : public ImportModule { } } else { for (auto e : graph->edges()) { - if (tlp::randomDouble() < p) { + if (tlp::randomNumber() < p) { do { - n1 = nodes[tlp::randomInteger(nbNodes - 1)]; - n2 = nodes[tlp::randomInteger(nbNodes - 1)]; + n1 = nodes[tlp::randomNumber(nbNodes - 1)]; + n2 = nodes[tlp::randomNumber(nbNodes - 1)]; } while (graph->hasEdge(n1, n2, false)); graph->setEnds(e, n1, n2); diff --git a/plugins/interactor/Fisheye/FisheyeInteractor.cpp b/plugins/interactor/Fisheye/FisheyeInteractor.cpp index b0dc0871d1..ce61dfd991 100644 --- a/plugins/interactor/Fisheye/FisheyeInteractor.cpp +++ b/plugins/interactor/Fisheye/FisheyeInteractor.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -116,14 +116,14 @@ unique_ptr FisheyeInteractorComponent::fisheyeShader; FisheyeInteractorComponent::FisheyeInteractorComponent(FisheyeConfigWidget *configWidget) : _configWidget(configWidget), _activateFisheye(false) { - _fboTextureId = "fisheyeTexture" + to_string(reinterpret_cast(this)); + _fboTextureId = "fisheyeTexture" + to_string(reinterpret_cast(this)); } FisheyeInteractorComponent::FisheyeInteractorComponent( const FisheyeInteractorComponent &fisheyeInteractorComponent) { _configWidget = fisheyeInteractorComponent._configWidget; _activateFisheye = false; - _fboTextureId = "fisheyeTexture" + to_string(reinterpret_cast(this)); + _fboTextureId = "fisheyeTexture" + to_string(reinterpret_cast(this)); } FisheyeInteractorComponent::~FisheyeInteractorComponent() { diff --git a/plugins/layout/Circular.cpp b/plugins/layout/Circular.cpp index 3442f16c96..77727ab07b 100644 --- a/plugins/layout/Circular.cpp +++ b/plugins/layout/Circular.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -51,7 +51,7 @@ static void dfs(node n, const Graph *sg, deque &st, vector &maxCycle ++nbCalls; if (nbCalls % 10000 == 0) { - pluginProgress->progress(randomInteger(100), 100); + pluginProgress->progress(randomNumber(100), 100); nbCalls = 0; } diff --git a/plugins/layout/GEMLayout.cpp b/plugins/layout/GEMLayout.cpp index 48d3f26244..be82cdea0d 100644 --- a/plugins/layout/GEMLayout.cpp +++ b/plugins/layout/GEMLayout.cpp @@ -90,7 +90,7 @@ GEMLayout::GEMLayout(const tlp::PluginContext *context) GEMLayout::~GEMLayout() = default; //========================================================= uint GEMLayout::select() { - return randomInteger(graph->numberOfNodes() - 1); + return randomNumber(graph->numberOfNodes() - 1); } //========================================================= void GEMLayout::vertexdata_init(const float starttemp) { @@ -127,7 +127,7 @@ Coord GEMLayout::computeForces(uint v, float shake, float gravity, bool testPlac // Init force in a random position for (uint cnt = 0; cnt < _dim; ++cnt) { - force[cnt] = shake - float(randomDouble(2. * shake)); + force[cnt] = shake - float(randomNumber(2. * shake)); } // Add central force diff --git a/plugins/layout/GEMLayout.h b/plugins/layout/GEMLayout.h index 6475595851..4fd5a6f66d 100644 --- a/plugins/layout/GEMLayout.h +++ b/plugins/layout/GEMLayout.h @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -118,7 +118,7 @@ class GEMLayout : public tlp::LayoutAlgorithm { * GEM3D variables */ - unsigned long Iteration; + ulong Iteration; float _temperature; tlp::Coord _center; float _maxtemp; diff --git a/plugins/layout/Grip/Grip.cpp b/plugins/layout/Grip/Grip.cpp index 2a750a4cb6..08b40526b0 100644 --- a/plugins/layout/Grip/Grip.cpp +++ b/plugins/layout/Grip/Grip.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -171,7 +171,7 @@ void Grip::firstNodesPlacement() { g->addNode(n1); g->addNode(n2); g->addNode(n3); - result->rotateX(3.14159 / 2. - (3.14159 * randomInteger(1)), g->getNodes(), g->getEdges()); + result->rotateX(3.14159 / 2. - (3.14159 * randomNumber(1)), g->getNodes(), g->getEdges()); currentGraph->delSubGraph(g); const Coord &c1 = result->getNodeValue(n1); @@ -248,10 +248,10 @@ void Grip::initialPlacement(uint start, uint end) { nbConsidered += 1.; } - double alpha = edgeLength / 6.0 * randomDouble(); + double alpha = edgeLength / 6.0 * randomNumber(); Coord alea = - Coord(alpha - (2. * alpha * randomInteger(1)), alpha - (2. * alpha * randomInteger(1)), - (alpha - (2. * alpha * randomInteger(1)))); + Coord(alpha - (2. * alpha * randomNumber(1)), alpha - (2. * alpha * randomNumber(1)), + (alpha - (2. * alpha * randomNumber(1)))); if (_dim == 2) { alea[2] = 0.; @@ -381,10 +381,10 @@ void Grip::fr_reffinement(uint start, uint end) { } if (!(euclidian_dist_sqr > 1E-4)) { - double alpha = randomDouble(2.0); - c_tmp = Coord(alpha - (2. * alpha * randomInteger(1)), - alpha - (2. * alpha * randomInteger(1)), - alpha - (2. * alpha * randomInteger(1))); + double alpha = randomNumber(2.0); + c_tmp = + Coord(alpha - (2. * alpha * randomNumber(1)), alpha - (2. * alpha * randomNumber(1)), + alpha - (2. * alpha * randomNumber(1))); if (_dim == 2) { c_tmp[2] = 0.; @@ -457,8 +457,8 @@ void Grip::init() { double diam = sqrt(currentGraph->numberOfNodes()); for (auto n : currentGraph->nodes()) { - Coord alea = Coord(diam - (2. * diam * randomInteger(1)), diam - (2. * diam * randomInteger(1)), - diam - (2. * diam * randomInteger(1))); + Coord alea = Coord(diam - (2. * diam * randomNumber(1)), diam - (2. * diam * randomNumber(1)), + diam - (2. * diam * randomNumber(1))); if (_dim == 2) { alea[2] = 0.; diff --git a/plugins/layout/Random.cpp b/plugins/layout/Random.cpp index bee93424c3..e62d789232 100644 --- a/plugins/layout/Random.cpp +++ b/plugins/layout/Random.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -39,7 +39,7 @@ bool Random::run() { for (auto n : graph->nodes()) { result->setNodeValue( - n, Coord(randomInteger(1024), randomInteger(1024), is3D ? randomInteger(1024) : 0)); + n, Coord(randomNumber(1024), randomNumber(1024), is3D ? randomNumber(1024) : 0)); } return true; diff --git a/plugins/metric/Random.cpp b/plugins/metric/Random.cpp index 0bb3b4d9ba..4ede5c9c43 100644 --- a/plugins/metric/Random.cpp +++ b/plugins/metric/Random.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -65,13 +65,13 @@ bool RandomMetric::run() { if (nodes) { for (auto n : graph->nodes()) { - result->setNodeValue(n, randomDouble()); + result->setNodeValue(n, randomNumber()); } } if (edges) { for (auto e : graph->edges()) { - result->setEdgeValue(e, randomDouble()); + result->setEdgeValue(e, randomNumber()); } } diff --git a/plugins/view/ParallelCoordinatesView/src/QuantitativeParallelAxis.cpp b/plugins/view/ParallelCoordinatesView/src/QuantitativeParallelAxis.cpp index df441703d4..a8da573a39 100644 --- a/plugins/view/ParallelCoordinatesView/src/QuantitativeParallelAxis.cpp +++ b/plugins/view/ParallelCoordinatesView/src/QuantitativeParallelAxis.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -73,7 +73,7 @@ void QuantitativeParallelAxis::setAxisLabels() { } else { auto min = static_cast(axisMinValue); auto max = static_cast(axisMaxValue); - unsigned long long incrementStep = (max - min) / DEFAULT_NB_AXIS_GRAD; + ulong incrementStep = (max - min) / DEFAULT_NB_AXIS_GRAD; if (incrementStep < 1) { incrementStep = 1; diff --git a/plugins/view/SOMView/SOMLIB/SOMAlgorithm.cpp b/plugins/view/SOMView/SOMLIB/SOMAlgorithm.cpp index 5f4575b2f9..79a962587e 100644 --- a/plugins/view/SOMView/SOMLIB/SOMAlgorithm.cpp +++ b/plugins/view/SOMView/SOMLIB/SOMAlgorithm.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -165,7 +165,7 @@ node SOMAlgorithm::findBMU(SOMMap *map, const DynamicVector &input, doub n = matchList.front(); } else { // Take randomly a vector in the matchlist. - unsigned int num = randomUnsignedInteger(matchList.size() - 1); + unsigned int num = randomNumber(matchList.size() - 1); assert(num < matchList.size()); n = matchList[num]; } diff --git a/tests/external_plugins_build/plugins_src/TestPlugins.cpp b/tests/external_plugins_build/plugins_src/TestPlugins.cpp index c7f074dda7..f7a0d703e8 100644 --- a/tests/external_plugins_build/plugins_src/TestPlugins.cpp +++ b/tests/external_plugins_build/plugins_src/TestPlugins.cpp @@ -63,8 +63,8 @@ class TestDoubleAlgorithmPlugin : public tlp::DoubleAlgorithm { TestDoubleAlgorithmPlugin(tlp::PluginContext *context) : tlp::DoubleAlgorithm(context) {} bool run() override { - result->setAllNodeValue(tlp::randomDouble()); - result->setNodeValue(graph->getRandomNode(), tlp::randomDouble()); + result->setAllNodeValue(tlp::randomNumber()); + result->setNodeValue(graph->getRandomNode(), tlp::randomNumber()); return true; } }; @@ -81,8 +81,8 @@ class TestIntegerAlgorithmPlugin : public tlp::IntegerAlgorithm { TestIntegerAlgorithmPlugin(tlp::PluginContext *context) : tlp::IntegerAlgorithm(context) {} bool run() override { - result->setAllNodeValue(tlp::randomInteger(10000)); - result->setNodeValue(graph->getRandomNode(), tlp::randomInteger(10000)); + result->setAllNodeValue(tlp::randomNumber(10000)); + result->setNodeValue(graph->getRandomNode(), tlp::randomNumber(10000)); return true; } }; diff --git a/tests/library/talipot/DoublePropertyTest.cpp b/tests/library/talipot/DoublePropertyTest.cpp index 292047ce0d..2aa9668699 100644 --- a/tests/library/talipot/DoublePropertyTest.cpp +++ b/tests/library/talipot/DoublePropertyTest.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -185,8 +185,8 @@ void DoublePropertyTest::testDoublePropertySetAllValue() { sg->addNode(graph->target(e1)); sg->addEdge(e1); - const double v1 = tlp::randomDouble(); - const double v2 = tlp::randomDouble(); + const double v1 = tlp::randomNumber(); + const double v2 = tlp::randomNumber(); // create a double property and set all values for nodes and edges DoubleProperty *prop = graph->getLocalDoubleProperty(doublePropertyName); @@ -244,8 +244,8 @@ void DoublePropertyTest::testDoublePropertySetAllValue() { void DoublePropertyTest::testDoublePropertySetDefaultValue() { - const double v1 = tlp::randomDouble(); - const double v2 = tlp::randomDouble(); + const double v1 = tlp::randomNumber(); + const double v2 = tlp::randomNumber(); // create a double property and set all values for nodes and edges DoubleProperty *prop = graph->getLocalDoubleProperty(doublePropertyName); @@ -325,7 +325,7 @@ void DoublePropertyTest::testDoublePropertySetDefaultValue() { // check that after pushing a graph, adding a new node and changing the default property value // the node property value gets restored to the default value of the property the time the node // was created - double v3 = tlp::randomDouble(); + double v3 = tlp::randomNumber(); // push graph state graph->push(); // add a node, its property value should be v2 @@ -357,7 +357,7 @@ void DoublePropertyTest::testVectorDoublePropertyCopyFrom() { CPPUNIT_ASSERT(nVectorProp[n] == prop->getNodeValue(n)); } for (auto e : graph->edges()) { - prop->setEdgeValue(e, tlp::randomDouble()); + prop->setEdgeValue(e, tlp::randomNumber()); } EdgeVectorProperty eVectorProp(graph); eVectorProp.copyFromProperty(prop); diff --git a/tests/library/talipot/ImportExportTest.cpp b/tests/library/talipot/ImportExportTest.cpp index c370c4dafc..a8db77bb57 100644 --- a/tests/library/talipot/ImportExportTest.cpp +++ b/tests/library/talipot/ImportExportTest.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -222,18 +222,18 @@ void ImportExportTest::testSubGraphsImportExport() { } static Color genRandomColor() { - return Color(uchar(tlp::randomUnsignedInteger(255)), uchar(tlp::randomUnsignedInteger(255)), - uchar(tlp::randomUnsignedInteger(255)), uchar(tlp::randomUnsignedInteger(255))); + return Color(uchar(tlp::randomNumber(255)), uchar(tlp::randomNumber(255)), + uchar(tlp::randomNumber(255)), uchar(tlp::randomNumber(255))); } static Coord genRandomCoord() { - return tlp::Coord(float(tlp::randomDouble(1000)), float(tlp::randomDouble(1000)), - float(tlp::randomDouble(1000))); + return tlp::Coord(float(tlp::randomNumber(1000)), float(tlp::randomNumber(1000)), + float(tlp::randomNumber(1000))); } static Size genRandomSize() { - return tlp::Size(float(tlp::randomDouble(10)), float(tlp::randomDouble(10)), - float(tlp::randomDouble(10))); + return tlp::Size(float(tlp::randomNumber(10)), float(tlp::randomNumber(10)), + float(tlp::randomNumber(10))); } Graph *ImportExportTest::createSimpleGraph() const { @@ -284,7 +284,7 @@ Graph *ImportExportTest::createSimpleGraph() const { std::ostringstream oss; for (auto n : original->nodes()) { - uint vecSize = tlp::randomUnsignedInteger(9) + 1; + uint vecSize = tlp::randomNumber(9) + 1; vector boolVec; vector colorVec; vector coordVec; @@ -296,18 +296,18 @@ Graph *ImportExportTest::createSimpleGraph() const { boolVec.push_back((n.id + i) % 2 == 0); coordVec.push_back(genRandomCoord()); colorVec.push_back(genRandomColor()); - doubleVec.push_back(tlp::randomDouble(DBL_MAX)); - intVec.push_back(tlp::randomInteger(INT_MAX)); + doubleVec.push_back(tlp::randomNumber(DBL_MAX)); + intVec.push_back(tlp::randomNumber(INT_MAX)); sizeVec.push_back(genRandomSize()); - oss << tlp::randomDouble(); + oss << tlp::randomNumber(); stringVec.push_back(oss.str()); oss.str(""); } booleanProp->setNodeValue(n, n.id % 2 == 0); colorProp->setNodeValue(n, genRandomColor()); - doubleProp->setNodeValue(n, tlp::randomDouble(DBL_MAX)); - integerProp->setNodeValue(n, tlp::randomInteger(INT_MAX)); + doubleProp->setNodeValue(n, tlp::randomNumber(DBL_MAX)); + integerProp->setNodeValue(n, tlp::randomNumber(INT_MAX)); layoutProp->setNodeValue(n, genRandomCoord()); sizeProp->setNodeValue(n, genRandomSize()); oss << "node " << n.id; @@ -325,7 +325,7 @@ Graph *ImportExportTest::createSimpleGraph() const { for (auto e : original->edges()) { - uint vecSize = tlp::randomUnsignedInteger(9) + 1; + uint vecSize = tlp::randomNumber(9) + 1; vector boolVec; vector colorVec; vector coordVec; @@ -338,18 +338,18 @@ Graph *ImportExportTest::createSimpleGraph() const { boolVec.push_back((e.id + i) % 2 == 0); coordVec.push_back(genRandomCoord()); colorVec.push_back(genRandomColor()); - doubleVec.push_back(tlp::randomDouble(DBL_MAX)); - intVec.push_back(tlp::randomInteger(INT_MAX)); + doubleVec.push_back(tlp::randomNumber(DBL_MAX)); + intVec.push_back(tlp::randomNumber(INT_MAX)); sizeVec.push_back(genRandomSize()); - oss << tlp::randomDouble(); + oss << tlp::randomNumber(); stringVec.push_back(oss.str()); oss.str(""); } booleanProp->setEdgeValue(e, e.id % 2 == 0); colorProp->setEdgeValue(e, genRandomColor()); - doubleProp->setEdgeValue(e, tlp::randomDouble(DBL_MAX)); - integerProp->setEdgeValue(e, tlp::randomInteger(INT_MAX)); + doubleProp->setEdgeValue(e, tlp::randomNumber(DBL_MAX)); + integerProp->setEdgeValue(e, tlp::randomNumber(INT_MAX)); layoutProp->setEdgeValue(e, coordVec); sizeProp->setEdgeValue(e, genRandomSize()); oss << "edge " << e.id; diff --git a/tests/library/talipot/MutableContainerTest.cpp b/tests/library/talipot/MutableContainerTest.cpp index d5b314140c..f497d4addf 100644 --- a/tests/library/talipot/MutableContainerTest.cpp +++ b/tests/library/talipot/MutableContainerTest.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2021 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -218,7 +218,7 @@ void MutableContainerTest::testSetGet() { mutString->setAll("Sophie"); for (uint i = 0; i < NBTEST * 10; ++i) { - uint rando = randomUnsignedInteger(NBTEST - 1); + uint rando = randomNumber(NBTEST - 1); mutBool->set(rando, true); mutDouble->set(rando, rando); mutString->set(rando, string("David")); @@ -230,13 +230,13 @@ void MutableContainerTest::testSetGet() { mutBool->setAll(true); for (uint i = 0; i < NBTEST * 10; ++i) { - uint rando = randomUnsignedInteger(NBTEST - 1); + uint rando = randomNumber(NBTEST - 1); mutBool->set(rando, false); CPPUNIT_ASSERT(!mutBool->get(rando)); } for (uint i = 0; i < NBTEST * 10; ++i) { - uint rando = randomUnsignedInteger(NBTEST - 1); + uint rando = randomNumber(NBTEST - 1); bool isNotDefault = true; mutBool->set(rando, true); CPPUNIT_ASSERT(mutBool->get(rando, isNotDefault)); diff --git a/tests/library/talipot/SuperGraphTest.cpp b/tests/library/talipot/SuperGraphTest.cpp index 44336b8286..24c2b82fe5 100644 --- a/tests/library/talipot/SuperGraphTest.cpp +++ b/tests/library/talipot/SuperGraphTest.cpp @@ -297,8 +297,8 @@ void SuperGraphTest::testOrderEdgeAndSwap() { // change edges order for (uint j = 0; j < NB_EDGES; ++j) { - uint u = randomUnsignedInteger(NB_EDGES - 1); - uint v = randomUnsignedInteger(NB_EDGES - 1); + uint u = randomNumber(NB_EDGES - 1); + uint v = randomNumber(NB_EDGES - 1); std::swap(edges[u], edges[v]); } @@ -309,8 +309,8 @@ void SuperGraphTest::testOrderEdgeAndSwap() { // swap two edges for (uint j = 0; j < NB_EDGES; ++j) { - uint u = randomUnsignedInteger(NB_EDGES - 1); - uint v = randomUnsignedInteger(NB_EDGES - 1); + uint u = randomNumber(NB_EDGES - 1); + uint v = randomNumber(NB_EDGES - 1); graph->swapEdgeOrder(nodes[0], edges[u], edges[v]); std::swap(edges[u], edges[v]); } diff --git a/tests/plugins/BasicPluginsTest.cpp b/tests/plugins/BasicPluginsTest.cpp index 346b5f0609..81d031b974 100644 --- a/tests/plugins/BasicPluginsTest.cpp +++ b/tests/plugins/BasicPluginsTest.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2019-2022 The Talipot developers + * Copyright (C) 2019-2023 The Talipot developers * * Talipot is a fork of Tulip, created by David Auber * and the Tulip development Team from LaBRI, University of Bordeaux @@ -377,7 +377,7 @@ void BasicPluginsTest::testEqualValueClustering() { for (uint i = 0; i < NB_ADD; ++i) { nodes.push_back(graph->addNode()); - metric->setNodeValue(nodes[i], randomUnsignedInteger(NB_ADD - 1)); + metric->setNodeValue(nodes[i], randomNumber(NB_ADD - 1)); } uint NB_EDGES = EDGE_RATIO * NB_ADD;