From 5c8796b44a1c807c467952990fe9738d227e46d7 Mon Sep 17 00:00:00 2001 From: Sylvain Leclerc Date: Thu, 11 Apr 2024 13:32:51 +0200 Subject: [PATCH] Remove unnecessary ".inc.hxx" files (#2031) Replaces ugly includes which behaviour is guided by preprocessor definition, with standard template instantiation mechanisms. --------- Signed-off-by: Sylvain Leclerc --- src/solver/variable/CMakeLists.txt | 11 - src/solver/variable/adequacy/area.cpp | 25 -- .../adequacy/area.memory-estimation.cpp | 25 -- .../adequacy/bc.memory-estimation.cpp | 26 -- src/solver/variable/economy/area.cpp | 25 -- .../economy/area.memory-estimation.cpp | 25 -- .../variable/economy/bc.memory-estimation.cpp | 25 -- .../include/antares/solver/variable/area.hxx | 247 ++++++++++++++++ .../antares/solver/variable/area.inc.hxx | 278 ------------------ .../variable/area.memory-estimation.inc.hxx | 48 --- .../variable/bc.memory-estimation.inc.hxx | 44 --- .../solver/variable/bindConstraints.hxx | 13 + 12 files changed, 260 insertions(+), 532 deletions(-) delete mode 100644 src/solver/variable/adequacy/area.cpp delete mode 100644 src/solver/variable/adequacy/area.memory-estimation.cpp delete mode 100644 src/solver/variable/adequacy/bc.memory-estimation.cpp delete mode 100644 src/solver/variable/economy/area.cpp delete mode 100644 src/solver/variable/economy/area.memory-estimation.cpp delete mode 100644 src/solver/variable/economy/bc.memory-estimation.cpp delete mode 100644 src/solver/variable/include/antares/solver/variable/area.inc.hxx delete mode 100644 src/solver/variable/include/antares/solver/variable/area.memory-estimation.inc.hxx delete mode 100644 src/solver/variable/include/antares/solver/variable/bc.memory-estimation.inc.hxx diff --git a/src/solver/variable/CMakeLists.txt b/src/solver/variable/CMakeLists.txt index d727cab3ff..58009ba7b4 100644 --- a/src/solver/variable/CMakeLists.txt +++ b/src/solver/variable/CMakeLists.txt @@ -12,7 +12,6 @@ set(SRC_VARIABLE include/antares/solver/variable/state.hxx include/antares/solver/variable/area.h include/antares/solver/variable/area.hxx - include/antares/solver/variable/area.inc.hxx include/antares/solver/variable/setofareas.h include/antares/solver/variable/setofareas.hxx include/antares/solver/variable/bindConstraints.h @@ -68,9 +67,6 @@ source_group("variable\\common" FILES ${SRC_VARIABLE_COMMON}) set(SRC_VARIABLE_ADEQUACY include/antares/solver/variable/adequacy/all.h - adequacy/area.cpp - adequacy/area.memory-estimation.cpp - adequacy/bc.memory-estimation.cpp include/antares/solver/variable/adequacy/links.h include/antares/solver/variable/adequacy/spilledEnergy.h include/antares/solver/variable/adequacy/overallCost.h @@ -81,9 +77,6 @@ source_group("variable\\adequacy" FILES ${SRC_VARIABLE_ADEQUACY}) set(SRC_VARIABLE_ECONOMY include/antares/solver/variable/economy/all.h include/antares/solver/variable/economy/links.h - economy/area.cpp - economy/area.memory-estimation.cpp - economy/bc.memory-estimation.cpp # Variables for Economy include/antares/solver/variable/economy/max-mrg.h @@ -170,10 +163,6 @@ target_link_libraries(antares-solver-variable add_library(antares-solver-variable-info include/antares/solver/variable/adequacy/all.h include/antares/solver/variable/economy/all.h - economy/area.memory-estimation.cpp - adequacy/area.memory-estimation.cpp - economy/bc.memory-estimation.cpp - adequacy/bc.memory-estimation.cpp include/antares/solver/variable/surveyresults.h include/antares/solver/variable/surveyresults/surveyresults.h include/antares/solver/variable/surveyresults/data.h diff --git a/src/solver/variable/adequacy/area.cpp b/src/solver/variable/adequacy/area.cpp deleted file mode 100644 index 1b86e7c3de..0000000000 --- a/src/solver/variable/adequacy/area.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* -** Copyright 2007-2024, RTE (https://www.rte-france.com) -** See AUTHORS.txt -** SPDX-License-Identifier: MPL-2.0 -** This file is part of Antares-Simulator, -** Adequacy and Performance assessment for interconnected energy networks. -** -** Antares_Simulator is free software: you can redistribute it and/or modify -** it under the terms of the Mozilla Public Licence 2.0 as published by -** the Mozilla Foundation, either version 2 of the License, or -** (at your option) any later version. -** -** Antares_Simulator is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** Mozilla Public Licence 2.0 for more details. -** -** You should have received a copy of the Mozilla Public Licence 2.0 -** along with Antares_Simulator. If not, see . -*/ - -#include "antares/solver/variable/adequacy/all.h" - -#define NEXTTYPE Adequacy::VariablesPerArea -#include "antares/solver/variable/area.inc.hxx" \ No newline at end of file diff --git a/src/solver/variable/adequacy/area.memory-estimation.cpp b/src/solver/variable/adequacy/area.memory-estimation.cpp deleted file mode 100644 index 1a0cfdc732..0000000000 --- a/src/solver/variable/adequacy/area.memory-estimation.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* -** Copyright 2007-2024, RTE (https://www.rte-france.com) -** See AUTHORS.txt -** SPDX-License-Identifier: MPL-2.0 -** This file is part of Antares-Simulator, -** Adequacy and Performance assessment for interconnected energy networks. -** -** Antares_Simulator is free software: you can redistribute it and/or modify -** it under the terms of the Mozilla Public Licence 2.0 as published by -** the Mozilla Foundation, either version 2 of the License, or -** (at your option) any later version. -** -** Antares_Simulator is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** Mozilla Public Licence 2.0 for more details. -** -** You should have received a copy of the Mozilla Public Licence 2.0 -** along with Antares_Simulator. If not, see . -*/ - -#include "antares/solver/variable/adequacy/all.h" - -using NEXTTYPE = Solver::Variable::Adequacy::VariablesPerArea; -#include "antares/solver/variable/area.memory-estimation.inc.hxx" diff --git a/src/solver/variable/adequacy/bc.memory-estimation.cpp b/src/solver/variable/adequacy/bc.memory-estimation.cpp deleted file mode 100644 index 150b96286e..0000000000 --- a/src/solver/variable/adequacy/bc.memory-estimation.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* -** Copyright 2007-2024, RTE (https://www.rte-france.com) -** See AUTHORS.txt -** SPDX-License-Identifier: MPL-2.0 -** This file is part of Antares-Simulator, -** Adequacy and Performance assessment for interconnected energy networks. -** -** Antares_Simulator is free software: you can redistribute it and/or modify -** it under the terms of the Mozilla Public Licence 2.0 as published by -** the Mozilla Foundation, either version 2 of the License, or -** (at your option) any later version. -** -** Antares_Simulator is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** Mozilla Public Licence 2.0 for more details. -** -** You should have received a copy of the Mozilla Public Licence 2.0 -** along with Antares_Simulator. If not, see . -*/ - -#include "antares/solver/variable/adequacy/all.h" - -using bc_next_type = Solver::Variable::Adequacy::VariablesPerBindingConstraints; - -#include "antares/solver/variable/bc.memory-estimation.inc.hxx" diff --git a/src/solver/variable/economy/area.cpp b/src/solver/variable/economy/area.cpp deleted file mode 100644 index cf0b85943f..0000000000 --- a/src/solver/variable/economy/area.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* -** Copyright 2007-2024, RTE (https://www.rte-france.com) -** See AUTHORS.txt -** SPDX-License-Identifier: MPL-2.0 -** This file is part of Antares-Simulator, -** Adequacy and Performance assessment for interconnected energy networks. -** -** Antares_Simulator is free software: you can redistribute it and/or modify -** it under the terms of the Mozilla Public Licence 2.0 as published by -** the Mozilla Foundation, either version 2 of the License, or -** (at your option) any later version. -** -** Antares_Simulator is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** Mozilla Public Licence 2.0 for more details. -** -** You should have received a copy of the Mozilla Public Licence 2.0 -** along with Antares_Simulator. If not, see . -*/ - -#include "antares/solver/variable/economy/all.h" - -#define NEXTTYPE Economy::VariablesPerArea -#include "antares/solver/variable/area.inc.hxx" diff --git a/src/solver/variable/economy/area.memory-estimation.cpp b/src/solver/variable/economy/area.memory-estimation.cpp deleted file mode 100644 index 5bc66b8502..0000000000 --- a/src/solver/variable/economy/area.memory-estimation.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* -** Copyright 2007-2024, RTE (https://www.rte-france.com) -** See AUTHORS.txt -** SPDX-License-Identifier: MPL-2.0 -** This file is part of Antares-Simulator, -** Adequacy and Performance assessment for interconnected energy networks. -** -** Antares_Simulator is free software: you can redistribute it and/or modify -** it under the terms of the Mozilla Public Licence 2.0 as published by -** the Mozilla Foundation, either version 2 of the License, or -** (at your option) any later version. -** -** Antares_Simulator is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** Mozilla Public Licence 2.0 for more details. -** -** You should have received a copy of the Mozilla Public Licence 2.0 -** along with Antares_Simulator. If not, see . -*/ - -#include "antares/solver/variable/economy/all.h" - -using NEXTTYPE = Solver::Variable::Economy::VariablesPerArea; -#include "antares/solver/variable/area.memory-estimation.inc.hxx" diff --git a/src/solver/variable/economy/bc.memory-estimation.cpp b/src/solver/variable/economy/bc.memory-estimation.cpp deleted file mode 100644 index c9c005ed81..0000000000 --- a/src/solver/variable/economy/bc.memory-estimation.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* -** Copyright 2007-2024, RTE (https://www.rte-france.com) -** See AUTHORS.txt -** SPDX-License-Identifier: MPL-2.0 -** This file is part of Antares-Simulator, -** Adequacy and Performance assessment for interconnected energy networks. -** -** Antares_Simulator is free software: you can redistribute it and/or modify -** it under the terms of the Mozilla Public Licence 2.0 as published by -** the Mozilla Foundation, either version 2 of the License, or -** (at your option) any later version. -** -** Antares_Simulator is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** Mozilla Public Licence 2.0 for more details. -** -** You should have received a copy of the Mozilla Public Licence 2.0 -** along with Antares_Simulator. If not, see . -*/ - -#include "antares/solver/variable/economy/all.h" - -using bc_next_type = Solver::Variable::Economy::VariablesPerBindingConstraints; -#include "antares/solver/variable/bc.memory-estimation.inc.hxx" \ No newline at end of file diff --git a/src/solver/variable/include/antares/solver/variable/area.hxx b/src/solver/variable/include/antares/solver/variable/area.hxx index 6b53522b45..a9c21f58ce 100644 --- a/src/solver/variable/include/antares/solver/variable/area.hxx +++ b/src/solver/variable/include/antares/solver/variable/area.hxx @@ -23,6 +23,8 @@ #include +#include "antares/solver/variable/economy/dispatchable-generation-margin.h" + namespace Antares { namespace Solver @@ -270,6 +272,251 @@ inline void Areas::retrieveResultsForLink( pAreas[link->from->index].template retrieveResultsForLink(result, link); } +template +Areas::~Areas() +{ + // Releasing the memory occupied by the areas + delete[] pAreas; +} + +template +void Areas::initializeFromStudy(Data::Study& study) +{ + // The total number of areas + pAreaCount = study.areas.size(); + + // Reserving the memory + pAreas = new NextType[pAreaCount]; + + // For each area... + uint tick = 6; + uint oldPercent = 0; + for (uint i = 0; i != pAreaCount; ++i) + { + // Instancing a new set of variables of the area + auto* currentArea = study.areas.byIndex[i]; + if (!(--tick)) + { + uint newPercent = ((i * 100u) / pAreaCount); + if (newPercent != oldPercent) + { + logs.info() << "Allocating resources " << ((i * 100u) / pAreaCount) << "%"; + oldPercent = newPercent; + } + // Reset the tick + tick = 6; + } + + // Initialize the variables + // From the study + pAreas[i].initializeFromStudy(study); + // From the area + pAreas[i].initializeFromArea(&study, currentArea); + // Does current output variable appears non applicable in areas' output files, not + // districts'. Note that digest gather area and district results. + pAreas[i].broadcastNonApplicability(not currentArea->hydro.reservoirManagement); + + // For each current area's variable, getting the print status, that is : + // is variable's column(s) printed in output (areas) reports ? + pAreas[i].getPrintStatusFromStudy(study); + + pAreas[i].supplyMaxNumberOfColumns(study); + } +} + +template +void Areas::simulationBegin() +{ + for (uint i = 0; i != pAreaCount; ++i) + { + pAreas[i].simulationBegin(); + } +} + +template +void Areas::simulationEnd() +{ + for (uint i = 0; i != pAreaCount; ++i) + { + pAreas[i].simulationEnd(); + } +} + +template +void Areas::hourForEachArea(State& state, uint numSpace) +{ + // For each area... + state.study.areas.each( + [&](Data::Area& area) + { + state.area = &area; // the current area + + // Initializing the state for the current area + state.initFromAreaIndex(area.index, numSpace); + + for (const auto& cluster : area.thermal.list.each_enabled()) + { + // Intiializing the state for the current thermal cluster + state.initFromThermalClusterIndex(cluster->areaWideIndex); + } + + // Variables + auto& variablesForArea = pAreas[area.index]; + variablesForArea.hourForEachArea(state, numSpace); + + // All links + auto end = area.links.end(); + for (auto i = area.links.begin(); i != end; ++i) + { + state.link = i->second; + // Variables + variablesForArea.hourForEachLink(state, numSpace); + } + }); // for each area +} + +template +void Areas::weekForEachArea(State& state, uint numSpace) +{ + // For each area... + state.study.areas.each( + [&](Data::Area& area) + { + state.area = &area; // the current area + + // Initializing the state for the current area + state.initFromAreaIndex(area.index, numSpace); + + auto& variablesForArea = pAreas[area.index]; + + // DTG MRG + state.dispatchableMargin + = variablesForArea + .template retrieveHourlyResultsForCurrentYear( + numSpace); + + variablesForArea.weekForEachArea(state, numSpace); + + // NOTE + // currently, the event is not broadcasted to thermal + // clusters and links + }); // for each area +} + +template +void Areas::yearBegin(uint year, uint numSpace) +{ + for (uint i = 0; i != pAreaCount; ++i) + pAreas[i].yearBegin(year, numSpace); +} + +template +void Areas::yearEndBuild(State& state, uint year, uint numSpace) +{ + // For each area... + state.study.areas.each( + [&](Data::Area& area) + { + state.area = &area; // the current area + + // Initializing the state for the current area + state.initFromAreaIndex(area.index, numSpace); + + // Variables + auto& variablesForArea = pAreas[area.index]; + + for (const auto& cluster : area.thermal.list.each_enabled()) + { + state.thermalCluster = cluster.get(); + state.yearEndResetThermal(); + + // Variables + variablesForArea.yearEndBuildPrepareDataForEachThermalCluster(state, year, numSpace); + + // Building the end of year + state.yearEndBuildFromThermalClusterIndex(cluster->areaWideIndex); + + // Variables + variablesForArea.yearEndBuildForEachThermalCluster(state, year, numSpace); + } // for each thermal cluster + }); // for each area +} + +template +void Areas::yearEnd(uint year, uint numSpace) +{ + for (uint i = 0; i != pAreaCount; ++i) + { + // Broadcast to all areas + pAreas[i].yearEnd(year, numSpace); + } +} + +template +void Areas::computeSummary(std::map& numSpaceToYear, + unsigned int nbYearsForCurrentSummary) +{ + for (uint i = 0; i != pAreaCount; ++i) + { + // Broadcast to all areas + pAreas[i].computeSummary(numSpaceToYear, nbYearsForCurrentSummary); + } +} + +template +void Areas::weekBegin(State& state) +{ + for (uint i = 0; i != pAreaCount; ++i) + pAreas[i].weekBegin(state); +} + +template +void Areas::weekEnd(State& state) +{ + for (uint i = 0; i != pAreaCount; ++i) + pAreas[i].weekEnd(state); +} + +template +void Areas::hourBegin(uint hourInTheYear) +{ + for (uint i = 0; i != pAreaCount; ++i) + pAreas[i].hourBegin(hourInTheYear); +} + +template +void Areas::hourForEachLink(State& state, uint numSpace) +{ + for (uint i = 0; i != pAreaCount; ++i) + pAreas[i].hourForEachLink(state, numSpace); +} + +template +void Areas::hourEnd(State& state, uint hourInTheYear) +{ + for (uint i = 0; i != pAreaCount; ++i) + pAreas[i].hourEnd(state, hourInTheYear); +} + +template +void Areas::beforeYearByYearExport(uint year, uint numSpace) +{ + for (uint i = 0; i != pAreaCount; ++i) + pAreas[i].beforeYearByYearExport(year, numSpace); +} + +template +uint64_t Areas::memoryUsage() const +{ + uint64_t result = 0; + for (unsigned int i = 0; i != pAreaCount; ++i) + { + result += sizeof(NextType) + sizeof(void*); // overhead vector + result += pAreas[i].memoryUsage(); + } + return result; +} + } // namespace Variable } // namespace Solver } // namespace Antares diff --git a/src/solver/variable/include/antares/solver/variable/area.inc.hxx b/src/solver/variable/include/antares/solver/variable/area.inc.hxx deleted file mode 100644 index 057ca23bbe..0000000000 --- a/src/solver/variable/include/antares/solver/variable/area.inc.hxx +++ /dev/null @@ -1,278 +0,0 @@ -/* -** Copyright 2007-2024, RTE (https://www.rte-france.com) -** See AUTHORS.txt -** SPDX-License-Identifier: MPL-2.0 -** This file is part of Antares-Simulator, -** Adequacy and Performance assessment for interconnected energy networks. -** -** Antares_Simulator is free software: you can redistribute it and/or modify -** it under the terms of the Mozilla Public Licence 2.0 as published by -** the Mozilla Foundation, either version 2 of the License, or -** (at your option) any later version. -** -** Antares_Simulator is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** Mozilla Public Licence 2.0 for more details. -** -** You should have received a copy of the Mozilla Public Licence 2.0 -** along with Antares_Simulator. If not, see . -*/ - -#include "variable.h" -#include "area.h" -#include - -using namespace Yuni; - -namespace Antares -{ -namespace Solver -{ -namespace Variable -{ -namespace Economy -{ -// forward declaration -struct VCardDispatchableGenMargin; - -} // namespace Economy -} // namespace Variable -} // namespace Solver -} // namespace Antares - -namespace Antares -{ -namespace Solver -{ -namespace Variable -{ -template<> -Areas::~Areas() -{ - // Releasing the memory occupied by the areas - delete[] pAreas; -} - -template<> -void Areas::initializeFromStudy(Data::Study& study) -{ - // The total number of areas - pAreaCount = study.areas.size(); - - // Reserving the memory - pAreas = new NextType[pAreaCount]; - - // For each area... - uint tick = 6; - uint oldPercent = 0; - for (uint i = 0; i != pAreaCount; ++i) - { - // Instancing a new set of variables of the area - auto* currentArea = study.areas.byIndex[i]; - if (!(--tick)) - { - uint newPercent = ((i * 100u) / pAreaCount); - if (newPercent != oldPercent) - { - logs.info() << "Allocating resources " << ((i * 100u) / pAreaCount) << "%"; - oldPercent = newPercent; - } - // Reset the tick - tick = 6; - } - - // Initialize the variables - // From the study - pAreas[i].initializeFromStudy(study); - // From the area - pAreas[i].initializeFromArea(&study, currentArea); - // Does current output variable appears non applicable in areas' output files, not - // districts'. Note that digest gather area and district results. - pAreas[i].broadcastNonApplicability(not currentArea->hydro.reservoirManagement); - - // For each current area's variable, getting the print status, that is : - // is variable's column(s) printed in output (areas) reports ? - pAreas[i].getPrintStatusFromStudy(study); - - pAreas[i].supplyMaxNumberOfColumns(study); - } -} - -template<> -void Areas::simulationBegin() -{ - for (uint i = 0; i != pAreaCount; ++i) - { - pAreas[i].simulationBegin(); - } -} - -template<> -void Areas::simulationEnd() -{ - for (uint i = 0; i != pAreaCount; ++i) - { - pAreas[i].simulationEnd(); - } -} - -template<> -void Areas::hourForEachArea(State& state, uint numSpace) -{ - // For each area... - state.study.areas.each([&](Data::Area& area) { - state.area = &area; // the current area - - // Initializing the state for the current area - state.initFromAreaIndex(area.index, numSpace); - - for (const auto& cluster : area.thermal.list.each_enabled()) - { - // Intiializing the state for the current thermal cluster - state.initFromThermalClusterIndex(cluster->areaWideIndex); - } - - // Variables - auto& variablesForArea = pAreas[area.index]; - variablesForArea.hourForEachArea(state, numSpace); - - // All links - auto end = area.links.end(); - for (auto i = area.links.begin(); i != end; ++i) - { - state.link = i->second; - // Variables - variablesForArea.hourForEachLink(state, numSpace); - } - }); // for each area -} - -template<> -void Areas::weekForEachArea(State& state, uint numSpace) -{ - // For each area... - state.study.areas.each([&](Data::Area& area) { - state.area = &area; // the current area - - // Initializing the state for the current area - state.initFromAreaIndex(area.index, numSpace); - - auto& variablesForArea = pAreas[area.index]; - - // DTG MRG - state.dispatchableMargin - = variablesForArea - .retrieveHourlyResultsForCurrentYear(numSpace); - - variablesForArea.weekForEachArea(state, numSpace); - - // NOTE - // currently, the event is not broadcasted to thermal - // clusters and links - }); // for each area -} - -template<> -void Areas::yearBegin(uint year, uint numSpace) -{ - for (uint i = 0; i != pAreaCount; ++i) - pAreas[i].yearBegin(year, numSpace); -} - -template<> -void Areas::yearEndBuild(State& state, uint year, uint numSpace) -{ - // For each area... - state.study.areas.each([&](Data::Area& area) { - state.area = &area; // the current area - - // Initializing the state for the current area - state.initFromAreaIndex(area.index, numSpace); - - // Variables - auto& variablesForArea = pAreas[area.index]; - - for (const auto& cluster : area.thermal.list.each_enabled()) - { - state.thermalCluster = cluster.get(); - state.yearEndResetThermal(); - - // Variables - variablesForArea.yearEndBuildPrepareDataForEachThermalCluster(state, year, numSpace); - - // Building the end of year - state.yearEndBuildFromThermalClusterIndex(cluster->areaWideIndex); - - // Variables - variablesForArea.yearEndBuildForEachThermalCluster(state, year, numSpace); - } // for each thermal cluster - }); // for each area -} - -template<> -void Areas::yearEnd(uint year, uint numSpace) -{ - for (uint i = 0; i != pAreaCount; ++i) - { - // Broadcast to all areas - pAreas[i].yearEnd(year, numSpace); - } -} - -template<> -void Areas::computeSummary(std::map& numSpaceToYear, - unsigned int nbYearsForCurrentSummary) -{ - for (uint i = 0; i != pAreaCount; ++i) - { - // Broadcast to all areas - pAreas[i].computeSummary(numSpaceToYear, nbYearsForCurrentSummary); - } -} - -template<> -void Areas::weekBegin(State& state) -{ - for (uint i = 0; i != pAreaCount; ++i) - pAreas[i].weekBegin(state); -} - -template<> -void Areas::weekEnd(State& state) -{ - for (uint i = 0; i != pAreaCount; ++i) - pAreas[i].weekEnd(state); -} - -template<> -void Areas::hourBegin(uint hourInTheYear) -{ - for (uint i = 0; i != pAreaCount; ++i) - pAreas[i].hourBegin(hourInTheYear); -} - -template<> -void Areas::hourForEachLink(State& state, uint numSpace) -{ - for (uint i = 0; i != pAreaCount; ++i) - pAreas[i].hourForEachLink(state, numSpace); -} - -template<> -void Areas::hourEnd(State& state, uint hourInTheYear) -{ - for (uint i = 0; i != pAreaCount; ++i) - pAreas[i].hourEnd(state, hourInTheYear); -} - -template<> -void Areas::beforeYearByYearExport(uint year, uint numSpace) -{ - for (uint i = 0; i != pAreaCount; ++i) - pAreas[i].beforeYearByYearExport(year, numSpace); -} - -} // namespace Variable -} // namespace Solver -} // namespace Antares diff --git a/src/solver/variable/include/antares/solver/variable/area.memory-estimation.inc.hxx b/src/solver/variable/include/antares/solver/variable/area.memory-estimation.inc.hxx deleted file mode 100644 index b7540b80b7..0000000000 --- a/src/solver/variable/include/antares/solver/variable/area.memory-estimation.inc.hxx +++ /dev/null @@ -1,48 +0,0 @@ -/* -** Copyright 2007-2024, RTE (https://www.rte-france.com) -** See AUTHORS.txt -** SPDX-License-Identifier: MPL-2.0 -** This file is part of Antares-Simulator, -** Adequacy and Performance assessment for interconnected energy networks. -** -** Antares_Simulator is free software: you can redistribute it and/or modify -** it under the terms of the Mozilla Public Licence 2.0 as published by -** the Mozilla Foundation, either version 2 of the License, or -** (at your option) any later version. -** -** Antares_Simulator is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** Mozilla Public Licence 2.0 for more details. -** -** You should have received a copy of the Mozilla Public Licence 2.0 -** along with Antares_Simulator. If not, see . -*/ - -#include "variable.h" -#include "area.h" -#include - -using namespace Yuni; - -namespace Antares -{ -namespace Solver -{ -namespace Variable -{ -template<> -uint64_t Areas::memoryUsage() const -{ - uint64_t result = 0; - for (unsigned int i = 0; i != pAreaCount; ++i) - { - result += sizeof(NextType) + sizeof(void*); // overhead vector - result += pAreas[i].memoryUsage(); - } - return result; -} - -} // namespace Variable -} // namespace Solver -} // namespace Antares diff --git a/src/solver/variable/include/antares/solver/variable/bc.memory-estimation.inc.hxx b/src/solver/variable/include/antares/solver/variable/bc.memory-estimation.inc.hxx deleted file mode 100644 index 2203382dfa..0000000000 --- a/src/solver/variable/include/antares/solver/variable/bc.memory-estimation.inc.hxx +++ /dev/null @@ -1,44 +0,0 @@ -/* -** Copyright 2007-2024, RTE (https://www.rte-france.com) -** See AUTHORS.txt -** SPDX-License-Identifier: MPL-2.0 -** This file is part of Antares-Simulator, -** Adequacy and Performance assessment for interconnected energy networks. -** -** Antares_Simulator is free software: you can redistribute it and/or modify -** it under the terms of the Mozilla Public Licence 2.0 as published by -** the Mozilla Foundation, either version 2 of the License, or -** (at your option) any later version. -** -** Antares_Simulator is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** Mozilla Public Licence 2.0 for more details. -** -** You should have received a copy of the Mozilla Public Licence 2.0 -** along with Antares_Simulator. If not, see . -*/ - -using namespace Yuni; - -namespace Antares -{ -namespace Solver -{ -namespace Variable -{ -template<> -uint64_t BindingConstraints::memoryUsage() const -{ - uint64_t result = 0; - for (unsigned int i = 0; i != pBCcount; ++i) - { - result += sizeof(NextType) + sizeof(void*); // overhead vector - result += pBindConstraints[i].memoryUsage(); - } - return result; -} - -} // namespace Variable -} // namespace Solver -} // namespace Antares diff --git a/src/solver/variable/include/antares/solver/variable/bindConstraints.hxx b/src/solver/variable/include/antares/solver/variable/bindConstraints.hxx index 2e5129ab43..93b2c6c1e1 100644 --- a/src/solver/variable/include/antares/solver/variable/bindConstraints.hxx +++ b/src/solver/variable/include/antares/solver/variable/bindConstraints.hxx @@ -189,4 +189,17 @@ void BindingConstraints::hourEnd(State& state, uint hourInTheYear) for (uint i = 0; i != pBCcount; ++i) pBindConstraints[i].hourEnd(state, hourInTheYear); } + +template +uint64_t BindingConstraints::memoryUsage() const +{ + uint64_t result = 0; + for (unsigned int i = 0; i != pBCcount; ++i) + { + result += sizeof(NextType) + sizeof(void*); // overhead vector + result += pBindConstraints[i].memoryUsage(); + } + return result; +} + } // namespace Antares::Solver::Variable