Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • T Trilinos
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 936
    • Issues 936
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • James Willenbring
  • Trilinos
  • Issues
  • #4680

Closed
Open
Created Mar 20, 2019 by James Willenbring@jmwilleMaintainer

Tpetra::CrsGraph, CrsMatrix: Constructor that takes an array of max row counts, takes it by ArrayRCP, but doesn't actually keep the reference

Created by: mhoemmen

@trilinos/tpetra @vbrunini

Both Tpetra::CrsGraph and Tpetra::CrsMatrix have constructors that take an array of the maximum number of entries in each row. The constructors take that array by Teuchos::ArrayRCP<const size_t>. Idiomatically, taking an ArrayRCP of const suggests that the class keeps a reference to the array, so that users shouldn't modify it. This is not what happens. Tpetra actually deep-copies the array.

We should thus change the constructors so they take either a raw array, or Teuchos::ArrayView<const size_t>. Once we have C++20, we can use std::span, which exactly expresses the desired idiom in native C++.

I found this by looking through Chaparral (@vbrunini of course has already fixed it to use StaticProfile, because he is just effective like that ;-) ). I saw that it was using a nonowning ArrayRCP there, and got worried, but then discovered that it didn't matter, since CrsGraph (and thus CrsMatrix) just deep-copies it.

Assignee
Assign to
Time tracking