Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does MatrixFree::initialize_dof_vector() set vector entries to zero? #13480

Closed
nfehn opened this issue Mar 2, 2022 · 1 comment · Fixed by #13481
Closed

Does MatrixFree::initialize_dof_vector() set vector entries to zero? #13480

nfehn opened this issue Mar 2, 2022 · 1 comment · Fixed by #13481

Comments

@nfehn
Copy link
Contributor

nfehn commented Mar 2, 2022

If I see it correctly, I could not find this information in the documentation, see
https://www.dealii.org/developer/doxygen/deal.II/classMatrixFree.html#a6389c1e91648d277bdd81af095b5296c

@kronbichler
Copy link
Member

Yes, it does, because the function calls

AssertIndexRange(comp, n_components());
vec.reinit(dof_info[comp].vector_partitioner, task_info.communicator_sm);
which in turn does
// initialize to zero
*this = Number();

Do you want to add this information to the documentation here:
* Initialize function for a general vector. The length of the vector is
* equal to the total number of degrees in the DoFHandler. If the vector is
* of class LinearAlgebra::distributed::Vector@<Number@>, the ghost entries
* are set accordingly. For vector-valued problems with several DoFHandlers
* underlying this class, the parameter @p vector_component defines which
* component is to be used.
*
* For the vectors used with MatrixFree and in FEEvaluation, a vector needs
* to hold all
* @ref GlossLocallyActiveDof "locally active DoFs"
* and also some of the
* @ref GlossLocallyRelevantDof "locally relevant DoFs".
* The selection of DoFs is such that one can read all degrees of freedom on
* all locally relevant elements (locally active) plus the degrees of freedom
* that constraints expand into from the locally owned cells. However, not
* all locally relevant DoFs are stored because most of them would never be
* accessed in matrix-vector products and result in too much data sent
* around which impacts the performance.
*/
template <typename VectorType>
void
initialize_dof_vector(VectorType & vec,
const unsigned int dof_handler_index = 0) const;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants