44 template< std::
size_t Dimension,
class Po
intType,
class IteratorType,
class CoordinateType >
50 for(std::size_t
i = 0 ;
i < Dimension ;
i++)
52 for(
IteratorType i_point = PointsBegin ; i_point < PointsEnd ; i_point++)
53 for(std::size_t
i = 0 ;
i < Dimension ;
i++)
54 Position[
i] += (**i_point)[
i];
55 for(std::size_t
i = 0 ;
i < Dimension ;
i++)
61 template< std::
size_t Dimension,
class Po
intType,
class IteratorType,
class CoordinateType >
68 for(std::size_t
i = 0 ;
i < Dimension ;
i++)
69 Position[
i] = (MaxPoint[
i] + MinPoint[
i]) * 0.500;
78 template<
class TLeafType >
80 typename TLeafType::PointType,
81 typename TLeafType::PointerType,
82 typename TLeafType::IteratorType,
83 typename TLeafType::DistanceIteratorType >
141 AverageSplit()(mPosition,MinPoint,MaxPoint,PointsBegin,PointsEnd);
151 for(
IteratorType i_point = PointsBegin ; i_point < PointsEnd ; i_point++, i_temp++)
154 IndexType child_index = GetChildIndex(**i_point);
155 cell_sizes[child_index]++;
158 cell_position[0] = PointsBegin;
161 cell_position[
i] = cell_position[
i-1];
162 std::advance(cell_position[
i], cell_sizes[
i-1]);
174 IndexType child_index = GetChildIndex(**i_point);
175 *(cell_position[child_index]++) = *i_point;
179 if(cell_sizes[0] > BucketSize)
180 mpChilds[0]=
new OCTreePartition(PointsBegin, cell_position[0], MinPoint, mPosition, BucketSize);
182 mpChilds[0]=
new LeafType(PointsBegin, cell_position[0]);
190 if(cell_sizes[
i] > BucketSize)
197 new_min_point[
j] = mPosition[
j];
198 new_max_point[
j] = MaxPoint[
j];
202 new_min_point[
j] = MinPoint[
j];
203 new_max_point[
j] = mPosition[
j];
209 new_min_point , new_max_point, BucketSize);
212 mpChilds[
i]=
new LeafType(cell_position[
i-1], cell_position[
i]);
218 void PrintData(std::ostream& rOStream, std::string
const& Perfix = std::string())
const override
220 rOStream << Perfix <<
"Partition at point (" << mPosition[0];
222 rOStream <<
"," << mPosition[
j];
223 rOStream << std::endl;
226 mpChilds[
j]->
PrintData(rOStream, Perfix +
" ");
246 SizeType child_index = GetChildIndex(ThisPoint);
250 DistanceToPartitions(child_index, ThisPoint, distances_to_partitions);
253 if((
i != child_index) && (distances_to_partitions[
i] < rResultDistance))
261 SizeType child_index = GetChildIndex(ThisPoint);
264 mpChilds[child_index]->
SearchInRadius(ThisPoint, Radius, Radius2, Results, ResultsDistances, NumberOfResults, MaxNumberOfResults);
268 DistanceToPartitions(child_index, ThisPoint, distances_to_partitions);
271 if((
i != child_index) && (distances_to_partitions[
i] < Radius2))
272 mpChilds[
i]->
SearchInRadius(ThisPoint, Radius, Radius2, Results, ResultsDistances, NumberOfResults, MaxNumberOfResults);
278 SizeType child_index = GetChildIndex(ThisPoint);
281 mpChilds[child_index]->
SearchInRadius(ThisPoint, Radius, Radius2, Results, NumberOfResults, MaxNumberOfResults);
285 DistanceToPartitions(child_index, ThisPoint, distances_to_partitions);
288 if((
i != child_index) && (distances_to_partitions[
i] < Radius2))
289 mpChilds[
i]->
SearchInRadius(ThisPoint, Radius, Radius2, Results, NumberOfResults, MaxNumberOfResults);
299 const IndexType dim_mask[] = { 1, 2, 4 };
302 if( rThisPoint[
i] >= mPosition[
i] ) child_index += dim_mask[
i];
309 const IndexType coordinate_mask[] = { 1, 2, 4 };
321 rDistances[
i] = 0.00;
323 IndexType partitions = ContainingChildIndex^
i;
327 if(coordinate_mask[
j] & partitions) rDistances[
i] += offset_from_postition[
j];
349 if (number_of_points == 0)
351 else if (number_of_points <= BucketSize)
353 return new LeafType(PointsBegin, PointsEnd);
357 return new OCTreePartition(PointsBegin, PointsEnd, LowPoint, HighPoint, BucketSize);
Short class definition.
Definition: octree.h:84
LeafType::SearchStructureType SearchStructureType
Definition: octree.h:119
OcTreeMidPointSplit< Dimension, PointType, IteratorType, CoordinateType > MidPointSplit
Definition: octree.h:117
TLeafType LeafType
Definition: octree.h:92
void SearchNearestPoint(PointType const &ThisPoint, PointerType &Result, CoordinateType &rResultDistance) override
Definition: octree.h:242
TreeNodeType::SizeType SizeType
Definition: octree.h:112
LeafType::PointerType PointerType
Definition: octree.h:102
LeafType::DistanceFunction DistanceFunction
Definition: octree.h:104
static const SizeType number_of_childs
Definition: octree.h:121
static TreeNodeType * Construct(IteratorType PointsBegin, IteratorType PointsEnd, PointType HighPoint, PointType LowPoint, SizeType BucketSize)
Definition: octree.h:342
LeafType::PointType PointType
Definition: octree.h:94
OCTreePartition(IteratorType PointsBegin, IteratorType PointsEnd, PointType const &MinPoint, PointType const &MaxPoint, SizeType BucketSize=1)
Partition constructor.
Definition: octree.h:130
void PrintData(std::ostream &rOStream, std::string const &Perfix=std::string()) const override
Definition: octree.h:218
LeafType::ContainerType ContainerType
Definition: octree.h:96
void SearchInRadius(PointType const &ThisPoint, CoordinateType const &Radius, CoordinateType const &Radius2, IteratorType &Results, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults) override
Definition: octree.h:275
LeafType::IteratorType IteratorType
Definition: octree.h:98
@ Dimension
Definition: octree.h:106
TreeNodeType::IndexType IndexType
Definition: octree.h:114
virtual ~OCTreePartition()
Destructor.
Definition: octree.h:231
void SearchInRadius(PointType const &ThisPoint, CoordinateType const &Radius, CoordinateType const &Radius2, IteratorType &Results, DistanceIteratorType &ResultsDistances, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults) override
Definition: octree.h:258
LeafType::DistanceIteratorType DistanceIteratorType
Definition: octree.h:100
KRATOS_CLASS_POINTER_DEFINITION(OCTreePartition)
Pointer definition of KDTree.
OcTreeAverageSplit< Dimension, PointType, IteratorType, CoordinateType > AverageSplit
Definition: octree.h:116
TreeNodeType::CoordinateType CoordinateType
Definition: octree.h:110
TreeNode< Dimension, PointType, PointerType, IteratorType, DistanceIteratorType > TreeNodeType
Definition: octree.h:108
void operator()(PointType &Position, PointType const &MinPoint, PointType const &MaxPoint, IteratorType const &PointsBegin, IteratorType const &PointsEnd)
Definition: octree.h:48
void operator()(PointType &Position, PointType const &MinPoint, PointType const &MaxPoint, IteratorType const &PointsBegin, IteratorType const &PointsEnd)
Definition: octree.h:65
Point class.
Definition: point.h:59
Short class definition.
Definition: tree.h:61
virtual void SearchNearestPoint(PointType const &ThisPoint, PointerType &rResult, CoordinateType &rResultDistance)
Definition: tree.h:105
virtual void SearchInRadius(PointType const &ThisPoint, CoordinateType const &Radius, CoordinateType const &Radius2, IteratorType &Results, DistanceIteratorType &ResultsDistances, SizeType &NumberOfResults, SizeType const &MaxNumberOfResults)
Definition: tree.h:110
double CoordinateType
Define CoordinateType as double.
Definition: tree.h:76
std::size_t IndexType
Define IndexType as std::size_t.
Definition: tree.h:73
std::size_t SizeType
Define SizeType as std::size_t.
Definition: tree.h:70
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
std::size_t PointerDistance(TPointerType const &PointerBegin, TPointerType const &PointerEnd)
Definition: search_structure.h:91
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Temp
Definition: PecletTest.py:105
int j
Definition: quadrature.py:648
float temp
Definition: rotating_cone.py:85
integer i
Definition: TensorModule.f:17
float factor
for node in (self.combined_model_part).Nodes: pold = node.GetSolutionStepValue(PRESSURE,...
Definition: ulf_PGLASS.py:254
Configure::IteratorType IteratorType
Definition: transfer_utility.h:249
Configure::PointType PointType
Definition: transfer_utility.h:245
Configure::ContainerType ContainerType
Definition: transfer_utility.h:247