Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/github_actions/mattnotmitt/dox…
Browse files Browse the repository at this point in the history
…ygen-action-1.12.0
  • Loading branch information
a-zakir authored Jan 28, 2025
2 parents b834321 + da7ed45 commit 3a88ca7
Show file tree
Hide file tree
Showing 57 changed files with 139 additions and 541 deletions.
6 changes: 5 additions & 1 deletion src/solver/modelConverter/modelConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ std::vector<Antares::Study::SystemModel::PortType> convertTypes(
{
// Convert portTypes to Antares::Study::SystemModel::PortType
std::vector<Antares::Study::SystemModel::PortType> out;
out.reserve(library.port_types.size());
for (const auto& portType: library.port_types)
{
std::vector<Antares::Study::SystemModel::PortField> fields;
Expand Down Expand Up @@ -77,6 +78,7 @@ std::vector<Antares::Study::SystemModel::Parameter> convertParameters(
{
namespace SM = Antares::Study::SystemModel;
std::vector<SM::Parameter> parameters;
parameters.reserve(model.parameters.size());
for (const auto& parameter: model.parameters)
{
parameters.emplace_back(parameter.id,
Expand Down Expand Up @@ -119,7 +121,7 @@ std::vector<Antares::Study::SystemModel::Variable> convertVariables(const ModelP
namespace SM = Antares::Study::SystemModel;

std::vector<SM::Variable> variables;

variables.reserve(model.variables.size());
for (const auto& variable: model.variables)
{
SM::Expression lb(variable.lower_bound,
Expand Down Expand Up @@ -153,6 +155,7 @@ std::vector<Antares::Study::SystemModel::Constraint> convertConstraints(
const Antares::Solver::ModelParser::Model& model)
{
std::vector<Antares::Study::SystemModel::Constraint> constraints;
constraints.reserve(model.constraints.size());
for (const auto& constraint: model.constraints)
{
auto nodeRegistry = convertExpressionToNode(constraint.expression, model);
Expand All @@ -173,6 +176,7 @@ std::vector<Antares::Study::SystemModel::Model> convertModels(
const Antares::Solver::ModelParser::Library& library)
{
std::vector<Antares::Study::SystemModel::Model> models;
models.reserve(library.models.size());
for (const auto& model: library.models)
{
Antares::Study::SystemModel::ModelBuilder modelBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ struct VCardOverallCost
static constexpr uint8_t isPossiblyNonApplicable = 0;

typedef IntermediateValues IntermediateValuesBaseType;
typedef IntermediateValues* IntermediateValuesType;
typedef std::vector<IntermediateValues> IntermediateValuesType;

typedef IntermediateValuesBaseType* IntermediateValuesTypeForSpatialAg;

Expand Down Expand Up @@ -131,11 +131,6 @@ class OverallCost: public Variable::IVariable<OverallCost<NextT>, NextT, VCardOv
};

public:
~OverallCost()
{
delete[] pValuesForTheCurrentYear;
}

void initializeFromStudy(Data::Study& study)
{
pNbYearsParallel = study.maxNbYearsInParallel;
Expand All @@ -144,7 +139,7 @@ class OverallCost: public Variable::IVariable<OverallCost<NextT>, NextT, VCardOv
InitializeResultsFromStudy(AncestorType::pResults, study);

// Intermediate values
pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
pValuesForTheCurrentYear.resize(pNbYearsParallel);
for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
{
pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct VCardSpilledEnergy
static constexpr uint8_t isPossiblyNonApplicable = 0;

typedef IntermediateValues IntermediateValuesBaseType;
typedef IntermediateValues* IntermediateValuesType;
typedef std::vector<IntermediateValues> IntermediateValuesType;

typedef IntermediateValuesBaseType* IntermediateValuesTypeForSpatialAg;

Expand Down Expand Up @@ -132,19 +132,14 @@ class SpilledEnergy: public Variable::IVariable<SpilledEnergy<NextT>, NextT, VCa
};

public:
~SpilledEnergy()
{
delete[] pValuesForTheCurrentYear;
}

void initializeFromStudy(Data::Study& study)
{
pNbYearsParallel = study.maxNbYearsInParallel;

// Intermediate values
InitializeResultsFromStudy(AncestorType::pResults, study);

pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
pValuesForTheCurrentYear.resize(pNbYearsParallel);
for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
{
pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct VCardTimeSeriesValuesHydro
static constexpr uint8_t isPossiblyNonApplicable = 0;

typedef IntermediateValues IntermediateValuesBaseType;
typedef IntermediateValues* IntermediateValuesType;
typedef std::vector<IntermediateValues> IntermediateValuesType;

typedef IntermediateValuesBaseType* IntermediateValuesTypeForSpatialAg;

Expand Down Expand Up @@ -134,7 +134,6 @@ class TimeSeriesValuesHydro
public:
~TimeSeriesValuesHydro()
{
delete[] pValuesForTheCurrentYear;
delete[] pFatalValues;
}

Expand All @@ -150,7 +149,7 @@ class TimeSeriesValuesHydro

InitializeResultsFromStudy(AncestorType::pResults, study);

pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
pValuesForTheCurrentYear.resize(pNbYearsParallel);
for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
{
pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct VCardTimeSeriesValuesLoad
static constexpr uint8_t isPossiblyNonApplicable = 0;

typedef IntermediateValues IntermediateValuesBaseType;
typedef IntermediateValues* IntermediateValuesType;
typedef std::vector<IntermediateValues> IntermediateValuesType;

typedef IntermediateValuesBaseType* IntermediateValuesTypeForSpatialAg;

Expand Down Expand Up @@ -132,18 +132,13 @@ class TimeSeriesValuesLoad
};

public:
~TimeSeriesValuesLoad()
{
delete[] pValuesForTheCurrentYear;
}

void initializeFromStudy(Data::Study& study)
{
pNbYearsParallel = study.maxNbYearsInParallel;

InitializeResultsFromStudy(AncestorType::pResults, study);

pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
pValuesForTheCurrentYear.resize(pNbYearsParallel);
for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
{
pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct VCardMiscGenMinusRowPSP
static constexpr uint8_t isPossiblyNonApplicable = 0;

typedef IntermediateValues IntermediateValuesBaseType;
typedef IntermediateValues* IntermediateValuesType;
typedef std::vector<IntermediateValues> IntermediateValuesType;
typedef IntermediateValuesBaseType* IntermediateValuesTypeForSpatialAg;

}; // class VCard
Expand Down Expand Up @@ -129,11 +129,6 @@ class MiscGenMinusRowPSP
};

public:
~MiscGenMinusRowPSP()
{
delete[] pValuesForTheCurrentYear;
}

void initializeFromStudy(Data::Study& study)
{
pNbYearsParallel = study.maxNbYearsInParallel;
Expand All @@ -142,7 +137,7 @@ class MiscGenMinusRowPSP
InitializeResultsFromStudy(AncestorType::pResults, study);

// Intermediate values
pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
pValuesForTheCurrentYear.resize(pNbYearsParallel);
for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
{
pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct VCardPSP
static constexpr uint8_t isPossiblyNonApplicable = 0;

typedef IntermediateValues IntermediateValuesBaseType;
typedef IntermediateValues* IntermediateValuesType;
typedef std::vector<IntermediateValues> IntermediateValuesType;
typedef IntermediateValuesBaseType* IntermediateValuesTypeForSpatialAg;

}; // class VCard
Expand Down Expand Up @@ -128,11 +128,6 @@ class PSP: public Variable::IVariable<PSP<NextT>, NextT, VCardPSP>
};

public:
~PSP()
{
delete[] pValuesForTheCurrentYear;
}

void initializeFromStudy(Data::Study& study)
{
pNbYearsParallel = study.maxNbYearsInParallel;
Expand All @@ -141,7 +136,7 @@ class PSP: public Variable::IVariable<PSP<NextT>, NextT, VCardPSP>
InitializeResultsFromStudy(AncestorType::pResults, study);

// Intermediate values
pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
pValuesForTheCurrentYear.resize(pNbYearsParallel);
for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
{
pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct VCardTimeSeriesValuesSolar
static constexpr uint8_t isPossiblyNonApplicable = 0;

typedef IntermediateValues IntermediateValuesBaseType;
typedef IntermediateValues* IntermediateValuesType;
typedef std::vector<IntermediateValues> IntermediateValuesType;

typedef IntermediateValuesBaseType* IntermediateValuesTypeForSpatialAg;

Expand Down Expand Up @@ -132,18 +132,13 @@ class TimeSeriesValuesSolar
};

public:
~TimeSeriesValuesSolar()
{
delete[] pValuesForTheCurrentYear;
}

void initializeFromStudy(Data::Study& study)
{
pNbYearsParallel = study.maxNbYearsInParallel;

InitializeResultsFromStudy(AncestorType::pResults, study);

pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
pValuesForTheCurrentYear.resize(pNbYearsParallel);
for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
{
pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,6 @@ class SpatialAggregate
};

public:
SpatialAggregate()
{
}

~SpatialAggregate()
{
delete[] pValuesForTheCurrentYear;
}

void initializeFromStudy(Data::Study& study)
{
typedef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct VCardTimeSeriesValuesWind
static constexpr uint8_t isPossiblyNonApplicable = 0;

typedef IntermediateValues IntermediateValuesBaseType;
typedef IntermediateValues* IntermediateValuesType;
typedef std::vector<IntermediateValues> IntermediateValuesType;

typedef IntermediateValuesBaseType* IntermediateValuesTypeForSpatialAg;

Expand Down Expand Up @@ -132,18 +132,13 @@ class TimeSeriesValuesWind
};

public:
~TimeSeriesValuesWind()
{
delete[] pValuesForTheCurrentYear;
}

void initializeFromStudy(Data::Study& study)
{
pNbYearsParallel = study.maxNbYearsInParallel;

InitializeResultsFromStudy(AncestorType::pResults, study);

pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
pValuesForTheCurrentYear.resize(pNbYearsParallel);
for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
{
pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ struct VCardSTSbyGroup
static constexpr uint8_t isPossiblyNonApplicable = 0;

typedef IntermediateValues IntermediateValuesDeepType;
typedef IntermediateValues* IntermediateValuesBaseType;
typedef IntermediateValuesBaseType* IntermediateValuesType;
typedef std::vector<IntermediateValues> IntermediateValuesBaseType;
typedef std::vector<IntermediateValuesBaseType> IntermediateValuesType;

}; // class VCard

Expand Down Expand Up @@ -157,25 +157,11 @@ class STSbyGroup: public Variable::IVariable<STSbyGroup<NextT>, NextT, VCardSTSb
};

public:
STSbyGroup():
pValuesForTheCurrentYear(nullptr)
{
}

~STSbyGroup()
{
for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
{
delete[] pValuesForTheCurrentYear[numSpace];
}
delete[] pValuesForTheCurrentYear;
}

void initializeFromArea(Data::Study* study, Data::Area* area)
{
// Get the number of years in parallel
pNbYearsParallel = study->maxNbYearsInParallel;
pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
pValuesForTheCurrentYear.resize(pNbYearsParallel);

// Building the vector of group names the clusters belong to.
groupNames_ = sortedUniqueGroups(area->shortTermStorage.storagesByIndex);
Expand All @@ -189,8 +175,7 @@ class STSbyGroup: public Variable::IVariable<STSbyGroup<NextT>, NextT, VCardSTSb

for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
{
pValuesForTheCurrentYear[numSpace] = new VCardType::IntermediateValuesDeepType
[nbColumns_];
pValuesForTheCurrentYear[numSpace].resize(nbColumns_);
}

for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
Expand All @@ -209,11 +194,6 @@ class STSbyGroup: public Variable::IVariable<STSbyGroup<NextT>, NextT, VCardSTSb
}
else
{
for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
{
pValuesForTheCurrentYear[numSpace] = nullptr;
}

AncestorType::pResults.clear();
}
// Next
Expand Down
Loading

0 comments on commit 3a88ca7

Please sign in to comment.