Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renewable containers #1809

Merged
merged 10 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/centos7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
release:
types: [created]
push:
branches:
- develop
- branches:
- develop
schedule:
- cron: '21 2 * * *'

Expand Down Expand Up @@ -54,9 +54,14 @@ jobs:
unzip -q ortools.zip
rm ortools.zip

- name: Install gcc 10
run: |
yum install -y centos-release-scl
yum install -y devtoolset-10-gcc*

- name: Configure
run: |
source /opt/rh/devtoolset-9/enable
source /opt/rh/devtoolset-10/enable
cmake3 -B _build -S src \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
Expand All @@ -70,7 +75,7 @@ jobs:

- name: Build
run: |
source /opt/rh/devtoolset-9/enable
source /opt/rh/devtoolset-10/enable
source /opt/rh/rh-git227/enable
cmake3 --build _build --config Release -j2
ccache -s
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/oracle8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
release:
types: [created]
push:
branches:
- develop
- branches:
- develop
schedule:
- cron: '21 2 * * *'

Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Install libraries
run: |
dnf install -y epel-release git cmake wget rpm-build redhat-lsb-core
dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-9-toolchain zlib-devel
dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-10-toolchain zlib-devel

- name: Checkout
run: |
Expand All @@ -51,7 +51,7 @@ jobs:

- name: Configure
run: |
source /opt/rh/gcc-toolset-9/enable
source /opt/rh/gcc-toolset-10/enable
cmake -B _build -S src \
-DCMAKE_BUILD_TYPE=release \
-DBUILD_TESTING=ON \
Expand All @@ -60,8 +60,8 @@ jobs:

- name: Build
run: |
source /opt/rh/gcc-toolset-9/enable
cmake --build _build --config Release -j2
source /opt/rh/gcc-toolset-10/enable
cmake --build _build --config Release -j$(nproc)

- name: Run unit and end-to-end tests
if: ${{ env.IS_PUSH == 'true' }}
Expand Down
39 changes: 21 additions & 18 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
os: [ubuntu-20.04]
os: [ ubuntu-20.04 ]

env:
SONAR_SERVER_URL: "https://sonarcloud.io"
Expand All @@ -37,9 +37,10 @@ jobs:

- name: Install libraries
run: |
sudo apt-get update
sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev
sudo apt-get install libboost-test-dev
sudo apt-get update
sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev
sudo apt-get install libboost-test-dev
sudo apt-get install g++-10 gcc-10

- name: Read antares-deps version
id: antares-deps-version
Expand Down Expand Up @@ -67,8 +68,8 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip3 install -r src/tests/examples/requirements.txt
python -m pip install --upgrade pip
pip3 install -r src/tests/examples/requirements.txt

- name: Init submodule
run: |
Expand All @@ -77,21 +78,23 @@ jobs:

- name: Configure
run: |
cmake -B _build -S src \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DDEPS_INSTALL_DIR=./rte-antares-deps-Debug \
-DCODE_COVERAGE=ON \
-DCMAKE_BUILD_TYPE=debug \
-DCMAKE_PREFIX_PATH="../install;${{ env.ORTOOLS_DIR }}/install" \
-DBUILD_TESTING=ON \
-DMZ_CODE_COVERAGE=ON \
-DBUILD_not_system=OFF \
-DPython3_EXECUTABLE='${{ steps.setup-python.outputs.python-path }}'
cmake -B _build -S src \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=/usr/bin/gcc-10 \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER=/usr/bin/g++-10 \
-DDEPS_INSTALL_DIR=./rte-antares-deps-Debug \
-DCODE_COVERAGE=ON \
-DCMAKE_BUILD_TYPE=debug \
-DCMAKE_PREFIX_PATH="../install;${{ env.ORTOOLS_DIR }}/install" \
-DBUILD_TESTING=ON \
-DMZ_CODE_COVERAGE=ON \
-DBUILD_not_system=OFF \
-DPython3_EXECUTABLE='${{ steps.setup-python.outputs.python-path }}'

- name: Build
run: |
build-wrapper-linux-x86-64 --out-dir $GITHUB_WORKSPACE/_build/output cmake --build _build --config release -j2
build-wrapper-linux-x86-64 --out-dir $GITHUB_WORKSPACE/_build/output cmake --build _build --config release -j2

- name: Test and generate coverage
continue-on-error: true
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ubuntu-system-deps-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
sudo apt-get update
sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev
sudo apt-get install libboost-test-dev
sudo apt-get install g++-10 gcc-10

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -42,7 +43,7 @@ jobs:

- name: Configure
run: |
cmake -B _build -S src -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=release -DBUILD_TESTING=ON
cmake -B _build -S src -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=/usr/bin/gcc-10 -DCMAKE_CXX_COMPILER=/usr/bin/g++-10 -DCMAKE_BUILD_TYPE=release -DBUILD_TESTING=ON

- name: Build
run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
sudo apt-get update
sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev
sudo apt-get install libboost-test-dev
sudo apt-get install g++-10 gcc-10

- name: Read antares-deps version
id: antares-deps-version
Expand Down Expand Up @@ -92,7 +93,9 @@ jobs:
run: |
cmake -B _build -S src \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=/usr/bin/gcc-10 \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER=/usr/bin/g++-10 \
-DDEPS_INSTALL_DIR=${{github.workspace}}/rte-antares-deps-Release \
-DCMAKE_BUILD_TYPE=release \
-DBUILD_TESTING=ON \
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ include(CheckCXXCompilerFlag)
include(CMakeDependentOption)
include(FetchContent)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

if (DEFINED VCPKG_ROOT)
include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
Expand Down
2 changes: 1 addition & 1 deletion src/cmake/common-settings.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Common FLAGS for all compilers
#
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

set(COMMON_GCC_FLAGS "-Wall -W -Wextra -Wfatal-errors")
if (NOT WIN32)
Expand Down
2 changes: 1 addition & 1 deletion src/ext/yuni/src/yuni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ include("${CMAKE_CURRENT_SOURCE_DIR}/../cmake/common-settings.cmake")
include("${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules.cmake")


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

if(YUNI_MODULE_CORE)
# The header yuni.h must be available
Expand Down
12 changes: 6 additions & 6 deletions src/ext/yuni/src/yuni/core/string/operators.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -112,39 +112,39 @@ inline Yuni::CString<SizeT, ExpT> operator+(const Yuni::CString<SizeT, ExpT>& rh
template<uint SizeT, bool ExpT>
inline bool operator==(const char* lhs, const Yuni::CString<SizeT, ExpT>& rhs)
{
return rhs == lhs;
return rhs.equals(lhs);
}

template<uint SizeT, bool ExpT>
inline bool operator!=(const char* lhs, const Yuni::CString<SizeT, ExpT>& rhs)
{
return rhs != lhs;
return !rhs.equals(lhs);
}

template<int N, uint SizeT, bool ExpT>
inline bool operator==(const char lhs[N], const Yuni::CString<SizeT, ExpT>& rhs)
{
return rhs == lhs;
return rhs.equals(lhs);
}

template<int N, uint SizeT, bool ExpT>
inline bool operator!=(const char lhs[N], const Yuni::CString<SizeT, ExpT>& rhs)
{
return rhs != lhs;
return !rhs.equals(lhs);
}

template<class TraitsT, class AllocT, uint SizeT, bool ExpT>
inline bool operator==(const std::basic_string<char, TraitsT, AllocT>& lhs,
const Yuni::CString<SizeT, ExpT>& rhs)
{
return rhs == lhs;
return rhs.equals(lhs);
}

template<class TraitsT, class AllocT, uint SizeT, bool ExpT>
inline bool operator!=(const std::basic_string<char, TraitsT, AllocT>& lhs,
const Yuni::CString<SizeT, ExpT>& rhs)
{
return rhs != lhs;
return !rhs.equals(lhs);
}

inline bool operator==(const AnyString& mbs, Yuni::UTF8::Char c)
Expand Down
20 changes: 5 additions & 15 deletions src/libs/antares/study/parts/common/cluster_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ bool ClusterList<ClusterT>::exists(const Data::ClusterName& id) const
}

template<class ClusterT>
Data::ClusterList<ClusterT>::ClusterList() : byIndex(nullptr), groupCount(ClusterT::groupMax, 0)
Data::ClusterList<ClusterT>::ClusterList() : groupCount(ClusterT::groupMax, 0)
{
}

Expand All @@ -109,12 +109,7 @@ Data::ClusterList<ClusterT>::~ClusterList()
template<class ClusterT>
void ClusterList<ClusterT>::clear()
{
if (byIndex)
{
delete[] byIndex;
byIndex = nullptr;
}

byIndex.clear();
if (not cluster.empty())
cluster.clear();
}
Expand Down Expand Up @@ -184,25 +179,20 @@ void ClusterList<ClusterT>::storeTimeseriesNumbers(Solver::IResultWriter& writer
template<class ClusterT>
void ClusterList<ClusterT>::rebuildIndex()
{
delete[] byIndex;
byIndex.clear();

if (not empty())
{
uint indx = 0;
using ClusterWeakPtr = ClusterT*;
byIndex = new ClusterWeakPtr[size()];

auto end = cluster.end();
for (auto i = cluster.begin(); i != end; ++i)
byIndex.resize(size());
for (auto i = cluster.begin(); i != cluster.end(); ++i)
{
auto cluster = i->second.get();
byIndex[indx] = cluster;
cluster->index = indx;
++indx;
}
}
else
byIndex = nullptr;
}

template<class ClusterT>
Expand Down
2 changes: 1 addition & 1 deletion src/libs/antares/study/parts/common/cluster_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class ClusterList

public:
//! All clusters by their index
ClusterT** byIndex;
std::vector<ClusterT*> byIndex;
//! All clusters
Map cluster;

Expand Down
7 changes: 0 additions & 7 deletions src/libs/antares/study/parts/renewable/cluster_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ namespace Antares
{
namespace Data
{
RenewableClusterList::~RenewableClusterList()
{
}

RenewableClusterList::RenewableClusterList()
{
}

YString RenewableClusterList::typeID() const
{
Expand Down
2 changes: 0 additions & 2 deletions src/libs/antares/study/parts/renewable/cluster_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ namespace Data
class RenewableClusterList : public ClusterList<RenewableCluster>
{
public:
RenewableClusterList();
~RenewableClusterList();
// Overriden virtual methods
YString typeID() const override;
bool loadFromFolder(const AnyString& folder, Area* area);
Expand Down
5 changes: 0 additions & 5 deletions src/libs/antares/study/parts/renewable/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,15 @@ void PartRenewable::prepareAreaWideIndexes()
// And init the areaWideIndex (unique index for a given area)
if (list.empty())
{
clusters.clear();
return;
}

clusters.assign(list.size(), nullptr);

auto end = list.end();
uint idx = 0;
for (auto i = list.begin(); i != end; ++i)
{
RenewableCluster* t = i->second.get();
t->areaWideIndex = idx;
clusters[idx] = t;
++idx;
}
}
Expand Down Expand Up @@ -107,7 +103,6 @@ uint PartRenewable::removeDisabledClusters()
void PartRenewable::reset()
{
list.clear();
clusters.clear();
}

} // namespace Data
Expand Down
16 changes: 0 additions & 16 deletions src/libs/antares/study/parts/renewable/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,6 @@ class PartRenewable
//! List of all renewable clusters (enabled and disabled)
RenewableClusterList list;

/*!
** \brief All clusters for the area
**
** This variable is only available at runtime from the solver.
** It is initialized in the same time that the runtime data.
**
** This list is mainly used to ensure the same order of the
** renewable clusters in the outputs.
*/
std::vector<RenewableCluster*> clusters;
//! How many clusters have we got ?
// Only available from the solver
inline size_t clusterCount() const
{
return clusters.size();
}
}; // class PartRenewable

} // namespace Data
Expand Down
Loading