Skip to content
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

Cleanup in geodata.hpp/cpp #154

Merged
merged 6 commits into from
Jan 5, 2024
Merged

Cleanup in geodata.hpp/cpp #154

merged 6 commits into from
Jan 5, 2024

Conversation

sebastiangrimberg
Copy link
Contributor

Minor cleanup of geodata helper functions and declarations, in preparation for palace::Mesh class. Includes some const correctness fixes for mfem::Mesh enabled by #151.

@sebastiangrimberg sebastiangrimberg added the enhancement New feature or request label Dec 14, 2023
@sebastiangrimberg sebastiangrimberg force-pushed the sjg/geodata-updates branch 2 times, most recently from b612c06 to c3866a3 Compare December 15, 2023 01:11
@sebastiangrimberg sebastiangrimberg marked this pull request as ready for review December 15, 2023 05:10
@sebastiangrimberg sebastiangrimberg force-pushed the sjg/build-system-updates branch 2 times, most recently from 6575381 to 0f520fb Compare December 19, 2023 16:33
Base automatically changed from sjg/build-system-updates to main December 20, 2023 17:39
@sebastiangrimberg sebastiangrimberg mentioned this pull request Dec 20, 2023
11 tasks
@@ -1020,18 +1020,17 @@ void WavePortOperator::PrintBoundaryInfo(const IoData &iodata, mfem::ParMesh &me
continue;
}
const int attr = i + 1;
mfem::Vector nor;
mesh::GetSurfaceNormal(mesh, attr, nor);
mfem::Vector normal = mesh::GetSurfaceNormal(mesh, attr);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: maybe auto for these GetSurfaceNormal? Reducing the number of mfem::Vector in the repo seems worthwhile, to avoid possible confusion on when to use which.

Comment on lines +1377 to +1381
std::sort(attributes.begin(), attributes.end());
attributes.erase(unique(attributes.begin(), attributes.end()), attributes.end());
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like avoiding the expensive resorting on every insert for set, given we only care about the sorted and unique invariant after they're fully collected. I'm assuming the possible duplication/size issues of attributes for all of these aren't concerning either.

Might consider shrink_to_fit on these attribute vectors after this unique, given they shouldn't be changed again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 7eb7ec.

{
// MeshGenerator is reduced over the communicator. This checks for geometries on any
// processor.
auto meshgen = mesh.MeshGenerator();
auto meshgen = const_cast<mfem::Mesh &>(mesh).MeshGenerator();
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's so annoying of MeshGenerator(), no reason that shouldn't be const.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is actually no longer needed after the patch from #151 (from mfem/mfem#4019).

@hughcars
Copy link
Collaborator

hughcars commented Jan 4, 2024

#164 minor mfem patch for the segfault issue with "SaveAdaptMesh"

@sebastiangrimberg sebastiangrimberg merged commit 9b9cb88 into main Jan 5, 2024
17 checks passed
@sebastiangrimberg sebastiangrimberg deleted the sjg/geodata-updates branch January 5, 2024 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants