42 std::vector<int>
const& vec_fracture_mat_IDs,
43 std::vector<std::vector<MeshLib::Node*>>
const& vec_vec_fracture_nodes,
44 std::vector<std::vector<MeshLib::Element*>>
const&
45 vec_vec_fracture_matrix_elements,
46 std::vector<std::pair<std::size_t, std::vector<int>>>
const&
47 vec_branch_nodeID_matIDs,
48 std::vector<std::pair<std::size_t, std::vector<int>>>
const&
49 vec_junction_nodeID_matIDs)
56 OGS_FATAL(
"The given mesh does not have relevant properties");
60 std::vector<MeshLib::Node*> new_nodes(
62 std::vector<MeshLib::Element*> new_eles(
66 for (
auto const& vec_fracture_nodes : vec_vec_fracture_nodes)
68 for (
auto const* org_node : vec_fracture_nodes)
70 auto duplicated_node =
72 new_nodes.push_back(duplicated_node);
74 duplicated_node->getID());
78 for (
auto const& entry : vec_junction_nodeID_matIDs)
80 auto* org_node = org_mesh.
getNode(entry.first);
81 auto duplicated_node =
83 new_nodes.push_back(duplicated_node);
85 duplicated_node->getID());
89 for (
unsigned fracture_id = 0;
90 fracture_id < vec_vec_fracture_matrix_elements.size();
93 auto const frac_matid = vec_fracture_mat_IDs[fracture_id];
94 auto const& vec_fracture_matrix_elements =
95 vec_vec_fracture_matrix_elements[fracture_id];
96 auto const& vec_fracture_nodes = vec_vec_fracture_nodes[fracture_id];
98 "levelset" + std::to_string(fracture_id + 1));
99 for (
auto const* org_e : vec_fracture_matrix_elements)
107 auto const eid = org_e->getID();
109 if ((*prop_levelset)[eid] <= 0)
118 const auto node_id = getNodeIndex(*e, i);
119 if (!includesNodeID(vec_fracture_nodes, node_id))
130 const auto& dup_newNodeIDs = itr->second;
133 unsigned new_node_id = 0;
134 if (dup_newNodeIDs.size() == 1)
137 new_node_id = dup_newNodeIDs[0];
139 else if (dup_newNodeIDs.size() == 2)
142 const auto& br_matids = getMaterialIdsForNode(
143 vec_branch_nodeID_matIDs, node_id);
145 br_matids, frac_matid);
147 auto const frac2_id =
149 assert(frac2_id != std::numeric_limits<std::size_t>::max());
150 auto prop_levelset2 =
152 "levelset" + std::to_string(frac2_id + 1));
154 if ((*prop_levelset2)[eid] <= 0)
164 assert(pos != std::numeric_limits<std::size_t>::max());
165 new_node_id = dup_newNodeIDs[pos];
170 const auto& jct_matids = getMaterialIdsForNode(
171 vec_junction_nodeID_matIDs, node_id);
173 jct_matids, frac_matid);
175 auto const frac2_id =
177 assert(frac2_id != std::numeric_limits<std::size_t>::max());
178 auto prop_levelset2 =
180 "levelset" + std::to_string(frac2_id + 1));
183 if ((*prop_levelset2)[eid] <= 0)
188 assert(pos != std::numeric_limits<std::size_t>::max());
189 new_node_id = dup_newNodeIDs[pos];
194 new_node_id = dup_newNodeIDs.back();
199 e->
setNode(i, new_nodes[new_node_id]);
206 new_nodes, new_eles);
208 for (
auto [name, property] :
_org_mesh.getProperties())
215 else if (
auto const* p =
220 else if (
auto const* p =
225 else if (
auto const* p =
230 else if (
auto const* p =
235 else if (
auto const* p =
241 else if (
auto const* p =
247 else if (
auto const* p =
253 else if (
auto const* p =
259 else if (
auto const* p =
267 "Mesh property '{:s}' of unhandled data type '{:s}'. Please "
268 "check the data type of the mesh properties. The available "
276 "\n\t unsigned long,"
277 "\n\t unsigned long long,"
279 property->getPropertyName(),
284 vec_junction_nodeID_matIDs.size());
328 if (destination_property ==
nullptr)
338 auto const n_dest_comp =
341 for (
unsigned i = 0; i <
_org_mesh.getNumberOfNodes(); i++)
343 auto last = std::copy_n(&source_property[i * n_src_comp],
345 &(*destination_property)[i * n_dest_comp]);
347 std::fill_n(last, n_dest_comp - n_src_comp, T{0});
352 for (
unsigned k = 0; k < itr.second.size(); k++)
355 &(*destination_property)[itr.first * n_dest_comp],
357 &(*destination_property)[itr.second[k] * n_dest_comp]);
363 assert(source_property.
size() == destination_property->
size());
364 std::copy(source_property.
begin(), source_property.
end(),
365 destination_property->
begin());
370 "Property '{:s}' values cannot be copied because its mesh item "
371 "type '{:s}' is not supported. Unexpected error, because the "
372 "destination property was created.",
378 unsigned const n_junctions)
380 auto const& u = *
_output_mesh->getProperties().getPropertyVector<
double>(
382 auto const n_u_comp = u.getNumberOfGlobalComponents();
383 assert(u.size() ==
_output_mesh->getNodes().size() * 3);
385 *
_output_mesh->getProperties().createNewPropertyVector<
double>(
387 total_u.resize(u.size());
388 ranges::copy(u, total_u.begin());
390 for (
unsigned enrich_id = 0; enrich_id < n_fractures + n_junctions;
394 std::vector<double> nodal_levelset(
396 std::numeric_limits<double>::quiet_NaN());
398 auto const& ele_levelset =
399 *
_output_mesh->getProperties().getPropertyVector<
double>(
400 "levelset" + std::to_string(enrich_id + 1));
407 const double e_levelset = ele_levelset[e->getID()];
409 for (
unsigned i = 0; i < e->getNumberOfNodes(); i++)
411 nodal_levelset[getNodeIndex(*e, i)] = e_levelset;
417 *
_output_mesh->getProperties().getPropertyVector<
double>(
418 "displacement_jump" + std::to_string(enrich_id + 1));
419 for (
unsigned i = 0; i <
_output_mesh->getNodes().size(); i++)
421 for (
int j = 0; j < n_u_comp; j++)
423 total_u[i * n_u_comp + j] +=
424 nodal_levelset[i] * g[i * n_u_comp + j];
PostProcessTool(MeshLib::Mesh const &org_mesh, std::vector< int > const &vec_fracture_mat_IDs, std::vector< std::vector< MeshLib::Node * > > const &vec_vec_fracture_nodes, std::vector< std::vector< MeshLib::Element * > > const &vec_vec_fracture_matrix_elements, std::vector< std::pair< std::size_t, std::vector< int > > > const &vec_branch_nodeID_matIDs, std::vector< std::pair< std::size_t, std::vector< int > > > const &vec_junction_nodeID_matIDs)
bool includesNodeID(std::vector< MeshLib::Node * > const &vec_nodes, std::size_t node_id)
std::vector< int > const & getMaterialIdsForNode(std::vector< std::pair< std::size_t, std::vector< int > > > const &vec_nodeID_matIDs, std::size_t nodeID)