SLEPc set_initial_vector

75 views
Skip to first unread message

Antoni Vidal

unread,
Jun 10, 2013, 12:26:10 PM6/10/13
to dea...@googlegroups.com
Dear Deal.ii's users and developers,

I am trying to use the SLEPc eigenvalue solver in a hpset_initial_vectorPETScWrappers::VectorBase refinement problem. In order to set a initial guess of the resulting eigenvector I use set_initial_vector (const PETScWrappers::VectorBase). The problem is that this function only accepts a estimation for one eigenvector. 

I know that is possible to give more than one eigenvector estimation from the SLEPc documentation, and it should be an straight forward change of the slepc_solver.cc/h file, but I don't know in which format I should set the initial_vector(s) this file.

  // The actual slepc_solver.cc file:
  // set the initial vector(s) if any
    if (initial_vector && initial_vector->size() != 0)
      {
        Vec this_vector = *initial_vector;
        ierr = EPSSetInitialSpace (solver_data->eps, 1, &this_vector);
      }

Thank you for your time.

Timo Heister

unread,
Jun 10, 2013, 9:44:49 PM6/10/13
to dea...@googlegroups.com
Dear Antoni,

it looks like EPSSetInitialSpace gets a C array of Vec. So it wants
something like
Vec vectors[5];
vectors[0]=first_vector; ...
This works because a PETSc Vec is just a pointer that can be copied by value.

I would create a function with the signature
set_initial_vectors(const std::vector<PETScWarppers::VectorBase*> &vectors)
Internally you have to create a C array of type Vec. You convert from
PETScWarppers::VectorBase to Vec as given in the code you posted.

Does that help?
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dealii+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Timo Heister
http://www.math.tamu.edu/~heister/

Antoni Vidal

unread,
Jun 11, 2013, 4:01:32 AM6/11/13
to dea...@googlegroups.com
Thank you Timo,

That would be great!


Timo Heister

unread,
Jun 11, 2013, 11:58:12 AM6/11/13
to dea...@googlegroups.com
Dear Antoni,

> That would be great!

I was actually hoping that you could figure out how to do this with my
suggestions. If it works it would be great if you can share it with us
so we can include it.

Let me know how it goes.

Timo
Reply all
Reply to author
Forward
0 new messages