MPS-Basic
Loading...
Searching...
No Matches
SurfaceDetector::Distribution Class Reference

Detects free surface based on number density and assists evaluation by particle distribution. More...

#include <distribution.hpp>

Inheritance diagram for SurfaceDetector::Distribution:
Collaboration diagram for SurfaceDetector::Distribution:

Public Member Functions

bool isFreeSurface (const Particles &particles, const Particle &particle) override
 Whether the particle is on the free surface.
 
 ~Distribution () override
 
 Distribution (double n0, double particleDistance, double distributionThresholdRatio, double numberDensityThresholdRatio)
 
- Public Member Functions inherited from SurfaceDetector::Interface
virtual ~Interface ()=default
 

Private Member Functions

bool mainDetection (const Particles &particles, const Particle &particle)
 Main detection based on number density.
 
bool subDetection (const Particles &particles, const Particle &particle)
 Sub detection based on particle distribution.
 

Private Attributes

double n0
 Reference value for number density.
 
double particleDistance
 Particle distance.
 
double distributionThresholdRatio
 Threshold ratio for particle distribution.
 
double numberDensityThresholdRatio
 Threshold ratio for number density.
 

Detailed Description

Detects free surface based on number density and assists evaluation by particle distribution.

Proposed by Khayyer et al. (2009). A supplementary judgment based on particle distribution is added to the judgment based on number density. Even if a particle is determined to be a surface particle by number density, it is not considered a surface particle if there is no bias in the arrangement of the particles.

Definition at line 12 of file distribution.hpp.

Constructor & Destructor Documentation

◆ ~Distribution()

Distribution::~Distribution ( )
override

Definition at line 67 of file distribution.cpp.

67 {
68}

◆ Distribution()

Distribution::Distribution ( double n0,
double particleDistance,
double distributionThresholdRatio,
double numberDensityThresholdRatio )

Definition at line 60 of file distribution.cpp.

65}
double distributionThresholdRatio
Threshold ratio for particle distribution.
double particleDistance
Particle distance.
double numberDensityThresholdRatio
Threshold ratio for number density.
double n0
Reference value for number density.

Member Function Documentation

◆ isFreeSurface()

bool Distribution::isFreeSurface ( const Particles & particles,
const Particle & particle )
overridevirtual

Whether the particle is on the free surface.

Parameters
particlesparticles
particleparticle inside the particles
Returns
Whether the particle is on the free surface

Implements SurfaceDetector::Interface.

Definition at line 7 of file distribution.cpp.

7 {
8 // main: surface, sub: surface -> surface (true)
9 // main: surface, sub: inner -> inner (false)
10 // main: inner, sub: surface -> inner (false)
11 // main: inner, sub: inner -> inner (false)
12 if (mainDetection(particles, particle)) {
13 return subDetection(particles, particle);
14 } else {
15 return false;
16 }
17}
bool mainDetection(const Particles &particles, const Particle &particle)
Main detection based on number density.
bool subDetection(const Particles &particles, const Particle &particle)
Sub detection based on particle distribution.
Here is the call graph for this function:

◆ mainDetection()

bool Distribution::mainDetection ( const Particles & particles,
const Particle & particle )
private

Main detection based on number density.

Returns
true if the particle is considered to be a free surface

Definition at line 23 of file distribution.cpp.

23 {
25}
double numberDensity
number density of the particle
Definition particle.hpp:59
Here is the caller graph for this function:

◆ subDetection()

bool Distribution::subDetection ( const Particles & particles,
const Particle & particle )
private

Sub detection based on particle distribution.

Returns
true if the particle is considered to be a free surface

Definition at line 31 of file distribution.cpp.

31 {
32 if (particle.neighbors.empty()) {
33 // If the particle has no neighbors, it is considered to be a free surface.
34 return true;
35 }
36
37 Eigen::Vector3d rij_sum = Eigen::Vector3d::Zero();
38 for (auto& neighbor : particle.neighbors) {
39 auto& pj = particles[neighbor.id];
40
41 rij_sum += pj.position - particle.position;
42 }
43
45
46 if (abs(rij_sum.x()) > threshold) {
47 return true;
48
49 } else if (abs(rij_sum.y()) > threshold) {
50 return true;
51
52 } else if (abs(rij_sum.z()) > threshold) {
53 return true;
54
55 } else {
56 return false;
57 }
58}
Eigen::Vector3d position
position of the particle
Definition particle.hpp:55
std::vector< Neighbor > neighbors
neighbors of the particle
Definition particle.hpp:66
Here is the caller graph for this function:

Member Data Documentation

◆ n0

double SurfaceDetector::Distribution::n0
private

Reference value for number density.

Definition at line 22 of file distribution.hpp.

◆ particleDistance

double SurfaceDetector::Distribution::particleDistance
private

Particle distance.

Definition at line 23 of file distribution.hpp.

◆ distributionThresholdRatio

double SurfaceDetector::Distribution::distributionThresholdRatio
private

Threshold ratio for particle distribution.

Definition at line 24 of file distribution.hpp.

◆ numberDensityThresholdRatio

double SurfaceDetector::Distribution::numberDensityThresholdRatio
private

Threshold ratio for number density.

Definition at line 25 of file distribution.hpp.


The documentation for this class was generated from the following files: