Skip to content

Commit

Permalink
docs: Update API docs
Browse files Browse the repository at this point in the history
AgglomerationSolver, BaseSolver, ChemicalReaction, Plots, MixtureEnthalpyLookup,
DyssolTypes, DefinesMDB, DyssolDefines.
Remove old API docs.
  • Loading branch information
vasylskorych committed Nov 23, 2023
1 parent 0bade48 commit d6cc48e
Show file tree
Hide file tree
Showing 19 changed files with 1,229 additions and 466 deletions.
130 changes: 79 additions & 51 deletions BaseSolvers/AgglomerationSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,87 +6,115 @@
#include "BaseSolver.h"
#include <functional>

/**
* \brief Agglomeration solver.
*/
class CAgglomerationSolver : public CBaseSolver
{
public:
/**
* \brief Types of agglomeration kernels.
*/
enum class EKernels : size_t
{
CONSTANT = 0,
SUM = 1,
PRODUCT = 2,
BROWNIAN = 3,
SHEAR = 4,
PEGLOW = 5,
COAGULATION = 6,
GRAVITATIONAL = 7,
EKE = 8,
THOMPSON = 9,
CUSTOM = 10,
CONSTANT = 0, ///< Constant kernel.
SUM = 1, ///< Sum kernel.
PRODUCT = 2, ///< Product kernel.
BROWNIAN = 3, ///< Brownian kernel.
SHEAR = 4, ///< Shear kernel.
PEGLOW = 5, ///< Peglow kernel.
COAGULATION = 6, ///< Coagulation kernel.
GRAVITATIONAL = 7, ///< Gravitational kernel.
EKE = 8, ///< Equipartition kinetic energy kernel.
THOMPSON = 9, ///< Thompson kernel.
CUSTOM = 10, ///< Custom kernel.
};

protected:
using u_matr_t = std::vector<std::vector<size_t>>;
using d_matr_t = std::vector<std::vector<double>>;
using u_vect_t = std::vector<size_t>;
using d_vect_t = std::vector<double>;
using u_matr_t = std::vector<std::vector<size_t>>; ///< Matrix of size_t.
using d_matr_t = std::vector<std::vector<double>>; ///< Matrix of double.
using u_vect_t = std::vector<size_t>; ///< Vector of size_t.
using d_vect_t = std::vector<double>; ///< Vector of double.

using kernel_t = double(double, double); // Type of the kernel function.
using kernel_t = double(double, double); ///< Type of the kernel function.

EKernels m_kernel{ EKernels::BROWNIAN }; // Selected kernel function.
double m_beta0{ 1.0 }; // Size independent agglomeration rate (set zero for no agglomeration).
std::vector<double> m_parameters; // Additional parameters.
std::vector<double> m_grid; // Diameter-related PSD grid.
std::function<kernel_t> m_CutomKernel{}; // Custom kernel function.
EKernels m_kernel{ EKernels::BROWNIAN }; ///< Selected kernel function.
double m_beta0{ 1.0 }; ///< Size independent agglomeration rate (set zero for no agglomeration).
std::vector<double> m_parameters; ///< Additional parameters.
std::vector<double> m_grid; ///< Diameter-related PSD grid.
std::function<kernel_t> m_CutomKernel{}; ///< Custom kernel function.

public:
/**
* \private
*/
CAgglomerationSolver();
/**
* \private
*/
~CAgglomerationSolver() override = default;
/**
* \private
*/
CAgglomerationSolver(const CAgglomerationSolver& _other) = default;
/**
* \private
*/
CAgglomerationSolver(CAgglomerationSolver && _other) = default;
/**
* \private
*/
CAgglomerationSolver& operator=(const CAgglomerationSolver & _other) = default;
/**
* \private
*/
CAgglomerationSolver& operator=(CAgglomerationSolver && _other) = default;

/// <summary>
/// Sets all required parameters and calls Initialize()
/// </summary>
/// <param name="_grid">Diameter-related PSD grid</param>
/// <param name="_beta0">Size independent agglomeration rate</param>
/// <param name="_kernel">Type of the agglomeration kernel</param>
/// <param name="_parameters">Additional parameters</param>
/**
* \brief Sets all required parameters and calls Initialize()
* \param _grid Diameter-related PSD grid
* \param _beta0 Size independent agglomeration rate
* \param _kernel Type of the agglomeration kernel
* \param _parameters Additional parameters
*/
void Initialize(const d_vect_t& _grid, double _beta0, EKernels _kernel, const d_vect_t& _parameters = d_vect_t());
/// <summary>
/// Sets all required parameters and calls Initialize()
/// </summary>
/// <param name="_grid">Diameter-related PSD grid</param>
/// <param name="_beta0">Size independent agglomeration rate</param>
/// <param name="_kernel">Function of the agglomeration kernel</param>
/// <param name="_parameters">Additional parameters</param>
/**
* \brief Sets all required parameters and calls Initialize()
* \param _grid Diameter-related PSD grid
* \param _beta0 Size independent agglomeration rate
* \param _kernel Function of the agglomeration kernel
* \param _parameters Additional parameters
*/
void Initialize(const d_vect_t& _grid, double _beta0, const std::function<kernel_t>& _kernel, const d_vect_t& _parameters = d_vect_t());

/// <summary>
/// Actual initialization of the solver.
/// </summary>
/**
* \brief Actual initialization of the solver.
*/
void Initialize() override;
/// <summary>
/// Main calculation function
/// </summary>
/// <param name="_n">Number distribution</param>
/// <param name="_rateB">Output vector for birth rate</param>
/// <param name="_rateD">Output vector for death rate</param>
/**
* \brief Main calculation function
* \param _n Number distribution
* \param _rateB Output vector for birth rate
* \param _rateD Output vector for death rate
*/
virtual void Calculate(const d_vect_t& _n, d_vect_t& _rateB, d_vect_t& _rateD);
/// <summary>
/// Main calculation function
/// </summary>
/// <param name="_n">Number distribution</param>
/// <returns>Birth and death rates</returns>
/**
* \brief Main calculation function
* \param _n Number distribution
* \return Birth and death rates
*/
std::pair<d_vect_t, d_vect_t> Calculate(const d_vect_t& _n);

protected:
// Calculates the chosen kernel function for particles with volumes _u and _v.
/**
* Calculates the chosen kernel function for particles with volumes _u and _v.
*/
[[nodiscard]] double Kernel(double _u, double _v) const;

private:
// Sets all parameters.
/**
* Sets all parameters.
*/
void SetParameters(const d_vect_t& _grid, double _beta0, EKernels _kernel, const std::function<kernel_t>& _kernelFun, const d_vect_t& _parameters);
};

