[cig-commits] commit 2341 by bangerth to /var/svn/dealii/aspect
dealii.demon at gmail.com
dealii.demon at gmail.com
Fri Mar 21 13:35:01 PDT 2014
Revision 2341
Harden error checking upon restarting somewhat. Fix some code that used internal details of the C++ standard library and that only worked using GCC but not using the Intel compiler.
U trunk/aspect/doc/modules/changes.h
U trunk/aspect/source/simulator/checkpoint_restart.cc
http://www.dealii.org/websvn/revision.php?repname=Aspect+Repository&path=%2F&rev=2341&peg=2341
Diff:
Modified: trunk/aspect/doc/modules/changes.h
===================================================================
--- trunk/aspect/doc/modules/changes.h 2014-03-21 03:33:34 UTC (rev 2340)
+++ trunk/aspect/doc/modules/changes.h 2014-03-21 20:34:58 UTC (rev 2341)
@@ -8,10 +8,16 @@
</p>
<ol>
- <li>New: There is now a postprocess that computes a measure of
+ <li>Fixed: Restarting from a previously checkpointed solution
+ did not work when using the Intel compiler and its standard library.
+ This is now fixed.
+ <br>
+ (Wolfgang Bangerth, Jacqueline Austermann 2014/03/21)
+
+ <li>New: There is now a postprocessor that computes a measure of
dynamic topography, based on the vertical component of the stress.
<br>
- (Wolfgang Bangerth, Jacqueline Austermann 2014/03/03)
+ (Wolfgang Bangerth, Jacqueline Austermann 2014/03/20)
<li>New: Aspect now installs a file <code>AspectConfig.cmake</code>
into the same directory as the executable that can be used by
Modified: trunk/aspect/source/simulator/checkpoint_restart.cc
===================================================================
--- trunk/aspect/source/simulator/checkpoint_restart.cc 2014-03-21 03:33:34 UTC (rev 2340)
+++ trunk/aspect/source/simulator/checkpoint_restart.cc 2014-03-21 20:34:58 UTC (rev 2341)
@@ -169,11 +169,12 @@
}
catch (...)
{
- AssertThrow(false, ExcMessage("Cannot open snapshot mesh file."));
+ AssertThrow(false, ExcMessage("Cannot open snapshot mesh file or read the triangulation stored there."));
}
global_volume = GridTools::volume (triangulation, mapping);
setup_dofs();
+
LinearAlgebra::BlockVector
distributed_system (system_rhs);
LinearAlgebra::BlockVector
@@ -194,10 +195,14 @@
old_solution = old_distributed_system;
old_old_solution = old_old_distributed_system;
- //read zlib compressed resume.z
+
+ // read zlib compressed resume.z
+ try
{
std::ifstream ifs ((parameters.output_directory + "restart.resume.z").c_str());
- AssertThrow(ifs.is_open(), ExcMessage("Cannot open snapshot resume file."));
+ AssertThrow(ifs.is_open(),
+ ExcMessage("Cannot open snapshot resume file."));
+
uint32_t compression_header[4];
ifs.read((char *)compression_header, 4 * sizeof(compression_header[0]));
Assert(compression_header[0]==1, ExcInternalError());
@@ -206,16 +211,32 @@
std::vector<char> uncompressed(compression_header[1]);
ifs.read(&compressed[0],compression_header[3]);
uLongf uncompressed_size = compression_header[1];
- uncompress((Bytef *)&uncompressed[0], &uncompressed_size, (Bytef *)&compressed[0], compression_header[3]);
+ const int err = uncompress((Bytef *)&uncompressed[0], &uncompressed_size,
+ (Bytef *)&compressed[0], compression_header[3]);
+ AssertThrow (err == Z_OK,
+ ExcMessage (std::string("Uncompressing the data buffer resulted in an error with code <")
+ +
+ Utilities::int_to_string(err)));
+
{
- std::stringstream ss;
- // this puts the data of uncompressed into the stringstream
- ifs.rdbuf()->pubsetbuf(&uncompressed[0], uncompressed_size);
+ std::istringstream ss;
+ ss.str(std::string (&uncompressed[0], uncompressed_size));
aspect::iarchive ia (ss);
ia >> (*this);
}
}
+ catch (std::exception &e)
+ {
+ AssertThrow (false,
+ ExcMessage (std::string("Cannot seem to deserialize the data previously stored!
")
+ +
+ "Some part of the machinery generated an exception that says <"
+ +
+ e.what()
+ +
+ ">"));
+ }
// re-initialize the postprocessors with the current object
postprocess_manager.initialize (*this);
More information about the CIG-COMMITS
mailing list