1 #ifndef CASM_HamiltonianModules_impl
2 #define CASM_HamiltonianModules_impl
4 #include <boost/filesystem.hpp>
13 template <
typename DoFDictInserter,
typename RuntimeLibInserter>
16 RuntimeLibInserter lib_it) {
18 typedef traits_ptr(signature)();
23 return std::make_pair(dict_it, lib_it);
28 for (
auto &entry : boost::make_iterator_range(
30 fs::path p = entry.path();
31 std::string p_s = p.string();
32 auto p_size = p_s.size();
34 if (fs::is_regular_file(p) &&
35 p_s.compare(p_size - 3, p_size,
".cc") == 0) {
36 fs::path f = p.filename();
37 std::string f_s = f.string();
38 auto f_size = f_s.size();
40 std::string msg =
"Compiling new custom DoFTraits for DoF: " +
41 f_s.substr(0, f_size - 3);
44 p_s.substr(0, p_size - 3),
48 auto make_dof = lib_ptr->template get_function<signature>(
49 "make_" + f_s.substr(0, f_size - 3) +
"_dof");
51 std::unique_ptr<DoFType::Traits> ptr(make_dof());
55 *lib_it++ = std::make_pair(ptr->name(), lib_ptr);
60 return std::make_pair(dict_it, lib_it);
64 template <
typename SymRepBuilderDictInserter,
typename RuntimeLibInserter>
65 std::pair<SymRepBuilderDictInserter, RuntimeLibInserter>
67 SymRepBuilderDictInserter dict_it,
68 RuntimeLibInserter lib_it) {
70 typedef bldr_ptr(signature)();
75 return std::make_pair(dict_it, lib_it);
80 for (
auto &entry : boost::make_iterator_range(
82 fs::path p = entry.path();
83 std::string p_s = p.string();
84 auto p_size = p_s.size();
86 if (fs::is_regular_file(p) &&
87 p_s.compare(p_size - 3, p_size,
".cc") == 0) {
88 fs::path f = p.filename();
89 std::string f_s = f.string();
90 auto f_size = f_s.size();
92 std::string msg =
"Compiling new custom SymRepBuilderInterface: " +
93 f_s.substr(0, f_size - 3);
97 p_s.substr(0, p_size - 3),
102 auto make_traits = lib_ptr->template get_function<signature>(
103 "make_" + f_s.substr(0, f_size - 3) +
"_symrep_builder");
105 std::unique_ptr<SymRepBuilderInterface> ptr(make_traits());
108 *lib_it++ = std::make_pair(ptr->name(), lib_ptr);
113 return std::make_pair(dict_it, lib_it);
Specification of CASM project directory structure.
fs::path root_dir() const
Return casm project directory path.
fs::path symrep_builder_plugins() const
Return SymrepBuilder plugin dir.
fs::path dof_plugins() const
Return DoF plugin dir.
Collection of all the traits specific to a DoF type.
DirectoryStructure const & dir() const
Access DirectoryStructure object. Throw if not set.
std::string compile_options() const
std::string so_options() const
Abstract base class that provides interface for converting cartesian isometry to specialized transfor...
std::shared_ptr< RuntimeLibrary > log_make_shared_runtime_lib(std::string filename_base, std::string compile_options, std::string so_options, std::string compile_msg)
Make shared_ptr<RuntimeLibrary>, logging progress and errors.
std::string include_path(const fs::path &dir)
std::pair< SymRepBuilderDictInserter, RuntimeLibInserter > load_symrep_builder_plugins(const ProjectSettings &set, SymRepBuilderDictInserter dict_it, RuntimeLibInserter lib_it)
Load SymRepBuilder plugins from a CASM project.
std::pair< DoFDictInserter, RuntimeLibInserter > load_dof_plugins(const ProjectSettings &set, DoFDictInserter dict_it, RuntimeLibInserter lib_it)
Load DoF plugins from a CASM project.
DirectoryStructure const & dir