-
Notifications
You must be signed in to change notification settings - Fork 707
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12602 from peterrum/rpe_unique_fix
Fix tolerances in GridTools::internal::distributed_compute_point_locations()
- Loading branch information
Showing
4 changed files
with
120 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// --------------------------------------------------------------------- | ||
// | ||
// Copyright (C) 2021 by the deal.II authors | ||
// | ||
// This file is part of the deal.II library. | ||
// | ||
// The deal.II library is free software; you can use it, redistribute | ||
// it, and/or modify it under the terms of the GNU Lesser General | ||
// Public License as published by the Free Software Foundation; either | ||
// version 2.1 of the License, or (at your option) any later version. | ||
// The full text of the license can be found in the file LICENSE.md at | ||
// the top level directory of deal.II. | ||
// | ||
// --------------------------------------------------------------------- | ||
|
||
// Test Utilities::MPI::RemotePointEvaluation with and without unique mapping | ||
// for a within a tolerance. | ||
|
||
#include <deal.II/base/mpi.h> | ||
|
||
#include <deal.II/distributed/tria.h> | ||
|
||
#include <deal.II/fe/fe_q.h> | ||
#include <deal.II/fe/mapping_q1.h> | ||
|
||
#include <deal.II/grid/grid_generator.h> | ||
|
||
#include <deal.II/lac/la_vector.h> | ||
|
||
#include <deal.II/numerics/vector_tools_evaluate.h> | ||
|
||
#include "../tests.h" | ||
|
||
using namespace dealii; | ||
|
||
|
||
template <int dim> | ||
void | ||
test(const bool enforce_unique_map) | ||
{ | ||
parallel::distributed::Triangulation<dim> tria(MPI_COMM_WORLD); | ||
GridGenerator::subdivided_hyper_cube(tria, 2); | ||
tria.refine_global(1); | ||
|
||
FE_Q<dim> fe(1); | ||
DoFHandler<dim> dof_handler(tria); | ||
dof_handler.distribute_dofs(fe); | ||
|
||
Vector<double> vec(dof_handler.n_dofs()); | ||
|
||
vec = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) + 1; | ||
|
||
MappingQ1<dim> mapping; | ||
|
||
std::vector<Point<dim>> evaluation_points; | ||
|
||
evaluation_points.emplace_back(0.5, 0.5 + 1e-7); // should be assigned to rank | ||
// 0 for unique mapping | ||
|
||
Utilities::MPI::RemotePointEvaluation<dim> eval(1e-6, enforce_unique_map); | ||
|
||
const auto result_avg = | ||
VectorTools::point_values<1>(mapping, | ||
dof_handler, | ||
vec, | ||
evaluation_points, | ||
eval, | ||
VectorTools::EvaluationFlags::avg); | ||
const auto result_min = VectorTools::point_values<1>( | ||
eval, dof_handler, vec, VectorTools::EvaluationFlags::min); | ||
const auto result_max = VectorTools::point_values<1>( | ||
eval, dof_handler, vec, VectorTools::EvaluationFlags::max); | ||
const auto result_insert = VectorTools::point_values<1>( | ||
eval, dof_handler, vec, VectorTools::EvaluationFlags::insert); | ||
|
||
for (unsigned int i = 0; i < evaluation_points.size(); ++i) | ||
deallog << i << " " << result_avg[i] << " " << result_min[i] << " " | ||
<< result_max[i] << " " << result_insert[i] << " " | ||
<< eval.get_point_ptrs()[i + 1] - eval.get_point_ptrs()[i] | ||
<< std::endl; | ||
} | ||
|
||
|
||
|
||
int | ||
main(int argc, char **argv) | ||
{ | ||
Utilities::MPI::MPI_InitFinalize mpi(argc, argv, 1); | ||
MPILogInitAll all; | ||
|
||
test<2>(false); | ||
test<2>(true); | ||
} |
7 changes: 7 additions & 0 deletions
7
tests/remote_point_evaluation/mapping_03.with_p4est=true.mpirun=2.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
DEAL:0::0 1.50000 1.00000 2.00000 1.00000 4 | ||
DEAL:0::0 1.00000 1.00000 1.00000 1.00000 1 | ||
|
||
DEAL:1::0 1.50000 1.00000 2.00000 1.00000 4 | ||
DEAL:1::0 1.00000 1.00000 1.00000 1.00000 1 | ||
|