Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
1d5ee1a3
Commit
1d5ee1a3
authored
Apr 04, 2020
by
Charlles Abreu
Browse files
Version 2 of Continuous1DFunction serialization
parent
eaad0655
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
serialization/src/TabulatedFunctionProxies.cpp
serialization/src/TabulatedFunctionProxies.cpp
+9
-3
No files found.
serialization/src/TabulatedFunctionProxies.cpp
View file @
1d5ee1a3
...
...
@@ -41,7 +41,7 @@ Continuous1DFunctionProxy::Continuous1DFunctionProxy() : SerializationProxy("Con
}
void
Continuous1DFunctionProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
Continuous1DFunction
&
function
=
*
reinterpret_cast
<
const
Continuous1DFunction
*>
(
object
);
double
min
,
max
;
vector
<
double
>
values
;
...
...
@@ -57,13 +57,19 @@ void Continuous1DFunctionProxy::serialize(const void* object, SerializationNode&
}
void
*
Continuous1DFunctionProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
2
)
throw
OpenMMException
(
"Unsupported version number"
);
const
SerializationNode
&
valuesNode
=
node
.
getChildNode
(
"Values"
);
vector
<
double
>
values
;
for
(
auto
&
child
:
valuesNode
.
getChildren
())
values
.
push_back
(
child
.
getDoubleProperty
(
"v"
));
return
new
Continuous1DFunction
(
values
,
node
.
getDoubleProperty
(
"min"
),
node
.
getDoubleProperty
(
"max"
),
node
.
getBoolProperty
(
"periodic"
));
bool
periodic
;
if
(
version
==
1
)
periodic
=
false
;
else
periodic
=
node
.
getBoolProperty
(
"periodic"
);
return
new
Continuous1DFunction
(
values
,
node
.
getDoubleProperty
(
"min"
),
node
.
getDoubleProperty
(
"max"
),
periodic
);
}
Continuous2DFunctionProxy
::
Continuous2DFunctionProxy
()
:
SerializationProxy
(
"Continuous2DFunction"
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment