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
b4dcef47
Commit
b4dcef47
authored
Apr 18, 2016
by
peastman
Browse files
Merge pull request #1465 from peastman/tabulated
Optimized reference implementation of continuous tabulated functions
parents
abbf0b67
fc0689ac
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
5 deletions
+32
-5
platforms/reference/include/ReferenceTabulatedFunction.h
platforms/reference/include/ReferenceTabulatedFunction.h
+4
-1
platforms/reference/src/ReferenceTabulatedFunction.cpp
platforms/reference/src/ReferenceTabulatedFunction.cpp
+28
-4
No files found.
platforms/reference/include/ReferenceTabulatedFunction.h
View file @
b4dcef47
...
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2014 Stanford University and the Authors.
*
* Portions copyright (c) 2014
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -55,6 +55,7 @@ public:
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
CustomFunction
*
clone
()
const
;
private:
ReferenceContinuous1DFunction
(
const
ReferenceContinuous1DFunction
&
other
);
const
Continuous1DFunction
&
function
;
double
min
,
max
;
std
::
vector
<
double
>
x
,
values
,
derivs
;
...
...
@@ -71,6 +72,7 @@ public:
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
CustomFunction
*
clone
()
const
;
private:
ReferenceContinuous2DFunction
(
const
ReferenceContinuous2DFunction
&
other
);
const
Continuous2DFunction
&
function
;
int
xsize
,
ysize
;
double
xmin
,
xmax
,
ymin
,
ymax
;
...
...
@@ -89,6 +91,7 @@ public:
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
CustomFunction
*
clone
()
const
;
private:
ReferenceContinuous3DFunction
(
const
ReferenceContinuous3DFunction
&
other
);
const
Continuous3DFunction
&
function
;
int
xsize
,
ysize
,
zsize
;
double
xmin
,
xmax
,
ymin
,
ymax
,
zmin
,
zmax
;
...
...
platforms/reference/src/ReferenceTabulatedFunction.cpp
View file @
b4dcef47
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2014 Stanford University and the Authors.
*
* Portions copyright (c) 2014
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -80,6 +80,13 @@ ReferenceContinuous1DFunction::ReferenceContinuous1DFunction(const Continuous1DF
SplineFitter
::
createNaturalSpline
(
x
,
values
,
derivs
);
}
ReferenceContinuous1DFunction
::
ReferenceContinuous1DFunction
(
const
ReferenceContinuous1DFunction
&
other
)
:
function
(
other
.
function
)
{
function
.
getFunctionParameters
(
values
,
min
,
max
);
x
=
other
.
x
;
values
=
other
.
values
;
derivs
=
other
.
derivs
;
}
int
ReferenceContinuous1DFunction
::
getNumArguments
()
const
{
return
1
;
}
...
...
@@ -99,7 +106,7 @@ double ReferenceContinuous1DFunction::evaluateDerivative(const double* arguments
}
CustomFunction
*
ReferenceContinuous1DFunction
::
clone
()
const
{
return
new
ReferenceContinuous1DFunction
(
function
);
return
new
ReferenceContinuous1DFunction
(
*
this
);
}
ReferenceContinuous2DFunction
::
ReferenceContinuous2DFunction
(
const
Continuous2DFunction
&
function
)
:
function
(
function
)
{
...
...
@@ -113,6 +120,14 @@ ReferenceContinuous2DFunction::ReferenceContinuous2DFunction(const Continuous2DF
SplineFitter
::
create2DNaturalSpline
(
x
,
y
,
values
,
c
);
}
ReferenceContinuous2DFunction
::
ReferenceContinuous2DFunction
(
const
ReferenceContinuous2DFunction
&
other
)
:
function
(
other
.
function
)
{
function
.
getFunctionParameters
(
xsize
,
ysize
,
values
,
xmin
,
xmax
,
ymin
,
ymax
);
x
=
other
.
x
;
y
=
other
.
y
;
values
=
other
.
values
;
c
=
other
.
c
;
}
int
ReferenceContinuous2DFunction
::
getNumArguments
()
const
{
return
2
;
}
...
...
@@ -144,7 +159,7 @@ double ReferenceContinuous2DFunction::evaluateDerivative(const double* arguments
}
CustomFunction
*
ReferenceContinuous2DFunction
::
clone
()
const
{
return
new
ReferenceContinuous2DFunction
(
function
);
return
new
ReferenceContinuous2DFunction
(
*
this
);
}
ReferenceContinuous3DFunction
::
ReferenceContinuous3DFunction
(
const
Continuous3DFunction
&
function
)
:
function
(
function
)
{
...
...
@@ -161,6 +176,15 @@ ReferenceContinuous3DFunction::ReferenceContinuous3DFunction(const Continuous3DF
SplineFitter
::
create3DNaturalSpline
(
x
,
y
,
z
,
values
,
c
);
}
ReferenceContinuous3DFunction
::
ReferenceContinuous3DFunction
(
const
ReferenceContinuous3DFunction
&
other
)
:
function
(
other
.
function
)
{
function
.
getFunctionParameters
(
xsize
,
ysize
,
zsize
,
values
,
xmin
,
xmax
,
ymin
,
ymax
,
zmin
,
zmax
);
x
=
other
.
x
;
y
=
other
.
y
;
z
=
other
.
z
;
values
=
other
.
values
;
c
=
other
.
c
;
}
int
ReferenceContinuous3DFunction
::
getNumArguments
()
const
{
return
3
;
}
...
...
@@ -200,7 +224,7 @@ double ReferenceContinuous3DFunction::evaluateDerivative(const double* arguments
}
CustomFunction
*
ReferenceContinuous3DFunction
::
clone
()
const
{
return
new
ReferenceContinuous3DFunction
(
function
);
return
new
ReferenceContinuous3DFunction
(
*
this
);
}
ReferenceDiscrete1DFunction
::
ReferenceDiscrete1DFunction
(
const
Discrete1DFunction
&
function
)
:
function
(
function
)
{
...
...
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