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

make blueprint helpers available to multiple source files #713

Merged
merged 7 commits into from
Mar 16, 2021

Conversation

xjrc
Copy link
Member

@xjrc xjrc commented Feb 19, 2021

This pull request aims to clean up and abstract the Blueprint helper code (e.g. internal code for querying information about a mesh, like its dimsnion, striding, etc.) so that it's available to source code outside of conduit_blueprint_mesh.cpp. This refactoring will be particularly useful when tackling #682 and finalizing #642 as it will make this helper functionality available to the conduit_blueprint_mpi_mesh.cpp source code.

At a more fine-grained level, this pull request includes the following modifications:

  • Refactor all Blueprint static containers to use initializer lists.
  • Create a new internal object file that is imported by both conduit_blueprint_mesh.cpp and conduit_blueprint_mpi_mesh.cpp.
  • Incorporate a small amount of Blueprint helper code into conduit_blueprint_mpi_mesh.cpp and write associated test cases.

@xjrc xjrc added this to the 0.8.0 milestone Feb 19, 2021
@xjrc xjrc self-assigned this Feb 19, 2021
@coveralls
Copy link

coveralls commented Feb 19, 2021

Coverage Status

Coverage decreased (-0.2%) to 86.306% when pulling 1aad7da on xjrc:refactor/blueprint-abstract-helpers into 6353066 on LLNL:develop.

@xjrc xjrc force-pushed the refactor/blueprint-abstract-helpers branch from ceeeb6d to 9f16af9 Compare February 22, 2021 20:21
@xjrc xjrc removed the wip label Mar 2, 2021
@xjrc xjrc requested review from cyrush and nselliott March 2, 2021 22:34
@xjrc
Copy link
Member Author

xjrc commented Mar 2, 2021

@cyrush, @nselliott: I think that this PR is ready for review. Here's an overview of the main changes:

  1. The Blueprint topology utility code that lived in conduit_blueprint_mesh.cpp has been moved to conduit_blueprint_util_mesh.cpp, and exposed via conduit_blueprint_util_mesh.hpp. This header can be used from within any Blueprint source file.
  2. The conduit_blueprint_util_o2mrelation.hpp is an analogous module for general one-to-many utilities (currently just constant variables).
  3. The conduit::blueprint::mesh::coordset::length and conduit::blueprint::mesh::topology::{dims|length} functions have been added to the public Blueprint Mesh interface.
  4. Many test cases have been refactored to use the new constants/functions defined in conduit_blueprint_util_mesh.hpp and conduit_blueprint_util_o2mrelation.hpp.

This should help with #682 and some of the abstractions @nselliott has been working on. Let me know what you think!

/// file: conduit_blueprint_util_mesh.cpp
///
//-----------------------------------------------------------------------------

Copy link
Contributor

Choose a reason for hiding this comment

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

Since this file has no code that does anything, are you including it as a place for further additions?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's correct; I want the small amount of code that's in conduit_blueprint_util_o2mrelation.hpp and I figured that I'd include a corresponding source file just in case we ever need to put anything in it.

Copy link
Contributor

@nselliott nselliott left a comment

Choose a reason for hiding this comment

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

Thanks @xjrc , this is good.

@cyrush
Copy link
Member

cyrush commented Mar 5, 2021

Joe looks good, One overarching question I have

Should we use:

util::mesh or mesh::utils

I feel like a case could be made for mesh::utils -- they are utils that apply to things that confirm to the mesh bp?

Maybe the same should apply to o2m, but I didn't catch it there?

Want to make sure we consider it.

@xjrc
Copy link
Member Author

xjrc commented Mar 8, 2021

Joe looks good, One overarching question I have

Should we use:

util::mesh or mesh::utils

I feel like a case could be made for mesh::utils -- they are utils that apply to things that confirm to the mesh bp?

Maybe the same should apply to o2m, but I didn't catch it there?

Want to make sure we consider it.

I like the look of mesh::utils better, and I think it better describes the scope of the functionality (though, some things may ultimately live at some higher blueprint::utils level); I will make this change.

@xjrc xjrc closed this Mar 8, 2021
@xjrc xjrc reopened this Mar 8, 2021
@xjrc
Copy link
Member Author

xjrc commented Mar 8, 2021

@cyrush: I just remembered why I chose the current ordering: to better match with the nesting scheme used for blueprint::mpi::mesh. I still prefer your naming suggestion, though I suppose my question would be how does the utils namespace differ from the mpi namespace to justify the difference in ordering? If there is no substantial difference, my preference would be to reverse the order in both places (i.e. blueprint::mesh::mpi and blueprint::mesh::utils).

@cyrush
Copy link
Member

cyrush commented Mar 8, 2021

Hmm, lets ponder a bit more.

…nate the unused 'coords' function.

* Integrated the 'blueprint::util::mesh' constants into the BP meshing test cases.
* Made all of the 'blueprint::util::mesh' constants all caps to match Conduit convention.
…non-const 'generate_offsets'.

* Added regression tests for the new public Blueprint query functions in 't_blueprint_mesh_query.cpp'.
@xjrc xjrc force-pushed the refactor/blueprint-abstract-helpers branch from d9753ea to 666c0be Compare March 10, 2021 18:58
@cyrush
Copy link
Member

cyrush commented Mar 16, 2021

Still not sure what is best here.

Note: Everything under blueprint::mpi exists in the mpi-enabled lib -- that's one type of logical grouping that is useful in a different way b/c it has linking implications.

Also what do we think about blueprint::mesh::utils blueprint::mpi::mesh::utils?

Honestly -- we can also consider placing those methods simply in blueprint::mesh, unless you are worried they will clutter the namespace? Lots of choices to consider (?)

@xjrc
Copy link
Member Author

xjrc commented Mar 16, 2021

Still not sure what is best here.

Note: Everything under blueprint::mpi exists in the mpi-enabled lib -- that's one type of logical grouping that is useful in a different way b/c it has linking implications.

That seems to me like a reasonable factor of differentiation.

Also what do we think about blueprint::mesh::utils blueprint::mpi::mesh::utils?

Honestly -- we can also consider placing those methods simply in blueprint::mesh, unless you are worried they will clutter the namespace? Lots of choices to consider (?)

I think that the former is fine, and I certainly prefer it to the latter. I'd like to separate out these functions to help identify them as utilities that have lower-level use cases and interfaces. I will change the namespace ordering.

@cyrush
Copy link
Member

cyrush commented Mar 16, 2021

sorry one more nitpick: we have conduit::utils, so should these be utils

@xjrc
Copy link
Member Author

xjrc commented Mar 16, 2021

sorry one more nitpick: we have conduit::utils, so should these be utils

Point well taken; the changes have been made.

Copy link
Member

@cyrush cyrush left a comment

Choose a reason for hiding this comment

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

thanks @xjrc , looks good!

@xjrc
Copy link
Member Author

xjrc commented Mar 16, 2021

@cyrush: Can you merge (if Travis looks okay; it failed on grabbing packages, so it's likely on their end)? It looks like I don't have the proper permissions.

@cyrush
Copy link
Member

cyrush commented Mar 16, 2021

yes, I just re-started travis.

But it is strange you can't merge, we should figure that out.

@cyrush cyrush merged commit 8a0591a into LLNL:develop Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Blueprint
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

4 participants