-
Notifications
You must be signed in to change notification settings - Fork 0
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
Hermes-3 merges #1
base: next
Are you sure you want to change the base?
Changes from 8 commits
9d7f620
c8e3dd0
2e9f495
1c77e00
7d261d4
30a93f7
fee27c9
96da2e9
e56981c
6b2c132
df2d661
263f9fe
bac4ca9
708bdcb
d88b454
023bc41
affc995
71f5b6a
31fd461
17e46cf
9c0ae16
4a17b49
2f7c3c0
d611758
db96b7e
84bfcef
73265df
8ff388a
d7f8807
acdc86c
87e6877
ffca58c
bb7c0f2
01951e8
44022f9
9cccd66
79821e2
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 |
---|---|---|
|
@@ -138,7 +138,10 @@ struct GetDimensions { | |
std::vector<int> operator()([[maybe_unused]] int value) { return {1}; } | ||
std::vector<int> operator()([[maybe_unused]] BoutReal value) { return {1}; } | ||
std::vector<int> operator()([[maybe_unused]] const std::string& value) { return {1}; } | ||
std::vector<int> operator()(const Array<BoutReal>& array) { return {array.size()}; } | ||
template <typename T> | ||
std::vector<int> operator()(const Array<T>& array) { | ||
return {array.size()}; | ||
} | ||
std::vector<int> operator()(const Matrix<BoutReal>& array) { | ||
const auto shape = array.shape(); | ||
return {std::get<0>(shape), std::get<1>(shape)}; | ||
|
@@ -477,7 +480,26 @@ bool GridFile::get([[maybe_unused]] Mesh* m, [[maybe_unused]] std::vector<int>& | |
[[maybe_unused]] GridDataSource::Direction dir) { | ||
TRACE("GridFile::get(vector<int>)"); | ||
|
||
return false; | ||
if (not data.isSet(name)) { | ||
return false; | ||
} | ||
|
||
const auto full_var = data[name].as<Array<int>>(); | ||
|
||
// Check size | ||
if (full_var.size() < len + offset) { | ||
throw BoutException("{} has length {}. Expected {} elements + {} offset", name, | ||
full_var.size(), len, offset); | ||
} | ||
|
||
// Ensure that output variable has the correct size | ||
var.resize(len); | ||
|
||
const auto* it = std::begin(full_var); | ||
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. warning: variable name 'it' is too short, expected at least 3 characters [readability-identifier-length] const auto* it = std::begin(full_var);
^ |
||
std::advance(it, offset); | ||
std::copy_n(it, len, std::begin(var)); | ||
|
||
return true; | ||
} | ||
|
||
bool GridFile::get(Mesh* UNUSED(m), std::vector<BoutReal>& var, const std::string& name, | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2117,6 +2117,35 @@ void BoutMesh::topology() { | |||||||||
add_target(ny_inner - 1, 0, nx); | ||||||||||
} | ||||||||||
|
||||||||||
// Additional limiters | ||||||||||
// Each limiter needs 3 indices: A Y index, start and end X indices | ||||||||||
int limiter_count = 0; | ||||||||||
Mesh::get(limiter_count, "limiter_count", 0); | ||||||||||
if (limiter_count > 0) { | ||||||||||
std::vector<int> limiter_yinds, limiter_xstarts, limiter_xends; | ||||||||||
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. warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]
Suggested change
|
||||||||||
if (!source->get(this, limiter_yinds, "limiter_yinds", limiter_count)) { | ||||||||||
throw BoutException("Couldn't read limiter_yinds vector of length {} from mesh", | ||||||||||
limiter_count); | ||||||||||
} | ||||||||||
if (!source->get(this, limiter_xstarts, "limiter_xstarts", limiter_count)) { | ||||||||||
throw BoutException("Couldn't read limiter_xstarts vector of length {} from mesh", | ||||||||||
limiter_count); | ||||||||||
} | ||||||||||
if (!source->get(this, limiter_xends, "limiter_xends", limiter_count)) { | ||||||||||
throw BoutException("Couldn't read limiter_xend vector of length {} from mesh", | ||||||||||
limiter_count); | ||||||||||
} | ||||||||||
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. warning: variable 'yind' of type 'int' can be declared 'const' [misc-const-correctness]
Suggested change
|
||||||||||
|
||||||||||
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. warning: variable 'xstart' of type 'int' can be declared 'const' [misc-const-correctness]
Suggested change
|
||||||||||
for (int i = 0; i < limiter_count; ++i) { | ||||||||||
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. warning: variable 'xend' of type 'int' can be declared 'const' [misc-const-correctness]
Suggested change
|
||||||||||
int yind = limiter_yinds[i]; | ||||||||||
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. warning: variable 'yind' of type 'int' can be declared 'const' [misc-const-correctness]
Suggested change
|
||||||||||
int xstart = limiter_xstarts[i]; | ||||||||||
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. warning: variable 'xstart' of type 'int' can be declared 'const' [misc-const-correctness]
Suggested change
|
||||||||||
int xend = limiter_xends[i]; | ||||||||||
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. warning: variable 'xend' of type 'int' can be declared 'const' [misc-const-correctness]
Suggested change
|
||||||||||
output_info.write("Adding a limiter between y={} and {}. X indices {} to {}\n", | ||||||||||
yind, yind + 1, xstart, xend); | ||||||||||
add_target(yind, xstart, xend); | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
if ((ixseps_inner > 0) | ||||||||||
&& (((PE_YIND * MYSUB > jyseps1_1) && (PE_YIND * MYSUB <= jyseps2_1)) | ||||||||||
|| ((PE_YIND * MYSUB > jyseps1_2) && (PE_YIND * MYSUB <= jyseps2_2)))) { | ||||||||||
|
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.
warning: variable name 'it' is too short, expected at least 3 characters [readability-identifier-length]