The current GetPot behavior (discovered the hard way) when asked to parse an unreadable config file is to behave as if you'd asked it to parse an empty file instead, and leave no indication that a file open error occurred.
In other words, make a typo in your file name or screw up permissions on a shared file and you're going to be stuck diagnosing a bunch of weird, seemingly unrelated errors much later in your code. The best workaround to detect unreadable files is to then try reopening the file with an ifstream in user code, but that's slightly ugly and it's technically subject to a race condition. A few possible fixes we could put in: 1. Throw an error when a file can't be opened. 2. Set a flag (equivalent to the stuff in std::ios) that can be tested after parsing. 3. Add a GetPot method for parsing any isteam - then the user can make sure an ifstream is valid themselves. My first impulse would have been (1), but it breaks backward compatibility for anyone depending on the "don't need an empty file to use configuration defaults" behavior, and it's not consistent with the way std::ifstream behaves. I'm thinking of adding both (2) and (3). Anyone else have preferences or other ideas? --- Roy ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk _______________________________________________ Libmesh-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-devel
