diff --git a/.gitignore b/.gitignore index 4f22857..43c6090 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,5 @@ build/* .vscode/ # Test artifacts -Testing/ \ No newline at end of file +Testing/ +dev/Testing/ \ No newline at end of file diff --git a/dev/app/src/main.cpp b/dev/app/src/main.cpp index f618a82..2a58548 100644 --- a/dev/app/src/main.cpp +++ b/dev/app/src/main.cpp @@ -53,5 +53,7 @@ int main(int argc, char* argv[]) { auto commandLineArguments = loadCommandLineArguments(argc, argv); auto configParameters = setupConfigParameters(commandLineArguments); + + return 0; } diff --git a/dev/libs/data_processing/include/data_processing/config.h b/dev/libs/data_processing/include/data_processing/config.h index 50b9f1a..786acff 100644 --- a/dev/libs/data_processing/include/data_processing/config.h +++ b/dev/libs/data_processing/include/data_processing/config.h @@ -2,19 +2,18 @@ #define FLASH_CONFIG_H #include +#include #include #include #include #include -#include - -#include #include +#include namespace flash { -namespace data_processing{ -namespace config{ +namespace data_processing { +namespace config { /** * @brief Throw when an invalid key is detected. diff --git a/dev/libs/data_processing/include/data_processing/read_hdf5.h b/dev/libs/data_processing/include/data_processing/read_hdf5.h index 2fbe717..9c26abf 100644 --- a/dev/libs/data_processing/include/data_processing/read_hdf5.h +++ b/dev/libs/data_processing/include/data_processing/read_hdf5.h @@ -6,16 +6,16 @@ #include #include + #include namespace flash { -namespace data_processing{ +namespace data_processing { namespace read_hdf5 { - /** * @brief Read a \p flash::types::real_dp vector from an HDF5 file - * + * * @param[in] filename Name of the HDF5 file * @param[in] datasetName Absolute name of the dataset * @return A \p flash::types::DVector initialized with the data from the file @@ -26,4 +26,4 @@ flash::types::DVector readDoubleVectorHDF5(const std::string &filename, const st } // namespace data_processing } // namespace flash -#endif // FLASH_READ_H \ No newline at end of file +#endif // FLASH_READ_H \ No newline at end of file diff --git a/dev/libs/data_processing/src/config.cpp b/dev/libs/data_processing/src/config.cpp index 6bf3ab6..f51c1bd 100644 --- a/dev/libs/data_processing/src/config.cpp +++ b/dev/libs/data_processing/src/config.cpp @@ -55,17 +55,14 @@ auto nodeToArray(const YAML::Node &node, bool (*rule)(T value), std::string msg) Config::Config(const YAML::Node &configYamlNode, const std::vector &allowedKeys, const std::vector &mandatoryKeys, const DefaultConfig &defaults) { - // extract keys from yaml node - - std::cout< keysInNode; for (auto kv : configYamlNode) { auto key = kv.first.as(); keysInNode.push_back(key); } - std::cout< } } - std::cout< } try { - n_k_points = nodeToValue(configYamlNode["n_k_points"], "n_k_points is wrongly initialized."); n_occupied_total = nodeToValue(configYamlNode["n_occupied_total"], "n_occupied_total is wrongly initialized."); n_unoccupied_total = nodeToValue(configYamlNode["n_unoccupied_total"], "n_unoccupied_total is wrongly initialized."); n_isdf_vexc = nodeToValue(configYamlNode["n_isdf_vexc"], "n_isdf_vexc is wrongly initialized."); - n_isdf_wscr_occupied = - nodeToValue(configYamlNode["n_isdf_wscr_occupied"], "n_isdf_wscr_occupied is wrongly initialized."); + n_isdf_wscr_occupied = nodeToValue(configYamlNode["n_isdf_wscr_occupied"], + "n_isdf_wscr_occupied is wrongly initialized."); n_isdf_wscr_unoccupied = nodeToValue(configYamlNode["n_isdf_wscr_unoccupied"], - "n_isdf_wscr_unoccupied is wrongly initialized."); + "n_isdf_wscr_unoccupied is wrongly initialized."); max_lanczos_iterations = nodeToValue(configYamlNode["max_lanczos_iterations"], - "max_lanczos_iterations is wrongly initialized."); - omega_range = - nodeToValue>(configYamlNode["omega_range"], "omega_range is wrongly initialized."); + "max_lanczos_iterations is wrongly initialized."); + omega_range = nodeToValue>(configYamlNode["omega_range"], + "omega_range is wrongly initialized."); n_omega = nodeToValue(configYamlNode["n_omega"], "n_omega is wrongly initialized."); max_cvt_iterations = nodeToValueWithDefault(configYamlNode, "max_cvt_iterations", defaults.max_cvt_Itereations, - "max_cvt_iterations is wrongly initialized."); - cvt_convergence_criterium = nodeToValueWithDefault(configYamlNode, "cvt_convergence_criterium", - defaults.cvt_convergence_criterium, - "cvt_convergence_criterium is wrongly initialized."); + "max_cvt_iterations is wrongly initialized."); + cvt_convergence_criterium = nodeToValueWithDefault( + configYamlNode, "cvt_convergence_criterium", defaults.cvt_convergence_criterium, + "cvt_convergence_criterium is wrongly initialized."); seed_source = nodeToSeed(configYamlNode, "seed_source", defaults.seed_source); - + } catch (const InvalidConfigurationException) { throw; } } - void Config::validate() { + // Rule for n_k_points if (n_k_points == 0) { throw InvalidConfigurationException("n_k_points must be > 0."); @@ -131,45 +126,45 @@ void Config::validate() { throw InvalidConfigurationException("n_occupied_total + n_unoccupied_total must be divisable by n_k_points."); } // Rules for n_isdf_vexc - if (!n_isdf_vexc > 0) { + if (n_isdf_vexc == 0) { throw InvalidConfigurationException("n_isdf_vexc must be > 0."); } - if (!n_isdf_vexc <= n_occupied_total * n_unoccupied_total / n_k_points) { + if (n_isdf_vexc > n_occupied_total * n_unoccupied_total / n_k_points) { throw InvalidConfigurationException( "n_isdf_vexc must be <= n_occupied_total * n_unoccupied_total / n_k_points."); } // Rules for n_isdf_wscr_occupied - if (!n_isdf_wscr_occupied > 0) { + if (n_isdf_wscr_occupied == 0) { throw InvalidConfigurationException("n_isdf_wscr_occupied must be > 0."); } - if (!n_isdf_wscr_occupied <= std::pow(n_occupied_total, 2)) { + if (n_isdf_wscr_occupied > std::pow(n_occupied_total, 2)) { throw InvalidConfigurationException("n_isdf_wscr_occupied must be <= n_occupied_total^2."); } // Rules for n_isdf_wscr_unoccupied - if (!n_isdf_wscr_unoccupied > 0) { + if (n_isdf_wscr_unoccupied == 0) { throw InvalidConfigurationException("n_isdf_wscr_unoccupied must be > 0."); } - if (!n_isdf_wscr_unoccupied <= std::pow(n_occupied_total, 2)) { + if (n_isdf_wscr_unoccupied > std::pow(n_occupied_total, 2)) { throw InvalidConfigurationException("n_isdf_wscr_unoccupied must be <= n_occupied_total^2."); } // Rule for max_lanczos_iterations - if (!max_lanczos_iterations > 0) { + if (max_lanczos_iterations == 0) { throw InvalidConfigurationException("max_lanczos_iterations must be > 0."); } // Rule for omega_range - if (!sizeof(omega_range) == 2) { + if (sizeof(omega_range) != 2) { throw InvalidConfigurationException("omega_range must contain exactly 2 values."); } - if (!omega_range[0] < omega_range[1]) { + if (omega_range[0] >= omega_range[1]) { throw InvalidConfigurationException( "Lower limit of omega_range (left value) must be smaller then the upper limit (right value)."); } // Rule for n_omega - if (!n_omega > 0) { + if (n_omega == 0) { throw InvalidConfigurationException("n_omega must be > 0."); } // Rule for max_cvt_iterations - if (!cvt_convergence_criterium > 0) { + if (cvt_convergence_criterium == 0) { throw InvalidConfigurationException("cvt_convergence_criterium must be > 0."); } } diff --git a/dev/libs/data_processing/src/read_hdf5.cpp b/dev/libs/data_processing/src/read_hdf5.cpp index 04e8ab1..f242acc 100644 --- a/dev/libs/data_processing/src/read_hdf5.cpp +++ b/dev/libs/data_processing/src/read_hdf5.cpp @@ -1,12 +1,10 @@ #include - namespace tp = flash::types; using namespace flash::data_processing::read_hdf5; - tp::DVector readDoubleVectorHDF5(const std::string &filename, const std::string &datasetName) { - try { + try { // Open the HDF5 file H5::H5File file(filename, H5F_ACC_RDONLY); @@ -26,14 +24,11 @@ tp::DVector readDoubleVectorHDF5(const std::string &filename, const std::string tp::DVector eigenVector = Eigen::Map(buffer.data(), buffer.size()); return eigenVector; - } - catch (H5::FileIException &error) { + } catch (H5::FileIException &error) { error.printErrorStack(); - } - catch (H5::DataSetIException &error) { + } catch (H5::DataSetIException &error) { error.printErrorStack(); - } - catch (H5::DataSpaceIException &error) { + } catch (H5::DataSpaceIException &error) { error.printErrorStack(); } diff --git a/dev/libs/types/include/types/types.h b/dev/libs/types/include/types/types.h index 49935c2..d8b1e51 100644 --- a/dev/libs/types/include/types/types.h +++ b/dev/libs/types/include/types/types.h @@ -21,7 +21,6 @@ typedef Eigen::Vector CVector; typedef Eigen::Matrix DMatrix; typedef Eigen::Matrix CMatrix; - } // namespace types } // namespace flash diff --git a/dev/linter/.clang-tidy b/dev/linter/.clang-tidy index a95b679..f35af34 100644 --- a/dev/linter/.clang-tidy +++ b/dev/linter/.clang-tidy @@ -9,6 +9,7 @@ Checks: > - bugprone-* - misc-* - filter-.* + - header-filter=.* - -* # Disable other checks WarningsAsErrors: '' diff --git a/dev/tests/data_processing/src/config_test.cpp b/dev/tests/data_processing/src/config_test.cpp index c122759..b37814c 100644 --- a/dev/tests/data_processing/src/config_test.cpp +++ b/dev/tests/data_processing/src/config_test.cpp @@ -1,9 +1,9 @@ #define CATCH_CONFIG_MAIN -#include - #include +#include + namespace ftp = flash::types; using namespace flash::data_processing::config;