aboutsummaryrefslogtreecommitdiff
path: root/src/maple
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-04-13 18:06:40 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-04-13 18:06:40 +0000
commit6546309f2a2a8586ea4ef5c6e8a23e0caff209bd (patch)
tree188d22771a19be06345e5db1a34731c51da9988e /src/maple
parent6d07b30924c2efb6cff31d99f337429c99b568c7 (diff)
add sets of all coordinates
fine-tune input/output sets in codegen2() git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@516 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/maple')
-rw-r--r--src/maple/codegen2.maple43
-rw-r--r--src/maple/coords.maple3
-rw-r--r--src/maple/coords.minc21
3 files changed, 42 insertions, 25 deletions
diff --git a/src/maple/codegen2.maple b/src/maple/codegen2.maple
index 84144be..5ffe7ac 100644
--- a/src/maple/codegen2.maple
+++ b/src/maple/codegen2.maple
@@ -60,7 +60,7 @@ codegen2 :=
proc(expr_in::{algebraic, list(algebraic)},
lhs_name::{name, list(name)},
output_file_name::string)
-local expr, temps, expr_cost;
+local expr, expr_temps, input_set, output_set, expr_cost;
printf("codegen(%a)\n", lhs_name);
@@ -76,13 +76,17 @@ expr := [codegen[optimize](expr)];
saveit(10, procname, "optimize", expr);
printf(" find temporary variables\n");
-temps := temps_in_eqnlist(expr, lhs_name);
-saveit(10, procname, "temps", expr);
+expr_temps := temps_in_eqnlist(expr, lhs_name);
+saveit(10, procname, "temps", expr_temps);
printf(" convert Diff(expr,rho,sigma) --> PARTIAL_RHO_SIGMA(expr) etc\n");
expr := fix_Diff(expr);
saveit(10, procname, "fix_Diff", expr);
+input_set := deindex_names( indets(map(rhs,expr),name)
+ minus {op(expr_temps)}
+ minus x_all_set );
+output_set := deindex_names( {op(map(lhs,expr))} minus {op(expr_temps)} );
printf(" convert R_dd[2,3] --> R_dd_23 etc\n");
expr := unindex_names(expr);
saveit(10, procname, "unindex", expr);
@@ -99,9 +103,11 @@ saveit(10, procname, "fix_rationals", expr);
printf(" writing C code\n");
ftruncate(output_file_name);
fprintf(output_file_name, "/*\n");
+fprintf(output_file_name, " * inputs = %a\n", input_set);
+fprintf(output_file_name, " * outputs = %a\n", output_set);
fprintf(output_file_name, " * cost = %a\n", expr_cost);
fprintf(output_file_name, " */\n");
-print_name_list_dcl(temps, "fp", output_file_name);
+print_name_list_dcl(expr_temps, "fp", output_file_name);
codegen[C](expr, filename=output_file_name);
NULL;
@@ -335,16 +341,20 @@ end;
# The converted expression is returned as the function result.
#
deindex_names :=
-proc(expr::{name, list(name), set(name)})
+proc(expr::{name, function, list({name,function}), set({name,function})})
+local fn_name, fn_args_list;
# recurse over lists and sets
if (type(expr, {list, set}))
then return map(deindex_names, expr);
fi;
-# return non-indexed names and numbers unchanged
-if (type(expr, {string, numeric}))
- then return expr;
+# recurse over function calls
+if (type(expr, function))
+ then
+ fn := op(0, expr);
+ fn_args_list := [op(expr)];
+ fn; return '%'(op(map(deindex_names, fn_args_list)));
fi;
# convert indexed names
@@ -352,6 +362,11 @@ if (type(expr, indexed))
then return op(0, expr);
fi;
+# return non-indexed names and numbers unchanged
+if (type(expr, {name, numeric}))
+ then return expr;
+fi;
+
# unknown type
error "expr has unknown type!\n"
"whattype(expr)=%1\n"
@@ -380,7 +395,7 @@ proc(expr::{
})
local nn, k,
base, power,
- fn_name, fn_args_list, converted_fn_args_list,
+ fn, fn_args_list,
base_name, index_seq;
# recurse over lists and sets
@@ -416,10 +431,9 @@ fi;
# recurse over function calls
if (type(expr, function))
then
- fn_name := op(0, expr);
+ fn := op(0, expr);
fn_args_list := [op(expr)];
- converted_fn_args_list := map(unindex_names, fn_args_list);
- return fn_name(op(converted_fn_args_list));
+ fn; return '%'(op(map(unindex_names, fn_args_list)));
fi;
# convert indexed names
@@ -473,7 +487,7 @@ fix_rationals :=
proc(expr::{algebraic, name = algebraic, list({algebraic, name = algebraic})})
local nn, k,
base, power, fbase, fpower,
- fn, fn_args_list, fixed_fn_args_list,
+ fn, fn_args_list,
int_factors, nonint_factors,
num, den, mult;
@@ -494,8 +508,7 @@ if (type(expr, function))
if (fn <> 'RATIONAL')
then
fn_args_list := [op(expr)];
- fixed_fn_args_list := map(fix_rationals, fn_args_list);
- fn; return '%'(op(fixed_fn_args_list));
+ fn; return '%'(op(map(fix_rationals, fn_args_list)));
fi;
fi;
diff --git a/src/maple/coords.maple b/src/maple/coords.maple
index cd6be48..70e6257 100644
--- a/src/maple/coords.maple
+++ b/src/maple/coords.maple
@@ -29,6 +29,7 @@ x_xyz[1] := xx;
x_xyz[2] := yy;
x_xyz[3] := zz;
x_xyz_list := map(op, [entries(x_xyz)]);
+x_xyz_set := {op(x_xyz_list)};
# r coordinate
r__fnd := ssqrt(xx^2 + yy^2 + zz^2);
@@ -38,9 +39,11 @@ y_rs := array(1..N_ang);
y_rs[1] := rho;
y_rs[2] := sigma;
y_rs_list := map(op, [entries(y_rs)]);
+y_rs_set := {op(y_rs_set)};
# list of all coordinates (for sorting things into "nice" order)
x_all_list := [op(x_xyz_list), op(y_rs_list)];
+x_all_set := {op(x_all_list)};
NULL;
end proc;
diff --git a/src/maple/coords.minc b/src/maple/coords.minc
index 03c01ec..194b847 100644
--- a/src/maple/coords.minc
+++ b/src/maple/coords.minc
@@ -5,13 +5,14 @@
delta,
# coordinates
-N, # number of spatial coordinates
-N_ang, # number of angular spatial coordinates
-r, r__fnd, # radial coordinate, inert and as fn(xx,yy,zz) coords
-x_xyz, x_xyz_list, # array and list of (xx,yy,zz) coordinates
-y_rs, y_rs_list, # array and list of (rho,sigma) coordinates
-rho, sigma, # individual patch coordinates
-mu, nu, phi, # angular coordinates
-xx, yy, zz, # Cartesian coordinates
-x_all_list # list of all coordinates
- # no comma
+N, # number of spatial coordinates
+N_ang, # number of angular spatial coordinates
+r, r__fnd, # radial coordinate,
+ # ... inert and as fn(xx,yy,zz) coords
+x_xyz, x_xyz_list, x_xyz_set, # array/list/set of (xx,yy,zz) coordinates
+y_rs, y_rs_list, y_rs_set, # array and list of (rho,sigma) coordinates
+rho, sigma, # individual patch coordinates
+mu, nu, phi, # angular coordinates
+xx, yy, zz, # Cartesian coordinates
+x_all_list, x_all_set # list of all coordinates
+ # no comma