Expand Down
116 changes: 89 additions & 27 deletions BaseSolvers/BaseSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,67 +42,129 @@ enum class ESolverTypes : uint32_t
#define CREATE_SOLVER_FUN(X) MACRO_CONCAT(CREATE_SOLVER_FUNCTION_CONF, X)
#define CREATE_SOLVER_FUN_NAME(X) MACRO_TOSTRING(CREATE_SOLVER_FUN(X))

/**
* \brief Base solver.
*/
class CBaseSolver
{
protected:
ESolverTypes m_type{ ESolverTypes::SOLVER_NONE }; // Type of the solver (SOLVER_AGGLOMERATION_1/SOLVER_PBM_1/...).
std::string m_name{}; // User-friendly name of the solver.
std::string m_authorName{}; // Name of solver's author.
std::string m_uniqueID{}; // Unique identifier of the solver.
std::string m_helpLink{}; // Link to help file for solver.
size_t m_version{}; // Version of the solver.
size_t m_compilerVersion{ COMPILER_VERSION }; // Version of compiler used to build the solver.
ESolverTypes m_type{ ESolverTypes::SOLVER_NONE }; ///< Type of the solver (SOLVER_AGGLOMERATION_1/SOLVER_PBM_1/...).
std::string m_name{}; ///< User-friendly name of the solver.
std::string m_authorName{}; ///< Name of solver's author.
std::string m_uniqueID{}; ///< Unique identifier of the solver.
std::string m_helpLink{}; ///< Link to help file for solver.
size_t m_version{}; ///< Version of the solver.
size_t m_compilerVersion{ COMPILER_VERSION }; ///< Version of compiler used to build the solver.

public:
/**
* \private
*/
CBaseSolver() = default;
/**
* \private
*/
virtual ~CBaseSolver() = default;
/**
* \private
*/
CBaseSolver(const CBaseSolver& _other) = default;
/**
* \private
*/
CBaseSolver(CBaseSolver&& _other) = default;
/**
* \private
*/
CBaseSolver& operator=(const CBaseSolver& _other) = default;
/**
* \private
*/
CBaseSolver& operator=(CBaseSolver&& _other) = default;

// Returns type to which belongs this solver.
/**
* \brief Returns type to which belongs this solver.
* \return Solver's type.
*/
ESolverTypes GetType() const;
// Returns name of solver.
/**
* \brief Returns name of solver.
* \return Solver's name.
*/
std::string GetName() const;
// Returns name of the solver's author.
/**
* \brief Returns name of the solver's author.
* \return Author's type.
*/
std::string GetAuthorName() const;
// Returns version of solver.
/**
* \brief Returns version of solver.
* \return Solver's version.
*/
size_t GetVersion() const;
// Returns string key, unique for all solvers.
/**
* \brief Returns string key, unique for all solvers.
* \return Solver's unique ID.
*/
std::string GetUniqueID() const;
/**
* \brief Returns the help link of the solver.
* \return Help link of the solver.
*/
* \brief Returns the help link of the solver.
* \return Help link of the solver.
*/
std::string GetHelpLink() const;

// Sets the name of the solver.
/**
* \brief Sets the name of the solver.
* \param _name Solver's name.
*/
void SetName(const std::string& _name);
// Sets the name of solver's author.
/**
* \brief Sets the name of solver's author.
* \param _author Solver's author.
*/
void SetAuthorName(const std::string& _author);
// Sets the version of the solver.
/**
* \brief Sets the version of the solver.
* \param _version Solver's version.
*/
void SetVersion(size_t _version);
// Sets the unique identifier of the solver.
/**
* \brief Sets the unique identifier of the solver.
* \param _id Solver's unique ID.
*/
void SetUniqueID(const std::string& _id);
/**
* \brief Sets the help link of the solver.
* \param _helpLink Help link of the solver.
*/
* \brief Sets the help link of the solver.
* \param _helpLink Help link of the solver.
*/
void SetHelpLink(const std::string& _helpLink);

// Will be called once during creation of the solver (name, author, key, version).
/**
* \brief Will be called once during creation of the solver (name, author, key, version).
*/
virtual void CreateBasicInfo() = 0;
// Will be called to initialize the solver.
/**
* \brief Will be called to initialize the solver.
*/
virtual void Initialize();
// Will be called once after the whole simulation is finished.
/**
* \brief Will be called once after the whole simulation is finished.
*/
virtual void Finalize();
// Will be called when storing of current internal state is needed.
/**
* \brief Will be called when storing of current internal state is needed.
*/
virtual void SaveState();
// Will be called when loading of last stored internal state is needed.
/**
* \brief Will be called when loading of last stored internal state is needed.
*/
virtual void LoadState();

protected:
/**
* \brief Sets an error state of the solver, prints the message to the simulation log, and requests to stop simulation.
* \param _message Message to show in the simulation log.
*/
[[noreturn]] void RaiseError(const std::string& _message) const;
};

Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ IF(BUILD_DOCS)
"BaseSolvers/AgglomerationSolver"
"BaseSolvers/BaseSolver"
"Utilities/DyssolDefines"
"Utilities/DyssolTypes"
)

# Gather all API headers
Expand Down
3 changes: 3 additions & 0 deletions Documentation/004_development/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ All functions, classes, their member variables and methods, needed to develop ne
class_basesolver
class_statevariablesmanager
class_statevariable
class_point
class_curve
class_plot
class_plotmanager
class_mixtureenthalpylookup
class_matrix2d
class_densemdmatrix
Expand Down
8 changes: 8 additions & 0 deletions Documentation/004_development/class_curve.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. _sec.development.api.class_curve:

Curve
=====

.. doxygenclass:: CCurve
:project: dyssol_models_api
:members:
9 changes: 0 additions & 9 deletions Documentation/004_development/class_plot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,5 @@ Plot
====

.. doxygenclass:: CPlot
:project: dyssol_models_api
:members:

.. _sec.development.api.class_curve:

Curve
=====

.. doxygenclass:: CCurve
:project: dyssol_models_api
:members:
8 changes: 8 additions & 0 deletions Documentation/004_development/class_plotmanager.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. _sec.development.api.class_plotmanager:

Plot manager
============

.. doxygenclass:: CPlotManager
:project: dyssol_models_api
:members:
8 changes: 8 additions & 0 deletions Documentation/004_development/class_point.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. _sec.development.api.class_point:

Point
=====

.. doxygenclass:: CPoint
:project: dyssol_models_api
:members:
2 changes: 1 addition & 1 deletion Documentation/004_development/constants.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ Dyssol constants
:project: dyssol_models_api

.. doxygenenum:: ESolverTypes
:project: dyssol_models_api
:project: dyssol_models_api
Loading

0 comments on commit d6cc48e

Please sign in to comment.