Antares_Simulator icon indicating copy to clipboard operation
Antares_Simulator copied to clipboard

Remove variable numSpace

Open flomnes opened this issue 1 year ago • 2 comments

Basically, we have structures whose member data is duplicated for multi-threading, and indexed by numSpace, the thread number.

My advice would be to confine this numSpace variable to the highest level, so that this implementation detail doesn't leak everywhere. I think this work will mainly concern the code that generates the output, which is where most occurrences of numSpace are found. There are also a few in the hydro heuristics code.

Example (src/solver/variable/economy/inflow.h)

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

    InitializeResultsFromStudy(AncestorType::pResults, study);

    pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel];
    for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++)
        pValuesForTheCurrentYear[numSpace].initializeFromStudy(study);

    // Next
    NextType::initializeFromStudy(study);
}

flomnes avatar Aug 21 '23 08:08 flomnes