Skip to content

Commit 43d0db9

Browse files
committed
add graduation_width in mesh_config
1 parent 373567f commit 43d0db9

File tree

7 files changed

+189
-109
lines changed

7 files changed

+189
-109
lines changed

demos/FiniteVolume/heat.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ int main(int argc, char* argv[])
127127
{
128128
auto config = samurai::mesh_config<dim>().min_level(min_level).max_level(max_level);
129129
mesh = {config, box};
130-
// mesh = {box, min_level, max_level};
131130
u.resize();
132131
// Initial solution
133132
if (init_sol == "dirac")

demos/FiniteVolume/linear_convection.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ int main(int argc, char* argv[])
7676
app.add_flag("--implicit", implicit_scheme, "Implicit scheme instead of explicit")->group("Simulation parameters");
7777
app.add_option("--dt", dt, "Time step")->capture_default_str()->group("Simulation parameters");
7878
app.add_option("--cfl", cfl, "The CFL")->capture_default_str()->group("Simulation parameters");
79-
app.add_option("--min-level", min_level, "Minimum level of the multiresolution")->capture_default_str()->group("Multiresolution");
80-
app.add_option("--max-level", max_level, "Maximum level of the multiresolution")->capture_default_str()->group("Multiresolution");
8179
app.add_option("--path", path, "Output path")->capture_default_str()->group("Output");
8280
app.add_option("--filename", filename, "File name prefix")->capture_default_str()->group("Output");
8381
app.add_option("--nfiles", nfiles, "Number of output files")->capture_default_str()->group("Output");
@@ -100,7 +98,8 @@ int main(int argc, char* argv[])
10098

10199
if (restart_file.empty())
102100
{
103-
mesh = {box, min_level, max_level, periodic};
101+
auto config = samurai::mesh_config<dim>().min_level(min_level).max_level(max_level).periodic(periodic);
102+
mesh = {config, box};
104103
// Initial solution
105104
u = samurai::make_scalar_field<double>("u",
106105
mesh,
@@ -145,7 +144,7 @@ int main(int argc, char* argv[])
145144

146145
if (dt == 0)
147146
{
148-
double dx = mesh.cell_length(max_level);
147+
double dx = mesh.cell_length(mesh.max_level());
149148
auto a = xt::abs(velocity);
150149
double sum_velocities = xt::sum(xt::abs(velocity))();
151150
dt = cfl * dx / sum_velocities;

demos/FiniteVolume/linear_convection_obstacle.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ int main(int argc, char* argv[])
6262
app.add_option("--Tf", Tf, "Final time")->capture_default_str()->group("Simulation parameters");
6363
app.add_option("--dt", dt, "Time step")->capture_default_str()->group("Simulation parameters");
6464
app.add_option("--cfl", cfl, "The CFL")->capture_default_str()->group("Simulation parameters");
65-
app.add_option("--min-level", min_level, "Minimum level of the multiresolution")->capture_default_str()->group("Multiresolution");
66-
app.add_option("--max-level", max_level, "Maximum level of the multiresolution")->capture_default_str()->group("Multiresolution");
6765
app.add_option("--path", path, "Output path")->capture_default_str()->group("Output");
6866
app.add_option("--filename", filename, "File name prefix")->capture_default_str()->group("Output");
6967
app.add_option("--nfiles", nfiles, "Number of output files")->capture_default_str()->group("Output");
@@ -77,7 +75,9 @@ int main(int argc, char* argv[])
7775
samurai::DomainBuilder<dim> domain({-1., -1.}, {1., 1.});
7876
domain.remove({0.0, 0.0}, {0.4, 0.4});
7977

80-
Mesh mesh(domain, min_level, max_level);
78+
auto config = samurai::mesh_config<dim>().min_level(min_level).max_level(max_level);
79+
Mesh mesh = {config, domain};
80+
// Mesh mesh(domain, min_level, max_level);
8181

8282
// Initial solution
8383
auto u = samurai::make_scalar_field<double>("u",
@@ -117,7 +117,7 @@ int main(int argc, char* argv[])
117117

118118
if (dt == 0)
119119
{
120-
double dx = mesh.cell_length(max_level);
120+
double dx = mesh.cell_length(mesh.max_level());
121121
auto a = xt::abs(constant_velocity);
122122
double sum_velocities = xt::sum(xt::abs(constant_velocity))();
123123
dt = cfl * dx / sum_velocities;

include/samurai/arguments.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ namespace samurai
99
namespace args
1010
{
1111
// Mesh arguments
12-
static std::size_t min_level = std::numeric_limits<std::size_t>::max();
13-
static std::size_t max_level = std::numeric_limits<std::size_t>::max();
12+
static std::size_t min_level = std::numeric_limits<std::size_t>::max();
13+
static std::size_t max_level = std::numeric_limits<std::size_t>::max();
14+
static std::size_t graduation_width = std::numeric_limits<std::size_t>::max();
1415

1516
static bool timers = false;
1617
#ifdef SAMURAI_WITH_MPI
@@ -30,6 +31,7 @@ namespace samurai
3031
{
3132
app.add_option("--min-level", args::min_level, "The minimum level of the mesh")->group("SAMURAI");
3233
app.add_option("--max-level", args::max_level, "The maximum level of the mesh")->group("SAMURAI");
34+
app.add_option("--graduation-width", args::graduation_width, "The graduation width of the mesh")->group("SAMURAI");
3335

3436
#ifdef SAMURAI_WITH_MPI
3537
app.add_flag("--dont-redirect-output", args::dont_redirect_output, "Redirect the output for all ranks different of 0")

0 commit comments

Comments
 (0)