On 04/11/2011 03:18 PM, Roy Stogner wrote:


On Sun, 10 Apr 2011, David Knezevic wrote:

This change seems to have affected ex23. If you put ex23 in "online mode" by setting
online_mode = true
in ex23.in, then the RB_sol.gmv that is generated is just zero. Reverting to r4332 restores the old behavior (non-zero RB_sol.gmv).

I guess the change to r4333 affected the writing/reading of RB basis functions in RBEvaluation::write_out_basis_functions() and RBEvaluation::read_in_basis_functions() ?

Yup - I'd foolishly assumed that nothing was directly using the
lower-level System::read_* calls without doing a read_headers (and
learning the data file's vector names) first; the library was already
making such an assumption with the cached _additional_data_written
variable so I figured no harm in adding another.  So my implementation
fills a _written_var_indices vector, based on those header contents,
with which to do any later remapping of vectors necessary.

So when rb_sys tries to read vectors without reading the headers,
there are no identified vectors to read, and it doesn't read anything.

I'm not sure I know *what* assumptions I can safely make with regard
to rb_sys, so I'm not sure what the right workaround is.  For
instance, I could restore the old "read vectors in blind sequential
order" behavior whenever _written_var_indices is empty... but then
what happens if you do a full read on on data file and then try to do
a header-less read on another?  It'll break again.

Any ideas?

Ah, I see, I think that's a sensible assumption. I think the best thing is to write/read the header in RBEvaluation. The attached patch fixes ex23.

Perhaps printing a warning message in read_* if n_vars = 0 would be worthwhile though?

David

Index: src/systems/rb_evaluation.C
===================================================================
--- src/systems/rb_evaluation.C (revision 4335)
+++ src/systems/rb_evaluation.C (working copy)
@@ -951,6 +951,11 @@
     std::ostringstream file_name;
     const std::string basis_function_suffix = 
(rb_sys.write_binary_basis_functions ? ".xdr" : ".dat");
 
+    file_name << directory_name << "/bf_header" << basis_function_suffix;
+    Xdr header_data(file_name.str(),
+                    rb_sys.write_binary_basis_functions ? ENCODE : WRITE);
+    rb_sys.write_header(header_data, "", false);
+
     // Use System::write_serialized_data to write out the basis functions
     // by copying them into this->solution one at a time.
     for(unsigned int i=0; i<basis_functions.size(); i++)
@@ -986,6 +991,11 @@
     const std::string basis_function_suffix = 
(rb_sys.read_binary_basis_functions ? ".xdr" : ".dat");
     struct stat stat_info;
 
+    file_name << directory_name << "/bf_header" << basis_function_suffix;
+    Xdr header_data(file_name.str(),
+                    rb_sys.read_binary_basis_functions ? DECODE : READ);
+    rb_sys.read_header(header_data, "", false);
+
     // Use System::read_serialized_data to read in the basis functions
     // into this->solution and then swap with the appropriate
     // of basis function.
------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Libmesh-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to