peclet-dem 1.1.0
Performance-portable XPBD Discrete Element Method (Kokkos + ArborX)
Loading...
Searching...
No Matches
dem_bindings_checks.hpp File Reference

Input validation of the peclet.dem Python binding (src/dem_bindings.cpp only). More...

#include <array>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <stdexcept>
#include <string>
#include <tuple>
#include <vector>
#include "narrowphase.hpp"

Go to the source code of this file.

Namespaces

namespace  peclet
namespace  peclet::dem
namespace  peclet::dem::binding_checks

Typedefs

using peclet::dem::binding_checks::F3Arg = std::array<float, 3>
 A triple: any sequence of three floats (tuple, list, (3,) array).

Functions

std::string peclet::dem::binding_checks::num (double v)
void peclet::dem::binding_checks::require (bool ok, const char *who, const std::string &name, const std::string &rule, double v)
void peclet::dem::binding_checks::finite (const char *who, const std::string &name, double v, const char *dim)
void peclet::dem::binding_checks::positive (const char *who, const std::string &name, double v, const char *dim)
void peclet::dem::binding_checks::nonneg (const char *who, const std::string &name, double v, const char *dim)
void peclet::dem::binding_checks::restitutionCoef (const char *who, const char *name, double v)
 A restitution coefficient: [0, 1], dimensionless.
void peclet::dem::binding_checks::poissonRatio (const char *who, const char *name, double v)
 An isotropic solid's Poisson ratio: (-1, 0.5], dimensionless.
std::string peclet::dem::binding_checks::component (const char *name, std::size_t i)
 Per-component forms for a triple (or a quaternion): the parameter is named name[i].
template<class T, std::size_t N>
void peclet::dem::binding_checks::finiteEach (const char *who, const char *name, const std::array< T, N > &a, const char *dim)
template<class T, std::size_t N>
void peclet::dem::binding_checks::positiveEach (const char *who, const char *name, const std::array< T, N > &a, const char *dim)
template<class T, std::size_t N>
void peclet::dem::binding_checks::nonnegEach (const char *who, const char *name, const std::array< T, N > &a, const char *dim)
void peclet::dem::binding_checks::count (const char *who, const std::string &name, std::int64_t v, std::int64_t lo)
 A count (capacity, iterations, samples per axis): an integer >= lo.
void peclet::dem::binding_checks::sampleCounts (const char *who, int rx, int ry, int rz)
 A reconstruction grid's samples per axis (get_sdf_grid / export_sdf): each >= 1.
void peclet::dem::binding_checks::sdfShapeArgs (const char *who, const F3Arg &origin, const F3Arg &spacing, const F3Arg &inv_inertia, float bounding_radius)
 The shared arguments of set_sdf_shape / add_sdf_shape.
void peclet::dem::binding_checks::domainCorners (const F3Arg &mn, const F3Arg &mx)
 set_domain(min, max): finite corners, max > min on every axis.
void peclet::dem::binding_checks::plane (const F3Arg &p, const F3Arg &n)
 add_plane: a finite point and a finite, non-zero normal.
void peclet::dem::binding_checks::mpiBox (const std::tuple< double, double, double > &origin, const std::tuple< double, double, double > &extent, const std::tuple< long, long, long > &cells)
 init_mpi's global box: finite origin, positive extent, at least one ORB cell per axis.
void peclet::dem::binding_checks::materialIds (const std::vector< int > &ids)

Variables

constexpr int peclet::dem::binding_checks::kMaxMaterialId = peclet::dem::kMaxMaterials - 1
 Material ids index the 8-entry pair tables (narrowphase.hpp kMaxMaterials).

Detailed Description

Input validation of the peclet.dem Python binding (src/dem_bindings.cpp only).

The C++ API (sim.hpp) is internal and trusts its caller; the public setters refuse a NaN/Inf or a physically inadmissible value at the binding, as ValueError (std::invalid_argument), before it reaches the solver. A valid value takes exactly the path it took before. The message names the setter, the parameter, the admissible range with its dimension (dem works in the caller's consistent units) and the offending value. Binding-only: no solver header includes this.

Definition in file dem_bindings_checks.hpp.