I have a working Python code for Eigenmode analysis. I use a SLEPc Eigensolver, solve modes and export the result to a file.
Python code <<
tm = dolfin.SLEPcEigenSolver(S_tm, T_tm)
tm.solve(modes)
# get Eigen pair
k_r, k_i, ev_r, ev_i = tm.get_eigenpair(0)
E = dolfin.Function(V) # V is my functionspace
E.vector()[:] = ev_r
# Exporting the file
file = dolfin.File("out.pvd")
file << E
In C++, it is almost the same.
C++ Code <<
dolfin::SLEPcEigenSolver tm(S_tm, T_tm);
tm.solve(5);
double kr, ki;
dolfin::Vector ev_i;
dolfin::Vector ev_r;
tm.get_eigenpair(k_r, k_i, ev_r, ev_i, 0);
dolfin::Function E;
But I couldn’t find how we can assign the Vector result (ev_r) of the get_eigenpair() method to a dolfin::Function (E)