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.
|
A bins container for 3 dimensional GeometricalObject entities. More...
#include <geometrical_objects_bins.h>
Public Member Functions | |
Life Cycle | |
template<typename TIteratorType > | |
GeometricalObjectsBins (TIteratorType GeometricalObjectsBegin, TIteratorType GeometricalObjectsEnd, const double Tolerance=1e-12) | |
The constructor with all geometries to be stored. Please note that all of them should be available at construction time and cannot be modified after. More... | |
template<typename TContainer > | |
GeometricalObjectsBins (TContainer &rGeometricalObjectsVector, const double Tolerance=1e-12) | |
The constructor with all geometries to be stored. Please note that all of them should be available at construction time and cannot be modified after. More... | |
virtual | ~GeometricalObjectsBins () |
Destructor. More... | |
Operations | |
CellType & | GetCell (const std::size_t I, const std::size_t J, const std::size_t K) |
Accessing cell_ijk giving the 3 indices. More... | |
BoundingBox< PointType > | GetCellBoundingBox (const std::size_t I, const std::size_t J, const std::size_t K) |
Calculating the cell_ijk bounding box. More... | |
void | SearchInRadius (const PointType &rPoint, const double Radius, std::vector< ResultType > &rResults) |
This method takes a point and finds all of the objects in the given radius to it. More... | |
template<typename TPointIteratorType > | |
void | SearchInRadius (TPointIteratorType itPointBegin, TPointIteratorType itPointEnd, const double Radius, std::vector< std::vector< ResultType >> &rResults) |
This method takes a point and finds all of the objects in the given radius to it (iterative version). More... | |
ResultType | SearchNearestInRadius (const PointType &rPoint, const double Radius) |
This method takes a point and finds the nearest object to it in a given radius. More... | |
template<typename TPointIteratorType > | |
std::vector< ResultType > | SearchNearestInRadius (TPointIteratorType itPointBegin, TPointIteratorType itPointEnd, const double Radius) |
This method takes a point and finds the nearest object to it in a given radius (iterative version). More... | |
ResultType | SearchNearest (const PointType &rPoint) |
This method takes a point and finds the nearest object to it. More... | |
template<typename TPointIteratorType > | |
std::vector< ResultType > | SearchNearest (TPointIteratorType itPointBegin, TPointIteratorType itPointEnd) |
This method takes a point and finds the nearest object to it (iterative version). More... | |
ResultType | SearchIsInside (const PointType &rPoint) |
This method takes a point and search if it's inside an geometrical object of the domain. More... | |
template<typename TPointIteratorType > | |
std::vector< ResultType > | SearchIsInside (TPointIteratorType itPointBegin, TPointIteratorType itPointEnd) |
This method takes a point and search if it's inside an geometrical object of the domain (iterative version). More... | |
Access | |
const BoundingBox< PointType > & | GetBoundingBox () const |
Getting the bins bounding box. More... | |
const array_1d< double, 3 > & | GetCellSizes () |
return an array with the x,y and z size of the cube More... | |
const array_1d< std::size_t, 3 > & | GetNumberOfCells () |
returns a 3D array having the number of cells in direction x, y and z More... | |
std::size_t | GetTotalNumberOfCells () |
The total number of cells in the container. 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) const |
Print object's data. More... | |
Protected Member Functions | |
Protected Life Cycle | |
GeometricalObjectsBins ()=default | |
Default constructor protected. More... | |
Protected Operations | |
bool | PointIsInsideBoundingBox (const array_1d< double, 3 > &rCoords) |
This method checks if a point is inside any bounding box of the global bounding boxes. More... | |
bool | PointIsInsideBoundingBoxWithTolerance (const array_1d< double, 3 > &rCoords, const double Tolerance) |
This method checks if a point is inside any bounding box of the global bounding boxes considering a certain tolerance. More... | |
void | CalculateCellSize (const std::size_t NumberOfCells) |
Calculate the cell sizes to be as equilateral as possible and tries to approximate (roughly) the given number of cells. More... | |
template<typename TIteratorType > | |
void | AddObjectsToCells (TIteratorType GeometricalObjectsBegin, TIteratorType GeometricalObjectsEnd) |
Adding objects to the cells that intersecting with it. More... | |
Protected Attributes | |
Protected Member Variables | |
BoundingBox< PointType > | mBoundingBox |
array_1d< std::size_t, Dimension > | mNumberOfCells |
The bounding box of the domain. More... | |
array_1d< double, 3 > | mCellSizes |
The number of cells in each direction. More... | |
array_1d< double, 3 > | mInverseOfCellSize |
The size of each cell in each direction. More... | |
std::vector< CellType > | mCells |
The inverse of the size of each cell in each direction. More... | |
double | mTolerance |
The cells of the domain. More... | |
Static Protected Attributes | |
Protected Static Member Variables | |
static constexpr unsigned int | Dimension = 3 |
Type Definitions | |
using | PointType = Point |
The point type definition. More... | |
using | ObjectType = GeometricalObject |
The type of geometrical object to be stored in the bins. More... | |
using | CellType = std::vector< GeometricalObject * > |
The type of geometrical object to be stored in the bins. More... | |
using | ResultType = SpatialSearchResult< GeometricalObject > |
KRATOS_CLASS_POINTER_DEFINITION (GeometricalObjectsBins) | |
Pointer definition of GeometricalObjectsBins. More... | |
A bins container for 3 dimensional GeometricalObject entities.
It provides efficient search in radius and search nearest methods. All of the geometries should be given at construction time. After constructing the bins the geometries cannot be modified. In case of any modification, the bins should be reconstructed.
using Kratos::GeometricalObjectsBins::CellType = std::vector<GeometricalObject*> |
The type of geometrical object to be stored in the bins.
The type of geometrical object to be stored in the bins.
The point type definition.
|
inline |
The constructor with all geometries to be stored. Please note that all of them should be available at construction time and cannot be modified after.
GeometricalObjectsBegin | The begin iterator of the geometries to be stored |
GeometricalObjectsEnd | The end iterator of the geometries to be stored |
TIteratorType | The type of the iterator |
|
inline |
The constructor with all geometries to be stored. Please note that all of them should be available at construction time and cannot be modified after.
rGeometricalObjectsVector | The geometries to be stored |
TContainer | The container type |
|
inlinevirtual |
Destructor.
|
protecteddefault |
Default constructor protected.
|
inlineprotected |
Adding objects to the cells that intersecting with it.
This method takes a geometrical object and adds it to the cells that intersecting with it.
TIteratorType | The type of the iterator of the geometrical objects |
GeometricalObjectsBegin | The begining of the geometrical objects |
GeometricalObjectsEnd | The end of the geometrical objects |
|
protected |
Calculate the cell sizes to be as equilateral as possible and tries to approximate (roughly) the given number of cells.
This method calculates the cell sizes to be as equilateral as possible and tries to approximate (roughly) the given number of cells
NumberOfCells | The number of cells to be calculated |
|
inline |
Getting the bins bounding box.
GeometricalObjectsBins::CellType & Kratos::GeometricalObjectsBins::GetCell | ( | const std::size_t | I, |
const std::size_t | J, | ||
const std::size_t | K | ||
) |
Accessing cell_ijk giving the 3 indices.
I | The index in x direction |
J | The index in y direction |
K | The index in z direction |
BoundingBox< GeometricalObjectsBins::PointType > Kratos::GeometricalObjectsBins::GetCellBoundingBox | ( | const std::size_t | I, |
const std::size_t | J, | ||
const std::size_t | K | ||
) |
Calculating the cell_ijk bounding box.
I | The index in x direction |
J | The index in y direction |
K | The index in z direction |
return an array with the x,y and z size of the cube
|
inline |
returns a 3D array having the number of cells in direction x, y and z
|
inline |
The total number of cells in the container.
|
inlinevirtual |
Turn back information as a string.
Kratos::GeometricalObjectsBins::KRATOS_CLASS_POINTER_DEFINITION | ( | GeometricalObjectsBins | ) |
Pointer definition of GeometricalObjectsBins.
|
protected |
This method checks if a point is inside any bounding box of the global bounding boxes.
rCoords | The coordinates of the point |
|
protected |
This method checks if a point is inside any bounding box of the global bounding boxes considering a certain tolerance.
rCoords | The coordinates of the point |
Tolerance | The tolerance |
|
inlinevirtual |
Print object's data.
|
inlinevirtual |
Print information about this object.
void Kratos::GeometricalObjectsBins::SearchInRadius | ( | const PointType & | rPoint, |
const double | Radius, | ||
std::vector< ResultType > & | rResults | ||
) |
This method takes a point and finds all of the objects in the given radius to it.
The result contains the object and also its distance to the point.
rPoint | The point to be checked |
Radius | The radius to be checked |
rResults | The results of the search |
|
inline |
This method takes a point and finds all of the objects in the given radius to it (iterative version).
The result contains the object and also its distance to the point.
itPointBegin | The first point iterator |
itPointEnd | The last point iterator |
Radius | The radius to be checked |
rResults | The results of the search |
TPointIteratorType | The type of the point iterator |
GeometricalObjectsBins::ResultType Kratos::GeometricalObjectsBins::SearchIsInside | ( | const PointType & | rPoint | ) |
This method takes a point and search if it's inside an geometrical object of the domain.
If it is inside an object, it returns it, and search distance is set to zero. If there is no object, the result will be set to not found. Result contains a flag is the object has been found or not. This method is a simplified and faster method of SearchNearest.
rPoint | The point to be checked |
|
inline |
This method takes a point and search if it's inside an geometrical object of the domain (iterative version).
If it is inside an object, it returns it, and search distance is set to zero. If there is no object, the result will be set to not found. Result contains a flag is the object has been found or not. This method is a simplified and faster method of SearchNearest.
itPointBegin | The first point iterator |
itPointEnd | The last point iterator |
TPointIteratorType | The type of the point iterator |
GeometricalObjectsBins::ResultType Kratos::GeometricalObjectsBins::SearchNearest | ( | const PointType & | rPoint | ) |
This method takes a point and finds the nearest object to it.
If there are more than one object in the same minimum distance only one is returned Result contains a flag is the object has been found or not.
rPoint | The point to be checked |
|
inline |
This method takes a point and finds the nearest object to it (iterative version).
If there are more than one object in the same minimum distance only one is returned Result contains a flag is the object has been found or not.
itPointBegin | The first point iterator |
itPointEnd | The last point iterator |
TPointIteratorType | The type of the point iterator |
GeometricalObjectsBins::ResultType Kratos::GeometricalObjectsBins::SearchNearestInRadius | ( | const PointType & | rPoint, |
const double | Radius | ||
) |
This method takes a point and finds the nearest object to it in a given radius.
If there are more than one object in the same minimum distance only one is returned If there are no objects in that radius the result will be set to not found. Result contains a flag is the object has been found or not.
rPoint | The point to be checked |
Radius | The radius to be checked |
|
inline |
This method takes a point and finds the nearest object to it in a given radius (iterative version).
If there are more than one object in the same minimum distance only one is returned If there are no objects in that radius the result will be set to not found. Result contains a flag is the object has been found or not.
itPointBegin | The first point iterator |
itPointEnd | The last point iterator |
Radius | The radius to be checked |
TPointIteratorType | The type of the point iterator |
|
staticconstexprprotected |
|
protected |
|
protected |
The inverse of the size of each cell in each direction.
The number of cells in each direction.
The size of each cell in each direction.
The bounding box of the domain.
|
protected |
The cells of the domain.