-
Notifications
You must be signed in to change notification settings - Fork 44
WIP: TOML Parameters #1277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
WIP: TOML Parameters #1277
Changes from 7 commits
f9cdea6
612dbbd
a0563cc
28d0dda
7c6b5b4
0db82f4
17a985e
f6ad86c
3d4dc5b
132f183
39089fb
6dd8649
15e6f87
864f8e9
a6c2dbf
24b0719
c1f2168
7e837bd
19f380e
e369e7f
1230639
bf375c8
25ed9db
b0964ef
7602e72
4398f7d
7086359
2b0b0a8
4f06b22
92d5f62
f904817
43e4fd3
9f2eb8c
a09bce8
62af088
98e99f2
dea09de
d9569d0
b79e41a
bd52ed7
d570058
efb065e
ecf869b
3512b7f
3d71dcd
469903a
44559a5
5bbc09c
38fc240
2e7bed7
13cbae6
7e775b8
8e0a2e7
bb93a3c
b86fe1e
eea42fb
6c229da
4bd0383
c93ab26
aff47d9
f5ebe91
07c7809
9d3c0da
5099ff1
edc9ead
c63f97a
b169872
a7ac214
eb0ddef
73ee2ea
925d529
e125829
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,16 +68,12 @@ Mesh::Mesh(ParameterInput *pin, ApplicationInput *app_in, Packages_t &packages, | |
| adaptive(pin->GetOrAddString("parthenon/mesh", "refinement", "none") == "adaptive" | ||
| ? true | ||
| : false), | ||
| multilevel( | ||
| (adaptive || | ||
| pin->GetOrAddString("parthenon/mesh", "refinement", "none") == "static" || | ||
| pin->GetOrAddString("parthenon/mesh", "multigrid", "false") == "true") | ||
| ? true | ||
| : false), | ||
| multigrid(pin->GetOrAddString("parthenon/mesh", "multigrid", "false") == "true" | ||
| ? true | ||
| : false), | ||
|
Yurlungur marked this conversation as resolved.
Outdated
|
||
| nbnew(), nbdel(), step_since_lb(), gflag(), packages(packages), | ||
| multilevel(adaptive || | ||
| pin->GetOrAddString("parthenon/mesh", "refinement", "none") == | ||
| "static" || | ||
| pin->GetOrAddBoolean("parthenon/mesh", "multigrid", false)), | ||
| multigrid(pin->GetOrAddBoolean("parthenon/mesh", "multigrid", false)), nbnew(), | ||
| nbdel(), step_since_lb(), gflag(), packages(packages), | ||
| resolved_packages(ResolvePackages(packages)), | ||
| default_pack_size_(pin->GetOrAddInteger("parthenon/mesh", "pack_size", -1)), | ||
| // private members: | ||
|
|
@@ -739,10 +735,6 @@ void Mesh::FillDerived() { | |
| } | ||
| } | ||
|
|
||
| //---------------------------------------------------------------------------------------- | ||
| // \!fn void Mesh::Initialize(bool init_problem, ParameterInput *pin) | ||
| // \brief initialization before the main loop | ||
|
|
||
| void Mesh::Initialize(bool init_problem, ParameterInput *pin, ApplicationInput *app_in) { | ||
| PARTHENON_INSTRUMENT | ||
| bool init_done = true; | ||
|
|
@@ -1095,27 +1087,28 @@ void Mesh::DoStaticRefinement(ParameterInput *pin) { | |
| return std::pair<int, int>{lxmin, lxmax}; | ||
| }; | ||
|
|
||
| InputBlock *pib = pin->pfirst_block; | ||
| while (pib != nullptr) { | ||
| if (pib->block_name.compare(0, 27, "parthenon/static_refinement") == 0) { | ||
| for (auto pib : pin->Blocks("parthenon")) { | ||
| std::string block_name = std::string(pib.first); | ||
|
Comment on lines
+1116
to
+1117
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to confirm, you could have instead done a search for "parthenon/static_refinement" here right? You just chose to use the nested block structure?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, not really. Asking for
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm I don't love that... oh well... price we pay maybe.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this a price? I thought separating Parthenon blocks was the whole reason for naming them all
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just want the ability to loop over all blocks, which is something someone might want to do. But if you've added a visitor that visits everything, then it's a non-issue. |
||
| if (block_name.compare(0, 17, "static_refinement") == 0) { | ||
| RegionSize ref_size; | ||
| ref_size.xmin(X1DIR) = pin->GetReal(pib->block_name, "x1min"); | ||
| ref_size.xmax(X1DIR) = pin->GetReal(pib->block_name, "x1max"); | ||
| std::string block_path = "parthenon." + block_name; | ||
| ref_size.xmin(X1DIR) = pin->GetReal(block_path, "x1min"); | ||
| ref_size.xmax(X1DIR) = pin->GetReal(block_path, "x1max"); | ||
| if (ndim >= 2) { | ||
| ref_size.xmin(X2DIR) = pin->GetReal(pib->block_name, "x2min"); | ||
| ref_size.xmax(X2DIR) = pin->GetReal(pib->block_name, "x2max"); | ||
| ref_size.xmin(X2DIR) = pin->GetReal(block_path, "x2min"); | ||
| ref_size.xmax(X2DIR) = pin->GetReal(block_path, "x2max"); | ||
| } else { | ||
| ref_size.xmin(X2DIR) = mesh_size.xmin(X2DIR); | ||
| ref_size.xmax(X2DIR) = mesh_size.xmax(X2DIR); | ||
| } | ||
| if (ndim == 3) { | ||
| ref_size.xmin(X3DIR) = pin->GetReal(pib->block_name, "x3min"); | ||
| ref_size.xmax(X3DIR) = pin->GetReal(pib->block_name, "x3max"); | ||
| ref_size.xmin(X3DIR) = pin->GetReal(block_path, "x3min"); | ||
| ref_size.xmax(X3DIR) = pin->GetReal(block_path, "x3max"); | ||
| } else { | ||
| ref_size.xmin(X3DIR) = mesh_size.xmin(X3DIR); | ||
| ref_size.xmax(X3DIR) = mesh_size.xmax(X3DIR); | ||
| } | ||
| int ref_lev = pin->GetInteger(pib->block_name, "level"); | ||
| int ref_lev = pin->GetInteger(block_path, "level"); | ||
| int lrlev = ref_lev + GetLegacyTreeRootLevel(); | ||
| // range check | ||
| if (ref_lev < 1) { | ||
|
|
@@ -1167,7 +1160,6 @@ void Mesh::DoStaticRefinement(ParameterInput *pin) { | |
| } | ||
| } | ||
| } | ||
| pib = pib->pnext; | ||
| } | ||
| } | ||
| // Return list of locations and levels for the legacy tree | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the preferred way to do it? Not
add_subdirectory? How does this work for installing parthenon as a library?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's header only, so I assumed this was how to do it. But there are a ton of installation methods on the website, maybe another works better? Didn't really think about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do
add_subdirectoryand then addTOMLas a CMake target, the same way we add Kokkos. That should automatically thread it through all of the nonsenseCMakemight rely on.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The website doesn't explicitly call that approach out, but I see the cmake supports it. There's checks about whether or not the project is "top level."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I tried messing with this a bit and it doesn't seem like TOML++'s build system supports this. So we should leave it for now and I'll submit an issue.