KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
List of all members
Kratos::MetisDivideHeterogeneousInputProcess Class Reference

Call Metis to divide an heterogeneous mesh, by partitioning its nodal graph. More...

#include <metis_divide_heterogeneous_input_process.h>

Inheritance diagram for Kratos::MetisDivideHeterogeneousInputProcess:
Collaboration diagram for Kratos::MetisDivideHeterogeneousInputProcess:

Public Member Functions

Life Cycle
 MetisDivideHeterogeneousInputProcess (IO &rIO, SizeType NumberOfPartitions, int Dimension=3, int Verbosity=0, bool SynchronizeConditions=false)
 Default constructor. More...
 
 MetisDivideHeterogeneousInputProcess (MetisDivideHeterogeneousInputProcess const &rOther)=delete
 Copy constructor. More...
 
virtual ~MetisDivideHeterogeneousInputProcess ()
 Destructor. More...
 
Operators
void operator() ()
 
Operations
void Execute () override
 Generate a partition using Metis. More...
 
virtual void GetNodesPartitions (std::vector< idxtype > &rNodePartition, SizeType &rNumNodes)
 
Input and output
std::string Info () const override
 Turn back information as a string. More...
 
void PrintInfo (std::ostream &rOStream) const override
 Print information about this object. More...
 
void PrintData (std::ostream &rOStream) const override
 Print object's data. More...
 
- Public Member Functions inherited from Kratos::Process
 KRATOS_CLASS_POINTER_DEFINITION (Process)
 Pointer definition of Process. More...
 
 Process ()
 Default constructor. More...
 
 Process (const Flags options)
 
 ~Process () override
 Destructor. More...
 
void operator() ()
 This operator is provided to call the process as a function and simply calls the Execute method. More...
 
virtual Process::Pointer Create (Model &rModel, Parameters ThisParameters)
 This method creates an pointer of the process. More...
 
virtual void ExecuteInitialize ()
 This function is designed for being called at the beginning of the computations right after reading the model and the groups. More...
 
virtual void ExecuteBeforeSolutionLoop ()
 This function is designed for being execute once before the solution loop but after all of the solvers where built. More...
 
virtual void ExecuteInitializeSolutionStep ()
 This function will be executed at every time step BEFORE performing the solve phase. More...
 
virtual void ExecuteFinalizeSolutionStep ()
 This function will be executed at every time step AFTER performing the solve phase. More...
 
virtual void ExecuteBeforeOutputStep ()
 This function will be executed at every time step BEFORE writing the output. More...
 
virtual void ExecuteAfterOutputStep ()
 This function will be executed at every time step AFTER writing the output. More...
 
virtual void ExecuteFinalize ()
 This function is designed for being called at the end of the computations. More...
 
virtual int Check ()
 This function is designed for being called after ExecuteInitialize ONCE to verify that the input is correct. More...
 
virtual void Clear ()
 This method clears the assignation of the conditions. More...
 
virtual const Parameters GetDefaultParameters () const
 This method provides the defaults parameters to avoid conflicts between the different constructors. More...
 
- Public Member Functions inherited from Kratos::Flags
Flagsoperator= (Flags const &rOther)
 Assignment operator. More...
 
 operator bool () const
 
Flags operator~ () const
 
bool operator! () const
 
void AssignFlags (Flags const &rOther)
 
void Set (const Flags ThisFlag)
 
void Set (const Flags ThisFlag, bool Value)
 
void Reset (const Flags ThisFlag)
 
void Flip (const Flags ThisFlag)
 
void SetPosition (IndexType Position, bool Value=true)
 
bool GetPosition (IndexType Position) const
 
void FlipPosition (IndexType Position)
 
void ClearPosition (IndexType Position)
 
void Clear ()
 
Flags AsFalse () const
 
bool Is (Flags const &rOther) const
 
bool IsDefined (Flags const &rOther) const
 
bool IsNot (Flags const &rOther) const
 
bool IsNotDefined (Flags const &rOther) const
 
 KRATOS_CLASS_POINTER_DEFINITION (Flags)
 Pointer definition of Flags. More...
 
const Flagsoperator|= (const Flags &Other)
 
const Flagsoperator&= (const Flags &Other)
 
 Flags ()
 Default constructor. More...
 
 Flags (Flags const &rOther)
 Copy constructor. More...
 
virtual ~Flags ()
 Destructor. More...
 

Protected Member Functions

Private Operations
void ExecutePartitioning (PartitioningInfo &rPartitioningInfo)
 
int PartitionNodes (SizeType NumNodes, idxtype *NodeIndices, idxtype *NodeConnectivities, std::vector< idxtype > &rNodePartition)
 Call Metis to create a partition of nodes based on the nodal graph. More...
 
void PartitionMesh (std::vector< idxtype > const &NodePartition, const IO::ConnectivitiesContainerType &rElemConnectivities, std::vector< idxtype > &rElemPartition)
 Use the nodal partition data to assign elements or conditions to a partition. More...
 
void PartitionElementsSynchronous (std::vector< idxtype > const &NodePartition, const IO::ConnectivitiesContainerType &rElemConnectivities, std::vector< idxtype > &rElemPartition)
 Partition the elements such that boundary elements are always assigned the majority partition. More...
 
void PartitionConditionsSynchronous (const std::vector< idxtype > &rNodePartition, const std::vector< idxtype > &rElemPartition, const IO::ConnectivitiesContainerType &rCondConnectivities, const IO::ConnectivitiesContainerType &rElemConnectivities, std::vector< idxtype > &rCondPartition)
 Partition the conditions such that the condition is assigned the same partition as its parent element. More...
 
void RedistributeHangingNodes (std::vector< idxtype > &rNodePartition, std::vector< idxtype > const &rElementPartition, const IO::ConnectivitiesContainerType &rElementConnectivities, std::vector< idxtype > const &rConditionPartition, const IO::ConnectivitiesContainerType &rConditionConnectivities)
 
SizeType FindMax (SizeType NumTerms, const std::vector< int > &rVect)
 
void PrintDebugData (const std::string &rLabel, const std::vector< idxtype > &rPartitionData)
 
Un accessible methods
MetisDivideHeterogeneousInputProcessoperator= (MetisDivideHeterogeneousInputProcess const &rOther)
 Assignment operator. More...
 

Protected Attributes

Member Variables
IOmrIO
 
SizeType mNumberOfPartitions
 
bool mSynchronizeConditions
 
int mVerbosity
 
int mNumNodes
 
std::vector< std::unordered_set< std::size_t > > mNodeConnectivities
 

Type Definitions

using SizeType = IO::SizeType
 
using GraphType = IO::GraphType
 
using PartitioningInfo = IO::PartitioningInfo
 
using PartitionIndicesType = IO::PartitionIndicesType
 
using PartitionIndicesContainerType = IO::PartitionIndicesContainerType
 
using idxtype = idx_t
 
 KRATOS_CLASS_POINTER_DEFINITION (MetisDivideHeterogeneousInputProcess)
 Pointer definition of MetisDivideHeterogeneousInputProcess. More...
 

Additional Inherited Members

- Public Types inherited from Kratos::Flags
enum  FlagsList {
  Flag0 = BlockType(1) , Flag1 = BlockType(1) << 1 , Flag2 = BlockType(1) << 2 , Flag3 = BlockType(1) << 3 ,
  Flag4 = BlockType(1) << 4 , Flag5 = BlockType(1) << 5 , Flag6 = BlockType(1) << 6 , Flag7 = BlockType(1) << 7 ,
  Flag8 = BlockType(1) << 8 , Flag9 = BlockType(1) << 9 , Flag10 = BlockType(1) << 10 , Flag11 = BlockType(1) << 11 ,
  Flag12 = BlockType(1) << 12 , Flag13 = BlockType(1) << 13 , Flag14 = BlockType(1) << 14 , Flag15 = BlockType(1) << 15 ,
  Flag16 = BlockType(1) << 16 , Flag17 = BlockType(1) << 17 , Flag18 = BlockType(1) << 18 , Flag19 = BlockType(1) << 19 ,
  Flag20 = BlockType(1) << 20 , Flag21 = BlockType(1) << 21 , Flag22 = BlockType(1) << 22 , Flag23 = BlockType(1) << 23 ,
  Flag24 = BlockType(1) << 24 , Flag25 = BlockType(1) << 25 , Flag26 = BlockType(1) << 26 , Flag27 = BlockType(1) << 27 ,
  Flag28 = BlockType(1) << 28 , Flag29 = BlockType(1) << 29 , Flag30 = BlockType(1) << 30
}
 
