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::ContainerExpressionUtils Class Reference

#include <container_expression_utils.h>

Collaboration diagram for Kratos::ContainerExpressionUtils:

Public Types

Type definitions
using IndexType = std::size_t
 
using SparseSpaceType = UblasSpace< double, CompressedMatrix, Vector >
 
using SparseMatrixType = SparseSpaceType::MatrixType
 

Static Public Member Functions

Static operations
template<class TContainerType >
static double EntityMaxNormL2 (const ContainerExpression< TContainerType > &rContainer)
 Calculate max L2 norm of the evaluated expression for each entitiy. More...
 
static double InnerProduct (const CollectiveExpression &rContainer1, const CollectiveExpression &rContainer2)
 Computes inner product between two container expressions by evaluating both expressions for each entity in their containers, hence this is an expensive operation. Both container expressions should have the same types of containe expressions, therefore they may have the same container expressions lists. More...
 
template<class TContainerType >
static void ProductWithEntityMatrix (ContainerExpression< TContainerType > &rOutput, const SparseMatrixType &rMatrix, const ContainerExpression< TContainerType > &rInput)
 Calculates matrix vector product for container variable data. More...
 
template<class TContainerType >
static void ProductWithEntityMatrix (ContainerExpression< TContainerType > &rOutput, const Matrix &rMatrix, const ContainerExpression< TContainerType > &rInput)
 Calculates matrix vector product for container variable data. More...
 
static void Transpose (Matrix &rOutput, const Matrix &rInput)
 Transposes a dense matrix. More...
 
static void Transpose (SparseMatrixType &rOutput, const SparseMatrixType &rInput)
 Transposes a sparse matrix. More...
 
template<class TContainerType >
static void ComputeNumberOfNeighbourEntities (ContainerExpression< ModelPart::NodesContainerType > &rOutput)
 Computes number ofneighbour entities for the container. More...
 
template<class TContainerType >
static void MapContainerVariableToNodalVariable (ContainerExpression< ModelPart::NodesContainerType > &rOutput, const ContainerExpression< TContainerType > &rInput, const ContainerExpression< ModelPart::NodesContainerType > &rNeighbourEntities)
 Maps container data to nodal data. More...
 
template<class TContainerType >
static void MapNodalVariableToContainerVariable (ContainerExpression< TContainerType > &rOutput, const ContainerExpression< ModelPart::NodesContainerType > &rInput)
 Maps nodal values to container variable data. More...
 
template<class TContainerType >
static void ComputeNodalVariableProductWithEntityMatrix (ContainerExpression< ModelPart::NodesContainerType > &rOutput, const ContainerExpression< ModelPart::NodesContainerType > &rNodalValues, const Variable< Matrix > &rMatrixVariable, TContainerType &rEntities)
 Computes nodal and entity wise matrix multiplication. More...
 

Member Typedef Documentation

◆ IndexType

◆ SparseMatrixType

◆ SparseSpaceType

Member Function Documentation

◆ ComputeNodalVariableProductWithEntityMatrix()

template<class TContainerType >
void Kratos::ContainerExpressionUtils::ComputeNodalVariableProductWithEntityMatrix ( ContainerExpression< ModelPart::NodesContainerType > &  rOutput,
const ContainerExpression< ModelPart::NodesContainerType > &  rNodalValues,
const Variable< Matrix > &  rMatrixVariable,
TContainerType &  rEntities 
)
static

Computes nodal and entity wise matrix multiplication.

This method first distributes rNodalValues to nodes. Then it calculates the matrix from the rEntities using rMatrixVariable. Then nodal values of each entitiy in rEntities is computed. Finally the matrix (from rMatrixVariable in each entity) and vector (from nodal values for each entity taken from rNodalValues) multiplication is carried out. The solution of this multiplication is stored in rOutput.

This method is optimized and compatible with OpenMP and MPI.

Template Parameters
TContainerType
Parameters
rOutputOutput containing the matrix vectormultiplication
rNodalValuesNodal values used as the vector.
rMatrixVariableThe variable used to obtain matrix from each variable.
rEntitiesEntities to compute the matrix.

◆ ComputeNumberOfNeighbourEntities()

template<class TContainerType >
void Kratos::ContainerExpressionUtils::ComputeNumberOfNeighbourEntities ( ContainerExpression< ModelPart::NodesContainerType > &  rOutput)
static

Computes number ofneighbour entities for the container.

This method computes number of entities present around nodes in the given TContainerType in the model parts provided in the rOutput.

This method is optimized and compatible with OpenMP and MPI.

Template Parameters
TContainerType
Parameters
rOutputOutput containing number of entities around each node.

