SPH
src
core
run
SpecialEntries.cpp
Go to the documentation of this file.
1
#include "
run/SpecialEntries.h
"
2
3
NAMESPACE_SPH_BEGIN
4
5
std::string
CurveEntry::toString
()
const
{
6
std::stringstream ss;
7
for
(
Size
i = 0; i < curve.
getPointCnt
(); ++i) {
8
const
CurvePoint
p = curve.
getPoint
(i);
9
ss << p.
x
<<
" "
<< p.
y
<<
" "
;
10
if
(i < curve.
getPointCnt
() - 1) {
11
ss << curve.
getSegment
(i) <<
" "
;
12
}
13
}
14
return
ss.str();
15
}
16
17
void
CurveEntry::fromString
(
const
std::string& s) {
18
std::stringstream ss(s);
19
Array<CurvePoint>
points;
20
Array<bool>
flags;
21
while
(ss) {
22
CurvePoint
p;
23
ss >> p.
x
>> p.
y
;
24
points.
push
(p);
25
26
bool
f;
27
ss >> f;
28
flags.
push
(f);
29
}
30
curve =
Curve
(std::move(points));
31
for
(
Size
i = 0; i < flags.
size
() - 1; ++i) {
32
curve.
setSegment
(i, flags[i]);
33
}
34
}
35
36
AutoPtr<IExtraEntry>
CurveEntry::clone
()
const
{
37
return
makeAuto<CurveEntry>(curve);
38
}
39
40
NAMESPACE_SPH_END
NAMESPACE_SPH_BEGIN
NAMESPACE_SPH_BEGIN
Definition:
BarnesHut.cpp:13
Size
uint32_t Size
Integral type used to index arrays (by default).
Definition:
Globals.h:16
NAMESPACE_SPH_END
#define NAMESPACE_SPH_END
Definition:
Object.h:12
SpecialEntries.h
Additional bindings to IVirtualSettings.
Array
Generic dynamically allocated resizable storage.
Definition:
Array.h:43
Array::push
INLINE void push(U &&u)
Adds new element to the end of the array, resizing the array if necessary.
Definition:
Array.h:306
Array::size
INLINE TCounter size() const noexcept
Definition:
Array.h:193
AutoPtr< IExtraEntry >
CurveEntry::fromString
virtual void fromString(const std::string &s) override
Definition:
SpecialEntries.cpp:17
CurveEntry::clone
virtual AutoPtr< IExtraEntry > clone() const override
Definition:
SpecialEntries.cpp:36
CurveEntry::toString
virtual std::string toString() const override
Definition:
SpecialEntries.cpp:5
Curve
Represents a user-defined function, defined by a set of points interpolated by either piecewise linea...
Definition:
Curve.h:19
Curve::getPoint
const CurvePoint & getPoint(const Size idx) const
Returns the position of idx-th point.
Definition:
Curve.cpp:99
Curve::getPointCnt
Size getPointCnt() const
Returns the number of points defining the curve.
Definition:
Curve.cpp:95
Curve::setSegment
void setSegment(const Size idx, const bool cubic)
Modifies the interpolation type of idx-th segment.
Definition:
Curve.cpp:130
Curve::getSegment
bool getSegment(const Size idx) const
Returns the interpolation type of idx-th segment.
Definition:
Curve.cpp:126
CurvePoint
Definition:
Curve.h:8
CurvePoint::x
Float x
Definition:
Curve.h:9
CurvePoint::y
Float y
Definition:
Curve.h:10
Generated by
1.9.1