9 #if !defined(KRATOS_OMP_DEM_SEARCH_H_INCLUDED )
10 #define KRATOS_OMP_DEM_SEARCH_H_INCLUDED
38 #define KRATOS_TIMER_START(t) Timer::Start(t);
39 #define KRATOS_TIMER_STOP(t) Timer::Stop(t);
41 #define KRATOS_TIMER_START(t)
42 #define KRATOS_TIMER_STOP(t)
111 OMP_DEMSearch(
const double domain_min_x = 0.0,
const double domain_min_y = 0.0,
const double domain_min_z = 0.0,
112 const double domain_max_x = -1.0,
const double domain_max_y = -1.0,
const double domain_max_z = -1.0)
188 int MaxNumberOfElements = rStructureElements.size();
196 DistanceType localResultsDistances(MaxNumberOfElements);
197 std::size_t NumberOfResults = 0;
199 #pragma omp for schedule(dynamic, 100)
200 for (
int i = 0; i < static_cast<int>(elements_array.size()); ++
i){
201 ResultElementsContainerType::iterator ResultsPointer = localResults.begin();
202 DistanceType::iterator ResultsDistancesPointer = localResultsDistances.begin();
207 NumberOfResults = p_bins->SearchObjectsInRadiusExclusive(elements_array[
i],
radius,ResultsPointer,ResultsDistancesPointer,MaxNumberOfElements);
209 rResults[
i].insert(rResults[
i].begin(),localResults.begin(),localResults.begin()+NumberOfResults);
210 rResultsDistance[
i].insert(rResultsDistance[
i].begin(),localResultsDistances.begin(),localResultsDistances.begin()+NumberOfResults);
226 int MaxNumberOfElements = rStructureElements.size();
235 DistanceType localResultsDistances(MaxNumberOfElements);
236 std::size_t NumberOfResults = 0;
239 for (
int i = 0; i < static_cast<int>(elements_array.size()); ++
i){
240 ResultElementsContainerType::iterator ResultsPointer = localResults.begin();
241 DistanceType::iterator ResultsDistancesPointer = localResultsDistances.begin();
246 NumberOfResults = p_bins->SearchObjectsInRadius(elements_array[
i],
radius,ResultsPointer,ResultsDistancesPointer,MaxNumberOfElements);
248 rResults[
i].insert(rResults[
i].begin(),localResults.begin(),localResults.begin()+NumberOfResults);
249 rResultsDistance[
i].insert(rResultsDistance[
i].begin(),localResultsDistances.begin(),localResultsDistances.begin()+NumberOfResults);
264 int MaxNumberOfElements = rStructureElements.size();
273 std::size_t NumberOfResults = 0;
276 for (
int i = 0; i < static_cast<int>(elements_array.size()); ++
i){
277 ResultElementsContainerType::iterator ResultsPointer = localResults.begin();
281 NumberOfResults = p_bins->SearchObjectsInRadiusExclusive(elements_array[
i],
radius,ResultsPointer,MaxNumberOfElements);
283 rResults[
i].insert(rResults[
i].begin(),localResults.begin(),localResults.begin()+NumberOfResults);
298 int MaxNumberOfElements = rStructureElements.size();
303 BinsType bins(elements_ModelPart.begin(), elements_ModelPart.end());
308 std::size_t NumberOfResults = 0;
311 for (
int i = 0; i < static_cast<int>(elements_array.size()); ++
i){
312 ResultElementsContainerType::iterator ResultsPointer = localResults.begin();
319 rResults[
i].insert(rResults[
i].begin(),localResults.begin(),localResults.begin()+NumberOfResults);
335 int MaxNumberOfNodes = rNodes.size();
347 std::size_t NumberOfResults = 0;
350 for (
int i = 0; i < static_cast<int>(nodes_array.size()); ++
i){
351 ResultNodesContainerType::iterator ResultsPointer = localResults.begin();
352 DistanceType::iterator ResultsDistancesPointer = localResultsDistances.begin();
354 NumberOfResults = p_bins->SearchObjectsInRadiusExclusive(nodes_array[
i], Radius[
i], ResultsPointer, ResultsDistancesPointer, MaxNumberOfNodes);
355 rResults[
i].insert(rResults[
i].begin(),localResults.begin(),localResults.begin()+NumberOfResults);
356 rResultsDistance[
i].insert(rResultsDistance[
i].begin(),localResultsDistances.begin(),localResultsDistances.begin()+NumberOfResults);
372 int MaxNumberOfNodes = rStructureNodes.size();
377 NodeBinsType bins(nodes_ModelPart.begin(), nodes_ModelPart.end());
383 std::size_t NumberOfResults = 0;
386 for (
int i = 0; i < static_cast<int>(nodes_array.size()); ++
i){
387 ResultNodesContainerType::iterator ResultsPointer = localResults.begin();
388 DistanceType::iterator ResultsDistancesPointer = localResultsDistances.begin();
390 NumberOfResults = bins.
SearchObjectsInRadius(nodes_array[
i],Radius[
i],ResultsPointer,ResultsDistancesPointer,MaxNumberOfNodes);
392 rResults[
i].insert(rResults[
i].begin(),localResults.begin(),localResults.begin()+NumberOfResults);
393 rResultsDistance[
i].insert(rResultsDistance[
i].begin(),localResultsDistances.begin(),localResultsDistances.begin()+NumberOfResults);
408 int MaxNumberOfNodes = rStructureNodes.size();
413 NodeBinsType bins(nodes_ModelPart.begin(), nodes_ModelPart.end());
418 std::size_t NumberOfResults = 0;
421 for (
int i = 0; i < static_cast<int>(nodes_array.size()); ++
i){
422 ResultNodesContainerType::iterator ResultsPointer = localResults.begin();
426 rResults[
i].insert(rResults[
i].begin(),localResults.begin(),localResults.begin()+NumberOfResults);
441 int MaxNumberOfNodes = rStructureNodes.size();
446 NodeBinsType bins(nodes_ModelPart.begin(), nodes_ModelPart.end());
451 std::size_t NumberOfResults = 0;
454 for (
int i = 0; i < static_cast<int>(nodes_array.size()); ++
i){
455 ResultNodesContainerType::iterator ResultsPointer = localResults.begin();
459 rResults[
i].insert(rResults[
i].begin(),localResults.begin(),localResults.begin()+NumberOfResults);
475 int MaxNumberOfElements = rStructureElements.size();
483 SearElementPointerToGeometricalObjecPointerTemporalVector.reserve(elements_sear.size());
484 BinsElementPointerToGeometricalObjecPointerTemporalVector.reserve(elements_bins.size());
486 for (ElementsContainerType::ContainerType::iterator it = elements_bins.begin(); it != elements_bins.end(); it++)
487 BinsElementPointerToGeometricalObjecPointerTemporalVector.push_back(*it);
489 for (ConditionsContainerType::ContainerType::iterator it = elements_sear.begin(); it != elements_sear.end(); it++)
490 SearElementPointerToGeometricalObjecPointerTemporalVector.push_back(*it);
492 GeometricalBinsType bins(BinsElementPointerToGeometricalObjecPointerTemporalVector.begin(), BinsElementPointerToGeometricalObjecPointerTemporalVector.end());
497 DistanceType localResultsDistances(MaxNumberOfElements);
498 std::size_t NumberOfResults = 0;
501 for (
int i = 0; i < static_cast<int>(elements_sear.size()); ++
i){
503 DistanceType::iterator ResultsDistancesPointer = localResultsDistances.begin();
505 NumberOfResults = bins.
SearchObjectsInRadiusExclusive(SearElementPointerToGeometricalObjecPointerTemporalVector[
i],Radius[
i],ResultsPointer,ResultsDistancesPointer,MaxNumberOfElements);
507 rResults[
i].reserve(NumberOfResults);
511 Condition::Pointer elem = dynamic_pointer_cast<Condition>(*it);
512 rResults[
i].push_back(elem);
513 rResultsDistance[
i].insert(rResultsDistance[
i].begin(),localResultsDistances.begin(),localResultsDistances.begin()+NumberOfResults);
530 int MaxNumberOfElements = rStructureElements.size();
538 SearElementPointerToGeometricalObjecPointerTemporalVector.reserve(elements_sear.size());
539 BinsElementPointerToGeometricalObjecPointerTemporalVector.reserve(elements_bins.size());
541 for (ElementsContainerType::ContainerType::iterator it = elements_bins.begin(); it != elements_bins.end(); it++)
542 BinsElementPointerToGeometricalObjecPointerTemporalVector.push_back(*it);
544 for (ConditionsContainerType::ContainerType::iterator it = elements_sear.begin(); it != elements_sear.end(); it++)
545 SearElementPointerToGeometricalObjecPointerTemporalVector.push_back(*it);
547 GeometricalBinsType bins(BinsElementPointerToGeometricalObjecPointerTemporalVector.begin(), BinsElementPointerToGeometricalObjecPointerTemporalVector.end());
552 DistanceType localResultsDistances(MaxNumberOfElements);
553 std::size_t NumberOfResults = 0;
556 for (
int i = 0; i < static_cast<int>(elements_sear.size()); ++
i){
558 DistanceType::iterator ResultsDistancesPointer = localResultsDistances.begin();
560 NumberOfResults = bins.
SearchObjectsInRadius(SearElementPointerToGeometricalObjecPointerTemporalVector[
i],Radius[
i],ResultsPointer,ResultsDistancesPointer,MaxNumberOfElements);
562 rResults[
i].reserve(NumberOfResults);
566 Condition::Pointer elem = dynamic_pointer_cast<Condition>(*it);
567 rResults[
i].push_back(elem);
568 rResultsDistance[
i].insert(rResultsDistance[
i].begin(),localResultsDistances.begin(),localResultsDistances.begin()+NumberOfResults);
585 int MaxNumberOfElements = rStructureElements.size();
593 SearElementPointerToGeometricalObjecPointerTemporalVector.reserve(elements_sear.size());
594 BinsElementPointerToGeometricalObjecPointerTemporalVector.reserve(elements_bins.size());
596 for (ElementsContainerType::ContainerType::iterator it = elements_sear.begin(); it != elements_sear.end(); it++)
597 SearElementPointerToGeometricalObjecPointerTemporalVector.push_back(*it);
599 for (ConditionsContainerType::ContainerType::iterator it = elements_bins.begin(); it != elements_bins.end(); it++)
600 BinsElementPointerToGeometricalObjecPointerTemporalVector.push_back(*it);
602 GeometricalBinsType bins(BinsElementPointerToGeometricalObjecPointerTemporalVector.begin(), BinsElementPointerToGeometricalObjecPointerTemporalVector.end());
607 DistanceType localResultsDistances(MaxNumberOfElements);
608 std::size_t NumberOfResults = 0;
611 for (
int i = 0; i < static_cast<int>(elements_sear.size()); ++
i){
613 DistanceType::iterator ResultsDistancesPointer = localResultsDistances.begin();
615 NumberOfResults = bins.
SearchObjectsInRadiusExclusive(SearElementPointerToGeometricalObjecPointerTemporalVector[
i],Radius[
i],ResultsPointer,ResultsDistancesPointer,MaxNumberOfElements);
617 rResults[
i].reserve(NumberOfResults);
621 Element::Pointer elem = dynamic_pointer_cast<Element>(*it);
622 rResults[
i].push_back(elem);
623 rResultsDistance[
i].insert(rResultsDistance[
i].begin(),localResultsDistances.begin(),localResultsDistances.begin()+NumberOfResults);
640 int MaxNumberOfElements = rStructureElements.size();
648 SearElementPointerToGeometricalObjecPointerTemporalVector.reserve(elements_sear.size());
649 BinsElementPointerToGeometricalObjecPointerTemporalVector.reserve(elements_bins.size());
651 for (ElementsContainerType::ContainerType::iterator it = elements_sear.begin(); it != elements_sear.end(); it++)
652 SearElementPointerToGeometricalObjecPointerTemporalVector.push_back(*it);
654 for (ConditionsContainerType::ContainerType::iterator it = elements_bins.begin(); it != elements_bins.end(); it++)
655 BinsElementPointerToGeometricalObjecPointerTemporalVector.push_back(*it);
657 GeometricalBinsType bins(BinsElementPointerToGeometricalObjecPointerTemporalVector.begin(), BinsElementPointerToGeometricalObjecPointerTemporalVector.end());
662 DistanceType localResultsDistances(MaxNumberOfElements);
663 std::size_t NumberOfResults = 0;
666 for (
int i = 0; i < static_cast<int>(elements_sear.size()); ++
i){
668 DistanceType::iterator ResultsDistancesPointer = localResultsDistances.begin();
670 NumberOfResults = bins.
SearchObjectsInRadius(SearElementPointerToGeometricalObjecPointerTemporalVector[
i],Radius[
i],ResultsPointer,ResultsDistancesPointer,MaxNumberOfElements);
672 rResults[
i].reserve(NumberOfResults);
676 Element::Pointer elem = dynamic_pointer_cast<Element>(*it);
677 rResults[
i].push_back(elem);
678 rResultsDistance[
i].insert(rResultsDistance[
i].begin(),localResultsDistances.begin(),localResultsDistances.begin()+NumberOfResults);
701 virtual std::string
Info()
const override
703 std::stringstream buffer;
704 buffer <<
"OpenMPDemSearch" ;
710 virtual void PrintInfo(std::ostream& rOStream)
const override {rOStream <<
"OpenMPDemSearch";}
713 virtual void PrintData(std::ostream& rOStream)
const override {}
792 return std::unique_ptr<BinsType>(
new BinsTypePeriodic(r_model_part_container.begin(), r_model_part_container.end(), this->mDomainMin, this->mDomainMax));
796 return std::unique_ptr<BinsType>(
new BinsType(r_model_part_container.begin(), r_model_part_container.end()));
803 return std::unique_ptr<NodeBinsType>(
new NodeBinsTypePeriodic(r_model_part_container.begin(), r_model_part_container.end(), this->mDomainMin, this->mDomainMax));
807 return std::unique_ptr<NodeBinsType>(
new NodeBinsType(r_model_part_container.begin(), r_model_part_container.end()));
Short class definition.
Definition: bins_dynamic_objects.h:57
SizeType SearchObjectsInRadius(PointerType &ThisObject, const double &Radius, ResultIteratorType &Results)
Definition: bins_dynamic_objects.h:301
virtual SizeType SearchObjectsInRadiusExclusive(PointerType &ThisObject, const double &Radius, ResultIteratorType &Results)
Definition: bins_dynamic_objects.h:368
Short class definition.
Definition: bins_dynamic_objects_periodic.h:49
Definition: dem_search.h:132
bool mDomainPeriodicity
Definition: dem_search.h:367
Definition: discrete_particle_configure.h:46
Short class definition.
Definition: omp_dem_search.h:72
void SearchNodesInRadiusInclusiveImplementation(NodesContainerType const &rStructureNodes, NodesContainerType const &rNodes, const RadiusArrayType &Radius, VectorResultNodesContainerType &rResults, VectorDistanceType &rResultsDistance)
Definition: omp_dem_search.h:363
PointType * PtrPointType
Definition: omp_dem_search.h:80
void SearchElementsInRadiusExclusiveImplementation(ElementsContainerType const &rStructureElements, ElementsContainerType const &rElements, const RadiusArrayType &Radius, VectorResultElementsContainerType &rResults, VectorDistanceType &rResultsDistance)
Definition: omp_dem_search.h:131
void SearchGeometricalInRadiusExclusiveImplementation(ElementsContainerType const &rStructureElements, ConditionsContainerType const &rElements, const RadiusArrayType &Radius, VectorResultConditionsContainerType &rResults, VectorDistanceType &rResultsDistance)
Definition: omp_dem_search.h:466
NodeConfigure< 3 > NodeConfigureType
Definition: omp_dem_search.h:89
BinsObjectDynamic< ElementConfigureType > BinsType
Definition: omp_dem_search.h:93
double * DistanceVector
Definition: omp_dem_search.h:84
void SearchGeometricalInRadiusInclusiveImplementation(ConditionsContainerType const &rStructureElements, ElementsContainerType const &rElements, const RadiusArrayType &Radius, VectorResultElementsContainerType &rResults, VectorDistanceType &rResultsDistance)
Definition: omp_dem_search.h:631
DiscreteParticleConfigure< 3 > ElementConfigureType
Definition: omp_dem_search.h:88
void SearchGeometricalInRadiusExclusiveImplementation(ConditionsContainerType const &rStructureElements, ElementsContainerType const &rElements, const RadiusArrayType &Radius, VectorResultElementsContainerType &rResults, VectorDistanceType &rResultsDistance)
Definition: omp_dem_search.h:576
KRATOS_CLASS_POINTER_DEFINITION(OMP_DEMSearch)
Pointer definition of OMP_DEMSearch.
BinsObjectDynamic< GeometricalConfigureType > GeometricalBinsType
Definition: omp_dem_search.h:99
BinsObjectDynamicPeriodic< NodeConfigureType > NodeBinsTypePeriodic
Definition: omp_dem_search.h:97
double * DistanceIterator
Definition: omp_dem_search.h:85
GeometricalConfigure< 3 > GeometricalConfigureType
Definition: omp_dem_search.h:90
std::vector< PtrPointType >::iterator PointIterator
Definition: omp_dem_search.h:82
void SearchElementsInRadiusInclusiveImplementation(ElementsContainerType const &rStructureElements, ElementsContainerType const &rElements, const RadiusArrayType &Radius, VectorResultElementsContainerType &rResults)
Definition: omp_dem_search.h:290
virtual void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: omp_dem_search.h:710
BinsObjectDynamicPeriodic< ElementConfigureType > BinsTypePeriodic
Definition: omp_dem_search.h:94
void SearchNodesInRadiusExclusiveImplementation(NodesContainerType const &rStructureNodes, NodesContainerType const &rNodes, const RadiusArrayType &Radius, VectorResultNodesContainerType &rResults, VectorDistanceType &rResultsDistance)
Definition: omp_dem_search.h:326
virtual std::string Info() const override
Turn back information as a string.
Definition: omp_dem_search.h:701
std::unique_ptr< NodeBinsType > NodeBinsUniquePointerType
Definition: omp_dem_search.h:98
void SearchNodesInRadiusInclusiveImplementation(NodesContainerType const &rStructureNodes, NodesContainerType const &rNodes, const RadiusArrayType &Radius, VectorResultNodesContainerType &rResults)
Definition: omp_dem_search.h:433
OMP_DEMSearch(const double domain_min_x=0.0, const double domain_min_y=0.0, const double domain_min_z=0.0, const double domain_max_x=-1.0, const double domain_max_y=-1.0, const double domain_max_z=-1.0)
Default constructor.
Definition: omp_dem_search.h:111
void SearchElementsInRadiusExclusiveImplementation(ElementsContainerType const &rStructureElements, ElementsContainerType const &rElements, const RadiusArrayType &Radius, VectorResultElementsContainerType &rResults)
Definition: omp_dem_search.h:256
void SearchGeometricalInRadiusInclusiveImplementation(ElementsContainerType const &rStructureElements, ConditionsContainerType const &rElements, const RadiusArrayType &Radius, VectorResultConditionsContainerType &rResults, VectorDistanceType &rResultsDistance)
Definition: omp_dem_search.h:521
std::vector< PtrPointType > * PointVector
Definition: omp_dem_search.h:81
BinsObjectDynamic< NodeConfigureType > NodeBinsType
Definition: omp_dem_search.h:96
PointerVectorSet< GeometricalObject, IndexedObject > GeometricalObjectType
Definition: omp_dem_search.h:102
void SearchElementsInRadiusInclusiveImplementation(ElementsContainerType const &rStructureElements, ElementsContainerType const &rElements, const RadiusArrayType &Radius, VectorResultElementsContainerType &rResults, VectorDistanceType &rResultsDistance)
Definition: omp_dem_search.h:217
virtual void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: omp_dem_search.h:713
std::unique_ptr< BinsType > BinsUniquePointerType
Definition: omp_dem_search.h:95
void SearchNodesInRadiusExclusiveImplementation(NodesContainerType const &rStructureNodes, NodesContainerType const &rNodes, const RadiusArrayType &Radius, VectorResultNodesContainerType &rResults)
Definition: omp_dem_search.h:400
~OMP_DEMSearch()
Destructor.
Definition: omp_dem_search.h:118
Point class.
Definition: point.h:59
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: pointer_vector_set.h:95
TContainerType ContainerType
Definition: pointer_vector_set.h:90
std::vector< ResultConditionsContainerType > VectorResultConditionsContainerType
Definition: spatial_search.h:92
std::vector< double > RadiusArrayType
Input/output types.
Definition: spatial_search.h:95
std::vector< DistanceType > VectorDistanceType
Definition: spatial_search.h:97
std::vector< ResultNodesContainerType > VectorResultNodesContainerType
Definition: spatial_search.h:82
ModelPart::NodesContainerType NodesContainerType
Nodes classes.
Definition: spatial_search.h:80
ModelPart::ElementsContainerType ElementsContainerType
Elements classes.
Definition: spatial_search.h:85
ModelPart::ConditionsContainerType ConditionsContainerType
Conditions classes.
Definition: spatial_search.h:90
NodesContainerType::ContainerType ResultNodesContainerType
Definition: spatial_search.h:81
std::vector< ResultElementsContainerType > VectorResultElementsContainerType
Definition: spatial_search.h:87
ElementsContainerType::ContainerType ResultElementsContainerType
Definition: spatial_search.h:86
std::vector< double > DistanceType
Definition: spatial_search.h:96
Definition: spheric_particle.h:31
virtual double GetSearchRadius()
Definition: spheric_particle.cpp:2201
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
float radius
Definition: mesh_to_mdpa_converter.py:18
integer i
Definition: TensorModule.f:17
Configure::ContainerType ContainerType
Definition: transfer_utility.h:247