◆ EntityMaxNormL2()

template<class TContainerType >
double Kratos::ContainerExpressionUtils::EntityMaxNormL2 ( const ContainerExpression< TContainerType > &  rContainer)
static

Calculate max L2 norm of the evaluated expression for each entitiy.

This calculates L2 norm of the each entity expression by evaluating, and then returns the maximum of those. This is also an expensive operation.

This method is optimized and compatible with OpenMP and MPI.

Template Parameters
TContainerType
Parameters
rContainerContainer data
Returns
double Max L2 norm

◆ InnerProduct()

double Kratos::ContainerExpressionUtils::InnerProduct ( const CollectiveExpression rContainer1,
const CollectiveExpression rContainer2 
)
static

Computes inner product between two container expressions by evaluating both expressions for each entity in their containers, hence this is an expensive operation. Both container expressions should have the same types of containe expressions, therefore they may have the same container expressions lists.

This method is optimized and compatible with OpenMP and MPI.

Parameters
rContainer1Container expressions 1
rContainer2Container expressions 2
Returns
double Output of the inner product.

◆ MapContainerVariableToNodalVariable()

template<class TContainerType >
void Kratos::ContainerExpressionUtils::MapContainerVariableToNodalVariable ( ContainerExpression< ModelPart::NodesContainerType > &  rOutput,
const ContainerExpression< TContainerType > &  rInput,
const ContainerExpression< ModelPart::NodesContainerType > &  rNeighbourEntities 
)
static

Maps container data to nodal data.

This method mapps containr data given in rInput to nodal data (rOutput). Mapping is done using rNeighbourEntities (which should consist of number of neighbour entities surrounding each node.).

All the model parts in rOutput, rInput and rNeighbourEntities should be the same.

This method is optimized and compatible with OpenMP and MPI.

Template Parameters
TContainerType
Parameters
rOutputOutput containing mapped nodal values.
rInputInput containing values in the TContainerType which needs to be mapped to nodes.
rNeighbourEntitiesNumber of neighbour entities present around each node.

◆ MapNodalVariableToContainerVariable()

template<class TContainerType >
void Kratos::ContainerExpressionUtils::MapNodalVariableToContainerVariable ( ContainerExpression< TContainerType > &  rOutput,
const ContainerExpression< ModelPart::NodesContainerType > &  rInput 
)
static

Maps nodal values to container variable data.

This method maps nodal data to given container type.

rOutput and rInput should have the same model part.

This method is optimized and compatible with OpenMP and MPI.

Template Parameters
TContainerType
Parameters
rOutputOutput containing mapped data.
rInputNodal data to be mapped to the other type of container.

◆ ProductWithEntityMatrix() [1/2]

template<class TContainerType >
void Kratos::ContainerExpressionUtils::ProductWithEntityMatrix ( ContainerExpression< TContainerType > &  rOutput,
const Matrix rMatrix,
const ContainerExpression< TContainerType > &  rInput 
)
static

Calculates matrix vector product for container variable data.

This computes matrix and vector product between rMatrix and the contaienr variable data rInput. This is an expensive operation since this involve evaluating the expression for each entity and doing matrix vector multiplication.

This is only compatible with OpenMP.

Template Parameters
TContainerType
Parameters
rOutputOutput container containing matrix vector multiplication.
rMatrixdense matrix
rInputInput container values to be used with matrix product.

◆ ProductWithEntityMatrix() [2/2]

template<class TContainerType >
void Kratos::ContainerExpressionUtils::ProductWithEntityMatrix ( ContainerExpression< TContainerType > &  rOutput,
const SparseMatrixType rMatrix,
const ContainerExpression< TContainerType > &  rInput 
)
static

Calculates matrix vector product for container variable data.

This computes matrix and vector product between rMatrix and the contaienr variable data rInput. This is an expensive operation since this involve evaluating the expression for each entity and doing matrix vector multiplication.

This is only compatible with OpenMP.

Template Parameters
TContainerType
Parameters
rOutputOutput container containing matrix vector multiplication.
rMatrixSparse matrix
rInputInput container values to be used with matrix product.

◆ Transpose() [1/2]

void Kratos::ContainerExpressionUtils::Transpose ( Matrix rOutput,
const Matrix rInput 
)
static

Transposes a dense matrix.

This method is optimized for OpenMP.

Parameters
rOutput
rInput

◆ Transpose() [2/2]

void Kratos::ContainerExpressionUtils::Transpose ( SparseMatrixType rOutput,
const SparseMatrixType rInput 
)
static

Transposes a sparse matrix.

This method is optimized for OpenMP.

Parameters
rOutput
rInput

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