How can I get the basis function of an existing finite element space or to build a finite element space according to my existing basis functions?

Dear all,

At present,I‘m going to deal with the basis function using a spacial algorithm to realize optimizing finite element method, so I’m facing the following two challenges:

(1)With knowing mesh “TH” ,I can use the code " fespace Vh(TH,p1);" to get the finite element space. How can I get the basis functions of the space “Vh”?

(2) If I have had some basis functions “a1, a2, …, an” on the mash “TH”, how can I build a new finite element space?

Thank you advance!