|
From: | Zhenghuai Guo |
Subject: | Re: [Getfem-users] How_to_update_im_data_in_each_loop |
Date: | Fri, 10 May 2019 11:24:53 +0000 |
Hi Andriy, Thank you for the advice. They are very helpful. I have a question regarding the
ga_interpolation_im_data as below Say if I do
getfem::im_data previous_cauthy_1(mim_1); (step 1) model.add_im_data("previous_cauthy_1", previous_cauthy_1); (step 2) other stuff here getfem::ga_interpolation_im_data(model, "Grad_u_1" , previous_cauthy_1, base_vector_previous_cauthy_1); (step 3) When I do the step 3, do I update the
"previous_cauthy_1" defined in (step 2) which is inside the model or update the previous_cauthy_1 defined in the (step 1)
or both ? (because they are linked) I assume by doing the (step 3), the im_data “previous_cauthy_1” in the model is updated, right? Thank you very much Regards Zhenghuai Guo From: Andriy Andreykiv <address@hidden> Dear Zhenghuai Guo, There are several ways. A very concise way is using
interpolation functions with _expression_, Interpolation on an im_data object (on the Gauss points of an integration method): void getfem::ga_interpolation_im_data(md, expr, im_data &imd, base_vector &result, const mesh_region &rg=mesh_region::all_convexes()); However, if this, for some reason doesn't work for you, you can simply iterate over elements (or faces) of a region of interest and set the data on each Gauss point in a loop: getfem::mesh mesh; getfem::mesh_im im(mesh); bgeot::multi_index matrixSize(2, 2); auto regionA = 1; ImData imDataA(im, matrixSize, regionA); PlainVector data(imDataA.nb_tensor_elem() * imDataA.nb_filtered_index()); for (auto v = getfem::mr_visitor{mesh.region(regionA)}; !v.finished(); ++v) { for (size_t point = 0; point != imDataA.nb_points_of_element(v.cv()); ++point) { bgeot::base_matrix M(2, 2); // fill in M imDataA.set_matrix(data, v.cv(), point, M); } } you can also set this way ImData for vectors and scalars, of course. Best regards, Andriy On Fri, 10 May 2019 at 06:21, Zhenghuai Guo <address@hidden> wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |