aboutsummaryrefslogtreecommitdiff
path: root/Tools/CodeGen/CodeGen.m
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2011-09-28 10:31:50 +0200
committerIan Hinder <ian.hinder@aei.mpg.de>2011-09-29 20:57:09 +0200
commit5784b9cd74b582639cb70fe91810d63f289de8ce (patch)
treef40f80e4e8f6643964e26d3659e18312af9933aa /Tools/CodeGen/CodeGen.m
parentbee7aebdba5f888c0b3913767f94047bd4ea6b88 (diff)
Add function Parenthesis
This is used to encapsulate upwind finite differencing operations in McLachlan to simplify substitutions. Similar to a parenthesis, this function does nothing.
Diffstat (limited to 'Tools/CodeGen/CodeGen.m')
-rw-r--r--Tools/CodeGen/CodeGen.m3
1 files changed, 3 insertions, 0 deletions
diff --git a/Tools/CodeGen/CodeGen.m b/Tools/CodeGen/CodeGen.m
index 127ee81..6ed87d0 100644
--- a/Tools/CodeGen/CodeGen.m
+++ b/Tools/CodeGen/CodeGen.m
@@ -948,6 +948,9 @@ ReplacePowers[expr_, vectorise_] :=
rhs = rhs /. -8/3 -> -keightthird;
*)
+ (* Remove parentheses *)
+ rhs = rhs //. Parenthesis[xx_] -> xx;
+
(* Avoid rational numbers *)
rhs = rhs /. Rational[xx_,yy_] :> N[xx/yy, 30];