summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGard Spreemann <gard.spreemann@epfl.ch>2018-10-24 13:33:53 +0200
committerGard Spreemann <gard.spreemann@epfl.ch>2018-10-24 13:33:53 +0200
commit88b4324ecb7f06fe31c0dfe62640d1594764a23f (patch)
tree3963af2e2fed1f8c43680c019d0491d3496ee414
parent3ae1f6c19533f24964166ec373e739c82919ae75 (diff)
PETSc printing.
-rw-r--r--src/options.cpp22
1 files 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 <string>
-#include <iostream>
+#include <petscmat.h>
#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;
}