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
6bf99439
"csrc/sm90/vscode:/vscode.git/clone" did not exist on "892f7274916e7334755a32a56c21335e17bd92e4"
Commit
6bf99439
authored
Jun 24, 2020
by
Charlles Abreu
Browse files
Fixed sanity checks in spline filters
parent
77b488b8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
openmmapi/src/SplineFitter.cpp
openmmapi/src/SplineFitter.cpp
+12
-4
No files found.
openmmapi/src/SplineFitter.cpp
View file @
6bf99439
...
@@ -200,8 +200,12 @@ void SplineFitter::solveTridiagonalMatrix(const vector<double>& a, const vector<
...
@@ -200,8 +200,12 @@ void SplineFitter::solveTridiagonalMatrix(const vector<double>& a, const vector<
void
SplineFitter
::
create2DSpline
(
const
vector
<
double
>&
x
,
const
vector
<
double
>&
y
,
const
vector
<
double
>&
values
,
bool
periodic
,
vector
<
vector
<
double
>
>&
c
)
{
void
SplineFitter
::
create2DSpline
(
const
vector
<
double
>&
x
,
const
vector
<
double
>&
y
,
const
vector
<
double
>&
values
,
bool
periodic
,
vector
<
vector
<
double
>
>&
c
)
{
int
xsize
=
x
.
size
(),
ysize
=
y
.
size
();
int
xsize
=
x
.
size
(),
ysize
=
y
.
size
();
// if (xsize < 2 || ysize < 2)
if
(
periodic
)
{
// throw OpenMMException("create2DNaturalSpline: must have at least two points along each axis");
if
(
xsize
<
3
||
ysize
<
3
)
throw
OpenMMException
(
"create2DNaturalSpline: periodic spline must have at least three points along each axis"
);
}
else
if
(
xsize
<
2
||
ysize
<
2
)
throw
OpenMMException
(
"create2DNaturalSpline: must have at least two points along each axis"
);
if
(
values
.
size
()
!=
xsize
*
ysize
)
if
(
values
.
size
()
!=
xsize
*
ysize
)
throw
OpenMMException
(
"create2DNaturalSpline: incorrect number of values"
);
throw
OpenMMException
(
"create2DNaturalSpline: incorrect number of values"
);
vector
<
double
>
d1
(
xsize
*
ysize
),
d2
(
xsize
*
ysize
),
d12
(
xsize
*
ysize
);
vector
<
double
>
d1
(
xsize
*
ysize
),
d2
(
xsize
*
ysize
),
d12
(
xsize
*
ysize
);
...
@@ -385,8 +389,12 @@ void SplineFitter::evaluate2DSplineDerivatives(const vector<double>& x, const ve
...
@@ -385,8 +389,12 @@ void SplineFitter::evaluate2DSplineDerivatives(const vector<double>& x, const ve
void
SplineFitter
::
create3DSpline
(
const
vector
<
double
>&
x
,
const
vector
<
double
>&
y
,
const
vector
<
double
>&
z
,
const
vector
<
double
>&
values
,
bool
periodic
,
vector
<
vector
<
double
>
>&
c
)
{
void
SplineFitter
::
create3DSpline
(
const
vector
<
double
>&
x
,
const
vector
<
double
>&
y
,
const
vector
<
double
>&
z
,
const
vector
<
double
>&
values
,
bool
periodic
,
vector
<
vector
<
double
>
>&
c
)
{
int
xsize
=
x
.
size
(),
ysize
=
y
.
size
(),
zsize
=
z
.
size
();
int
xsize
=
x
.
size
(),
ysize
=
y
.
size
(),
zsize
=
z
.
size
();
int
xysize
=
xsize
*
ysize
;
int
xysize
=
xsize
*
ysize
;
// if (xsize < 2 || ysize < 2 || zsize < 2)
if
(
periodic
)
{
// throw OpenMMException("create2DNaturalSpline: must have at least two points along each axis");
if
(
xsize
<
3
||
ysize
<
3
||
zsize
<
3
)
throw
OpenMMException
(
"create3DNaturalSpline: periodic spline must have at least three points along each axis"
);
}
else
if
(
xsize
<
2
||
ysize
<
2
||
zsize
<
2
)
throw
OpenMMException
(
"create3DNaturalSpline: must have at least two points along each axis"
);
if
(
values
.
size
()
!=
xsize
*
ysize
*
zsize
)
if
(
values
.
size
()
!=
xsize
*
ysize
*
zsize
)
throw
OpenMMException
(
"create2DNaturalSpline: incorrect number of values"
);
throw
OpenMMException
(
"create2DNaturalSpline: incorrect number of values"
);
vector
<
double
>
d1
(
xsize
*
ysize
*
zsize
),
d2
(
xsize
*
ysize
*
zsize
),
d3
(
xsize
*
ysize
*
zsize
);
vector
<
double
>
d1
(
xsize
*
ysize
*
zsize
),
d2
(
xsize
*
ysize
*
zsize
),
d3
(
xsize
*
ysize
*
zsize
);
...
...
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