Create vectors
Barry Smith
bsmith at mcs.anl.gov
Mon Nov 9 14:54:59 CST 2009
Yes, for example
integer localn(level_numbers)
Vec myvecs(level_numbers)
for i=1,level_numbers
VecCreate(PETSC_COMM_WORLD,localn(i),PETSC_DETERMINE,myvecs(i),ierr)
endo
Of course, myvecs() can also may made allocatable and you can set
at run time the number of levels.
Barry
On Nov 9, 2009, at 7:29 AM, jarunan at ascomp.ch wrote:
>
> I am solving multi-level grid (similar to multi grid but not the
> same). In each iteration, each level is solved separately but
> solutions are mapped to eachother. Each level has different size of
> matrix and vector. And each test case has different numbers of grid
> level.
>
> I have a difficulty to create vectors and matrices for each level,
> preparing for the computation, as I do not want to create and
> destroy them in every iteration. I am thinking of something similar
> to array pointer (the code is in fortran) e.g.,
>
> Type(real_array), Dimension(:), allocatable:: pointername
> Allocate(pointername(level_numbers))
>
> do i = 1, level_numbers
> allocate(pointername(i)%p(size))
> enddo
>
>
> Is it possible to create pointer to vectors?
>
>
> Thank you
> Jarunan
>
>
> Quoting jarunan at ascomp.ch:
>
>>
>> Hello,
>>
>> Is there an equivalent way to allocating array pointer for creating
>> vectors (or vector pointers)?
>>
>>
>> Jarunan
>
>
>
> --
> Jarunan Panyasantisuk
> Development Engineer
> ASCOMP GmbH, Technoparkstr. 1
> CH-8005 Zurich, Switzerland
> Phone : +41 44 445 4072
> Fax : +41 44 445 4075
> E-mail: jarunan at ascomp.ch
> www.ascomp.ch
More information about the petsc-users
mailing list