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

Use size_type as return type of SparseMatrix::m(). #16670

Merged
merged 1 commit into from Feb 20, 2024

Conversation

bangerth
Copy link
Member

This makes these functions consistent with what we have in the Epetra wrappers, and (that was my original motivation) avoids warnings in the block matrix class about comparing integers of different sizes/signedness.

Conceptually, it makes sense to use size_type for these functions. size_type is defined as

include/deal.II/lac/trilinos_tpetra_sparse_matrix.h:      using size_type = dealii::types::global_dof_index;

So it is unsigned, which is exactly what these functions should return.

(I will note as an aside that different parts of the Tpetra wrappers define their own size_type types, and some of these are signed:

include/deal.II/lac/trilinos_tpetra_block_sparse_matrix.h:      using size_type       = typename BaseClass::size_type;
include/deal.II/lac/trilinos_tpetra_block_vector.h:      using size_type       = typename BaseClass::size_type;
include/deal.II/lac/trilinos_tpetra_solver_direct.h:      using size_type = dealii::types::signed_global_dof_index;   ******
include/deal.II/lac/trilinos_tpetra_sparse_matrix.h:      using size_type = dealii::types::global_dof_index;
include/deal.II/lac/trilinos_tpetra_sparse_matrix.templates.h:      using size_type = dealii::types::signed_global_dof_index;  ******
include/deal.II/lac/trilinos_tpetra_sparsity_pattern.h:        using size_type = dealii::types::signed_global_dof_index;  ******
include/deal.II/lac/trilinos_tpetra_sparsity_pattern.h:        using size_type = size_t;  ******
include/deal.II/lac/trilinos_tpetra_sparsity_pattern.h:      using size_type = dealii::types::signed_global_dof_index;  ******
include/deal.II/lac/trilinos_tpetra_vector.h:      using size_type = dealii::types::global_dof_index;
include/deal.II/lac/trilinos_tpetra_vector.h:      using size_type  = types::global_dof_index;

This is perhaps not great design. I'll open an issue about this.)

@bangerth
Copy link
Member Author

@jpthiele @kinnewig FYI

@masterleinad masterleinad merged commit 20586c5 into dealii:master Feb 20, 2024
16 checks passed
@bangerth bangerth deleted the size-type branch February 20, 2024 17:18
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