OGS
|
Classes | |
struct | NodeStruct |
struct | ConfigOffsets |
struct | PartitionOffsets |
struct | Partition |
A subdomain mesh. More... | |
class | NodeWiseMeshPartitioner |
Mesh partitioner. More... | |
Functions | |
void | writeMETIS (std::vector< MeshLib::Element * > const &elements, const std::string &file_name) |
std::vector< std::size_t > | readMetisData (const std::string &file_name_base, long const number_of_partitions, std::size_t const number_of_nodes) |
void | removeMetisPartitioningFiles (std::string const &file_name_base, long const number_of_partitions) |
NodeWiseMeshPartitioner::IntegerType | getNumberOfIntegerVariablesOfElements (std::vector< const MeshLib::Element * > const &elements) |
std::size_t | nodeIdBulkMesh (MeshLib::Node const &node, std::vector< std::size_t > const *node_id_mapping=nullptr) |
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::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) |
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::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) |
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) |
template<typename T > | |
std::size_t | copyNodePropertyVectorValues (Partition const &p, std::size_t const offset, MeshLib::PropertyVector< T > const &pv, MeshLib::PropertyVector< T > &partitioned_pv) |
template<typename T > | |
std::size_t | copyCellPropertyVectorValues (Partition const &p, std::size_t const offset, MeshLib::PropertyVector< T > const &pv, MeshLib::PropertyVector< T > &partitioned_pv) |
template<typename T > | |
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) |
template<typename Function > | |
void | applyToPropertyVectors (MeshLib::Properties const &properties, Function f) |
void | addVtkGhostTypeProperty (MeshLib::Properties &partitioned_properties, std::vector< Partition > const &partitions, std::size_t const total_number_of_cells) |
MeshLib::Properties | partitionProperties (MeshLib::Properties const &properties, std::vector< Partition > const &partitions) |
Partition existing properties and add vtkGhostType cell data array property. More... | |
void | markDuplicateGhostCells (MeshLib::Mesh const &mesh, std::vector< Partition > &partitions) |
template<typename T > | |
void | writePropertyVectorValues (std::ostream &os, MeshLib::PropertyVector< T > const &pv) |
template<typename T > | |
bool | writePropertyVector (MeshLib::PropertyVector< T > const *const pv, MeshLib::MeshItemType const mesh_item_type, std::ostream &out_val, std::ostream &out_meta) |
void | writeProperties (const std::string &file_name_base, MeshLib::Properties const &partitioned_properties, std::vector< Partition > const &partitions, MeshLib::MeshItemType const mesh_item_type) |
PartitionOffsets | computePartitionOffsets (Partition const &partition) |
ConfigOffsets | incrementConfigOffsets (ConfigOffsets const &oldConfig, PartitionOffsets const &offsets) |
std::tuple< std::vector< long >, std::vector< long > > | writeConfigData (const std::string &file_name_base, std::vector< Partition > const &partitions) |
void | getElementIntegerVariables (const MeshLib::Element &elem, const std::unordered_map< std::size_t, long > &local_node_ids, std::vector< long > &elem_info, long &counter) |
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. More... | |
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 | writeNodes (const std::string &file_name_base, std::vector< Partition > const &partitions, std::vector< std::size_t > const &global_node_ids) |
void ApplicationUtils::addVtkGhostTypeProperty | ( | MeshLib::Properties & | partitioned_properties, |
std::vector< Partition > const & | partitions, | ||
std::size_t const | total_number_of_cells | ||
) |
Definition at line 450 of file NodeWiseMeshPartitioner.cpp.
References MeshLib::Cell, MeshLib::Properties::createNewPropertyVector(), and OGS_FATAL.
Referenced by partitionProperties().
void ApplicationUtils::applyToPropertyVectors | ( | MeshLib::Properties const & | properties, |
Function | f | ||
) |
Applies a function of the form f(type, name) -> bool for each of the properties names. The type argument is used to call f<decltype(type)>(name). At least one of the functions must return the 'true' value, but at most one is executed.
Definition at line 427 of file NodeWiseMeshPartitioner.cpp.
References MaterialPropertyLib::name, and OGS_FATAL.
Referenced by partitionProperties(), and writeProperties().
PartitionOffsets ApplicationUtils::computePartitionOffsets | ( | Partition const & | partition | ) |
Definition at line 877 of file NodeWiseMeshPartitioner.cpp.
References getNumberOfIntegerVariablesOfElements(), ApplicationUtils::Partition::ghost_elements, ApplicationUtils::Partition::nodes, and ApplicationUtils::Partition::regular_elements.
Referenced by writeConfigData().
std::size_t ApplicationUtils::copyCellPropertyVectorValues | ( | Partition const & | p, |
std::size_t const | offset, | ||
MeshLib::PropertyVector< T > const & | pv, | ||
MeshLib::PropertyVector< T > & | partitioned_pv | ||
) |
Copies the properties from global property vector pv
to the partition-local one partitioned_pv
. Regular elements' and ghost elements' values are copied.
Definition at line 343 of file NodeWiseMeshPartitioner.cpp.
References MeshLib::PropertyVectorBase::getNumberOfGlobalComponents().
Referenced by copyPropertyVector().
std::size_t ApplicationUtils::copyNodePropertyVectorValues | ( | Partition const & | p, |
std::size_t const | offset, | ||
MeshLib::PropertyVector< T > const & | pv, | ||
MeshLib::PropertyVector< T > & | partitioned_pv | ||
) |
Copies the properties from global property vector pv
to the partition-local one partitioned_pv
.
Definition at line 321 of file NodeWiseMeshPartitioner.cpp.
References MeshLib::PropertyVectorBase::getNumberOfGlobalComponents().
Referenced by copyPropertyVector().
bool ApplicationUtils::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 | ||
) |
Definition at line 369 of file NodeWiseMeshPartitioner.cpp.
References MeshLib::Cell, copyCellPropertyVectorValues(), copyNodePropertyVectorValues(), MeshLib::Properties::createNewPropertyVector(), MeshLib::PropertyVectorBase::getMeshItemType(), MeshLib::PropertyVectorBase::getNumberOfGlobalComponents(), MeshLib::PropertyVectorBase::getPropertyName(), MeshLib::IntegrationPoint, MeshLib::Node, and OGS_FATAL.
std::unordered_map<std::size_t, long> ApplicationUtils::enumerateLocalNodeIds | ( | std::vector< MeshLib::Node * > const & | nodes | ) |
Generates a mapping of given node ids to a new local (renumbered) node ids.
Definition at line 974 of file NodeWiseMeshPartitioner.cpp.
Referenced by writeElements().
std::tuple<std::vector<MeshLib::Element const*>, std::vector<MeshLib::Element const*> > ApplicationUtils::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 |
||
) |
1 find elements belonging to the partition part_id: fills vector partition.regular_elements 2 find ghost elements belonging to the partition part_id fills vector partition.ghost_elements
Definition at line 193 of file NodeWiseMeshPartitioner.cpp.
References numberOfRegularNodes().
Referenced by ApplicationUtils::NodeWiseMeshPartitioner::partitionOtherMesh(), and ApplicationUtils::NodeWiseMeshPartitioner::processPartition().
std::tuple<std::vector<MeshLib::Node*>, std::vector<MeshLib::Node*> > ApplicationUtils::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 |
||
) |
Prerequisite: the ghost elements has to be found (using findElementsInPartition). Finds ghost nodes and non-linear element ghost nodes by walking over ghost elements.
Definition at line 232 of file NodeWiseMeshPartitioner.cpp.
References MeshLib::Mesh::getElementsConnectedToNode(), MeshLib::isBaseNode(), and partitionLookup().
Referenced by ApplicationUtils::NodeWiseMeshPartitioner::partitionOtherMesh(), and ApplicationUtils::NodeWiseMeshPartitioner::processPartition().
std::pair<std::vector<MeshLib::Node*>, std::vector<MeshLib::Node*> > ApplicationUtils::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 |
||
) |
1 copy pointers to nodes belonging to the partition part_id into base nodes vector, and 2 collect non-linear element nodes belonging to the partition part_id in extra nodes vector. If node_id_mapping
is given, it will be used to map the mesh node ids to other ids; used by boundary meshes, for example.
Definition at line 135 of file NodeWiseMeshPartitioner.cpp.
References MeshLib::Mesh::getElementsConnectedToNode(), MeshLib::isBaseNode(), and partitionLookup().
Referenced by ApplicationUtils::NodeWiseMeshPartitioner::partitionOtherMesh(), and ApplicationUtils::NodeWiseMeshPartitioner::processPartition().
void ApplicationUtils::getElementIntegerVariables | ( | const MeshLib::Element & | elem, |
const std::unordered_map< std::size_t, long > & | local_node_ids, | ||
std::vector< long > & | elem_info, | ||
long & | counter | ||
) |
Get integer variables, which are used to define an element
elem | Element |
local_node_ids | Local node indices of a partition |
elem_info | A vector holds all integer variables of element definitions |
counter | Recorder of the number of integer variables. |
Definition at line 953 of file NodeWiseMeshPartitioner.cpp.
References MeshLib::Element::getCellType(), MeshLib::Element::getNode(), and MeshLib::Element::getNumberOfNodes().
Referenced by writeElements().
NodeWiseMeshPartitioner::IntegerType ApplicationUtils::getNumberOfIntegerVariablesOfElements | ( | std::vector< const MeshLib::Element * > const & | elements | ) |
Calculate the total number of integer variables of an element vector. Each element has three integer variables for element ID, element type, number of nodes of the element. Therefore the total number of the integers in elements
is 3 * elements.size() + sum (number of nodes of each element).
Definition at line 80 of file NodeWiseMeshPartitioner.cpp.
Referenced by computePartitionOffsets(), and ApplicationUtils::Partition::writeConfig().
ConfigOffsets ApplicationUtils::incrementConfigOffsets | ( | ConfigOffsets const & | oldConfig, |
PartitionOffsets const & | offsets | ||
) |
Definition at line 888 of file NodeWiseMeshPartitioner.cpp.
References ApplicationUtils::ConfigOffsets::element_rank_offset, ApplicationUtils::ConfigOffsets::ghost_element_rank_offset, ApplicationUtils::PartitionOffsets::ghost_elements, ApplicationUtils::PartitionOffsets::node, ApplicationUtils::ConfigOffsets::node_rank_offset, and ApplicationUtils::PartitionOffsets::regular_elements.
Referenced by writeConfigData().
void ApplicationUtils::markDuplicateGhostCells | ( | MeshLib::Mesh const & | mesh, |
std::vector< Partition > & | partitions | ||
) |
Definition at line 525 of file NodeWiseMeshPartitioner.cpp.
References MeshLib::Mesh::getElements().
Referenced by ApplicationUtils::NodeWiseMeshPartitioner::partitionByMETIS(), and ApplicationUtils::NodeWiseMeshPartitioner::partitionOtherMesh().
std::size_t ApplicationUtils::nodeIdBulkMesh | ( | MeshLib::Node const & | node, |
std::vector< std::size_t > const * | node_id_mapping = nullptr |
||
) |
Definition at line 109 of file NodeWiseMeshPartitioner.cpp.
References MathLib::Point3dWithID::getID().
Referenced by partitionLookup().
std::ptrdiff_t ApplicationUtils::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 |
||
) |
Definition at line 175 of file NodeWiseMeshPartitioner.cpp.
References MeshLib::Element::getNodes(), and MeshLib::Element::getNumberOfNodes().
Referenced by findElementsInPartition().
std::size_t ApplicationUtils::partitionLookup | ( | MeshLib::Node const & | node, |
std::vector< std::size_t > const & | partition_ids, | ||
std::vector< std::size_t > const * | node_id_mapping = nullptr |
||
) |
Definition at line 116 of file NodeWiseMeshPartitioner.cpp.
References nodeIdBulkMesh().
Referenced by findGhostNodesInPartition(), and findRegularNodesInPartition().
MeshLib::Properties ApplicationUtils::partitionProperties | ( | MeshLib::Properties const & | properties, |
std::vector< Partition > const & | partitions | ||
) |
Partition existing properties and add vtkGhostType cell data array property.
Creates partitioned mesh properties for nodes and cells.
Definition at line 480 of file NodeWiseMeshPartitioner.cpp.
References addVtkGhostTypeProperty(), applyToPropertyVectors(), and DBUG().
Referenced by main(), and ApplicationUtils::NodeWiseMeshPartitioner::partitionByMETIS().
std::vector< std::size_t > ApplicationUtils::readMetisData | ( | const std::string & | file_name_base, |
long | number_of_partitions, | ||
std::size_t | number_of_nodes | ||
) |
Read metis data
file_name_base | The prefix of the filename. |
number_of_partitions | The number is used to compose the full filename and forms the postfix. |
number_of_nodes | Expected/required number of nodes to be read. |
Definition at line 45 of file Metis.cpp.
References OGS_FATAL.
Referenced by main().
void ApplicationUtils::removeMetisPartitioningFiles | ( | std::string const & | file_name_base, |
long | number_of_partitions | ||
) |
std::tuple<std::vector<long>, std::vector<long> > ApplicationUtils::writeConfigData | ( | const std::string & | file_name_base, |
std::vector< Partition > const & | partitions | ||
) |
Write the configuration data of the partition data in binary files.
Definition at line 910 of file NodeWiseMeshPartitioner.cpp.
References computePartitionOffsets(), incrementConfigOffsets(), OGS_FATAL, and ApplicationUtils::ConfigOffsets::writeConfig().
Referenced by ApplicationUtils::NodeWiseMeshPartitioner::write(), and ApplicationUtils::NodeWiseMeshPartitioner::writeOtherMesh().
void ApplicationUtils::writeElements | ( | std::string const & | file_name_base, |
std::vector< Partition > const & | partitions, | ||
std::vector< long > const & | regular_element_offsets, | ||
std::vector< long > const & | ghost_element_offsets | ||
) |
Write the element integer variables of all partitions into binary files.
file_name_base | The prefix of the file name. |
partitions | Partitions vector. |
regular_element_offsets | The numbers of all non-ghost element integer variables of each partitions. |
ghost_element_offsets | The numbers of all ghost element |
Definition at line 994 of file NodeWiseMeshPartitioner.cpp.
References enumerateLocalNodeIds(), getElementIntegerVariables(), and OGS_FATAL.
Referenced by ApplicationUtils::NodeWiseMeshPartitioner::write(), and ApplicationUtils::NodeWiseMeshPartitioner::writeOtherMesh().
void ApplicationUtils::writeMETIS | ( | std::vector< MeshLib::Element * > const & | elements, |
const std::string & | file_name | ||
) |
Write elements as METIS graph file
elements | The mesh elements. |
file_name | File name with an extension of mesh. |
Definition at line 19 of file Metis.cpp.
References MeshLib::getNodeIndex(), and OGS_FATAL.
Referenced by main().
void ApplicationUtils::writeNodes | ( | const std::string & | file_name_base, |
std::vector< Partition > const & | partitions, | ||
std::vector< std::size_t > const & | global_node_ids | ||
) |
Write the nodes of all partitions into a binary file.
file_name_base | The prefix of the file name. |
partitions | the list of partitions |
global_node_ids | global numbering of nodes |
Definition at line 1060 of file NodeWiseMeshPartitioner.cpp.
References OGS_FATAL.
Referenced by ApplicationUtils::NodeWiseMeshPartitioner::write(), and ApplicationUtils::NodeWiseMeshPartitioner::writeOtherMesh().
void ApplicationUtils::writeProperties | ( | const std::string & | file_name_base, |
MeshLib::Properties const & | partitioned_properties, | ||
std::vector< Partition > const & | partitions, | ||
MeshLib::MeshItemType const | mesh_item_type | ||
) |
Definition at line 793 of file NodeWiseMeshPartitioner.cpp.
References applyToPropertyVectors(), DBUG(), MaterialPropertyLib::number_of_properties, OGS_FATAL, MeshLib::Properties::size(), MaterialLib::Solids::MFront::toString(), MeshLib::IO::writePropertyVectorPartitionMetaData(), and BaseLib::writeValueBinary().
Referenced by ApplicationUtils::NodeWiseMeshPartitioner::write(), and ApplicationUtils::NodeWiseMeshPartitioner::writeOtherMesh().
bool ApplicationUtils::writePropertyVector | ( | MeshLib::PropertyVector< T > const *const | pv, |
MeshLib::MeshItemType const | mesh_item_type, | ||
std::ostream & | out_val, | ||
std::ostream & | out_meta | ||
) |
Definition at line 768 of file NodeWiseMeshPartitioner.cpp.
References MeshLib::IO::PropertyVectorMetaData::fillPropertyVectorMetaDataTypeInfo(), MeshLib::PropertyVectorBase::getMeshItemType(), MeshLib::PropertyVectorBase::getNumberOfGlobalComponents(), MeshLib::PropertyVector< PROP_VAL_TYPE >::getNumberOfTuples(), MeshLib::PropertyVectorBase::getPropertyName(), MeshLib::IO::PropertyVectorMetaData::number_of_components, MeshLib::IO::PropertyVectorMetaData::number_of_tuples, MeshLib::IO::PropertyVectorMetaData::property_name, MeshLib::IO::writePropertyVectorMetaData(), and writePropertyVectorValues().
void ApplicationUtils::writePropertyVectorValues | ( | std::ostream & | os, |
MeshLib::PropertyVector< T > const & | pv | ||
) |
Definition at line 761 of file NodeWiseMeshPartitioner.cpp.
References MeshLib::PropertyVector< PROP_VAL_TYPE >::size().
Referenced by writePropertyVector().