Skip to content
Snippets Groups Projects
Commit 31152b0f authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add access and setting pgs functions for partitioner library

parent 3b98e735
No related branches found
No related tags found
1 merge request!202Prepare PTScotch integration
......@@ -32,6 +32,7 @@
#include <language/utils/UnaryOperatorRegisterForRnxn.hpp>
#include <language/utils/UnaryOperatorRegisterForZ.hpp>
#include <utils/Messenger.hpp>
#include <utils/PartitionerOptions.hpp>
#include <utils/PugsUtils.hpp>
#include <utils/RandomEngine.hpp>
#include <utils/Stop.hpp>
......@@ -94,6 +95,27 @@ CoreModule::CoreModule() : BuiltinModule(true)
));
this->_addBuiltinFunction("setPartitionerLibrary", std::function(
[](const std::string& library_name) -> void {
PartitionerOptions::default_options.library() =
getPartitionerEnumFromName<PartitionerLibrary>(library_name);
}
));
this->_addBuiltinFunction("getPartitionerOptions", std::function(
[]() -> std::string {
std::ostringstream os;
os << rang::fgB::yellow << "Partitioner options"
<< rang::style::reset << '\n';
os << PartitionerOptions::default_options;
return os.str();
}
));
this->_addTypeDescriptor(ast_node_data_type_from<std::shared_ptr<const OStream>>);
this->_addBuiltinFunction("ofstream", std::function(
......
......@@ -32,6 +32,20 @@ name(const PartitionerLibrary library)
throw UnexpectedError("Linear system library name is not defined!");
}
template <typename PartitionerEnumType>
inline PartitionerEnumType
getPartitionerEnumFromName(const std::string& enum_name)
{
using BaseT = std::underlying_type_t<PartitionerEnumType>;
for (BaseT enum_value = static_cast<BaseT>(PartitionerEnumType::PT__begin);
enum_value < static_cast<BaseT>(PartitionerEnumType::PT__end); ++enum_value) {
if (name(PartitionerEnumType{enum_value}) == enum_name) {
return PartitionerEnumType{enum_value};
}
}
throw NormalError(std::string{"could not find '"} + enum_name + "' associate type!");
}
class PartitionerOptions
{
private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment