Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core][MPI] Adding SpecializedSpatialSearchMPI class, which provides MPI interface to SpecializedSpatialSearch #11305

Closed
wants to merge 183 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
ef88961
WIP
loumalouomega May 26, 2023
9bad4a6
Improve
loumalouomega May 26, 2023
986580c
Extend
loumalouomega May 26, 2023
d31ff1d
More advances
loumalouomega May 26, 2023
00e8287
Adding test for spatial search result
loumalouomega May 29, 2023
7e4126b
Adding missing == operator
loumalouomega May 29, 2023
eaa9db0
Missing
loumalouomega May 29, 2023
56e1c6d
Adding getting methods
loumalouomega May 29, 2023
0a56c93
WIP test
loumalouomega May 29, 2023
c176b7e
Adding getting methods
loumalouomega May 29, 2023
a4d965b
WIP test
loumalouomega May 29, 2023
5823e0f
Adding accessing methods
loumalouomega May 29, 2023
d268863
WIP test
loumalouomega May 29, 2023
f72970b
Clear distances
loumalouomega May 29, 2023
eca2e1f
Clear distances
loumalouomega May 29, 2023
147fe2e
Fix memmory leak
loumalouomega May 29, 2023
0f983c9
Clear TODO
loumalouomega May 29, 2023
af73855
Adding Clear method
loumalouomega May 29, 2023
d1cca79
Adding Clear method
loumalouomega May 29, 2023
414d523
Adding test for SynchronizeAll
loumalouomega May 29, 2023
3573b0b
Adding test SpatialSearchResultContainerGetResultShapeFunctions
loumalouomega May 29, 2023
9bc8179
Extend tests
loumalouomega May 30, 2023
4dea51a
Extend tests
loumalouomega May 30, 2023
f124196
Adding MPI tests
loumalouomega May 30, 2023
6604b83
Expose to python
loumalouomega May 30, 2023
1a61ba5
Merge branch 'master' into core/mpi/spatial-search-container
loumalouomega May 30, 2023
3b6956b
Extend tests and python interface
loumalouomega May 30, 2023
dff6ab9
Adapting to new structure
loumalouomega May 30, 2023
2498e1d
Update test (WIP)
loumalouomega May 30, 2023
d4e3e99
Update definitions
loumalouomega May 30, 2023
dfffd9c
Update definition
loumalouomega May 30, 2023
2c92fd0
Update test
loumalouomega May 30, 2023
63d035c
Checking in container
loumalouomega May 31, 2023
40bea6c
Merge branch 'master' into core/mpi/spatial-search-container
loumalouomega May 31, 2023
a8d5f98
Adding iterators
loumalouomega May 31, 2023
fa21f83
Rename tests
loumalouomega May 31, 2023
407a326
New methods for SpatialSearchResult
loumalouomega May 17, 2023
259cabb
Fix include
loumalouomega May 31, 2023
9387547
Fix comparisons integers
loumalouomega May 31, 2023
485cf4b
Missing static_cast
loumalouomega May 31, 2023
217d605
Consistency
loumalouomega May 31, 2023
fb5481b
Not technmically a typo, but changed
loumalouomega May 31, 2023
c7d082c
Correction
loumalouomega May 31, 2023
269f067
Minor
loumalouomega May 31, 2023
fb5fa27
Improve operators
loumalouomega May 31, 2023
ac37cc9
Merge branch 'master' into core/mpi/spatial-search-container
loumalouomega Jun 1, 2023
10f6b6d
Suggestion
loumalouomega Jun 1, 2023
8f9ced9
Adding IsObjectFound
loumalouomega Jun 1, 2023
26662de
Consistency
loumalouomega Jun 1, 2023
e3cd60b
Update test
loumalouomega Jun 1, 2023
72fc5d8
More test update
loumalouomega Jun 1, 2023
9b95a0e
Adding virtual
loumalouomega Jun 1, 2023
ef19251
Merge master
loumalouomega Jun 1, 2023
dc0e7f2
Merge branch 'master' into core/mpi/spatial-search-container
loumalouomega Jun 1, 2023
4683903
Extend test
loumalouomega Jun 2, 2023
7a84b90
Update check
loumalouomega Jun 2, 2023
47517bb
Update checks
loumalouomega Jun 2, 2023
442cf14
Adding local BB check
loumalouomega Jun 2, 2023
ca61a70
Minor fix
loumalouomega Jun 2, 2023
465b240
Update constructor of ParallelFillCommunciator
loumalouomega Jun 2, 2023
6473758
Adding flag
loumalouomega Jun 2, 2023
8130d62
Adding `SynchronizeAll` to `SpatialSearchResultContainerMap`
loumalouomega Jun 2, 2023
0c88214
Fix tolerance
loumalouomega Jun 2, 2023
194b9e7
Minor comment
loumalouomega Jun 2, 2023
3f36191
Merge branch 'master' into core/mpi/spatial-search-container
loumalouomega Jun 5, 2023
7310310
Adding new method to `AddResult`
loumalouomega Jun 5, 2023
b7a66e0
Instantioate for `Node` too
loumalouomega Jun 5, 2023
ebb394b
Reactivate for node
loumalouomega Jun 5, 2023
a80cf0d
Merge branch 'master' into core/mpi/spatial-search-container
loumalouomega Jun 6, 2023
90c4b76
[Core] Reduce code duplication in python binding
loumalouomega Jun 6, 2023
7ab7fa5
Minor
loumalouomega Jun 6, 2023
e000bd4
Adding Global distances
loumalouomega Jun 6, 2023
0862c27
Move to cpp
loumalouomega Jun 6, 2023
8154bf9
Extend `AddResult` method
loumalouomega Jun 6, 2023
649ef96
Extend API
loumalouomega Jun 7, 2023
2f745cf
Extend `SpatialSearch`
loumalouomega Jun 7, 2023
24a100d
Expose to python
loumalouomega Jun 7, 2023
3f0c0e1
Rename method
loumalouomega Jun 7, 2023
8135d6b
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 7, 2023
69b0ca9
WIP test container interface
loumalouomega Jun 7, 2023
17346c8
Merge branch 'core/mpi/specialized-spatial-search-mpi' of https://git…
loumalouomega Jun 7, 2023
6fe5b0a
Missing return
loumalouomega Jun 7, 2023
27f3b34
Acess method
loumalouomega Jun 7, 2023
7dde2a2
Fix python binding
loumalouomega Jun 7, 2023
00c3754
Adding print method
loumalouomega Jun 8, 2023
3b0d17f
Adding << operator
loumalouomega Jun 8, 2023
54a6499
Minor revert
loumalouomega Jun 8, 2023
569c60d
Minor
loumalouomega Jun 8, 2023
bafed25
Missing references
loumalouomega Jun 8, 2023
9a16cd6
Update the test
loumalouomega Jun 8, 2023
78ddf55
Standard PrintObject
loumalouomega Jun 8, 2023
9050247
[Core] Extend definitions from `define_python`, adding `VectorToPyLis…
loumalouomega Jun 8, 2023
9dfc683
Moving methods
loumalouomega Jun 8, 2023
7158b9b
Remve unused
loumalouomega Jun 8, 2023
8d8fb70
Automatic conversion
loumalouomega Jun 8, 2023
eaad518
Revert "[Core] Extend definitions from `define_python`, adding `Vecto…
loumalouomega Jun 8, 2023
96c9504
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 8, 2023
048653e
[Core][MPI] Initial add of `MPISearchUtilities`
loumalouomega Jun 8, 2023
7fcb68b
Adding tests for MPISearchUtilities
loumalouomega Jun 9, 2023
fe5e8ee
Fix sync issue
loumalouomega Jun 9, 2023
05df220
Windows fix?
loumalouomega Jun 9, 2023
9f39294
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 9, 2023
1a24e03
[Core][MPI] Adding required files for `AddMPISearchStrategiesToPython`
loumalouomega Jun 9, 2023
42374e8
Another try to fix Windows compilation
loumalouomega Jun 9, 2023
2a2a804
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 9, 2023
0fd3ee3
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 12, 2023
0e5e6cd
Merge master
loumalouomega Jun 12, 2023
6ff9b92
Adding missing Reserve method
loumalouomega Jun 14, 2023
202fbff
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 14, 2023
4300bac
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 15, 2023
a9345b3
Direct points methods
loumalouomega Jun 15, 2023
7b45f41
Expose to python
loumalouomega Jun 15, 2023
b572c41
Update test
loumalouomega Jun 15, 2023
71dac60
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 15, 2023
7b8c8c9
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 19, 2023
3b71c9e
WIP
loumalouomega Jun 15, 2023
f556a3a
Minor
loumalouomega Jun 19, 2023
5806ed3
[Core] Moving more BB methods to `SearchUtilities`
loumalouomega Jun 19, 2023
7ae7741
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 19, 2023
2b61802
Moving to source
loumalouomega Jun 19, 2023
b82067a
Adding `MPISynchronousPointSynchronizationWithDistances`
loumalouomega Jun 19, 2023
3c90e33
More WIP
loumalouomega Jun 19, 2023
c01ade3
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 20, 2023
2efe204
Partial revert
loumalouomega Jun 20, 2023
91a83a5
Correct comment
loumalouomega Jun 20, 2023
56d804a
Rename method
loumalouomega Jun 20, 2023
9c0cfd8
Cleaning unused
loumalouomega Jun 20, 2023
caf4c12
Using parallel utilities
loumalouomega Jun 20, 2023
cca0743
Add synchhronize flag
loumalouomega Jun 20, 2023
c55937a
Many advances
loumalouomega Jun 20, 2023
a47cff1
More methods
loumalouomega Jun 20, 2023
1c9eb9f
[Core] Reduce code duplication in python register
loumalouomega Jun 20, 2023
9e3f834
Reduce code duplication
loumalouomega Jun 20, 2023
7a67788
[Core] Missing test to be register in `test_KratosCore`
loumalouomega Jun 20, 2023
e7ead33
Register MPI tests
loumalouomega Jun 20, 2023
2d062b5
New class
loumalouomega Jun 20, 2023
3bcb1ee
Missing variable
loumalouomega Jun 20, 2023
0d7e548
Merge master
loumalouomega Jun 21, 2023
e8c80d4
Merge branch 'core/mpi/specialized-spatial-search-mpi' of https://git…
loumalouomega Jun 21, 2023
d6cfa65
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 21, 2023
d510cfe
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 21, 2023
a0786f3
More methods override
loumalouomega Jun 21, 2023
681067f
Rename method
loumalouomega Jun 21, 2023
a522e53
New method to more flexibility
loumalouomega Jun 21, 2023
ab956f8
Update method calls
loumalouomega Jun 21, 2023
b17a751
Missing check
loumalouomega Jun 21, 2023
a6c6e1a
Missing implementations
loumalouomega Jun 21, 2023
9cb3342
Minor refactor test
loumalouomega Jun 21, 2023
33bf6e5
Refactor test
loumalouomega Jun 21, 2023
7f33f31
Typo (well, a bug)
loumalouomega Jun 21, 2023
4e255f3
Minor
loumalouomega Jun 21, 2023
a67eeee
[Core] Adding initialization BB methods that may be required in deriv…
loumalouomega Jun 22, 2023
ab8fd88
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 22, 2023
4d09f31
Using new methods
loumalouomega Jun 22, 2023
72534e4
Using local meshes
loumalouomega Jun 22, 2023
ee1c79b
Simplify
loumalouomega Jun 22, 2023
0ab8827
Missing methods to register
loumalouomega Jun 22, 2023
7176478
Missing proper definitions of methods
loumalouomega Jun 22, 2023
4d7e34d
Missing cleaning
loumalouomega Jun 9, 2023
a49e4ed
Avoid ModelPart dependency
loumalouomega Jun 9, 2023
8f7b9d5
Merge master
loumalouomega Jun 22, 2023
1eaf8fd
Typo
loumalouomega Jun 22, 2023
c1eb96e
Making CLang compiler happy with override (a priori not required)
loumalouomega Jun 22, 2023
1e4225e
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 25, 2023
a482be4
Adding new methods
loumalouomega Jun 25, 2023
2c520be
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jun 29, 2023
8615995
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jul 12, 2023
618c271
Remove duplicated definition
loumalouomega Jul 12, 2023
598b792
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jul 17, 2023
a413c8a
Minor fix
loumalouomega Jul 17, 2023
dfbed90
Refactor block
loumalouomega Jul 17, 2023
05cb446
Better name
loumalouomega Jul 17, 2023
9bbf37f
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jul 17, 2023
a8e8daa
Additional refactor
loumalouomega Jul 17, 2023
09ecc48
Suggested refactored code
loumalouomega Jul 17, 2023
172fe86
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jul 18, 2023
37210bd
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jul 20, 2023
f562e6b
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Jul 20, 2023
bfc64c9
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Aug 21, 2023
7cddcd5
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Aug 23, 2023
d1df14a
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Aug 31, 2023
e197eb0
Fix macros tests
loumalouomega Aug 31, 2023
cd30718
Merge branch 'master' into core/mpi/specialized-spatial-search-mpi
loumalouomega Oct 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Many advances
  • Loading branch information
