It seems that using block_write() and block_read would be easier to store data
and reuse them
as initial conditions on identical geometry and mesh compared to using
boost:serialization.

In sequential computations, that is probably true.

(i) Suppose I want to store my 'Solution' vector to the zeroth block of a
BlockVector 'solution_save'.
For that I have used the following command (in blue) and I get error (in red).
It seems that the first
line is not the correct way to store vectors in the block. Can you please let
me know the correct command?

solution_save.block(0) = solution;
std::ofstream output_text("data.txt");
solution_save.block_write(output_text);

/home/abasak/Desktop/Anup/dealiicodes/myprogs/junks/step-26/step-26.cc:338:28:
error: no match for ‘operator=’ (operand types are ‘const BlockType {aka const
dealii::Vector<double>}’ and ‘const dealii::Vector<double>’)
     solution_save.block(0) = solution;

The left hand side vector is *const*. You can't assign anything to it.

It may be const because you declare it const, or because it is a member variable but you are in a function that is marked as "const".


2. I am solving mechanics problem. So I need to store the stress and strain
tensors at each node as well. I was wondering if it is possible to store
the tensors somehow. One possibility could be, I think, to store all nine
(here six) components in different blocks and reunite them while reading. But
is there a smarter way to store tensors?

Why don't you just loop over all cells, over all quadrature points, and serialize all of your data into a stream, e.g., by just writing them as regular data. Then, upon loading, you can just reverse the operation by reading from the stream.


3. Also, I must save the triangulation and all nodal and element information.
How to go about it?

That is where you should use the boost serialization functionality others have already pointed you to.

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.

Reply via email to