Loading src/include/Configuration.h +7 −3 Original line number Diff line number Diff line Loading @@ -126,6 +126,8 @@ protected: double _gpu_ram_gb; //! \brief Sphere overlap tolerance; double _tolerance; //! \brief Inversion algorithm (0 - LU, 1 - SVD, 2 - RBT) short _invert_mode; public: //! \brief Read-only view on number of spherical components. Loading Loading @@ -178,12 +180,14 @@ public: const short& refine_flag = _refine_flag; //! \brief Read-only view on flag for dynamic order management. const short& dyn_order_flag = _dyn_order_flag; //! \brief Read-only view on host RAM in GB //! \brief Read-only view on host RAM in GB. const double& host_ram_gb = _host_ram_gb; //! \brief Read-only view on GPU RAM in GB //! \brief Read-only view on GPU RAM in GB. const double& gpu_ram_gb = _gpu_ram_gb; //! \brief Read-only view on sphere overlap tolerance //! \brief Read-only view on sphere overlap tolerance. const double& tolerance = _tolerance; //! \brief Read-only view on inversion algorithm. const short& invert_mode = _invert_mode; /** * \brief Build a scattering geometry configuration structure. Loading src/libnptm/Configuration.cpp +37 −5 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ #include <hdf5.h> #include <regex> #include <string> #include <string.h> // #include <string.h> #ifdef USE_MPI #ifndef MPI_VERSION #include <mpi.h> Loading Loading @@ -63,6 +63,8 @@ using namespace std; // >>> GeometryConfiguration CLASS IMPLEMENTATION <<< GeometryConfiguration::GeometryConfiguration( int nsph, int lm, int in_pol, int npnt, int npntts, int isam, int li, int le, np_int mxndm, int iavm, double *x, double *y, Loading Loading @@ -97,11 +99,12 @@ GeometryConfiguration::GeometryConfiguration( _sph_x = x; _sph_y = y; _sph_z = z; _refine_flag = 0; _refine_flag = false; _dyn_order_flag = 1; _host_ram_gb = 0.0; _gpu_ram_gb = 0.0; _tolerance = -1.0; _invert_mode = 0; } GeometryConfiguration::GeometryConfiguration(const GeometryConfiguration& rhs) Loading Loading @@ -142,6 +145,7 @@ GeometryConfiguration::GeometryConfiguration(const GeometryConfiguration& rhs) _host_ram_gb = rhs._host_ram_gb; _gpu_ram_gb = rhs._gpu_ram_gb; _tolerance = rhs._tolerance; _invert_mode = rhs._invert_mode; } #ifdef MPI_VERSION Loading Loading @@ -177,11 +181,12 @@ GeometryConfiguration::GeometryConfiguration(const mixMPI *mpidata) { MPI_Bcast(_sph_x, _number_of_spheres, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(_sph_y, _number_of_spheres, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(_sph_z, _number_of_spheres, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_refine_flag, 1, MPI_SHORT, 0, MPI_COMM_WORLD); MPI_Bcast(&_refine_flag, 1, MPI_C_BOOL, 0, MPI_COMM_WORLD); MPI_Bcast(&_dyn_order_flag, 1, MPI_SHORT, 0, MPI_COMM_WORLD); MPI_Bcast(&_host_ram_gb, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_gpu_ram_gb, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_tolerance, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_invert_mode, 1, MPI_SHORT, 0, MPI_COMM_WORLD); } void GeometryConfiguration::mpibcast(const mixMPI *mpidata) { Loading Loading @@ -213,11 +218,12 @@ void GeometryConfiguration::mpibcast(const mixMPI *mpidata) { MPI_Bcast(_sph_x, _number_of_spheres, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(_sph_y, _number_of_spheres, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(_sph_z, _number_of_spheres, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_refine_flag, 1, MPI_SHORT, 0, MPI_COMM_WORLD); MPI_Bcast(&_refine_flag, 1, MPI_C_BOOL, 0, MPI_COMM_WORLD); MPI_Bcast(&_dyn_order_flag, 1, MPI_SHORT, 0, MPI_COMM_WORLD); MPI_Bcast(&_host_ram_gb, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_gpu_ram_gb, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_tolerance, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_invert_mode, 1, MPI_SHORT, 0, MPI_COMM_WORLD); } #endif Loading Loading @@ -359,7 +365,7 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil re = regex("[0-9]+"); regex_search(str_target, m, re); short refine_flag = (short)stoi(m.str()); conf->_refine_flag = refine_flag; if (refine_flag > 0) conf->_refine_flag = true; is_parsed = true; } if (str_target.substr(0, 15).compare("USE_DYN_ORDERS=") == 0) { Loading Loading @@ -391,6 +397,20 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil is_parsed = true; } } if (str_target.size() > 10) { if (str_target.substr(0, 10).compare("INVERSION=") == 0) { string str_inv_mode = str_target.substr(10, str_target.length()); short inv_mode = 0; if (str_inv_mode.compare("LU") == 0) inv_mode = 0; else if (str_inv_mode.compare("SVD") == 0) inv_mode = 1; else if (str_inv_mode.compare("RBT") == 0) inv_mode = 2; else { throw(UnrecognizedConfigurationException("ERROR: unrecognized option \"" + str_target + "\"!\n")); } conf->_invert_mode = inv_mode; is_parsed = true; } } if (!is_parsed) { if (str_target.size() > 0) { if (str_target.substr(0, 1).compare("#") != 0) { Loading @@ -405,7 +425,18 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil delete[] file_lines; return conf; } // >>> END OF GeometryConfiguration CLASS IMPLEMENTATION <<< // >>> RuntimeSettings CLASS IMPLEMENTATION <<< RuntimeSettings::RuntimeSettings(GeometryConfiguration *gconf) { _invert_mode = gconf->invert_mode; _gpu_ram_gb = gconf->gpu_ram_gb; _host_ram_gb = gconf->host_ram_gb; _use_refinement = gconf->refinement_flag; } // >>> END OF RuntimeSettings CLASS IMPLEMENTATION <<< // >>> ScattererConfiguration CLASS IMPLEMENTATION <<< ScattererConfiguration::ScattererConfiguration( int nsph, int configs, double *scale_vector, int nxi, const std::string& variable_name, int *iog_vector, Loading Loading @@ -1577,6 +1608,7 @@ bool ScattererConfiguration::operator ==(const ScattererConfiguration &other) { } return true; } // >>> END OF ScattererConfiguration CLASS IMPLEMENTATION <<< int *check_overlaps( ScattererConfiguration *sconf, GeometryConfiguration *gconf, Loading Loading
src/include/Configuration.h +7 −3 Original line number Diff line number Diff line Loading @@ -126,6 +126,8 @@ protected: double _gpu_ram_gb; //! \brief Sphere overlap tolerance; double _tolerance; //! \brief Inversion algorithm (0 - LU, 1 - SVD, 2 - RBT) short _invert_mode; public: //! \brief Read-only view on number of spherical components. Loading Loading @@ -178,12 +180,14 @@ public: const short& refine_flag = _refine_flag; //! \brief Read-only view on flag for dynamic order management. const short& dyn_order_flag = _dyn_order_flag; //! \brief Read-only view on host RAM in GB //! \brief Read-only view on host RAM in GB. const double& host_ram_gb = _host_ram_gb; //! \brief Read-only view on GPU RAM in GB //! \brief Read-only view on GPU RAM in GB. const double& gpu_ram_gb = _gpu_ram_gb; //! \brief Read-only view on sphere overlap tolerance //! \brief Read-only view on sphere overlap tolerance. const double& tolerance = _tolerance; //! \brief Read-only view on inversion algorithm. const short& invert_mode = _invert_mode; /** * \brief Build a scattering geometry configuration structure. Loading
src/libnptm/Configuration.cpp +37 −5 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ #include <hdf5.h> #include <regex> #include <string> #include <string.h> // #include <string.h> #ifdef USE_MPI #ifndef MPI_VERSION #include <mpi.h> Loading Loading @@ -63,6 +63,8 @@ using namespace std; // >>> GeometryConfiguration CLASS IMPLEMENTATION <<< GeometryConfiguration::GeometryConfiguration( int nsph, int lm, int in_pol, int npnt, int npntts, int isam, int li, int le, np_int mxndm, int iavm, double *x, double *y, Loading Loading @@ -97,11 +99,12 @@ GeometryConfiguration::GeometryConfiguration( _sph_x = x; _sph_y = y; _sph_z = z; _refine_flag = 0; _refine_flag = false; _dyn_order_flag = 1; _host_ram_gb = 0.0; _gpu_ram_gb = 0.0; _tolerance = -1.0; _invert_mode = 0; } GeometryConfiguration::GeometryConfiguration(const GeometryConfiguration& rhs) Loading Loading @@ -142,6 +145,7 @@ GeometryConfiguration::GeometryConfiguration(const GeometryConfiguration& rhs) _host_ram_gb = rhs._host_ram_gb; _gpu_ram_gb = rhs._gpu_ram_gb; _tolerance = rhs._tolerance; _invert_mode = rhs._invert_mode; } #ifdef MPI_VERSION Loading Loading @@ -177,11 +181,12 @@ GeometryConfiguration::GeometryConfiguration(const mixMPI *mpidata) { MPI_Bcast(_sph_x, _number_of_spheres, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(_sph_y, _number_of_spheres, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(_sph_z, _number_of_spheres, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_refine_flag, 1, MPI_SHORT, 0, MPI_COMM_WORLD); MPI_Bcast(&_refine_flag, 1, MPI_C_BOOL, 0, MPI_COMM_WORLD); MPI_Bcast(&_dyn_order_flag, 1, MPI_SHORT, 0, MPI_COMM_WORLD); MPI_Bcast(&_host_ram_gb, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_gpu_ram_gb, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_tolerance, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_invert_mode, 1, MPI_SHORT, 0, MPI_COMM_WORLD); } void GeometryConfiguration::mpibcast(const mixMPI *mpidata) { Loading Loading @@ -213,11 +218,12 @@ void GeometryConfiguration::mpibcast(const mixMPI *mpidata) { MPI_Bcast(_sph_x, _number_of_spheres, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(_sph_y, _number_of_spheres, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(_sph_z, _number_of_spheres, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_refine_flag, 1, MPI_SHORT, 0, MPI_COMM_WORLD); MPI_Bcast(&_refine_flag, 1, MPI_C_BOOL, 0, MPI_COMM_WORLD); MPI_Bcast(&_dyn_order_flag, 1, MPI_SHORT, 0, MPI_COMM_WORLD); MPI_Bcast(&_host_ram_gb, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_gpu_ram_gb, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_tolerance, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(&_invert_mode, 1, MPI_SHORT, 0, MPI_COMM_WORLD); } #endif Loading Loading @@ -359,7 +365,7 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil re = regex("[0-9]+"); regex_search(str_target, m, re); short refine_flag = (short)stoi(m.str()); conf->_refine_flag = refine_flag; if (refine_flag > 0) conf->_refine_flag = true; is_parsed = true; } if (str_target.substr(0, 15).compare("USE_DYN_ORDERS=") == 0) { Loading Loading @@ -391,6 +397,20 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil is_parsed = true; } } if (str_target.size() > 10) { if (str_target.substr(0, 10).compare("INVERSION=") == 0) { string str_inv_mode = str_target.substr(10, str_target.length()); short inv_mode = 0; if (str_inv_mode.compare("LU") == 0) inv_mode = 0; else if (str_inv_mode.compare("SVD") == 0) inv_mode = 1; else if (str_inv_mode.compare("RBT") == 0) inv_mode = 2; else { throw(UnrecognizedConfigurationException("ERROR: unrecognized option \"" + str_target + "\"!\n")); } conf->_invert_mode = inv_mode; is_parsed = true; } } if (!is_parsed) { if (str_target.size() > 0) { if (str_target.substr(0, 1).compare("#") != 0) { Loading @@ -405,7 +425,18 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(const std::string& fil delete[] file_lines; return conf; } // >>> END OF GeometryConfiguration CLASS IMPLEMENTATION <<< // >>> RuntimeSettings CLASS IMPLEMENTATION <<< RuntimeSettings::RuntimeSettings(GeometryConfiguration *gconf) { _invert_mode = gconf->invert_mode; _gpu_ram_gb = gconf->gpu_ram_gb; _host_ram_gb = gconf->host_ram_gb; _use_refinement = gconf->refinement_flag; } // >>> END OF RuntimeSettings CLASS IMPLEMENTATION <<< // >>> ScattererConfiguration CLASS IMPLEMENTATION <<< ScattererConfiguration::ScattererConfiguration( int nsph, int configs, double *scale_vector, int nxi, const std::string& variable_name, int *iog_vector, Loading Loading @@ -1577,6 +1608,7 @@ bool ScattererConfiguration::operator ==(const ScattererConfiguration &other) { } return true; } // >>> END OF ScattererConfiguration CLASS IMPLEMENTATION <<< int *check_overlaps( ScattererConfiguration *sconf, GeometryConfiguration *gconf, Loading