PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
anonymous_namespace{prenotch.cpp} Namespace Reference

Functions

template<typename Predicate >
std::size_t breakBondsIf (geometry::Fracture &fracture, const std::vector< util::Point > &xRef, const std::vector< std::vector< std::size_t > > &neighbors, const std::vector< std::size_t > &nodeParticleId, std::size_t particleId, Predicate crosses)
 

Function Documentation

◆ breakBondsIf()

template<typename Predicate >
std::size_t anonymous_namespace{prenotch.cpp}::breakBondsIf ( geometry::Fracture &  fracture,
const std::vector< util::Point > &  xRef,
const std::vector< std::vector< std::size_t > > &  neighbors,
const std::vector< std::size_t > &  nodeParticleId,
std::size_t  particleId,
Predicate  crosses 
)

Breaks the bonds of one particle for which the predicate is true.

Definition at line 19 of file prenotch.cpp.

23 {
24 if (neighbors.size() > xRef.size() ||
25 nodeParticleId.size() < neighbors.size())
26 throw std::invalid_argument(
27 "prenotch: node arrays are inconsistent with the neighbour list");
28
29 std::size_t broken = 0;
30 for (std::size_t i = 0; i < neighbors.size(); ++i) {
31 if (nodeParticleId[i] != particleId)
32 continue;
33 const auto &xi = xRef[i];
34 for (std::size_t k = 0; k < neighbors[i].size(); ++k) {
35 const std::size_t j = neighbors[i][k];
36 if (j >= nodeParticleId.size() || nodeParticleId[j] != particleId)
37 continue;
38 const auto &xj = xRef[j];
39 if (crosses(xi.d_x, xi.d_y, xj.d_x, xj.d_y)) {
40 fracture.setBondState(i, k, true);
41 ++broken;
42 }
43 }
44 }
45 return broken;
46}
void setBondState(const std::size_t &i, const std::size_t &j, const bool &state)
Sets the bond state.
Definition fracture.cpp:51

References geometry::Fracture::setBondState().

Here is the call graph for this function: