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

Epetra vector access operator #16880

Merged
merged 3 commits into from
Apr 17, 2024

Conversation

pcafrica
Copy link
Contributor

@pcafrica pcafrica commented Apr 12, 2024

This PR adresses - and hopefully solves - #16877.

Copy link
Member

@bangerth bangerth left a comment

Choose a reason for hiding this comment

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

Thank you!

Comment on lines 63 to 73
namespace internal
{
/**
* Declare type for container size.
*/
using size_type = dealii::types::global_dof_index;

/**
* Declare type for container value type.
*/
using value_type = double;
Copy link
Member

Choose a reason for hiding this comment

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

Could we choose a namespace that makes sure these typedefs are only used for vectors? Say EpetraWrappers::internal::Vector or so?

Copy link
Contributor Author

@pcafrica pcafrica Apr 13, 2024

Choose a reason for hiding this comment

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

Hi @bangerth, I'm not sure if I got your comment correctly.

I just followed the same pattern used in other similar classes (Tpetra Vector, TrilinosWrappers::MPI::Vector and so on).

What exactly do you mean by choosing a different namespace for these aliases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you just want to drop aliases from the internal namespace and leave them only in the main Vector class?

Copy link
Member

Choose a reason for hiding this comment

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

What I meant is that having

  namespace EpetraWrappers {
    namespace internal {
      using value_type = double;

leaves a generically names type value_type in a namespace that is not clearly associated with the Vector class. It is perhaps true that all of the EpetraWrappers classes use double as their value type, but the point of the value_type you declare here is to support one specific class, and that should be made clear by either choosing a name that makes that obvious, or put it into a namespace that is clearly associated with the Vector class.

The ideal namespace, of course, is the class itself. So if there was a way to redirect all of the places where you use the typdef to the Vector::value_type type, that would be ideal.

Same for the other typedef (size_type).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I see your point. Would something like this work?

I'm noticing a similar pattern in other places (e.g. in trilinos_vector.h and trilinos_tpetra_vector.h). If my proposed solution is ok, I'll take care of propagating the modification there.

Copy link
Member

@bangerth bangerth left a comment

Choose a reason for hiding this comment

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

Let me retract the approval -- this is ok to merge if we can find a different place for the using declaration.

@pcafrica pcafrica force-pushed the epetra_vector_access_operator branch 2 times, most recently from 98210db to c356f59 Compare April 16, 2024 07:50
Copy link
Member

@bangerth bangerth left a comment

Choose a reason for hiding this comment

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

Yes, this works. Thanks for working with me on this issue!

I'd be very happy to approve (separate) PRs if you wanted to fix this in other places as well!

@bangerth
Copy link
Member

Would you mind fix-up'ing the indent commit into the commit it is supposed to fix?

@pcafrica pcafrica force-pushed the epetra_vector_access_operator branch from 6d139c1 to de0596c Compare April 16, 2024 22:15
@pcafrica
Copy link
Contributor Author

Would you mind fix-up'ing the indent commit into the commit it is supposed to fix?

Done!

@bangerth
Copy link
Member

/rebuild

@bangerth
Copy link
Member

Thank you -- good to go!

@bangerth bangerth merged commit 162f6fe into dealii:master Apr 17, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants