Loading src/include/Configuration.h +14 −1 Original line number Diff line number Diff line Loading @@ -290,7 +290,7 @@ protected: double *_radii_of_spheres; //! \brief Vector of sphere ID numbers, with size [N_SPHERES]. int *_iog_vec; //! \brief Vector of layer numbers for every sphere, with size [N_SPHERES]. //! \brief Vector of layer numbers for every sphere, with size [CONFIGURATIONS]. int *_nshl_vec; //! \brief Vector of scale parameters, with size [N_SCALES]. double *_scale_vec; Loading Loading @@ -511,6 +511,12 @@ public: */ int get_iog(int index) { return _iog_vec[index]; } /*! \brief Get the maximum radius of the sphere components. * * \return radius: `double` The radius of the largest sphere. */ double get_max_radius(); /*! \brief Get the number of layers for a given configuration. * * This is a specialized function to get the number of layers in a specific Loading @@ -521,6 +527,13 @@ public: */ int get_nshl(int index) { return _nshl_vec[index]; } /*! \brief Get the radius of the smallest sphere containing the particle. * * \param gc: `GeometryConfiguration *` Pointer to a `GeometryConfiguration` instance. * \return radius: `double` The radius of the sphere containing the particle. */ double get_particle_radius(GeometryConfiguration *gc); /*! \brief Get the radius of a sphere by its index. * * This is a specialized function to get the radius of a sphere through its Loading src/libnptm/Configuration.cpp +34 −0 Original line number Diff line number Diff line Loading @@ -971,6 +971,40 @@ ScattererConfiguration* ScattererConfiguration::from_legacy(const std::string& f return conf; } double ScattererConfiguration::get_max_radius() { double result = 0.0; for (int ci = 0; ci < _configurations; ci++) { if (_radii_of_spheres[ci] > result) result = _radii_of_spheres[ci]; } return result; } double ScattererConfiguration::get_particle_radius(GeometryConfiguration *gc) { double result = 0.0; if (_use_external_sphere) { result = _radii_of_spheres[0] * _rcf[0][_nshl_vec[0] - 1]; } else { double x, y, z; int far_index = -1; double dist2, max_dist; double max_dist2 = 0.0; for (int si = 0; si < _number_of_spheres; si++) { x = gc->get_sph_x(si); y = gc->get_sph_y(si); z = gc->get_sph_z(si); dist2 = x * x + y * y + z * z; if (dist2 > max_dist2) { max_dist2 = dist2; far_index = si; } } max_dist = sqrt(max_dist2); result = max_dist + _radii_of_spheres[far_index]; } return result; } void ScattererConfiguration::print() { int ies = (_use_external_sphere)? 1 : 0; printf("### CONFIGURATION DATA ###\n"); Loading Loading
src/include/Configuration.h +14 −1 Original line number Diff line number Diff line Loading @@ -290,7 +290,7 @@ protected: double *_radii_of_spheres; //! \brief Vector of sphere ID numbers, with size [N_SPHERES]. int *_iog_vec; //! \brief Vector of layer numbers for every sphere, with size [N_SPHERES]. //! \brief Vector of layer numbers for every sphere, with size [CONFIGURATIONS]. int *_nshl_vec; //! \brief Vector of scale parameters, with size [N_SCALES]. double *_scale_vec; Loading Loading @@ -511,6 +511,12 @@ public: */ int get_iog(int index) { return _iog_vec[index]; } /*! \brief Get the maximum radius of the sphere components. * * \return radius: `double` The radius of the largest sphere. */ double get_max_radius(); /*! \brief Get the number of layers for a given configuration. * * This is a specialized function to get the number of layers in a specific Loading @@ -521,6 +527,13 @@ public: */ int get_nshl(int index) { return _nshl_vec[index]; } /*! \brief Get the radius of the smallest sphere containing the particle. * * \param gc: `GeometryConfiguration *` Pointer to a `GeometryConfiguration` instance. * \return radius: `double` The radius of the sphere containing the particle. */ double get_particle_radius(GeometryConfiguration *gc); /*! \brief Get the radius of a sphere by its index. * * This is a specialized function to get the radius of a sphere through its Loading
src/libnptm/Configuration.cpp +34 −0 Original line number Diff line number Diff line Loading @@ -971,6 +971,40 @@ ScattererConfiguration* ScattererConfiguration::from_legacy(const std::string& f return conf; } double ScattererConfiguration::get_max_radius() { double result = 0.0; for (int ci = 0; ci < _configurations; ci++) { if (_radii_of_spheres[ci] > result) result = _radii_of_spheres[ci]; } return result; } double ScattererConfiguration::get_particle_radius(GeometryConfiguration *gc) { double result = 0.0; if (_use_external_sphere) { result = _radii_of_spheres[0] * _rcf[0][_nshl_vec[0] - 1]; } else { double x, y, z; int far_index = -1; double dist2, max_dist; double max_dist2 = 0.0; for (int si = 0; si < _number_of_spheres; si++) { x = gc->get_sph_x(si); y = gc->get_sph_y(si); z = gc->get_sph_z(si); dist2 = x * x + y * y + z * z; if (dist2 > max_dist2) { max_dist2 = dist2; far_index = si; } } max_dist = sqrt(max_dist2); result = max_dist + _radii_of_spheres[far_index]; } return result; } void ScattererConfiguration::print() { int ies = (_use_external_sphere)? 1 : 0; printf("### CONFIGURATION DATA ###\n"); Loading