Thanks, that looks like it works. I don't have any problems left with
getting the output to work now, but for my own clarification, I'd like
to have a better understanding of how vectors work and what compress
actually does. I get the impression that modifying vector
elements results in some locally cached values that are then pushed out
to the distributed vector object when you call compress. I'm still a bit
confused as to what exactly compressed does. Does it just modify locally
held values in the distributed vector or does it also update ghosted
values for ghosted vectors? From previous discussions, it sounds like
ghost updates only happen during an assignment.
Correct. A bit of a description is here, in the entry called
"Compressing distributed vectors and matrices":
http://dealii.org/developer/doxygen/deal.II/DEALGlossary.html
I'm also confused about the exact distinction between the
VectorOperations "add" and "insert". It appears that in some cases you
can call compress with "add" and for others you can call "insert"
but the code throws an error if you choose the wrong option. It isn't
always clear why this is the case. If I have an assignment in my code
that modifies a vector element
vec(i) = a
then I would expect that the value of the vector element at i would be
"a" after calling compress. If I use the vector operation "insert" is
this what happens?
Correct.
What happens if I call "add", assuming that I can
even do this?
You can't. (An error may not happen, but you shouldn't try.) The thing
is that if you add, multiple processors may have added something to the
same entry, and compress() will have to add it all up. If you set from
multiple processors, these values better be the same, and so it's good
enough to just do one set operation on the processor that owns the element.
It looks like you should call "add" after setting up a vector or matrix,
...and adding into its entries from multiple processors, as we do during
assembly...
which would make sense if the assignment operation was actually caching
a value, plus the location at which the value would be inserted, so that
"add" was specifying that you include that element in the data
structure.
"add" is really meant in a literal sense, as in "perform the addition of
two numbers". It is not intended to suggest "add an entry to a data
structure that may not have had that entry allocated before, as for
example in a sparse matrix".
You may find the glossary entry linked to above useful, or maybe not. We
would be quite happy to take any updated text if you find that it can be
improved!
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.
For more options, visit https://groups.google.com/d/optout.