Skip to content

Commit

Permalink
Separation of loading and validation for renewables clusters [ANT-121…
Browse files Browse the repository at this point in the history
…3] (#2175)
  • Loading branch information
payetvin authored Jun 20, 2024
1 parent 9be866c commit 7dbb39c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/libs/antares/study/area/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,7 @@ bool AreaList::loadFromFolder(const StudyLoadOptions& options)
Area& area = *(i->second);
buffer.clear() << pStudy.folderInput << renewablePlant << area.id;
ret = area.renewable.list.loadFromFolder(buffer.c_str(), &area) && ret;
ret = area.renewable.list.validateClusters() && ret;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
#include "../common/cluster_list.h"
#include "cluster.h"

namespace Antares
{
namespace Data
namespace Antares::Data
{
/*!
** \brief List of renewable clusters
Expand All @@ -39,10 +37,12 @@ class RenewableClusterList: public ClusterList<RenewableCluster>
public:
std::string typeID() const override;
uint64_t memoryUsage() const override;

bool loadFromFolder(const AnyString& folder, Area* area);
bool validateClusters() const;

bool saveToFolder(const AnyString& folder) const override;
}; // class RenewableClusterList
} // namespace Data
} // namespace Antares
} // namespace Antares::Data

#endif /* __ANTARES_LIBS_STUDY_PARTS_RENEWABLE_CLUSTER_LIST_H__ */
19 changes: 13 additions & 6 deletions src/libs/antares/study/parts/renewable/cluster_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@

using namespace Yuni;

namespace Antares
{
namespace Data
namespace Antares::Data
{

#define SEP IO::Separator
Expand Down Expand Up @@ -211,7 +209,6 @@ bool RenewableClusterList::loadFromFolder(const AnyString& folder, Area* area)
continue;
}

cluster->integrityCheck();
addToCompleteList(cluster);
}
}
Expand All @@ -223,7 +220,17 @@ bool RenewableClusterList::loadFromFolder(const AnyString& folder, Area* area)
return false;
}

bool RenewableClusterList::validateClusters() const
{
bool ret = true;
for (const auto& cluster : allClusters_)
{
ret = cluster->integrityCheck() && ret;
}

return ret;
}

#undef SEP

} // namespace Data
} // namespace Antares
} // namespace Antares::Data

0 comments on commit 7dbb39c

Please sign in to comment.