typedef int64_t BlockType
 
typedef int64_t FlagType
 
typedef std::size_t IndexType
 
- Static Public Member Functions inherited from Kratos::Flags
static const Flags AllDefined ()
 
static const Flags AllTrue ()
 
static Flags Create (IndexType ThisPosition, bool Value=true)
 

Detailed Description

Call Metis to divide an heterogeneous mesh, by partitioning its nodal graph.

Member Typedef Documentation

◆ GraphType

◆ idxtype

◆ PartitionIndicesContainerType

◆ PartitionIndicesType

◆ PartitioningInfo

◆ SizeType

Constructor & Destructor Documentation

◆ MetisDivideHeterogeneousInputProcess() [1/2]

Kratos::MetisDivideHeterogeneousInputProcess::MetisDivideHeterogeneousInputProcess ( IO rIO,
SizeType  NumberOfPartitions,
int  Dimension = 3,
int  Verbosity = 0,
bool  SynchronizeConditions = false 
)
inline

Default constructor.

◆ MetisDivideHeterogeneousInputProcess() [2/2]

Kratos::MetisDivideHeterogeneousInputProcess::MetisDivideHeterogeneousInputProcess ( MetisDivideHeterogeneousInputProcess const &  rOther)
delete

Copy constructor.

◆ ~MetisDivideHeterogeneousInputProcess()

virtual Kratos::MetisDivideHeterogeneousInputProcess::~MetisDivideHeterogeneousInputProcess ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ Execute()

void Kratos::MetisDivideHeterogeneousInputProcess::Execute ( )
overridevirtual

Generate a partition using Metis.

Partitioned input is written as <problem name>_<mpi rank>.mdpa

Reimplemented from Kratos::Process.

◆ ExecutePartitioning()

void Kratos::MetisDivideHeterogeneousInputProcess::ExecutePartitioning ( PartitioningInfo rPartitioningInfo)
protected

◆ FindMax()

MetisDivideHeterogeneousInputProcess::SizeType Kratos::MetisDivideHeterogeneousInputProcess::FindMax ( SizeType  NumTerms,
const std::vector< int > &  rVect 
)
protected

◆ GetNodesPartitions()

void Kratos::MetisDivideHeterogeneousInputProcess::GetNodesPartitions ( std::vector< idxtype > &  rNodePartition,
SizeType rNumNodes 
)
virtual

◆ Info()

std::string Kratos::MetisDivideHeterogeneousInputProcess::Info ( ) const
inlineoverridevirtual

Turn back information as a string.

Reimplemented from Kratos::Process.

Reimplemented in Kratos::MetisDivideSubModelPartsHeterogeneousInputProcess.

◆ KRATOS_CLASS_POINTER_DEFINITION()

Kratos::MetisDivideHeterogeneousInputProcess::KRATOS_CLASS_POINTER_DEFINITION ( MetisDivideHeterogeneousInputProcess  )

Pointer definition of MetisDivideHeterogeneousInputProcess.

◆ operator()()

void Kratos::MetisDivideHeterogeneousInputProcess::operator() ( )
inline

◆ operator=()

MetisDivideHeterogeneousInputProcess& Kratos::MetisDivideHeterogeneousInputProcess::operator= ( MetisDivideHeterogeneousInputProcess const &  rOther)
protected

Assignment operator.

◆ PartitionConditionsSynchronous()

