Skip to content

Added the Mesh_topology enum class. - #3490

Open
wearysebas wants to merge 3 commits into
nextfrom
MeshTopology_rebase
Open

Added the Mesh_topology enum class.#3490
wearysebas wants to merge 3 commits into
nextfrom
MeshTopology_rebase

Conversation

@wearysebas

Copy link
Copy Markdown
Collaborator

The getMeshTopology function identifies the current topology and the variable now stores the value so that it can be used anywhere.

To be expanded with the Snowflake and X-Point topology.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

return MeshTopology::connected_double_null;
} else {
return MeshTopology::unconnected_double_null;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use 'else' after 'return' [readability-else-after-return]

Suggested change
}
} if (jyseps2_1 == jyseps1_2) {
return MeshTopology::single_null;
} else if (ixseps1 == ixseps2) {
return MeshTopology::connected_double_null;
} else {
return MeshTopology::unconnected_double_null;
}

if (NPES % (possible_nxpe * possible_nype) != 0) {
continue;
}
int possible_npes = possible_nxpe * possible_nype;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'possible_npes' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int possible_npes = possible_nxpe * possible_nype;
int const possible_npes = possible_nxpe * possible_nype;

if (mesh_topology == MeshTopology::unconnected_double_null
|| mesh_topology == MeshTopology::connected_double_null) {
if (not(jyseps1_1 < jyseps2_1 && jyseps2_1 < ny_inner
&& ny_inner < jyseps1_2 && jyseps1_2 < jyseps2_2)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]

Suggested change
&& ny_inner < jyseps1_2 && jyseps1_2 < jyseps2_2)) {
if (jyseps1_1 >= jyseps2_1 || jyseps2_1 >= ny_inner
|| ny_inner >= jyseps1_2 || jyseps1_2 >= jyseps2_2) {


mesh_topology = getMeshTopology(jyseps1_1, jyseps2_1, jyseps1_2, jyseps2_2, ny_inner,
ixseps1, ixseps2);
output_info << _("Detected mesh topology = ") << toString(mesh_topology) << std::endl;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]

Suggested change
output_info << _("Detected mesh topology = ") << toString(mesh_topology) << std::endl;
output_info << _("Detected mesh topology = ") << toString(mesh_topology) << '\n';

proc[1] = PROC_NUM(i, YPROC(jyseps2_2));

output_debug << "CORE2 " << proc[0] << ", " << proc[1] << endl;
output_debug << "CORE2 " << proc[0] << ", " << proc[1] << endl;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use 'endl' with streams; use '\n' instead [performance-avoid-endl]

Suggested change
output_debug << "CORE2 " << proc[0] << ", " << proc[1] << endl;
output_debug << "CORE2 " << proc[0] << ", " << proc[1] << '\n';

periodicX = periodic_X_;
setYDecompositionIndices(jyseps1_1_, jyseps2_1_, jyseps1_2_, jyseps2_2_, ny_inner_);
mesh_topology = getMeshTopology(jyseps1_1, jyseps2_1, jyseps1_2, jyseps2_2, ny_inner,
ixseps1, ixseps2);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'mesh_topology' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]

src/mesh/impls/bout/boutmesh.cxx:2098:

-       NYPE(nype), ixseps1(ixseps1_), ixseps2(ixseps2_), symmetricGlobalX(symmetric_X),
+       NYPE(nype), ixseps1(ixseps1_), ixseps2(ixseps2_), mesh_topology(getMeshTopology(jyseps1_1, jyseps2_1, jyseps1_2, jyseps2_2, ny_inner,
+                                   ixseps1, ixseps2)), symmetricGlobalX(symmetric_X),
Suggested change
ixseps1, ixseps2);

/// Topology and communications compatible with BOUT
/// conventions.

BOUT_ENUM_CLASS(MeshTopology,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "BOUT_ENUM_CLASS" is directly included [misc-include-cleaner]

src/mesh/impls/bout/boutmesh.hxx:6:

- #include "bout/bout_types.hxx"
+ #include "bout/bout_enum_class.hxx"
+ #include "bout/bout_types.hxx"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant