19 #include <unordered_map>
35 :
id(id_),
x(x_),
y(y_),
z(z_)
57 OGS_FATAL(
"Mesh items other than nodes and cells are not supported.");
61 std::ostream& os, std::vector<std::size_t>
const& global_node_ids)
const
63 std::vector<NodeStruct> nodes_buffer;
64 nodes_buffer.reserve(
nodes.size());
66 for (
const auto* node :
nodes)
68 double const* coords = node->getCoords();
69 nodes_buffer.emplace_back(global_node_ids[node->getID()], coords[0],
70 coords[1], coords[2]);
72 return os.write(
reinterpret_cast<const char*
>(nodes_buffer.data()),
81 std::vector<const MeshLib::Element*>
const& elements)
83 return 3 * elements.size() +
84 std::accumulate(begin(elements), end(elements), 0,
85 [](
auto const nnodes,
auto const* e)
86 {
return nnodes + e->getNumberOfNodes(); });
92 static_cast<long>(
nodes.size()),
106 return os.write(
reinterpret_cast<const char*
>(data),
sizeof(data));
111 std::vector<std::size_t>
const* node_id_mapping =
nullptr)
113 return node_id_mapping ? (*node_id_mapping)[node.
getID()] : node.
getID();
118 std::vector<std::size_t>
const& partition_ids,
119 std::vector<std::size_t>
const* node_id_mapping =
nullptr)
124 return partition_ids[node_id(node)];
134 std::pair<std::vector<MeshLib::Node*>, std::vector<MeshLib::Node*>>
136 std::size_t
const part_id,
137 const bool is_mixed_high_order_linear_elems,
138 std::vector<MeshLib::Node*>
const& nodes,
139 std::vector<std::size_t>
const& partition_ids,
141 std::vector<std::size_t>
const* node_id_mapping =
nullptr)
144 std::vector<MeshLib::Node*> partition_nodes;
145 copy_if(begin(nodes), end(nodes), std::back_inserter(partition_nodes),
152 std::vector<MeshLib::Node*> base_nodes;
153 base_nodes.reserve(partition_nodes.size() /
156 std::vector<MeshLib::Node*> higher_order_nodes;
157 higher_order_nodes.reserve(
158 partition_nodes.size() /
164 begin(partition_nodes), end(partition_nodes),
165 std::back_inserter(base_nodes), std::back_inserter(higher_order_nodes),
168 return !is_mixed_high_order_linear_elems ||
172 return {base_nodes, higher_order_nodes};
177 std::vector<std::size_t>
const& partition_ids,
178 std::vector<std::size_t>
const* node_id_mapping =
nullptr)
182 return partitionLookup(*n, partition_ids,
183 node_id_mapping) == part_id;
191 std::tuple<std::vector<MeshLib::Element const*>,
192 std::vector<MeshLib::Element const*>>
194 std::size_t
const part_id,
195 std::vector<MeshLib::Element*>
const& elements,
196 std::vector<std::size_t>
const& partition_ids,
197 std::vector<std::size_t>
const* node_id_mapping =
nullptr)
199 std::vector<MeshLib::Element const*> regular_elements;
200 std::vector<MeshLib::Element const*> ghost_elements;
202 for (
auto elem : elements)
205 *elem, part_id, partition_ids, node_id_mapping);
207 if (regular_nodes == 0)
213 static_cast<std::ptrdiff_t
>(elem->getNumberOfNodes()))
215 regular_elements.push_back(elem);
219 ghost_elements.push_back(elem);
222 return std::tuple<std::vector<MeshLib::Element const*>,
223 std::vector<MeshLib::Element const*>>{regular_elements,
231 std::tuple<std::vector<MeshLib::Node*>, std::vector<MeshLib::Node*>>
233 std::size_t
const part_id,
234 const bool is_mixed_high_order_linear_elems,
235 std::vector<MeshLib::Node*>
const& nodes,
236 std::vector<MeshLib::Element const*>
const& ghost_elements,
237 std::vector<std::size_t>
const& partition_ids,
239 std::vector<std::size_t>
const* node_id_mapping =
nullptr)
241 std::vector<MeshLib::Node*> base_nodes;
242 std::vector<MeshLib::Node*> ghost_nodes;
244 std::vector<bool> is_ghost_node(nodes.size(),
false);
245 for (
const auto* ghost_elem : ghost_elements)
247 for (
unsigned i = 0; i < ghost_elem->getNumberOfNodes(); i++)
249 auto const& n = ghost_elem->getNode(i);
250 if (is_ghost_node[n->getID()])
257 if (!is_mixed_high_order_linear_elems ||
260 base_nodes.push_back(nodes[n->getID()]);
264 ghost_nodes.push_back(nodes[n->getID()]);
266 is_ghost_node[n->getID()] =
true;
270 return std::tuple<std::vector<MeshLib::Node*>, std::vector<MeshLib::Node*>>{
271 base_nodes, ghost_nodes};
275 std::size_t
const part_id,
const bool is_mixed_high_order_linear_elems)
278 std::vector<MeshLib::Node*> higher_order_regular_nodes;
279 std::tie(partition.nodes, higher_order_regular_nodes) =
284 partition.number_of_regular_base_nodes = partition.nodes.size();
285 partition.number_of_regular_nodes = partition.number_of_regular_base_nodes +
286 higher_order_regular_nodes.size();
288 std::tie(partition.regular_elements, partition.ghost_elements) =
291 std::vector<MeshLib::Node*> base_ghost_nodes;
292 std::vector<MeshLib::Node*> higher_order_ghost_nodes;
293 std::tie(base_ghost_nodes, higher_order_ghost_nodes) =
295 _mesh->getNodes(), partition.ghost_elements,
298 std::copy(begin(base_ghost_nodes), end(base_ghost_nodes),
299 std::back_inserter(partition.nodes));
301 partition.number_of_base_nodes = partition.nodes.size();
303 if (is_mixed_high_order_linear_elems)
305 std::copy(begin(higher_order_regular_nodes),
306 end(higher_order_regular_nodes),
307 std::back_inserter(partition.nodes));
308 std::copy(begin(higher_order_ghost_nodes),
309 end(higher_order_ghost_nodes),
310 std::back_inserter(partition.nodes));
314 partition.number_of_mesh_base_nodes =
_mesh->getNumberOfBaseNodes();
315 partition.number_of_mesh_all_nodes =
_mesh->getNumberOfNodes();
320 template <
typename T>
323 std::size_t
const offset,
327 auto const& nodes = p.nodes;
328 auto const nnodes = nodes.size();
330 for (std::size_t i = 0; i < nnodes; ++i)
332 const auto global_id = nodes[i]->getID();
333 std::copy_n(&pv[n_components * global_id], n_components,
334 &partitioned_pv[offset + n_components * i]);
336 return n_components * nnodes;
342 template <
typename T>
345 std::size_t
const offset,
349 std::size_t
const n_regular(p.regular_elements.size());
351 for (std::size_t i = 0; i < n_regular; ++i)
353 const auto id = p.regular_elements[i]->getID();
354 std::copy_n(&pv[n_components *
id], n_components,
355 &partitioned_pv[offset + n_components * i]);
358 std::size_t
const n_ghost(p.ghost_elements.size());
359 for (std::size_t i = 0; i < n_ghost; ++i)
361 const auto id = p.ghost_elements[i]->getID();
362 std::copy_n(&pv[n_components *
id], n_components,
363 &partitioned_pv[offset + n_components * (n_regular + i)]);
365 return n_components * (n_regular + n_ghost);
368 template <
typename T>
371 std::vector<Partition>
const& partitions,
373 std::map<MeshLib::MeshItemType, std::size_t>
const& total_number_of_tuples)
391 partitioned_pv->resize(total_number_of_tuples.at(item_type) *
394 auto copy_property_vector_values =
395 [&](
Partition const& p, std::size_t offset)
408 "Copying of property vector values for mesh item type {:s} is not "
413 std::size_t position_offset(0);
414 for (
auto p : partitions)
416 position_offset += copy_property_vector_values(p, position_offset);
426 template <
typename Function>
429 for (
auto [
name, property] : properties)
436 bool success = f(
double{}, property) || f(
float{}, property) ||
437 f(
int{}, property) || f(
long{}, property) ||
438 f(
unsigned{}, property) || f(
long{}, property) ||
439 f(
static_cast<unsigned long>(0), property) ||
440 f(std::size_t{}, property) || f(
char{}, property) ||
441 f(
static_cast<unsigned char>(0), property);
444 OGS_FATAL(
"Could not apply function to PropertyVector '{:s}'.",
445 property->getPropertyName());
451 std::vector<Partition>
const& partitions,
452 std::size_t
const total_number_of_cells)
454 auto* vtk_ghost_type =
457 if (vtk_ghost_type ==
nullptr)
459 OGS_FATAL(
"Could not create vtkGhostType cell data array.");
462 vtk_ghost_type->resize(total_number_of_cells);
463 std::size_t offset = 0;
464 for (
auto const& partition : partitions)
466 offset += partition.regular_elements.size();
467 for (std::size_t i = 0; i < partition.ghost_elements.size(); ++i)
469 if (partition.duplicate_ghost_cell[i])
471 (*vtk_ghost_type)[offset + i] |=
472 vtkDataSetAttributes::DUPLICATECELL;
475 offset += partition.ghost_elements.size();
482 std::vector<Partition>
const& partitions)
488 auto count_tuples = [&](
MeshItemType const mesh_item_type)
490 return std::accumulate(
491 begin(partitions), end(partitions), 0,
492 [&](std::size_t
const sum,
Partition const& p)
493 {
return sum + p.numberOfMeshItems(mesh_item_type); });
495 std::map<MeshItemType, std::size_t>
const total_number_of_tuples = {
496 {MeshItemType::Cell, count_tuples(MeshItemType::Cell)},
497 {MeshItemType::Node, count_tuples(MeshItemType::Node)}};
500 "total number of tuples after partitioning defined for cells is {:d} "
501 "and for nodes {:d}.",
502 total_number_of_tuples.at(MeshItemType::Cell),
503 total_number_of_tuples.at(MeshItemType::Node));
510 [&](
auto type,
auto const property)
512 return copyPropertyVector<decltype(type)>(
513 partitioned_properties, partitions,
515 total_number_of_tuples);
520 total_number_of_tuples.at(MeshItemType::Cell));
522 return partitioned_properties;
526 std::vector<Partition>& partitions)
528 std::vector<bool> cell_visited(mesh.
getElements().size(),
false);
530 for (
auto& partition : partitions)
532 partition.duplicate_ghost_cell.resize(partition.ghost_elements.size(),
535 for (std::size_t i = 0; i < partition.ghost_elements.size(); i++)
537 const auto& ghost_element = *partition.ghost_elements[i];
538 if (!cell_visited[ghost_element.getID()])
540 cell_visited[ghost_element.getID()] =
true;
541 partition.duplicate_ghost_cell[i] =
false;
548 const bool is_mixed_high_order_linear_elems)
550 for (std::size_t part_id = 0; part_id <
_partitions.size(); part_id++)
552 INFO(
"Processing partition: {:d}", part_id);
566 std::vector<Partition>
const& local_partitions)
const
568 if (bulk_node_ids_pv ==
nullptr)
573 auto& bulk_node_ids = *bulk_node_ids_pv;
575 std::size_t offset = 0;
577 assert(
_partitions.size() == local_partitions.size());
578 int const n_partitions =
static_cast<int>(
_partitions.size());
579 for (
int partition_id = 0; partition_id < n_partitions; ++partition_id)
581 auto const& bulk_partition =
_partitions[partition_id];
582 auto const& local_partition = local_partitions[partition_id];
585 auto const& bulk_nodes = bulk_partition.nodes;
586 auto const n_bulk_nodes = bulk_nodes.size();
587 std::map<std::size_t, std::size_t> global_to_local;
588 for (std::size_t local_node_id = 0; local_node_id < n_bulk_nodes;
591 global_to_local[bulk_nodes[local_node_id]->getID()] = local_node_id;
594 auto const& local_nodes = local_partition.nodes;
595 auto const n_local_nodes = local_nodes.size();
596 for (std::size_t local_node_id = 0; local_node_id < n_local_nodes;
599 bulk_node_ids[offset + local_node_id] =
600 global_to_local[bulk_node_ids[offset + local_node_id]];
602 offset += n_local_nodes;
608 std::vector<Partition>
const& local_partitions)
const
610 if (bulk_element_ids_pv ==
nullptr)
615 auto& bulk_element_ids = *bulk_element_ids_pv;
617 std::size_t offset = 0;
619 assert(
_partitions.size() == local_partitions.size());
620 int const n_partitions =
static_cast<int>(
_partitions.size());
621 for (
int partition_id = 0; partition_id < n_partitions; ++partition_id)
623 auto const& bulk_partition =
_partitions[partition_id];
624 auto const& local_partition = local_partitions[partition_id];
627 std::map<std::size_t, std::size_t> global_to_local;
630 std::vector<MeshLib::Element const*>
const& elements,
631 std::size_t
const offset)
633 auto const n_elements = elements.size();
634 for (std::size_t e = 0; e < n_elements; ++e)
636 global_to_local[elements[e]->getID()] = offset + e;
640 map_elements(bulk_partition.regular_elements, 0);
641 map_elements(bulk_partition.ghost_elements,
642 bulk_partition.regular_elements.size());
645 auto renumber_elements =
646 [&bulk_element_ids, &global_to_local](
647 std::vector<MeshLib::Element const*>
const& elements,
648 std::size_t
const offset)
650 auto const n_elements = elements.size();
651 for (std::size_t e = 0; e < n_elements; ++e)
653 bulk_element_ids[offset + e] =
654 global_to_local[bulk_element_ids[offset + e]];
659 offset += renumber_elements(local_partition.regular_elements, offset);
660 offset += renumber_elements(local_partition.ghost_elements, offset);
666 bool const is_mixed_high_order_linear_elems)
const
668 auto const& bulk_node_ids =
672 std::vector<Partition> partitions(
_partitions.size());
673 for (std::size_t part_id = 0; part_id <
_partitions.size(); part_id++)
675 auto& partition = partitions[part_id];
676 INFO(
"Processing partition: {:d}", part_id);
681 std::vector<MeshLib::Node*> higher_order_regular_nodes;
682 std::tie(partition.nodes, higher_order_regular_nodes) =
684 part_id, is_mixed_high_order_linear_elems,
mesh.
getNodes(),
687 partition.number_of_regular_base_nodes = partition.nodes.size();
688 partition.number_of_regular_nodes =
689 partition.number_of_regular_base_nodes +
690 higher_order_regular_nodes.size();
692 std::tie(partition.regular_elements, partition.ghost_elements) =
696 std::vector<MeshLib::Node*> base_ghost_nodes;
697 std::vector<MeshLib::Node*> higher_order_ghost_nodes;
698 std::tie(base_ghost_nodes, higher_order_ghost_nodes) =
704 std::copy(begin(base_ghost_nodes), end(base_ghost_nodes),
705 std::back_inserter(partition.nodes));
707 partition.number_of_base_nodes = partition.nodes.size();
709 if (is_mixed_high_order_linear_elems)
711 std::copy(begin(higher_order_regular_nodes),
712 end(higher_order_regular_nodes),
713 std::back_inserter(partition.nodes));
714 std::copy(begin(higher_order_ghost_nodes),
715 end(higher_order_ghost_nodes),
716 std::back_inserter(partition.nodes));
725 const bool is_mixed_high_order_linear_elems)
727 std::size_t node_global_id_offset = 0;
732 for (std::size_t i = 0; i < partition.number_of_regular_base_nodes; i++)
735 node_global_id_offset;
736 node_global_id_offset++;
740 if (!is_mixed_high_order_linear_elems)
748 const std::size_t end_id = partition.number_of_base_nodes +
749 partition.number_of_regular_nodes -
750 partition.number_of_regular_base_nodes;
751 for (std::size_t i = partition.number_of_base_nodes; i < end_id; i++)
754 node_global_id_offset;
755 node_global_id_offset++;
760 template <
typename T>
764 os.write(
reinterpret_cast<const char*
>(pv.data()), pv.
size() *
sizeof(T));
767 template <
typename T>
770 std::ostream& out_val, std::ostream& out_meta)
795 std::vector<Partition>
const& partitions,
799 partitioned_properties.
size(mesh_item_type);
805 auto const file_name_infix =
toString(mesh_item_type);
807 auto const file_name_cfg = file_name_base +
"_partitioned_" +
808 file_name_infix +
"_properties_cfg" +
809 std::to_string(partitions.size()) +
".bin";
810 std::ofstream out(file_name_cfg, std::ios::binary);
813 OGS_FATAL(
"Could not open file '{:s}' for output.", file_name_cfg);
816 auto const file_name_val = file_name_base +
"_partitioned_" +
817 file_name_infix +
"_properties_val" +
818 std::to_string(partitions.size()) +
".bin";
819 std::ofstream out_val(file_name_val, std::ios::binary);
822 OGS_FATAL(
"Could not open file '{:s}' for output.", file_name_val);
828 partitioned_properties,
829 [&](
auto type,
auto const& property)
831 return writePropertyVector<decltype(type)>(
834 mesh_item_type, out_val, out);
837 unsigned long offset = 0;
838 for (
const auto& partition : partitions)
841 offset,
static_cast<unsigned long>(
842 partition.numberOfMeshItems(mesh_item_type))};
844 "Write meta data for node-based PropertyVector: global offset "
845 "{:d}, number of tuples {:d}",
846 pvpmd.offset, pvpmd.number_of_tuples);
848 offset += pvpmd.number_of_tuples;
863 os.write(
reinterpret_cast<const char*
>(
this),
sizeof(
ConfigOffsets));
865 static long reserved = 0;
867 return os.write(
reinterpret_cast<const char*
>(&reserved),
sizeof(
long));
879 return {
static_cast<long>(partition.
nodes.size()),
911 const std::string& file_name_base, std::vector<Partition>
const& partitions)
913 auto const file_name_cfg = file_name_base +
"_partitioned_msh_cfg" +
914 std::to_string(partitions.size()) +
".bin";
915 std::ofstream of_bin_cfg(file_name_cfg, std::ios::binary);
918 OGS_FATAL(
"Could not open file '{:s}' for output.", file_name_cfg);
921 std::vector<long> partitions_element_offsets;
922 partitions_element_offsets.reserve(partitions.size());
923 std::vector<long> partitions_ghost_element_offsets;
924 partitions_ghost_element_offsets.reserve(partitions.size());
927 for (
const auto& partition : partitions)
936 partitions_element_offsets.push_back(
937 partition_offsets.regular_elements);
938 partitions_ghost_element_offsets.push_back(
939 partition_offsets.ghost_elements);
942 return std::make_tuple(partitions_element_offsets,
943 partitions_ghost_element_offsets);
955 const std::unordered_map<std::size_t, long>& local_node_ids,
956 std::vector<long>& elem_info,
959 constexpr
unsigned mat_id =
962 elem_info[counter++] = mat_id;
963 elem_info[counter++] =
static_cast<long>(elem.
getCellType());
964 elem_info[counter++] = nn;
966 for (
long i = 0; i < nn; i++)
968 auto const& n = *elem.
getNode(i);
969 elem_info[counter++] = local_node_ids.at(n.getID());
975 std::vector<MeshLib::Node*>
const& nodes)
977 std::unordered_map<std::size_t, long> local_ids;
978 local_ids.reserve(nodes.size());
980 long local_node_id = 0;
981 for (
const auto* node : nodes)
983 local_ids[node->getID()] = local_node_id++;
995 std::vector<Partition>
const& partitions,
996 std::vector<long>
const& regular_element_offsets,
997 std::vector<long>
const& ghost_element_offsets)
999 const std::string npartitions_str = std::to_string(partitions.size());
1001 auto const file_name_ele =
1002 file_name_base +
"_partitioned_msh_ele" + npartitions_str +
".bin";
1003 std::ofstream element_info_os(file_name_ele, std::ios::binary);
1004 if (!element_info_os)
1006 OGS_FATAL(
"Could not open file '{:s}' for output.", file_name_ele);
1009 auto const file_name_ele_g =
1010 file_name_base +
"_partitioned_msh_ele_g" + npartitions_str +
".bin";
1011 std::ofstream ghost_element_info_os(file_name_ele_g, std::ios::binary);
1012 if (!ghost_element_info_os)
1014 OGS_FATAL(
"Could not open file '{:s}' for output.", file_name_ele_g);
1017 for (std::size_t i = 0; i < partitions.size(); i++)
1019 const auto& partition = partitions[i];
1024 std::vector<long> ele_info(regular_element_offsets[i]);
1026 auto writeElementData =
1028 std::vector<MeshLib::Element const*>
const& elements,
1029 long const element_offsets,
1030 std::ofstream& output_stream)
1032 long counter = elements.size();
1033 std::vector<long> ele_info(element_offsets);
1035 for (std::size_t j = 0; j < elements.size(); j++)
1037 const auto* elem = elements[j];
1038 ele_info[j] = counter;
1043 output_stream.write(
reinterpret_cast<const char*
>(ele_info.data()),
1044 ele_info.size() *
sizeof(
long));
1048 writeElementData(partition.regular_elements, regular_element_offsets[i],
1051 writeElementData(partition.ghost_elements, ghost_element_offsets[i],
1052 ghost_element_info_os);
1061 std::vector<Partition>
const& partitions,
1062 std::vector<std::size_t>
const& global_node_ids)
1064 auto const file_name = file_name_base +
"_partitioned_msh_nod" +
1065 std::to_string(partitions.size()) +
".bin";
1066 std::ofstream os(file_name, std::ios::binary);
1069 OGS_FATAL(
"Could not open file '{:s}' for output.", file_name);
1072 for (
const auto& partition : partitions)
1074 partition.writeNodes(os, global_node_ids);
1087 const std::vector<IntegerType>& regular_element_offsets =
1088 std::get<0>(elements_offsets);
1089 const std::vector<IntegerType>& ghost_element_offsets =
1090 std::get<1>(elements_offsets);
1092 ghost_element_offsets);
1098 std::string
const& output_filename_base,
1099 std::vector<Partition>
const& partitions,
1104 const auto elem_integers =
1107 const std::vector<IntegerType>& num_elem_integers =
1108 std::get<0>(elem_integers);
1109 const std::vector<IntegerType>& num_g_elem_integers =
1110 std::get<1>(elem_integers);
1111 writeElements(output_filename_base, partitions, num_elem_integers,
1112 num_g_elem_integers);
1114 writeProperties(output_filename_base, partitioned_properties, partitions,
1116 writeProperties(output_filename_base, partitioned_properties, partitions,
void INFO(char const *fmt, Args const &... args)
void DBUG(char const *fmt, Args const &... args)
Declare a class to perform node wise mesh partitioning.
Helper tools for debugging.
Implementation of the VtuInterface class.
void processPartition(std::size_t const part_id, const bool is_mixed_high_order_linear_elems)
void renumberBulkElementIdsProperty(MeshLib::PropertyVector< std::size_t > *const bulk_element_ids_pv, std::vector< Partition > const &local_partitions) const
void partitionByMETIS(const bool is_mixed_high_order_linear_elems)
MeshLib::Mesh const & mesh() const
void write(const std::string &file_name_base)
void renumberBulkNodeIdsProperty(MeshLib::PropertyVector< std::size_t > *const bulk_node_ids, std::vector< Partition > const &local_partitions) const
std::unique_ptr< MeshLib::Mesh > _mesh
Pointer to a mesh object.
MeshLib::Properties _partitioned_properties
Properties where values at ghost nodes and extra nodes are inserted.
std::vector< Partition > partitionOtherMesh(MeshLib::Mesh const &mesh, bool const is_mixed_high_order_linear_elems) const
std::vector< std::size_t > _nodes_global_ids
Global IDs of all nodes after partitioning.
void renumberNodeIndices(const bool is_mixed_high_order_linear_elems)
std::vector< Partition > _partitions
Data for all partitions.
std::vector< std::size_t > _nodes_partition_ids
Partition IDs of each nodes.
void writeOtherMesh(std::string const &output_filename_base, std::vector< Partition > const &partitions, MeshLib::Properties const &partitioned_properties) const
std::size_t getID() const
virtual Node *const * getNodes() const =0
Get array of element nodes.
virtual CellType getCellType() const =0
virtual const Node * getNode(unsigned idx) const =0
virtual unsigned getNumberOfNodes() const =0
std::size_t getNumberOfBaseNodes() const
Get the number of base nodes.
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Properties & getProperties()
std::size_t getNumberOfNodes() const
Get the number of nodes.
std::vector< Element const * > const & getElementsConnectedToNode(std::size_t node_id) const
Property manager on mesh items. Class Properties manages scalar, vector or matrix properties....
std::map< std::string, PropertyVectorBase * >::size_type size() const
PropertyVector< T > const * getPropertyVector(std::string const &name) const
PropertyVector< T > * createNewPropertyVector(std::string const &name, MeshItemType mesh_item_type, std::size_t n_components=1)
std::string const & getPropertyName() const
MeshItemType getMeshItemType() const
int getNumberOfGlobalComponents() const
std::size_t getNumberOfTuples() const
std::function< bool(const double t, MappedConstVector< N > const &y, MappedVector< N > &ydot)> Function
std::size_t copyCellPropertyVectorValues(Partition const &p, std::size_t const offset, MeshLib::PropertyVector< T > const &pv, MeshLib::PropertyVector< T > &partitioned_pv)
void addVtkGhostTypeProperty(MeshLib::Properties &partitioned_properties, std::vector< Partition > const &partitions, std::size_t const total_number_of_cells)
bool writePropertyVector(MeshLib::PropertyVector< T > const *const pv, MeshLib::MeshItemType const mesh_item_type, std::ostream &out_val, std::ostream &out_meta)
std::ptrdiff_t numberOfRegularNodes(MeshLib::Element const &e, std::size_t const part_id, std::vector< std::size_t > const &partition_ids, std::vector< std::size_t > const *node_id_mapping=nullptr)
std::tuple< std::vector< MeshLib::Node * >, std::vector< MeshLib::Node * > > findGhostNodesInPartition(std::size_t const part_id, const bool is_mixed_high_order_linear_elems, std::vector< MeshLib::Node * > const &nodes, std::vector< MeshLib::Element const * > const &ghost_elements, std::vector< std::size_t > const &partition_ids, MeshLib::Mesh const &mesh, std::vector< std::size_t > const *node_id_mapping=nullptr)
MeshLib::Properties partitionProperties(MeshLib::Properties const &properties, std::vector< Partition > const &partitions)
Partition existing properties and add vtkGhostType cell data array property.
void writeNodes(const std::string &file_name_base, std::vector< Partition > const &partitions, std::vector< std::size_t > const &global_node_ids)
std::size_t nodeIdBulkMesh(MeshLib::Node const &node, std::vector< std::size_t > const *node_id_mapping=nullptr)
ConfigOffsets incrementConfigOffsets(ConfigOffsets const &oldConfig, PartitionOffsets const &offsets)
std::tuple< std::vector< MeshLib::Element const * >, std::vector< MeshLib::Element const * > > findElementsInPartition(std::size_t const part_id, std::vector< MeshLib::Element * > const &elements, std::vector< std::size_t > const &partition_ids, std::vector< std::size_t > const *node_id_mapping=nullptr)
bool copyPropertyVector(MeshLib::Properties &partitioned_properties, std::vector< Partition > const &partitions, MeshLib::PropertyVector< T > const *const pv, std::map< MeshLib::MeshItemType, std::size_t > const &total_number_of_tuples)
void applyToPropertyVectors(MeshLib::Properties const &properties, Function f)
PartitionOffsets computePartitionOffsets(Partition const &partition)
NodeWiseMeshPartitioner::IntegerType getNumberOfIntegerVariablesOfElements(std::vector< const MeshLib::Element * > const &elements)
std::size_t partitionLookup(MeshLib::Node const &node, std::vector< std::size_t > const &partition_ids, std::vector< std::size_t > const *node_id_mapping=nullptr)
std::tuple< std::vector< long >, std::vector< long > > writeConfigData(const std::string &file_name_base, std::vector< Partition > const &partitions)
std::pair< std::vector< MeshLib::Node * >, std::vector< MeshLib::Node * > > findRegularNodesInPartition(std::size_t const part_id, const bool is_mixed_high_order_linear_elems, std::vector< MeshLib::Node * > const &nodes, std::vector< std::size_t > const &partition_ids, MeshLib::Mesh const &mesh, std::vector< std::size_t > const *node_id_mapping=nullptr)
void writePropertyVectorValues(std::ostream &os, MeshLib::PropertyVector< T > const &pv)
std::unordered_map< std::size_t, long > enumerateLocalNodeIds(std::vector< MeshLib::Node * > const &nodes)
Generates a mapping of given node ids to a new local (renumbered) node ids.
void getElementIntegerVariables(const MeshLib::Element &elem, const std::unordered_map< std::size_t, long > &local_node_ids, std::vector< long > &elem_info, long &counter)
void markDuplicateGhostCells(MeshLib::Mesh const &mesh, std::vector< Partition > &partitions)
std::size_t copyNodePropertyVectorValues(Partition const &p, std::size_t const offset, MeshLib::PropertyVector< T > const &pv, MeshLib::PropertyVector< T > &partitioned_pv)
void writeProperties(const std::string &file_name_base, MeshLib::Properties const &partitioned_properties, std::vector< Partition > const &partitions, MeshLib::MeshItemType const mesh_item_type)
void writeElements(std::string const &file_name_base, std::vector< Partition > const &partitions, std::vector< long > const ®ular_element_offsets, std::vector< long > const &ghost_element_offsets)
void writeValueBinary(std::ostream &out, T const &val)
write value as binary into the given output stream
const char * toString(mgis::behaviour::Behaviour::Kinematic kin)
Converts MGIS kinematic to a string representation.
void copy(PETScVector const &x, PETScVector &y)
void writePropertyVectorPartitionMetaData(std::ostream &os, PropertyVectorPartitionMetaData const &pvpmd)
void writePropertyVectorMetaData(std::ostream &os, PropertyVectorMetaData const &pvmd)
bool isBaseNode(Node const &node, std::vector< Element const * > const &elements_connected_to_node)
long ghost_element_rank_offset
std::ostream & writeConfig(std::ostream &os) const
NodeWiseMeshPartitioner::IntegerType id
NodeStruct(NodeWiseMeshPartitioner::IntegerType const id_, double const x_, double const y_, double const z_)
std::size_t number_of_mesh_base_nodes
std::size_t number_of_base_nodes
std::size_t number_of_regular_nodes
std::ostream & writeConfig(std::ostream &os) const
std::size_t number_of_mesh_all_nodes
std::vector< MeshLib::Node * > nodes
nodes.
std::size_t numberOfMeshItems(MeshLib::MeshItemType const item_type) const
std::size_t number_of_regular_base_nodes
std::vector< const MeshLib::Element * > regular_elements
Non ghost elements.
std::vector< const MeshLib::Element * > ghost_elements
std::ostream & writeNodes(std::ostream &os, std::vector< std::size_t > const &global_node_ids) const