void Kratos::MetisDivideHeterogeneousInputProcess::PartitionConditionsSynchronous ( const std::vector< idxtype > &  rNodePartition,
const std::vector< idxtype > &  rElemPartition,
const IO::ConnectivitiesContainerType rCondConnectivities,
const IO::ConnectivitiesContainerType rElemConnectivities,
std::vector< idxtype > &  rCondPartition 
)
protected

Partition the conditions such that the condition is assigned the same partition as its parent element.

◆ PartitionElementsSynchronous()

void Kratos::MetisDivideHeterogeneousInputProcess::PartitionElementsSynchronous ( std::vector< idxtype > const &  NodePartition,
const IO::ConnectivitiesContainerType rElemConnectivities,
std::vector< idxtype > &  rElemPartition 
)
protected

Partition the elements such that boundary elements are always assigned the majority partition.

◆ PartitionMesh()

void Kratos::MetisDivideHeterogeneousInputProcess::PartitionMesh ( std::vector< idxtype > const &  NodePartition,
const IO::ConnectivitiesContainerType rElemConnectivities,
std::vector< idxtype > &  rElemPartition 
)
protected

Use the nodal partition data to assign elements or conditions to a partition.

◆ PartitionNodes()

int Kratos::MetisDivideHeterogeneousInputProcess::PartitionNodes ( SizeType  NumNodes,
idxtype NodeIndices,
idxtype NodeConnectivities,
std::vector< idxtype > &  rNodePartition 
)
protected

Call Metis to create a partition of nodes based on the nodal graph.

Metis_PartGraphKway is used to generate a partition for nodes in the model.

Parameters
NumNodesNumber of nodes in the mesh.
NodeIndicespointer to C array of size NumNodes+1, xadj array for calls to Metis_PartGraphKway.
NodeConnectivitiespointer to C array of size NodeIndices[NumNodes+1], adjcncy array for calls to Metis_PartGraphKway.
rNodePartitionMetis output as an std::vector, position k is the partition that will contain the k-th node (Node with Id k+1).
Returns
Number of graph edges cut by Metis.

◆ PrintData()

void Kratos::MetisDivideHeterogeneousInputProcess::PrintData ( std::ostream &  rOStream) const
inlineoverridevirtual

Print object's data.

Reimplemented from Kratos::Process.

Reimplemented in Kratos::MetisDivideSubModelPartsHeterogeneousInputProcess.

◆ PrintDebugData()

void Kratos::MetisDivideHeterogeneousInputProcess::PrintDebugData ( const std::string &  rLabel,
const std::vector< idxtype > &  rPartitionData 
)
protected

◆ PrintInfo()

void Kratos::MetisDivideHeterogeneousInputProcess::PrintInfo ( std::ostream &  rOStream) const
inlineoverridevirtual

Print information about this object.

Reimplemented from Kratos::Process.

Reimplemented in Kratos::MetisDivideSubModelPartsHeterogeneousInputProcess.

◆ RedistributeHangingNodes()

void Kratos::MetisDivideHeterogeneousInputProcess::RedistributeHangingNodes ( std::vector< idxtype > &  rNodePartition,
std::vector< idxtype > const &  rElementPartition,
const IO::ConnectivitiesContainerType rElementConnectivities,
std::vector< idxtype > const &  rConditionPartition,
const IO::ConnectivitiesContainerType rConditionConnectivities 
)
protected

Member Data Documentation

◆ mNodeConnectivities

std::vector<std::unordered_set<std::size_t> > Kratos::MetisDivideHeterogeneousInputProcess::mNodeConnectivities
protected

◆ mNumberOfPartitions

SizeType Kratos::MetisDivideHeterogeneousInputProcess::mNumberOfPartitions
protected

◆ mNumNodes

int Kratos::MetisDivideHeterogeneousInputProcess::mNumNodes
protected

◆ mrIO

IO& Kratos::MetisDivideHeterogeneousInputProcess::mrIO
protected

◆ mSynchronizeConditions

bool Kratos::MetisDivideHeterogeneousInputProcess::mSynchronizeConditions
protected

◆ mVerbosity

int Kratos::MetisDivideHeterogeneousInputProcess::mVerbosity
protected

The documentation for this class was generated from the following files: