PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
geometry Namespace Reference

Collection of methods and data related to geometry. More...

Data Structures

class  Fracture
 A class for fracture state of bonds. More...
 

Functions

void computeNonlocalNeighborhood (const std::vector< util::Point > &nodes, double horizon, std::vector< std::vector< size_t > > &nodeNeighs)
 Partitions the nodes based on node neighborlist supplied. Function first creates a graph with nodes as vertices and edges given by node neighbors. Then the metis function is called to partition the graph into specified number of parts.
 

Detailed Description

Collection of methods and data related to geometry.

Function Documentation

◆ computeNonlocalNeighborhood()

void geometry::computeNonlocalNeighborhood ( const std::vector< util::Point > &  nodes,
double  horizon,
std::vector< std::vector< size_t > > &  nodeNeighs 
)

Partitions the nodes based on node neighborlist supplied. Function first creates a graph with nodes as vertices and edges given by node neighbors. Then the metis function is called to partition the graph into specified number of parts.

Parameters
nodesNodal coordinates
horizonNonlocal radius
nodeNeighsNeighborlist of nodes

Definition at line 17 of file geometryUtil.cpp.

19 {
20 nodeNeighs.resize(nodes.size());
21
22 auto nsearch_p = std::make_unique<NSearch>(nodes);
23 double set_tree_time = nsearch_p->updatePointCloud(nodes, true);
24 set_tree_time += nsearch_p->setInputCloud();
25 std::cout << fmt::format("Tree setup time (ms) = {}. \n", set_tree_time);
26
27 for (size_t i=0; i<nodes.size(); i++) {
28 std::vector<size_t> neighs;
29 std::vector<double> sqr_dist;
30 nodeNeighs[i].resize(0);
31
32 if (nsearch_p->radiusSearch(nodes[i], horizon, neighs, sqr_dist) > 0) {
33 for (std::size_t j = 0; j < neighs.size(); ++j)
34 if (neighs[j] != i) {
35 nodeNeighs[i].push_back(neighs[j]);
36 }
37 }
38 }
39}

Referenced by test::testGraphPartitioning(), and test::testMPI().

Here is the caller graph for this function: