Commit 3799015d authored by jstark's avatar jstark
Browse files

Updating documentation.

parent e5c82bd7
...@@ -63,7 +63,7 @@ if ( CUDA_ON_BACKEND STREQUAL "HIP" AND HIP_FOUND ) ...@@ -63,7 +63,7 @@ if ( CUDA_ON_BACKEND STREQUAL "HIP" AND HIP_FOUND )
# BoundaryConditions/tests/method_of_images_cylinder_unit_test.cpp # BoundaryConditions/tests/method_of_images_cylinder_unit_test.cpp
# level_set/closest_point/closest_point_unit_tests.cpp # level_set/closest_point/closest_point_unit_tests.cpp
level_set/redistancing_Sussman/tests/redistancingSussman_unit_test.cpp level_set/redistancing_Sussman/tests/redistancingSussman_unit_test.cpp
level_set/redistancing_Sussman/tests/convergence_test.cpp # level_set/redistancing_Sussman/tests/convergence_test.cpp
) )
...@@ -92,15 +92,18 @@ else() ...@@ -92,15 +92,18 @@ else()
# FiniteDifference/eq_unit_test_3d.cpp # FiniteDifference/eq_unit_test_3d.cpp
# FiniteDifference/eq_unit_test.cpp # FiniteDifference/eq_unit_test.cpp
# FiniteDifference/tests/Eno_Weno_unit_test.cpp # FiniteDifference/tests/Eno_Weno_unit_test.cpp
# FiniteDifference/tests/Upwind_gradient_unit_test.cpp FiniteDifference/tests/Upwind_gradient_unit_test.cpp
# FiniteDifference/tests/FD_simple_unit_test.cpp FiniteDifference/tests/FD_simple_unit_test.cpp
# Operators/Vector/vector_dist_operators_unit_tests.cpp # Operators/Vector/vector_dist_operators_unit_tests.cpp
# Operators/Vector/vector_dist_operators_apply_kernel_unit_tests.cpp # Operators/Vector/vector_dist_operators_apply_kernel_unit_tests.cpp
# ../../src/lib/pdata.cpp # ../../src/lib/pdata.cpp
# BoundaryConditions/tests/method_of_images_cylinder_unit_test.cpp # BoundaryConditions/tests/method_of_images_cylinder_unit_test.cpp
# level_set/closest_point/closest_point_unit_tests.cpp # level_set/closest_point/closest_point_unit_tests.cpp
level_set/redistancing_Sussman/tests/redistancingSussman_unit_test.cpp level_set/redistancing_Sussman/tests/redistancingSussman_unit_test.cpp
level_set/redistancing_Sussman/tests/convergence_test.cpp level_set/redistancing_Sussman/tests/redistancingSussman_fast_unit_test.cpp
level_set/redistancing_Sussman/tests/convergence_test.cpp
level_set/redistancing_Sussman/tests/help_functions_unit_test.cpp
level_set/redistancing_Sussman/tests/narrowBand_unit_test.cpp
) )
set_property(TARGET numerics PROPERTY CUDA_ARCHITECTURES OFF) set_property(TARGET numerics PROPERTY CUDA_ARCHITECTURES OFF)
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* @param dplus: Gradient approximated using RHS neighbors. * @param dplus: Gradient approximated using RHS neighbors.
* @param dminus: Gradient approximated using LHS neighbors. * @param dminus: Gradient approximated using LHS neighbors.
* @param sign: Sign of the velocity with which the wave front is moving. * @param sign: Sign of the velocity with which the wave front is moving.
* @return Scalar double upwind gradient approximation in the dimension given. * @return Scalar upwind gradient approximation in the dimension given.
*/ */
template <typename field_type> template <typename field_type>
static field_type upwinding(field_type dplus, field_type dminus, int sign) static field_type upwinding(field_type dplus, field_type dminus, int sign)
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/**@brief Computes the time step for the iterative re-distancing fulfilling CFL condition. /**@brief Computes the time step for the iterative re-distancing fulfilling CFL condition.
* *
* @tparam grid_type Inferred type of the input grid. * @tparam grid_type Template type of the input grid.
* @param grid Input OpenFPM grid. * @param grid Input OpenFPM grid.
* @return Time step. * @return Time step.
*/ */
...@@ -40,7 +40,7 @@ typename grid_type::stype get_time_step_CFL(grid_type &grid) ...@@ -40,7 +40,7 @@ typename grid_type::stype get_time_step_CFL(grid_type &grid)
/**@brief Computes the time step size fulfilling CFL condition according to https://www.cfd-online /**@brief Computes the time step size fulfilling CFL condition according to https://www.cfd-online
* .com/Wiki/Courant–Friedrichs–Lewy_condition for arbitrary dimensionality. * .com/Wiki/Courant–Friedrichs–Lewy_condition for arbitrary dimensionality.
* *
* @tparam grid_type Inferred type of the input grid. * @tparam grid_type Template type of the input grid.
* @param grid Input OpenFPM grid. * @param grid Input OpenFPM grid.
* @param u Array of size grid_type::dims containing the velocity in each dimension. * @param u Array of size grid_type::dims containing the velocity in each dimension.
* @param Cmax Courant number. * @param Cmax Courant number.
...@@ -59,7 +59,7 @@ typename grid_type::stype get_time_step_CFL(grid_type & grid, typename grid_type ...@@ -59,7 +59,7 @@ typename grid_type::stype get_time_step_CFL(grid_type & grid, typename grid_type
/**@brief Computes the time step size fulfilling CFL condition according to https://www.cfd-online /**@brief Computes the time step size fulfilling CFL condition according to https://www.cfd-online
* .com/Wiki/Courant–Friedrichs–Lewy_condition for arbitrary dimensionality. * .com/Wiki/Courant–Friedrichs–Lewy_condition for arbitrary dimensionality.
* *
* @tparam grid_type Inferred type of the input grid. * @tparam grid_type Template type of the input grid.
* @param grid Input OpenFPM grid. * @param grid Input OpenFPM grid.
* @param u Velocity of propagating wave if isotropic for each direction. * @param u Velocity of propagating wave if isotropic for each direction.
* @param Cmax Courant number. * @param Cmax Courant number.
...@@ -80,8 +80,8 @@ typename grid_type::stype get_time_step_CFL(grid_type & grid, typename grid_type ...@@ -80,8 +80,8 @@ typename grid_type::stype get_time_step_CFL(grid_type & grid, typename grid_type
* init_value. * init_value.
* *
* @tparam Prop Index of property that should be initialized with the value from \p init_value. * @tparam Prop Index of property that should be initialized with the value from \p init_value.
* @tparam grid_type Inferred type of input OpenFPM grid. * @tparam grid_type Template type of input OpenFPM grid.
* @tparam T Inferred type of the variable containing the initialization value \p init_value. * @tparam T Template type of the variable containing the initialization value \p init_value.
* @param grid OpenFPM grid whose property \p Prop should be initialized, including its ghost layer. * @param grid OpenFPM grid whose property \p Prop should be initialized, including its ghost layer.
* @param init_value Variable that contains the value that should be copied to \p Prop. * @param init_value Variable that contains the value that should be copied to \p Prop.
*/ */
...@@ -101,8 +101,8 @@ void init_grid_and_ghost(grid_type & grid, T init_value) ...@@ -101,8 +101,8 @@ void init_grid_and_ghost(grid_type & grid, T init_value)
* *
* @tparam attr_sc Index of property that contains the value that should be copied. * @tparam attr_sc Index of property that contains the value that should be copied.
* @tparam attr_ds Index of property to which the value should be copied to. * @tparam attr_ds Index of property to which the value should be copied to.
* @tparam grid_source_type Inferred type of the source grid \p grid_sc. * @tparam grid_source_type Template type of the source grid \p grid_sc.
* @tparam grid_dest_type Inferred type of the destination grid \p grid_ds. * @tparam grid_dest_type Template type of the destination grid \p grid_ds.
* @param grid_sc OpenFPM grid from which value is copied (source). * @param grid_sc OpenFPM grid from which value is copied (source).
* @param grid_ds OpenFPM grid to which value is copied to (destination). * @param grid_ds OpenFPM grid to which value is copied to (destination).
* @param include_ghost Bool variable that defines if the copying should include the ghost layer. False, if not; true, * @param include_ghost Bool variable that defines if the copying should include the ghost layer. False, if not; true,
...@@ -144,9 +144,9 @@ void copy_gridTogrid(const grid_source_type & grid_sc, grid_dest_type & grid_ds, ...@@ -144,9 +144,9 @@ void copy_gridTogrid(const grid_source_type & grid_sc, grid_dest_type & grid_ds,
/**@brief Determines the biggest spacing of a grid which is potentially anisotropic when comparing x, y (and z) /**@brief Determines the biggest spacing of a grid which is potentially anisotropic when comparing x, y (and z)
* coordinate axis. * coordinate axis.
* *
* @tparam grid_type Inferred type of input grid. * @tparam grid_type Template type of input grid.
* @param grid Input OpenFPM grid. * @param grid Input OpenFPM grid.
* @return Double variable that contains the value of the biggest spacing. * @return Biggest spacing of same type as grid-space.
*/ */
template <typename grid_type> template <typename grid_type>
typename grid_type::stype get_biggest_spacing(grid_type & grid) typename grid_type::stype get_biggest_spacing(grid_type & grid)
...@@ -162,9 +162,9 @@ typename grid_type::stype get_biggest_spacing(grid_type & grid) ...@@ -162,9 +162,9 @@ typename grid_type::stype get_biggest_spacing(grid_type & grid)
/**@brief Determines the smallest spacing of a grid which is potentially anisotropic when comparing x, y (and z) /**@brief Determines the smallest spacing of a grid which is potentially anisotropic when comparing x, y (and z)
* coordinate axis. * coordinate axis.
* *
* @tparam grid_type Inferred type of input grid. * @tparam grid_type Template type of input grid.
* @param grid Input OpenFPM grid. * @param grid Input OpenFPM grid.
* @return Double variable that contains the value of the smallest spacing. * @return Smallest spacing of same type as grid-space.
*/ */
template <typename grid_type> template <typename grid_type>
typename grid_type::stype get_smallest_spacing(grid_type & grid) typename grid_type::stype get_smallest_spacing(grid_type & grid)
...@@ -183,10 +183,10 @@ typename grid_type::stype get_smallest_spacing(grid_type & grid) ...@@ -183,10 +183,10 @@ typename grid_type::stype get_smallest_spacing(grid_type & grid)
* *
* @tparam Prop1 Index of the first property. * @tparam Prop1 Index of the first property.
* @tparam Prop2 Index of the second property. * @tparam Prop2 Index of the second property.
* @tparam grid_type Inferred type of the input grid. * @tparam grid_type Template type of the input grid.
* @param grid Input OpenFPM grid. * @param grid Input OpenFPM grid.
* @return Double variable that contains the sum over all grid nodes of the difference between the value stored at \p * @return Sum over all grid nodes of the difference between the value stored at \p Prop1 and the value stored at \p
* Prop1 and the value stored at \p Prop2. * Prop2.
*/ */
template <size_t Prop1, size_t Prop2, typename grid_type> template <size_t Prop1, size_t Prop2, typename grid_type>
auto average_difference(grid_type & grid) auto average_difference(grid_type & grid)
...@@ -206,9 +206,9 @@ auto average_difference(grid_type & grid) ...@@ -206,9 +206,9 @@ auto average_difference(grid_type & grid)
/**@brief Determines the maximum value stored on a given grid at a given property. /**@brief Determines the maximum value stored on a given grid at a given property.
* *
* @tparam Prop Index of property for which maximum should be found. * @tparam Prop Index of property for which maximum should be found.
* @tparam grid_type Inferred type of the input grid. * @tparam grid_type Template type of the input grid.
* @param grid Input OpenFPM grid. * @param grid Input OpenFPM grid.
* @return Double variable that contains the maximum value of property \p Prop in \p grid. * @return Maximum value of property \p Prop in \p grid.
*/ */
template <size_t Prop, typename grid_type> template <size_t Prop, typename grid_type>
auto get_max_val(grid_type & grid) auto get_max_val(grid_type & grid)
...@@ -231,9 +231,9 @@ auto get_max_val(grid_type & grid) ...@@ -231,9 +231,9 @@ auto get_max_val(grid_type & grid)
/**@brief Determines the minimum value stored on a given grid at a given property. /**@brief Determines the minimum value stored on a given grid at a given property.
* *
* @tparam Prop Index of property for which minimum should be found. * @tparam Prop Index of property for which minimum should be found.
* @tparam grid_type Inferred type of the input grid. * @tparam grid_type Template type of the input grid.
* @param grid Input OpenFPM grid. * @param grid Input OpenFPM grid.
* @return Double variable that contains the minimum value of property \p Prop in \p grid. * @return Minimum value of property \p Prop in \p grid.
*/ */
template <size_t Prop, typename grid_type> template <size_t Prop, typename grid_type>
auto get_min_val(grid_type & grid) auto get_min_val(grid_type & grid)
...@@ -257,7 +257,7 @@ auto get_min_val(grid_type & grid) ...@@ -257,7 +257,7 @@ auto get_min_val(grid_type & grid)
* *
* @tparam Prop_in Index of property that contains the value whose sign should be determined. * @tparam Prop_in Index of property that contains the value whose sign should be determined.
* @tparam Prop_out Index of property where the sign should be written to. * @tparam Prop_out Index of property where the sign should be written to.
* @tparam grid_type Inferred type of the input grid. * @tparam grid_type Template type of the input grid.
* @param grid Input OpenFPM grid. * @param grid Input OpenFPM grid.
*/ */
template <size_t Prop_in, size_t Prop_out, typename grid_type> template <size_t Prop_in, size_t Prop_out, typename grid_type>
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
/**@brief Class for getting the narrow band around the interface /**@brief Class for getting the narrow band around the interface
* @file NarrowBand.hpp * @file NarrowBand.hpp
* @class NarrowBand * @class NarrowBand
* @tparam grid_in_type Inferred type of input grid that stores the signed distance function Phi_SDF. * @tparam grid_in_type Template type of input grid that stores the signed distance function Phi_SDF.
*/ */
template <typename grid_in_type, typename phi_type> template <typename grid_in_type, typename phi_type>
class NarrowBand class NarrowBand
...@@ -115,8 +115,8 @@ public: ...@@ -115,8 +115,8 @@ public:
* *
* @tparam Phi_SDF_grid Index of property storing the signed distance function in the input grid. * @tparam Phi_SDF_grid Index of property storing the signed distance function in the input grid.
* @tparam Phi_SDF_vd Index of property that should store the SDF in the narrow band particle vector. * @tparam Phi_SDF_vd Index of property that should store the SDF in the narrow band particle vector.
* @tparam vector_type Inferred type of the particle vector. * @tparam vector_type Template type of the particle vector.
* @tparam grid_type Inferred type of the grid storing the SDF. * @tparam grid_type Template type of the grid storing the SDF.
* *
* @param grid Grid of arb. dims. storing the SDF (result of redistancing). * @param grid Grid of arb. dims. storing the SDF (result of redistancing).
* @param vd Empty vector with same spatial scaling (box) as the grid. * @param vd Empty vector with same spatial scaling (box) as the grid.
...@@ -149,8 +149,8 @@ public: ...@@ -149,8 +149,8 @@ public:
* @tparam Phi_SDF_grid Index of property storing the signed distance function in the input grid. * @tparam Phi_SDF_grid Index of property storing the signed distance function in the input grid.
* @tparam Phi_SDF_vd Index of property that should store the SDF in the narrow band particle vector. * @tparam Phi_SDF_vd Index of property that should store the SDF in the narrow band particle vector.
* @tparam Phi_grad Index of property that should store the gradient of phi in the narrow band particle vector. * @tparam Phi_grad Index of property that should store the gradient of phi in the narrow band particle vector.
* @tparam vector_type Inferred type of the particle vector. * @tparam vector_type Template type of the particle vector.
* @tparam grid_type Inferred type of the grid storing the SDF. * @tparam grid_type Template type of the grid storing the SDF.
* *
* @param grid Grid of arb. dims. storing the SDF (result of redistancing). * @param grid Grid of arb. dims. storing the SDF (result of redistancing).
* @param vd Empty vector with same spatial scaling (box) as the grid. * @param vd Empty vector with same spatial scaling (box) as the grid.
...@@ -186,8 +186,8 @@ public: ...@@ -186,8 +186,8 @@ public:
* @tparam Phi_SDF_vd Index of property that should store the SDF in the narrow band particle vector. * @tparam Phi_SDF_vd Index of property that should store the SDF in the narrow band particle vector.
* @tparam Phi_grad Index of property that should store the gradient of phi in the narrow band particle vector. * @tparam Phi_grad Index of property that should store the gradient of phi in the narrow band particle vector.
* @tparam Phi_magnOfGrad Index of property that should store the gradient magnitude of Phi. * @tparam Phi_magnOfGrad Index of property that should store the gradient magnitude of Phi.
* @tparam vector_type Inferred type of the particle vector. * @tparam vector_type Template type of the particle vector.
* @tparam grid_type Inferred type of the grid storing the SDF. * @tparam grid_type Template type of the grid storing the SDF.
* *
* @param grid Grid of arb. dims. storing the SDF (result of redistancing). * @param grid Grid of arb. dims. storing the SDF (result of redistancing).
* @param vd Empty vector with same spatial scaling (box) as the grid. * @param vd Empty vector with same spatial scaling (box) as the grid.
...@@ -225,8 +225,8 @@ public: ...@@ -225,8 +225,8 @@ public:
* be a scalar). * be a scalar).
* @tparam Prop1_vd Index of particle property, where grid property should be copied to (prop. value must be a * @tparam Prop1_vd Index of particle property, where grid property should be copied to (prop. value must be a
* scalar). * scalar).
* @tparam vector_type Inferred type of the particle vector. * @tparam vector_type Template type of the particle vector.
* @tparam grid_type Inferred type of the grid storing the SDF. * @tparam grid_type Template type of the grid storing the SDF.
* *
* @param grid Grid of arb. dims. storing the SDF (result of redistancing) and any arbitrary other (scalar) * @param grid Grid of arb. dims. storing the SDF (result of redistancing) and any arbitrary other (scalar)
* property. * property.
...@@ -263,8 +263,8 @@ public: ...@@ -263,8 +263,8 @@ public:
* @tparam Index1Vd Index of 1st scalar property on particle to which value from grid should be copied to. * @tparam Index1Vd Index of 1st scalar property on particle to which value from grid should be copied to.
* @tparam Index2Vd Index of 2nd scalar property on particle to which value from grid should be copied to. * @tparam Index2Vd Index of 2nd scalar property on particle to which value from grid should be copied to.
* @tparam Index3Vd Index of 3rd scalar property on particle to which value from grid should be copied to. * @tparam Index3Vd Index of 3rd scalar property on particle to which value from grid should be copied to.
* @tparam vector_type Inferred type of the particle vector. * @tparam vector_type Template type of the particle vector.
* @tparam grid_type Inferred type of the grid storing the SDF. * @tparam grid_type Template type of the grid storing the SDF.
* *
* @param grid Grid of arb. dims. storing the SDF (result of redistancing) and any arbitrary other (scalar) * @param grid Grid of arb. dims. storing the SDF (result of redistancing) and any arbitrary other (scalar)
* property. * property.
...@@ -360,10 +360,12 @@ private: ...@@ -360,10 +360,12 @@ private:
} }
/**@brief Checks if a value for Phi_SDF lays within the narrow band. /**@brief Checks if a value for Phi_SDF lays within the narrow band.
* *
* @tparam T Template type of parameter Phi.
* @param Phi Value of the signed distance function Phi_SDF. * @param Phi Value of the signed distance function Phi_SDF.
* @return True, if point lays within the narrow band; False if not. * @return True, if point lays within the narrow band; False if not.
*/ */
bool within_narrow_band(double Phi) template<typename T>
bool within_narrow_band(T Phi)
{ {
return (Phi >= b_low && Phi <= b_up); return (Phi >= b_low && Phi <= b_up);
} }
......
...@@ -156,7 +156,7 @@ struct DistFromSol ...@@ -156,7 +156,7 @@ struct DistFromSol
/**@brief Class for reinitializing a level-set function into a signed distance function using Sussman redistancing. /**@brief Class for reinitializing a level-set function into a signed distance function using Sussman redistancing.
* @file RedistancingSussman.hpp * @file RedistancingSussman.hpp
* @class RedistancingSussman * @class RedistancingSussman
* @tparam grid_in_type Inferred type of input grid, which stores the initial level-set function Phi_0. * @tparam grid_in_type Template type of input grid, which stores the initial level-set function Phi_0.
*/ */
template <typename grid_in_type, typename phi_type> template <typename grid_in_type, typename phi_type>
class RedistancingSussman class RedistancingSussman
......
...@@ -12,13 +12,13 @@ bool AlmostEqualRelativeAndAbs(T A, T B, ...@@ -12,13 +12,13 @@ bool AlmostEqualRelativeAndAbs(T A, T B,
{ {
// Check if the numbers are really close -- needed // Check if the numbers are really close -- needed
// when comparing numbers near zero. // when comparing numbers near zero.
float diff = fabs(A - B); T diff = fabs(A - B);
if (diff <= maxDiff) if (diff <= maxDiff)
return true; return true;
A = fabs(A); A = fabs(A);
B = fabs(B); B = fabs(B);
float largest = (B > A) ? B : A; T largest = (B > A) ? B : A;
if (diff <= largest * maxRelDiff) if (diff <= largest * maxRelDiff)
return true; return true;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* @file AnalyticalSDF.hpp * @file AnalyticalSDF.hpp
* *
* @brief Header file containing functions that compute the analytical solution of the signed distance function (SDF) * @brief Header file containing functions that compute the analytical solution of the signed distance function (SDF)
* for a 3D sphere and a 2D circle of defined radius on a grid. * for a 3D sphere and a 2D disk of defined radius on a grid.
* *
* @author Justina Stark * @author Justina Stark
* @date October 2020 * @date October 2020
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
#define ANALYTICAL_SDF_HPP #define ANALYTICAL_SDF_HPP
#include <iostream> #include <iostream>
#include "Vector/vector_dist.hpp"
#include "Grid/grid_dist_id.hpp"
/**@brief Computes the analytical signed distance function of a sphere for a given point in space. /**@brief Computes the analytical signed distance function of a sphere for a given point in space.
* *
* @details At the center of the sphere, \a &phi;_SDF_analytic = \a Radius. Moving outwards from the center on, the * @details At the center of the sphere, \a &phi;_SDF_analytic = \a Radius. Moving outwards from the center on, the
...@@ -30,13 +33,13 @@ ...@@ -30,13 +33,13 @@
* @f[ \phi_{SDF}(x, y, z) = R - \sqrt{((x-a)^2 + (y-b)^2 + (z-c)^2)} @f] * @f[ \phi_{SDF}(x, y, z) = R - \sqrt{((x-a)^2 + (y-b)^2 + (z-c)^2)} @f]
* *
* @tparam point_type Template type of OpenFPM Point<dimension, type>. * @tparam point_type Template type of OpenFPM Point<dimension, type>.
* @tparam radius_type Template type of radius. * @tparam space_type Template type of radius.
* @param coords Point_type coordinates of point. * @param coords Point_type coordinates of point.
* @param radius Radius_type radius of the sphere. * @param radius Space_type radius of the sphere.
* @param center_x Double x-coordinate of sphere center. * @param center_x Space_type x-coordinate of sphere center.
* @param center_y Double y-coordinate of sphere center. * @param center_y Space_type y-coordinate of sphere center.
* @param center_z Double z-coordinate of sphere center. * @param center_z Space_type z-coordinate of sphere center.
* @return Double variable that contains the exact solution for the signed distance function of a given point in a * @return Space_type variable that contains the exact solution for the signed distance function of a given point in a
* sphere of given radius, where the SDF has positive values inside and negative values outside the sphere. * sphere of given radius, where the SDF has positive values inside and negative values outside the sphere.
*/ */
template <typename point_type, typename space_type> template <typename point_type, typename space_type>
...@@ -61,13 +64,13 @@ space_type get_analytic_sdf_sphere(point_type coords, space_type radius, ...@@ -61,13 +64,13 @@ space_type get_analytic_sdf_sphere(point_type coords, space_type radius,
* @details Solves the exact SDF for each grid nodes and writes the solution to a given property. * @details Solves the exact SDF for each grid nodes and writes the solution to a given property.
* *
* @tparam SDF_exact Index of property where the anaytical solution for the SDF should be written to. * @tparam SDF_exact Index of property where the anaytical solution for the SDF should be written to.
* @tparam grid_type Inferred type of the input grid. * @tparam grid_type Template type of the input grid.
* @tparam radius_type Inferred type of radius the sphere is supposed to have. * @tparam space_type Template type of radius the sphere is supposed to have.
* @param grid Input OpenFPM grid. * @param grid Input OpenFPM grid.
* @param radius Radius of the filled sphere. * @param radius Radius of the filled sphere.
* @param center_x Double x-coordinate of sphere center. * @param center_x Space_type x-coordinate of sphere center.
* @param center_y Double y-coordinate of sphere center. * @param center_y Space_type y-coordinate of sphere center.
* @param center_z Double z-coordinate of sphere center. * @param center_z Space_type z-coordinate of sphere center.
*/ */
template <size_t SDF_exact, typename grid_type, typename space_type> template <size_t SDF_exact, typename grid_type, typename space_type>
...@@ -100,13 +103,13 @@ void init_analytic_sdf_sphere(grid_type & grid, space_type radius, space_type ce ...@@ -100,13 +103,13 @@ void init_analytic_sdf_sphere(grid_type & grid, space_type radius, space_type ce
* @f[ \phi_{SDF}(x, y, z) = R - \sqrt{((x-a)^2 + (y-b)^2 + (z-c)^2)} @f] * @f[ \phi_{SDF}(x, y, z) = R - \sqrt{((x-a)^2 + (y-b)^2 + (z-c)^2)} @f]
* *
* @tparam point_type Template type of OpenFPM Point<dimension, type>. * @tparam point_type Template type of OpenFPM Point<dimension, type>.
* @tparam radius_type Template type of radius. * @tparam space_type Template type of radius.
* @param coords Point_type coordinates of point. * @param coords Point_type coordinates of point.
* @param radius Radius_type radius of the sphere. * @param radius Space_type radius of the sphere.
* @param center_x Double x-coordinate of sphere center. * @param center_x Space_type x-coordinate of sphere center.
* @param center_y Double y-coordinate of sphere center. * @param center_y Space_type y-coordinate of sphere center.
* @param center_z Double z-coordinate of sphere center. * @param center_z Space_type z-coordinate of sphere center.
* @return Double variable that contains the exact solution for the signed distance function of a given point in a * @return Space_type variable that contains the exact solution for the signed distance function of a given point in a
* sphere of given radius, where the SDF has positive values inside and negative values outside the sphere. * sphere of given radius, where the SDF has positive values inside and negative values outside the sphere.
*/ */
template <typename point_type, typename space_type> template <typename point_type, typename space_type>
...@@ -130,9 +133,8 @@ space_type get_analytic_sdf_circle(point_type coords, space_type radius, ...@@ -130,9 +133,8 @@ space_type get_analytic_sdf_circle(point_type coords, space_type radius,
* @details Solves the exact SDF for each grid nodes and writes the solution to a given property. * @details Solves the exact SDF for each grid nodes and writes the solution to a given property.
* *
* @tparam SDF_exact Index of property where the anaytical solution for the SDF should be written to. * @tparam SDF_exact Index of property where the anaytical solution for the SDF should be written to.
* @tparam grid_type Inferred type of the input grid. * @tparam grid_type Template type of the input grid.
* @tparam radius_type Inferred type of radius the circle is supposed to have. * @tparam space_type Template type of radius and center coordinates.
* @tparam center_type Inferred type of the center coordinates.
* @param grid Input OpenFPM grid. * @param grid Input OpenFPM grid.
* @param radius Radius of the filled circle. * @param radius Radius of the filled circle.
* @param center_x X-coordinate of the circle center. * @param center_x X-coordinate of the circle center.
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* @tparam PropNumeric Index of grid property that contains the numerical value. * @tparam PropNumeric Index of grid property that contains the numerical value.
* @tparam PropAnalytic Index of grid property that contains the analytical (exact) value. * @tparam PropAnalytic Index of grid property that contains the analytical (exact) value.
* @tparam Error Index of grid property where the computed error should be written to. * @tparam Error Index of grid property where the computed error should be written to.
* @tparam gridtype Inferred type of the input grid. * @tparam gridtype Template type of the input grid.
* @param grid Input OpenFPM grid. Can be of any dimension. * @param grid Input OpenFPM grid. Can be of any dimension.
*/ */
template <size_t PropNumeric, size_t PropAnalytic, size_t Error, typename gridtype> template <size_t PropNumeric, size_t PropAnalytic, size_t Error, typename gridtype>
...@@ -68,7 +68,7 @@ void get_absolute_error(gridtype & grid) ...@@ -68,7 +68,7 @@ void get_absolute_error(gridtype & grid)
* @tparam PropNumeric Index of grid property that contains the numerical value. * @tparam PropNumeric Index of grid property that contains the numerical value.
* @tparam PropAnalytic Index of grid property that contains the analytical (exact) value. * @tparam PropAnalytic Index of grid property that contains the analytical (exact) value.
* @tparam Error Index of grid property where the computed error should be written to. * @tparam Error Index of grid property where the computed error should be written to.
* @tparam gridtype Inferred type of the input grid. * @tparam gridtype Template type of the input grid.
* @param grid Input OpenFPM grid. Can be of any dimension. * @param grid Input OpenFPM grid. Can be of any dimension.
*/ */
template <size_t PropNumeric, size_t PropAnalytic, size_t Error, typename gridtype> template <size_t PropNumeric, size_t PropAnalytic, size_t Error, typename gridtype>
...@@ -95,27 +95,26 @@ void get_relative_error(gridtype & grid) ...@@ -95,27 +95,26 @@ void get_relative_error(gridtype & grid)
} }
} }
/**@brief Class for computing relative/absolute errors and l2/l_infinity norm for distributed grids and vectors /**@brief Class for computing the l2/l_infinity norm for distributed grids and vectors based on given errors.
* *
* @tparam lnorm_type Desired return type for l-norm. * @tparam lnorm_type Return type for l-norm.
*/ */
template <typename lnorm_type> template <typename lnorm_type>
class LNorms class LNorms
{ {
public: public:
LNorms(){}; LNorms() = default;
// Member variables // Member variables
lnorm_type l2; lnorm_type l2; // L2 norm
lnorm_type linf; lnorm_type linf; // L_infinity norm
// Member functions // Member functions
/**@brief Computes the L_2 and L_infinity norm on the basis of the precomputed error on a grid. /**@brief Computes the L_2 and L_infinity norm on the basis of the precomputed error on a grid.
* *
* @tparam Error Index of grid property that contains the error. * @tparam Error Index of grid property that contains the error.
* @tparam gridtype Inferred type of the input grid. * @tparam gridtype Template type of the input grid.
* @param grid Input OpenFPM grid. Can be of any dimension. * @param grid Input OpenFPM grid. Can be of any dimension.
* @return Object of type L_norms that contains #L_norms::l2 and #L_norms::linf. */
*/
template <size_t Error, typename gridtype> template <size_t Error, typename gridtype>
void get_l_norms_grid(gridtype & grid) void get_l_norms_grid(gridtype & grid)
{ {
...@@ -140,13 +139,12 @@ public: ...@@ -140,13 +139,12 @@ public:
l2 = (lnorm_type) sqrt( sumErrorSq / (error_type)grid.size()); l2 = (lnorm_type) sqrt( sumErrorSq / (error_type)grid.size());
linf = (lnorm_type) maxError; linf = (lnorm_type) maxError;
} }
/**@brief Computes the L_2 and L_infinity norm on the basis of the precomputed error on a particle vector. /**@brief Computes the L_2 and L_infinity norm on the basis of the precomputed error on a particle vector.
* *
* @tparam Error Index of grid property that contains the error. * @tparam Error Index of grid property that contains the error.
* @tparam vectortype Inferred type of the input particle vector. * @tparam vectortype Template type of the input particle vector.
* @param vd Input particle vector. * @param vd Input particle vector.
* @return Object of type L_norms that contains #L_norms::l2 and #L_norms::linf. */
*/
template <size_t Error, typename vectortype> template <size_t Error, typename vectortype>
void get_l_norms_vector(vectortype & vd) void get_l_norms_vector(vectortype & vd)
{ {
...@@ -173,16 +171,18 @@ public: ...@@ -173,16 +171,18 @@ public:
l2 = (lnorm_type) sqrt( sumErrorSq / (error_type)count); l2 = (lnorm_type) sqrt( sumErrorSq / (error_type)count);
linf = (lnorm_type) maxError; linf = (lnorm_type) maxError;
} }
/**@brief Writes the N (number of grid points on a square grid) and L-norms as strings to a csv-file. /**@brief Writes the N (number of grid points on a square grid) and L-norms as strings to a csv-file.