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

MPI utilities for searching geometrical objects. More...

#include <search_utilities.h>

Collaboration diagram for Kratos::SearchUtilities:

Static Public Member Functions

Operations
template<class TPointType >
static bool PointIsInsideBoundingBox (const BoundingBox< TPointType > &rBoundingBox, const array_1d< double, 3 > &rCoords)
 Check if a point is inside a bounding box. More...
 
static bool PointIsInsideBoundingBox (const BoundingBoxType &rBoundingBox, const array_1d< double, 3 > &rCoords)
 Check if a point is inside a bounding box. More...
 
template<class TPointType >
static bool PointIsInsideBoundingBox (const BoundingBox< TPointType > &rBoundingBox, const array_1d< double, 3 > &rCoords, const double Tolerance)
 This method checks if a point is inside a bounding box considering a certain tolerance. More...
 
static void ComputeBoundingBoxesWithTolerance (const std::vector< double > &rBoundingBoxes, const double Tolerance, std::vector< double > &rBoundingBoxesWithTolerance)
 Compute the bounding boxes of the given bounding boxes from a given tolerance. More...
 
static void ComputeBoundingBoxesWithToleranceCheckingNullBB (const std::vector< double > &rBoundingBoxes, const double Tolerance, std::vector< double > &rBoundingBoxesWithTolerance)
 Compute the bounding boxes of the given bounding boxes from a given tolerance, additionally checking if the bounding boxes are initialized. More...
 
template<typename TPointIteratorType >
static void SynchronousPointSynchronization (TPointIteratorType itPointBegin, TPointIteratorType itPointEnd, std::vector< double > &rAllPointsCoordinates, std::vector< IndexType > &rAllPointsIds, const DataCommunicator &rDataCommunicator)
 SynchronousPointSynchronization prepares synchronously the coordinates of the points for MPI search. More...
 
template<typename TPointIteratorType , typename TBoundingBoxType >
static std::vector< IndexTypeSynchronousPointSynchronizationWithBoundingBox (TPointIteratorType itPointBegin, TPointIteratorType itPointEnd, DistributedSearchInformation &rSearchInfo, const TBoundingBoxType &rBoundingBox, const double ThresholdBoundingBox, const DataCommunicator &rDataCommunicator, const bool IndexItIsJustCounter=false)
 SynchronousPointSynchronization prepares synchronously the coordinates of the points for MPI search. More...
 
template<typename TPointIteratorType >
static std::vector< intSynchronousPointSynchronizationWithRecvSizes (TPointIteratorType itPointBegin, TPointIteratorType itPointEnd, std::vector< double > &rAllPointsCoordinates, std::vector< IndexType > &rAllPointsIds, const DataCommunicator &rDataCommunicator)
 SynchronousPointSynchronizationWithRecvSizes prepares synchronously the coordinates of the points for MPI search including the recv sizes. More...
 
template<typename TPointIteratorType >
static std::vector< doubleSynchronousPointSynchronizationWithRadius (TPointIteratorType itPointBegin, TPointIteratorType itPointEnd, std::vector< double > &rAllPointsCoordinates, std::vector< IndexType > &rAllPointsIds, const std::vector< double > &rRadius, const DataCommunicator &rDataCommunicator)
 SynchronousPointSynchronizationWithRadius prepares synchronously the coordinates of the points for MPI search including radius. More...
 
template<class TContainer , class TResultType >
static std::vector< typename PointObject< typename TContainer::value_type >::Pointer > PrepareSearch (const TContainer &rStructure, const TContainer &rInput, TResultType &rResults, VectorDistanceType &rResultsDistance)
 This method prepares the search. More...
 
template<class TContainer , class TResultType >
static void PrepareOutputSearch (const TContainer &rInput, TResultType &rResults, VectorDistanceType &rResultsDistance)
 This method prepares the search output. More...
 
template<class TContainer >
static std::vector< typename PointObject< typename TContainer::value_type >::Pointer > PreparePointsSearch (const TContainer &rStructure)
 This method prepares the points for search. More...
 
template<class TContainer , class TSpatialContainer , class TResultType >
static void ParallelSearch (const TContainer &rInput, const RadiusArrayType &rRadius, TSpatialContainer &rSearch, TResultType &rResults, VectorDistanceType &rResultsDistance, const int AllocationSize=1000)
 This method performs the search in parallel. More...
 

Type Definitions

using BoundingBoxType = std::array< double, 6 >
 The Bounding Box type. More...
 
using IndexType = long unsigned int
 The index type definition. More...
 
using SizeType = std::size_t
 The size type definition. More...
 
using RadiusArrayType = std::vector< double >
 Input/output types. More...
 
using DistanceType = std::vector< double >
 
using VectorDistanceType = std::vector< DistanceType >
 
static constexpr double ZeroTolerance = std::numeric_limits<double>::epsilon()
 Define zero tolerance as Epsilon. More...
 

Detailed Description

MPI utilities for searching geometrical objects.

Some methods original implementation coming from MappingUtilities

Author
Philipp Bucher (MappingUtilities methods)
Vicente Mataix Ferrandiz

Member Typedef Documentation

◆ BoundingBoxType

The Bounding Box type.

◆ DistanceType

◆ IndexType

using Kratos::SearchUtilities::IndexType = long unsigned int

The index type definition.

◆ RadiusArrayType

Input/output types.

◆ SizeType

using Kratos::SearchUtilities::SizeType = std::size_t

The size type definition.

◆ VectorDistanceType

Member Function Documentation

◆ ComputeBoundingBoxesWithTolerance()

void Kratos::SearchUtilities::ComputeBoundingBoxesWithTolerance ( const std::vector< double > &  rBoundingBoxes,
const double  Tolerance,
std::vector< double > &  rBoundingBoxesWithTolerance 
)
static

Compute the bounding boxes of the given bounding boxes from a given tolerance.

Parameters
rBoundingBoxesThe bounding boxes
ToleranceThe tolerance
rBoundingBoxesWithToleranceThe resulting bounding boxes with the applied tolerance

◆ ComputeBoundingBoxesWithToleranceCheckingNullBB()

void Kratos::SearchUtilities::ComputeBoundingBoxesWithToleranceCheckingNullBB ( const std::vector< double > &  rBoundingBoxes,
const double  Tolerance,
std::vector< double > &  rBoundingBoxesWithTolerance 
)
static

Compute the bounding boxes of the given bounding boxes from a given tolerance, additionally checking if the bounding boxes are initialized.

This method is used when the bounding boxes are not initialized

Parameters
rBoundingBoxesThe bounding boxes
ToleranceThe tolerance
rBoundingBoxesWithToleranceThe resulting bounding boxes with the applied tolerance

◆ ParallelSearch()

template<class TContainer , class TSpatialContainer , class TResultType >
static void Kratos::SearchUtilities::ParallelSearch ( const TContainer &  rInput,
const RadiusArrayType rRadius,
TSpatialContainer &  rSearch,
TResultType &  rResults,
VectorDistanceType rResultsDistance,
const int  AllocationSize = 1000 
)
inlinestatic

This method performs the search in parallel.

Parameters
rInputThe input container
rRadiusThe radius array
rSearchThe spatial search
rResultsThe results
rResultsDistanceThe results distance
AllocationSizeThe allocation size
Template Parameters
TContainerThe container type
TSpatialContainerThe spatial container type
TResultTypeThe result type

◆ PointIsInsideBoundingBox() [1/3]

template<class TPointType >
static bool Kratos::SearchUtilities::PointIsInsideBoundingBox ( const BoundingBox< TPointType > &  rBoundingBox,
const array_1d< double, 3 > &  rCoords 
)
inlinestatic

Check if a point is inside a bounding box.

Bounding box class implementation

Parameters
rBoundingBoxThe bounding box
rCoordsThe point
Returns
true if the point is inside the bounding box
Template Parameters
TPointTypeThe type of point considered

◆ PointIsInsideBoundingBox() [2/3]

template<class TPointType >
static bool Kratos::SearchUtilities::PointIsInsideBoundingBox ( const BoundingBox< TPointType > &  rBoundingBox,
const array_1d< double, 3 > &  rCoords,
const double  Tolerance 
)
inlinestatic

This method checks if a point is inside a bounding box considering a certain tolerance.

Parameters
rBoundingBoxThe bounding box
rCoordsThe coordinates of the point
ToleranceThe tolerance
Returns
True if the point is inside the bounding box
Template Parameters
TPointTypeThe type of point considered

◆ PointIsInsideBoundingBox() [3/3]

static bool Kratos::SearchUtilities::PointIsInsideBoundingBox ( const BoundingBoxType rBoundingBox,
const array_1d< double, 3 > &  rCoords 
)
inlinestatic

Check if a point is inside a bounding box.

Bounding box array of 6 doubles implementation

Parameters
rBoundingBoxThe bounding box
rCoordsThe point
Returns
true if the point is inside the bounding box

◆ PrepareOutputSearch()

template<class TContainer , class TResultType >
static void Kratos::SearchUtilities::PrepareOutputSearch ( const TContainer &  rInput,
TResultType &  rResults,
VectorDistanceType rResultsDistance 
)
inlinestatic

This method prepares the search output.

Parameters
rInputThe input to be searched
rResultsThe results
rResultsDistanceThe results distance
Template Parameters
TContainerThe container type
TResultTypeThe result type

◆ PreparePointsSearch()

template<class TContainer >
static std::vector<typename PointObject<typename TContainer::value_type>::Pointer> Kratos::SearchUtilities::PreparePointsSearch ( const TContainer &  rStructure)
inlinestatic

This method prepares the points for search.

Parameters
rStructureThe structure to be searched
Template Parameters
TContainerThe container type

◆ PrepareSearch()

template<class TContainer , class TResultType >
static std::vector<typename PointObject<typename TContainer::value_type>::Pointer> Kratos::SearchUtilities::PrepareSearch ( const TContainer &  rStructure,
const TContainer &  rInput,
TResultType &  rResults,
VectorDistanceType rResultsDistance 
)
inlinestatic

This method prepares the search.

Parameters
rStructureThe structure to be searched
rInputThe input to be searched
rResultsThe results
rResultsDistanceThe results distance
Template Parameters
TContainerThe container type
TResultTypeThe result type

◆ SynchronousPointSynchronization()

template<typename TPointIteratorType >
static void Kratos::SearchUtilities::SynchronousPointSynchronization ( TPointIteratorType  itPointBegin,
TPointIteratorType  itPointEnd,
std::vector< double > &  rAllPointsCoordinates,
std::vector< IndexType > &  rAllPointsIds,
const DataCommunicator rDataCommunicator 
)
inlinestatic

SynchronousPointSynchronization prepares synchronously the coordinates of the points for MPI search.

Parameters
itPointBeginIterator to the beginning of the points range
itPointEndIterator to the end of the points range
rAllPointsCoordinatesvector where the computed coordinates will be stored
rAllPointsIdsThe ids of all the points (just a counter for points, and ids for nodes)
rDataCommunicatorThe data communicator
Template Parameters
TPointIteratorTypeThe type of the point iterator

◆ SynchronousPointSynchronizationWithBoundingBox()

template<typename TPointIteratorType , typename TBoundingBoxType >
static std::vector<IndexType> Kratos::SearchUtilities::SynchronousPointSynchronizationWithBoundingBox ( TPointIteratorType  itPointBegin,
TPointIteratorType  itPointEnd,
DistributedSearchInformation rSearchInfo,
const TBoundingBoxType &  rBoundingBox,
const double  ThresholdBoundingBox,
const DataCommunicator rDataCommunicator,
const bool  IndexItIsJustCounter = false 
)
inlinestatic

SynchronousPointSynchronization prepares synchronously the coordinates of the points for MPI search.

Parameters
itPointBeginIterator to the beginning of the points range.
itPointEndIterator to the end of the points range.
rSearchInfoThe class containing the result of the search.
rBoundingBoxThe bounding box considered.
ThresholdBoundingBoxThe threshold for computing is inside bounding box considered.
rDataCommunicatorThe data communicator.
IndexItIsJustCounterIf the index considered it it just a counter.
Template Parameters
TPointIteratorTypeThe type of the point iterator.
TBoundingBoxTypeThe type of the bounding box.
Returns
The ids of all points.

◆ SynchronousPointSynchronizationWithRadius()

template<typename TPointIteratorType >
static std::vector<double> Kratos::SearchUtilities::SynchronousPointSynchronizationWithRadius ( TPointIteratorType  itPointBegin,
TPointIteratorType  itPointEnd,
std::vector< double > &  rAllPointsCoordinates,
std::vector< IndexType > &  rAllPointsIds,
const std::vector< double > &  rRadius,
const DataCommunicator rDataCommunicator 
)
inlinestatic

SynchronousPointSynchronizationWithRadius prepares synchronously the coordinates of the points for MPI search including radius.

With radius

Parameters
itPointBeginIterator to the beginning of the points range
itPointEndIterator to the end of the points range
rAllPointsCoordinatesvector where the computed coordinates will be stored
rAllPointsIdsThe ids of all the points (just a counter for points, and ids for nodes)
rRadiusThe radius of the points
rDataCommunicatorThe data communicator
Returns
The resulting whole radius vector
Template Parameters
TPointIteratorTypeThe type of the point iterator

◆ SynchronousPointSynchronizationWithRecvSizes()

template<typename TPointIteratorType >
static std::vector<int> Kratos::SearchUtilities::SynchronousPointSynchronizationWithRecvSizes ( TPointIteratorType  itPointBegin,
TPointIteratorType  itPointEnd,
std::vector< double > &  rAllPointsCoordinates,
std::vector< IndexType > &  rAllPointsIds,
const DataCommunicator rDataCommunicator 
)
inlinestatic

SynchronousPointSynchronizationWithRecvSizes prepares synchronously the coordinates of the points for MPI search including the recv sizes.

With recv sizes

Parameters
itPointBeginIterator to the beginning of the points range
itPointEndIterator to the end of the points range
rAllPointsCoordinatesvector where the computed coordinates will be stored
rAllPointsIdsThe ids of all the points (just a counter for points, and ids for nodes)
rDataCommunicatorThe data communicator
Returns
The resulting whole radius vector
Template Parameters
TPointIteratorTypeThe type of the point iterator

Member Data Documentation

◆ ZeroTolerance

constexpr double Kratos::SearchUtilities::ZeroTolerance = std::numeric_limits<double>::epsilon()
staticconstexpr

Define zero tolerance as Epsilon.


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