Loading src/cluster/Makefile +4 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ F_CLU_OBJS=$(OBJDIR)/clu.o $(OBJDIR)/edfb_clu.o #CXX_CLU_OBJS=$(OBJDIR)/np_cluster.o $(OBJDIR)/Commons.o $(OBJDIR)/Configuration.o $(OBJDIR)/file_io.o $(OBJDIR)/Parsers.o $(OBJDIR)/sph_subs.o $(OBJDIR)/clu_subs.o $(OBJDIR)/cluster.o $(OBJDIR)/TransitionMatrix.o CXX_CLU_OBJS=$(OBJDIR)/np_cluster.o $(OBJDIR)/cluster.o $(LIBNPTM) CXX_CLU_DEBUG=$(OBJDIR)/np_cluster.g* $(OBJDIR)/cluster.g* all: $(LIBNPTM) $(BUILDDIR_CLU)/clu $(BUILDDIR_CLU)/edfb_clu $(BUILDDIR_CLU)/np_cluster Loading @@ -47,8 +49,8 @@ $(BUILDDIR_CLU)/np_cluster: $(OBJDIR) $(CXX_CLU_OBJS) $(BUILDDIR_CLU) $(LIBNPTM) $(CXX) $(CXXFLAGS) -o $(BUILDDIR_CLU)/np_cluster $(CXX_CLU_OBJS) $(LIBNPTM) $(CXXLDFLAGS) clean: rm -f $(F_CLU_OBJS) $(CXX_CLU_OBJS) rm -f $(F_CLU_OBJS) $(CXX_CLU_OBJS) $(CXX_CLU_DEBUG) wipe: rm -f $(BUILDDIR_CLU)/clu $(BUILDDIR_CLU)/edfb_clu $(BUILDDIR_CLU)/np_cluster $(F_CLU_OBJS) $(CXX_CLU_OBJS) rm -f $(BUILDDIR_CLU)/clu $(BUILDDIR_CLU)/edfb_clu $(BUILDDIR_CLU)/np_cluster $(F_CLU_OBJS) $(CXX_CLU_OBJS) $(CXX_CLU_DEBUG) src/cluster/cluster.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,10 @@ #include <fstream> #include <string> #ifndef INCLUDE_ERRORS_H_ #include "../include/errors.h" #endif #ifndef INCLUDE_CONFIGURATION_H_ #include "../include/Configuration.h" #endif Loading src/include/Configuration.h +38 −46 Original line number Diff line number Diff line Loading @@ -28,52 +28,6 @@ #ifndef INCLUDE_CONFIGURATION_H_ #define INCLUDE_CONFIGURATION_H_ /** * \brief Exception for open file error handlers. */ class OpenConfigurationFileException: public std::exception { protected: //! \brief Name of the file that was accessed. std::string file_name; public: /** * \brief Exception instance constructor. * * \param name: `string` Name of the file that was accessed. */ OpenConfigurationFileException(std::string name) { file_name = name; } /** * \brief Exception message. */ virtual const char* what() const throw() { return file_name.c_str(); } }; /** * \brief Exception for unrecognized configuration data sets. */ class UnrecognizedConfigurationException: public std::exception { protected: //! Description of the problem. std::string message; public: /** * \brief Exception instance constructor. * * \param problem: `string` Description of the problem that occurred. */ UnrecognizedConfigurationException(std::string problem) { message = problem; } /** * \brief Exception message. */ virtual const char* what() const throw() { return message.c_str(); } }; /** * \brief A class to represent the configuration of the scattering geometry. * Loading Loading @@ -361,6 +315,44 @@ public: */ static ScattererConfiguration* from_dedfb(std::string file_name); /*! \brief Get the ID of a sphere by its index. * * The proper way to access read-only parameters from outside a class is to define * public methods that return their values. For arrays, particularly those that * are accessed multiple times, it is convenient to have specialized methods that * return the required values based on their index in the array. * * \param index: `int` Index of the ID to be retrieved. * \return id: `int` The desired identifier. */ int get_iog(int index) { return iog_vec[index]; } /*! \brief Get the value of a parameter by name. * * The proper way to access read-only parameters from outside a class is to define * public methods that return their values. For configuration operations, whose * optimization is not critical, it is possible to define a single function that * returns simple scalar values called by name. Access to more complicated data * structures, on the other hand, require specialized methods which avoid the * burden of searching the necessary value across the whole arrya every time. * * \param param_name: `string` Name of the parameter to be retrieved. * \return value: `double` Value of the requested parameter. */ double get_param(std::string param_name); /*! \brief Get the value of a scale by its index. * * The proper way to access read-only parameters from outside a class is to define * public methods that return their values. For arrays, particularly those that * are accessed multiple times, it is convenient to have specialized methods that * return the required values based on their index in the array. * * \param index: `int` Index of the scale to be retrieved. * \return scale: `double` The desired scale. */ double get_scale(int index) { return scale_vec[index]; } /*! \brief Print the contents of the configuration object to terminal. * * In case of quick debug testing, `ScattererConfiguration.print()` allows printing Loading src/include/List.h +1 −32 Original line number Diff line number Diff line Loading @@ -6,38 +6,7 @@ #ifndef INCLUDE_LIST_H_ #define INCLUDE_LIST_H_ /** * \brief Exception for out of bounds List requests. */ class ListOutOfBoundsException: public std::exception { protected: //! Description of the problem. std::string message; public: /** * \brief Exception instance constructor. * * \param requested: `int` The index that was requested. * \param min: `int` The minimum index allowed by the list. * \param max: `int` The maximum index allowed by the list. */ ListOutOfBoundsException(int requested, int min, int max) { message = "Error: requested index " + std::to_string(requested) + " out of list allowed bounds [" + std::to_string(min) + ", " + std::to_string(max - 1) + "]"; } /** * \brief Exception message. */ virtual const char* what() const throw() { return message.c_str(); } }; /** * \brief A class to represent dynamic lists. /*! \brief A class to represent dynamic lists. * * This class helps in the creation and management of dynamic lists of * objects, whose size is not known in advance. List offers the advantage Loading src/include/TransitionMatrix.h +0 −22 Original line number Diff line number Diff line Loading @@ -6,28 +6,6 @@ #ifndef INCLUDE_TRANSITIONMATRIX_H_ #define INCLUDE_TRANSITIONMATRIX_H_ /** * \brief Exception for unrecognized file formats. */ class UnrecognizedFormatException: public std::exception { protected: //! Description of the problem. std::string message; public: /** * \brief Exception instance constructor. * * \param problem: `string` Description of the problem that occurred. */ UnrecognizedFormatException(std::string problem) { message = problem; } /** * \brief Exception message. */ virtual const char* what() const throw() { return message.c_str(); } }; /*! \brief Class to represent the Transition Matrix. */ class TransitionMatrix { Loading Loading
src/cluster/Makefile +4 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ F_CLU_OBJS=$(OBJDIR)/clu.o $(OBJDIR)/edfb_clu.o #CXX_CLU_OBJS=$(OBJDIR)/np_cluster.o $(OBJDIR)/Commons.o $(OBJDIR)/Configuration.o $(OBJDIR)/file_io.o $(OBJDIR)/Parsers.o $(OBJDIR)/sph_subs.o $(OBJDIR)/clu_subs.o $(OBJDIR)/cluster.o $(OBJDIR)/TransitionMatrix.o CXX_CLU_OBJS=$(OBJDIR)/np_cluster.o $(OBJDIR)/cluster.o $(LIBNPTM) CXX_CLU_DEBUG=$(OBJDIR)/np_cluster.g* $(OBJDIR)/cluster.g* all: $(LIBNPTM) $(BUILDDIR_CLU)/clu $(BUILDDIR_CLU)/edfb_clu $(BUILDDIR_CLU)/np_cluster Loading @@ -47,8 +49,8 @@ $(BUILDDIR_CLU)/np_cluster: $(OBJDIR) $(CXX_CLU_OBJS) $(BUILDDIR_CLU) $(LIBNPTM) $(CXX) $(CXXFLAGS) -o $(BUILDDIR_CLU)/np_cluster $(CXX_CLU_OBJS) $(LIBNPTM) $(CXXLDFLAGS) clean: rm -f $(F_CLU_OBJS) $(CXX_CLU_OBJS) rm -f $(F_CLU_OBJS) $(CXX_CLU_OBJS) $(CXX_CLU_DEBUG) wipe: rm -f $(BUILDDIR_CLU)/clu $(BUILDDIR_CLU)/edfb_clu $(BUILDDIR_CLU)/np_cluster $(F_CLU_OBJS) $(CXX_CLU_OBJS) rm -f $(BUILDDIR_CLU)/clu $(BUILDDIR_CLU)/edfb_clu $(BUILDDIR_CLU)/np_cluster $(F_CLU_OBJS) $(CXX_CLU_OBJS) $(CXX_CLU_DEBUG)
src/cluster/cluster.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,10 @@ #include <fstream> #include <string> #ifndef INCLUDE_ERRORS_H_ #include "../include/errors.h" #endif #ifndef INCLUDE_CONFIGURATION_H_ #include "../include/Configuration.h" #endif Loading
src/include/Configuration.h +38 −46 Original line number Diff line number Diff line Loading @@ -28,52 +28,6 @@ #ifndef INCLUDE_CONFIGURATION_H_ #define INCLUDE_CONFIGURATION_H_ /** * \brief Exception for open file error handlers. */ class OpenConfigurationFileException: public std::exception { protected: //! \brief Name of the file that was accessed. std::string file_name; public: /** * \brief Exception instance constructor. * * \param name: `string` Name of the file that was accessed. */ OpenConfigurationFileException(std::string name) { file_name = name; } /** * \brief Exception message. */ virtual const char* what() const throw() { return file_name.c_str(); } }; /** * \brief Exception for unrecognized configuration data sets. */ class UnrecognizedConfigurationException: public std::exception { protected: //! Description of the problem. std::string message; public: /** * \brief Exception instance constructor. * * \param problem: `string` Description of the problem that occurred. */ UnrecognizedConfigurationException(std::string problem) { message = problem; } /** * \brief Exception message. */ virtual const char* what() const throw() { return message.c_str(); } }; /** * \brief A class to represent the configuration of the scattering geometry. * Loading Loading @@ -361,6 +315,44 @@ public: */ static ScattererConfiguration* from_dedfb(std::string file_name); /*! \brief Get the ID of a sphere by its index. * * The proper way to access read-only parameters from outside a class is to define * public methods that return their values. For arrays, particularly those that * are accessed multiple times, it is convenient to have specialized methods that * return the required values based on their index in the array. * * \param index: `int` Index of the ID to be retrieved. * \return id: `int` The desired identifier. */ int get_iog(int index) { return iog_vec[index]; } /*! \brief Get the value of a parameter by name. * * The proper way to access read-only parameters from outside a class is to define * public methods that return their values. For configuration operations, whose * optimization is not critical, it is possible to define a single function that * returns simple scalar values called by name. Access to more complicated data * structures, on the other hand, require specialized methods which avoid the * burden of searching the necessary value across the whole arrya every time. * * \param param_name: `string` Name of the parameter to be retrieved. * \return value: `double` Value of the requested parameter. */ double get_param(std::string param_name); /*! \brief Get the value of a scale by its index. * * The proper way to access read-only parameters from outside a class is to define * public methods that return their values. For arrays, particularly those that * are accessed multiple times, it is convenient to have specialized methods that * return the required values based on their index in the array. * * \param index: `int` Index of the scale to be retrieved. * \return scale: `double` The desired scale. */ double get_scale(int index) { return scale_vec[index]; } /*! \brief Print the contents of the configuration object to terminal. * * In case of quick debug testing, `ScattererConfiguration.print()` allows printing Loading
src/include/List.h +1 −32 Original line number Diff line number Diff line Loading @@ -6,38 +6,7 @@ #ifndef INCLUDE_LIST_H_ #define INCLUDE_LIST_H_ /** * \brief Exception for out of bounds List requests. */ class ListOutOfBoundsException: public std::exception { protected: //! Description of the problem. std::string message; public: /** * \brief Exception instance constructor. * * \param requested: `int` The index that was requested. * \param min: `int` The minimum index allowed by the list. * \param max: `int` The maximum index allowed by the list. */ ListOutOfBoundsException(int requested, int min, int max) { message = "Error: requested index " + std::to_string(requested) + " out of list allowed bounds [" + std::to_string(min) + ", " + std::to_string(max - 1) + "]"; } /** * \brief Exception message. */ virtual const char* what() const throw() { return message.c_str(); } }; /** * \brief A class to represent dynamic lists. /*! \brief A class to represent dynamic lists. * * This class helps in the creation and management of dynamic lists of * objects, whose size is not known in advance. List offers the advantage Loading
src/include/TransitionMatrix.h +0 −22 Original line number Diff line number Diff line Loading @@ -6,28 +6,6 @@ #ifndef INCLUDE_TRANSITIONMATRIX_H_ #define INCLUDE_TRANSITIONMATRIX_H_ /** * \brief Exception for unrecognized file formats. */ class UnrecognizedFormatException: public std::exception { protected: //! Description of the problem. std::string message; public: /** * \brief Exception instance constructor. * * \param problem: `string` Description of the problem that occurred. */ UnrecognizedFormatException(std::string problem) { message = problem; } /** * \brief Exception message. */ virtual const char* what() const throw() { return message.c_str(); } }; /*! \brief Class to represent the Transition Matrix. */ class TransitionMatrix { Loading