Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
Antares::Data::AreaList Class Referencefinal

A list of areas. More...

#include <area.h>

Inheritance diagram for Antares::Data::AreaList:

Public Types

using iterator = Area::Map::iterator
 An iterator.
 
using const_iterator = Area::Map::const_iterator
 A const iterator.
 
using reverse_iterator = Area::Map::reverse_iterator
 An iterator.
 
using const_reverse_iterator = Area::Map::const_reverse_iterator
 A const iterator.
 
using value_type = Area::Map::value_type
 Key-value type.
 

Public Member Functions

Constructor & Destructor
 AreaList (Study &study)
 Default constructor.
 
 ~AreaList ()
 Destructor.
 
Iterating through all areas
template<class PredicateT >
void each (const PredicateT &predicate)
 Iterate through all areas.
 
template<class PredicateT >
void each (const PredicateT &predicate) const
 Iterate through all areas (const)
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
Internal Data TS-Generators / Series
void ensureDataIsInitialized (Parameters &params, bool loadOnlyNeeded)
 Ensure data for time series/prepro are initalized if they should be.
 
Import / Export
bool loadFromFolder (const StudyLoadOptions &options)
 Load all informations about areas from a folder (-> input/generalData)
 
bool loadListFromFile (const std::filesystem::path &filename)
 Fill the list of areas from an input file.
 
bool saveToFolder (const AnyString &folder) const
 Save all informations about areas into a folder (-> input/generalData)
 
bool saveListToFile (const AnyString &filename) const
 Write the list of areas into a file.
 
void saveLinkListToBuffer (Yuni::Clob &buffer) const
 Write the list of all links into a file.
 
bool preloadAndMarkAsModifiedAllInvalidatedAreas (uint *invalidateCount=nullptr) const
 Preload all areas which have been invalidated.
 
Areas
Areaadd (Area *a)
 Add an area in the container.
 
Areafind (const AreaName &id)
 Find an area from its unique string id.
 
const Areafind (const AreaName &id) const
 Find an area from its unique string id (const)
 
AreafindFromName (const AreaName &name)
 Find an area from its name.
 
AreafindFromPosition (const int x, const int y) const
 
const AreafindFromName (const AreaName &name) const
 Find an area from its name (const)
 
void resizeAllTimeseriesNumbers (uint n)
 Resize all matrices dedicated to the sampled timeseries numbers.
 
void clear ()
 Remove all elements in the container.
 
bool empty () const
 Get if the container is empty.
 
bool forceReload (bool reload=false) const
 Invalidate all areas.
 
void markAsModified () const
 Mark all data as modified.
 
void rebuildIndexes ()
 Rebuild the indexes for accessing areas.
 
bool remove (const AnyString &id)
 Remove an area from its ID.
 
bool renameArea (const AreaName &oldid, const AreaName &newName)
 Rename an area.
 
bool renameArea (const AreaName &oldid, const AreaName &newid, const AreaName &newName)
 Rename an area.
 
uint size () const
 Get the total number of areas.
 
Links
AreaLinkfindLink (const AreaName &area, const AreaName &with)
 Find an interconnection between two areas.
 
const AreaLinkfindLink (const AreaName &area, const AreaName &with) const
 
AreaLinkfindLinkFromINIKey (const AnyString &key)
 Try to find the link from a given INI key (<area1>%<area2>)
 
ThermalClusterfindClusterFromINIKey (const AnyString &key)
 Try to find the cluster from a given INI key (<area>.<cluster>)
 
uint areaLinkCount () const
 Get the total number of interconnections between all areas.
 
Tools
void fixOrientationForAllInterconnections (BindingConstraintsRepository &bindingconstraints)
 Fix all invalid orientations.
 
void removeLoadTimeseries ()
 Remove all load timeseries.
 
void removeHydroTimeseries ()
 Remove all hydro timeseries.
 
void removeSolarTimeseries ()
 Remove all solar timeseries.
 
void removeWindTimeseries ()
 Remove all wind timeseries.
 
void removeThermalTimeseries ()
 Remove all thermal timeseries.
 
Area::ScratchMap buildScratchMap (uint numspace)
 create a map with the corresponding scratchpad for each area link to this numspace
 
void updateNameIDSet () const
 Update the name id set.
 

Operators

std::vector< Area * > byIndex
 All areas by their index.
 
Area::Map areas
 All areas in the list.
 
Area::NameSet nameidSet
 Name set (must be updated by updateNameSet)
 
Areaoperator[] (uint i)
 Get an area from its index.
 
const Areaoperator[] (uint i) const
 

Detailed Description

A list of areas.

Here is one way to iterate through the list :

...
<do some stuff here to fill the area list>
...
Area* c = l->first;
while (NULL != c)
{
...
<do some stuff here with the area via `c`>
...
c = c->next;
}
A list of areas.
Definition area.h:366

It is possible to directly access to an area via its index :

...
<do some stuff here to fill the area list>
...
printf("Area name : `%s`\n", (*(l->byIndex[2])).name);
std::vector< Area * > byIndex
All areas by their index.
Definition area.h:665

Member Function Documentation

◆ ensureDataIsInitialized()

void Antares::Data::AreaList::ensureDataIsInitialized ( Parameters & params,
bool loadOnlyNeeded )

Ensure data for time series/prepro are initalized if they should be.

It initializes data for each area so it would be better to call this routine when areas are already loaded.

◆ findLink()

AreaLink * Antares::Data::AreaList::findLink ( const AreaName & area,
const AreaName & with )

Find an interconnection between two areas.

Parameters
areaThe name of the first area (in lowercase)
withThe name of the second area (in lowercase)

◆ forceReload()

bool Antares::Data::AreaList::forceReload ( bool reload = false) const

Invalidate all areas.

Parameters
reloadTrue to reload data in the same time
Returns
True if the operation succeeded

◆ loadFromFolder()

bool Antares::Data::AreaList::loadFromFolder ( const StudyLoadOptions & options)

Load all informations about areas from a folder (-> input/generalData)

Parameters
lThe list of areas
folderThe target folder

◆ loadListFromFile()

bool Antares::Data::AreaList::loadListFromFile ( const std::filesystem::path & filename)

Fill the list of areas from an input file.

The file structure is merely composed by all names of areas, one line one area

Parameters
lThe structure
filenameThe file to read
Returns
A non-zero value if the operation was successful, 0 otherwise

◆ preloadAndMarkAsModifiedAllInvalidatedAreas()

bool Antares::Data::AreaList::preloadAndMarkAsModifiedAllInvalidatedAreas ( uint * invalidateCount = nullptr) const

Preload all areas which have been invalidated.

Parameters
[out]Thenumber of areas which have been invalidated

◆ rebuildIndexes()

void Antares::Data::AreaList::rebuildIndexes ( )

Rebuild the indexes for accessing areas.

It is sometimes quite usefull to use a mere index to access to a given area. This is mandatory when used from the solver.

◆ remove()

bool Antares::Data::AreaList::remove ( const AnyString & id)

Remove an area from its ID.

Warning
When used by a study, do not forget to remove all binding constraints which depends upon this area before any call to this routine.

◆ renameArea() [1/2]

bool Antares::Data::AreaList::renameArea ( const AreaName & oldid,
const AreaName & newid,
const AreaName & newName )

Rename an area.

Parameters
oldidID of the area to rename
newIDThe new area ID
newNameThe new name for the area
Returns
True if the operation succeeded (the area has been renamed) false otherwise (if another area has the same name)
Warning
This function invalidates the index of all areas. If you need the indexes after a call to this routine, please use AreaListRebuildIndex()

◆ renameArea() [2/2]

bool Antares::Data::AreaList::renameArea ( const AreaName & oldid,
const AreaName & newName )

Rename an area.

Parameters
oldidID of the area to rename
newNameThe new name for the area
Returns
True if the operation succeeded (the area has been renamed) false otherwise (if another area has the same name)
Warning
This function invalidates the index of all areas. If you need the indexes after a call to this routine, please use AreaListRebuildIndex()

◆ resizeAllTimeseriesNumbers()

void Antares::Data::AreaList::resizeAllTimeseriesNumbers ( uint n)

Resize all matrices dedicated to the sampled timeseries numbers.

Parameters
nA number of years

◆ saveLinkListToBuffer()

void Antares::Data::AreaList::saveLinkListToBuffer ( Yuni::Clob & buffer) const

Write the list of all links into a file.

<area name upstream>
<tab><area name downstream>
<tab><area name downstream>
<area name upstream>
<area name upstream>
<tab><area name downstream>
Parameters
filenameThe file to read
Returns
A non-zero value if the operation was successful, 0 otherwise

◆ saveListToFile()

bool Antares::Data::AreaList::saveListToFile ( const AnyString & filename) const

Write the list of areas into a file.

The file structure is merely composed by all names of areas, one line one area

Parameters
filenameThe file to read
Returns
A non-zero value if the operation was successful, 0 otherwise

◆ saveToFolder()

bool Antares::Data::AreaList::saveToFolder ( const AnyString & folder) const

Save all informations about areas into a folder (-> input/generalData)

Parameters
lThe list of areas
folderThe target folder

The documentation for this class was generated from the following files: