OGS
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
v
w
z
Enumerations
b
c
d
e
f
g
i
l
m
n
o
p
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
l
m
n
p
r
s
t
v
y
Classes
Class List
Class Index
Class Hierarchy
Files
File List
File Members
All
a
b
c
d
e
f
g
i
k
m
n
o
p
r
s
t
v
w
x
Functions
a
c
d
e
f
g
i
m
o
p
r
s
t
v
w
Variables
Typedefs
Enumerations
Macros
b
c
g
m
n
o
p
r
s
t
▼
OGS
►
OpenGeoSys 6.5.4-338-g7b1a40943b source code documentation
►
OGS CTests—Project Files
►
OGS Input File Parameters—Quality Assurance
►
OGS Input File Parameters
BulkMappingDocuPage
Todo List
OGS Input File Parameters—List of incomplete documentation pages
Bibliography
►
Namespaces
►
Classes
▼
Files
▼
File List
►
Applications
►
BaseLib
►
build
►
ChemistryLib
Documentation
►
GeoLib
►
InfoLib
►
MaterialLib
▼
MathLib
▼
Curve
►
CreatePiecewiseLinearCurve.cpp
►
CreatePiecewiseLinearCurve.h
PiecewiseLinearMonotonicCurve.cpp
►
PiecewiseLinearMonotonicCurve.h
►
Integration
►
InterpolationAlgorithms
►
LinAlg
►
Nonlinear
►
ODE
►
EigenBlockMatrixView.h
FormattingUtils.cpp
►
FormattingUtils.h
►
GeometricBasics.cpp
►
GeometricBasics.h
►
KahanSum.h
►
KelvinVector-impl.h
►
KelvinVector.cpp
►
KelvinVector.h
►
MathTools.cpp
►
MathTools.h
►
Point3d.cpp
►
Point3d.h
►
Point3dWithID.h
►
VectorizedTensor.cpp
►
VectorizedTensor.h
►
WeightedPoint.cpp
►
WeightedPoint.h
►
MeshGeoToolsLib
►
MeshLib
►
MeshToolsLib
►
NumLib
►
ParameterLib
►
ProcessLib
►
File Members
CreatePiecewiseLinearCurve.cpp
Go to the documentation of this file.
1
13
#include "
CreatePiecewiseLinearCurve.h
"
14
15
#include <boost/endian/conversion.hpp>
16
#include <fstream>
17
#include <iostream>
18
#include <vector>
19
20
#include "
BaseLib/ConfigTree.h
"
21
#include "
BaseLib/Error.h
"
22
#include "
BaseLib/FileTools.h
"
23
#include "
BaseLib/StringTools.h
"
24
25
namespace
MathLib
26
{
27
PiecewiseLinearCurveConfig
parsePiecewiseLinearCurveConfig
(
28
BaseLib::ConfigTree
const
& config)
29
{
30
const
bool
read_from_file =
31
config.
getConfigParameter
<
bool
>(
"read_from_file"
,
false
);
32
33
std::vector<double> x;
34
std::vector<double> y;
35
36
if
(read_from_file ==
true
)
37
{
38
auto
const
coords_file_name =
40
config.
getConfigParameter
<std::string>(
"coords"
);
41
42
auto
const
values_file_name =
44
config.
getConfigParameter
<std::string>(
"values"
);
45
46
x =
BaseLib::readDoublesFromBinaryFile
(coords_file_name);
47
48
y =
BaseLib::readDoublesFromBinaryFile
(values_file_name);
49
}
50
else
51
{
52
x =
54
config.
getConfigParameter
<std::vector<double>>(
"coords"
);
55
y =
57
config.
getConfigParameter
<std::vector<double>>(
"values"
);
58
}
59
60
if
(x.empty() || y.empty())
61
{
62
OGS_FATAL
(
"The given coordinates or values vector is empty."
);
63
}
64
if
(x.size() != y.size())
65
{
66
OGS_FATAL
(
67
"The given coordinates and values vector sizes are "
68
"different."
);
69
}
70
71
return
{std::move(x), std::move(y)};
72
}
27
PiecewiseLinearCurveConfig
parsePiecewiseLinearCurveConfig
( {
…
}
73
}
// namespace MathLib
ConfigTree.h
CreatePiecewiseLinearCurve.h
Error.h
OGS_FATAL
#define OGS_FATAL(...)
Definition
Error.h:26
FileTools.h
Filename manipulation routines.
StringTools.h
Definition of string helper functions.
BaseLib::ConfigTree
Definition
ConfigTree.h:107
BaseLib::ConfigTree::getConfigParameter
T getConfigParameter(std::string const ¶m) const
Definition
ConfigTree-impl.h:41
BaseLib::readDoublesFromBinaryFile
std::vector< double > readDoublesFromBinaryFile(const std::string &filename)
Definition
FileTools.cpp:296
MathLib
Definition
CreateComponent.h:32
MathLib::parsePiecewiseLinearCurveConfig
PiecewiseLinearCurveConfig parsePiecewiseLinearCurveConfig(BaseLib::ConfigTree const &config)
Definition
CreatePiecewiseLinearCurve.cpp:27
MathLib::PiecewiseLinearCurveConfig
Definition
CreatePiecewiseLinearCurve.h:27
MathLib
Curve
CreatePiecewiseLinearCurve.cpp
Generated by
1.12.0