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.
Classes | List of all members
Kratos::Tree< TPartitionType > Class Template Reference

A generic tree data structure for spatial partitioning. More...

#include <tree.h>

Collaboration diagram for Kratos::Tree< TPartitionType >:

Classes

struct  GetObjectType
 
struct  GetObjectType< T, std::void_t< typename T::ObjectType > >
 
class  Partitions
 Class to represent partitions for the tree. More...
 

Public Member Functions

Life Cycle
 Tree (IteratorType itPointsBegin, IteratorType itPointsEnd, SizeType BucketSize=1)
 Construct a new Tree object. More...
 
 Tree (IteratorType itPointsBegin, IteratorType itPointsEnd, Partitions Parts)
 Construct a new Tree object. More...
 
virtual ~Tree ()
 Destructor. More...
 
Operations
PointerType ExistPoint (PointerType const &ThisPoint, CoordinateType const Tolerance=static_cast< CoordinateType >(10.0 *DBL_EPSILON))
 Check if a point exists in the tree within a given tolerance. More...
 
PointerType SearchNearestPoint (PointType const &ThisPoint, CoordinateType &rResultDistance)
 Search for the nearest point to a given point. More...
 
PointerType SearchNearestPoint (PointType const &ThisPoint)
 Search for points within a given radius of a point. More...
 
SizeType SearchInRadius (PointType const &ThisPoint, CoordinateType Radius, IteratorType Results, DistanceIteratorType ResultsDistances, SizeType MaxNumberOfResults)
 Search for points within a given radius of a point. More...
 
SizeType SearchInRadius (PointType const &ThisPoint, CoordinateType Radius, IteratorType Results, SizeType MaxNumberOfResults)
 Search for points within a given radius of a point. More...
 
SizeType SearchInBox (PointType const &MinPointBox, PointType const &MaxPointBox, IteratorType Results, SizeType MaxNumberOfResults)
 Search for points within a given axis-aligned box. More...
 
Access
PointTypeBoundingBoxLowPoint ()
 Get a reference to the low point of the bounding box. More...
 
PointTypeBoundingBoxHighPoint ()
 Get a reference to the high point of the bounding box. More...
 
BoundingBox< PointType > & GetBoundingBox ()
 Get the bounding box. More...
 
Input and output
virtual std::string Info () const
 Turn back information as a string. More...
 
virtual void PrintInfo (std::ostream &rOStream) const
 Print information about this object. More...
 
virtual void PrintData (std::ostream &rOStream, std::string const &Perfix=std::string()) const
 Print object's data. More...
 

Type Definitions

using PartitionType = TPartitionType
 The partition type definition. More...
 
using LeafType = typename PartitionType::LeafType
 The leaf type definition. More...
 
using PointType = typename PartitionType::PointType
 The point type definition. More...
 
using IteratorType = typename PartitionType::IteratorType
 The iterator type definition. More...
 
using ObjectType = typename GetObjectType< PointType >::type
 The object type. More...
 
using DistanceIteratorType = typename PartitionType::DistanceIteratorType
 The distance iterator type definition. More...
 
using PointerType = typename PartitionType::PointerType
 The pointer type definition. More...
 
using DistanceFunction = typename PartitionType::DistanceFunction
 The distance function type definition. More...
 
using NodeType = TreeNode< Dimension, PointType, PointerType, IteratorType, DistanceIteratorType >
 The node type definition. More...
 
using CoordinateType = typename NodeType::CoordinateType
 The coordinate type definition. More...
 
using SizeType = typename NodeType::SizeType
 The size type definition. More...
 
using IndexType = typename NodeType::IndexType
 The index type definition. More...
 
using SearchStructureType = typename PartitionType::SearchStructureType
 The search structure type definition. More...
 
static constexpr std::size_t Dimension = PartitionType::Dimension
 Dimension definition. More...
 
 KRATOS_CLASS_POINTER_DEFINITION (Tree)
 Pointer definition of Tree. More...
 

Detailed Description

template<class TPartitionType>
class Kratos::Tree< TPartitionType >

A generic tree data structure for spatial partitioning.

This class implements a generic tree data structure for spatial partitioning.