loumalouomega committed Jun 20, 2023
commit c55937a90819717b97a1db6a2a4f4a1caa32199a
213 changes: 203 additions & 10 deletions kratos/mpi/spatial_containers/specialized_spatial_search_mpi.cpp
Original file line number Diff line number Diff line change
@@ -15,8 +15,10 @@
// External includes

// Project includes
#include "utilities/search_utilities.h"
#include "utilities/parallel_utilities.h"
#include "mpi/spatial_containers/specialized_spatial_search_mpi.h"
#include "mpi/includes/mpi_data_communicator.h"

namespace Kratos
{
@@ -83,10 +85,25 @@ void SpecializedSpatialSearchMPI<TSearchBackend>::SearchNodesOverPointInRadius (
const array_1d<double,3>& rPoint,
const double Radius,
NodeSpatialSearchResultContainerType& rResults,
const DataCommunicator& rDataCommunicator
const DataCommunicator& rDataCommunicator,
const bool SyncronizeResults
)
{

{
// Initialize the BB is required
if (!mBoundingBoxesInitialized) {
InitializeLocalBoundingBox(rStructureNodes);
}

// Check if the point is inside the set
if (SearchUtilities::PointIsInsideBoundingBox(mLocalBoundingBox, rPoint, Radius)) {
// Call local search
BaseType::SearchNodesOverPointInRadius(rStructureNodes, rPoint, Radius, rResults, rDataCommunicator, false);
}

// Synchronize if needed
if (SyncronizeResults) {
rResults.SynchronizeAll(rDataCommunicator);
}
}

/***********************************************************************************/
@@ -97,10 +114,54 @@ void SpecializedSpatialSearchMPI<TSearchBackend>::SearchNodesOverPointNearestPoi
const NodesContainerType& rStructureNodes,
const array_1d<double,3>& rPoint,
NodeSpatialSearchResultContainerType& rResults,
const DataCommunicator& rDataCommunicator
const DataCommunicator& rDataCommunicator,
const bool SyncronizeResults
)
{
{
// Initialize the BB is required
if (!mBoundingBoxesInitialized) {
InitializeLocalBoundingBox(rStructureNodes);
}

// Compute max radius
const array_1d<double, 3> box_size = mLocalBoundingBox.GetMaxPoint() - mLocalBoundingBox.GetMinPoint();
const double max_radius= *std::max_element(box_size.begin(), box_size.end());

// Get the rank
const int current_rank = rDataCommunicator.Rank();

// Check if the point is inside the set
NodeSpatialSearchResultContainerType local_result;
if (SearchUtilities::PointIsInsideBoundingBox(mLocalBoundingBox, rPoint, max_radius)) {
// Call local search
BaseType::SearchNodesOverPointNearestPoint(rStructureNodes, rPoint, local_result, rDataCommunicator, false);
}

/* Now sync results between partitions */

// Get the distance
const double local_distance = local_result.NumberOfLocalResults() > 0 ? local_result.GetLocalDistances().begin()->second : std::numeric_limits<double>::max();

// Find the minimum value and the rank that holds it
struct {
double value;
int rank;
} local_min, global_min;

local_min.value = local_distance;
local_min.rank = current_rank;
MPI_Allreduce(&local_min, &global_min, 1, MPI_DOUBLE_INT, MPI_MINLOC, MPIDataCommunicator::GetMPICommunicator(rDataCommunicator));

// Get the solution from the computed_rank
if (global_min.rank == current_rank) {
// Add the local search
rResults.AddResult(*(local_result.GetLocalPointers().begin().base()));
}

// Synchronize if needed
if (SyncronizeResults) {
rResults.SynchronizeAll(rDataCommunicator);
}
}

/***********************************************************************************/
@@ -112,10 +173,25 @@ void SpecializedSpatialSearchMPI<TSearchBackend>::SearchElementsOverPointInRadiu
const array_1d<double,3>& rPoint,
const double Radius,
ElementSpatialSearchResultContainerType& rResults,
const DataCommunicator& rDataCommunicator
const DataCommunicator& rDataCommunicator,
const bool SyncronizeResults
)
{
{
// Initialize the BB is required
if (!mBoundingBoxesInitialized) {
InitializeLocalBoundingBox(rStructureElements.begin(), rStructureElements.end());
}

// Check if the point is inside the set
if (SearchUtilities::PointIsInsideBoundingBox(mLocalBoundingBox, rPoint, Radius)) {
// Call local search
BaseType::SearchElementsOverPointInRadius(rStructureElements, rPoint, Radius, rResults, rDataCommunicator, false);
}

// Synchronize if needed
if (SyncronizeResults) {
rResults.SynchronizeAll(rDataCommunicator);
}
}

/***********************************************************************************/
@@ -126,10 +202,54 @@ void SpecializedSpatialSearchMPI<TSearchBackend>::SearchElementsOverPointNearest
const ElementsContainerType& rStructureElements,
const array_1d<double,3>& rPoint,
ElementSpatialSearchResultContainerType& rResults,
const DataCommunicator& rDataCommunicator
const DataCommunicator& rDataCommunicator,
const bool SyncronizeResults
)
{
// Initialize the BB is required
if (!mBoundingBoxesInitialized) {
InitializeLocalBoundingBox(rStructureElements.begin(), rStructureElements.end());
}

// Compute max radius
const array_1d<double, 3> box_size = mLocalBoundingBox.GetMaxPoint() - mLocalBoundingBox.GetMinPoint();
const double max_radius= *std::max_element(box_size.begin(), box_size.end());

// Get the rank
const int current_rank = rDataCommunicator.Rank();

// Check if the point is inside the set
ElementSpatialSearchResultContainerType local_result;
if (SearchUtilities::PointIsInsideBoundingBox(mLocalBoundingBox, rPoint, max_radius)) {
// Call local search
BaseType::SearchElementsOverPointNearestPoint(rStructureElements, rPoint, local_result, rDataCommunicator, false);
}

/* Now sync results between partitions */

// Get the distance
const double local_distance = local_result.NumberOfLocalResults() > 0 ? local_result.GetLocalDistances().begin()->second : std::numeric_limits<double>::max();

// Find the minimum value and the rank that holds it
struct {
double value;
int rank;
} local_min, global_min;

local_min.value = local_distance;
local_min.rank = current_rank;
MPI_Allreduce(&local_min, &global_min, 1, MPI_DOUBLE_INT, MPI_MINLOC, MPIDataCommunicator::GetMPICommunicator(rDataCommunicator));

// Get the solution from the computed_rank
if (global_min.rank == current_rank) {
// Add the local search
rResults.AddResult(*(local_result.GetLocalPointers().begin().base()));
}

// Synchronize if needed
if (SyncronizeResults) {
rResults.SynchronizeAll(rDataCommunicator);
}
}

/***********************************************************************************/
@@ -141,10 +261,25 @@ void SpecializedSpatialSearchMPI<TSearchBackend>::SearchConditionsOverPointInRad
const array_1d<double,3>& rPoint,
const double Radius,
ConditionSpatialSearchResultContainerType& rResults,
const DataCommunicator& rDataCommunicator
const DataCommunicator& rDataCommunicator,
const bool SyncronizeResults
)
{
// Initialize the BB is required
if (!mBoundingBoxesInitialized) {
InitializeLocalBoundingBox(rStructureConditions.begin(), rStructureConditions.end());
}

// Check if the point is inside the set
if (SearchUtilities::PointIsInsideBoundingBox(mLocalBoundingBox, rPoint, Radius)) {
// Call local search
BaseType::SearchConditionsOverPointInRadius(rStructureConditions, rPoint, Radius, rResults, rDataCommunicator, false);
}

// Synchronize if needed
if (SyncronizeResults) {
rResults.SynchronizeAll(rDataCommunicator);
}
}

/***********************************************************************************/
@@ -155,10 +290,68 @@ void SpecializedSpatialSearchMPI<TSearchBackend>::SearchConditionsOverPointNeare
const ConditionsContainerType& rStructureConditions,
const array_1d<double,3>& rPoint,
ConditionSpatialSearchResultContainerType& rResults,
const DataCommunicator& rDataCommunicator
const DataCommunicator& rDataCommunicator,
const bool SyncronizeResults
)
{
// Initialize the BB is required
if (!mBoundingBoxesInitialized) {
InitializeLocalBoundingBox(rStructureConditions.begin(), rStructureConditions.end());
}

// Compute max radius
const array_1d<double, 3> box_size = mLocalBoundingBox.GetMaxPoint() - mLocalBoundingBox.GetMinPoint();
const double max_radius= *std::max_element(box_size.begin(), box_size.end());

// Get the rank
const int current_rank = rDataCommunicator.Rank();

// Check if the point is inside the set
ConditionSpatialSearchResultContainerType local_result;
if (SearchUtilities::PointIsInsideBoundingBox(mLocalBoundingBox, rPoint, max_radius)) {
// Call local search
BaseType::SearchConditionsOverPointNearestPoint(rStructureConditions, rPoint, local_result, rDataCommunicator, false);
}

/* Now sync results between partitions */

// Get the distance
const double local_distance = local_result.NumberOfLocalResults() > 0 ? local_result.GetLocalDistances().begin()->second : std::numeric_limits<double>::max();

// Find the minimum value and the rank that holds it
struct {
double value;
int rank;
} local_min, global_min;

local_min.value = local_distance;
local_min.rank = current_rank;
MPI_Allreduce(&local_min, &global_min, 1, MPI_DOUBLE_INT, MPI_MINLOC, MPIDataCommunicator::GetMPICommunicator(rDataCommunicator));

// Get the solution from the computed_rank
if (global_min.rank == current_rank) {
// Add the local search
rResults.AddResult(*(local_result.GetLocalPointers().begin().base()));
}

// Synchronize if needed
if (SyncronizeResults) {
rResults.SynchronizeAll(rDataCommunicator);
}
}

/***********************************************************************************/
/***********************************************************************************/

template<SpatialContainer TSearchBackend>
void SpecializedSpatialSearchMPI<TSearchBackend>::InitializeLocalBoundingBox(const NodesContainerType& rStructureNodes)
{
const std::size_t number_of_nodes = rStructureNodes.size();
if (number_of_nodes > 0) {
mLocalBoundingBox.Set(rStructureNodes.begin(), rStructureNodes.end());
mLocalBoundingBox.Extend(Tolerance);
}
mBoundingBoxesInitialized = true;
}

/***********************************************************************************/
Loading