[aspect-devel] inconsistency in use of x, y, and z
Wolfgang Bangerth
bangerth at tamu.edu
Wed Mar 11 19:27:10 PDT 2015
On 03/11/2015 09:09 PM, Jonathan Perry-Houts wrote:
> I don't know if this would be helpful, but I added a quick hack to allow
> Aspect to accept parameter files via stdin
> (ie `cat input.prm | mpirun aspect`). This would allow arbitrary
> modification by shell tools before Aspect ever sees the parameter file.
>
> https://github.com/jperryhouts/aspect/tree/read_stdin
I think that's too complicated.
First, do you need to write the tmp parameter file? What happens with whatever
you pipe into mpirun? Is it passed to every instance of aspect, or only to the
first?
Second, there is a Unix convention by which you indicate that you want to
write input from stdin rather than from an input file by using the special
"filename" '--' as argument. I.e., you could do something like this:
Assert (argc==2);
std_cxx11::shared_ptr<std::ifstream> input_file_stream;
std::ifstream *input_stream;
if (std::string(argv[1]) != std::string("--"))
{
input_file_stream.reset (new std::ifstream(argv[1]));
Assert (*input_file_stream);
input_stream = input_file_stream.get();
}
else
{
input_stream = &std::cin;
}
...read parameters from *input_stream...;
// input_file_stream goes out of scope and automatically deletes the
// std::ifstream object if it was assigned
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth at math.tamu.edu
www: http://www.math.tamu.edu/~bangerth/
More information about the Aspect-devel
mailing list