NetDEM v1.0
Loading...
Searching...
No Matches
solver_ann_pw.hpp
Go to the documentation of this file.
1#pragma once
2
6#include "general_net.hpp"
7#include "particle.hpp"
8#include "regression_net.hpp"
9#include "shape.hpp"
10#include "wall.hpp"
11#include <string>
12
13namespace netdem {
27public:
30
33
40
50 SolverANNPW(Particle *const p, Wall *const w);
51
59 CollisionSolverPW *Clone() const override;
60
73 void Init(std::string const &classifier_file,
74 std::string const &regressor_file);
75
84 void Init(Particle *const p, Wall *const w) override;
85
94 bool Detect() override;
95
105 void ResolveInit(ContactPW *const cnt, double timestep) override;
106
116 void ResolveUpdate(ContactPW *const cnt, double timestep) override;
117
128 void ResolveInit_LinearSpring(CollisionGeometries *const cnt_geoms,
129 double timestep);
130
142 double timestep);
143
154 void ResolveInit_VolumeBased(CollisionGeometries *const cnt_geoms,
155 double timestep);
156
168 double timestep);
169
181 double timestep);
182
194 double timestep);
195
207 std::tuple<double, Vec3d> GetPotential(Vec3d const &pos, Vec4d const &quat);
208
217 std::tuple<Vec3d, Vec3d, Vec3d> EvaluateContactForces();
218
219private:
221 Shape *shape_1{nullptr};
222
224 Shape *shape_2{nullptr};
225
227 double bound_sphere_radius_1;
228
230 double bound_sphere_radius_2;
231
233 double scale;
234
236 Vec3d dpos_12;
237
239 Vec3d dpos_12_ref;
240
242 Vec4d dquat_12;
243};
244
245} // namespace netdem
A class representing the geometries associated with a collision.
Definition collision_geometries.hpp:15
An abstract class representing a collision solver for a particle and a wall.
Definition collision_solver_pw.hpp:20
A class representing a contact between a particle and a wall.
Definition contact_pw.hpp:22
A class representing a general neural network.
Definition general_net.hpp:19
Definition particle.hpp:26
A class that represents a feedforward neural network for regression.
Definition regression_net.hpp:21
This class represents different types of shapes and performs various calculations on them.
Definition shape.hpp:15
A class that represents a collision solver between two particles using artificial neural networks.
Definition solver_ann_pw.hpp:26
netdem::GeneralNet classifier
The neural network model used for classification.
Definition solver_ann_pw.hpp:29
CollisionSolverPW * Clone() const override
Creates a copy of the SolverANNPW object.
Definition solver_ann_pw.cpp:13
void ResolveUpdate(ContactPW *const cnt, double timestep) override
Resolves the collision during update time.
Definition solver_ann_pw.cpp:93
void ResolveInit_LinearSpring(CollisionGeometries *const cnt_geoms, double timestep)
Resolves the collision using a linear spring model at initialization time.
Definition solver_ann_pw.cpp:109
std::tuple< double, Vec3d > GetPotential(Vec3d const &pos, Vec4d const &quat)
Calculates the potential energy and contact position for the collision.
Definition solver_ann_pw.cpp:269
std::tuple< Vec3d, Vec3d, Vec3d > EvaluateContactForces()
Evaluates the contact forces for the collision.
Definition solver_ann_pw.cpp:291
void Init(std::string const &classifier_file, std::string const &regressor_file)
Initializes the collision solver with neural network models from disk.
void ResolveInit_VolumeBased(CollisionGeometries *const cnt_geoms, double timestep)
Resolves the collision using a volume-based method at initialization time.
Definition solver_ann_pw.cpp:165
netdem::RegressionNet regressor
The neural network model used for regression.
Definition solver_ann_pw.hpp:32
bool Detect() override
Detects collisions between the two particles.
Definition solver_ann_pw.cpp:39
void ResolveUpdate_PotentialBased(CollisionGeometries *const cnt_geoms, double timestep)
Resolves the collision using a potential-based method during update time.
Definition solver_ann_pw.cpp:246
void ResolveUpdate_VolumeBased(CollisionGeometries *const cnt_geoms, double timestep)
Resolves the collision using a volume-based method during update time.
Definition solver_ann_pw.cpp:194
void ResolveInit_PotentialBased(CollisionGeometries *const cnt_geoms, double timestep)
Resolves the collision using a potential-based method at initialization time.
Definition solver_ann_pw.cpp:225
void ResolveInit(ContactPW *const cnt, double timestep) override
Resolves the collision at initialization time.
Definition solver_ann_pw.cpp:73
void ResolveUpdate_LinearSpring(CollisionGeometries *const cnt_geoms, double timestep)
Resolves the collision using a linear spring model during update time.
Definition solver_ann_pw.cpp:136
SolverANNPW()
Default constructor for the SolverANNPW class.
Definition solver_ann_pw.cpp:9
A class representing a wall object in a physics simulation.
Definition wall.hpp:32
Definition bond_entry.hpp:7
pos
Definition json_serilization.hpp:19
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18
std::array< double, 4 > Vec4d
Definition utils_macros.hpp:19