]> https://gitweb.dealii.org/ - dealii-svn.git/commit
This was tricky: In this test we use the GnuplotPatch class to produce output for...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 21 Sep 2010 21:09:00 +0000 (21:09 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 21 Sep 2010 21:09:00 +0000 (21:09 +0000)
commitcddd585b82a76e00c136d1deb8e535973063a478
tree62295103f7e71325e4af9412ebd94650f01c7325
parent86a9cfdbf60cd6cc18ca297f7d0eadc453ab893a
This was tricky: In this test we use the GnuplotPatch class to produce output for each patch. We do so through the WorkStream framework, so we can be sure that only one output operation is happening at the same time, but it's not predictable on which thread this will happen (this doesn't matter, of course -- all we care for is that the Copier operation of the WorkStream class runs only once at any given time). Now, GnuplotPatch directs output to the deallog class. Unfortunately, GnuplotPatch uses a different ostringstream buffer for output on each thread to avoid multiple threads stepping on each others toes writing into the string buffer. The string buffer is only flushed atomically to the actual output stream once we pipe a std::endl into deallog. The problem happens because we set std::precision on deallog from the main thread -- where it is honored if GnuplotPatch::assemble happens to run on the main thread, but if WorkStream schedules GnuplotPatch::assemble on another thread then the deallog class uses a different ostringstream buffer that didn't have the precision set in the same way. The precision then doesn't matter any more once the result is dumped into deallog.get_file_stream() since at that point it is only a bunch of characters, not a number any more. The result is that the output is not predictable and changes in precision from run to run of the program.

The solution to the problem is to not set the precision of the output streams at all and use the default values. The buffers the deallog class uses for other threads then have the same precision as that of the main thread.

git-svn-id: https://svn.dealii.org/trunk@22109 0785d39b-7218-0410-832d-ea1e28bc413d
tests/multigrid/mg_renumbered_02.cc
tests/multigrid/mg_renumbered_02/cmp/generic
tests/multigrid/mg_renumbered_03.cc
tests/multigrid/mg_renumbered_03/cmp/generic

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.