On 10/28/22 00:50, 'yy.wayne' via deal.II User Group wrote:
I have a question that if ghost_indices should be past to a vector's reinit?
In step-40 and line 89 of this test
<https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdealii%2Fdealii%2Fblob%2Fmaster%2Ftests%2Fmpi%2Fsolution_transfer_04.cc%23%3A~%3Atext%3Dsolution.reinit(locally_owned_dofs%2C%2520MPI_COMM_WORLD)%3B&data=05%7C01%7CWolfgang.Bangerth%40colostate.edu%7C7703891c22db47014d6308dab8b0c6be%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C638025366645029265%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Q%2FZxqQEdJR%2FeoBSz8SNn0LAocgqvLtSV6tAmkUeeCeA%3D&reserved=0>,
system_rhs and solution are reinit with reinit(local_dofs, mpi_communicator)
only. But in line 95 of that test
<https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdealii%2Fdealii%2Fblob%2Fmaster%2Ftests%2Fmpi%2Fsolution_transfer_04.cc%23%3A~%3Atext%3Dold_solution.reinit(locally_owned_dofs%2C&data=05%7C01%7CWolfgang.Bangerth%40colostate.edu%7C7703891c22db47014d6308dab8b0c6be%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C638025366645029265%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=YI0OrnoL5OxFwMaqTC7lxVpwgqL%2BS3dbkNDMPfI%2FmUo%3D&reserved=0>,
we need ghost_indices as argument. That's same for one of my code, where I
found a bug because I didn't use locally_relevant_dofs when reinit a
system_rhs. To reduce mistakes, should vectors always be reinit with
ghost_indices then ?
No. The question is whether you need ghost elements in the vector or not, and
that is typically a question on whether you need to *read* individual entries.
When you build the right hand side and when you call a solver to compute the
solution vector, we use "completely distributed vectors" that do not have
ghost elements. When you want to output the solution graphically, however, you
need to be able to read individual vector elements also for ghost entries, and
so then you need the locally relevant dofs. Vectors with ghost elements are
read-only.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: bange...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/
--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/74232844-3e6d-2be1-7216-f3cf8e319422%40colostate.edu.