Skip to content

Commit

Permalink
Replace euler mapping with box mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
fdrmrc committed Sep 16, 2024
1 parent 9a15f8f commit 3b9e11c
Show file tree
Hide file tree
Showing 12 changed files with 164 additions and 592 deletions.
682 changes: 135 additions & 547 deletions examples/minimal_SIP.cc

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions include/agglomeration_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ class AgglomerationHandler : public Subscriptor
inline const Mapping<dim> &
get_mapping() const;

inline const MappingBox<dim> &
get_agglomeration_mapping() const;

inline const std::vector<BoundingBox<dim>> &
get_local_bboxes() const;

Expand Down Expand Up @@ -897,6 +900,15 @@ AgglomerationHandler<dim, spacedim>::get_mapping() const



template <int dim, int spacedim>
inline const MappingBox<dim> &
AgglomerationHandler<dim, spacedim>::get_agglomeration_mapping() const
{
return *box_mapping;
}



template <int dim, int spacedim>
inline const Triangulation<dim, spacedim> &
AgglomerationHandler<dim, spacedim>::get_triangulation() const
Expand Down
2 changes: 1 addition & 1 deletion test/polydeal/coarse_operator_from_matrix_free.cc
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ TestMGMatrix<dim>::agglomerate_and_compute_level_matrices()
LinearAlgebra::distributed::Vector<double> dst_coarse_op;
dst_coarse_op.reinit(agglomeration_handler->agglo_dh.locally_owned_dofs(),
comm);
VectorTools::interpolate(*(agglomeration_handler->euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
agglomeration_handler->agglo_dh,
func,
src_coarse);
Expand Down
5 changes: 3 additions & 2 deletions test/polydeal/distributed_injection_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ DistributedHierarchyTest<dim>::setup_agglomerated_problem()
ah_coarse->agglo_dh.locally_owned_dofs();
TrilinosWrappers::MPI::Vector interp_coarse(locally_owned_dofs_coarse, comm);

VectorTools::interpolate(*(ah_coarse->euler_mapping),
VectorTools::interpolate(ah_coarse->get_agglomeration_mapping(),
,
ah_coarse->agglo_dh,
func,
interp_coarse);
Expand Down Expand Up @@ -425,7 +426,7 @@ DistributedHierarchyTest<dim>::setup_agglomerated_problem()
// Compute error:
TrilinosWrappers::MPI::Vector interp_fine(
dst.locally_owned_elements(), comm); // take parallel layout from dst
VectorTools::interpolate(*(ah_fine->euler_mapping),
VectorTools::interpolate(ah_fine->get_agglomeration_mapping(),
ah_fine->agglo_dh,
func,
interp_fine);
Expand Down
4 changes: 2 additions & 2 deletions test/polydeal/distributed_poisson_sanity_check_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -613,12 +613,12 @@ main(int argc, char *argv[])
LinearFunction<2> xfunction{{1, 0}};
LinearFunction<2> xplusyfunction{{1, 1}};

VectorTools::interpolate(*(ah.euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
ah.get_dof_handler(),
xfunction,
interpx);

VectorTools::interpolate(*(ah.euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
ah.get_dof_handler(),
xplusyfunction,
interpxplusy);
Expand Down
4 changes: 2 additions & 2 deletions test/polydeal/distributed_poisson_sanity_check_02.cc
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,12 @@ main(int argc, char *argv[])
LinearFunction<2> xfunction{{1, 0}};
LinearFunction<2> xplusyfunction{{1, 1}};

VectorTools::interpolate(*(ah.euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
ah.get_dof_handler(),
xfunction,
interpx);

VectorTools::interpolate(*(ah.euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
ah.get_dof_handler(),
xplusyfunction,
interpxplusy);
Expand Down
4 changes: 2 additions & 2 deletions test/polydeal/fully_distributed_poisson_sanity_check_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,12 @@ main(int argc, char *argv[])
LinearFunction<2> xfunction{{1, 0}};
LinearFunction<2> xplusyfunction{{1, 1}};

VectorTools::interpolate(*(ah.euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
ah.get_dof_handler(),
xfunction,
interpx);

VectorTools::interpolate(*(ah.euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
ah.get_dof_handler(),
xplusyfunction,
interpxplusy);
Expand Down
4 changes: 2 additions & 2 deletions test/polydeal/fully_distributed_poisson_sanity_check_02.cc
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,12 @@ main(int argc, char *argv[])
LinearFunction<2> xfunction{{1, 0}};
LinearFunction<2> xplusyfunction{{1, 1}};

VectorTools::interpolate(*(ah.euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
ah.get_dof_handler(),
xfunction,
interpx);

VectorTools::interpolate(*(ah.euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
ah.get_dof_handler(),
xplusyfunction,
interpxplusy);
Expand Down
29 changes: 0 additions & 29 deletions test/polydeal/minimal_SIP_Poisson.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ class Poisson
assemble_system();
void
solve();
void
output_results();

bool to_agglomerate;
Triangulation<dim> tria;
Expand Down Expand Up @@ -475,32 +473,6 @@ Poisson<dim>::solve()



template <int dim>
void
Poisson<dim>::output_results()
{
{
const std::string filename = "agglomerated_Poisson.vtu";
std::ofstream output(filename);

DataOut<dim> data_out;
data_out.attach_dof_handler(ah->get_dof_handler());
data_out.add_data_vector(solution, "u", DataOut<dim>::type_dof_data);
data_out.build_patches(mapping);
data_out.write_vtu(output);
}
{
const std::string filename = "agglomerated_Poisson_test.vtu";
std::ofstream output(filename);

DataOut<dim> data_out;
data_out.attach_dof_handler(ah->get_dof_handler());
data_out.add_data_vector(solution, "u", DataOut<dim>::type_dof_data);
data_out.build_patches(*(ah->euler_mapping));
data_out.write_vtu(output);
}
}

template <int dim>
void
Poisson<dim>::run()
Expand All @@ -509,7 +481,6 @@ Poisson<dim>::run()
setup_agglomeration();
assemble_system();
solve();
output_results();
}

template <int dim>
Expand Down
4 changes: 2 additions & 2 deletions test/polydeal/poisson_sanity_check_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,11 @@ LaplaceOperator<dim>::perform_sanity_check()
Vector<double> interpone(ah->get_dof_handler().n_dofs());
LinearFunction<dim> xfunction{{1, 0}};
LinearFunction<dim> xplusfunction{{1, 1}};
VectorTools::interpolate(*(ah->euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
ah->get_dof_handler(),
xfunction,
interpx);
VectorTools::interpolate(*(ah->euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
ah->get_dof_handler(),
xplusfunction,
interpxplusy);
Expand Down
2 changes: 1 addition & 1 deletion test/polydeal/poisson_sanity_check_02.cc
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ LaplaceOperator<dim>::perform_sanity_check()
for (const auto &func : functions)
{
Vector<double> interp_vector(ah->get_dof_handler().n_dofs());
VectorTools::interpolate(*(ah->euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
ah->get_dof_handler(),
*func,
interp_vector);
Expand Down
4 changes: 2 additions & 2 deletions test/polydeal/poisson_sanity_check_03.cc
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,11 @@ LaplaceOperator<dim>::perform_sanity_check()
Vector<double> interpone(ah->get_dof_handler().n_dofs());
LinearFunction<dim> xfunction{{1, 0}};
LinearFunction<dim> xplusfunction{{1, 1}};
VectorTools::interpolate(*(ah->euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
ah->get_dof_handler(),
xfunction,
interpx);
VectorTools::interpolate(*(ah->euler_mapping),
VectorTools::interpolate(ah->get_agglomeration_mapping(),
ah->get_dof_handler(),
xplusfunction,
interpxplusy);
Expand Down

0 comments on commit 3b9e11c

Please sign in to comment.