Template Parameters
TPartitionTypeThe partitioning strategy type.
Author
Carlos Labra

Member Typedef Documentation

◆ CoordinateType

template<class TPartitionType >
using Kratos::Tree< TPartitionType >::CoordinateType = typename NodeType::CoordinateType

The coordinate type definition.

◆ DistanceFunction

template<class TPartitionType >
using Kratos::Tree< TPartitionType >::DistanceFunction = typename PartitionType::DistanceFunction

The distance function type definition.

◆ DistanceIteratorType

template<class TPartitionType >
using Kratos::Tree< TPartitionType >::DistanceIteratorType = typename PartitionType::DistanceIteratorType

The distance iterator type definition.

◆ IndexType

template<class TPartitionType >
using Kratos::Tree< TPartitionType >::IndexType = typename NodeType::IndexType

The index type definition.

◆ IteratorType

template<class TPartitionType >
using Kratos::Tree< TPartitionType >::IteratorType = typename PartitionType::IteratorType

The iterator type definition.

◆ LeafType

template<class TPartitionType >
using Kratos::Tree< TPartitionType >::LeafType = typename PartitionType::LeafType

The leaf type definition.

◆ NodeType

template<class TPartitionType >
using Kratos::Tree< TPartitionType >::NodeType = TreeNode<Dimension,PointType,PointerType,IteratorType,DistanceIteratorType>

The node type definition.

◆ ObjectType

template<class TPartitionType >
using Kratos::Tree< TPartitionType >::ObjectType = typename GetObjectType<PointType>::type

The object type.

◆ PartitionType

template<class TPartitionType >
using Kratos::Tree< TPartitionType >::PartitionType = TPartitionType

The partition type definition.

◆ PointerType

template<class TPartitionType >
using Kratos::Tree< TPartitionType >::PointerType = typename PartitionType::PointerType

The pointer type definition.

◆ PointType

template<class TPartitionType >
using Kratos::Tree< TPartitionType >::PointType = typename PartitionType::PointType

The point type definition.

◆ SearchStructureType

template<class TPartitionType >
using Kratos::Tree< TPartitionType >::SearchStructureType = typename PartitionType::SearchStructureType

The search structure type definition.

◆ SizeType

template<class TPartitionType >
using Kratos::Tree< TPartitionType >::SizeType = typename NodeType::SizeType

The size type definition.

Constructor & Destructor Documentation

◆ Tree() [1/2]

template<class TPartitionType >
Kratos::Tree< TPartitionType >::Tree ( IteratorType  itPointsBegin,
IteratorType  itPointsEnd,
SizeType  BucketSize = 1 
)
inline

Construct a new Tree object.

Parameters
itPointsBeginIterator to the first point
itPointsEndIterator to the last point
BucketSizeSize of the bucket

◆ Tree() [2/2]

template<class TPartitionType >
Kratos::Tree< TPartitionType >::Tree ( IteratorType  itPointsBegin,
IteratorType  itPointsEnd,
Partitions  Parts 
)
inline

Construct a new Tree object.

Parameters
itPointsBeginIterator to the first point
itPointsEndIterator to the last point
PartsThe partitions definition

◆ ~Tree()

template<class TPartitionType >
virtual Kratos::Tree< TPartitionType >::~Tree ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ BoundingBoxHighPoint()

template<class TPartitionType >
PointType& Kratos::Tree< TPartitionType >::BoundingBoxHighPoint ( )
inline

Get a reference to the high point of the bounding box.

Returns
A reference to the high point of the bounding box.

◆ BoundingBoxLowPoint()

template<class TPartitionType >
PointType& Kratos::Tree< TPartitionType >::BoundingBoxLowPoint ( )
inline

Get a reference to the low point of the bounding box.

Returns
A reference to the low point of the bounding box.

◆ ExistPoint()

template<class TPartitionType >
PointerType Kratos::Tree< TPartitionType >::ExistPoint ( PointerType const &  ThisPoint,
CoordinateType const  Tolerance = static_cast<CoordinateType>(10.0*DBL_EPSILON) 
)
inline

Check if a point exists in the tree within a given tolerance.

