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
df51e651
Commit
df51e651
authored
Oct 30, 2009
by
Peter Eastman
Browse files
Added an optimization
parent
b91c396b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
libraries/lepton/src/ParsedExpression.cpp
libraries/lepton/src/ParsedExpression.cpp
+5
-0
No files found.
libraries/lepton/src/ParsedExpression.cpp
View file @
df51e651
...
@@ -203,6 +203,11 @@ ExpressionTreeNode ParsedExpression::substituteSimplerExpression(const Expressio
...
@@ -203,6 +203,11 @@ ExpressionTreeNode ParsedExpression::substituteSimplerExpression(const Expressio
return
ExpressionTreeNode
(
new
Operation
::
MultiplyConstant
(
-
dynamic_cast
<
const
Operation
::
MultiplyConstant
*>
(
&
children
[
0
].
getOperation
())
->
getValue
()),
children
[
0
].
getChildren
()[
0
]);
return
ExpressionTreeNode
(
new
Operation
::
MultiplyConstant
(
-
dynamic_cast
<
const
Operation
::
MultiplyConstant
*>
(
&
children
[
0
].
getOperation
())
->
getValue
()),
children
[
0
].
getChildren
()[
0
]);
break
;
break
;
}
}
case
Operation
::
MULTIPLY_CONSTANT
:
{
if
(
children
[
0
].
getOperation
().
getId
()
==
Operation
::
MULTIPLY_CONSTANT
)
// Combine two multiplies into a single one
return
ExpressionTreeNode
(
new
Operation
::
MultiplyConstant
(
dynamic_cast
<
const
Operation
::
MultiplyConstant
*>
(
&
node
.
getOperation
())
->
getValue
()
*
dynamic_cast
<
const
Operation
::
MultiplyConstant
*>
(
&
children
[
0
].
getOperation
())
->
getValue
()),
children
[
0
].
getChildren
()[
0
]);
}
}
}
return
ExpressionTreeNode
(
node
.
getOperation
().
clone
(),
children
);
return
ExpressionTreeNode
(
node
.
getOperation
().
clone
(),
children
);
}
}
...
...
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