create parallel vectors (allocatable type question)
Randall Mackie
randy at geosystem.us
Wed Apr 18 11:45:43 CDT 2007
I want to create a doubly-indexed MPI global vector in my Fortran code,
but I won't know the number to create until I start the program (it is
model dependent). In Fortran, I would use allocatable type statements,
and just allocate the number once known. (This is different from allocating
the length of the vector).
If I knew I wanted 5 of these, I could say:
Vec X(5)
And then create them later with calls to VecCreateMPI, and VecDuplicate, for
example.
In my case, I want to do something like:
Vec X(:)
And then determine the number later in my code.
Is there a way to do this that I'm just overlooking? Do I just need to
use a larger number than expected, and then create only the number
of vectors actually needed later on with VecCreateMPI and VecDuplicate?
Thanks, Randy
--
Randall Mackie
GSY-USA, Inc.
PMB# 643
2261 Market St.,
San Francisco, CA 94114-1600
Tel (415) 469-8649
Fax (415) 469-5044
California Registered Geophysicist
License No. GP 1034
More information about the petsc-users
mailing list