Véronique Pham <[email protected]> a écrit : > Hi everyone, > > I would like to ask a question about the assembling using the getfem > generic_assembly procedure. > In the getfem_assembling.h file, on the Helmholtz equation case, the real > and the complex case are dissociate, there are: > > - For the complex case: > > template<typename MATr, typename MATi, typename VECTr, typename VECTi> > void asm_Helmholtz_cplx(const MATr &Mr, const MATi &Mi, const mesh_im &mim, > const mesh_fem &mf_u, const mesh_fem &mf_data, > const VECTr &K_squaredr, const VECTi &K_squaredi, > const mesh_region &rg=mesh_region::all_convexes()) { > generic_assembly assem("Kr=data$1(#2); Ki=data$2(#2);" > "m = comp(Base(#1).Base(#1).Base(#2)); " > "M$1(#1,#1)+=sym(m(:,:,i).Kr(i) - " > "comp(Grad(#1).Grad(#1))(:,i,:,i));" > "M$2(#1,#1)+=sym(m(:,:,i).Ki(i));"); > assem.push_mi(mim); > assem.push_mf(mf_u); > assem.push_mf(mf_data); > assem.push_data(K_squaredr); > assem.push_data(K_squaredi); > assem.push_mat(const_cast<MATr&>(Mr)); > assem.push_mat(const_cast<MATi&>(Mi)); > assem.assembly(rg); > } > > - For the real case: > > template<typename MAT, typename VECT> > void asm_Helmholtz_real(const MAT &M, const mesh_im &mim, > const mesh_fem &mf_u, const mesh_fem &mf_data, > const VECT &K_squared, > const mesh_region &rg=mesh_region::all_convexes()) { > generic_assembly assem("K=data$1(#2);" > "m = comp(Base(#1).Base(#1).Base(#2)); " > "M$1(#1,#1)+=sym(m(:,:,i).K(i) - " > "comp(Grad(#1).Grad(#1))(:,i,:,i));"); > assem.push_mi(mim); > assem.push_mf(mf_u); > assem.push_mf(mf_data); > assem.push_data(K_squared); > assem.push_mat(const_cast<MAT&>(M)); > assem.assembly(rg); > } > > Does that mean that we cannot use directly a vector of complex > (interleaved real and imaginary part) and that we have to split it in > two vectors of real?
The generic assembly treats indeed only real terms. It cannot treat directly complex values. But the complex version of asm_Helmholtz do itself the separation into real and imaginary part. This is done with the use of gmm::real_part and gmm::imag_part which give writable references. Yves. _______________________________________________ Getfem-users mailing list [email protected] https://mail.gna.org/listinfo/getfem-users
