PSCF
v1.1
src
fd1d
domain
GeometryMode.cpp
1
/*
2
* PSCF - Polymer Self-Consistent Field Theory
3
*
4
* Copyright 2016 - 2022, The Regents of the University of Minnesota
5
* Distributed under the terms of the GNU General Public License.
6
*/
7
8
#include <
util/global.h
>
// uses UTIL_THROW
9
#include "GeometryMode.h"
// class header
10
11
namespace
Pscf
{
12
namespace
Fd1d
13
{
14
15
using namespace
Util
;
16
17
/*
18
* Extract a GeometryMode from an istream as a string.
19
*/
20
std::istream&
operator>>
(std::istream& in,
GeometryMode
& mode)
21
{
22
std::string buffer;
23
in >> buffer;
24
if
(buffer ==
"Planar"
|| buffer ==
"planar"
) {
25
mode = Planar;
26
}
else
27
if
(buffer ==
"Cylindrical"
|| buffer ==
"cylindrical"
) {
28
mode = Cylindrical;
29
}
else
30
if
(buffer ==
"Spherical"
|| buffer ==
"spherical"
) {
31
mode = Spherical;
32
}
else
{
33
UTIL_THROW
(
"Invalid GeometryMode value input"
);
34
}
35
return
in;
36
}
37
38
/*
39
* Insert a GeometryMode to an ostream as a string.
40
*/
41
std::ostream&
operator<<
(std::ostream& out,
GeometryMode
mode)
42
{
43
if
(mode == Planar) {
44
out <<
"planar"
;
45
}
else
46
if
(mode == Cylindrical) {
47
out <<
"cylindrical"
;
48
}
else
49
if
(mode == Spherical) {
50
out <<
"spherical"
;
51
}
else
{
52
UTIL_THROW
(
"This should never happen"
);
53
}
54
return
out;
55
}
56
57
}
58
}
global.h
File containing preprocessor macros for error handling.
UTIL_THROW
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Definition:
global.h:51
Pscf::Fd1d::GeometryMode
GeometryMode
Enumeration of geometrical modes for functions of one coordinate.
Definition:
GeometryMode.h:30
Pscf
C++ namespace for polymer self-consistent field theory (PSCF).
Definition:
BlockDescriptor.cpp:11
Util
Utility classes for scientific computation.
Definition:
accumulators.mod:1
Util::operator>>
std::istream & operator>>(std::istream &in, Pair< Data > &pair)
Input a Pair from an istream.
Definition:
Pair.h:44
Util::operator<<
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.
Definition:
Pair.h:57
Generated on Wed Sep 20 2023 00:52:45 for PSCF by
1.9.5