Parameters
ThisPointThe point to check.
ToleranceThe tolerance for proximity check.
Returns
A pointer to the existing point or a null pointer.

◆ GetBoundingBox()

template<class TPartitionType >
BoundingBox<PointType>& Kratos::Tree< TPartitionType >::GetBoundingBox ( )
inline

Get the bounding box.

This function creates a bounding box using the low and high points and returns it.

Returns
The bounding box.

◆ Info()

template<class TPartitionType >
virtual std::string Kratos::Tree< TPartitionType >::Info ( ) const
inlinevirtual

Turn back information as a string.

◆ KRATOS_CLASS_POINTER_DEFINITION()

template<class TPartitionType >
Kratos::Tree< TPartitionType >::KRATOS_CLASS_POINTER_DEFINITION ( Tree< TPartitionType >  )

Pointer definition of Tree.

◆ PrintData()

template<class TPartitionType >
virtual void Kratos::Tree< TPartitionType >::PrintData ( std::ostream &  rOStream,
std::string const &  Perfix = std::string() 
) const
inlinevirtual

Print object's data.

◆ PrintInfo()

template<class TPartitionType >
virtual void Kratos::Tree< TPartitionType >::PrintInfo ( std::ostream &  rOStream) const
inlinevirtual

Print information about this object.

◆ SearchInBox()

template<class TPartitionType >
SizeType Kratos::Tree< TPartitionType >::SearchInBox ( PointType const &  MinPointBox,
PointType const &  MaxPointBox,
IteratorType  Results,
SizeType  MaxNumberOfResults 
)
inline

Search for points within a given axis-aligned box.

Parameters
MinPointBoxThe minimum point of the bounding box.
MaxPointBoxThe maximum point of the bounding box.
ResultsIterator to store the found points.
MaxNumberOfResultsMaximum number of results to return.
Returns
The number of points found within the specified bounding box.

◆ SearchInRadius() [1/2]

template<class TPartitionType >
SizeType Kratos::Tree< TPartitionType >::SearchInRadius ( PointType const &  ThisPoint,
CoordinateType  Radius,
IteratorType  Results,
DistanceIteratorType  ResultsDistances,
SizeType  MaxNumberOfResults 
)
inline

Search for points within a given radius of a point.

Parameters
ThisPointThe center point.
RadiusThe search radius.
ResultsIterator to store the found points.
ResultsDistancesIterator to store the distances to found points.
MaxNumberOfResultsMaximum number of results to return.
Returns
The number of points found within the specified radius.

◆ SearchInRadius() [2/2]

template<class TPartitionType >
SizeType Kratos::Tree< TPartitionType >::SearchInRadius ( PointType const &  ThisPoint,
CoordinateType  Radius,
IteratorType  Results,
SizeType  MaxNumberOfResults 
)
inline

Search for points within a given radius of a point.

Parameters
ThisPointThe center point.
RadiusThe search radius.
ResultsIterator to store the found points.
MaxNumberOfResultsMaximum number of results to return.
Returns
The number of points found within the specified radius.

◆ SearchNearestPoint() [1/2]

template<class TPartitionType >
PointerType Kratos::Tree< TPartitionType >::SearchNearestPoint ( PointType const &  ThisPoint)
inline

Search for points within a given radius of a point.

Parameters
ThisPointThe center point.
RadiusThe search radius.
ResultsIterator to store the found points.
ResultsDistancesIterator to store the distances to found points.
MaxNumberOfResultsMaximum number of results to return.
Returns
The number of points found within the specified radius.

◆ SearchNearestPoint() [2/2]

template<class TPartitionType >
PointerType Kratos::Tree< TPartitionType >::SearchNearestPoint ( PointType const &  ThisPoint,
CoordinateType rResultDistance 
)
inline

Search for the nearest point to a given point.

Parameters
ThisPointThe point for which to find the nearest point.
Returns
A pointer to the nearest point.

Member Data Documentation

◆ Dimension

template<class TPartitionType >
constexpr std::size_t Kratos::Tree< TPartitionType >::Dimension = PartitionType::Dimension
staticconstexpr

Dimension definition.


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