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
8381aaa8
Commit
8381aaa8
authored
Feb 28, 2014
by
peastman
Browse files
Fixed compilation errors on Windows
parent
47a5e2a4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
265 additions
and
259 deletions
+265
-259
platforms/reference/src/ReferenceTabulatedFunction.cpp
platforms/reference/src/ReferenceTabulatedFunction.cpp
+265
-259
No files found.
platforms/reference/src/ReferenceTabulatedFunction.cpp
View file @
8381aaa8
...
@@ -32,12 +32,18 @@
...
@@ -32,12 +32,18 @@
#include "ReferenceTabulatedFunction.h"
#include "ReferenceTabulatedFunction.h"
#include "openmm/OpenMMException.h"
#include "openmm/OpenMMException.h"
#include "openmm/internal/SplineFitter.h"
#include "openmm/internal/SplineFitter.h"
#include <cmath>
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
using
Lepton
::
CustomFunction
;
using
Lepton
::
CustomFunction
;
/**
* We need to define this ourselves, since Visual Studio is missing round() from cmath.
*/
static
int
round
(
double
x
)
{
return
(
int
)
(
x
+
0.5
);
}
extern
"C"
CustomFunction
*
createReferenceTabulatedFunction
(
const
TabulatedFunction
&
function
)
{
extern
"C"
CustomFunction
*
createReferenceTabulatedFunction
(
const
TabulatedFunction
&
function
)
{
if
(
dynamic_cast
<
const
Continuous1DFunction
*>
(
&
function
)
!=
NULL
)
if
(
dynamic_cast
<
const
Continuous1DFunction
*>
(
&
function
)
!=
NULL
)
return
new
ReferenceContinuous1DFunction
(
dynamic_cast
<
const
Continuous1DFunction
&>
(
function
));
return
new
ReferenceContinuous1DFunction
(
dynamic_cast
<
const
Continuous1DFunction
&>
(
function
));
...
@@ -195,7 +201,7 @@ int ReferenceDiscrete1DFunction::getNumArguments() const {
...
@@ -195,7 +201,7 @@ int ReferenceDiscrete1DFunction::getNumArguments() const {
}
}
double
ReferenceDiscrete1DFunction
::
evaluate
(
const
double
*
arguments
)
const
{
double
ReferenceDiscrete1DFunction
::
evaluate
(
const
double
*
arguments
)
const
{
int
i
=
(
int
)
round
(
arguments
[
0
]);
int
i
=
round
(
arguments
[
0
]);
if
(
i
<
0
||
i
>=
values
.
size
())
if
(
i
<
0
||
i
>=
values
.
size
())
throw
OpenMMException
(
"ReferenceDiscrete1DFunction: argument out of range"
);
throw
OpenMMException
(
"ReferenceDiscrete1DFunction: argument out of range"
);
return
values
[
i
];
return
values
[
i
];
...
@@ -218,8 +224,8 @@ int ReferenceDiscrete2DFunction::getNumArguments() const {
...
@@ -218,8 +224,8 @@ int ReferenceDiscrete2DFunction::getNumArguments() const {
}
}
double
ReferenceDiscrete2DFunction
::
evaluate
(
const
double
*
arguments
)
const
{
double
ReferenceDiscrete2DFunction
::
evaluate
(
const
double
*
arguments
)
const
{
int
i
=
(
int
)
round
(
arguments
[
0
]);
int
i
=
round
(
arguments
[
0
]);
int
j
=
(
int
)
round
(
arguments
[
1
]);
int
j
=
round
(
arguments
[
1
]);
if
(
i
<
0
||
i
>=
xsize
||
j
<
0
||
j
>=
ysize
)
if
(
i
<
0
||
i
>=
xsize
||
j
<
0
||
j
>=
ysize
)
throw
OpenMMException
(
"ReferenceDiscrete2DFunction: argument out of range"
);
throw
OpenMMException
(
"ReferenceDiscrete2DFunction: argument out of range"
);
return
values
[
i
+
j
*
xsize
];
return
values
[
i
+
j
*
xsize
];
...
@@ -242,9 +248,9 @@ int ReferenceDiscrete3DFunction::getNumArguments() const {
...
@@ -242,9 +248,9 @@ int ReferenceDiscrete3DFunction::getNumArguments() const {
}
}
double
ReferenceDiscrete3DFunction
::
evaluate
(
const
double
*
arguments
)
const
{
double
ReferenceDiscrete3DFunction
::
evaluate
(
const
double
*
arguments
)
const
{
int
i
=
(
int
)
round
(
arguments
[
0
]);
int
i
=
round
(
arguments
[
0
]);
int
j
=
(
int
)
round
(
arguments
[
1
]);
int
j
=
round
(
arguments
[
1
]);
int
k
=
(
int
)
round
(
arguments
[
2
]);
int
k
=
round
(
arguments
[
2
]);
if
(
i
<
0
||
i
>=
xsize
||
j
<
0
||
j
>=
ysize
||
k
<
0
||
k
>=
zsize
)
if
(
i
<
0
||
i
>=
xsize
||
j
<
0
||
j
>=
ysize
||
k
<
0
||
k
>=
zsize
)
throw
OpenMMException
(
"ReferenceDiscrete3DFunction: argument out of range"
);
throw
OpenMMException
(
"ReferenceDiscrete3DFunction: argument out of range"
);
return
values
[
i
+
(
j
+
k
*
ysize
)
*
xsize
];
return
values
[
i
+
(
j
+
k
*
ysize
)
*
xsize
];
...
...
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