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

Generate 1D strip matsets #1038

Merged
merged 4 commits into from Nov 18, 2022
Merged

Conversation

agcapps
Copy link
Member

@agcapps agcapps commented Nov 8, 2022

Similar to fields, new matsets must be generated that point to the new topologies.

@agcapps agcapps requested a review from cyrush November 8, 2022 20:20
@agcapps agcapps self-assigned this Nov 8, 2022
@@ -642,6 +650,11 @@ namespace topology
//-----------------------------------------------------------------------------
namespace matset
{
//-------------------------------------------------------------------------
void CONDUIT_BLUEPRINT_API generate_strip(conduit::Node& fields,
Copy link
Member

Choose a reason for hiding this comment

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

This should be a private helper b/c it really can't be used outside the context of other generate_strip methods.

Copy link
Member

Choose a reason for hiding this comment

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

Further review: don't think we need this this guy?
(Not being called)

Sorry if I am commenting while things are evolving.

@agcapps
Copy link
Member Author

agcapps commented Nov 8, 2022

Need to add tests

@agcapps
Copy link
Member Author

agcapps commented Nov 8, 2022

Putting up this PR because it turns out we need matsets right away.

}

// check for target matset names
if (options.has_child("matset_names"))
Copy link
Member

Choose a reason for hiding this comment

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

Note: matset names could be inferred from the field_names options (or all fields).
I expect thats how folks would think to use it ("I want these fields, make it so")


// generate new coordset, topology, and fields
mesh::generate_strip(topo, topo_dest, coords_dest, fields_dest, options);

Copy link
Member

@cyrush cyrush Nov 8, 2022

Choose a reason for hiding this comment

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

For any new field that has a matset, we need to rewire:

fields/{name}/matset = newmatsetname

@agcapps
Copy link
Member Author

agcapps commented Nov 9, 2022

Matsets refer to a topology. All fields refer to a topology, and some fields refer to a matset.

Here's my question, @cyrush : Will we ever have a matset that does not get referred to by a field? Do we care about those matsets? It's much easier if we can ignore "orphan" matsets that refer to the source topo but aren't referred to by any field. In that case, as you suggested on line 2287 of conduit_blueprint_mesh.cpp, we can just use options/field_prefix to name the new matsets.

I guess we could use options/field_prefix to name all the new matsets that get created for the new topology. Thoughts?

@cyrush
Copy link
Member

cyrush commented Nov 9, 2022

For the intended use case, I believe folks will care first and foremost about mapping fields ("I need these fields")
and a standalone matset (no related fields) would only pop up for testing.

To give full control, let's provide a matsets_prefix option that acts like fields_prefix. (that is optional, but when specifi is used for any new matsets created)

@agcapps
Copy link
Member Author

agcapps commented Nov 9, 2022

Another question: A common case (that we are showing in the example) is for the user to create the new topo and all dependent fields, etc. in the same mesh. In this case, unless the user specifies a fields_prefix, there will be overwritten fields. Do we care? Should we make a default fields_prefix?

I mean, perhaps the user meant to overwrite the field, though I really doubt that.

@cyrush
Copy link
Member

cyrush commented Nov 9, 2022

I think overwriting fields (and other components) will be unintended in most all cases, and could be a source of pain.

We should error if folks try to override any field, or matset.

We could also guard the topology or coordset, but those checks will require different implementation.

@agcapps
Copy link
Member Author

agcapps commented Nov 10, 2022

We need to exercise this on a test. This opens up a huge can of worms. Only one of the meshes produced by the functions in conduit_blueprint_examples.cpp has a matset, and that one isn't linked to a field.

We could add matsets to basic(); I think that would definitely be scope creep.

We could add a top level (public) function to conduit_blueprint_mesh_examples.hpp/cpp, named something like add_mixed_field(), that only operates on rectilinear or structured meshes.

And then there is the fact that we have several different forms of matset. I would propose to generate the form that the user needs, then later add the others.

@cyrush
Copy link
Member

cyrush commented Nov 10, 2022

We do need test data to exercise this -- but we don't need a fully fledged example.

Since we are doing a simple 1D dataset as input, I recommend we create a matset and field.
Easiest style matset and corresponding field data.

We effectively copy the matset so I am not worried about testing all the combos of the matset internals.

@agcapps
Copy link
Member Author

agcapps commented Nov 10, 2022

We do need test data to exercise this -- but we don't need a fully fledged example.

Agreed!

Since we are doing a simple 1D dataset as input, I recommend we create a matset and field. Easiest style matset and corresponding field data.

OK, so I'll build the matset in the test.

We effectively copy the matset so I am not worried about testing all the combos of the matset internals.

Yes, I'll build the kind of matset that we're interested in.

@cyrush
Copy link
Member

cyrush commented Nov 10, 2022

Good plan.

@agcapps agcapps merged commit 36a58a4 into develop Nov 18, 2022
@agcapps agcapps deleted the bugfix/capps2/1D_matsets_to_strip branch November 18, 2022 20:56
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.

None yet

2 participants