From 88b4324ecb7f06fe31c0dfe62640d1594764a23f Mon Sep 17 00:00:00 2001 From: Gard Spreemann Date: Wed, 24 Oct 2018 13:33:53 +0200 Subject: PETSc printing. --- src/options.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/options.cpp b/src/options.cpp index a52a0bc..498267f 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -1,18 +1,18 @@ #include -#include +#include #include "options.hpp" void print_usage(const std::string & invocation) { - std::cerr << "Usage:" << std::endl; - std::cerr << invocation << " " << usage_args << std::endl; + PetscPrintf(PETSC_COMM_WORLD, "Usage:\n"); + PetscPrintf(PETSC_COMM_WORLD, "%s %s\n", invocation.c_str(), usage_args.c_str()); } void print_help(const std::string & invocation) { print_usage(invocation); - std::cerr << "FIXME: Write help." << std::endl; + PetscPrintf(PETSC_COMM_WORLD, "FIXME: Write help.\n"); } int parse_opts(int argc, char ** argv, Options & opts) @@ -35,7 +35,7 @@ int parse_opts(int argc, char ** argv, Options & opts) opts.infile = std::string(argv[++i]); else { - std::cerr << "Missing argument to --laplacian." << std::endl; + PetscPrintf(PETSC_COMM_WORLD, "Missing argument to --laplacian.\n"); print_usage(invocation); return 1; } @@ -47,7 +47,7 @@ int parse_opts(int argc, char ** argv, Options & opts) opts.outfile_vals = std::string(argv[++i]); else { - std::cerr << "Missing argument to --vals." << std::endl; + PetscPrintf(PETSC_COMM_WORLD, "Missing argument to --vals.\n"); print_usage(invocation); return 1; } @@ -59,7 +59,7 @@ int parse_opts(int argc, char ** argv, Options & opts) opts.outfile_vecs = std::string(argv[++i]); else { - std::cerr << "Missing argument to --vecs." << std::endl; + PetscPrintf(PETSC_COMM_WORLD, "Missing argument to --vecs.\n"); print_usage(invocation); return 1; } @@ -67,27 +67,27 @@ int parse_opts(int argc, char ** argv, Options & opts) else { - std::cout << "The argument \"" << arg << "\" will be dealt with by PETSc/SLEPc if they understand it. Otherwise it will be silently ignored." << std::endl; + PetscPrintf(PETSC_COMM_WORLD, "The argument %s will be dealt with by PETSc/SLEPc if they understand it. Otherwise it will be silently ignored.\n", arg.c_str()); } } // Begin options validation. if (opts.infile.empty()) { - std::cerr << "Missing Laplacian file." << std::endl; + PetscPrintf(PETSC_COMM_WORLD, "Missing Laplacian file.\n"); print_usage(invocation); return 1; } if (opts.outfile_vecs.empty()) { - std::cerr << "Missing output eigenvectors file." << std::endl; + PetscPrintf(PETSC_COMM_WORLD, "Missing output eigenvectors file.\n"); print_usage(invocation); return 1; } if (opts.outfile_vals.empty()) { - std::cerr << "Missing output eigenvalues file." << std::endl; + PetscPrintf(PETSC_COMM_WORLD, "Missing output eigenvalues file.\n"); print_usage(invocation); return 1; } -- cgit v1.2.3