38 NodeInserter::NodeInserter()
39 : m_mesh(nullptr), m_target_node_distance(0.0), m_yielding_threshold(0.0)
44 : m_mesh(nullptr), m_target_node_distance(0.0), m_yielding_threshold(0.0)
53 assert( cd.
Check() &&
"CoreData not ok.");
55 m_mesh = m_cd.m_mesh.get();
57 m_target_node_distance = m_cd.m_parameters->get<
double>(
"cell_mechanics.target_node_distance");
58 m_yielding_threshold = m_cd.m_parameters->get<
double>(
"cell_mechanics.yielding_threshold");
61 const string here = string(VL_HERE) +
" exception:\n";
66 void NodeInserter::InsertNode(
Edge& edge)
72 auto new_node = m_mesh->BuildNode(pos, m_mesh->
IsAtBoundary(&edge));
74 new_node->SetSam(new_node->IsAtBoundary() &&
77 UpdateNeighbors(edge, new_node);
83 unsigned int insert_count = 0U;
84 const auto& walls = m_mesh->
GetWalls();
86 for (
const auto& wall : walls) {
87 if ( wall->GetC1()->IsFixed() || wall->GetC2()->IsFixed()) {
90 vector<Edge> edges = wall->GetEdges();
91 for (
auto edge : edges) {
93 if (l > m_yielding_threshold * m_target_node_distance) {
103 void NodeInserter::UpdateNeighbors(
Edge& edge,
Node* new_node)
105 list<NeighborNodes> owners;
117 copy(owners_first.begin(), owners_first.end(), back_inserter(owners));
119 copy(owners_second.begin(), owners_second.end(), back_inserter(owners));
123 auto c = owners.begin();
124 while (c != owners.end()) {
125 c = adjacent_find(c, owners.end(), eql);
127 if (c != owners.end()) {
136 while (c != owners.end()) {
137 c = adjacent_find(c, owners.end(), eql);
139 if (!c->GetCell()->IsBoundaryPolygon()) {
void Initialize(const CoreData &cd)
Initializes based on values in property tree.
Core data with mesh, parameters, random engine and time data.
bool IsAtBoundary(const Edge *e) const
True iff the edge is on the mesh boundary.
std::list< Wall * > & GetNodeOwningWalls(Node *n)
The walls that contain the given node somewhere on the wall.
Cell * GetCell() const
Return the cell of this Neighbor pair.
Namespace for miscellaneous utilities.
NodeInserter()
Straight initialization of empty object.
Extremely simple Exception root class.
Namespace for the core simulator.
void ConstructNeighborList(Cell *cell)
Constructs neighbor list by looping over walls and registering adjoining cell for that wall...
An Edge connects two nodes and is ambidextrous.
Macro defs for debug and logging.
Structure of neighboring nodes: two neighboring nodes from standpoint of a given cell with an orderin...
void AddNodeToCell(Cell *c, Node *n, Node *nb1, Node *nb2)
Add node to cell between existing neighbor nodes.
Node * GetFirst() const
Get the first node of the edge.
Sim, the actual simulator.
int GetIndex() const
Return the index.
std::list< NeighborNodes > & GetNodeOwningNeighbors(Node *n)
Get the neighbors associated with this node.
unsigned int InsertNodes()
Insert nodes in those edges that have been stretched.
Interface for NodeInserter.
Header file for Exception class.
Wall * FindWall(const Edge &edge) const
Find the wall including the edge.
const std::vector< Wall * > & GetWalls() const
The walls of this mesh.
A cell wall, runs between cell corner points and consists of wall elements.
bool Check() const
Verify all pointers non-null.
Node * GetSecond() const
Get the second node of the edge.