PSCF v1.5.0
Blank.cpp
1/*
2* Util Package - C++ Utilities for Scientific Computation
3*
4* Copyright 2010 - 2017, David Morse (morse012@um.edu)
5* Distributed under the terms of the GNU General Public License.
6*/
7
8#include "Blank.h"
9
10#include <cctype>
11#include <istream>
12
13namespace Util
14{
15
16 // Constructor.
20
24
25 // Read a blank line
26 void Blank::readParam(std::istream &in)
27 {
28 if (isIoProcessor()) {
29
30 // Skip white space up to and including the end of the current
31 // line, of any length. Stop before any other character: such
32 // text belongs to the next item and is left in the stream.
33 int c = in.peek();
34 while (c != std::istream::traits_type::eof() && c != '\n'
35 && std::isspace(c)) {
36 in.get();
37 c = in.peek();
38 }
39 if (c == '\n') {
40 in.get();
41 }
42
45 }
46 }
47 }
48
49 // Write a blank line
50 void Blank::writeParam(std::ostream &out) const
51 { out << std::endl; }
52
53}
virtual void readParam(std::istream &in)
Read a blank line.
Definition Blank.cpp:26
virtual void writeParam(std::ostream &out) const
Write a blank line.
Definition Blank.cpp:50
virtual ~Blank()
Destructor.
Definition Blank.cpp:22
Blank()
Constructor.
Definition Blank.cpp:17
static std::ostream & file()
Get log ostream by reference.
Definition Log.cpp:59
bool isIoProcessor() const
Can this processor do file I/O ?
Definition MpiFileIo.h:94
ParamComponent()
Constructor.
static bool echo()
Get echo parameter.
Utility classes for scientific computation.