61 for (
auto operation : r_operations)
69 switch (operation.GetOperation())
72 case EDGE_OPERATION_ADD:
73 case EDGE_OPERATION_NODE_MERGE:
74 case EDGE_OPERATION_SPLIT:
75 case EDGE_OPERATION_MERGE:
77 const unsigned stored_index = operation.GetElementIndex();
78 unsigned location_index = stored_index;
84 if (operation.IsElementIndexRemapped())
87 if (rElementMap.
IsDeleted(location_index))
95 location_index = rElementMap.
GetNewIndex(stored_index);
99 const EdgeRemapInfo& r_edge_change = operation.rGetRemapInfo();
100 CellPtr p_cell = mpCellPopulation->GetCellUsingLocationIndex(location_index);
101 auto p_old_model =
static_cast<CellSrnModel*
>(p_cell->GetSrnModel());
102 std::vector<AbstractSrnModelPtr> old_srn_edges = p_old_model->
GetEdges();
103 RemapCellSrn(old_srn_edges, p_old_model, r_edge_change);
104 old_srn_edges.clear();
107 case EDGE_OPERATION_DIVIDE:
109 const unsigned location_index_1 = rElementMap.
GetNewIndex(operation.GetElementIndex());
110 const unsigned location_index_2 = rElementMap.
GetNewIndex(operation.GetElementIndex2());
112 const EdgeRemapInfo& r_edge_change_1 = operation.rGetRemapInfo();
113 const EdgeRemapInfo& r_edge_change_2 = operation.rGetRemapInfo2();
115 CellPtr p_cell_1 = mpCellPopulation->GetCellUsingLocationIndex(location_index_1);
116 CellPtr p_cell_2 = mpCellPopulation->GetCellUsingLocationIndex(location_index_2);
118 auto p_old_model_1 =
static_cast<CellSrnModel*
>(p_cell_1->GetSrnModel());
119 std::vector<AbstractSrnModelPtr> parent_srn_edges = p_old_model_1->
GetEdges();
120 auto p_old_model_2 =
static_cast<CellSrnModel*
>(p_cell_2->GetSrnModel());
122 RemapCellSrn(parent_srn_edges, p_old_model_1, r_edge_change_1);
123 RemapCellSrn(parent_srn_edges, p_old_model_2, r_edge_change_2);
124 parent_srn_edges.clear();
129 mpCellPopulation->rGetMesh().GetOperationRecorder()->ClearEdgeOperations();
138 std::vector<AbstractSrnModelPtr> new_edge_srn(edge_mapping.size());
140 const unsigned num_edges = edge_mapping.size();
141 std::vector<unsigned> shrunk_edges;
147 for (
unsigned i = 0; i < num_edges; i++)
150 const long remap_index = edge_mapping[i];
165 assert(!((remap_status == 0 || remap_status == 1) && remap_index < 0));
171 new_edge_srn[i] = boost::shared_ptr<AbstractSrnModel>(parentSrnEdges[remap_index]->CreateSrnModel());
181 new_edge_srn[i] = boost::shared_ptr<AbstractSrnModel>(parentSrnEdges[remap_index]->CreateSrnModel());
182 assert(split_proportions[i] >= 0);
183 new_edge_srn[i]->SplitEdgeSrn(split_proportions[i]);
189 new_edge_srn[i] = boost::shared_ptr<AbstractSrnModel>(parentSrnEdges[0]->CreateSrnModel());
190 new_edge_srn[i]->SetCell(pCellSrn->
GetCell());
191 new_edge_srn[i]->InitialiseDaughterCell();
197 new_edge_srn[i] = boost::shared_ptr<AbstractSrnModel>(parentSrnEdges[remap_index]->CreateSrnModel());
199 const bool is_prev_edge = rEdgeChange.
GetEdgesStatus()[(i+1)%num_edges]==3;
202 unsigned shrunk_edge = 0;
207 shrunk_edge = (remap_index+1)%(num_edges+1);
208 shrunk_edges.push_back(shrunk_edge);
212 shrunk_edge = remap_index==0 ? num_edges : remap_index-1;
214 new_edge_srn[i]->AddShrunkEdgeSrn(parentSrnEdges[shrunk_edge].get());
220 new_edge_srn[i] = boost::shared_ptr<AbstractSrnModel>(parentSrnEdges[remap_index]->CreateSrnModel());
221 const unsigned next_edge_index = (remap_index+1)%(num_edges+1);
222 new_edge_srn[i]->AddMergedEdgeSrn(parentSrnEdges[next_edge_index].get());
227 new_edge_srn[i]->SetEdgeLocalIndex(i);
228 new_edge_srn[i]->SetCell(pCellSrn->
GetCell());
232 auto p_interior_srn = boost::shared_ptr<AbstractSrnModel>(pCellSrn->
GetInteriorSrn());
233 if (p_interior_srn !=
nullptr)
235 for (
unsigned shrunk_edge_index : shrunk_edges)
237 p_interior_srn->AddShrunkEdgeToInterior(parentSrnEdges[shrunk_edge_index].get());