[Trilinos-Users] Epetra_MultiVector - construction with fixed stride
Martin Vymazal
martin.vymazal at vki.ac.be
Thu Oct 23 09:18:57 MDT 2014
Hello,
could someone please provide a code snippet demonstrating the use of the
following Epetra_MultiVector constructor
Epetra_MultiVector::Epetra_MultiVector (Epetra_DataAccess CV,
const Epetra_BlockMap & Map,
double * A,
int MyLDA,
int NumVectors
)
Say I would like to store 5 vectors of length 100 aligned in memory directly
after each other with no gaps. Does this mean that I am responsible for
allocating an array of doubles with length 5 x 100 to A ? I assume that MyLDA
should be 100 and NumVectors should be 5.
What should 'CV' be set to? The documentation says:
Copy - user data will be copied at construction (but then the memory is
allocated twice - once by me and then again in the constructor - waste of
space?)
View - user data will be encapsulated and used throughout the life of the
object - does this mean that I am responsible for pre-allocating the raw array
prior to construction of the MultiVector and for deallocating A after the
corresponding Epetra_MultiVector is destructed? And how would I know if that
is safe if the Epetra_MultiVector is held by an RCP from Teuchos?
I'm looking for a way of storing the vectors so that they mimic a dense matrix
and I can efficiently access one row of this matrix. If the stride is constant,
I only need to know A, the row index and MyLDA. If this is not the correct
approach, I'm open to suggestions of course. Thank you for any advice.
Best regards,
Martin Vymazal
More information about the Trilinos-Users
mailing list