@@ -253,7 +253,7 @@ dolfinx_mpc::mpc_data<T> compute_block_contributions(
253
253
{
254
254
const std::int32_t local_slave = local_slaves[i];
255
255
std::iota (dofs.begin (), dofs.end (), local_slave_blocks[i] * block_size);
256
- auto local_max = std::find (dofs. begin (), dofs. end () , local_slave);
256
+ auto local_max = std::ranges:: find (dofs, local_slave);
257
257
const auto max_index = std::distance (dofs.begin (), local_max);
258
258
for (std::int32_t j = 0 ; j < block_size; j++)
259
259
{
@@ -723,7 +723,7 @@ mpc_data<T> create_contact_slip_condition(
723
723
}
724
724
}
725
725
}
726
- if (auto not_found = std::find (slave_found. begin (), slave_found. end () , false );
726
+ if (auto not_found = std::ranges:: find (slave_found, false );
727
727
not_found != slave_found.end ())
728
728
{
729
729
std::runtime_error (
@@ -768,17 +768,20 @@ mpc_data<T> create_contact_slip_condition(
768
768
if (!(slave_found[c]) && (slave_max - slave_min > 0 ))
769
769
{
770
770
slave_found[c] = true ;
771
- std::copy (remote_colliding_masters.begin () + proc_start + slave_min,
772
- remote_colliding_masters.begin () + proc_start + slave_max,
773
- offproc_masters.begin () + offproc_offsets[c]);
774
-
775
- std::copy (remote_colliding_coeffs.begin () + proc_start + slave_min,
776
- remote_colliding_coeffs.begin () + proc_start + slave_max,
777
- offproc_coeffs.begin () + offproc_offsets[c]);
778
-
779
- std::copy (remote_colliding_owners.begin () + proc_start + slave_min,
780
- remote_colliding_owners.begin () + proc_start + slave_max,
781
- offproc_owners.begin () + offproc_offsets[c]);
771
+ std::ranges::copy (
772
+ remote_colliding_masters.begin () + proc_start + slave_min,
773
+ remote_colliding_masters.begin () + proc_start + slave_max,
774
+ offproc_masters.begin () + offproc_offsets[c]);
775
+
776
+ std::ranges::copy (
777
+ remote_colliding_coeffs.begin () + proc_start + slave_min,
778
+ remote_colliding_coeffs.begin () + proc_start + slave_max,
779
+ offproc_coeffs.begin () + offproc_offsets[c]);
780
+
781
+ std::ranges::copy (
782
+ remote_colliding_owners.begin () + proc_start + slave_min,
783
+ remote_colliding_owners.begin () + proc_start + slave_max,
784
+ offproc_owners.begin () + offproc_offsets[c]);
782
785
}
783
786
}
784
787
}
@@ -814,15 +817,15 @@ mpc_data<T> create_contact_slip_condition(
814
817
{
815
818
const std::int32_t master_min = masters_offsets[i];
816
819
const std::int32_t master_max = masters_offsets[i + 1 ];
817
- std::copy (masters_out.begin () + master_min,
818
- masters_out.begin () + master_max,
819
- local_masters.begin () + local_offsets[i] + loc_pos[i]);
820
- std::copy (coefficients_out.begin () + master_min,
821
- coefficients_out.begin () + master_max,
822
- local_coeffs.begin () + local_offsets[i] + loc_pos[i]);
823
- std::copy (owners_out.begin () + master_min,
824
- owners_out.begin () + master_max,
825
- local_owners.begin () + local_offsets[i] + loc_pos[i]);
820
+ std::ranges:: copy (masters_out.begin () + master_min,
821
+ masters_out.begin () + master_max,
822
+ local_masters.begin () + local_offsets[i] + loc_pos[i]);
823
+ std::ranges:: copy (coefficients_out.begin () + master_min,
824
+ coefficients_out.begin () + master_max,
825
+ local_coeffs.begin () + local_offsets[i] + loc_pos[i]);
826
+ std::ranges:: copy (owners_out.begin () + master_min,
827
+ owners_out.begin () + master_max,
828
+ local_owners.begin () + local_offsets[i] + loc_pos[i]);
826
829
loc_pos[i] += master_max - master_min;
827
830
}
828
831
@@ -832,18 +835,18 @@ mpc_data<T> create_contact_slip_condition(
832
835
const std::int32_t master_min = offproc_offsets[i];
833
836
const std::int32_t master_max = offproc_offsets[i + 1 ];
834
837
const std::int32_t slave_index = slave_indices_remote[i];
835
- std::copy (offproc_masters.begin () + master_min,
836
- offproc_masters.begin () + master_max,
837
- local_masters.begin () + local_offsets[slave_index]
838
- + loc_pos[slave_index]);
839
- std::copy (offproc_coeffs.begin () + master_min,
840
- offproc_coeffs.begin () + master_max,
841
- local_coeffs.begin () + local_offsets[slave_index]
842
- + loc_pos[slave_index]);
843
- std::copy (offproc_owners.begin () + master_min,
844
- offproc_owners.begin () + master_max,
845
- local_owners.begin () + local_offsets[slave_index]
846
- + loc_pos[slave_index]);
838
+ std::ranges:: copy (offproc_masters.begin () + master_min,
839
+ offproc_masters.begin () + master_max,
840
+ local_masters.begin () + local_offsets[slave_index]
841
+ + loc_pos[slave_index]);
842
+ std::ranges:: copy (offproc_coeffs.begin () + master_min,
843
+ offproc_coeffs.begin () + master_max,
844
+ local_coeffs.begin () + local_offsets[slave_index]
845
+ + loc_pos[slave_index]);
846
+ std::ranges:: copy (offproc_owners.begin () + master_min,
847
+ offproc_owners.begin () + master_max,
848
+ local_owners.begin () + local_offsets[slave_index]
849
+ + loc_pos[slave_index]);
847
850
loc_pos[slave_index] += master_max - master_min;
848
851
}
849
852
}
@@ -1479,18 +1482,18 @@ mpc_data<T> create_contact_inelastic_condition(
1479
1482
1480
1483
// Count number of incoming slaves
1481
1484
std::vector<std::int32_t > inc_num_slaves (src_ranks_ghost.size (), 0 );
1482
- std::ranges::for_each (
1483
- ghost_slaves ,
1484
- [block_size, size_local, &ghost_owners, &inc_num_slaves,
1485
- &src_ranks_ghost](std:: int32_t slave)
1486
- {
1487
- const std:: int32_t owner
1488
- = ghost_owners[slave / block_size - size_local];
1489
- const auto it
1490
- = std::find (src_ranks_ghost. begin (), src_ranks_ghost. end (), owner);
1491
- const auto index = std::distance (src_ranks_ghost.begin (), it);
1492
- inc_num_slaves[index ]++;
1493
- });
1485
+ std::ranges::for_each (ghost_slaves,
1486
+ [block_size, size_local, &ghost_owners, &inc_num_slaves ,
1487
+ &src_ranks_ghost](std:: int32_t slave)
1488
+ {
1489
+ const std:: int32_t owner
1490
+ = ghost_owners[slave / block_size - size_local];
1491
+ const auto it
1492
+ = std::ranges::find (src_ranks_ghost, owner);
1493
+ const auto index
1494
+ = std::distance (src_ranks_ghost.begin (), it);
1495
+ inc_num_slaves[index ]++;
1496
+ });
1494
1497
// Count number of outgoing slaves and masters
1495
1498
dolfinx::graph::AdjacencyList<int > shared_indices
1496
1499
= slave_index_map->index_to_dest_ranks ();
@@ -1524,8 +1527,7 @@ mpc_data<T> create_contact_inelastic_condition(
1524
1527
const auto num_masters = (std::int32_t )masters_i.size ();
1525
1528
for (auto proc : shared_indices.links (slave / block_size))
1526
1529
{
1527
- const auto it = std::find (dest_ranks_ghost.begin (),
1528
- dest_ranks_ghost.end (), proc);
1530
+ const auto it = std::ranges::find (dest_ranks_ghost, proc);
1529
1531
std::int32_t index = std::distance (dest_ranks_ghost.begin (), it);
1530
1532
out_num_masters[index ] += num_masters;
1531
1533
out_num_slaves[index ]++;
@@ -1708,8 +1710,7 @@ mpc_data<T> create_contact_inelastic_condition(
1708
1710
std::vector<std::int32_t > local_ghosts
1709
1711
= map_dofs_global_to_local<U>(V, in_ghost_slaves);
1710
1712
slaves.resize (num_loc_slaves + num_ghost_slaves);
1711
- std::copy (local_ghosts.cbegin (), local_ghosts.cend (),
1712
- slaves.begin () + num_loc_slaves);
1713
+ std::ranges::copy (local_ghosts, slaves.begin () + num_loc_slaves);
1713
1714
mpc.slaves = slaves;
1714
1715
mpc.masters = masters;
1715
1716
mpc.offsets = offsets;
0 commit comments