47 std::vector<int>
const& vec_fracture_mat_IDs,
48 std::vector<std::vector<MeshLib::Node*>>
const& vec_vec_fracture_nodes,
49 std::vector<std::vector<MeshLib::Element*>>
const&
50 vec_vec_fracture_matrix_elements,
51 std::vector<std::pair<std::size_t, std::vector<int>>>
const&
52 vec_branch_nodeID_matIDs,
53 std::vector<std::pair<std::size_t, std::vector<int>>>
const&
54 vec_junction_nodeID_matIDs)
61 OGS_FATAL(
"The given mesh does not have relevant properties");
65 std::vector<MeshLib::Node*> new_nodes(
67 std::vector<MeshLib::Element*> new_eles(
71 for (
auto const& vec_fracture_nodes : vec_vec_fracture_nodes)
73 for (
auto const* org_node : vec_fracture_nodes)
75 auto duplicated_node =
77 new_nodes.push_back(duplicated_node);
79 duplicated_node->getID());
83 for (
auto const& entry : vec_junction_nodeID_matIDs)
85 auto* org_node = org_mesh.
getNode(entry.first);
86 auto duplicated_node =
88 new_nodes.push_back(duplicated_node);
90 duplicated_node->getID());
94 for (
unsigned fracture_id = 0;
95 fracture_id < vec_vec_fracture_matrix_elements.size();
98 auto const frac_matid = vec_fracture_mat_IDs[fracture_id];
99 auto const& vec_fracture_matrix_elements =
100 vec_vec_fracture_matrix_elements[fracture_id];
101 auto const& vec_fracture_nodes = vec_vec_fracture_nodes[fracture_id];
103 "levelset" + std::to_string(fracture_id + 1));
104 for (
auto const* org_e : vec_fracture_matrix_elements)
112 auto const eid = org_e->getID();
114 if ((*prop_levelset)[eid] <= 0)
123 const auto node_id = getNodeIndex(*e, i);
124 if (!includesNodeID(vec_fracture_nodes, node_id))
135 const auto& dup_newNodeIDs = itr->second;
138 unsigned new_node_id = 0;
139 if (dup_newNodeIDs.size() == 1)
142 new_node_id = dup_newNodeIDs[0];
144 else if (dup_newNodeIDs.size() == 2)
147 const auto& br_matids = getMaterialIdsForNode(
148 vec_branch_nodeID_matIDs, node_id);
150 br_matids, frac_matid);
152 auto const frac2_id =
154 assert(frac2_id != std::numeric_limits<std::size_t>::max());
155 auto prop_levelset2 =
157 "levelset" + std::to_string(frac2_id + 1));
159 if ((*prop_levelset2)[eid] <= 0)
169 assert(pos != std::numeric_limits<std::size_t>::max());
170 new_node_id = dup_newNodeIDs[pos];
175 const auto& jct_matids = getMaterialIdsForNode(
176 vec_junction_nodeID_matIDs, node_id);
178 jct_matids, frac_matid);
180 auto const frac2_id =
182 assert(frac2_id != std::numeric_limits<std::size_t>::max());
183 auto prop_levelset2 =
185 "levelset" + std::to_string(frac2_id + 1));
188 if ((*prop_levelset2)[eid] <= 0)
193 assert(pos != std::numeric_limits<std::size_t>::max());
194 new_node_id = dup_newNodeIDs[pos];
199 new_node_id = dup_newNodeIDs.back();
204 e->
setNode(i, new_nodes[new_node_id]);
211 new_nodes, new_eles);
220 else if (
auto const* p =
225 else if (
auto const* p =
230 else if (
auto const* p =
235 else if (
auto const* p =
240 else if (
auto const* p =
246 else if (
auto const* p =
252 else if (
auto const* p =
258 else if (
auto const* p =
264 else if (
auto const* p =
272 "Mesh property '{:s}' of unhandled data type '{:s}'. Please "
273 "check the data type of the mesh properties. The available "
281 "\n\t unsigned long,"
282 "\n\t unsigned long long,"
284 property->getPropertyName(),
285 typeid(*property).name());
289 vec_junction_nodeID_matIDs.size());
333 if (destination_property ==
nullptr)
343 auto const n_dest_comp =
348 auto last = std::copy_n(&source_property[i * n_src_comp],
350 &(*destination_property)[i * n_dest_comp]);
352 std::fill_n(last, n_dest_comp - n_src_comp, T{0});
357 for (
unsigned k = 0; k < itr.second.size(); k++)
360 &(*destination_property)[itr.first * n_dest_comp],
362 &(*destination_property)[itr.second[k] * n_dest_comp]);
368 assert(source_property.
size() == destination_property->
size());
369 std::copy(source_property.begin(), source_property.end(),
370 destination_property->begin());
375 "Property '{:s}' values cannot be copied because its mesh item "
376 "type '{:s}' is not supported. Unexpected error, because the "
377 "destination property was created.",
383 unsigned const n_junctions)
385 auto const& u = *
_output_mesh->getProperties().getPropertyVector<
double>(
387 auto const n_u_comp = u.getNumberOfGlobalComponents();
388 assert(u.size() ==
_output_mesh->getNodes().size() * 3);
390 *
_output_mesh->getProperties().createNewPropertyVector<
double>(
392 total_u.resize(u.size());
393 std::copy(cbegin(u), cend(u), begin(total_u));
395 for (
unsigned enrich_id = 0; enrich_id < n_fractures + n_junctions;
399 std::vector<double> nodal_levelset(
401 std::numeric_limits<double>::quiet_NaN());
403 auto const& ele_levelset =
404 *
_output_mesh->getProperties().getPropertyVector<
double>(
405 "levelset" + std::to_string(enrich_id + 1));
412 const double e_levelset = ele_levelset[e->getID()];
414 for (
unsigned i = 0; i < e->getNumberOfNodes(); i++)
416 nodal_levelset[getNodeIndex(*e, i)] = e_levelset;
422 *
_output_mesh->getProperties().getPropertyVector<
double>(
423 "displacement_jump" + std::to_string(enrich_id + 1));
424 for (
unsigned i = 0; i <
_output_mesh->getNodes().size(); i++)
426 for (
int j = 0; j < n_u_comp; j++)
428 total_u[i * n_u_comp + j] +=
429 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)