Skip to content

Commit

Permalink
Fix deprecation warnings concerning mesh loaders. Issue wareHHOuse#97.
Browse files Browse the repository at this point in the history
  • Loading branch information
karolCascavita committed Apr 13, 2023
1 parent d3d3013 commit e21cb1f
Show file tree
Hide file tree
Showing 21 changed files with 372 additions and 299 deletions.
9 changes: 6 additions & 3 deletions apps/bingham/src/bingham_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ int main(int argc, char **argv)
if (std::regex_match(input_mesh, std::regex(".*\\.medit2d$")))
{
std::cout << "Guessed mesh format: Medit format" << std::endl;
auto msh = disk::load_medit_2d_mesh<T>(input_mesh.c_str());
disk::generic_mesh<T, 2> msh;
disk::load_mesh_medit<T>(input_mesh.c_str(), msh);
if(!run_bingham(msh, hdi, vp))
std::cout << "No convergence" << std::endl;

Expand All @@ -193,7 +194,8 @@ int main(int argc, char **argv)
if (std::regex_match(input_mesh, std::regex(".*\\.mesh2d$") ))
{
std::cout << "Guessed mesh format: Netgen 2D" << std::endl;
auto msh = disk::load_netgen_2d_mesh<T>(input_mesh.c_str());
disk::simplicial_mesh<T, 2> msh;
disk::load_mesh_netgen<T>(input_mesh.c_str(), msh);
if(!run_bingham(msh, hdi, vp))
std::cout << "No convergence" << std::endl;

Expand All @@ -204,7 +206,8 @@ int main(int argc, char **argv)
if (std::regex_match(input_mesh, std::regex(".*\\.quad$") ))
{
std::cout << "Guessed mesh format: DiSk++ Cartesian 2D" << std::endl;
auto msh = disk::load_cartesian_2d_mesh<T>(input_mesh.c_str());
disk::cartesian_mesh<T, 2> msh;
disk::load_mesh_diskpp_cartesian<T>(input_mesh.c_str(), msh);
if(!run_bingham(msh, hdi, vp))
std::cout << "No convergence" << std::endl;

Expand Down
12 changes: 9 additions & 3 deletions apps/bingham/src/bingham_vector_higher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ int main(int argc, char **argv)
if (std::regex_match(input_mesh, std::regex(".*\\.medit2d$")))
{
std::cout << "Guessed mesh format: Medit format" << std::endl;
auto msh = disk::load_medit_2d_mesh<T>(input_mesh.c_str());
disk::generic_mesh<T, 2> msh;
disk::load_mesh_medit<T>(input_mesh.c_str(), msh);

if(!run_bingham(msh, hdi, vp))
std::cout << "No convergence" << std::endl;

Expand All @@ -192,7 +194,9 @@ int main(int argc, char **argv)
if (std::regex_match(input_mesh, std::regex(".*\\.mesh2d$") ))
{
std::cout << "Guessed mesh format: Netgen 2D" << std::endl;
auto msh = disk::load_netgen_2d_mesh<T>(input_mesh.c_str());
disk::simplicial_mesh<T, 2> msh;
disk::load_mesh_netgen<T>(input_mesh.c_str(), msh);

if(!run_bingham(msh, hdi, vp))
std::cout << "No convergence" << std::endl;

Expand All @@ -203,7 +207,9 @@ int main(int argc, char **argv)
if (std::regex_match(input_mesh, std::regex(".*\\.quad$") ))
{
std::cout << "Guessed mesh format: DiSk++ Cartesian 2D" << std::endl;
auto msh = disk::load_cartesian_2d_mesh<T>(input_mesh.c_str());
disk::cartesian_mesh<T, 2> msh;
disk::load_mesh_diskpp_cartesian<T>(input_mesh.c_str(), msh);

if(!run_bingham(msh, hdi, vp))
std::cout << "No convergence" << std::endl;

Expand Down
9 changes: 6 additions & 3 deletions apps/contact/src/diffusion_nitsche.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ int main(int argc, char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.typ1$") ))
{
std::cout << "Guessed mesh format: FVCA5 2D" << std::endl;
auto msh = disk::load_fvca5_2d_mesh<T>(mesh_filename);
disk::generic_mesh<T,2> msh;
disk::load_mesh_fvca5_2d<T>(mesh_filename, msh);
auto error = run_diffusion_solver(msh, ap);
return 0;
}
Expand All @@ -109,7 +110,8 @@ int main(int argc, char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.mesh2d$") ))
{
std::cout << "Guessed mesh format: Netgen 2D" << std::endl;
auto msh = disk::load_netgen_2d_mesh<T>(mesh_filename);
disk::simplicial_mesh<T, 2> msh;
disk::load_mesh_netgen<T>(mesh_filename, msh);
auto error = run_diffusion_solver(msh, ap);
return 0;
}
Expand All @@ -118,7 +120,8 @@ int main(int argc, char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.quad$") ))
{
std::cout << "Guessed mesh format: DiSk++ Cartesian 2D" << std::endl;
auto msh = disk::load_cartesian_2d_mesh<T>(mesh_filename);
disk::cartesian_mesh<T, 2> msh;
disk::load_mesh_diskpp_cartesian<T>(mesh_filename, msh);
auto error = run_diffusion_solver(msh, ap);
return 0;
}
Expand Down
30 changes: 6 additions & 24 deletions apps/contact/src/signorini_newton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,9 @@ int main(int argc, char **argv)
/* Netgen 2d*/
if (std::regex_match(filename, std::regex(".*\\.mesh2d$") ))
{
typedef disk::simplicial_mesh<T, 2> mesh_type;
std::cout << "Guessed mesh format: Netgen 2D" << std::endl;
mesh_type msh;
disk::netgen_mesh_loader<T, 2> loader;
if (!loader.read_mesh(filename))
{
std::cout << "Problem loading mesh." << std::endl;
return 1;
}
loader.populate_mesh(msh);

disk::simplicial_mesh<T, 2> msh;
disk::load_mesh_netgen<T>(filename, msh);
run_signorini(msh, ap, run_exact);
return 0;
}
Expand All @@ -126,7 +118,8 @@ int main(int argc, char **argv)
if (std::regex_match(filename, std::regex(".*\\.typ1$") ))
{
std::cout << "Guessed mesh format: FVCA5 2D" << std::endl;
auto msh = disk::load_fvca5_2d_mesh<T>(filename);
disk::generic_mesh<T,2> msh;
disk::load_mesh_fvca5_2d<T>(filename, msh);
run_signorini(msh, ap, run_exact);
return 0;
}
Expand All @@ -135,22 +128,11 @@ int main(int argc, char **argv)
if (std::regex_match(filename, std::regex(".*\\.quad$") ))
{
std::cout << "Guessed mesh format: DiSk++ Cartesian 2D" << std::endl;
auto msh = disk::load_cartesian_2d_mesh<T>(filename);
disk::cartesian_mesh<T, 2> msh;
disk::load_mesh_diskpp_cartesian<T>(filename, msh);
run_signorini(msh, ap, run_exact);
return 0;
}


#if 0
/* Medit 2d*/
if (std::regex_match(filename, std::regex(".*\\.medit2d$")))
{
std::cout << "Guessed mesh format: Medit format" << std::endl;
typedef disk::generic_mesh<T, 2> mesh_type;
mesh_type msh = disk::load_medit_2d_mesh<T>(filename);
run_signorini(msh, ap);
}
#endif

return 0;
}
29 changes: 13 additions & 16 deletions apps/diffusion/src/diffusion_hho.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ int main(int argc, char **argv)
tmpdeg = std::stoi(optarg);
if (not lflag)
hdi.cell_degree(tmpdeg);

hdi.face_degree(tmpdeg);

if (not rflag)
hdi.reconstruction_degree(tmpdeg+1);
break;
Expand Down Expand Up @@ -105,9 +105,7 @@ int main(int argc, char **argv)
{
std::cout << "Mesh format: 1D uniform" << std::endl;

typedef disk::generic_mesh<T, 1> mesh_type;

mesh_type msh;
disk::generic_mesh<T, 1> msh;
disk::uniform_mesh_loader<T, 1> loader(0, 1, num_elems);
loader.populate_mesh(msh);

Expand All @@ -121,7 +119,8 @@ int main(int argc, char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.typ1$") ))
{
std::cout << "Guessed mesh format: FVCA5 2D" << std::endl;
auto msh = disk::load_fvca5_2d_mesh<T>(mesh_filename);
disk::generic_mesh<T, 2> msh;
disk::load_mesh_fvca5_2d<T>(mesh_filename, msh);
run_hho_diffusion_solver(msh, hdi, stat_cond, stab_diam_F);
return 0;
}
Expand All @@ -130,10 +129,9 @@ int main(int argc, char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.mesh2d$") ))
{
std::cout << "Guessed mesh format: Netgen 2D" << std::endl;
auto msh = disk::load_netgen_2d_mesh<T>(mesh_filename);

disk::simplicial_mesh<T, 2> msh;
disk::load_mesh_netgen<T>(mesh_filename, msh);
std::cout << msh.faces_size() << std::endl;

run_hho_diffusion_solver(msh, hdi, stat_cond, stab_diam_F);
return 0;
}
Expand All @@ -142,17 +140,18 @@ int main(int argc, char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.quad$") ))
{
std::cout << "Guessed mesh format: DiSk++ Cartesian 2D" << std::endl;
auto msh = disk::load_cartesian_2d_mesh<T>(mesh_filename);
disk::cartesian_mesh<T, 2> msh;
disk::load_mesh_diskpp_cartesian<T>(mesh_filename, msh);
run_hho_diffusion_solver(msh, hdi, stat_cond, stab_diam_F);
return 0;
}


/* Netgen 3D */
if (std::regex_match(mesh_filename, std::regex(".*\\.mesh$") ))
{
std::cout << "Guessed mesh format: Netgen 3D" << std::endl;
auto msh = disk::load_netgen_3d_mesh<T>(mesh_filename);
disk::simplicial_mesh<T, 3> msh;
disk::load_mesh_netgen<T>(mesh_filename, msh);
run_hho_diffusion_solver(msh, hdi, stat_cond, stab_diam_F);
return 0;
}
Expand All @@ -161,7 +160,8 @@ int main(int argc, char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.hex$") ))
{
std::cout << "Guessed mesh format: DiSk++ Cartesian 3D" << std::endl;
auto msh = disk::load_cartesian_3d_mesh<T>(mesh_filename);
disk::cartesian_mesh<T, 3> msh;
disk::load_mesh_diskpp_cartesian<T>(mesh_filename, msh);
run_hho_diffusion_solver(msh, hdi, stat_cond, stab_diam_F);
return 0;
}
Expand All @@ -171,11 +171,8 @@ int main(int argc, char **argv)
{
std::cout << "Guessed mesh format: FVCA6 3D" << std::endl;
disk::generic_mesh<T,3> msh;

disk::load_mesh_fvca6_3d<T>(mesh_filename, msh);

run_hho_diffusion_solver(msh, hdi, stat_cond, stab_diam_F);

return 0;
}
}
Expand Down
34 changes: 25 additions & 9 deletions apps/diskpp_tutorials/diskpp_tutorial_3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,15 @@ int main(int argc, const char **argv)
const char *mesh_filename = argv[1];

using T = double;

/* FVCA5 2D */
if (std::regex_match(mesh_filename, std::regex(".*\\.typ1$") ))
{
std::cout << "Guessed mesh format: FVCA5 2D" << std::endl;
auto msh = disk::load_fvca5_2d_mesh<T>(mesh_filename);
disk::generic_mesh<T, 2> msh;
auto success = disk::load_mesh_fvca5_2d<T>(mesh_filename, msh);
if (!success)
return 1;
run(msh);
return 0;
}
Expand All @@ -88,7 +92,10 @@ int main(int argc, const char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.mesh2d$") ))
{
std::cout << "Guessed mesh format: Netgen 2D" << std::endl;
auto msh = disk::load_netgen_2d_mesh<T>(mesh_filename);
disk::simplicial_mesh<T, 2> msh;
auto success = disk::load_mesh_netgen<T>(mesh_filename, msh);
if (!success)
return 1;
run(msh);
return 0;
}
Expand All @@ -97,17 +104,22 @@ int main(int argc, const char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.quad$") ))
{
std::cout << "Guessed mesh format: DiSk++ Cartesian 2D" << std::endl;
auto msh = disk::load_cartesian_2d_mesh<T>(mesh_filename);
disk::cartesian_mesh<T, 2> msh;
auto success = disk::load_mesh_diskpp_cartesian<T>(mesh_filename, msh);
if (!success)
return 1;
run(msh);
return 0;
}


/* Netgen 3D */
if (std::regex_match(mesh_filename, std::regex(".*\\.mesh$") ))
{
std::cout << "Guessed mesh format: Netgen 3D" << std::endl;
auto msh = disk::load_netgen_3d_mesh<T>(mesh_filename);
disk::simplicial_mesh<T, 3> msh;
auto success = disk::load_mesh_netgen<T>(mesh_filename, msh);
if (!success)
return 1;
run(msh);
return 0;
}
Expand All @@ -116,7 +128,10 @@ int main(int argc, const char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.hex$") ))
{
std::cout << "Guessed mesh format: DiSk++ Cartesian 3D" << std::endl;
auto msh = disk::load_cartesian_3d_mesh<T>(mesh_filename);
disk::cartesian_mesh<T, 3> msh;
auto success = disk::load_mesh_diskpp_cartesian<T>(mesh_filename, msh);
if (!success)
return 1;
run(msh);
return 0;
}
Expand All @@ -126,13 +141,14 @@ int main(int argc, const char **argv)
{
std::cout << "Guessed mesh format: FVCA6 3D" << std::endl;
disk::generic_mesh<T,3> msh;
disk::load_mesh_fvca6_3d<T>(mesh_filename, msh);
auto success = disk::load_mesh_fvca6_3d<T>(mesh_filename, msh);
if (!success)
return 1;
run(msh);
return 0;
}


return 0;
}


}
26 changes: 14 additions & 12 deletions apps/helmholtz/helmholtz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ run_hho_helmholtz_solver(Mesh& msh, size_t degree, const typename Mesh::coordina
}

std::cout << "h = " << disk::average_diameter(msh) << std::endl;
std::cout << "L2 error: " << std::sqrt(l2_error) << std::endl;
std::cout << "Energy error: " << std::sqrt(nrg_error) << std::endl;
std::cout << "L2 error: " << std::sqrt(l2_error) << std::endl;
std::cout << "Energy error: " << std::sqrt(nrg_error) << std::endl;

disk::silo_database silo_db;
silo_db.create("helmholtz.silo");
Expand Down Expand Up @@ -248,8 +248,8 @@ int main(int argc, char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.mesh2d$") ))
{
std::cout << "Guessed mesh format: Netgen 2D" << std::endl;
auto msh = disk::load_netgen_2d_mesh<T>(mesh_filename);

disk::simplicial_mesh<T, 2> msh;
disk::load_mesh_netgen<T>(mesh_filename, msh);
run_hho_helmholtz_solver(msh, degree, stab_param);

return 0;
Expand All @@ -259,7 +259,8 @@ int main(int argc, char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.typ1$") ))
{
std::cout << "Guessed mesh format: FVCA5 2D" << std::endl;
auto msh = disk::load_fvca5_2d_mesh<T>(mesh_filename);
disk::generic_mesh<T, 2> msh;
disk::load_mesh_fvca5_2d<T>(mesh_filename, msh);

run_hho_helmholtz_solver(msh, degree, stab_param);

Expand All @@ -270,7 +271,8 @@ int main(int argc, char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.mesh$") ))
{
std::cout << "Guessed mesh format: Netgen 3D" << std::endl;
auto msh = disk::load_netgen_3d_mesh<T>(mesh_filename);
disk::simplicial_mesh<T, 3> msh;
disk::load_mesh_netgen<T>(mesh_filename, msh);

run_hho_helmholtz_solver(msh, degree, stab_param);

Expand All @@ -281,10 +283,11 @@ int main(int argc, char **argv)
if (std::regex_match(mesh_filename, std::regex(".*\\.hex$") ))
{
std::cout << "Guessed mesh format: DiSk++ Cartesian 3D" << std::endl;
auto msh = disk::load_cartesian_3d_mesh<T>(mesh_filename);

disk::cartesian_mesh<T, 3> msh;
disk::load_mesh_diskpp_cartesian<T>(mesh_filename, msh);

run_hho_helmholtz_solver(msh, degree, stab_param);

return 0;
}

Expand All @@ -293,11 +296,10 @@ int main(int argc, char **argv)
{
std::cout << "Guessed mesh format: FVCA6 3D" << std::endl;
disk::generic_mesh<T,3> msh;

disk::load_mesh_fvca6_3d<T>(mesh_filename, msh);

run_hho_helmholtz_solver(msh, degree, stab_param);

return 0;
}
}
Loading

0 comments on commit e21cb1f

Please sign in to comment.