diff options
author | jthorn <jthorn@0f49ee68-0e4f-0410-9b9c-b2c123ded7ef> | 2003-07-06 11:16:19 +0000 |
---|---|---|
committer | jthorn <jthorn@0f49ee68-0e4f-0410-9b9c-b2c123ded7ef> | 2003-07-06 11:16:19 +0000 |
commit | a07489dec7a4e1153624e158a2c5f2837b9247de (patch) | |
tree | 83be503e3cdaf39c578202c0fcdcf71337845e42 /src/common | |
parent | 892b8a2d121db4c1e436177cb19baa06eb8d0e4a (diff) |
This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.
git-svn-id: http://svn.aei.mpg.de/numrel/AEIThorns/AEILocalInterp/trunk@3 0f49ee68-0e4f-0410-9b9c-b2c123ded7ef
Diffstat (limited to 'src/common')
99 files changed, 9255 insertions, 0 deletions
diff --git a/src/common/1d.cube.size2/coeffs-dcl.h b/src/common/1d.cube.size2/coeffs-dcl.h new file mode 100644 index 0000000..c3406db --- /dev/null +++ b/src/common/1d.cube.size2/coeffs-dcl.h @@ -0,0 +1,2 @@ +fp coeff_0; +fp coeff_p1; diff --git a/src/common/1d.cube.size2/data-dcl.h b/src/common/1d.cube.size2/data-dcl.h new file mode 100644 index 0000000..1e82c48 --- /dev/null +++ b/src/common/1d.cube.size2/data-dcl.h @@ -0,0 +1,2 @@ +fp data_0; +fp data_p1; diff --git a/src/common/1d.cube.size2/evaluate-molecule.c b/src/common/1d.cube.size2/evaluate-molecule.c new file mode 100644 index 0000000..873eecb --- /dev/null +++ b/src/common/1d.cube.size2/evaluate-molecule.c @@ -0,0 +1,2 @@ + coeffs->coeff_0*data->data_0 + + coeffs->coeff_p1*data->data_p1; diff --git a/src/common/1d.cube.size2/load-data.c b/src/common/1d.cube.size2/load-data.c new file mode 100644 index 0000000..c6bb0e3 --- /dev/null +++ b/src/common/1d.cube.size2/load-data.c @@ -0,0 +1,2 @@ +data->data_0 = DATA(0); +data->data_p1 = DATA(1); diff --git a/src/common/1d.cube.size2/store-coeffs.c b/src/common/1d.cube.size2/store-coeffs.c new file mode 100644 index 0000000..6117dc3 --- /dev/null +++ b/src/common/1d.cube.size2/store-coeffs.c @@ -0,0 +1,2 @@ +COEFF(0) = factor * coeffs->coeff_0; +COEFF(1) = factor * coeffs->coeff_p1; diff --git a/src/common/1d.cube.size3/coeffs-dcl.h b/src/common/1d.cube.size3/coeffs-dcl.h new file mode 100644 index 0000000..0dd24dc --- /dev/null +++ b/src/common/1d.cube.size3/coeffs-dcl.h @@ -0,0 +1,3 @@ +fp coeff_m1; +fp coeff_0; +fp coeff_p1; diff --git a/src/common/1d.cube.size3/data-dcl.h b/src/common/1d.cube.size3/data-dcl.h new file mode 100644 index 0000000..c82ad9b --- /dev/null +++ b/src/common/1d.cube.size3/data-dcl.h @@ -0,0 +1,3 @@ +fp data_m1; +fp data_0; +fp data_p1; diff --git a/src/common/1d.cube.size3/evaluate-molecule.c b/src/common/1d.cube.size3/evaluate-molecule.c new file mode 100644 index 0000000..eef1e44 --- /dev/null +++ b/src/common/1d.cube.size3/evaluate-molecule.c @@ -0,0 +1,3 @@ + coeffs->coeff_m1*data->data_m1 + + coeffs->coeff_0*data->data_0 + + coeffs->coeff_p1*data->data_p1; diff --git a/src/common/1d.cube.size3/load-data.c b/src/common/1d.cube.size3/load-data.c new file mode 100644 index 0000000..42b7f8c --- /dev/null +++ b/src/common/1d.cube.size3/load-data.c @@ -0,0 +1,3 @@ +data->data_m1 = DATA(-1); +data->data_0 = DATA(0); +data->data_p1 = DATA(1); diff --git a/src/common/1d.cube.size3/store-coeffs.c b/src/common/1d.cube.size3/store-coeffs.c new file mode 100644 index 0000000..2067270 --- /dev/null +++ b/src/common/1d.cube.size3/store-coeffs.c @@ -0,0 +1,3 @@ +COEFF(-1) = factor * coeffs->coeff_m1; +COEFF(0) = factor * coeffs->coeff_0; +COEFF(1) = factor * coeffs->coeff_p1; diff --git a/src/common/1d.cube.size4/coeffs-dcl.h b/src/common/1d.cube.size4/coeffs-dcl.h new file mode 100644 index 0000000..40576b6 --- /dev/null +++ b/src/common/1d.cube.size4/coeffs-dcl.h @@ -0,0 +1,4 @@ +fp coeff_m1; +fp coeff_0; +fp coeff_p1; +fp coeff_p2; diff --git a/src/common/1d.cube.size4/data-dcl.h b/src/common/1d.cube.size4/data-dcl.h new file mode 100644 index 0000000..3fe13fa --- /dev/null +++ b/src/common/1d.cube.size4/data-dcl.h @@ -0,0 +1,4 @@ +fp data_m1; +fp data_0; +fp data_p1; +fp data_p2; diff --git a/src/common/1d.cube.size4/evaluate-molecule.c b/src/common/1d.cube.size4/evaluate-molecule.c new file mode 100644 index 0000000..efc10e9 --- /dev/null +++ b/src/common/1d.cube.size4/evaluate-molecule.c @@ -0,0 +1,4 @@ + coeffs->coeff_m1*data->data_m1 + + coeffs->coeff_0*data->data_0 + + coeffs->coeff_p1*data->data_p1 + + coeffs->coeff_p2*data->data_p2; diff --git a/src/common/1d.cube.size4/load-data.c b/src/common/1d.cube.size4/load-data.c new file mode 100644 index 0000000..c38e68d --- /dev/null +++ b/src/common/1d.cube.size4/load-data.c @@ -0,0 +1,4 @@ +data->data_m1 = DATA(-1); +data->data_0 = DATA(0); +data->data_p1 = DATA(1); +data->data_p2 = DATA(2); diff --git a/src/common/1d.cube.size4/store-coeffs.c b/src/common/1d.cube.size4/store-coeffs.c new file mode 100644 index 0000000..5e73681 --- /dev/null +++ b/src/common/1d.cube.size4/store-coeffs.c @@ -0,0 +1,4 @@ +COEFF(-1) = factor * coeffs->coeff_m1; +COEFF(0) = factor * coeffs->coeff_0; +COEFF(1) = factor * coeffs->coeff_p1; +COEFF(2) = factor * coeffs->coeff_p2; diff --git a/src/common/1d.cube.size5/coeffs-dcl.h b/src/common/1d.cube.size5/coeffs-dcl.h new file mode 100644 index 0000000..bce2488 --- /dev/null +++ b/src/common/1d.cube.size5/coeffs-dcl.h @@ -0,0 +1,5 @@ +fp coeff_m2; +fp coeff_m1; +fp coeff_0; +fp coeff_p1; +fp coeff_p2; diff --git a/src/common/1d.cube.size5/data-dcl.h b/src/common/1d.cube.size5/data-dcl.h new file mode 100644 index 0000000..4308108 --- /dev/null +++ b/src/common/1d.cube.size5/data-dcl.h @@ -0,0 +1,5 @@ +fp data_m2; +fp data_m1; +fp data_0; +fp data_p1; +fp data_p2; diff --git a/src/common/1d.cube.size5/evaluate-molecule.c b/src/common/1d.cube.size5/evaluate-molecule.c new file mode 100644 index 0000000..e4d7c70 --- /dev/null +++ b/src/common/1d.cube.size5/evaluate-molecule.c @@ -0,0 +1,5 @@ + coeffs->coeff_m2*data->data_m2 + + coeffs->coeff_m1*data->data_m1 + + coeffs->coeff_0*data->data_0 + + coeffs->coeff_p1*data->data_p1 + + coeffs->coeff_p2*data->data_p2; diff --git a/src/common/1d.cube.size5/load-data.c b/src/common/1d.cube.size5/load-data.c new file mode 100644 index 0000000..2a6e8c7 --- /dev/null +++ b/src/common/1d.cube.size5/load-data.c @@ -0,0 +1,5 @@ +data->data_m2 = DATA(-2); +data->data_m1 = DATA(-1); +data->data_0 = DATA(0); +data->data_p1 = DATA(1); +data->data_p2 = DATA(2); diff --git a/src/common/1d.cube.size5/store-coeffs.c b/src/common/1d.cube.size5/store-coeffs.c new file mode 100644 index 0000000..ec2e17b --- /dev/null +++ b/src/common/1d.cube.size5/store-coeffs.c @@ -0,0 +1,5 @@ +COEFF(-2) = factor * coeffs->coeff_m2; +COEFF(-1) = factor * coeffs->coeff_m1; +COEFF(0) = factor * coeffs->coeff_0; +COEFF(1) = factor * coeffs->coeff_p1; +COEFF(2) = factor * coeffs->coeff_p2; diff --git a/src/common/1d.cube.size6/coeffs-dcl.h b/src/common/1d.cube.size6/coeffs-dcl.h new file mode 100644 index 0000000..90d978c --- /dev/null +++ b/src/common/1d.cube.size6/coeffs-dcl.h @@ -0,0 +1,6 @@ +fp coeff_m2; +fp coeff_m1; +fp coeff_0; +fp coeff_p1; +fp coeff_p2; +fp coeff_p3; diff --git a/src/common/1d.cube.size6/data-dcl.h b/src/common/1d.cube.size6/data-dcl.h new file mode 100644 index 0000000..301e199 --- /dev/null +++ b/src/common/1d.cube.size6/data-dcl.h @@ -0,0 +1,6 @@ +fp data_m2; +fp data_m1; +fp data_0; +fp data_p1; +fp data_p2; +fp data_p3; diff --git a/src/common/1d.cube.size6/evaluate-molecule.c b/src/common/1d.cube.size6/evaluate-molecule.c new file mode 100644 index 0000000..9e6e3c4 --- /dev/null +++ b/src/common/1d.cube.size6/evaluate-molecule.c @@ -0,0 +1,6 @@ + coeffs->coeff_m2*data->data_m2 + + coeffs->coeff_m1*data->data_m1 + + coeffs->coeff_0*data->data_0 + + coeffs->coeff_p1*data->data_p1 + + coeffs->coeff_p2*data->data_p2 + + coeffs->coeff_p3*data->data_p3; diff --git a/src/common/1d.cube.size6/load-data.c b/src/common/1d.cube.size6/load-data.c new file mode 100644 index 0000000..d271075 --- /dev/null +++ b/src/common/1d.cube.size6/load-data.c @@ -0,0 +1,6 @@ +data->data_m2 = DATA(-2); +data->data_m1 = DATA(-1); +data->data_0 = DATA(0); +data->data_p1 = DATA(1); +data->data_p2 = DATA(2); +data->data_p3 = DATA(3); diff --git a/src/common/1d.cube.size6/store-coeffs.c b/src/common/1d.cube.size6/store-coeffs.c new file mode 100644 index 0000000..c1ccbeb --- /dev/null +++ b/src/common/1d.cube.size6/store-coeffs.c @@ -0,0 +1,6 @@ +COEFF(-2) = factor * coeffs->coeff_m2; +COEFF(-1) = factor * coeffs->coeff_m1; +COEFF(0) = factor * coeffs->coeff_0; +COEFF(1) = factor * coeffs->coeff_p1; +COEFF(2) = factor * coeffs->coeff_p2; +COEFF(3) = factor * coeffs->coeff_p3; diff --git a/src/common/1d.cube.size7/coeffs-dcl.h b/src/common/1d.cube.size7/coeffs-dcl.h new file mode 100644 index 0000000..08ea7e6 --- /dev/null +++ b/src/common/1d.cube.size7/coeffs-dcl.h @@ -0,0 +1,7 @@ +fp coeff_m3; +fp coeff_m2; +fp coeff_m1; +fp coeff_0; +fp coeff_p1; +fp coeff_p2; +fp coeff_p3; diff --git a/src/common/1d.cube.size7/data-dcl.h b/src/common/1d.cube.size7/data-dcl.h new file mode 100644 index 0000000..c75fafc --- /dev/null +++ b/src/common/1d.cube.size7/data-dcl.h @@ -0,0 +1,7 @@ +fp data_m3; +fp data_m2; +fp data_m1; +fp data_0; +fp data_p1; +fp data_p2; +fp data_p3; diff --git a/src/common/1d.cube.size7/evaluate-molecule.c b/src/common/1d.cube.size7/evaluate-molecule.c new file mode 100644 index 0000000..ad83d90 --- /dev/null +++ b/src/common/1d.cube.size7/evaluate-molecule.c @@ -0,0 +1,7 @@ + coeffs->coeff_m3*data->data_m3 + + coeffs->coeff_m2*data->data_m2 + + coeffs->coeff_m1*data->data_m1 + + coeffs->coeff_0*data->data_0 + + coeffs->coeff_p1*data->data_p1 + + coeffs->coeff_p2*data->data_p2 + + coeffs->coeff_p3*data->data_p3; diff --git a/src/common/1d.cube.size7/load-data.c b/src/common/1d.cube.size7/load-data.c new file mode 100644 index 0000000..43973ff --- /dev/null +++ b/src/common/1d.cube.size7/load-data.c @@ -0,0 +1,7 @@ +data->data_m3 = DATA(-3); +data->data_m2 = DATA(-2); +data->data_m1 = DATA(-1); +data->data_0 = DATA(0); +data->data_p1 = DATA(1); +data->data_p2 = DATA(2); +data->data_p3 = DATA(3); diff --git a/src/common/1d.cube.size7/store-coeffs.c b/src/common/1d.cube.size7/store-coeffs.c new file mode 100644 index 0000000..93b597f --- /dev/null +++ b/src/common/1d.cube.size7/store-coeffs.c @@ -0,0 +1,7 @@ +COEFF(-3) = factor * coeffs->coeff_m3; +COEFF(-2) = factor * coeffs->coeff_m2; +COEFF(-1) = factor * coeffs->coeff_m1; +COEFF(0) = factor * coeffs->coeff_0; +COEFF(1) = factor * coeffs->coeff_p1; +COEFF(2) = factor * coeffs->coeff_p2; +COEFF(3) = factor * coeffs->coeff_p3; diff --git a/src/common/1d.log b/src/common/1d.log new file mode 100644 index 0000000..0dda0e4 --- /dev/null +++ b/src/common/1d.log @@ -0,0 +1,1492 @@ + |\^/| Maple 7 (IBM INTEL LINUX) +._|\| |/|_. Copyright (c) 2001 by Waterloo Maple Inc. + \ MAPLE / All rights reserved. Maple is a registered trademark of + <____ ____> Waterloo Maple Inc. + | Type ? for help. +# util.maple -- misc utility routines +# $Header$ +> +# +# fix_rationals - convert numbers to RATIONAL() calls +# nonmatching_names - find names in a list which *don't* have a specified prefix +# sprint_numeric_list - convert a numeric list to a valid C identifier suffix +# print_name_list_dcl - print C declarations for a list of names +# +# hypercube_points - compute all (integer) points in an N-dimensional hypercube +# +# ftruncate - truncate a file to zero length +# +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function converts all {integer, rational} subexpressions of its +# input except integer exponents and -1 factors in products, into function +# calls +# RATIONAL(num,den) +# This is useful in conjunction with the C() library function, since +# +# C( (1/3) * foo * bar ) +# t0 = foo*bar/3; +# +# generates a (slow) division (and runs the risk of mixed-mode-arithmetic +# problems), while +# +# C((1.0/3.0) * foo * bar); +# t0 = 0.3333333333*foo*bar; +# +# suffers from roundoff error. With this function, +# +# fix_rationals((1/3) * foo * bar); +# RATIONAL(1,3) foo bar +# C(%); +# t0 = RATIONAL(1.0,3.0)*foo*bar; +# +# which a C preprocessor macro can easily convert to the desired +# +# t0 = (1.0/3.0)*foo*bar; +# +# Additionally, this function can be told to leave certain types of +# subexpressions unconverged. For example, +# fix_rationals(expr, type, specfunc(integer, DATA)); +# will leave all subexpressions of the form DATA(integer arguments) +# unconverted. +# +# Arguments: +# expr = (in) The expression to be converted. +# inert_fn = (optional in) +# If specified, this argument should be a Boolean procedure +# or the name of a Boolean procedure. This procedure should +# take one or more argument, and return true if and only if +# the first argument should *not* be converted, i.e. if we +# should leave this expression unchanged. See the last +# example above. +# ... = (optional in) +# Any further arguments are passed as additional arguments to +# the inert_fn procedure. +# +> fix_rationals := +> proc( +> expr::{ +> algebraic, name = algebraic, +> list({algebraic, name = algebraic}), +> set ({algebraic, name = algebraic}) +> }, +> inert_fn::{name, procedure} +> ) +> local nn, k, +> base, power, fbase, fpower, +> fn, fn_args_list, +> num, den, mult; +> +# do we want to convert this expression? +> if ((nargs >= 2) and inert_fn(expr, args[3..nargs])) +> then return expr; +> end if; +> +# recurse over lists and sets +> if (type(expr, {list,set})) +> then return map(fix_rationals, expr, args[2..nargs]); +> end if; +> +# recurse over equation right hand sides +> if (type(expr, name = algebraic)) +> then return ( lhs(expr) = fix_rationals(rhs(expr), args[2..nargs]) ); +> end if; +> +# recurse over functions other than RATIONAL() +> if (type(expr, function)) +> then +> fn := op(0, expr); +> if (fn <> 'RATIONAL') +> then +> fn_args_list := [op(expr)]; +> fn_args_list := map(fix_rationals, fn_args_list, args[2..nargs]); +> fn; return '%'( op(fn_args_list) ); +> end if; +> end if; +> +> nn := nops(expr); +> +# recurse over sums +> if (type(expr, `+`)) +> then return sum('fix_rationals(op(k,expr), args[2..nargs])', 'k'=1..nn); +> end if; +> +# recurse over products +# ... leaving leading -1 factors intact, i.e. not converted to RATIONAL(-1,1) +> if (type(expr, `*`)) +> then +> if (op(1, expr) = -1) +> then return -1*fix_rationals(remove(type, expr, 'identical(-1)'), +> args[2..nargs]); +> else return product('fix_rationals(op(k,expr), args[2..nargs])', +> 'k'=1..nn); +> end if; +> end if; +> +# recurse over powers +# ... leaving integer exponents intact +> if (type(expr, `^`)) +> then +> base := op(1, expr); +> power := op(2, expr); +> +> fbase := fix_rationals(base, args[2..nargs]); +> if (type(power, integer)) +> then fpower := power; +> else fpower := fix_rationals(power, args[2..nargs]); +> end if; +> return fbase ^ fpower; +> end if; +> +# fix integers and fractions +> if (type(expr, integer)) +> then return 'RATIONAL'(expr, 1); +> end if; +> if (type(expr, fraction)) +> then +> num := op(1, expr); +> den := op(2, expr); +> +> return 'RATIONAL'(num, den); +> end if; +> +# turn Maple floating-point into integer fraction, then recursively fix that +> if (type(expr, float)) +> then +> mult := op(1, expr); +> power := op(2, expr); +> return fix_rationals(mult * 10^power, args[2..nargs]); +> end if; +> +# identity op on names +> if (type(expr, name)) +> then return expr; +> end if; +> +# unknown type +> error "%0", +> "unknown type for expr!", +> " whattype(expr) = ", whattype(expr), +> " expr = ", expr; +> end proc; +fix_rationals := proc(expr::{algebraic, name = algebraic, +list({algebraic, name = algebraic}), set({algebraic, name = algebraic})}, +inert_fn::{procedure, name}) +local nn, k, base, power, fbase, fpower, fn, fn_args_list, num, den, mult; + if 2 <= nargs and inert_fn(expr, args[3 .. nargs]) then return expr + end if; + if type(expr, {set, list}) then + return map(fix_rationals, expr, args[2 .. nargs]) + end if; + if type(expr, name = algebraic) then + return lhs(expr) = fix_rationals(rhs(expr), args[2 .. nargs]) + end if; + if type(expr, function) then + fn := op(0, expr); + if fn <> 'RATIONAL' then + fn_args_list := [op(expr)]; + fn_args_list := + map(fix_rationals, fn_args_list, args[2 .. nargs]); + fn; + return '%'(op(fn_args_list)) + end if + end if; + nn := nops(expr); + if type(expr, `+`) then return + sum('fix_rationals(op(k, expr), args[2 .. nargs])', 'k' = 1 .. nn) + end if; + if type(expr, `*`) then + if op(1, expr) = -1 then return -fix_rationals( + remove(type, expr, 'identical(-1)'), args[2 .. nargs]) + else return product('fix_rationals(op(k, expr), args[2 .. nargs])', + 'k' = 1 .. nn) + end if + end if; + if type(expr, `^`) then + base := op(1, expr); + power := op(2, expr); + fbase := fix_rationals(base, args[2 .. nargs]); + if type(power, integer) then fpower := power + else fpower := fix_rationals(power, args[2 .. nargs]) + end if; + return fbase^fpower + end if; + if type(expr, integer) then return 'RATIONAL'(expr, 1) end if; + if type(expr, fraction) then + num := op(1, expr); den := op(2, expr); return 'RATIONAL'(num, den) + end if; + if type(expr, float) then + mult := op(1, expr); + power := op(2, expr); + return fix_rationals(mult*10^power, args[2 .. nargs]) + end if; + if type(expr, name) then return expr end if; + error "%0", "unknown type for expr!", " whattype(expr) = ", + whattype(expr), " expr = ", expr +end proc + +> +################################################################################ +> +# +# This function finds names in a list which *don't* have a specified prefix. +# +# Arguments: +# name_list = A list of the names. +# prefix = The prefix we want to filter out. +# +# Results: +# This function returns the subset list of names which don't have the +# specified prefix. +# +> nonmatching_names := +> proc( name_list::list({name,string}), prefix::{name,string} ) +> +> select( proc(n) +> evalb(not StringTools[IsPrefix](prefix,n)); +> end proc +> , +> name_list +> ); +> end proc; +nonmatching_names := proc( +name_list::list({name, string}), prefix::{name, string}) + select(proc(n) evalb(not StringTools[IsPrefix](prefix, n)) end proc, + name_list) +end proc + +> +################################################################################ +> +# +# This function converts a numeric list to a string which is a valid +# C identifier suffix: elements are separated by "_", decimal points are +# replaced by "x", and all nonzero values have explicit +/- signs, which +# are replaced by "p"/"m". +# +# For example, [0,-3.5,+4] --> "0_m3x5_p4". +# +> sprint_numeric_list := +> proc(nlist::list(numeric)) +> +# generate preliminary string, eg "+0_-3.5_+4" +> map2(sprintf, "%+a", nlist); +> ListTools[Join](%, "_"); +> cat(op(%)); +> +# fixup bad characters +> StringTools[SubstituteAll](%, "+0", "0"); +> StringTools[CharacterMap](".+-", "xpm", %); +> +> return %; +> end proc; +sprint_numeric_list := proc(nlist::list(numeric)) + map2(sprintf, "%+a", nlist); + ListTools[Join](%, "_"); + cat(op(%)); + StringTools[SubstituteAll](%, "+0", "0"); + StringTools[CharacterMap](".+-", "xpm", %); + return % +end proc + +> +################################################################################ +> +# +# This function prints a sequence of C declarations for a list of names. +# +# Argument: +# name_list = A list of the names. +# type_name = The C type of the names, eg. "double". +# file_name = The file name to write the declaration to. This is +# truncated before writing. +# +> print_name_list_dcl := +> proc( name_list::list({name,string}), +> type_name::string, +> file_name::string ) +> local blanks, separator_string; +> +> ftruncate(file_name); +> +> map( +> proc(var::{name,string}) +> fprintf(file_name, +> "%s %s;\n", +> type_name, var); +> end proc +> , +> name_list +> ); +> +> fclose(file_name); +> NULL; +> end proc; +print_name_list_dcl := proc( +name_list::list({name, string}), type_name::string, file_name::string) +local blanks, separator_string; + ftruncate(file_name); + map(proc(var::{name, string}) + fprintf(file_name, "%s %s;\n", type_name, var) + end proc, name_list); + fclose(file_name); + NULL +end proc + +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function computes a list of all the (integer) points in an +# N-dimensional hypercube, in lexicographic order. The present +# implementation requires N <= 4. +# +# Arguments: +# cmin,cmax = N-element lists of cube minimum/maximum coordinates. +# +# Results: +# The function returns a set of d-element lists giving the coordinates. +# For example, +# hypercube([0,0], [2,1] +# returns +# { [0,0], [0,1], [1,0], [1,1], [2,0], [2,1] } +> hypercube_points := +> proc(cmin::list(integer), cmax::list(integer)) +> local N, i,j,k,l; +> +> N := nops(cmin); +> if (nops(cmax) <> N) +> then error +> "must have same number of dimensions for min and max coordinates!"; +> fi; +> +> if (N = 1) +> then return [seq([i], i=cmin[1]..cmax[1])]; +> elif (N = 2) +> then return [ +> seq( +> seq([i,j], j=cmin[2]..cmax[2]), +> i=cmin[1]..cmax[1]) +> ]; +> elif (N = 3) +> then return [ +> seq( +> seq( +> seq([i,j,k], k=cmin[3]..cmax[3]), +> j=cmin[2]..cmax[2] ), +> i=cmin[1]..cmax[1]) +> ]; +> elif (N = 4) +> then return [ +> seq( +> seq( +> seq( +> seq([i,j,k,l], l=cmin[4]..cmax[4]), +> k=cmin[3]..cmax[3] ), +> j=cmin[2]..cmax[2]), +> i=cmin[1]..cmax[1]) +> ]; +> else +> error "implementation restriction: must have N <= 4, got %1!", N; +> fi; +> end proc; +hypercube_points := proc(cmin::list(integer), cmax::list(integer)) +local N, i, j, k, l; + N := nops(cmin); + if nops(cmax) <> N then error + "must have same number of dimensions for min and max coordinates!" + end if; + if N = 1 then return [seq([i], i = cmin[1] .. cmax[1])] + elif N = 2 then return + [seq(seq([i, j], j = cmin[2] .. cmax[2]), i = cmin[1] .. cmax[1])] + elif N = 3 then return [seq( + seq(seq([i, j, k], k = cmin[3] .. cmax[3]), j = cmin[2] .. cmax[2]) + , i = cmin[1] .. cmax[1])] + elif N = 4 then return [seq(seq(seq( + seq([i, j, k, l], l = cmin[4] .. cmax[4]), k = cmin[3] .. cmax[3]), + j = cmin[2] .. cmax[2]), i = cmin[1] .. cmax[1])] + else error "implementation restriction: must have N <= 4, got %1!", N + end if +end proc + +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function truncates a file to 0 length if it exists, or creates +# it at that length if it doesn't exist. +# +# Arguments: +# file_name = (in) The name of the file. +# +> ftruncate := +> proc(file_name::string) +> fopen(file_name, 'WRITE'); +> fclose(%); +> NULL; +> end proc; +ftruncate := + + proc(file_name::string) fopen(file_name, 'WRITE'); fclose(%); NULL end proc + +# interpolate.maple -- compute interpolation formulas/coefficients +# $Header$ +> +# +# <<<representation of numbers, data values, etc>>> +# Lagrange_polynomial_interpolant - compute Lagrange polynomial interpolant +# Hermite_polynomial_interpolant - compute Hermite polynomial interpolant +# coeff_as_lc_of_data - coefficients of ... (linear combination of data) +# +# print_coeff__lc_of_data - print C code to compute coefficients +# print_fetch_data - print C code to fetch input array chunk into struct data +# print_store_coeffs - print C code to store struct coeffs "somewhere" +# print_interp_cmpt__lc_of_data - print C code for computation of interpolant +# +# coeff_name - name of coefficient of data at a given [m] coordinate +# data_var_name - name of variable storing data value at a given [m] coordinate +# +> +################################################################################ +> +# +# ***** representation of numbers, data values, etc ***** +# +# We use RATIONAL(p.0,q.0) to denote the rational number p/q. +# +# We use DATA(...) to represent the data values being interpolated at a +# specified [m] coordinate, where the arguments are the [m] coordinates. +# +# We use COEFF(...) to represent the molecule coefficient at a specified +# [m] coordinate, where the arguments are the [m] coordinates. +# +# For example, the usual 1-D centered 2nd order 1st derivative molecule +# would be written +# RATIONAL(-1.0,2.0)*DATA(-1) + RATIONA(1.0,2.0)*DATA(1) +# and its coefficients as +# COEFF(-1) = RATIONAL(-1.0,2.0) +# COEFF(1) = RATIONAL(1.0,2.0) +# +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function computes a Lagrange polynomial interpolant in any +# number of dimensions. +# +# Arguments: +# fn = The interpolation function. This should be a procedure in the +# coordinates, having the coefficients as global variables. For +# example, +# proc(x,y) c00 + c10*x + c01*y end proc +# coeff_list = A set of the interpolation coefficients (coefficients in +# the interpolation function), for example [c00, c10, c01]. +# coord_list = A list of the coordinates (independent variables in the +# interpolation function), for example [x,y]. +# posn_list = A list of positions (each a list of numeric values) where the +# interpolant is to use data, for example hypercube([0,0], [1,1]). +# Any positions may be used; if they're redundant (as in the +# example) the least-squares interpolant is computed. +# +# Results: +# This function returns the interpolating polynomial, in the form of +# an algebraic expression in the coordinates and the data values. +# +> Lagrange_polynomial_interpolant := +> proc( +> fn::procedure, coeff_list::list(name), +> coord_list::list(name), posn_list::list(list(numeric)) +> ) +> local posn, data_eqns, coeff_eqns; +> +# coefficients of interpolating polynomial +> data_eqns := { seq( fn(op(posn))='DATA'(op(posn)) , posn=posn_list ) }; +> coeff_eqns := linalg[leastsqrs](data_eqns, {op(coeff_list)}); +> if (has(coeff_eqns, '_t')) +> then error "interpolation coefficients aren't uniquely determined!"; +> end if; +> +# interpolant as a polynomial in the coordinates +> return subs(coeff_eqns, eval(fn))(op(coord_list)); +> end proc; +Lagrange_polynomial_interpolant := proc(fn::procedure, coeff_list::list(name), +coord_list::list(name), posn_list::list(list(numeric))) +local posn, data_eqns, coeff_eqns; + data_eqns := {seq(fn(op(posn)) = 'DATA'(op(posn)), posn = posn_list)}; + coeff_eqns := linalg[leastsqrs](data_eqns, {op(coeff_list)}); + if has(coeff_eqns, '_t') then + error "interpolation coefficients aren't uniquely determined!" + end if; + return subs(coeff_eqns, eval(fn))(op(coord_list)) +end proc + +> +################################################################################ +> +# +# This function computes a Hermite polynomial interpolant in any +# number of dimensions. This is a polynomial which +# * has values which match the given data DATA() at a specified set of +# points, and +# * has derivatives which match the specified finite-difference derivatives +# of the given data DATA() at a specified set of points +# +# For the derivative matching, we actually match all possible products +# of 1st derivatives, i.e. in 2-D we match dx, dy, and dxy, in 3-D we +# match dx, dy, dz, dxy, dxz, dyz, and dxyz, etc etc. +# +# Arguments: +# fn = The interpolation function. This should be a procedure in the +# coordinates, having the coefficients as global variables. For +# example, +# proc(x,y) +# + c03*y^3 + c13*x*y^3 + c23*x^2*y^3 + c33*x^3*y^3 +# + c02*y^2 + c12*x*y^2 + c22*x^2*y^2 + c32*x^3*y^2 +# + c01*y + c11*x*y + c21*x^2*y + c31*x^3*y +# + c00 + c10*x + c20*x^2 + c30*x^3 +# end proc; +# coeff_set = A set of the interpolation coefficients (coefficients in +# the interpolation function), for example +# { +# c03, c13, c23, c33, +# c02, c12, c22, c32, +# c01, c11, c21, c31, +# c00, c10, c20, c30 +# } +# coord_list = A list of the coordinates (independent variables in the +# interpolation function), for example [x,y]. +# deriv_set = A set of equations of the form +# {coords} = proc +# giving the derivatives which are to be matched, and the +# procedures to compute their finite-difference approximations. +# Each procedure should take N_dims integer arguments specifying +# an evaluation point, and return a suitable linear combination +# of the DATA() for the derivative at that point. For example +# { +# {x} = proc(i::integer, j::integer) +# - 1/2*DATA(i-1,j) + 1/2*DATA(i+1,j) +# end proc +# , +# {y} = proc(i::integer, j::integer) +# - 1/2*DATA(i,j-1) + 1/2*DATA(i,j+1) +# end proc +# , +# {x,y} = proc(i::integer, j::integer) +# - 1/4*DATA(i-1,j+1) + 1/4*DATA(i+1,j+1) +# + 1/4*DATA(i-1,j-1) - 1/4*DATA(i+1,j-1) +# end proc +# } +# fn_posn_set = A set of positions (each a list of numeric values) +# where the interpolant is to match the given data DATA(), +# for example +# {[0,0], [0,1], [1,0], [1,1]} +# deriv_posn_set = A list of positions (each a list of numeric values) +# where the interpolant is to match the derivatives +# specified by deriv_set , for example +# {[0,0], [0,1], [1,0], [1,1]} +# +# Results: +# This function returns the interpolating polynomial, in the form of +# an algebraic expression in the coordinates and the data values. +# +> Hermite_polynomial_interpolant := +> proc( +> fn::procedure, +> coeff_set::set(name), +> coord_list::list(name), +> deriv_set::set(set(name) = procedure), +> fn_posn_set::set(list(numeric)), +> deriv_posn_set::set(list(numeric)) +> ) +> local fn_eqnset, deriv_eqnset, coeff_eqns, subs_eqnset; +> +> +# +# compute a set of equations +# {fn(posn) = DATA(posn)} +# giving the function values to be matched +# +> fn_eqnset := map( +> # return equation that fn(posn) = DATA(posn) +> proc(posn::list(integer)) +> fn(op(posn)) = 'DATA'(op(posn)); +> end proc +> , +> fn_posn_set +> ); +> +> +# +# compute a set of equations +# { diff(fn,coords)(posn) = DERIV(coords)(posn) } +# giving the derivative values to be matched, where DERIV(coords) +# is a placeholder for the appropriate derivative +# +> map( +> # return set of equations for this particular derivative +> proc(deriv_coords::set(name)) +> local deriv_fn; +> fn(op(coord_list)); +> diff(%, op(deriv_coords)); +> deriv_fn := unapply(%, op(coord_list)); +> map( +> proc(posn::list(integer)) +> deriv_fn(op(posn)) = 'DERIV'(op(deriv_coords))(op(posn)); +> end proc +> , +> deriv_posn_set +> ); +> end proc +> , +> map(lhs, deriv_set) +> ); +> deriv_eqnset := `union`(op(%)); +> +> +# +# solve overall set of equations for coefficients +# in terms of DATA() and DERIV() values +# +> coeff_eqns := solve[linear](fn_eqnset union deriv_eqnset, coeff_set); +> if (indets(map(rhs,%)) <> {}) +> then error "no unique solution for coefficients -- %1 eqns for %2 coeffs", +> nops(fn_eqnset union deriv_eqnset), +> nops(coeff_set); +> fi; +> +> +# +# compute a set of substitution equations +# {'DERIV'(coords) = procedure} +# +> subs_eqnset := map( +> proc(eqn::set(name) = procedure) +> 'DERIV'(op(lhs(eqn))) = rhs(eqn); +> end proc +> , +> deriv_set +> ); +> +> +# +# compute the coefficients in terms of the DATA() values +# +> subs(subs_eqnset, coeff_eqns); +> eval(%); +> +# +# compute the interpolant as a polynomial in the coordinates +# +> subs(%, fn(op(coord_list))); +> end proc; +Hermite_polynomial_interpolant := proc(fn::procedure, coeff_set::set(name), +coord_list::list(name), deriv_set::set(set(name) = procedure), +fn_posn_set::set(list(numeric)), deriv_posn_set::set(list(numeric))) +local fn_eqnset, deriv_eqnset, coeff_eqns, subs_eqnset; + fn_eqnset := map( + proc(posn::list(integer)) fn(op(posn)) = 'DATA'(op(posn)) end proc, + fn_posn_set); + map(proc(deriv_coords::set(name)) + local deriv_fn; + fn(op(coord_list)); + diff(%, op(deriv_coords)); + deriv_fn := unapply(%, op(coord_list)); + map(proc(posn::list(integer)) + deriv_fn(op(posn)) = + 'DERIV'(op(deriv_coords))(op(posn)) + end proc, deriv_posn_set) + end proc, map(lhs, deriv_set)); + deriv_eqnset := `union`(op(%)); + coeff_eqns := solve[linear](fn_eqnset union deriv_eqnset, coeff_set); + if indets(map(rhs, %)) <> {} then error + "no unique solution for coefficients -- %1 eqns for %2 coeffs", + nops(fn_eqnset union deriv_eqnset), nops(coeff_set) + end if; + subs_eqnset := map(proc(eqn::(set(name) = procedure)) + 'DERIV'(op(lhs(eqn))) = rhs(eqn) + end proc, deriv_set); + subs(subs_eqnset, coeff_eqns); + eval(%); + subs(%, fn(op(coord_list))) +end proc + +> +################################################################################ +> +# +# This function takes as input an interpolating polynomial, expresses +# it as a linear combination of the data values, and returns the coefficeints +# of that form. +# +# Arguments: +# interpolant = The interpolating polynomial (an algebraic expression +# in the coordinates and the data values). +# posn_list = The same list of data positions used in the interpolant. +# +# Results: +# This function returns the coefficients, as a list of equations of the +# form COEFF(...) = value , where each value is a polynomial in the +# coordinates. The order of the list matches that of posn_list. +# +> coeff_as_lc_of_data := +> proc( +> interpolant::algebraic, +> posn_list::list(list(numeric)) +> ) +> local data_list, interpolant_as_lc_of_data; +> +# interpolant as a linear combination of the data values +> data_list := [ seq( 'DATA'(op(posn)) , posn=posn_list ) ]; +> interpolant_as_lc_of_data := collect(interpolant, data_list); +> +# coefficients of the data values in the linear combination +> return map( +> proc(posn::list(numeric)) +> coeff(interpolant_as_lc_of_data, DATA(op(posn))); +> 'COEFF'(op(posn)) = %; +> end proc +> , +> posn_list +> ); +> end proc; +coeff_as_lc_of_data := proc( +interpolant::algebraic, posn_list::list(list(numeric))) +local data_list, interpolant_as_lc_of_data; + data_list := [seq('DATA'(op(posn)), posn = posn_list)]; + interpolant_as_lc_of_data := collect(interpolant, data_list); + return map(proc(posn::list(numeric)) + coeff(interpolant_as_lc_of_data, DATA(op(posn))); + 'COEFF'(op(posn)) = % + end proc, posn_list) +end proc + +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function prints C expressions for the coefficients of an +# interpolating polynomial. (The polynomial is expressed as linear +# combinations of the data values with coefficients which are +# RATIONAL(p,q) calls.) +# +# Arguments: +# coeff_list = A list of the coefficients, as returned from +# coeff_as_lc_of_data() . +# coeff_name_prefix = A prefix string for the coefficient names. +# temp_name_type = The C type to be used for Maple-introduced temporary +# names, eg. "double". +# file_name = The file name to write the coefficients to. This is +# truncated before writing. +# +> print_coeff__lc_of_data := +> proc( coeff_list::list(specfunc(numeric,COEFF) = algebraic), +> coeff_name_prefix::string, +> temp_name_type::string, +> file_name::string ) +> global `codegen/C/function/informed`; +> local coeff_list2, cmpt_list, temp_name_list; +> +# convert LHS of each equation from a COEFF() call (eg COEFF(-1,+1)) +# to a Maple/C variable name (eg coeff_I_m1_p1) +> coeff_list2 := map( +> proc(coeff_eqn::specfunc(numeric,COEFF) = algebraic) +> local posn; +> posn := [op(lhs(coeff_eqn))]; +> coeff_name(posn,coeff_name_prefix); +> convert(%, name); # codegen[C] wants LHS +> # to be an actual Maple *name* +> % = fix_rationals(rhs(coeff_eqn)); +> end proc +> , +> coeff_list +> ); +> +# +# generate the C code +# +> +# tell codegen[C] not to warn about unknown RATIONAL() and DATA() "fn calls" +# via undocumented :( global table +> `codegen/C/function/informed`['RATIONAL'] := true; +> `codegen/C/function/informed`['DATA'] := true; +> +> ftruncate(file_name); +> +# optimized computation sequence for all the coefficients +# (may use local variables t0,t1,t2,...) +> cmpt_list := [codegen[optimize](coeff_list2, tryhard)]; +> +# list of the t0,t1,t2,... local variables +> temp_name_list := nonmatching_names(map(lhs,cmpt_list), coeff_name_prefix); +> +# declare the t0,t1,t2,... local variables (if there are any) +> if (nops(temp_name_list) > 0) +> then print_name_list_dcl(%, temp_name_type, file_name); +> fi; +> +# now print the optimized computation sequence +> codegen[C](cmpt_list, filename=file_name); +> +> fclose(file_name); +> +> NULL; +> end proc; +print_coeff__lc_of_data := proc( +coeff_list::list(specfunc(numeric, COEFF) = algebraic), +coeff_name_prefix::string, temp_name_type::string, file_name::string) +local coeff_list2, cmpt_list, temp_name_list; +global `codegen/C/function/informed`; + coeff_list2 := map(proc( + coeff_eqn::(specfunc(numeric, COEFF) = algebraic)) + local posn; + posn := [op(lhs(coeff_eqn))]; + coeff_name(posn, coeff_name_prefix); + convert(%, name); + % = fix_rationals(rhs(coeff_eqn)) + end proc, coeff_list); + `codegen/C/function/informed`['RATIONAL'] := true; + `codegen/C/function/informed`['DATA'] := true; + ftruncate(file_name); + cmpt_list := [codegen[optimize](coeff_list2, tryhard)]; + temp_name_list := + nonmatching_names(map(lhs, cmpt_list), coeff_name_prefix); + if 0 < nops(temp_name_list) then + print_name_list_dcl(%, temp_name_type, file_name) + end if; + codegen[C](cmpt_list, filename = file_name); + fclose(file_name); + NULL +end proc + +> +################################################################################ +> +# +# This function prints a sequence of C expression to assign the data-value +# variables, eg +# data->data_m1_p1 = DATA(-1,1); +# +# Arguments: +# posn_list = The same list of positions as was used to compute the +# interpolating polynomial. +# data_var_name_prefix = A prefix string for the data variable names. +# file_name = The file name to write the coefficients to. This is +# truncated before writing. +# +> print_fetch_data := +> proc( +> posn_list::list(list(numeric)), +> data_var_name_prefix::string, +> file_name::string +> ) +> +> ftruncate(file_name); +> map( +> proc(posn::list(numeric)) +> fprintf(file_name, +> "%s = %a;\n", +> data_var_name(posn,data_var_name_prefix), +> DATA(op(posn))); +> end proc +> , +> posn_list +> ); +> fclose(file_name); +> +> NULL; +> end proc; +print_fetch_data := proc(posn_list::list(list(numeric)), +data_var_name_prefix::string, file_name::string) + ftruncate(file_name); + map(proc(posn::list(numeric)) + fprintf(file_name, "%s = %a;\n", + data_var_name(posn, data_var_name_prefix), DATA(op(posn))) + end proc, posn_list); + fclose(file_name); + NULL +end proc + +> +################################################################################ +> +# +# This function prints a sequence of C expression to store the interpolation +# coefficients in COEFF(...) expressions, eg +# COEFF(1,-1) = factor * coeffs->coeff_p1_m1; +# +# Arguments: +# posn_list = The list of positions in the molecule. +# coeff_name_prefix = A prefix string for the coefficient names, +# eg "factor * coeffs->coeff_" +# file_name = The file name to write the coefficients to. This is +# truncated before writing. +# +> print_store_coeffs := +> proc( +> posn_list::list(list(numeric)), +> coeff_name_prefix::string, +> file_name::string +> ) +> +> ftruncate(file_name); +> map( +> proc(posn::list(numeric)) +> fprintf(file_name, +> "%a = %s;\n", +> 'COEFF'(op(posn)), +> coeff_name(posn,coeff_name_prefix)); +> end proc +> , +> posn_list +> ); +> fclose(file_name); +> +> NULL; +> end proc; +print_store_coeffs := proc(posn_list::list(list(numeric)), +coeff_name_prefix::string, file_name::string) + ftruncate(file_name); + map(proc(posn::list(numeric)) + fprintf(file_name, "%a = %s;\n", 'COEFF'(op(posn)), + coeff_name(posn, coeff_name_prefix)) + end proc, posn_list); + fclose(file_name); + NULL +end proc + +> +################################################################################ +> +# +# This function prints a C expression to evaluate a molecule, i.e. +# to compute the molecule as a linear combination of the data values. +# +# Arguments: +# posn_list = The list of positions in the molecule. +# coeff_name_prefix = A prefix string for the coefficient names. +# data_var_name_prefix = A prefix string for the data variable names. +# file_name = The file name to write the coefficients to. This is +# truncated before writing. +# +> print_evaluate_molecule := +> proc( +> posn_list::list(list(numeric)), +> coeff_name_prefix::string, +> data_var_name_prefix::string, +> file_name::string +> ) +> +> ftruncate(file_name); +> +# list of "coeff*data_var" terms +> map( +> proc(posn::list(numeric)) +> sprintf("%s*%s", +> coeff_name(posn,coeff_name_prefix), +> data_var_name(posn,data_var_name_prefix)); +> end proc +> , +> posn_list +> ); +> +> ListTools[Join](%, "\n + "); +> cat(op(%)); +> fprintf(file_name, " %s;\n", %); +> +> fclose(file_name); +> +> NULL; +> end proc; +print_evaluate_molecule := proc(posn_list::list(list(numeric)), +coeff_name_prefix::string, data_var_name_prefix::string, file_name::string) + ftruncate(file_name); + map(proc(posn::list(numeric)) + sprintf("%s*%s", coeff_name(posn, coeff_name_prefix), + data_var_name(posn, data_var_name_prefix)) + end proc, posn_list); + ListTools[Join](%, "\n + "); + cat(op(%)); + fprintf(file_name, " %s;\n", %); + fclose(file_name); + NULL +end proc + +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function computes the name of the coefficient of the data at a +# given [m] position, i.e. it encapsulates our naming convention for this. +# +# Arguments: +# posn = (in) The [m] coordinates. +# name_prefix = A prefix string for the coefficient name. +# +# Results: +# The function returns the coefficient, as a Maple string. +# +> coeff_name := +> proc(posn::list(numeric), name_prefix::string) +> cat(name_prefix, sprint_numeric_list(posn)); +> end proc; +coeff_name := proc(posn::list(numeric), name_prefix::string) + cat(name_prefix, sprint_numeric_list(posn)) +end proc + +> +################################################################################ +> +# +# This function computes the name of the variable in which the C code +# will store the input data at a given [m] position, i.e. it encapsulates +# our naming convention for this. +# +# Arguments: +# posn = (in) The [m] coordinates. +# name_prefix = A prefix string for the variable name. +# +# Results: +# The function returns the variable name, as a Maple string. +# +> data_var_name := +> proc(posn::list(numeric), name_prefix::string) +> cat(name_prefix, sprint_numeric_list(posn)); +> end proc; +data_var_name := proc(posn::list(numeric), name_prefix::string) + cat(name_prefix, sprint_numeric_list(posn)) +end proc + +# Maple code to compute lists of point positions in hypercube-shaped molecules +# $Header$ +> +################################################################################ +> +# +# 1D interpolation points +# +> posn_list_1d_size2 := hypercube_points([ 0], [+1]); + posn_list_1d_size2 := [[0], [1]] + +> posn_list_1d_size3 := hypercube_points([-1], [+1]); + posn_list_1d_size3 := [[-1], [0], [1]] + +> posn_list_1d_size4 := hypercube_points([-1], [+2]); + posn_list_1d_size4 := [[-1], [0], [1], [2]] + +> posn_list_1d_size5 := hypercube_points([-2], [+2]); + posn_list_1d_size5 := [[-2], [-1], [0], [1], [2]] + +> posn_list_1d_size6 := hypercube_points([-2], [+3]); + posn_list_1d_size6 := [[-2], [-1], [0], [1], [2], [3]] + +> posn_list_1d_size7 := hypercube_points([-3], [+3]); + posn_list_1d_size7 := [[-3], [-2], [-1], [0], [1], [2], [3]] + +> +################################################################################ +> +# +# 2D interpolation points (Fortran ordering) +# +> posn_list_2d_size2 := map(ListTools[Reverse], +> hypercube_points([ 0, 0], [+1,+1])); + posn_list_2d_size2 := [[0, 0], [1, 0], [0, 1], [1, 1]] + +> posn_list_2d_size3 := map(ListTools[Reverse], +> hypercube_points([-1,-1], [+1,+1])); +posn_list_2d_size3 := [[-1, -1], [0, -1], [1, -1], [-1, 0], [0, 0], [1, 0], + + [-1, 1], [0, 1], [1, 1]] + +> posn_list_2d_size4 := map(ListTools[Reverse], +> hypercube_points([-1,-1], [+2,+2])); +posn_list_2d_size4 := [[-1, -1], [0, -1], [1, -1], [2, -1], [-1, 0], [0, 0], + + [1, 0], [2, 0], [-1, 1], [0, 1], [1, 1], [2, 1], [-1, 2], [0, 2], [1, 2], + + [2, 2]] + +> posn_list_2d_size5 := map(ListTools[Reverse], +> hypercube_points([-2,-2], [+2,+2])); +posn_list_2d_size5 := [[-2, -2], [-1, -2], [0, -2], [1, -2], [2, -2], [-2, -1], + + [-1, -1], [0, -1], [1, -1], [2, -1], [-2, 0], [-1, 0], [0, 0], [1, 0], + + [2, 0], [-2, 1], [-1, 1], [0, 1], [1, 1], [2, 1], [-2, 2], [-1, 2], [0, 2], + + [1, 2], [2, 2]] + +> posn_list_2d_size6 := map(ListTools[Reverse], +> hypercube_points([-2,-2], [+3,+3])); +posn_list_2d_size6 := [[-2, -2], [-1, -2], [0, -2], [1, -2], [2, -2], [3, -2], + + [-2, -1], [-1, -1], [0, -1], [1, -1], [2, -1], [3, -1], [-2, 0], [-1, 0], + + [0, 0], [1, 0], [2, 0], [3, 0], [-2, 1], [-1, 1], [0, 1], [1, 1], [2, 1], + + [3, 1], [-2, 2], [-1, 2], [0, 2], [1, 2], [2, 2], [3, 2], [-2, 3], [-1, 3], + + [0, 3], [1, 3], [2, 3], [3, 3]] + +> +################################################################################ +> +# +# 3D interpolation points (Fortran ordering) +# +> posn_list_3d_size2 := map(ListTools[Reverse], +> hypercube_points([ 0, 0, 0], [+1,+1,+1])); +posn_list_3d_size2 := [[0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0], [0, 0, 1], + + [1, 0, 1], [0, 1, 1], [1, 1, 1]] + +> posn_list_3d_size3 := map(ListTools[Reverse], +> hypercube_points([-1,-1,-1], [+1,+1,+1])); +posn_list_3d_size3 := [[-1, -1, -1], [0, -1, -1], [1, -1, -1], [-1, 0, -1], + + [0, 0, -1], [1, 0, -1], [-1, 1, -1], [0, 1, -1], [1, 1, -1], [-1, -1, 0], + + [0, -1, 0], [1, -1, 0], [-1, 0, 0], [0, 0, 0], [1, 0, 0], [-1, 1, 0], + + [0, 1, 0], [1, 1, 0], [-1, -1, 1], [0, -1, 1], [1, -1, 1], [-1, 0, 1], + + [0, 0, 1], [1, 0, 1], [-1, 1, 1], [0, 1, 1], [1, 1, 1]] + +> posn_list_3d_size4 := map(ListTools[Reverse], +> hypercube_points([-1,-1,-1], [+2,+2,+2])); +posn_list_3d_size4 := [[-1, -1, -1], [0, -1, -1], [1, -1, -1], [2, -1, -1], + + [-1, 0, -1], [0, 0, -1], [1, 0, -1], [2, 0, -1], [-1, 1, -1], [0, 1, -1], + + [1, 1, -1], [2, 1, -1], [-1, 2, -1], [0, 2, -1], [1, 2, -1], [2, 2, -1], + + [-1, -1, 0], [0, -1, 0], [1, -1, 0], [2, -1, 0], [-1, 0, 0], [0, 0, 0], + + [1, 0, 0], [2, 0, 0], [-1, 1, 0], [0, 1, 0], [1, 1, 0], [2, 1, 0], + + [-1, 2, 0], [0, 2, 0], [1, 2, 0], [2, 2, 0], [-1, -1, 1], [0, -1, 1], + + [1, -1, 1], [2, -1, 1], [-1, 0, 1], [0, 0, 1], [1, 0, 1], [2, 0, 1], + + [-1, 1, 1], [0, 1, 1], [1, 1, 1], [2, 1, 1], [-1, 2, 1], [0, 2, 1], + + [1, 2, 1], [2, 2, 1], [-1, -1, 2], [0, -1, 2], [1, -1, 2], [2, -1, 2], + + [-1, 0, 2], [0, 0, 2], [1, 0, 2], [2, 0, 2], [-1, 1, 2], [0, 1, 2], + + [1, 1, 2], [2, 1, 2], [-1, 2, 2], [0, 2, 2], [1, 2, 2], [2, 2, 2]] + +> posn_list_3d_size5 := map(ListTools[Reverse], +> hypercube_points([-2,-2,-2], [+2,+2,+2])); +posn_list_3d_size5 := [[-2, -2, -2], [-1, -2, -2], [0, -2, -2], [1, -2, -2], + + [2, -2, -2], [-2, -1, -2], [-1, -1, -2], [0, -1, -2], [1, -1, -2], + + [2, -1, -2], [-2, 0, -2], [-1, 0, -2], [0, 0, -2], [1, 0, -2], [2, 0, -2], + + [-2, 1, -2], [-1, 1, -2], [0, 1, -2], [1, 1, -2], [2, 1, -2], [-2, 2, -2], + + [-1, 2, -2], [0, 2, -2], [1, 2, -2], [2, 2, -2], [-2, -2, -1], [-1, -2, -1], + + [0, -2, -1], [1, -2, -1], [2, -2, -1], [-2, -1, -1], [-1, -1, -1], + + [0, -1, -1], [1, -1, -1], [2, -1, -1], [-2, 0, -1], [-1, 0, -1], [0, 0, -1], + + [1, 0, -1], [2, 0, -1], [-2, 1, -1], [-1, 1, -1], [0, 1, -1], [1, 1, -1], + + [2, 1, -1], [-2, 2, -1], [-1, 2, -1], [0, 2, -1], [1, 2, -1], [2, 2, -1], + + [-2, -2, 0], [-1, -2, 0], [0, -2, 0], [1, -2, 0], [2, -2, 0], [-2, -1, 0], + + [-1, -1, 0], [0, -1, 0], [1, -1, 0], [2, -1, 0], [-2, 0, 0], [-1, 0, 0], + + [0, 0, 0], [1, 0, 0], [2, 0, 0], [-2, 1, 0], [-1, 1, 0], [0, 1, 0], + + [1, 1, 0], [2, 1, 0], [-2, 2, 0], [-1, 2, 0], [0, 2, 0], [1, 2, 0], + + [2, 2, 0], [-2, -2, 1], [-1, -2, 1], [0, -2, 1], [1, -2, 1], [2, -2, 1], + + [-2, -1, 1], [-1, -1, 1], [0, -1, 1], [1, -1, 1], [2, -1, 1], [-2, 0, 1], + + [-1, 0, 1], [0, 0, 1], [1, 0, 1], [2, 0, 1], [-2, 1, 1], [-1, 1, 1], + + [0, 1, 1], [1, 1, 1], [2, 1, 1], [-2, 2, 1], [-1, 2, 1], [0, 2, 1], + + [1, 2, 1], [2, 2, 1], [-2, -2, 2], [-1, -2, 2], [0, -2, 2], [1, -2, 2], + + [2, -2, 2], [-2, -1, 2], [-1, -1, 2], [0, -1, 2], [1, -1, 2], [2, -1, 2], + + [-2, 0, 2], [-1, 0, 2], [0, 0, 2], [1, 0, 2], [2, 0, 2], [-2, 1, 2], + + [-1, 1, 2], [0, 1, 2], [1, 1, 2], [2, 1, 2], [-2, 2, 2], [-1, 2, 2], + + [0, 2, 2], [1, 2, 2], [2, 2, 2]] + +> posn_list_3d_size6 := map(ListTools[Reverse], +> hypercube_points([-2,-2,-2], [+3,+3,+3])); +posn_list_3d_size6 := [[-2, -2, -2], [-1, -2, -2], [0, -2, -2], [1, -2, -2], + + [2, -2, -2], [3, -2, -2], [-2, -1, -2], [-1, -1, -2], [0, -1, -2], + + [1, -1, -2], [2, -1, -2], [3, -1, -2], [-2, 0, -2], [-1, 0, -2], [0, 0, -2], + + [1, 0, -2], [2, 0, -2], [3, 0, -2], [-2, 1, -2], [-1, 1, -2], [0, 1, -2], + + [1, 1, -2], [2, 1, -2], [3, 1, -2], [-2, 2, -2], [-1, 2, -2], [0, 2, -2], + + [1, 2, -2], [2, 2, -2], [3, 2, -2], [-2, 3, -2], [-1, 3, -2], [0, 3, -2], + + [1, 3, -2], [2, 3, -2], [3, 3, -2], [-2, -2, -1], [-1, -2, -1], [0, -2, -1], + + [1, -2, -1], [2, -2, -1], [3, -2, -1], [-2, -1, -1], [-1, -1, -1], + + [0, -1, -1], [1, -1, -1], [2, -1, -1], [3, -1, -1], [-2, 0, -1], + + [-1, 0, -1], [0, 0, -1], [1, 0, -1], [2, 0, -1], [3, 0, -1], [-2, 1, -1], + + [-1, 1, -1], [0, 1, -1], [1, 1, -1], [2, 1, -1], [3, 1, -1], [-2, 2, -1], + + [-1, 2, -1], [0, 2, -1], [1, 2, -1], [2, 2, -1], [3, 2, -1], [-2, 3, -1], + + [-1, 3, -1], [0, 3, -1], [1, 3, -1], [2, 3, -1], [3, 3, -1], [-2, -2, 0], + + [-1, -2, 0], [0, -2, 0], [1, -2, 0], [2, -2, 0], [3, -2, 0], [-2, -1, 0], + + [-1, -1, 0], [0, -1, 0], [1, -1, 0], [2, -1, 0], [3, -1, 0], [-2, 0, 0], + + [-1, 0, 0], [0, 0, 0], [1, 0, 0], [2, 0, 0], [3, 0, 0], [-2, 1, 0], + + [-1, 1, 0], [0, 1, 0], [1, 1, 0], [2, 1, 0], [3, 1, 0], [-2, 2, 0], + + [-1, 2, 0], [0, 2, 0], [1, 2, 0], [2, 2, 0], [3, 2, 0], [-2, 3, 0], + + [-1, 3, 0], [0, 3, 0], [1, 3, 0], [2, 3, 0], [3, 3, 0], [-2, -2, 1], + + [-1, -2, 1], [0, -2, 1], [1, -2, 1], [2, -2, 1], [3, -2, 1], [-2, -1, 1], + + [-1, -1, 1], [0, -1, 1], [1, -1, 1], [2, -1, 1], [3, -1, 1], [-2, 0, 1], + + [-1, 0, 1], [0, 0, 1], [1, 0, 1], [2, 0, 1], [3, 0, 1], [-2, 1, 1], + + [-1, 1, 1], [0, 1, 1], [1, 1, 1], [2, 1, 1], [3, 1, 1], [-2, 2, 1], + + [-1, 2, 1], [0, 2, 1], [1, 2, 1], [2, 2, 1], [3, 2, 1], [-2, 3, 1], + + [-1, 3, 1], [0, 3, 1], [1, 3, 1], [2, 3, 1], [3, 3, 1], [-2, -2, 2], + + [-1, -2, 2], [0, -2, 2], [1, -2, 2], [2, -2, 2], [3, -2, 2], [-2, -1, 2], + + [-1, -1, 2], [0, -1, 2], [1, -1, 2], [2, -1, 2], [3, -1, 2], [-2, 0, 2], + + [-1, 0, 2], [0, 0, 2], [1, 0, 2], [2, 0, 2], [3, 0, 2], [-2, 1, 2], + + [-1, 1, 2], [0, 1, 2], [1, 1, 2], [2, 1, 2], [3, 1, 2], [-2, 2, 2], + + [-1, 2, 2], [0, 2, 2], [1, 2, 2], [2, 2, 2], [3, 2, 2], [-2, 3, 2], + + [-1, 3, 2], [0, 3, 2], [1, 3, 2], [2, 3, 2], [3, 3, 2], [-2, -2, 3], + + [-1, -2, 3], [0, -2, 3], [1, -2, 3], [2, -2, 3], [3, -2, 3], [-2, -1, 3], + + [-1, -1, 3], [0, -1, 3], [1, -1, 3], [2, -1, 3], [3, -1, 3], [-2, 0, 3], + + [-1, 0, 3], [0, 0, 3], [1, 0, 3], [2, 0, 3], [3, 0, 3], [-2, 1, 3], + + [-1, 1, 3], [0, 1, 3], [1, 1, 3], [2, 1, 3], [3, 1, 3], [-2, 2, 3], + + [-1, 2, 3], [0, 2, 3], [1, 2, 3], [2, 2, 3], [3, 2, 3], [-2, 3, 3], + + [-1, 3, 3], [0, 3, 3], [1, 3, 3], [2, 3, 3], [3, 3, 3]] + +# Maple code to compute common coefficients for all 1d interpolation schemes +# $Header$ +> +################################################################################ +> +# +# generic stuff for 1d, cube, size=2 +# +> +> data_list_1d_size2 := map(data_var_name, posn_list_1d_size2, "data_"); + data_list_1d_size2 := ["data_0", "data_p1"] + +> coeffs_list_1d_size2 := map(coeff_name, posn_list_1d_size2, "coeff_"); + coeffs_list_1d_size2 := ["coeff_0", "coeff_p1"] + +> +> print_name_list_dcl(data_list_1d_size2, "fp", +> "1d.cube.size2/data-dcl.h"); +> print_name_list_dcl(coeffs_list_1d_size2, "fp", +> "1d.cube.size2/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_1d_size2, "data->data_", +> "1d.cube.size2/fetch-data.c"); +> print_evaluate_molecule(posn_list_1d_size2, +> "coeffs->coeff_", "data->data_", +> "1d.cube.size2/evaluate-molecule.c"); +> print_store_coeffs(posn_list_1d_size2, +> "factor * coeffs->coeff_", +> "1d.cube.size2/store-coeffs.c"); +> +################################################################################ +> +# +# generic stuff for 1d, cube, size=3 +# +> +> data_list_1d_size3 := map(data_var_name, posn_list_1d_size3, "data_"); + data_list_1d_size3 := ["data_m1", "data_0", "data_p1"] + +> coeffs_list_1d_size3 := map(coeff_name, posn_list_1d_size3, "coeff_"); + coeffs_list_1d_size3 := ["coeff_m1", "coeff_0", "coeff_p1"] + +> +> print_name_list_dcl(data_list_1d_size3, "fp", +> "1d.cube.size3/data-dcl.h"); +> print_name_list_dcl(coeffs_list_1d_size3, "fp", +> "1d.cube.size3/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_1d_size3, "data->data_", +> "1d.cube.size3/fetch-data.c"); +> print_evaluate_molecule(posn_list_1d_size3, +> "coeffs->coeff_", "data->data_", +> "1d.cube.size3/evaluate-molecule.c"); +> print_store_coeffs(posn_list_1d_size3, +> "factor * coeffs->coeff_", +> "1d.cube.size3/store-coeffs.c"); +> +################################################################################ +> +# +# generic stuff for 1d, cube, size=4 +# +> +> data_list_1d_size4 := map(data_var_name, posn_list_1d_size4, "data_"); + data_list_1d_size4 := ["data_m1", "data_0", "data_p1", "data_p2"] + +> coeffs_list_1d_size4 := map(coeff_name, posn_list_1d_size4, "coeff_"); + coeffs_list_1d_size4 := ["coeff_m1", "coeff_0", "coeff_p1", "coeff_p2"] + +> +> print_name_list_dcl(data_list_1d_size4, "fp", +> "1d.cube.size4/data-dcl.h"); +> print_name_list_dcl(coeffs_list_1d_size4, "fp", +> "1d.cube.size4/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_1d_size4, "data->data_", +> "1d.cube.size4/fetch-data.c"); +> print_evaluate_molecule(posn_list_1d_size4, +> "coeffs->coeff_", "data->data_", +> "1d.cube.size4/evaluate-molecule.c"); +> print_store_coeffs(posn_list_1d_size4, +> "factor * coeffs->coeff_", +> "1d.cube.size4/store-coeffs.c"); +> +################################################################################ +> +# +# generic stuff for 1d, cube, size=5 +# +> +> data_list_1d_size5 := map(data_var_name, posn_list_1d_size5, "data_"); + data_list_1d_size5 := ["data_m2", "data_m1", "data_0", "data_p1", "data_p2"] + +> coeffs_list_1d_size5 := map(coeff_name, posn_list_1d_size5, "coeff_"); +coeffs_list_1d_size5 := + + ["coeff_m2", "coeff_m1", "coeff_0", "coeff_p1", "coeff_p2"] + +> +> print_name_list_dcl(data_list_1d_size5, "fp", +> "1d.cube.size5/data-dcl.h"); +> print_name_list_dcl(coeffs_list_1d_size5, "fp", +> "1d.cube.size5/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_1d_size5, "data->data_", +> "1d.cube.size5/fetch-data.c"); +> print_evaluate_molecule(posn_list_1d_size5, +> "coeffs->coeff_", "data->data_", +> "1d.cube.size5/evaluate-molecule.c"); +> print_store_coeffs(posn_list_1d_size5, +> "factor * coeffs->coeff_", +> "1d.cube.size5/store-coeffs.c"); +> +################################################################################ +> +# +# generic stuff for 1d, cube, size=6 +# +> +> data_list_1d_size6 := map(data_var_name, posn_list_1d_size6, "data_"); +data_list_1d_size6 := + + ["data_m2", "data_m1", "data_0", "data_p1", "data_p2", "data_p3"] + +> coeffs_list_1d_size6 := map(coeff_name, posn_list_1d_size6, "coeff_"); +coeffs_list_1d_size6 := + + ["coeff_m2", "coeff_m1", "coeff_0", "coeff_p1", "coeff_p2", "coeff_p3"] + +> +> print_name_list_dcl(data_list_1d_size6, "fp", +> "1d.cube.size6/data-dcl.h"); +> print_name_list_dcl(coeffs_list_1d_size6, "fp", +> "1d.cube.size6/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_1d_size6, "data->data_", +> "1d.cube.size6/fetch-data.c"); +> print_evaluate_molecule(posn_list_1d_size6, +> "coeffs->coeff_", "data->data_", +> "1d.cube.size6/evaluate-molecule.c"); +> print_store_coeffs(posn_list_1d_size6, +> "factor * coeffs->coeff_", +> "1d.cube.size6/store-coeffs.c"); +> +################################################################################ +> +# +# generic stuff for 1d, cube, size=7 +# +> +> data_list_1d_size7 := map(data_var_name, posn_list_1d_size7, "data_"); +data_list_1d_size7 := [ + + "data_m3", "data_m2", "data_m1", "data_0", "data_p1", "data_p2", "data_p3"] + +> coeffs_list_1d_size7 := map(coeff_name, posn_list_1d_size7, "coeff_"); +coeffs_list_1d_size7 := ["coeff_m3", "coeff_m2", "coeff_m1", "coeff_0", + + "coeff_p1", "coeff_p2", "coeff_p3"] + +> +> print_name_list_dcl(data_list_1d_size7, "fp", +> "1d.cube.size7/data-dcl.h"); +> print_name_list_dcl(coeffs_list_1d_size7, "fp", +> "1d.cube.size7/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_1d_size7, "data->data_", +> "1d.cube.size7/fetch-data.c"); +> print_evaluate_molecule(posn_list_1d_size7, +> "coeffs->coeff_", "data->data_", +> "1d.cube.size7/evaluate-molecule.c"); +> print_store_coeffs(posn_list_1d_size7, +> "factor * coeffs->coeff_", +> "1d.cube.size7/store-coeffs.c"); +> +################################################################################ +> quit +bytes used=584788, alloc=589716, time=0.10 diff --git a/src/common/1d.maple b/src/common/1d.maple new file mode 100644 index 0000000..7c59834 --- /dev/null +++ b/src/common/1d.maple @@ -0,0 +1,142 @@ +# Maple code to compute common coefficients for all 1d interpolation schemes +# $Header$ + +################################################################################ + +# +# generic stuff for 1d, cube, size=2 +# + +data_list_1d_size2 := map(data_var_name, posn_list_1d_size2, "data_"); +coeffs_list_1d_size2 := map(coeff_name, posn_list_1d_size2, "coeff_"); + +print_name_list_dcl(data_list_1d_size2, "fp", + "1d.cube.size2/data-dcl.h"); +print_name_list_dcl(coeffs_list_1d_size2, "fp", + "1d.cube.size2/coeffs-dcl.h"); + +print_load_data(posn_list_1d_size2, "data->data_", + "1d.cube.size2/load-data.c"); +print_evaluate_molecule(posn_list_1d_size2, + "coeffs->coeff_", "data->data_", + "1d.cube.size2/evaluate-molecule.c"); +print_store_coeffs(posn_list_1d_size2, + "factor * coeffs->coeff_", + "1d.cube.size2/store-coeffs.c"); + +################################################################################ + +# +# generic stuff for 1d, cube, size=3 +# + +data_list_1d_size3 := map(data_var_name, posn_list_1d_size3, "data_"); +coeffs_list_1d_size3 := map(coeff_name, posn_list_1d_size3, "coeff_"); + +print_name_list_dcl(data_list_1d_size3, "fp", + "1d.cube.size3/data-dcl.h"); +print_name_list_dcl(coeffs_list_1d_size3, "fp", + "1d.cube.size3/coeffs-dcl.h"); + +print_load_data(posn_list_1d_size3, "data->data_", + "1d.cube.size3/load-data.c"); +print_evaluate_molecule(posn_list_1d_size3, + "coeffs->coeff_", "data->data_", + "1d.cube.size3/evaluate-molecule.c"); +print_store_coeffs(posn_list_1d_size3, + "factor * coeffs->coeff_", + "1d.cube.size3/store-coeffs.c"); + +################################################################################ + +# +# generic stuff for 1d, cube, size=4 +# + +data_list_1d_size4 := map(data_var_name, posn_list_1d_size4, "data_"); +coeffs_list_1d_size4 := map(coeff_name, posn_list_1d_size4, "coeff_"); + +print_name_list_dcl(data_list_1d_size4, "fp", + "1d.cube.size4/data-dcl.h"); +print_name_list_dcl(coeffs_list_1d_size4, "fp", + "1d.cube.size4/coeffs-dcl.h"); + +print_load_data(posn_list_1d_size4, "data->data_", + "1d.cube.size4/load-data.c"); +print_evaluate_molecule(posn_list_1d_size4, + "coeffs->coeff_", "data->data_", + "1d.cube.size4/evaluate-molecule.c"); +print_store_coeffs(posn_list_1d_size4, + "factor * coeffs->coeff_", + "1d.cube.size4/store-coeffs.c"); + +################################################################################ + +# +# generic stuff for 1d, cube, size=5 +# + +data_list_1d_size5 := map(data_var_name, posn_list_1d_size5, "data_"); +coeffs_list_1d_size5 := map(coeff_name, posn_list_1d_size5, "coeff_"); + +print_name_list_dcl(data_list_1d_size5, "fp", + "1d.cube.size5/data-dcl.h"); +print_name_list_dcl(coeffs_list_1d_size5, "fp", + "1d.cube.size5/coeffs-dcl.h"); + +print_load_data(posn_list_1d_size5, "data->data_", + "1d.cube.size5/load-data.c"); +print_evaluate_molecule(posn_list_1d_size5, + "coeffs->coeff_", "data->data_", + "1d.cube.size5/evaluate-molecule.c"); +print_store_coeffs(posn_list_1d_size5, + "factor * coeffs->coeff_", + "1d.cube.size5/store-coeffs.c"); + +################################################################################ + +# +# generic stuff for 1d, cube, size=6 +# + +data_list_1d_size6 := map(data_var_name, posn_list_1d_size6, "data_"); +coeffs_list_1d_size6 := map(coeff_name, posn_list_1d_size6, "coeff_"); + +print_name_list_dcl(data_list_1d_size6, "fp", + "1d.cube.size6/data-dcl.h"); +print_name_list_dcl(coeffs_list_1d_size6, "fp", + "1d.cube.size6/coeffs-dcl.h"); + +print_load_data(posn_list_1d_size6, "data->data_", + "1d.cube.size6/load-data.c"); +print_evaluate_molecule(posn_list_1d_size6, + "coeffs->coeff_", "data->data_", + "1d.cube.size6/evaluate-molecule.c"); +print_store_coeffs(posn_list_1d_size6, + "factor * coeffs->coeff_", + "1d.cube.size6/store-coeffs.c"); + +################################################################################ + +# +# generic stuff for 1d, cube, size=7 +# + +data_list_1d_size7 := map(data_var_name, posn_list_1d_size7, "data_"); +coeffs_list_1d_size7 := map(coeff_name, posn_list_1d_size7, "coeff_"); + +print_name_list_dcl(data_list_1d_size7, "fp", + "1d.cube.size7/data-dcl.h"); +print_name_list_dcl(coeffs_list_1d_size7, "fp", + "1d.cube.size7/coeffs-dcl.h"); + +print_load_data(posn_list_1d_size7, "data->data_", + "1d.cube.size7/load-data.c"); +print_evaluate_molecule(posn_list_1d_size7, + "coeffs->coeff_", "data->data_", + "1d.cube.size7/evaluate-molecule.c"); +print_store_coeffs(posn_list_1d_size7, + "factor * coeffs->coeff_", + "1d.cube.size7/store-coeffs.c"); + +################################################################################ diff --git a/src/common/2d.cube.size2/coeffs-dcl.h b/src/common/2d.cube.size2/coeffs-dcl.h new file mode 100644 index 0000000..c52e5c6 --- /dev/null +++ b/src/common/2d.cube.size2/coeffs-dcl.h @@ -0,0 +1,4 @@ +fp coeff_0_0; +fp coeff_p1_0; +fp coeff_0_p1; +fp coeff_p1_p1; diff --git a/src/common/2d.cube.size2/data-dcl.h b/src/common/2d.cube.size2/data-dcl.h new file mode 100644 index 0000000..b6bbee6 --- /dev/null +++ b/src/common/2d.cube.size2/data-dcl.h @@ -0,0 +1,4 @@ +fp data_0_0; +fp data_p1_0; +fp data_0_p1; +fp data_p1_p1; diff --git a/src/common/2d.cube.size2/evaluate-molecule.c b/src/common/2d.cube.size2/evaluate-molecule.c new file mode 100644 index 0000000..a4232ef --- /dev/null +++ b/src/common/2d.cube.size2/evaluate-molecule.c @@ -0,0 +1,4 @@ + coeffs->coeff_0_0*data->data_0_0 + + coeffs->coeff_p1_0*data->data_p1_0 + + coeffs->coeff_0_p1*data->data_0_p1 + + coeffs->coeff_p1_p1*data->data_p1_p1; diff --git a/src/common/2d.cube.size2/load-data.c b/src/common/2d.cube.size2/load-data.c new file mode 100644 index 0000000..dfc6c80 --- /dev/null +++ b/src/common/2d.cube.size2/load-data.c @@ -0,0 +1,4 @@ +data->data_0_0 = DATA(0,0); +data->data_p1_0 = DATA(1,0); +data->data_0_p1 = DATA(0,1); +data->data_p1_p1 = DATA(1,1); diff --git a/src/common/2d.cube.size2/store-coeffs.c b/src/common/2d.cube.size2/store-coeffs.c new file mode 100644 index 0000000..1415ab1 --- /dev/null +++ b/src/common/2d.cube.size2/store-coeffs.c @@ -0,0 +1,4 @@ +COEFF(0,0) = factor * coeffs->coeff_0_0; +COEFF(1,0) = factor * coeffs->coeff_p1_0; +COEFF(0,1) = factor * coeffs->coeff_0_p1; +COEFF(1,1) = factor * coeffs->coeff_p1_p1; diff --git a/src/common/2d.cube.size3/coeffs-dcl.h b/src/common/2d.cube.size3/coeffs-dcl.h new file mode 100644 index 0000000..1dfb73d --- /dev/null +++ b/src/common/2d.cube.size3/coeffs-dcl.h @@ -0,0 +1,9 @@ +fp coeff_m1_m1; +fp coeff_0_m1; +fp coeff_p1_m1; +fp coeff_m1_0; +fp coeff_0_0; +fp coeff_p1_0; +fp coeff_m1_p1; +fp coeff_0_p1; +fp coeff_p1_p1; diff --git a/src/common/2d.cube.size3/data-dcl.h b/src/common/2d.cube.size3/data-dcl.h new file mode 100644 index 0000000..22dca3b --- /dev/null +++ b/src/common/2d.cube.size3/data-dcl.h @@ -0,0 +1,9 @@ +fp data_m1_m1; +fp data_0_m1; +fp data_p1_m1; +fp data_m1_0; +fp data_0_0; +fp data_p1_0; +fp data_m1_p1; +fp data_0_p1; +fp data_p1_p1; diff --git a/src/common/2d.cube.size3/evaluate-molecule.c b/src/common/2d.cube.size3/evaluate-molecule.c new file mode 100644 index 0000000..b4d0c00 --- /dev/null +++ b/src/common/2d.cube.size3/evaluate-molecule.c @@ -0,0 +1,9 @@ + coeffs->coeff_m1_m1*data->data_m1_m1 + + coeffs->coeff_0_m1*data->data_0_m1 + + coeffs->coeff_p1_m1*data->data_p1_m1 + + coeffs->coeff_m1_0*data->data_m1_0 + + coeffs->coeff_0_0*data->data_0_0 + + coeffs->coeff_p1_0*data->data_p1_0 + + coeffs->coeff_m1_p1*data->data_m1_p1 + + coeffs->coeff_0_p1*data->data_0_p1 + + coeffs->coeff_p1_p1*data->data_p1_p1; diff --git a/src/common/2d.cube.size3/load-data.c b/src/common/2d.cube.size3/load-data.c new file mode 100644 index 0000000..62725c2 --- /dev/null +++ b/src/common/2d.cube.size3/load-data.c @@ -0,0 +1,9 @@ +data->data_m1_m1 = DATA(-1,-1); +data->data_0_m1 = DATA(0,-1); +data->data_p1_m1 = DATA(1,-1); +data->data_m1_0 = DATA(-1,0); +data->data_0_0 = DATA(0,0); +data->data_p1_0 = DATA(1,0); +data->data_m1_p1 = DATA(-1,1); +data->data_0_p1 = DATA(0,1); +data->data_p1_p1 = DATA(1,1); diff --git a/src/common/2d.cube.size3/store-coeffs.c b/src/common/2d.cube.size3/store-coeffs.c new file mode 100644 index 0000000..2226970 --- /dev/null +++ b/src/common/2d.cube.size3/store-coeffs.c @@ -0,0 +1,9 @@ +COEFF(-1,-1) = factor * coeffs->coeff_m1_m1; +COEFF(0,-1) = factor * coeffs->coeff_0_m1; +COEFF(1,-1) = factor * coeffs->coeff_p1_m1; +COEFF(-1,0) = factor * coeffs->coeff_m1_0; +COEFF(0,0) = factor * coeffs->coeff_0_0; +COEFF(1,0) = factor * coeffs->coeff_p1_0; +COEFF(-1,1) = factor * coeffs->coeff_m1_p1; +COEFF(0,1) = factor * coeffs->coeff_0_p1; +COEFF(1,1) = factor * coeffs->coeff_p1_p1; diff --git a/src/common/2d.cube.size4/coeffs-dcl.h b/src/common/2d.cube.size4/coeffs-dcl.h new file mode 100644 index 0000000..beb0825 --- /dev/null +++ b/src/common/2d.cube.size4/coeffs-dcl.h @@ -0,0 +1,16 @@ +fp coeff_m1_m1; +fp coeff_0_m1; +fp coeff_p1_m1; +fp coeff_p2_m1; +fp coeff_m1_0; +fp coeff_0_0; +fp coeff_p1_0; +fp coeff_p2_0; +fp coeff_m1_p1; +fp coeff_0_p1; +fp coeff_p1_p1; +fp coeff_p2_p1; +fp coeff_m1_p2; +fp coeff_0_p2; +fp coeff_p1_p2; +fp coeff_p2_p2; diff --git a/src/common/2d.cube.size4/data-dcl.h b/src/common/2d.cube.size4/data-dcl.h new file mode 100644 index 0000000..a55365f --- /dev/null +++ b/src/common/2d.cube.size4/data-dcl.h @@ -0,0 +1,16 @@ +fp data_m1_m1; +fp data_0_m1; +fp data_p1_m1; +fp data_p2_m1; +fp data_m1_0; +fp data_0_0; +fp data_p1_0; +fp data_p2_0; +fp data_m1_p1; +fp data_0_p1; +fp data_p1_p1; +fp data_p2_p1; +fp data_m1_p2; +fp data_0_p2; +fp data_p1_p2; +fp data_p2_p2; diff --git a/src/common/2d.cube.size4/evaluate-molecule.c b/src/common/2d.cube.size4/evaluate-molecule.c new file mode 100644 index 0000000..03e306b --- /dev/null +++ b/src/common/2d.cube.size4/evaluate-molecule.c @@ -0,0 +1,16 @@ + coeffs->coeff_m1_m1*data->data_m1_m1 + + coeffs->coeff_0_m1*data->data_0_m1 + + coeffs->coeff_p1_m1*data->data_p1_m1 + + coeffs->coeff_p2_m1*data->data_p2_m1 + + coeffs->coeff_m1_0*data->data_m1_0 + + coeffs->coeff_0_0*data->data_0_0 + + coeffs->coeff_p1_0*data->data_p1_0 + + coeffs->coeff_p2_0*data->data_p2_0 + + coeffs->coeff_m1_p1*data->data_m1_p1 + + coeffs->coeff_0_p1*data->data_0_p1 + + coeffs->coeff_p1_p1*data->data_p1_p1 + + coeffs->coeff_p2_p1*data->data_p2_p1 + + coeffs->coeff_m1_p2*data->data_m1_p2 + + coeffs->coeff_0_p2*data->data_0_p2 + + coeffs->coeff_p1_p2*data->data_p1_p2 + + coeffs->coeff_p2_p2*data->data_p2_p2; diff --git a/src/common/2d.cube.size4/load-data.c b/src/common/2d.cube.size4/load-data.c new file mode 100644 index 0000000..ee17aca --- /dev/null +++ b/src/common/2d.cube.size4/load-data.c @@ -0,0 +1,16 @@ +data->data_m1_m1 = DATA(-1,-1); +data->data_0_m1 = DATA(0,-1); +data->data_p1_m1 = DATA(1,-1); +data->data_p2_m1 = DATA(2,-1); +data->data_m1_0 = DATA(-1,0); +data->data_0_0 = DATA(0,0); +data->data_p1_0 = DATA(1,0); +data->data_p2_0 = DATA(2,0); +data->data_m1_p1 = DATA(-1,1); +data->data_0_p1 = DATA(0,1); +data->data_p1_p1 = DATA(1,1); +data->data_p2_p1 = DATA(2,1); +data->data_m1_p2 = DATA(-1,2); +data->data_0_p2 = DATA(0,2); +data->data_p1_p2 = DATA(1,2); +data->data_p2_p2 = DATA(2,2); diff --git a/src/common/2d.cube.size4/store-coeffs.c b/src/common/2d.cube.size4/store-coeffs.c new file mode 100644 index 0000000..804500c --- /dev/null +++ b/src/common/2d.cube.size4/store-coeffs.c @@ -0,0 +1,16 @@ +COEFF(-1,-1) = factor * coeffs->coeff_m1_m1; +COEFF(0,-1) = factor * coeffs->coeff_0_m1; +COEFF(1,-1) = factor * coeffs->coeff_p1_m1; +COEFF(2,-1) = factor * coeffs->coeff_p2_m1; +COEFF(-1,0) = factor * coeffs->coeff_m1_0; +COEFF(0,0) = factor * coeffs->coeff_0_0; +COEFF(1,0) = factor * coeffs->coeff_p1_0; +COEFF(2,0) = factor * coeffs->coeff_p2_0; +COEFF(-1,1) = factor * coeffs->coeff_m1_p1; +COEFF(0,1) = factor * coeffs->coeff_0_p1; +COEFF(1,1) = factor * coeffs->coeff_p1_p1; +COEFF(2,1) = factor * coeffs->coeff_p2_p1; +COEFF(-1,2) = factor * coeffs->coeff_m1_p2; +COEFF(0,2) = factor * coeffs->coeff_0_p2; +COEFF(1,2) = factor * coeffs->coeff_p1_p2; +COEFF(2,2) = factor * coeffs->coeff_p2_p2; diff --git a/src/common/2d.cube.size5/coeffs-dcl.h b/src/common/2d.cube.size5/coeffs-dcl.h new file mode 100644 index 0000000..938560f --- /dev/null +++ b/src/common/2d.cube.size5/coeffs-dcl.h @@ -0,0 +1,25 @@ +fp coeff_m2_m2; +fp coeff_m1_m2; +fp coeff_0_m2; +fp coeff_p1_m2; +fp coeff_p2_m2; +fp coeff_m2_m1; +fp coeff_m1_m1; +fp coeff_0_m1; +fp coeff_p1_m1; +fp coeff_p2_m1; +fp coeff_m2_0; +fp coeff_m1_0; +fp coeff_0_0; +fp coeff_p1_0; +fp coeff_p2_0; +fp coeff_m2_p1; +fp coeff_m1_p1; +fp coeff_0_p1; +fp coeff_p1_p1; +fp coeff_p2_p1; +fp coeff_m2_p2; +fp coeff_m1_p2; +fp coeff_0_p2; +fp coeff_p1_p2; +fp coeff_p2_p2; diff --git a/src/common/2d.cube.size5/data-dcl.h b/src/common/2d.cube.size5/data-dcl.h new file mode 100644 index 0000000..1e44205 --- /dev/null +++ b/src/common/2d.cube.size5/data-dcl.h @@ -0,0 +1,25 @@ +fp data_m2_m2; +fp data_m1_m2; +fp data_0_m2; +fp data_p1_m2; +fp data_p2_m2; +fp data_m2_m1; +fp data_m1_m1; +fp data_0_m1; +fp data_p1_m1; +fp data_p2_m1; +fp data_m2_0; +fp data_m1_0; +fp data_0_0; +fp data_p1_0; +fp data_p2_0; +fp data_m2_p1; +fp data_m1_p1; +fp data_0_p1; +fp data_p1_p1; +fp data_p2_p1; +fp data_m2_p2; +fp data_m1_p2; +fp data_0_p2; +fp data_p1_p2; +fp data_p2_p2; diff --git a/src/common/2d.cube.size5/evaluate-molecule.c b/src/common/2d.cube.size5/evaluate-molecule.c new file mode 100644 index 0000000..56cf50d --- /dev/null +++ b/src/common/2d.cube.size5/evaluate-molecule.c @@ -0,0 +1,25 @@ + coeffs->coeff_m2_m2*data->data_m2_m2 + + coeffs->coeff_m1_m2*data->data_m1_m2 + + coeffs->coeff_0_m2*data->data_0_m2 + + coeffs->coeff_p1_m2*data->data_p1_m2 + + coeffs->coeff_p2_m2*data->data_p2_m2 + + coeffs->coeff_m2_m1*data->data_m2_m1 + + coeffs->coeff_m1_m1*data->data_m1_m1 + + coeffs->coeff_0_m1*data->data_0_m1 + + coeffs->coeff_p1_m1*data->data_p1_m1 + + coeffs->coeff_p2_m1*data->data_p2_m1 + + coeffs->coeff_m2_0*data->data_m2_0 + + coeffs->coeff_m1_0*data->data_m1_0 + + coeffs->coeff_0_0*data->data_0_0 + + coeffs->coeff_p1_0*data->data_p1_0 + + coeffs->coeff_p2_0*data->data_p2_0 + + coeffs->coeff_m2_p1*data->data_m2_p1 + + coeffs->coeff_m1_p1*data->data_m1_p1 + + coeffs->coeff_0_p1*data->data_0_p1 + + coeffs->coeff_p1_p1*data->data_p1_p1 + + coeffs->coeff_p2_p1*data->data_p2_p1 + + coeffs->coeff_m2_p2*data->data_m2_p2 + + coeffs->coeff_m1_p2*data->data_m1_p2 + + coeffs->coeff_0_p2*data->data_0_p2 + + coeffs->coeff_p1_p2*data->data_p1_p2 + + coeffs->coeff_p2_p2*data->data_p2_p2; diff --git a/src/common/2d.cube.size5/load-data.c b/src/common/2d.cube.size5/load-data.c new file mode 100644 index 0000000..57bcf0e --- /dev/null +++ b/src/common/2d.cube.size5/load-data.c @@ -0,0 +1,25 @@ +data->data_m2_m2 = DATA(-2,-2); +data->data_m1_m2 = DATA(-1,-2); +data->data_0_m2 = DATA(0,-2); +data->data_p1_m2 = DATA(1,-2); +data->data_p2_m2 = DATA(2,-2); +data->data_m2_m1 = DATA(-2,-1); +data->data_m1_m1 = DATA(-1,-1); +data->data_0_m1 = DATA(0,-1); +data->data_p1_m1 = DATA(1,-1); +data->data_p2_m1 = DATA(2,-1); +data->data_m2_0 = DATA(-2,0); +data->data_m1_0 = DATA(-1,0); +data->data_0_0 = DATA(0,0); +data->data_p1_0 = DATA(1,0); +data->data_p2_0 = DATA(2,0); +data->data_m2_p1 = DATA(-2,1); +data->data_m1_p1 = DATA(-1,1); +data->data_0_p1 = DATA(0,1); +data->data_p1_p1 = DATA(1,1); +data->data_p2_p1 = DATA(2,1); +data->data_m2_p2 = DATA(-2,2); +data->data_m1_p2 = DATA(-1,2); +data->data_0_p2 = DATA(0,2); +data->data_p1_p2 = DATA(1,2); +data->data_p2_p2 = DATA(2,2); diff --git a/src/common/2d.cube.size5/store-coeffs.c b/src/common/2d.cube.size5/store-coeffs.c new file mode 100644 index 0000000..aef1c88 --- /dev/null +++ b/src/common/2d.cube.size5/store-coeffs.c @@ -0,0 +1,25 @@ +COEFF(-2,-2) = factor * coeffs->coeff_m2_m2; +COEFF(-1,-2) = factor * coeffs->coeff_m1_m2; +COEFF(0,-2) = factor * coeffs->coeff_0_m2; +COEFF(1,-2) = factor * coeffs->coeff_p1_m2; +COEFF(2,-2) = factor * coeffs->coeff_p2_m2; +COEFF(-2,-1) = factor * coeffs->coeff_m2_m1; +COEFF(-1,-1) = factor * coeffs->coeff_m1_m1; +COEFF(0,-1) = factor * coeffs->coeff_0_m1; +COEFF(1,-1) = factor * coeffs->coeff_p1_m1; +COEFF(2,-1) = factor * coeffs->coeff_p2_m1; +COEFF(-2,0) = factor * coeffs->coeff_m2_0; +COEFF(-1,0) = factor * coeffs->coeff_m1_0; +COEFF(0,0) = factor * coeffs->coeff_0_0; +COEFF(1,0) = factor * coeffs->coeff_p1_0; +COEFF(2,0) = factor * coeffs->coeff_p2_0; +COEFF(-2,1) = factor * coeffs->coeff_m2_p1; +COEFF(-1,1) = factor * coeffs->coeff_m1_p1; +COEFF(0,1) = factor * coeffs->coeff_0_p1; +COEFF(1,1) = factor * coeffs->coeff_p1_p1; +COEFF(2,1) = factor * coeffs->coeff_p2_p1; +COEFF(-2,2) = factor * coeffs->coeff_m2_p2; +COEFF(-1,2) = factor * coeffs->coeff_m1_p2; +COEFF(0,2) = factor * coeffs->coeff_0_p2; +COEFF(1,2) = factor * coeffs->coeff_p1_p2; +COEFF(2,2) = factor * coeffs->coeff_p2_p2; diff --git a/src/common/2d.cube.size6/coeffs-dcl.h b/src/common/2d.cube.size6/coeffs-dcl.h new file mode 100644 index 0000000..4c4a072 --- /dev/null +++ b/src/common/2d.cube.size6/coeffs-dcl.h @@ -0,0 +1,36 @@ +fp coeff_m2_m2; +fp coeff_m1_m2; +fp coeff_0_m2; +fp coeff_p1_m2; +fp coeff_p2_m2; +fp coeff_p3_m2; +fp coeff_m2_m1; +fp coeff_m1_m1; +fp coeff_0_m1; +fp coeff_p1_m1; +fp coeff_p2_m1; +fp coeff_p3_m1; +fp coeff_m2_0; +fp coeff_m1_0; +fp coeff_0_0; +fp coeff_p1_0; +fp coeff_p2_0; +fp coeff_p3_0; +fp coeff_m2_p1; +fp coeff_m1_p1; +fp coeff_0_p1; +fp coeff_p1_p1; +fp coeff_p2_p1; +fp coeff_p3_p1; +fp coeff_m2_p2; +fp coeff_m1_p2; +fp coeff_0_p2; +fp coeff_p1_p2; +fp coeff_p2_p2; +fp coeff_p3_p2; +fp coeff_m2_p3; +fp coeff_m1_p3; +fp coeff_0_p3; +fp coeff_p1_p3; +fp coeff_p2_p3; +fp coeff_p3_p3; diff --git a/src/common/2d.cube.size6/data-dcl.h b/src/common/2d.cube.size6/data-dcl.h new file mode 100644 index 0000000..ba435b4 --- /dev/null +++ b/src/common/2d.cube.size6/data-dcl.h @@ -0,0 +1,36 @@ +fp data_m2_m2; +fp data_m1_m2; +fp data_0_m2; +fp data_p1_m2; +fp data_p2_m2; +fp data_p3_m2; +fp data_m2_m1; +fp data_m1_m1; +fp data_0_m1; +fp data_p1_m1; +fp data_p2_m1; +fp data_p3_m1; +fp data_m2_0; +fp data_m1_0; +fp data_0_0; +fp data_p1_0; +fp data_p2_0; +fp data_p3_0; +fp data_m2_p1; +fp data_m1_p1; +fp data_0_p1; +fp data_p1_p1; +fp data_p2_p1; +fp data_p3_p1; +fp data_m2_p2; +fp data_m1_p2; +fp data_0_p2; +fp data_p1_p2; +fp data_p2_p2; +fp data_p3_p2; +fp data_m2_p3; +fp data_m1_p3; +fp data_0_p3; +fp data_p1_p3; +fp data_p2_p3; +fp data_p3_p3; diff --git a/src/common/2d.cube.size6/evaluate-molecule.c b/src/common/2d.cube.size6/evaluate-molecule.c new file mode 100644 index 0000000..df0bde1 --- /dev/null +++ b/src/common/2d.cube.size6/evaluate-molecule.c @@ -0,0 +1,36 @@ + coeffs->coeff_m2_m2*data->data_m2_m2 + + coeffs->coeff_m1_m2*data->data_m1_m2 + + coeffs->coeff_0_m2*data->data_0_m2 + + coeffs->coeff_p1_m2*data->data_p1_m2 + + coeffs->coeff_p2_m2*data->data_p2_m2 + + coeffs->coeff_p3_m2*data->data_p3_m2 + + coeffs->coeff_m2_m1*data->data_m2_m1 + + coeffs->coeff_m1_m1*data->data_m1_m1 + + coeffs->coeff_0_m1*data->data_0_m1 + + coeffs->coeff_p1_m1*data->data_p1_m1 + + coeffs->coeff_p2_m1*data->data_p2_m1 + + coeffs->coeff_p3_m1*data->data_p3_m1 + + coeffs->coeff_m2_0*data->data_m2_0 + + coeffs->coeff_m1_0*data->data_m1_0 + + coeffs->coeff_0_0*data->data_0_0 + + coeffs->coeff_p1_0*data->data_p1_0 + + coeffs->coeff_p2_0*data->data_p2_0 + + coeffs->coeff_p3_0*data->data_p3_0 + + coeffs->coeff_m2_p1*data->data_m2_p1 + + coeffs->coeff_m1_p1*data->data_m1_p1 + + coeffs->coeff_0_p1*data->data_0_p1 + + coeffs->coeff_p1_p1*data->data_p1_p1 + + coeffs->coeff_p2_p1*data->data_p2_p1 + + coeffs->coeff_p3_p1*data->data_p3_p1 + + coeffs->coeff_m2_p2*data->data_m2_p2 + + coeffs->coeff_m1_p2*data->data_m1_p2 + + coeffs->coeff_0_p2*data->data_0_p2 + + coeffs->coeff_p1_p2*data->data_p1_p2 + + coeffs->coeff_p2_p2*data->data_p2_p2 + + coeffs->coeff_p3_p2*data->data_p3_p2 + + coeffs->coeff_m2_p3*data->data_m2_p3 + + coeffs->coeff_m1_p3*data->data_m1_p3 + + coeffs->coeff_0_p3*data->data_0_p3 + + coeffs->coeff_p1_p3*data->data_p1_p3 + + coeffs->coeff_p2_p3*data->data_p2_p3 + + coeffs->coeff_p3_p3*data->data_p3_p3; diff --git a/src/common/2d.cube.size6/load-data.c b/src/common/2d.cube.size6/load-data.c new file mode 100644 index 0000000..fc23eb3 --- /dev/null +++ b/src/common/2d.cube.size6/load-data.c @@ -0,0 +1,36 @@ +data->data_m2_m2 = DATA(-2,-2); +data->data_m1_m2 = DATA(-1,-2); +data->data_0_m2 = DATA(0,-2); +data->data_p1_m2 = DATA(1,-2); +data->data_p2_m2 = DATA(2,-2); +data->data_p3_m2 = DATA(3,-2); +data->data_m2_m1 = DATA(-2,-1); +data->data_m1_m1 = DATA(-1,-1); +data->data_0_m1 = DATA(0,-1); +data->data_p1_m1 = DATA(1,-1); +data->data_p2_m1 = DATA(2,-1); +data->data_p3_m1 = DATA(3,-1); +data->data_m2_0 = DATA(-2,0); +data->data_m1_0 = DATA(-1,0); +data->data_0_0 = DATA(0,0); +data->data_p1_0 = DATA(1,0); +data->data_p2_0 = DATA(2,0); +data->data_p3_0 = DATA(3,0); +data->data_m2_p1 = DATA(-2,1); +data->data_m1_p1 = DATA(-1,1); +data->data_0_p1 = DATA(0,1); +data->data_p1_p1 = DATA(1,1); +data->data_p2_p1 = DATA(2,1); +data->data_p3_p1 = DATA(3,1); +data->data_m2_p2 = DATA(-2,2); +data->data_m1_p2 = DATA(-1,2); +data->data_0_p2 = DATA(0,2); +data->data_p1_p2 = DATA(1,2); +data->data_p2_p2 = DATA(2,2); +data->data_p3_p2 = DATA(3,2); +data->data_m2_p3 = DATA(-2,3); +data->data_m1_p3 = DATA(-1,3); +data->data_0_p3 = DATA(0,3); +data->data_p1_p3 = DATA(1,3); +data->data_p2_p3 = DATA(2,3); +data->data_p3_p3 = DATA(3,3); diff --git a/src/common/2d.cube.size6/store-coeffs.c b/src/common/2d.cube.size6/store-coeffs.c new file mode 100644 index 0000000..235f10c --- /dev/null +++ b/src/common/2d.cube.size6/store-coeffs.c @@ -0,0 +1,36 @@ +COEFF(-2,-2) = factor * coeffs->coeff_m2_m2; +COEFF(-1,-2) = factor * coeffs->coeff_m1_m2; +COEFF(0,-2) = factor * coeffs->coeff_0_m2; +COEFF(1,-2) = factor * coeffs->coeff_p1_m2; +COEFF(2,-2) = factor * coeffs->coeff_p2_m2; +COEFF(3,-2) = factor * coeffs->coeff_p3_m2; +COEFF(-2,-1) = factor * coeffs->coeff_m2_m1; +COEFF(-1,-1) = factor * coeffs->coeff_m1_m1; +COEFF(0,-1) = factor * coeffs->coeff_0_m1; +COEFF(1,-1) = factor * coeffs->coeff_p1_m1; +COEFF(2,-1) = factor * coeffs->coeff_p2_m1; +COEFF(3,-1) = factor * coeffs->coeff_p3_m1; +COEFF(-2,0) = factor * coeffs->coeff_m2_0; +COEFF(-1,0) = factor * coeffs->coeff_m1_0; +COEFF(0,0) = factor * coeffs->coeff_0_0; +COEFF(1,0) = factor * coeffs->coeff_p1_0; +COEFF(2,0) = factor * coeffs->coeff_p2_0; +COEFF(3,0) = factor * coeffs->coeff_p3_0; +COEFF(-2,1) = factor * coeffs->coeff_m2_p1; +COEFF(-1,1) = factor * coeffs->coeff_m1_p1; +COEFF(0,1) = factor * coeffs->coeff_0_p1; +COEFF(1,1) = factor * coeffs->coeff_p1_p1; +COEFF(2,1) = factor * coeffs->coeff_p2_p1; +COEFF(3,1) = factor * coeffs->coeff_p3_p1; +COEFF(-2,2) = factor * coeffs->coeff_m2_p2; +COEFF(-1,2) = factor * coeffs->coeff_m1_p2; +COEFF(0,2) = factor * coeffs->coeff_0_p2; +COEFF(1,2) = factor * coeffs->coeff_p1_p2; +COEFF(2,2) = factor * coeffs->coeff_p2_p2; +COEFF(3,2) = factor * coeffs->coeff_p3_p2; +COEFF(-2,3) = factor * coeffs->coeff_m2_p3; +COEFF(-1,3) = factor * coeffs->coeff_m1_p3; +COEFF(0,3) = factor * coeffs->coeff_0_p3; +COEFF(1,3) = factor * coeffs->coeff_p1_p3; +COEFF(2,3) = factor * coeffs->coeff_p2_p3; +COEFF(3,3) = factor * coeffs->coeff_p3_p3; diff --git a/src/common/2d.log b/src/common/2d.log new file mode 100644 index 0000000..fb77538 --- /dev/null +++ b/src/common/2d.log @@ -0,0 +1,1521 @@ + |\^/| Maple 7 (IBM INTEL LINUX) +._|\| |/|_. Copyright (c) 2001 by Waterloo Maple Inc. + \ MAPLE / All rights reserved. Maple is a registered trademark of + <____ ____> Waterloo Maple Inc. + | Type ? for help. +# util.maple -- misc utility routines +# $Header$ +> +# +# fix_rationals - convert numbers to RATIONAL() calls +# nonmatching_names - find names in a list which *don't* have a specified prefix +# sprint_numeric_list - convert a numeric list to a valid C identifier suffix +# print_name_list_dcl - print C declarations for a list of names +# +# hypercube_points - compute all (integer) points in an N-dimensional hypercube +# +# ftruncate - truncate a file to zero length +# +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function converts all {integer, rational} subexpressions of its +# input except integer exponents and -1 factors in products, into function +# calls +# RATIONAL(num,den) +# This is useful in conjunction with the C() library function, since +# +# C( (1/3) * foo * bar ) +# t0 = foo*bar/3; +# +# generates a (slow) division (and runs the risk of mixed-mode-arithmetic +# problems), while +# +# C((1.0/3.0) * foo * bar); +# t0 = 0.3333333333*foo*bar; +# +# suffers from roundoff error. With this function, +# +# fix_rationals((1/3) * foo * bar); +# RATIONAL(1,3) foo bar +# C(%); +# t0 = RATIONAL(1.0,3.0)*foo*bar; +# +# which a C preprocessor macro can easily convert to the desired +# +# t0 = (1.0/3.0)*foo*bar; +# +# Additionally, this function can be told to leave certain types of +# subexpressions unconverged. For example, +# fix_rationals(expr, type, specfunc(integer, DATA)); +# will leave all subexpressions of the form DATA(integer arguments) +# unconverted. +# +# Arguments: +# expr = (in) The expression to be converted. +# inert_fn = (optional in) +# If specified, this argument should be a Boolean procedure +# or the name of a Boolean procedure. This procedure should +# take one or more argument, and return true if and only if +# the first argument should *not* be converted, i.e. if we +# should leave this expression unchanged. See the last +# example above. +# ... = (optional in) +# Any further arguments are passed as additional arguments to +# the inert_fn procedure. +# +> fix_rationals := +> proc( +> expr::{ +> algebraic, name = algebraic, +> list({algebraic, name = algebraic}), +> set ({algebraic, name = algebraic}) +> }, +> inert_fn::{name, procedure} +> ) +> local nn, k, +> base, power, fbase, fpower, +> fn, fn_args_list, +> num, den, mult; +> +# do we want to convert this expression? +> if ((nargs >= 2) and inert_fn(expr, args[3..nargs])) +> then return expr; +> end if; +> +# recurse over lists and sets +> if (type(expr, {list,set})) +> then return map(fix_rationals, expr, args[2..nargs]); +> end if; +> +# recurse over equation right hand sides +> if (type(expr, name = algebraic)) +> then return ( lhs(expr) = fix_rationals(rhs(expr), args[2..nargs]) ); +> end if; +> +# recurse over functions other than RATIONAL() +> if (type(expr, function)) +> then +> fn := op(0, expr); +> if (fn <> 'RATIONAL') +> then +> fn_args_list := [op(expr)]; +> fn_args_list := map(fix_rationals, fn_args_list, args[2..nargs]); +> fn; return '%'( op(fn_args_list) ); +> end if; +> end if; +> +> nn := nops(expr); +> +# recurse over sums +> if (type(expr, `+`)) +> then return sum('fix_rationals(op(k,expr), args[2..nargs])', 'k'=1..nn); +> end if; +> +# recurse over products +# ... leaving leading -1 factors intact, i.e. not converted to RATIONAL(-1,1) +> if (type(expr, `*`)) +> then +> if (op(1, expr) = -1) +> then return -1*fix_rationals(remove(type, expr, 'identical(-1)'), +> args[2..nargs]); +> else return product('fix_rationals(op(k,expr), args[2..nargs])', +> 'k'=1..nn); +> end if; +> end if; +> +# recurse over powers +# ... leaving integer exponents intact +> if (type(expr, `^`)) +> then +> base := op(1, expr); +> power := op(2, expr); +> +> fbase := fix_rationals(base, args[2..nargs]); +> if (type(power, integer)) +> then fpower := power; +> else fpower := fix_rationals(power, args[2..nargs]); +> end if; +> return fbase ^ fpower; +> end if; +> +# fix integers and fractions +> if (type(expr, integer)) +> then return 'RATIONAL'(expr, 1); +> end if; +> if (type(expr, fraction)) +> then +> num := op(1, expr); +> den := op(2, expr); +> +> return 'RATIONAL'(num, den); +> end if; +> +# turn Maple floating-point into integer fraction, then recursively fix that +> if (type(expr, float)) +> then +> mult := op(1, expr); +> power := op(2, expr); +> return fix_rationals(mult * 10^power, args[2..nargs]); +> end if; +> +# identity op on names +> if (type(expr, name)) +> then return expr; +> end if; +> +# unknown type +> error "%0", +> "unknown type for expr!", +> " whattype(expr) = ", whattype(expr), +> " expr = ", expr; +> end proc; +fix_rationals := proc(expr::{algebraic, name = algebraic, +list({algebraic, name = algebraic}), set({algebraic, name = algebraic})}, +inert_fn::{procedure, name}) +local nn, k, base, power, fbase, fpower, fn, fn_args_list, num, den, mult; + if 2 <= nargs and inert_fn(expr, args[3 .. nargs]) then return expr + end if; + if type(expr, {set, list}) then + return map(fix_rationals, expr, args[2 .. nargs]) + end if; + if type(expr, name = algebraic) then + return lhs(expr) = fix_rationals(rhs(expr), args[2 .. nargs]) + end if; + if type(expr, function) then + fn := op(0, expr); + if fn <> 'RATIONAL' then + fn_args_list := [op(expr)]; + fn_args_list := + map(fix_rationals, fn_args_list, args[2 .. nargs]); + fn; + return '%'(op(fn_args_list)) + end if + end if; + nn := nops(expr); + if type(expr, `+`) then return + sum('fix_rationals(op(k, expr), args[2 .. nargs])', 'k' = 1 .. nn) + end if; + if type(expr, `*`) then + if op(1, expr) = -1 then return -fix_rationals( + remove(type, expr, 'identical(-1)'), args[2 .. nargs]) + else return product('fix_rationals(op(k, expr), args[2 .. nargs])', + 'k' = 1 .. nn) + end if + end if; + if type(expr, `^`) then + base := op(1, expr); + power := op(2, expr); + fbase := fix_rationals(base, args[2 .. nargs]); + if type(power, integer) then fpower := power + else fpower := fix_rationals(power, args[2 .. nargs]) + end if; + return fbase^fpower + end if; + if type(expr, integer) then return 'RATIONAL'(expr, 1) end if; + if type(expr, fraction) then + num := op(1, expr); den := op(2, expr); return 'RATIONAL'(num, den) + end if; + if type(expr, float) then + mult := op(1, expr); + power := op(2, expr); + return fix_rationals(mult*10^power, args[2 .. nargs]) + end if; + if type(expr, name) then return expr end if; + error "%0", "unknown type for expr!", " whattype(expr) = ", + whattype(expr), " expr = ", expr +end proc + +> +################################################################################ +> +# +# This function finds names in a list which *don't* have a specified prefix. +# +# Arguments: +# name_list = A list of the names. +# prefix = The prefix we want to filter out. +# +# Results: +# This function returns the subset list of names which don't have the +# specified prefix. +# +> nonmatching_names := +> proc( name_list::list({name,string}), prefix::{name,string} ) +> +> select( proc(n) +> evalb(not StringTools[IsPrefix](prefix,n)); +> end proc +> , +> name_list +> ); +> end proc; +nonmatching_names := proc( +name_list::list({name, string}), prefix::{name, string}) + select(proc(n) evalb(not StringTools[IsPrefix](prefix, n)) end proc, + name_list) +end proc + +> +################################################################################ +> +# +# This function converts a numeric list to a string which is a valid +# C identifier suffix: elements are separated by "_", decimal points are +# replaced by "x", and all nonzero values have explicit +/- signs, which +# are replaced by "p"/"m". +# +# For example, [0,-3.5,+4] --> "0_m3x5_p4". +# +> sprint_numeric_list := +> proc(nlist::list(numeric)) +> +# generate preliminary string, eg "+0_-3.5_+4" +> map2(sprintf, "%+a", nlist); +> ListTools[Join](%, "_"); +> cat(op(%)); +> +# fixup bad characters +> StringTools[SubstituteAll](%, "+0", "0"); +> StringTools[CharacterMap](".+-", "xpm", %); +> +> return %; +> end proc; +sprint_numeric_list := proc(nlist::list(numeric)) + map2(sprintf, "%+a", nlist); + ListTools[Join](%, "_"); + cat(op(%)); + StringTools[SubstituteAll](%, "+0", "0"); + StringTools[CharacterMap](".+-", "xpm", %); + return % +end proc + +> +################################################################################ +> +# +# This function prints a sequence of C declarations for a list of names. +# +# Argument: +# name_list = A list of the names. +# type_name = The C type of the names, eg. "double". +# file_name = The file name to write the declaration to. This is +# truncated before writing. +# +> print_name_list_dcl := +> proc( name_list::list({name,string}), +> type_name::string, +> file_name::string ) +> local blanks, separator_string; +> +> ftruncate(file_name); +> +> map( +> proc(var::{name,string}) +> fprintf(file_name, +> "%s %s;\n", +> type_name, var); +> end proc +> , +> name_list +> ); +> +> fclose(file_name); +> NULL; +> end proc; +print_name_list_dcl := proc( +name_list::list({name, string}), type_name::string, file_name::string) +local blanks, separator_string; + ftruncate(file_name); + map(proc(var::{name, string}) + fprintf(file_name, "%s %s;\n", type_name, var) + end proc, name_list); + fclose(file_name); + NULL +end proc + +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function computes a list of all the (integer) points in an +# N-dimensional hypercube, in lexicographic order. The present +# implementation requires N <= 4. +# +# Arguments: +# cmin,cmax = N-element lists of cube minimum/maximum coordinates. +# +# Results: +# The function returns a set of d-element lists giving the coordinates. +# For example, +# hypercube([0,0], [2,1] +# returns +# { [0,0], [0,1], [1,0], [1,1], [2,0], [2,1] } +> hypercube_points := +> proc(cmin::list(integer), cmax::list(integer)) +> local N, i,j,k,l; +> +> N := nops(cmin); +> if (nops(cmax) <> N) +> then error +> "must have same number of dimensions for min and max coordinates!"; +> fi; +> +> if (N = 1) +> then return [seq([i], i=cmin[1]..cmax[1])]; +> elif (N = 2) +> then return [ +> seq( +> seq([i,j], j=cmin[2]..cmax[2]), +> i=cmin[1]..cmax[1]) +> ]; +> elif (N = 3) +> then return [ +> seq( +> seq( +> seq([i,j,k], k=cmin[3]..cmax[3]), +> j=cmin[2]..cmax[2] ), +> i=cmin[1]..cmax[1]) +> ]; +> elif (N = 4) +> then return [ +> seq( +> seq( +> seq( +> seq([i,j,k,l], l=cmin[4]..cmax[4]), +> k=cmin[3]..cmax[3] ), +> j=cmin[2]..cmax[2]), +> i=cmin[1]..cmax[1]) +> ]; +> else +> error "implementation restriction: must have N <= 4, got %1!", N; +> fi; +> end proc; +hypercube_points := proc(cmin::list(integer), cmax::list(integer)) +local N, i, j, k, l; + N := nops(cmin); + if nops(cmax) <> N then error + "must have same number of dimensions for min and max coordinates!" + end if; + if N = 1 then return [seq([i], i = cmin[1] .. cmax[1])] + elif N = 2 then return + [seq(seq([i, j], j = cmin[2] .. cmax[2]), i = cmin[1] .. cmax[1])] + elif N = 3 then return [seq( + seq(seq([i, j, k], k = cmin[3] .. cmax[3]), j = cmin[2] .. cmax[2]) + , i = cmin[1] .. cmax[1])] + elif N = 4 then return [seq(seq(seq( + seq([i, j, k, l], l = cmin[4] .. cmax[4]), k = cmin[3] .. cmax[3]), + j = cmin[2] .. cmax[2]), i = cmin[1] .. cmax[1])] + else error "implementation restriction: must have N <= 4, got %1!", N + end if +end proc + +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function truncates a file to 0 length if it exists, or creates +# it at that length if it doesn't exist. +# +# Arguments: +# file_name = (in) The name of the file. +# +> ftruncate := +> proc(file_name::string) +> fopen(file_name, 'WRITE'); +> fclose(%); +> NULL; +> end proc; +ftruncate := + + proc(file_name::string) fopen(file_name, 'WRITE'); fclose(%); NULL end proc + +# interpolate.maple -- compute interpolation formulas/coefficients +# $Header$ +> +# +# <<<representation of numbers, data values, etc>>> +# Lagrange_polynomial_interpolant - compute Lagrange polynomial interpolant +# Hermite_polynomial_interpolant - compute Hermite polynomial interpolant +# coeff_as_lc_of_data - coefficients of ... (linear combination of data) +# +# print_coeff__lc_of_data - print C code to compute coefficients +# print_fetch_data - print C code to fetch input array chunk into struct data +# print_store_coeffs - print C code to store struct coeffs "somewhere" +# print_interp_cmpt__lc_of_data - print C code for computation of interpolant +# +# coeff_name - name of coefficient of data at a given [m] coordinate +# data_var_name - name of variable storing data value at a given [m] coordinate +# +> +################################################################################ +> +# +# ***** representation of numbers, data values, etc ***** +# +# We use RATIONAL(p.0,q.0) to denote the rational number p/q. +# +# We use DATA(...) to represent the data values being interpolated at a +# specified [m] coordinate, where the arguments are the [m] coordinates. +# +# We use COEFF(...) to represent the molecule coefficient at a specified +# [m] coordinate, where the arguments are the [m] coordinates. +# +# For example, the usual 1-D centered 2nd order 1st derivative molecule +# would be written +# RATIONAL(-1.0,2.0)*DATA(-1) + RATIONA(1.0,2.0)*DATA(1) +# and its coefficients as +# COEFF(-1) = RATIONAL(-1.0,2.0) +# COEFF(1) = RATIONAL(1.0,2.0) +# +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function computes a Lagrange polynomial interpolant in any +# number of dimensions. +# +# Arguments: +# fn = The interpolation function. This should be a procedure in the +# coordinates, having the coefficients as global variables. For +# example, +# proc(x,y) c00 + c10*x + c01*y end proc +# coeff_list = A set of the interpolation coefficients (coefficients in +# the interpolation function), for example [c00, c10, c01]. +# coord_list = A list of the coordinates (independent variables in the +# interpolation function), for example [x,y]. +# posn_list = A list of positions (each a list of numeric values) where the +# interpolant is to use data, for example hypercube([0,0], [1,1]). +# Any positions may be used; if they're redundant (as in the +# example) the least-squares interpolant is computed. +# +# Results: +# This function returns the interpolating polynomial, in the form of +# an algebraic expression in the coordinates and the data values. +# +> Lagrange_polynomial_interpolant := +> proc( +> fn::procedure, coeff_list::list(name), +> coord_list::list(name), posn_list::list(list(numeric)) +> ) +> local posn, data_eqns, coeff_eqns; +> +# coefficients of interpolating polynomial +> data_eqns := { seq( fn(op(posn))='DATA'(op(posn)) , posn=posn_list ) }; +> coeff_eqns := linalg[leastsqrs](data_eqns, {op(coeff_list)}); +> if (has(coeff_eqns, '_t')) +> then error "interpolation coefficients aren't uniquely determined!"; +> end if; +> +# interpolant as a polynomial in the coordinates +> return subs(coeff_eqns, eval(fn))(op(coord_list)); +> end proc; +Lagrange_polynomial_interpolant := proc(fn::procedure, coeff_list::list(name), +coord_list::list(name), posn_list::list(list(numeric))) +local posn, data_eqns, coeff_eqns; + data_eqns := {seq(fn(op(posn)) = 'DATA'(op(posn)), posn = posn_list)}; + coeff_eqns := linalg[leastsqrs](data_eqns, {op(coeff_list)}); + if has(coeff_eqns, '_t') then + error "interpolation coefficients aren't uniquely determined!" + end if; + return subs(coeff_eqns, eval(fn))(op(coord_list)) +end proc + +> +################################################################################ +> +# +# This function computes a Hermite polynomial interpolant in any +# number of dimensions. This is a polynomial which +# * has values which match the given data DATA() at a specified set of +# points, and +# * has derivatives which match the specified finite-difference derivatives +# of the given data DATA() at a specified set of points +# +# For the derivative matching, we actually match all possible products +# of 1st derivatives, i.e. in 2-D we match dx, dy, and dxy, in 3-D we +# match dx, dy, dz, dxy, dxz, dyz, and dxyz, etc etc. +# +# Arguments: +# fn = The interpolation function. This should be a procedure in the +# coordinates, having the coefficients as global variables. For +# example, +# proc(x,y) +# + c03*y^3 + c13*x*y^3 + c23*x^2*y^3 + c33*x^3*y^3 +# + c02*y^2 + c12*x*y^2 + c22*x^2*y^2 + c32*x^3*y^2 +# + c01*y + c11*x*y + c21*x^2*y + c31*x^3*y +# + c00 + c10*x + c20*x^2 + c30*x^3 +# end proc; +# coeff_set = A set of the interpolation coefficients (coefficients in +# the interpolation function), for example +# { +# c03, c13, c23, c33, +# c02, c12, c22, c32, +# c01, c11, c21, c31, +# c00, c10, c20, c30 +# } +# coord_list = A list of the coordinates (independent variables in the +# interpolation function), for example [x,y]. +# deriv_set = A set of equations of the form +# {coords} = proc +# giving the derivatives which are to be matched, and the +# procedures to compute their finite-difference approximations. +# Each procedure should take N_dims integer arguments specifying +# an evaluation point, and return a suitable linear combination +# of the DATA() for the derivative at that point. For example +# { +# {x} = proc(i::integer, j::integer) +# - 1/2*DATA(i-1,j) + 1/2*DATA(i+1,j) +# end proc +# , +# {y} = proc(i::integer, j::integer) +# - 1/2*DATA(i,j-1) + 1/2*DATA(i,j+1) +# end proc +# , +# {x,y} = proc(i::integer, j::integer) +# - 1/4*DATA(i-1,j+1) + 1/4*DATA(i+1,j+1) +# + 1/4*DATA(i-1,j-1) - 1/4*DATA(i+1,j-1) +# end proc +# } +# fn_posn_set = A set of positions (each a list of numeric values) +# where the interpolant is to match the given data DATA(), +# for example +# {[0,0], [0,1], [1,0], [1,1]} +# deriv_posn_set = A list of positions (each a list of numeric values) +# where the interpolant is to match the derivatives +# specified by deriv_set , for example +# {[0,0], [0,1], [1,0], [1,1]} +# +# Results: +# This function returns the interpolating polynomial, in the form of +# an algebraic expression in the coordinates and the data values. +# +> Hermite_polynomial_interpolant := +> proc( +> fn::procedure, +> coeff_set::set(name), +> coord_list::list(name), +> deriv_set::set(set(name) = procedure), +> fn_posn_set::set(list(numeric)), +> deriv_posn_set::set(list(numeric)) +> ) +> local fn_eqnset, deriv_eqnset, coeff_eqns, subs_eqnset; +> +> +# +# compute a set of equations +# {fn(posn) = DATA(posn)} +# giving the function values to be matched +# +> fn_eqnset := map( +> # return equation that fn(posn) = DATA(posn) +> proc(posn::list(integer)) +> fn(op(posn)) = 'DATA'(op(posn)); +> end proc +> , +> fn_posn_set +> ); +> +> +# +# compute a set of equations +# { diff(fn,coords)(posn) = DERIV(coords)(posn) } +# giving the derivative values to be matched, where DERIV(coords) +# is a placeholder for the appropriate derivative +# +> map( +> # return set of equations for this particular derivative +> proc(deriv_coords::set(name)) +> local deriv_fn; +> fn(op(coord_list)); +> diff(%, op(deriv_coords)); +> deriv_fn := unapply(%, op(coord_list)); +> map( +> proc(posn::list(integer)) +> deriv_fn(op(posn)) = 'DERIV'(op(deriv_coords))(op(posn)); +> end proc +> , +> deriv_posn_set +> ); +> end proc +> , +> map(lhs, deriv_set) +> ); +> deriv_eqnset := `union`(op(%)); +> +> +# +# solve overall set of equations for coefficients +# in terms of DATA() and DERIV() values +# +> coeff_eqns := solve[linear](fn_eqnset union deriv_eqnset, coeff_set); +> if (indets(map(rhs,%)) <> {}) +> then error "no unique solution for coefficients -- %1 eqns for %2 coeffs", +> nops(fn_eqnset union deriv_eqnset), +> nops(coeff_set); +> fi; +> +> +# +# compute a set of substitution equations +# {'DERIV'(coords) = procedure} +# +> subs_eqnset := map( +> proc(eqn::set(name) = procedure) +> 'DERIV'(op(lhs(eqn))) = rhs(eqn); +> end proc +> , +> deriv_set +> ); +> +> +# +# compute the coefficients in terms of the DATA() values +# +> subs(subs_eqnset, coeff_eqns); +> eval(%); +> +# +# compute the interpolant as a polynomial in the coordinates +# +> subs(%, fn(op(coord_list))); +> end proc; +Hermite_polynomial_interpolant := proc(fn::procedure, coeff_set::set(name), +coord_list::list(name), deriv_set::set(set(name) = procedure), +fn_posn_set::set(list(numeric)), deriv_posn_set::set(list(numeric))) +local fn_eqnset, deriv_eqnset, coeff_eqns, subs_eqnset; + fn_eqnset := map( + proc(posn::list(integer)) fn(op(posn)) = 'DATA'(op(posn)) end proc, + fn_posn_set); + map(proc(deriv_coords::set(name)) + local deriv_fn; + fn(op(coord_list)); + diff(%, op(deriv_coords)); + deriv_fn := unapply(%, op(coord_list)); + map(proc(posn::list(integer)) + deriv_fn(op(posn)) = + 'DERIV'(op(deriv_coords))(op(posn)) + end proc, deriv_posn_set) + end proc, map(lhs, deriv_set)); + deriv_eqnset := `union`(op(%)); + coeff_eqns := solve[linear](fn_eqnset union deriv_eqnset, coeff_set); + if indets(map(rhs, %)) <> {} then error + "no unique solution for coefficients -- %1 eqns for %2 coeffs", + nops(fn_eqnset union deriv_eqnset), nops(coeff_set) + end if; + subs_eqnset := map(proc(eqn::(set(name) = procedure)) + 'DERIV'(op(lhs(eqn))) = rhs(eqn) + end proc, deriv_set); + subs(subs_eqnset, coeff_eqns); + eval(%); + subs(%, fn(op(coord_list))) +end proc + +> +################################################################################ +> +# +# This function takes as input an interpolating polynomial, expresses +# it as a linear combination of the data values, and returns the coefficeints +# of that form. +# +# Arguments: +# interpolant = The interpolating polynomial (an algebraic expression +# in the coordinates and the data values). +# posn_list = The same list of data positions used in the interpolant. +# +# Results: +# This function returns the coefficients, as a list of equations of the +# form COEFF(...) = value , where each value is a polynomial in the +# coordinates. The order of the list matches that of posn_list. +# +> coeff_as_lc_of_data := +> proc( +> interpolant::algebraic, +> posn_list::list(list(numeric)) +> ) +> local data_list, interpolant_as_lc_of_data; +> +# interpolant as a linear combination of the data values +> data_list := [ seq( 'DATA'(op(posn)) , posn=posn_list ) ]; +> interpolant_as_lc_of_data := collect(interpolant, data_list); +> +# coefficients of the data values in the linear combination +> return map( +> proc(posn::list(numeric)) +> coeff(interpolant_as_lc_of_data, DATA(op(posn))); +> 'COEFF'(op(posn)) = %; +> end proc +> , +> posn_list +> ); +> end proc; +coeff_as_lc_of_data := proc( +interpolant::algebraic, posn_list::list(list(numeric))) +local data_list, interpolant_as_lc_of_data; + data_list := [seq('DATA'(op(posn)), posn = posn_list)]; + interpolant_as_lc_of_data := collect(interpolant, data_list); + return map(proc(posn::list(numeric)) + coeff(interpolant_as_lc_of_data, DATA(op(posn))); + 'COEFF'(op(posn)) = % + end proc, posn_list) +end proc + +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function prints C expressions for the coefficients of an +# interpolating polynomial. (The polynomial is expressed as linear +# combinations of the data values with coefficients which are +# RATIONAL(p,q) calls.) +# +# Arguments: +# coeff_list = A list of the coefficients, as returned from +# coeff_as_lc_of_data() . +# coeff_name_prefix = A prefix string for the coefficient names. +# temp_name_type = The C type to be used for Maple-introduced temporary +# names, eg. "double". +# file_name = The file name to write the coefficients to. This is +# truncated before writing. +# +> print_coeff__lc_of_data := +> proc( coeff_list::list(specfunc(numeric,COEFF) = algebraic), +> coeff_name_prefix::string, +> temp_name_type::string, +> file_name::string ) +> global `codegen/C/function/informed`; +> local coeff_list2, cmpt_list, temp_name_list; +> +# convert LHS of each equation from a COEFF() call (eg COEFF(-1,+1)) +# to a Maple/C variable name (eg coeff_I_m1_p1) +> coeff_list2 := map( +> proc(coeff_eqn::specfunc(numeric,COEFF) = algebraic) +> local posn; +> posn := [op(lhs(coeff_eqn))]; +> coeff_name(posn,coeff_name_prefix); +> convert(%, name); # codegen[C] wants LHS +> # to be an actual Maple *name* +> % = fix_rationals(rhs(coeff_eqn)); +> end proc +> , +> coeff_list +> ); +> +# +# generate the C code +# +> +# tell codegen[C] not to warn about unknown RATIONAL() and DATA() "fn calls" +# via undocumented :( global table +> `codegen/C/function/informed`['RATIONAL'] := true; +> `codegen/C/function/informed`['DATA'] := true; +> +> ftruncate(file_name); +> +# optimized computation sequence for all the coefficients +# (may use local variables t0,t1,t2,...) +> cmpt_list := [codegen[optimize](coeff_list2, tryhard)]; +> +# list of the t0,t1,t2,... local variables +> temp_name_list := nonmatching_names(map(lhs,cmpt_list), coeff_name_prefix); +> +# declare the t0,t1,t2,... local variables (if there are any) +> if (nops(temp_name_list) > 0) +> then print_name_list_dcl(%, temp_name_type, file_name); +> fi; +> +# now print the optimized computation sequence +> codegen[C](cmpt_list, filename=file_name); +> +> fclose(file_name); +> +> NULL; +> end proc; +print_coeff__lc_of_data := proc( +coeff_list::list(specfunc(numeric, COEFF) = algebraic), +coeff_name_prefix::string, temp_name_type::string, file_name::string) +local coeff_list2, cmpt_list, temp_name_list; +global `codegen/C/function/informed`; + coeff_list2 := map(proc( + coeff_eqn::(specfunc(numeric, COEFF) = algebraic)) + local posn; + posn := [op(lhs(coeff_eqn))]; + coeff_name(posn, coeff_name_prefix); + convert(%, name); + % = fix_rationals(rhs(coeff_eqn)) + end proc, coeff_list); + `codegen/C/function/informed`['RATIONAL'] := true; + `codegen/C/function/informed`['DATA'] := true; + ftruncate(file_name); + cmpt_list := [codegen[optimize](coeff_list2, tryhard)]; + temp_name_list := + nonmatching_names(map(lhs, cmpt_list), coeff_name_prefix); + if 0 < nops(temp_name_list) then + print_name_list_dcl(%, temp_name_type, file_name) + end if; + codegen[C](cmpt_list, filename = file_name); + fclose(file_name); + NULL +end proc + +> +################################################################################ +> +# +# This function prints a sequence of C expression to assign the data-value +# variables, eg +# data->data_m1_p1 = DATA(-1,1); +# +# Arguments: +# posn_list = The same list of positions as was used to compute the +# interpolating polynomial. +# data_var_name_prefix = A prefix string for the data variable names. +# file_name = The file name to write the coefficients to. This is +# truncated before writing. +# +> print_fetch_data := +> proc( +> posn_list::list(list(numeric)), +> data_var_name_prefix::string, +> file_name::string +> ) +> +> ftruncate(file_name); +> map( +> proc(posn::list(numeric)) +> fprintf(file_name, +> "%s = %a;\n", +> data_var_name(posn,data_var_name_prefix), +> DATA(op(posn))); +> end proc +> , +> posn_list +> ); +> fclose(file_name); +> +> NULL; +> end proc; +print_fetch_data := proc(posn_list::list(list(numeric)), +data_var_name_prefix::string, file_name::string) + ftruncate(file_name); + map(proc(posn::list(numeric)) + fprintf(file_name, "%s = %a;\n", + data_var_name(posn, data_var_name_prefix), DATA(op(posn))) + end proc, posn_list); + fclose(file_name); + NULL +end proc + +> +################################################################################ +> +# +# This function prints a sequence of C expression to store the interpolation +# coefficients in COEFF(...) expressions, eg +# COEFF(1,-1) = factor * coeffs->coeff_p1_m1; +# +# Arguments: +# posn_list = The list of positions in the molecule. +# coeff_name_prefix = A prefix string for the coefficient names, +# eg "factor * coeffs->coeff_" +# file_name = The file name to write the coefficients to. This is +# truncated before writing. +# +> print_store_coeffs := +> proc( +> posn_list::list(list(numeric)), +> coeff_name_prefix::string, +> file_name::string +> ) +> +> ftruncate(file_name); +> map( +> proc(posn::list(numeric)) +> fprintf(file_name, +> "%a = %s;\n", +> 'COEFF'(op(posn)), +> coeff_name(posn,coeff_name_prefix)); +> end proc +> , +> posn_list +> ); +> fclose(file_name); +> +> NULL; +> end proc; +print_store_coeffs := proc(posn_list::list(list(numeric)), +coeff_name_prefix::string, file_name::string) + ftruncate(file_name); + map(proc(posn::list(numeric)) + fprintf(file_name, "%a = %s;\n", 'COEFF'(op(posn)), + coeff_name(posn, coeff_name_prefix)) + end proc, posn_list); + fclose(file_name); + NULL +end proc + +> +################################################################################ +> +# +# This function prints a C expression to evaluate a molecule, i.e. +# to compute the molecule as a linear combination of the data values. +# +# Arguments: +# posn_list = The list of positions in the molecule. +# coeff_name_prefix = A prefix string for the coefficient names. +# data_var_name_prefix = A prefix string for the data variable names. +# file_name = The file name to write the coefficients to. This is +# truncated before writing. +# +> print_evaluate_molecule := +> proc( +> posn_list::list(list(numeric)), +> coeff_name_prefix::string, +> data_var_name_prefix::string, +> file_name::string +> ) +> +> ftruncate(file_name); +> +# list of "coeff*data_var" terms +> map( +> proc(posn::list(numeric)) +> sprintf("%s*%s", +> coeff_name(posn,coeff_name_prefix), +> data_var_name(posn,data_var_name_prefix)); +> end proc +> , +> posn_list +> ); +> +> ListTools[Join](%, "\n + "); +> cat(op(%)); +> fprintf(file_name, " %s;\n", %); +> +> fclose(file_name); +> +> NULL; +> end proc; +print_evaluate_molecule := proc(posn_list::list(list(numeric)), +coeff_name_prefix::string, data_var_name_prefix::string, file_name::string) + ftruncate(file_name); + map(proc(posn::list(numeric)) + sprintf("%s*%s", coeff_name(posn, coeff_name_prefix), + data_var_name(posn, data_var_name_prefix)) + end proc, posn_list); + ListTools[Join](%, "\n + "); + cat(op(%)); + fprintf(file_name, " %s;\n", %); + fclose(file_name); + NULL +end proc + +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function computes the name of the coefficient of the data at a +# given [m] position, i.e. it encapsulates our naming convention for this. +# +# Arguments: +# posn = (in) The [m] coordinates. +# name_prefix = A prefix string for the coefficient name. +# +# Results: +# The function returns the coefficient, as a Maple string. +# +> coeff_name := +> proc(posn::list(numeric), name_prefix::string) +> cat(name_prefix, sprint_numeric_list(posn)); +> end proc; +coeff_name := proc(posn::list(numeric), name_prefix::string) + cat(name_prefix, sprint_numeric_list(posn)) +end proc + +> +################################################################################ +> +# +# This function computes the name of the variable in which the C code +# will store the input data at a given [m] position, i.e. it encapsulates +# our naming convention for this. +# +# Arguments: +# posn = (in) The [m] coordinates. +# name_prefix = A prefix string for the variable name. +# +# Results: +# The function returns the variable name, as a Maple string. +# +> data_var_name := +> proc(posn::list(numeric), name_prefix::string) +> cat(name_prefix, sprint_numeric_list(posn)); +> end proc; +data_var_name := proc(posn::list(numeric), name_prefix::string) + cat(name_prefix, sprint_numeric_list(posn)) +end proc + +# Maple code to compute lists of point positions in hypercube-shaped molecules +# $Header$ +> +################################################################################ +> +# +# 1D interpolation points +# +> posn_list_1d_size2 := hypercube_points([ 0], [+1]); + posn_list_1d_size2 := [[0], [1]] + +> posn_list_1d_size3 := hypercube_points([-1], [+1]); + posn_list_1d_size3 := [[-1], [0], [1]] + +> posn_list_1d_size4 := hypercube_points([-1], [+2]); + posn_list_1d_size4 := [[-1], [0], [1], [2]] + +> posn_list_1d_size5 := hypercube_points([-2], [+2]); + posn_list_1d_size5 := [[-2], [-1], [0], [1], [2]] + +> posn_list_1d_size6 := hypercube_points([-2], [+3]); + posn_list_1d_size6 := [[-2], [-1], [0], [1], [2], [3]] + +> posn_list_1d_size7 := hypercube_points([-3], [+3]); + posn_list_1d_size7 := [[-3], [-2], [-1], [0], [1], [2], [3]] + +> +################################################################################ +> +# +# 2D interpolation points (Fortran ordering) +# +> posn_list_2d_size2 := map(ListTools[Reverse], +> hypercube_points([ 0, 0], [+1,+1])); + posn_list_2d_size2 := [[0, 0], [1, 0], [0, 1], [1, 1]] + +> posn_list_2d_size3 := map(ListTools[Reverse], +> hypercube_points([-1,-1], [+1,+1])); +posn_list_2d_size3 := [[-1, -1], [0, -1], [1, -1], [-1, 0], [0, 0], [1, 0], + + [-1, 1], [0, 1], [1, 1]] + +> posn_list_2d_size4 := map(ListTools[Reverse], +> hypercube_points([-1,-1], [+2,+2])); +posn_list_2d_size4 := [[-1, -1], [0, -1], [1, -1], [2, -1], [-1, 0], [0, 0], + + [1, 0], [2, 0], [-1, 1], [0, 1], [1, 1], [2, 1], [-1, 2], [0, 2], [1, 2], + + [2, 2]] + +> posn_list_2d_size5 := map(ListTools[Reverse], +> hypercube_points([-2,-2], [+2,+2])); +posn_list_2d_size5 := [[-2, -2], [-1, -2], [0, -2], [1, -2], [2, -2], [-2, -1], + + [-1, -1], [0, -1], [1, -1], [2, -1], [-2, 0], [-1, 0], [0, 0], [1, 0], + + [2, 0], [-2, 1], [-1, 1], [0, 1], [1, 1], [2, 1], [-2, 2], [-1, 2], [0, 2], + + [1, 2], [2, 2]] + +> posn_list_2d_size6 := map(ListTools[Reverse], +> hypercube_points([-2,-2], [+3,+3])); +posn_list_2d_size6 := [[-2, -2], [-1, -2], [0, -2], [1, -2], [2, -2], [3, -2], + + [-2, -1], [-1, -1], [0, -1], [1, -1], [2, -1], [3, -1], [-2, 0], [-1, 0], + + [0, 0], [1, 0], [2, 0], [3, 0], [-2, 1], [-1, 1], [0, 1], [1, 1], [2, 1], + + [3, 1], [-2, 2], [-1, 2], [0, 2], [1, 2], [2, 2], [3, 2], [-2, 3], [-1, 3], + + [0, 3], [1, 3], [2, 3], [3, 3]] + +> +################################################################################ +> +# +# 3D interpolation points (Fortran ordering) +# +> posn_list_3d_size2 := map(ListTools[Reverse], +> hypercube_points([ 0, 0, 0], [+1,+1,+1])); +posn_list_3d_size2 := [[0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0], [0, 0, 1], + + [1, 0, 1], [0, 1, 1], [1, 1, 1]] + +> posn_list_3d_size3 := map(ListTools[Reverse], +> hypercube_points([-1,-1,-1], [+1,+1,+1])); +posn_list_3d_size3 := [[-1, -1, -1], [0, -1, -1], [1, -1, -1], [-1, 0, -1], + + [0, 0, -1], [1, 0, -1], [-1, 1, -1], [0, 1, -1], [1, 1, -1], [-1, -1, 0], + + [0, -1, 0], [1, -1, 0], [-1, 0, 0], [0, 0, 0], [1, 0, 0], [-1, 1, 0], + + [0, 1, 0], [1, 1, 0], [-1, -1, 1], [0, -1, 1], [1, -1, 1], [-1, 0, 1], + + [0, 0, 1], [1, 0, 1], [-1, 1, 1], [0, 1, 1], [1, 1, 1]] + +> posn_list_3d_size4 := map(ListTools[Reverse], +> hypercube_points([-1,-1,-1], [+2,+2,+2])); +posn_list_3d_size4 := [[-1, -1, -1], [0, -1, -1], [1, -1, -1], [2, -1, -1], + + [-1, 0, -1], [0, 0, -1], [1, 0, -1], [2, 0, -1], [-1, 1, -1], [0, 1, -1], + + [1, 1, -1], [2, 1, -1], [-1, 2, -1], [0, 2, -1], [1, 2, -1], [2, 2, -1], + + [-1, -1, 0], [0, -1, 0], [1, -1, 0], [2, -1, 0], [-1, 0, 0], [0, 0, 0], + + [1, 0, 0], [2, 0, 0], [-1, 1, 0], [0, 1, 0], [1, 1, 0], [2, 1, 0], + + [-1, 2, 0], [0, 2, 0], [1, 2, 0], [2, 2, 0], [-1, -1, 1], [0, -1, 1], + + [1, -1, 1], [2, -1, 1], [-1, 0, 1], [0, 0, 1], [1, 0, 1], [2, 0, 1], + + [-1, 1, 1], [0, 1, 1], [1, 1, 1], [2, 1, 1], [-1, 2, 1], [0, 2, 1], + + [1, 2, 1], [2, 2, 1], [-1, -1, 2], [0, -1, 2], [1, -1, 2], [2, -1, 2], + + [-1, 0, 2], [0, 0, 2], [1, 0, 2], [2, 0, 2], [-1, 1, 2], [0, 1, 2], + + [1, 1, 2], [2, 1, 2], [-1, 2, 2], [0, 2, 2], [1, 2, 2], [2, 2, 2]] + +> posn_list_3d_size5 := map(ListTools[Reverse], +> hypercube_points([-2,-2,-2], [+2,+2,+2])); +posn_list_3d_size5 := [[-2, -2, -2], [-1, -2, -2], [0, -2, -2], [1, -2, -2], + + [2, -2, -2], [-2, -1, -2], [-1, -1, -2], [0, -1, -2], [1, -1, -2], + + [2, -1, -2], [-2, 0, -2], [-1, 0, -2], [0, 0, -2], [1, 0, -2], [2, 0, -2], + + [-2, 1, -2], [-1, 1, -2], [0, 1, -2], [1, 1, -2], [2, 1, -2], [-2, 2, -2], + + [-1, 2, -2], [0, 2, -2], [1, 2, -2], [2, 2, -2], [-2, -2, -1], [-1, -2, -1], + + [0, -2, -1], [1, -2, -1], [2, -2, -1], [-2, -1, -1], [-1, -1, -1], + + [0, -1, -1], [1, -1, -1], [2, -1, -1], [-2, 0, -1], [-1, 0, -1], [0, 0, -1], + + [1, 0, -1], [2, 0, -1], [-2, 1, -1], [-1, 1, -1], [0, 1, -1], [1, 1, -1], + + [2, 1, -1], [-2, 2, -1], [-1, 2, -1], [0, 2, -1], [1, 2, -1], [2, 2, -1], + + [-2, -2, 0], [-1, -2, 0], [0, -2, 0], [1, -2, 0], [2, -2, 0], [-2, -1, 0], + + [-1, -1, 0], [0, -1, 0], [1, -1, 0], [2, -1, 0], [-2, 0, 0], [-1, 0, 0], + + [0, 0, 0], [1, 0, 0], [2, 0, 0], [-2, 1, 0], [-1, 1, 0], [0, 1, 0], + + [1, 1, 0], [2, 1, 0], [-2, 2, 0], [-1, 2, 0], [0, 2, 0], [1, 2, 0], + + [2, 2, 0], [-2, -2, 1], [-1, -2, 1], [0, -2, 1], [1, -2, 1], [2, -2, 1], + + [-2, -1, 1], [-1, -1, 1], [0, -1, 1], [1, -1, 1], [2, -1, 1], [-2, 0, 1], + + [-1, 0, 1], [0, 0, 1], [1, 0, 1], [2, 0, 1], [-2, 1, 1], [-1, 1, 1], + + [0, 1, 1], [1, 1, 1], [2, 1, 1], [-2, 2, 1], [-1, 2, 1], [0, 2, 1], + + [1, 2, 1], [2, 2, 1], [-2, -2, 2], [-1, -2, 2], [0, -2, 2], [1, -2, 2], + + [2, -2, 2], [-2, -1, 2], [-1, -1, 2], [0, -1, 2], [1, -1, 2], [2, -1, 2], + + [-2, 0, 2], [-1, 0, 2], [0, 0, 2], [1, 0, 2], [2, 0, 2], [-2, 1, 2], + + [-1, 1, 2], [0, 1, 2], [1, 1, 2], [2, 1, 2], [-2, 2, 2], [-1, 2, 2], + + [0, 2, 2], [1, 2, 2], [2, 2, 2]] + +> posn_list_3d_size6 := map(ListTools[Reverse], +> hypercube_points([-2,-2,-2], [+3,+3,+3])); +posn_list_3d_size6 := [[-2, -2, -2], [-1, -2, -2], [0, -2, -2], [1, -2, -2], + + [2, -2, -2], [3, -2, -2], [-2, -1, -2], [-1, -1, -2], [0, -1, -2], + + [1, -1, -2], [2, -1, -2], [3, -1, -2], [-2, 0, -2], [-1, 0, -2], [0, 0, -2], + + [1, 0, -2], [2, 0, -2], [3, 0, -2], [-2, 1, -2], [-1, 1, -2], [0, 1, -2], + + [1, 1, -2], [2, 1, -2], [3, 1, -2], [-2, 2, -2], [-1, 2, -2], [0, 2, -2], + + [1, 2, -2], [2, 2, -2], [3, 2, -2], [-2, 3, -2], [-1, 3, -2], [0, 3, -2], + + [1, 3, -2], [2, 3, -2], [3, 3, -2], [-2, -2, -1], [-1, -2, -1], [0, -2, -1], + + [1, -2, -1], [2, -2, -1], [3, -2, -1], [-2, -1, -1], [-1, -1, -1], + + [0, -1, -1], [1, -1, -1], [2, -1, -1], [3, -1, -1], [-2, 0, -1], + + [-1, 0, -1], [0, 0, -1], [1, 0, -1], [2, 0, -1], [3, 0, -1], [-2, 1, -1], + + [-1, 1, -1], [0, 1, -1], [1, 1, -1], [2, 1, -1], [3, 1, -1], [-2, 2, -1], + + [-1, 2, -1], [0, 2, -1], [1, 2, -1], [2, 2, -1], [3, 2, -1], [-2, 3, -1], + + [-1, 3, -1], [0, 3, -1], [1, 3, -1], [2, 3, -1], [3, 3, -1], [-2, -2, 0], + + [-1, -2, 0], [0, -2, 0], [1, -2, 0], [2, -2, 0], [3, -2, 0], [-2, -1, 0], + + [-1, -1, 0], [0, -1, 0], [1, -1, 0], [2, -1, 0], [3, -1, 0], [-2, 0, 0], + + [-1, 0, 0], [0, 0, 0], [1, 0, 0], [2, 0, 0], [3, 0, 0], [-2, 1, 0], + + [-1, 1, 0], [0, 1, 0], [1, 1, 0], [2, 1, 0], [3, 1, 0], [-2, 2, 0], + + [-1, 2, 0], [0, 2, 0], [1, 2, 0], [2, 2, 0], [3, 2, 0], [-2, 3, 0], + + [-1, 3, 0], [0, 3, 0], [1, 3, 0], [2, 3, 0], [3, 3, 0], [-2, -2, 1], + + [-1, -2, 1], [0, -2, 1], [1, -2, 1], [2, -2, 1], [3, -2, 1], [-2, -1, 1], + + [-1, -1, 1], [0, -1, 1], [1, -1, 1], [2, -1, 1], [3, -1, 1], [-2, 0, 1], + + [-1, 0, 1], [0, 0, 1], [1, 0, 1], [2, 0, 1], [3, 0, 1], [-2, 1, 1], + + [-1, 1, 1], [0, 1, 1], [1, 1, 1], [2, 1, 1], [3, 1, 1], [-2, 2, 1], + + [-1, 2, 1], [0, 2, 1], [1, 2, 1], [2, 2, 1], [3, 2, 1], [-2, 3, 1], + + [-1, 3, 1], [0, 3, 1], [1, 3, 1], [2, 3, 1], [3, 3, 1], [-2, -2, 2], + + [-1, -2, 2], [0, -2, 2], [1, -2, 2], [2, -2, 2], [3, -2, 2], [-2, -1, 2], + + [-1, -1, 2], [0, -1, 2], [1, -1, 2], [2, -1, 2], [3, -1, 2], [-2, 0, 2], + + [-1, 0, 2], [0, 0, 2], [1, 0, 2], [2, 0, 2], [3, 0, 2], [-2, 1, 2], + + [-1, 1, 2], [0, 1, 2], [1, 1, 2], [2, 1, 2], [3, 1, 2], [-2, 2, 2], + + [-1, 2, 2], [0, 2, 2], [1, 2, 2], [2, 2, 2], [3, 2, 2], [-2, 3, 2], + + [-1, 3, 2], [0, 3, 2], [1, 3, 2], [2, 3, 2], [3, 3, 2], [-2, -2, 3], + + [-1, -2, 3], [0, -2, 3], [1, -2, 3], [2, -2, 3], [3, -2, 3], [-2, -1, 3], + + [-1, -1, 3], [0, -1, 3], [1, -1, 3], [2, -1, 3], [3, -1, 3], [-2, 0, 3], + + [-1, 0, 3], [0, 0, 3], [1, 0, 3], [2, 0, 3], [3, 0, 3], [-2, 1, 3], + + [-1, 1, 3], [0, 1, 3], [1, 1, 3], [2, 1, 3], [3, 1, 3], [-2, 2, 3], + + [-1, 2, 3], [0, 2, 3], [1, 2, 3], [2, 2, 3], [3, 2, 3], [-2, 3, 3], + + [-1, 3, 3], [0, 3, 3], [1, 3, 3], [2, 3, 3], [3, 3, 3]] + +# Maple code to compute common coefficients for all 2d interpolation schemes +# $Header$ +> +################################################################################ +> +# +# generic stuff for 2d, cube, size=2 +# +> +> data_list_2d_size2 := map(data_var_name, posn_list_2d_size2, "data_"); + data_list_2d_size2 := ["data_0_0", "data_p1_0", "data_0_p1", "data_p1_p1"] + +> coeffs_list_2d_size2 := map(coeff_name, posn_list_2d_size2, "coeff_"); +coeffs_list_2d_size2 := + + ["coeff_0_0", "coeff_p1_0", "coeff_0_p1", "coeff_p1_p1"] + +> +> print_name_list_dcl(data_list_2d_size2, "fp", +> "2d.cube.size2/data-dcl.h"); +> print_name_list_dcl(coeffs_list_2d_size2, "fp", +> "2d.cube.size2/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_2d_size2, "data->data_", +> "2d.cube.size2/fetch-data.c"); +> print_evaluate_molecule(posn_list_2d_size2, +> "coeffs->coeff_", "data->data_", +> "2d.cube.size2/evaluate-molecule.c"); +> print_store_coeffs(posn_list_2d_size2, +> "factor * coeffs->coeff_", +> "2d.cube.size2/store-coeffs.c"); +> +################################################################################ +> +# +# generic stuff for 2d, cube, size=3 +# +> +> data_list_2d_size3 := map(data_var_name, posn_list_2d_size3, "data_"); +data_list_2d_size3 := ["data_m1_m1", "data_0_m1", "data_p1_m1", "data_m1_0", + + "data_0_0", "data_p1_0", "data_m1_p1", "data_0_p1", "data_p1_p1"] + +> coeffs_list_2d_size3 := map(coeff_name, posn_list_2d_size3, "coeff_"); +coeffs_list_2d_size3 := ["coeff_m1_m1", "coeff_0_m1", "coeff_p1_m1", + + "coeff_m1_0", "coeff_0_0", "coeff_p1_0", "coeff_m1_p1", "coeff_0_p1", + + "coeff_p1_p1"] + +> +> print_name_list_dcl(data_list_2d_size3, "fp", +> "2d.cube.size3/data-dcl.h"); +> print_name_list_dcl(coeffs_list_2d_size3, "fp", +> "2d.cube.size3/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_2d_size3, "data->data_", +> "2d.cube.size3/fetch-data.c"); +> print_evaluate_molecule(posn_list_2d_size3, +> "coeffs->coeff_", "data->data_", +> "2d.cube.size3/evaluate-molecule.c"); +> print_store_coeffs(posn_list_2d_size3, +> "factor * coeffs->coeff_", +> "2d.cube.size3/store-coeffs.c"); +> +################################################################################ +> +# +# generic stuff for 2d, cube, size=4 +# +> +> data_list_2d_size4 := map(data_var_name, posn_list_2d_size4, "data_"); +data_list_2d_size4 := ["data_m1_m1", "data_0_m1", "data_p1_m1", "data_p2_m1", + + "data_m1_0", "data_0_0", "data_p1_0", "data_p2_0", "data_m1_p1", + + "data_0_p1", "data_p1_p1", "data_p2_p1", "data_m1_p2", "data_0_p2", + + "data_p1_p2", "data_p2_p2"] + +> coeffs_list_2d_size4 := map(coeff_name, posn_list_2d_size4, "coeff_"); +coeffs_list_2d_size4 := ["coeff_m1_m1", "coeff_0_m1", "coeff_p1_m1", + + "coeff_p2_m1", "coeff_m1_0", "coeff_0_0", "coeff_p1_0", "coeff_p2_0", + + "coeff_m1_p1", "coeff_0_p1", "coeff_p1_p1", "coeff_p2_p1", "coeff_m1_p2", + + "coeff_0_p2", "coeff_p1_p2", "coeff_p2_p2"] + +> +> print_name_list_dcl(data_list_2d_size4, "fp", +> "2d.cube.size4/data-dcl.h"); +> print_name_list_dcl(coeffs_list_2d_size4, "fp", +> "2d.cube.size4/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_2d_size4, "data->data_", +> "2d.cube.size4/fetch-data.c"); +> print_evaluate_molecule(posn_list_2d_size4, +> "coeffs->coeff_", "data->data_", +> "2d.cube.size4/evaluate-molecule.c"); +> print_store_coeffs(posn_list_2d_size4, +> "factor * coeffs->coeff_", +> "2d.cube.size4/store-coeffs.c"); +> +################################################################################ +> +# +# generic stuff for 2d, cube, size=5 +# +> +> data_list_2d_size5 := map(data_var_name, posn_list_2d_size5, "data_"); +data_list_2d_size5 := ["data_m2_m2", "data_m1_m2", "data_0_m2", "data_p1_m2", + + "data_p2_m2", "data_m2_m1", "data_m1_m1", "data_0_m1", "data_p1_m1", + + "data_p2_m1", "data_m2_0", "data_m1_0", "data_0_0", "data_p1_0", + + "data_p2_0", "data_m2_p1", "data_m1_p1", "data_0_p1", "data_p1_p1", + + "data_p2_p1", "data_m2_p2", "data_m1_p2", "data_0_p2", "data_p1_p2", + + "data_p2_p2"] + +> coeffs_list_2d_size5 := map(coeff_name, posn_list_2d_size5, "coeff_"); +coeffs_list_2d_size5 := ["coeff_m2_m2", "coeff_m1_m2", "coeff_0_m2", + + "coeff_p1_m2", "coeff_p2_m2", "coeff_m2_m1", "coeff_m1_m1", "coeff_0_m1", + + "coeff_p1_m1", "coeff_p2_m1", "coeff_m2_0", "coeff_m1_0", "coeff_0_0", + + "coeff_p1_0", "coeff_p2_0", "coeff_m2_p1", "coeff_m1_p1", "coeff_0_p1", + + "coeff_p1_p1", "coeff_p2_p1", "coeff_m2_p2", "coeff_m1_p2", "coeff_0_p2", + + "coeff_p1_p2", "coeff_p2_p2"] + +> +> print_name_list_dcl(data_list_2d_size5, "fp", +> "2d.cube.size5/data-dcl.h"); +> print_name_list_dcl(coeffs_list_2d_size5, "fp", +> "2d.cube.size5/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_2d_size5, "data->data_", +> "2d.cube.size5/fetch-data.c"); +> print_evaluate_molecule(posn_list_2d_size5, +> "coeffs->coeff_", "data->data_", +> "2d.cube.size5/evaluate-molecule.c"); +> print_store_coeffs(posn_list_2d_size5, +> "factor * coeffs->coeff_", +> "2d.cube.size5/store-coeffs.c"); +> +################################################################################ +> +# +# generic stuff for 2d, cube, size=6 +# +> +> data_list_2d_size6 := map(data_var_name, posn_list_2d_size6, "data_"); +data_list_2d_size6 := ["data_m2_m2", "data_m1_m2", "data_0_m2", "data_p1_m2", + + "data_p2_m2", "data_p3_m2", "data_m2_m1", "data_m1_m1", "data_0_m1", + + "data_p1_m1", "data_p2_m1", "data_p3_m1", "data_m2_0", "data_m1_0", + + "data_0_0", "data_p1_0", "data_p2_0", "data_p3_0", "data_m2_p1", + + "data_m1_p1", "data_0_p1", "data_p1_p1", "data_p2_p1", "data_p3_p1", + + "data_m2_p2", "data_m1_p2", "data_0_p2", "data_p1_p2", "data_p2_p2", + + "data_p3_p2", "data_m2_p3", "data_m1_p3", "data_0_p3", "data_p1_p3", + + "data_p2_p3", "data_p3_p3"] + +> coeffs_list_2d_size6 := map(coeff_name, posn_list_2d_size6, "coeff_"); +coeffs_list_2d_size6 := ["coeff_m2_m2", "coeff_m1_m2", "coeff_0_m2", + + "coeff_p1_m2", "coeff_p2_m2", "coeff_p3_m2", "coeff_m2_m1", "coeff_m1_m1", + + "coeff_0_m1", "coeff_p1_m1", "coeff_p2_m1", "coeff_p3_m1", "coeff_m2_0", + + "coeff_m1_0", "coeff_0_0", "coeff_p1_0", "coeff_p2_0", "coeff_p3_0", + + "coeff_m2_p1", "coeff_m1_p1", "coeff_0_p1", "coeff_p1_p1", "coeff_p2_p1", + + "coeff_p3_p1", "coeff_m2_p2", "coeff_m1_p2", "coeff_0_p2", "coeff_p1_p2", + + "coeff_p2_p2", "coeff_p3_p2", "coeff_m2_p3", "coeff_m1_p3", "coeff_0_p3", + + "coeff_p1_p3", "coeff_p2_p3", "coeff_p3_p3"] + +> +> print_name_list_dcl(data_list_2d_size6, "fp", +> "2d.cube.size6/data-dcl.h"); +> print_name_list_dcl(coeffs_list_2d_size6, "fp", +> "2d.cube.size6/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_2d_size6, "data->data_", +> "2d.cube.size6/fetch-data.c"); +> print_evaluate_molecule(posn_list_2d_size6, +> "coeffs->coeff_", "data->data_", +> "2d.cube.size6/evaluate-molecule.c"); +> print_store_coeffs(posn_list_2d_size6, +> "factor * coeffs->coeff_", +> "2d.cube.size6/store-coeffs.c"); +> quit +bytes used=976064, alloc=917336, time=0.08 diff --git a/src/common/2d.maple b/src/common/2d.maple new file mode 100644 index 0000000..3d1d3cf --- /dev/null +++ b/src/common/2d.maple @@ -0,0 +1,117 @@ +# Maple code to compute common coefficients for all 2d interpolation schemes +# $Header$ + +################################################################################ + +# +# generic stuff for 2d, cube, size=2 +# + +data_list_2d_size2 := map(data_var_name, posn_list_2d_size2, "data_"); +coeffs_list_2d_size2 := map(coeff_name, posn_list_2d_size2, "coeff_"); + +print_name_list_dcl(data_list_2d_size2, "fp", + "2d.cube.size2/data-dcl.h"); +print_name_list_dcl(coeffs_list_2d_size2, "fp", + "2d.cube.size2/coeffs-dcl.h"); + +print_load_data(posn_list_2d_size2, "data->data_", + "2d.cube.size2/load-data.c"); +print_evaluate_molecule(posn_list_2d_size2, + "coeffs->coeff_", "data->data_", + "2d.cube.size2/evaluate-molecule.c"); +print_store_coeffs(posn_list_2d_size2, + "factor * coeffs->coeff_", + "2d.cube.size2/store-coeffs.c"); + +################################################################################ + +# +# generic stuff for 2d, cube, size=3 +# + +data_list_2d_size3 := map(data_var_name, posn_list_2d_size3, "data_"); +coeffs_list_2d_size3 := map(coeff_name, posn_list_2d_size3, "coeff_"); + +print_name_list_dcl(data_list_2d_size3, "fp", + "2d.cube.size3/data-dcl.h"); +print_name_list_dcl(coeffs_list_2d_size3, "fp", + "2d.cube.size3/coeffs-dcl.h"); + +print_load_data(posn_list_2d_size3, "data->data_", + "2d.cube.size3/load-data.c"); +print_evaluate_molecule(posn_list_2d_size3, + "coeffs->coeff_", "data->data_", + "2d.cube.size3/evaluate-molecule.c"); +print_store_coeffs(posn_list_2d_size3, + "factor * coeffs->coeff_", + "2d.cube.size3/store-coeffs.c"); + +################################################################################ + +# +# generic stuff for 2d, cube, size=4 +# + +data_list_2d_size4 := map(data_var_name, posn_list_2d_size4, "data_"); +coeffs_list_2d_size4 := map(coeff_name, posn_list_2d_size4, "coeff_"); + +print_name_list_dcl(data_list_2d_size4, "fp", + "2d.cube.size4/data-dcl.h"); +print_name_list_dcl(coeffs_list_2d_size4, "fp", + "2d.cube.size4/coeffs-dcl.h"); + +print_load_data(posn_list_2d_size4, "data->data_", + "2d.cube.size4/load-data.c"); +print_evaluate_molecule(posn_list_2d_size4, + "coeffs->coeff_", "data->data_", + "2d.cube.size4/evaluate-molecule.c"); +print_store_coeffs(posn_list_2d_size4, + "factor * coeffs->coeff_", + "2d.cube.size4/store-coeffs.c"); + +################################################################################ + +# +# generic stuff for 2d, cube, size=5 +# + +data_list_2d_size5 := map(data_var_name, posn_list_2d_size5, "data_"); +coeffs_list_2d_size5 := map(coeff_name, posn_list_2d_size5, "coeff_"); + +print_name_list_dcl(data_list_2d_size5, "fp", + "2d.cube.size5/data-dcl.h"); +print_name_list_dcl(coeffs_list_2d_size5, "fp", + "2d.cube.size5/coeffs-dcl.h"); + +print_load_data(posn_list_2d_size5, "data->data_", + "2d.cube.size5/load-data.c"); +print_evaluate_molecule(posn_list_2d_size5, + "coeffs->coeff_", "data->data_", + "2d.cube.size5/evaluate-molecule.c"); +print_store_coeffs(posn_list_2d_size5, + "factor * coeffs->coeff_", + "2d.cube.size5/store-coeffs.c"); + +################################################################################ + +# +# generic stuff for 2d, cube, size=6 +# + +data_list_2d_size6 := map(data_var_name, posn_list_2d_size6, "data_"); +coeffs_list_2d_size6 := map(coeff_name, posn_list_2d_size6, "coeff_"); + +print_name_list_dcl(data_list_2d_size6, "fp", + "2d.cube.size6/data-dcl.h"); +print_name_list_dcl(coeffs_list_2d_size6, "fp", + "2d.cube.size6/coeffs-dcl.h"); + +print_load_data(posn_list_2d_size6, "data->data_", + "2d.cube.size6/load-data.c"); +print_evaluate_molecule(posn_list_2d_size6, + "coeffs->coeff_", "data->data_", + "2d.cube.size6/evaluate-molecule.c"); +print_store_coeffs(posn_list_2d_size6, + "factor * coeffs->coeff_", + "2d.cube.size6/store-coeffs.c"); diff --git a/src/common/3d.cube.size2/coeffs-dcl.h b/src/common/3d.cube.size2/coeffs-dcl.h new file mode 100644 index 0000000..fc144be --- /dev/null +++ b/src/common/3d.cube.size2/coeffs-dcl.h @@ -0,0 +1,8 @@ +fp coeff_0_0_0; +fp coeff_p1_0_0; +fp coeff_0_p1_0; +fp coeff_p1_p1_0; +fp coeff_0_0_p1; +fp coeff_p1_0_p1; +fp coeff_0_p1_p1; +fp coeff_p1_p1_p1; diff --git a/src/common/3d.cube.size2/data-dcl.h b/src/common/3d.cube.size2/data-dcl.h new file mode 100644 index 0000000..a45f786 --- /dev/null +++ b/src/common/3d.cube.size2/data-dcl.h @@ -0,0 +1,8 @@ +fp data_0_0_0; +fp data_p1_0_0; +fp data_0_p1_0; +fp data_p1_p1_0; +fp data_0_0_p1; +fp data_p1_0_p1; +fp data_0_p1_p1; +fp data_p1_p1_p1; diff --git a/src/common/3d.cube.size2/evaluate-molecule.c b/src/common/3d.cube.size2/evaluate-molecule.c new file mode 100644 index 0000000..ca7209f --- /dev/null +++ b/src/common/3d.cube.size2/evaluate-molecule.c @@ -0,0 +1,8 @@ + coeffs->coeff_0_0_0*data->data_0_0_0 + + coeffs->coeff_p1_0_0*data->data_p1_0_0 + + coeffs->coeff_0_p1_0*data->data_0_p1_0 + + coeffs->coeff_p1_p1_0*data->data_p1_p1_0 + + coeffs->coeff_0_0_p1*data->data_0_0_p1 + + coeffs->coeff_p1_0_p1*data->data_p1_0_p1 + + coeffs->coeff_0_p1_p1*data->data_0_p1_p1 + + coeffs->coeff_p1_p1_p1*data->data_p1_p1_p1; diff --git a/src/common/3d.cube.size2/load-data.c b/src/common/3d.cube.size2/load-data.c new file mode 100644 index 0000000..7390485 --- /dev/null +++ b/src/common/3d.cube.size2/load-data.c @@ -0,0 +1,8 @@ +data->data_0_0_0 = DATA(0,0,0); +data->data_p1_0_0 = DATA(1,0,0); +data->data_0_p1_0 = DATA(0,1,0); +data->data_p1_p1_0 = DATA(1,1,0); +data->data_0_0_p1 = DATA(0,0,1); +data->data_p1_0_p1 = DATA(1,0,1); +data->data_0_p1_p1 = DATA(0,1,1); +data->data_p1_p1_p1 = DATA(1,1,1); diff --git a/src/common/3d.cube.size2/store-coeffs.c b/src/common/3d.cube.size2/store-coeffs.c new file mode 100644 index 0000000..aa3d643 --- /dev/null +++ b/src/common/3d.cube.size2/store-coeffs.c @@ -0,0 +1,8 @@ +COEFF(0,0,0) = factor * coeffs->coeff_0_0_0; +COEFF(1,0,0) = factor * coeffs->coeff_p1_0_0; +COEFF(0,1,0) = factor * coeffs->coeff_0_p1_0; +COEFF(1,1,0) = factor * coeffs->coeff_p1_p1_0; +COEFF(0,0,1) = factor * coeffs->coeff_0_0_p1; +COEFF(1,0,1) = factor * coeffs->coeff_p1_0_p1; +COEFF(0,1,1) = factor * coeffs->coeff_0_p1_p1; +COEFF(1,1,1) = factor * coeffs->coeff_p1_p1_p1; diff --git a/src/common/3d.cube.size3/coeffs-dcl.h b/src/common/3d.cube.size3/coeffs-dcl.h new file mode 100644 index 0000000..ea8a18a --- /dev/null +++ b/src/common/3d.cube.size3/coeffs-dcl.h @@ -0,0 +1,27 @@ +fp coeff_m1_m1_m1; +fp coeff_0_m1_m1; +fp coeff_p1_m1_m1; +fp coeff_m1_0_m1; +fp coeff_0_0_m1; +fp coeff_p1_0_m1; +fp coeff_m1_p1_m1; +fp coeff_0_p1_m1; +fp coeff_p1_p1_m1; +fp coeff_m1_m1_0; +fp coeff_0_m1_0; +fp coeff_p1_m1_0; +fp coeff_m1_0_0; +fp coeff_0_0_0; +fp coeff_p1_0_0; +fp coeff_m1_p1_0; +fp coeff_0_p1_0; +fp coeff_p1_p1_0; +fp coeff_m1_m1_p1; +fp coeff_0_m1_p1; +fp coeff_p1_m1_p1; +fp coeff_m1_0_p1; +fp coeff_0_0_p1; +fp coeff_p1_0_p1; +fp coeff_m1_p1_p1; +fp coeff_0_p1_p1; +fp coeff_p1_p1_p1; diff --git a/src/common/3d.cube.size3/data-dcl.h b/src/common/3d.cube.size3/data-dcl.h new file mode 100644 index 0000000..09dd175 --- /dev/null +++ b/src/common/3d.cube.size3/data-dcl.h @@ -0,0 +1,27 @@ +fp data_m1_m1_m1; +fp data_0_m1_m1; +fp data_p1_m1_m1; +fp data_m1_0_m1; +fp data_0_0_m1; +fp data_p1_0_m1; +fp data_m1_p1_m1; +fp data_0_p1_m1; +fp data_p1_p1_m1; +fp data_m1_m1_0; +fp data_0_m1_0; +fp data_p1_m1_0; +fp data_m1_0_0; +fp data_0_0_0; +fp data_p1_0_0; +fp data_m1_p1_0; +fp data_0_p1_0; +fp data_p1_p1_0; +fp data_m1_m1_p1; +fp data_0_m1_p1; +fp data_p1_m1_p1; +fp data_m1_0_p1; +fp data_0_0_p1; +fp data_p1_0_p1; +fp data_m1_p1_p1; +fp data_0_p1_p1; +fp data_p1_p1_p1; diff --git a/src/common/3d.cube.size3/evaluate-molecule.c b/src/common/3d.cube.size3/evaluate-molecule.c new file mode 100644 index 0000000..9ed9280 --- /dev/null +++ b/src/common/3d.cube.size3/evaluate-molecule.c @@ -0,0 +1,27 @@ + coeffs->coeff_m1_m1_m1*data->data_m1_m1_m1 + + coeffs->coeff_0_m1_m1*data->data_0_m1_m1 + + coeffs->coeff_p1_m1_m1*data->data_p1_m1_m1 + + coeffs->coeff_m1_0_m1*data->data_m1_0_m1 + + coeffs->coeff_0_0_m1*data->data_0_0_m1 + + coeffs->coeff_p1_0_m1*data->data_p1_0_m1 + + coeffs->coeff_m1_p1_m1*data->data_m1_p1_m1 + + coeffs->coeff_0_p1_m1*data->data_0_p1_m1 + + coeffs->coeff_p1_p1_m1*data->data_p1_p1_m1 + + coeffs->coeff_m1_m1_0*data->data_m1_m1_0 + + coeffs->coeff_0_m1_0*data->data_0_m1_0 + + coeffs->coeff_p1_m1_0*data->data_p1_m1_0 + + coeffs->coeff_m1_0_0*data->data_m1_0_0 + + coeffs->coeff_0_0_0*data->data_0_0_0 + + coeffs->coeff_p1_0_0*data->data_p1_0_0 + + coeffs->coeff_m1_p1_0*data->data_m1_p1_0 + + coeffs->coeff_0_p1_0*data->data_0_p1_0 + + coeffs->coeff_p1_p1_0*data->data_p1_p1_0 + + coeffs->coeff_m1_m1_p1*data->data_m1_m1_p1 + + coeffs->coeff_0_m1_p1*data->data_0_m1_p1 + + coeffs->coeff_p1_m1_p1*data->data_p1_m1_p1 + + coeffs->coeff_m1_0_p1*data->data_m1_0_p1 + + coeffs->coeff_0_0_p1*data->data_0_0_p1 + + coeffs->coeff_p1_0_p1*data->data_p1_0_p1 + + coeffs->coeff_m1_p1_p1*data->data_m1_p1_p1 + + coeffs->coeff_0_p1_p1*data->data_0_p1_p1 + + coeffs->coeff_p1_p1_p1*data->data_p1_p1_p1; diff --git a/src/common/3d.cube.size3/load-data.c b/src/common/3d.cube.size3/load-data.c new file mode 100644 index 0000000..5d22113 --- /dev/null +++ b/src/common/3d.cube.size3/load-data.c @@ -0,0 +1,27 @@ +data->data_m1_m1_m1 = DATA(-1,-1,-1); +data->data_0_m1_m1 = DATA(0,-1,-1); +data->data_p1_m1_m1 = DATA(1,-1,-1); +data->data_m1_0_m1 = DATA(-1,0,-1); +data->data_0_0_m1 = DATA(0,0,-1); +data->data_p1_0_m1 = DATA(1,0,-1); +data->data_m1_p1_m1 = DATA(-1,1,-1); +data->data_0_p1_m1 = DATA(0,1,-1); +data->data_p1_p1_m1 = DATA(1,1,-1); +data->data_m1_m1_0 = DATA(-1,-1,0); +data->data_0_m1_0 = DATA(0,-1,0); +data->data_p1_m1_0 = DATA(1,-1,0); +data->data_m1_0_0 = DATA(-1,0,0); +data->data_0_0_0 = DATA(0,0,0); +data->data_p1_0_0 = DATA(1,0,0); +data->data_m1_p1_0 = DATA(-1,1,0); +data->data_0_p1_0 = DATA(0,1,0); +data->data_p1_p1_0 = DATA(1,1,0); +data->data_m1_m1_p1 = DATA(-1,-1,1); +data->data_0_m1_p1 = DATA(0,-1,1); +data->data_p1_m1_p1 = DATA(1,-1,1); +data->data_m1_0_p1 = DATA(-1,0,1); +data->data_0_0_p1 = DATA(0,0,1); +data->data_p1_0_p1 = DATA(1,0,1); +data->data_m1_p1_p1 = DATA(-1,1,1); +data->data_0_p1_p1 = DATA(0,1,1); +data->data_p1_p1_p1 = DATA(1,1,1); diff --git a/src/common/3d.cube.size3/store-coeffs.c b/src/common/3d.cube.size3/store-coeffs.c new file mode 100644 index 0000000..992d1b8 --- /dev/null +++ b/src/common/3d.cube.size3/store-coeffs.c @@ -0,0 +1,27 @@ +COEFF(-1,-1,-1) = factor * coeffs->coeff_m1_m1_m1; +COEFF(0,-1,-1) = factor * coeffs->coeff_0_m1_m1; +COEFF(1,-1,-1) = factor * coeffs->coeff_p1_m1_m1; +COEFF(-1,0,-1) = factor * coeffs->coeff_m1_0_m1; +COEFF(0,0,-1) = factor * coeffs->coeff_0_0_m1; +COEFF(1,0,-1) = factor * coeffs->coeff_p1_0_m1; +COEFF(-1,1,-1) = factor * coeffs->coeff_m1_p1_m1; +COEFF(0,1,-1) = factor * coeffs->coeff_0_p1_m1; +COEFF(1,1,-1) = factor * coeffs->coeff_p1_p1_m1; +COEFF(-1,-1,0) = factor * coeffs->coeff_m1_m1_0; +COEFF(0,-1,0) = factor * coeffs->coeff_0_m1_0; +COEFF(1,-1,0) = factor * coeffs->coeff_p1_m1_0; +COEFF(-1,0,0) = factor * coeffs->coeff_m1_0_0; +COEFF(0,0,0) = factor * coeffs->coeff_0_0_0; +COEFF(1,0,0) = factor * coeffs->coeff_p1_0_0; +COEFF(-1,1,0) = factor * coeffs->coeff_m1_p1_0; +COEFF(0,1,0) = factor * coeffs->coeff_0_p1_0; +COEFF(1,1,0) = factor * coeffs->coeff_p1_p1_0; +COEFF(-1,-1,1) = factor * coeffs->coeff_m1_m1_p1; +COEFF(0,-1,1) = factor * coeffs->coeff_0_m1_p1; +COEFF(1,-1,1) = factor * coeffs->coeff_p1_m1_p1; +COEFF(-1,0,1) = factor * coeffs->coeff_m1_0_p1; +COEFF(0,0,1) = factor * coeffs->coeff_0_0_p1; +COEFF(1,0,1) = factor * coeffs->coeff_p1_0_p1; +COEFF(-1,1,1) = factor * coeffs->coeff_m1_p1_p1; +COEFF(0,1,1) = factor * coeffs->coeff_0_p1_p1; +COEFF(1,1,1) = factor * coeffs->coeff_p1_p1_p1; diff --git a/src/common/3d.cube.size4/coeffs-dcl.h b/src/common/3d.cube.size4/coeffs-dcl.h new file mode 100644 index 0000000..8c8d0bb --- /dev/null +++ b/src/common/3d.cube.size4/coeffs-dcl.h @@ -0,0 +1,64 @@ +fp coeff_m1_m1_m1; +fp coeff_0_m1_m1; +fp coeff_p1_m1_m1; +fp coeff_p2_m1_m1; +fp coeff_m1_0_m1; +fp coeff_0_0_m1; +fp coeff_p1_0_m1; +fp coeff_p2_0_m1; +fp coeff_m1_p1_m1; +fp coeff_0_p1_m1; +fp coeff_p1_p1_m1; +fp coeff_p2_p1_m1; +fp coeff_m1_p2_m1; +fp coeff_0_p2_m1; +fp coeff_p1_p2_m1; +fp coeff_p2_p2_m1; +fp coeff_m1_m1_0; +fp coeff_0_m1_0; +fp coeff_p1_m1_0; +fp coeff_p2_m1_0; +fp coeff_m1_0_0; +fp coeff_0_0_0; +fp coeff_p1_0_0; +fp coeff_p2_0_0; +fp coeff_m1_p1_0; +fp coeff_0_p1_0; +fp coeff_p1_p1_0; +fp coeff_p2_p1_0; +fp coeff_m1_p2_0; +fp coeff_0_p2_0; +fp coeff_p1_p2_0; +fp coeff_p2_p2_0; +fp coeff_m1_m1_p1; +fp coeff_0_m1_p1; +fp coeff_p1_m1_p1; +fp coeff_p2_m1_p1; +fp coeff_m1_0_p1; +fp coeff_0_0_p1; +fp coeff_p1_0_p1; +fp coeff_p2_0_p1; +fp coeff_m1_p1_p1; +fp coeff_0_p1_p1; +fp coeff_p1_p1_p1; +fp coeff_p2_p1_p1; +fp coeff_m1_p2_p1; +fp coeff_0_p2_p1; +fp coeff_p1_p2_p1; +fp coeff_p2_p2_p1; +fp coeff_m1_m1_p2; +fp coeff_0_m1_p2; +fp coeff_p1_m1_p2; +fp coeff_p2_m1_p2; +fp coeff_m1_0_p2; +fp coeff_0_0_p2; +fp coeff_p1_0_p2; +fp coeff_p2_0_p2; +fp coeff_m1_p1_p2; +fp coeff_0_p1_p2; +fp coeff_p1_p1_p2; +fp coeff_p2_p1_p2; +fp coeff_m1_p2_p2; +fp coeff_0_p2_p2; +fp coeff_p1_p2_p2; +fp coeff_p2_p2_p2; diff --git a/src/common/3d.cube.size4/data-dcl.h b/src/common/3d.cube.size4/data-dcl.h new file mode 100644 index 0000000..dada27a --- /dev/null +++ b/src/common/3d.cube.size4/data-dcl.h @@ -0,0 +1,64 @@ +fp data_m1_m1_m1; +fp data_0_m1_m1; +fp data_p1_m1_m1; +fp data_p2_m1_m1; +fp data_m1_0_m1; +fp data_0_0_m1; +fp data_p1_0_m1; +fp data_p2_0_m1; +fp data_m1_p1_m1; +fp data_0_p1_m1; +fp data_p1_p1_m1; +fp data_p2_p1_m1; +fp data_m1_p2_m1; +fp data_0_p2_m1; +fp data_p1_p2_m1; +fp data_p2_p2_m1; +fp data_m1_m1_0; +fp data_0_m1_0; +fp data_p1_m1_0; +fp data_p2_m1_0; +fp data_m1_0_0; +fp data_0_0_0; +fp data_p1_0_0; +fp data_p2_0_0; +fp data_m1_p1_0; +fp data_0_p1_0; +fp data_p1_p1_0; +fp data_p2_p1_0; +fp data_m1_p2_0; +fp data_0_p2_0; +fp data_p1_p2_0; +fp data_p2_p2_0; +fp data_m1_m1_p1; +fp data_0_m1_p1; +fp data_p1_m1_p1; +fp data_p2_m1_p1; +fp data_m1_0_p1; +fp data_0_0_p1; +fp data_p1_0_p1; +fp data_p2_0_p1; +fp data_m1_p1_p1; +fp data_0_p1_p1; +fp data_p1_p1_p1; +fp data_p2_p1_p1; +fp data_m1_p2_p1; +fp data_0_p2_p1; +fp data_p1_p2_p1; +fp data_p2_p2_p1; +fp data_m1_m1_p2; +fp data_0_m1_p2; +fp data_p1_m1_p2; +fp data_p2_m1_p2; +fp data_m1_0_p2; +fp data_0_0_p2; +fp data_p1_0_p2; +fp data_p2_0_p2; +fp data_m1_p1_p2; +fp data_0_p1_p2; +fp data_p1_p1_p2; +fp data_p2_p1_p2; +fp data_m1_p2_p2; +fp data_0_p2_p2; +fp data_p1_p2_p2; +fp data_p2_p2_p2; diff --git a/src/common/3d.cube.size4/evaluate-molecule.c b/src/common/3d.cube.size4/evaluate-molecule.c new file mode 100644 index 0000000..124a1b5 --- /dev/null +++ b/src/common/3d.cube.size4/evaluate-molecule.c @@ -0,0 +1,64 @@ + coeffs->coeff_m1_m1_m1*data->data_m1_m1_m1 + + coeffs->coeff_0_m1_m1*data->data_0_m1_m1 + + coeffs->coeff_p1_m1_m1*data->data_p1_m1_m1 + + coeffs->coeff_p2_m1_m1*data->data_p2_m1_m1 + + coeffs->coeff_m1_0_m1*data->data_m1_0_m1 + + coeffs->coeff_0_0_m1*data->data_0_0_m1 + + coeffs->coeff_p1_0_m1*data->data_p1_0_m1 + + coeffs->coeff_p2_0_m1*data->data_p2_0_m1 + + coeffs->coeff_m1_p1_m1*data->data_m1_p1_m1 + + coeffs->coeff_0_p1_m1*data->data_0_p1_m1 + + coeffs->coeff_p1_p1_m1*data->data_p1_p1_m1 + + coeffs->coeff_p2_p1_m1*data->data_p2_p1_m1 + + coeffs->coeff_m1_p2_m1*data->data_m1_p2_m1 + + coeffs->coeff_0_p2_m1*data->data_0_p2_m1 + + coeffs->coeff_p1_p2_m1*data->data_p1_p2_m1 + + coeffs->coeff_p2_p2_m1*data->data_p2_p2_m1 + + coeffs->coeff_m1_m1_0*data->data_m1_m1_0 + + coeffs->coeff_0_m1_0*data->data_0_m1_0 + + coeffs->coeff_p1_m1_0*data->data_p1_m1_0 + + coeffs->coeff_p2_m1_0*data->data_p2_m1_0 + + coeffs->coeff_m1_0_0*data->data_m1_0_0 + + coeffs->coeff_0_0_0*data->data_0_0_0 + + coeffs->coeff_p1_0_0*data->data_p1_0_0 + + coeffs->coeff_p2_0_0*data->data_p2_0_0 + + coeffs->coeff_m1_p1_0*data->data_m1_p1_0 + + coeffs->coeff_0_p1_0*data->data_0_p1_0 + + coeffs->coeff_p1_p1_0*data->data_p1_p1_0 + + coeffs->coeff_p2_p1_0*data->data_p2_p1_0 + + coeffs->coeff_m1_p2_0*data->data_m1_p2_0 + + coeffs->coeff_0_p2_0*data->data_0_p2_0 + + coeffs->coeff_p1_p2_0*data->data_p1_p2_0 + + coeffs->coeff_p2_p2_0*data->data_p2_p2_0 + + coeffs->coeff_m1_m1_p1*data->data_m1_m1_p1 + + coeffs->coeff_0_m1_p1*data->data_0_m1_p1 + + coeffs->coeff_p1_m1_p1*data->data_p1_m1_p1 + + coeffs->coeff_p2_m1_p1*data->data_p2_m1_p1 + + coeffs->coeff_m1_0_p1*data->data_m1_0_p1 + + coeffs->coeff_0_0_p1*data->data_0_0_p1 + + coeffs->coeff_p1_0_p1*data->data_p1_0_p1 + + coeffs->coeff_p2_0_p1*data->data_p2_0_p1 + + coeffs->coeff_m1_p1_p1*data->data_m1_p1_p1 + + coeffs->coeff_0_p1_p1*data->data_0_p1_p1 + + coeffs->coeff_p1_p1_p1*data->data_p1_p1_p1 + + coeffs->coeff_p2_p1_p1*data->data_p2_p1_p1 + + coeffs->coeff_m1_p2_p1*data->data_m1_p2_p1 + + coeffs->coeff_0_p2_p1*data->data_0_p2_p1 + + coeffs->coeff_p1_p2_p1*data->data_p1_p2_p1 + + coeffs->coeff_p2_p2_p1*data->data_p2_p2_p1 + + coeffs->coeff_m1_m1_p2*data->data_m1_m1_p2 + + coeffs->coeff_0_m1_p2*data->data_0_m1_p2 + + coeffs->coeff_p1_m1_p2*data->data_p1_m1_p2 + + coeffs->coeff_p2_m1_p2*data->data_p2_m1_p2 + + coeffs->coeff_m1_0_p2*data->data_m1_0_p2 + + coeffs->coeff_0_0_p2*data->data_0_0_p2 + + coeffs->coeff_p1_0_p2*data->data_p1_0_p2 + + coeffs->coeff_p2_0_p2*data->data_p2_0_p2 + + coeffs->coeff_m1_p1_p2*data->data_m1_p1_p2 + + coeffs->coeff_0_p1_p2*data->data_0_p1_p2 + + coeffs->coeff_p1_p1_p2*data->data_p1_p1_p2 + + coeffs->coeff_p2_p1_p2*data->data_p2_p1_p2 + + coeffs->coeff_m1_p2_p2*data->data_m1_p2_p2 + + coeffs->coeff_0_p2_p2*data->data_0_p2_p2 + + coeffs->coeff_p1_p2_p2*data->data_p1_p2_p2 + + coeffs->coeff_p2_p2_p2*data->data_p2_p2_p2; diff --git a/src/common/3d.cube.size4/load-data.c b/src/common/3d.cube.size4/load-data.c new file mode 100644 index 0000000..b520c48 --- /dev/null +++ b/src/common/3d.cube.size4/load-data.c @@ -0,0 +1,64 @@ +data->data_m1_m1_m1 = DATA(-1,-1,-1); +data->data_0_m1_m1 = DATA(0,-1,-1); +data->data_p1_m1_m1 = DATA(1,-1,-1); +data->data_p2_m1_m1 = DATA(2,-1,-1); +data->data_m1_0_m1 = DATA(-1,0,-1); +data->data_0_0_m1 = DATA(0,0,-1); +data->data_p1_0_m1 = DATA(1,0,-1); +data->data_p2_0_m1 = DATA(2,0,-1); +data->data_m1_p1_m1 = DATA(-1,1,-1); +data->data_0_p1_m1 = DATA(0,1,-1); +data->data_p1_p1_m1 = DATA(1,1,-1); +data->data_p2_p1_m1 = DATA(2,1,-1); +data->data_m1_p2_m1 = DATA(-1,2,-1); +data->data_0_p2_m1 = DATA(0,2,-1); +data->data_p1_p2_m1 = DATA(1,2,-1); +data->data_p2_p2_m1 = DATA(2,2,-1); +data->data_m1_m1_0 = DATA(-1,-1,0); +data->data_0_m1_0 = DATA(0,-1,0); +data->data_p1_m1_0 = DATA(1,-1,0); +data->data_p2_m1_0 = DATA(2,-1,0); +data->data_m1_0_0 = DATA(-1,0,0); +data->data_0_0_0 = DATA(0,0,0); +data->data_p1_0_0 = DATA(1,0,0); +data->data_p2_0_0 = DATA(2,0,0); +data->data_m1_p1_0 = DATA(-1,1,0); +data->data_0_p1_0 = DATA(0,1,0); +data->data_p1_p1_0 = DATA(1,1,0); +data->data_p2_p1_0 = DATA(2,1,0); +data->data_m1_p2_0 = DATA(-1,2,0); +data->data_0_p2_0 = DATA(0,2,0); +data->data_p1_p2_0 = DATA(1,2,0); +data->data_p2_p2_0 = DATA(2,2,0); +data->data_m1_m1_p1 = DATA(-1,-1,1); +data->data_0_m1_p1 = DATA(0,-1,1); +data->data_p1_m1_p1 = DATA(1,-1,1); +data->data_p2_m1_p1 = DATA(2,-1,1); +data->data_m1_0_p1 = DATA(-1,0,1); +data->data_0_0_p1 = DATA(0,0,1); +data->data_p1_0_p1 = DATA(1,0,1); +data->data_p2_0_p1 = DATA(2,0,1); +data->data_m1_p1_p1 = DATA(-1,1,1); +data->data_0_p1_p1 = DATA(0,1,1); +data->data_p1_p1_p1 = DATA(1,1,1); +data->data_p2_p1_p1 = DATA(2,1,1); +data->data_m1_p2_p1 = DATA(-1,2,1); +data->data_0_p2_p1 = DATA(0,2,1); +data->data_p1_p2_p1 = DATA(1,2,1); +data->data_p2_p2_p1 = DATA(2,2,1); +data->data_m1_m1_p2 = DATA(-1,-1,2); +data->data_0_m1_p2 = DATA(0,-1,2); +data->data_p1_m1_p2 = DATA(1,-1,2); +data->data_p2_m1_p2 = DATA(2,-1,2); +data->data_m1_0_p2 = DATA(-1,0,2); +data->data_0_0_p2 = DATA(0,0,2); +data->data_p1_0_p2 = DATA(1,0,2); +data->data_p2_0_p2 = DATA(2,0,2); +data->data_m1_p1_p2 = DATA(-1,1,2); +data->data_0_p1_p2 = DATA(0,1,2); +data->data_p1_p1_p2 = DATA(1,1,2); +data->data_p2_p1_p2 = DATA(2,1,2); +data->data_m1_p2_p2 = DATA(-1,2,2); +data->data_0_p2_p2 = DATA(0,2,2); +data->data_p1_p2_p2 = DATA(1,2,2); +data->data_p2_p2_p2 = DATA(2,2,2); diff --git a/src/common/3d.cube.size4/store-coeffs.c b/src/common/3d.cube.size4/store-coeffs.c new file mode 100644 index 0000000..9f06dff --- /dev/null +++ b/src/common/3d.cube.size4/store-coeffs.c @@ -0,0 +1,64 @@ +COEFF(-1,-1,-1) = factor * coeffs->coeff_m1_m1_m1; +COEFF(0,-1,-1) = factor * coeffs->coeff_0_m1_m1; +COEFF(1,-1,-1) = factor * coeffs->coeff_p1_m1_m1; +COEFF(2,-1,-1) = factor * coeffs->coeff_p2_m1_m1; +COEFF(-1,0,-1) = factor * coeffs->coeff_m1_0_m1; +COEFF(0,0,-1) = factor * coeffs->coeff_0_0_m1; +COEFF(1,0,-1) = factor * coeffs->coeff_p1_0_m1; +COEFF(2,0,-1) = factor * coeffs->coeff_p2_0_m1; +COEFF(-1,1,-1) = factor * coeffs->coeff_m1_p1_m1; +COEFF(0,1,-1) = factor * coeffs->coeff_0_p1_m1; +COEFF(1,1,-1) = factor * coeffs->coeff_p1_p1_m1; +COEFF(2,1,-1) = factor * coeffs->coeff_p2_p1_m1; +COEFF(-1,2,-1) = factor * coeffs->coeff_m1_p2_m1; +COEFF(0,2,-1) = factor * coeffs->coeff_0_p2_m1; +COEFF(1,2,-1) = factor * coeffs->coeff_p1_p2_m1; +COEFF(2,2,-1) = factor * coeffs->coeff_p2_p2_m1; +COEFF(-1,-1,0) = factor * coeffs->coeff_m1_m1_0; +COEFF(0,-1,0) = factor * coeffs->coeff_0_m1_0; +COEFF(1,-1,0) = factor * coeffs->coeff_p1_m1_0; +COEFF(2,-1,0) = factor * coeffs->coeff_p2_m1_0; +COEFF(-1,0,0) = factor * coeffs->coeff_m1_0_0; +COEFF(0,0,0) = factor * coeffs->coeff_0_0_0; +COEFF(1,0,0) = factor * coeffs->coeff_p1_0_0; +COEFF(2,0,0) = factor * coeffs->coeff_p2_0_0; +COEFF(-1,1,0) = factor * coeffs->coeff_m1_p1_0; +COEFF(0,1,0) = factor * coeffs->coeff_0_p1_0; +COEFF(1,1,0) = factor * coeffs->coeff_p1_p1_0; +COEFF(2,1,0) = factor * coeffs->coeff_p2_p1_0; +COEFF(-1,2,0) = factor * coeffs->coeff_m1_p2_0; +COEFF(0,2,0) = factor * coeffs->coeff_0_p2_0; +COEFF(1,2,0) = factor * coeffs->coeff_p1_p2_0; +COEFF(2,2,0) = factor * coeffs->coeff_p2_p2_0; +COEFF(-1,-1,1) = factor * coeffs->coeff_m1_m1_p1; +COEFF(0,-1,1) = factor * coeffs->coeff_0_m1_p1; +COEFF(1,-1,1) = factor * coeffs->coeff_p1_m1_p1; +COEFF(2,-1,1) = factor * coeffs->coeff_p2_m1_p1; +COEFF(-1,0,1) = factor * coeffs->coeff_m1_0_p1; +COEFF(0,0,1) = factor * coeffs->coeff_0_0_p1; +COEFF(1,0,1) = factor * coeffs->coeff_p1_0_p1; +COEFF(2,0,1) = factor * coeffs->coeff_p2_0_p1; +COEFF(-1,1,1) = factor * coeffs->coeff_m1_p1_p1; +COEFF(0,1,1) = factor * coeffs->coeff_0_p1_p1; +COEFF(1,1,1) = factor * coeffs->coeff_p1_p1_p1; +COEFF(2,1,1) = factor * coeffs->coeff_p2_p1_p1; +COEFF(-1,2,1) = factor * coeffs->coeff_m1_p2_p1; +COEFF(0,2,1) = factor * coeffs->coeff_0_p2_p1; +COEFF(1,2,1) = factor * coeffs->coeff_p1_p2_p1; +COEFF(2,2,1) = factor * coeffs->coeff_p2_p2_p1; +COEFF(-1,-1,2) = factor * coeffs->coeff_m1_m1_p2; +COEFF(0,-1,2) = factor * coeffs->coeff_0_m1_p2; +COEFF(1,-1,2) = factor * coeffs->coeff_p1_m1_p2; +COEFF(2,-1,2) = factor * coeffs->coeff_p2_m1_p2; +COEFF(-1,0,2) = factor * coeffs->coeff_m1_0_p2; +COEFF(0,0,2) = factor * coeffs->coeff_0_0_p2; +COEFF(1,0,2) = factor * coeffs->coeff_p1_0_p2; +COEFF(2,0,2) = factor * coeffs->coeff_p2_0_p2; +COEFF(-1,1,2) = factor * coeffs->coeff_m1_p1_p2; +COEFF(0,1,2) = factor * coeffs->coeff_0_p1_p2; +COEFF(1,1,2) = factor * coeffs->coeff_p1_p1_p2; +COEFF(2,1,2) = factor * coeffs->coeff_p2_p1_p2; +COEFF(-1,2,2) = factor * coeffs->coeff_m1_p2_p2; +COEFF(0,2,2) = factor * coeffs->coeff_0_p2_p2; +COEFF(1,2,2) = factor * coeffs->coeff_p1_p2_p2; +COEFF(2,2,2) = factor * coeffs->coeff_p2_p2_p2; diff --git a/src/common/3d.cube.size5/coeffs-dcl.h b/src/common/3d.cube.size5/coeffs-dcl.h new file mode 100644 index 0000000..94fdc84 --- /dev/null +++ b/src/common/3d.cube.size5/coeffs-dcl.h @@ -0,0 +1,125 @@ +fp coeff_m2_m2_m2; +fp coeff_m1_m2_m2; +fp coeff_0_m2_m2; +fp coeff_p1_m2_m2; +fp coeff_p2_m2_m2; +fp coeff_m2_m1_m2; +fp coeff_m1_m1_m2; +fp coeff_0_m1_m2; +fp coeff_p1_m1_m2; +fp coeff_p2_m1_m2; +fp coeff_m2_0_m2; +fp coeff_m1_0_m2; +fp coeff_0_0_m2; +fp coeff_p1_0_m2; +fp coeff_p2_0_m2; +fp coeff_m2_p1_m2; +fp coeff_m1_p1_m2; +fp coeff_0_p1_m2; +fp coeff_p1_p1_m2; +fp coeff_p2_p1_m2; +fp coeff_m2_p2_m2; +fp coeff_m1_p2_m2; +fp coeff_0_p2_m2; +fp coeff_p1_p2_m2; +fp coeff_p2_p2_m2; +fp coeff_m2_m2_m1; +fp coeff_m1_m2_m1; +fp coeff_0_m2_m1; +fp coeff_p1_m2_m1; +fp coeff_p2_m2_m1; +fp coeff_m2_m1_m1; +fp coeff_m1_m1_m1; +fp coeff_0_m1_m1; +fp coeff_p1_m1_m1; +fp coeff_p2_m1_m1; +fp coeff_m2_0_m1; +fp coeff_m1_0_m1; +fp coeff_0_0_m1; +fp coeff_p1_0_m1; +fp coeff_p2_0_m1; +fp coeff_m2_p1_m1; +fp coeff_m1_p1_m1; +fp coeff_0_p1_m1; +fp coeff_p1_p1_m1; +fp coeff_p2_p1_m1; +fp coeff_m2_p2_m1; +fp coeff_m1_p2_m1; +fp coeff_0_p2_m1; +fp coeff_p1_p2_m1; +fp coeff_p2_p2_m1; +fp coeff_m2_m2_0; +fp coeff_m1_m2_0; +fp coeff_0_m2_0; +fp coeff_p1_m2_0; +fp coeff_p2_m2_0; +fp coeff_m2_m1_0; +fp coeff_m1_m1_0; +fp coeff_0_m1_0; +fp coeff_p1_m1_0; +fp coeff_p2_m1_0; +fp coeff_m2_0_0; +fp coeff_m1_0_0; +fp coeff_0_0_0; +fp coeff_p1_0_0; +fp coeff_p2_0_0; +fp coeff_m2_p1_0; +fp coeff_m1_p1_0; +fp coeff_0_p1_0; +fp coeff_p1_p1_0; +fp coeff_p2_p1_0; +fp coeff_m2_p2_0; +fp coeff_m1_p2_0; +fp coeff_0_p2_0; +fp coeff_p1_p2_0; +fp coeff_p2_p2_0; +fp coeff_m2_m2_p1; +fp coeff_m1_m2_p1; +fp coeff_0_m2_p1; +fp coeff_p1_m2_p1; +fp coeff_p2_m2_p1; +fp coeff_m2_m1_p1; +fp coeff_m1_m1_p1; +fp coeff_0_m1_p1; +fp coeff_p1_m1_p1; +fp coeff_p2_m1_p1; +fp coeff_m2_0_p1; +fp coeff_m1_0_p1; +fp coeff_0_0_p1; +fp coeff_p1_0_p1; +fp coeff_p2_0_p1; +fp coeff_m2_p1_p1; +fp coeff_m1_p1_p1; +fp coeff_0_p1_p1; +fp coeff_p1_p1_p1; +fp coeff_p2_p1_p1; +fp coeff_m2_p2_p1; +fp coeff_m1_p2_p1; +fp coeff_0_p2_p1; +fp coeff_p1_p2_p1; +fp coeff_p2_p2_p1; +fp coeff_m2_m2_p2; +fp coeff_m1_m2_p2; +fp coeff_0_m2_p2; +fp coeff_p1_m2_p2; +fp coeff_p2_m2_p2; +fp coeff_m2_m1_p2; +fp coeff_m1_m1_p2; +fp coeff_0_m1_p2; +fp coeff_p1_m1_p2; +fp coeff_p2_m1_p2; +fp coeff_m2_0_p2; +fp coeff_m1_0_p2; +fp coeff_0_0_p2; +fp coeff_p1_0_p2; +fp coeff_p2_0_p2; +fp coeff_m2_p1_p2; +fp coeff_m1_p1_p2; +fp coeff_0_p1_p2; +fp coeff_p1_p1_p2; +fp coeff_p2_p1_p2; +fp coeff_m2_p2_p2; +fp coeff_m1_p2_p2; +fp coeff_0_p2_p2; +fp coeff_p1_p2_p2; +fp coeff_p2_p2_p2; diff --git a/src/common/3d.cube.size5/data-dcl.h b/src/common/3d.cube.size5/data-dcl.h new file mode 100644 index 0000000..f47ae87 --- /dev/null +++ b/src/common/3d.cube.size5/data-dcl.h @@ -0,0 +1,125 @@ +fp data_m2_m2_m2; +fp data_m1_m2_m2; +fp data_0_m2_m2; +fp data_p1_m2_m2; +fp data_p2_m2_m2; +fp data_m2_m1_m2; +fp data_m1_m1_m2; +fp data_0_m1_m2; +fp data_p1_m1_m2; +fp data_p2_m1_m2; +fp data_m2_0_m2; +fp data_m1_0_m2; +fp data_0_0_m2; +fp data_p1_0_m2; +fp data_p2_0_m2; +fp data_m2_p1_m2; +fp data_m1_p1_m2; +fp data_0_p1_m2; +fp data_p1_p1_m2; +fp data_p2_p1_m2; +fp data_m2_p2_m2; +fp data_m1_p2_m2; +fp data_0_p2_m2; +fp data_p1_p2_m2; +fp data_p2_p2_m2; +fp data_m2_m2_m1; +fp data_m1_m2_m1; +fp data_0_m2_m1; +fp data_p1_m2_m1; +fp data_p2_m2_m1; +fp data_m2_m1_m1; +fp data_m1_m1_m1; +fp data_0_m1_m1; +fp data_p1_m1_m1; +fp data_p2_m1_m1; +fp data_m2_0_m1; +fp data_m1_0_m1; +fp data_0_0_m1; +fp data_p1_0_m1; +fp data_p2_0_m1; +fp data_m2_p1_m1; +fp data_m1_p1_m1; +fp data_0_p1_m1; +fp data_p1_p1_m1; +fp data_p2_p1_m1; +fp data_m2_p2_m1; +fp data_m1_p2_m1; +fp data_0_p2_m1; +fp data_p1_p2_m1; +fp data_p2_p2_m1; +fp data_m2_m2_0; +fp data_m1_m2_0; +fp data_0_m2_0; +fp data_p1_m2_0; +fp data_p2_m2_0; +fp data_m2_m1_0; +fp data_m1_m1_0; +fp data_0_m1_0; +fp data_p1_m1_0; +fp data_p2_m1_0; +fp data_m2_0_0; +fp data_m1_0_0; +fp data_0_0_0; +fp data_p1_0_0; +fp data_p2_0_0; +fp data_m2_p1_0; +fp data_m1_p1_0; +fp data_0_p1_0; +fp data_p1_p1_0; +fp data_p2_p1_0; +fp data_m2_p2_0; +fp data_m1_p2_0; +fp data_0_p2_0; +fp data_p1_p2_0; +fp data_p2_p2_0; +fp data_m2_m2_p1; +fp data_m1_m2_p1; +fp data_0_m2_p1; +fp data_p1_m2_p1; +fp data_p2_m2_p1; +fp data_m2_m1_p1; +fp data_m1_m1_p1; +fp data_0_m1_p1; +fp data_p1_m1_p1; +fp data_p2_m1_p1; +fp data_m2_0_p1; +fp data_m1_0_p1; +fp data_0_0_p1; +fp data_p1_0_p1; +fp data_p2_0_p1; +fp data_m2_p1_p1; +fp data_m1_p1_p1; +fp data_0_p1_p1; +fp data_p1_p1_p1; +fp data_p2_p1_p1; +fp data_m2_p2_p1; +fp data_m1_p2_p1; +fp data_0_p2_p1; +fp data_p1_p2_p1; +fp data_p2_p2_p1; +fp data_m2_m2_p2; +fp data_m1_m2_p2; +fp data_0_m2_p2; +fp data_p1_m2_p2; +fp data_p2_m2_p2; +fp data_m2_m1_p2; +fp data_m1_m1_p2; +fp data_0_m1_p2; +fp data_p1_m1_p2; +fp data_p2_m1_p2; +fp data_m2_0_p2; +fp data_m1_0_p2; +fp data_0_0_p2; +fp data_p1_0_p2; +fp data_p2_0_p2; +fp data_m2_p1_p2; +fp data_m1_p1_p2; +fp data_0_p1_p2; +fp data_p1_p1_p2; +fp data_p2_p1_p2; +fp data_m2_p2_p2; +fp data_m1_p2_p2; +fp data_0_p2_p2; +fp data_p1_p2_p2; +fp data_p2_p2_p2; diff --git a/src/common/3d.cube.size5/evaluate-molecule.c b/src/common/3d.cube.size5/evaluate-molecule.c new file mode 100644 index 0000000..ec124a3 --- /dev/null +++ b/src/common/3d.cube.size5/evaluate-molecule.c @@ -0,0 +1,125 @@ + coeffs->coeff_m2_m2_m2*data->data_m2_m2_m2 + + coeffs->coeff_m1_m2_m2*data->data_m1_m2_m2 + + coeffs->coeff_0_m2_m2*data->data_0_m2_m2 + + coeffs->coeff_p1_m2_m2*data->data_p1_m2_m2 + + coeffs->coeff_p2_m2_m2*data->data_p2_m2_m2 + + coeffs->coeff_m2_m1_m2*data->data_m2_m1_m2 + + coeffs->coeff_m1_m1_m2*data->data_m1_m1_m2 + + coeffs->coeff_0_m1_m2*data->data_0_m1_m2 + + coeffs->coeff_p1_m1_m2*data->data_p1_m1_m2 + + coeffs->coeff_p2_m1_m2*data->data_p2_m1_m2 + + coeffs->coeff_m2_0_m2*data->data_m2_0_m2 + + coeffs->coeff_m1_0_m2*data->data_m1_0_m2 + + coeffs->coeff_0_0_m2*data->data_0_0_m2 + + coeffs->coeff_p1_0_m2*data->data_p1_0_m2 + + coeffs->coeff_p2_0_m2*data->data_p2_0_m2 + + coeffs->coeff_m2_p1_m2*data->data_m2_p1_m2 + + coeffs->coeff_m1_p1_m2*data->data_m1_p1_m2 + + coeffs->coeff_0_p1_m2*data->data_0_p1_m2 + + coeffs->coeff_p1_p1_m2*data->data_p1_p1_m2 + + coeffs->coeff_p2_p1_m2*data->data_p2_p1_m2 + + coeffs->coeff_m2_p2_m2*data->data_m2_p2_m2 + + coeffs->coeff_m1_p2_m2*data->data_m1_p2_m2 + + coeffs->coeff_0_p2_m2*data->data_0_p2_m2 + + coeffs->coeff_p1_p2_m2*data->data_p1_p2_m2 + + coeffs->coeff_p2_p2_m2*data->data_p2_p2_m2 + + coeffs->coeff_m2_m2_m1*data->data_m2_m2_m1 + + coeffs->coeff_m1_m2_m1*data->data_m1_m2_m1 + + coeffs->coeff_0_m2_m1*data->data_0_m2_m1 + + coeffs->coeff_p1_m2_m1*data->data_p1_m2_m1 + + coeffs->coeff_p2_m2_m1*data->data_p2_m2_m1 + + coeffs->coeff_m2_m1_m1*data->data_m2_m1_m1 + + coeffs->coeff_m1_m1_m1*data->data_m1_m1_m1 + + coeffs->coeff_0_m1_m1*data->data_0_m1_m1 + + coeffs->coeff_p1_m1_m1*data->data_p1_m1_m1 + + coeffs->coeff_p2_m1_m1*data->data_p2_m1_m1 + + coeffs->coeff_m2_0_m1*data->data_m2_0_m1 + + coeffs->coeff_m1_0_m1*data->data_m1_0_m1 + + coeffs->coeff_0_0_m1*data->data_0_0_m1 + + coeffs->coeff_p1_0_m1*data->data_p1_0_m1 + + coeffs->coeff_p2_0_m1*data->data_p2_0_m1 + + coeffs->coeff_m2_p1_m1*data->data_m2_p1_m1 + + coeffs->coeff_m1_p1_m1*data->data_m1_p1_m1 + + coeffs->coeff_0_p1_m1*data->data_0_p1_m1 + + coeffs->coeff_p1_p1_m1*data->data_p1_p1_m1 + + coeffs->coeff_p2_p1_m1*data->data_p2_p1_m1 + + coeffs->coeff_m2_p2_m1*data->data_m2_p2_m1 + + coeffs->coeff_m1_p2_m1*data->data_m1_p2_m1 + + coeffs->coeff_0_p2_m1*data->data_0_p2_m1 + + coeffs->coeff_p1_p2_m1*data->data_p1_p2_m1 + + coeffs->coeff_p2_p2_m1*data->data_p2_p2_m1 + + coeffs->coeff_m2_m2_0*data->data_m2_m2_0 + + coeffs->coeff_m1_m2_0*data->data_m1_m2_0 + + coeffs->coeff_0_m2_0*data->data_0_m2_0 + + coeffs->coeff_p1_m2_0*data->data_p1_m2_0 + + coeffs->coeff_p2_m2_0*data->data_p2_m2_0 + + coeffs->coeff_m2_m1_0*data->data_m2_m1_0 + + coeffs->coeff_m1_m1_0*data->data_m1_m1_0 + + coeffs->coeff_0_m1_0*data->data_0_m1_0 + + coeffs->coeff_p1_m1_0*data->data_p1_m1_0 + + coeffs->coeff_p2_m1_0*data->data_p2_m1_0 + + coeffs->coeff_m2_0_0*data->data_m2_0_0 + + coeffs->coeff_m1_0_0*data->data_m1_0_0 + + coeffs->coeff_0_0_0*data->data_0_0_0 + + coeffs->coeff_p1_0_0*data->data_p1_0_0 + + coeffs->coeff_p2_0_0*data->data_p2_0_0 + + coeffs->coeff_m2_p1_0*data->data_m2_p1_0 + + coeffs->coeff_m1_p1_0*data->data_m1_p1_0 + + coeffs->coeff_0_p1_0*data->data_0_p1_0 + + coeffs->coeff_p1_p1_0*data->data_p1_p1_0 + + coeffs->coeff_p2_p1_0*data->data_p2_p1_0 + + coeffs->coeff_m2_p2_0*data->data_m2_p2_0 + + coeffs->coeff_m1_p2_0*data->data_m1_p2_0 + + coeffs->coeff_0_p2_0*data->data_0_p2_0 + + coeffs->coeff_p1_p2_0*data->data_p1_p2_0 + + coeffs->coeff_p2_p2_0*data->data_p2_p2_0 + + coeffs->coeff_m2_m2_p1*data->data_m2_m2_p1 + + coeffs->coeff_m1_m2_p1*data->data_m1_m2_p1 + + coeffs->coeff_0_m2_p1*data->data_0_m2_p1 + + coeffs->coeff_p1_m2_p1*data->data_p1_m2_p1 + + coeffs->coeff_p2_m2_p1*data->data_p2_m2_p1 + + coeffs->coeff_m2_m1_p1*data->data_m2_m1_p1 + + coeffs->coeff_m1_m1_p1*data->data_m1_m1_p1 + + coeffs->coeff_0_m1_p1*data->data_0_m1_p1 + + coeffs->coeff_p1_m1_p1*data->data_p1_m1_p1 + + coeffs->coeff_p2_m1_p1*data->data_p2_m1_p1 + + coeffs->coeff_m2_0_p1*data->data_m2_0_p1 + + coeffs->coeff_m1_0_p1*data->data_m1_0_p1 + + coeffs->coeff_0_0_p1*data->data_0_0_p1 + + coeffs->coeff_p1_0_p1*data->data_p1_0_p1 + + coeffs->coeff_p2_0_p1*data->data_p2_0_p1 + + coeffs->coeff_m2_p1_p1*data->data_m2_p1_p1 + + coeffs->coeff_m1_p1_p1*data->data_m1_p1_p1 + + coeffs->coeff_0_p1_p1*data->data_0_p1_p1 + + coeffs->coeff_p1_p1_p1*data->data_p1_p1_p1 + + coeffs->coeff_p2_p1_p1*data->data_p2_p1_p1 + + coeffs->coeff_m2_p2_p1*data->data_m2_p2_p1 + + coeffs->coeff_m1_p2_p1*data->data_m1_p2_p1 + + coeffs->coeff_0_p2_p1*data->data_0_p2_p1 + + coeffs->coeff_p1_p2_p1*data->data_p1_p2_p1 + + coeffs->coeff_p2_p2_p1*data->data_p2_p2_p1 + + coeffs->coeff_m2_m2_p2*data->data_m2_m2_p2 + + coeffs->coeff_m1_m2_p2*data->data_m1_m2_p2 + + coeffs->coeff_0_m2_p2*data->data_0_m2_p2 + + coeffs->coeff_p1_m2_p2*data->data_p1_m2_p2 + + coeffs->coeff_p2_m2_p2*data->data_p2_m2_p2 + + coeffs->coeff_m2_m1_p2*data->data_m2_m1_p2 + + coeffs->coeff_m1_m1_p2*data->data_m1_m1_p2 + + coeffs->coeff_0_m1_p2*data->data_0_m1_p2 + + coeffs->coeff_p1_m1_p2*data->data_p1_m1_p2 + + coeffs->coeff_p2_m1_p2*data->data_p2_m1_p2 + + coeffs->coeff_m2_0_p2*data->data_m2_0_p2 + + coeffs->coeff_m1_0_p2*data->data_m1_0_p2 + + coeffs->coeff_0_0_p2*data->data_0_0_p2 + + coeffs->coeff_p1_0_p2*data->data_p1_0_p2 + + coeffs->coeff_p2_0_p2*data->data_p2_0_p2 + + coeffs->coeff_m2_p1_p2*data->data_m2_p1_p2 + + coeffs->coeff_m1_p1_p2*data->data_m1_p1_p2 + + coeffs->coeff_0_p1_p2*data->data_0_p1_p2 + + coeffs->coeff_p1_p1_p2*data->data_p1_p1_p2 + + coeffs->coeff_p2_p1_p2*data->data_p2_p1_p2 + + coeffs->coeff_m2_p2_p2*data->data_m2_p2_p2 + + coeffs->coeff_m1_p2_p2*data->data_m1_p2_p2 + + coeffs->coeff_0_p2_p2*data->data_0_p2_p2 + + coeffs->coeff_p1_p2_p2*data->data_p1_p2_p2 + + coeffs->coeff_p2_p2_p2*data->data_p2_p2_p2; diff --git a/src/common/3d.cube.size5/load-data.c b/src/common/3d.cube.size5/load-data.c new file mode 100644 index 0000000..386ac90 --- /dev/null +++ b/src/common/3d.cube.size5/load-data.c @@ -0,0 +1,125 @@ +data->data_m2_m2_m2 = DATA(-2,-2,-2); +data->data_m1_m2_m2 = DATA(-1,-2,-2); +data->data_0_m2_m2 = DATA(0,-2,-2); +data->data_p1_m2_m2 = DATA(1,-2,-2); +data->data_p2_m2_m2 = DATA(2,-2,-2); +data->data_m2_m1_m2 = DATA(-2,-1,-2); +data->data_m1_m1_m2 = DATA(-1,-1,-2); +data->data_0_m1_m2 = DATA(0,-1,-2); +data->data_p1_m1_m2 = DATA(1,-1,-2); +data->data_p2_m1_m2 = DATA(2,-1,-2); +data->data_m2_0_m2 = DATA(-2,0,-2); +data->data_m1_0_m2 = DATA(-1,0,-2); +data->data_0_0_m2 = DATA(0,0,-2); +data->data_p1_0_m2 = DATA(1,0,-2); +data->data_p2_0_m2 = DATA(2,0,-2); +data->data_m2_p1_m2 = DATA(-2,1,-2); +data->data_m1_p1_m2 = DATA(-1,1,-2); +data->data_0_p1_m2 = DATA(0,1,-2); +data->data_p1_p1_m2 = DATA(1,1,-2); +data->data_p2_p1_m2 = DATA(2,1,-2); +data->data_m2_p2_m2 = DATA(-2,2,-2); +data->data_m1_p2_m2 = DATA(-1,2,-2); +data->data_0_p2_m2 = DATA(0,2,-2); +data->data_p1_p2_m2 = DATA(1,2,-2); +data->data_p2_p2_m2 = DATA(2,2,-2); +data->data_m2_m2_m1 = DATA(-2,-2,-1); +data->data_m1_m2_m1 = DATA(-1,-2,-1); +data->data_0_m2_m1 = DATA(0,-2,-1); +data->data_p1_m2_m1 = DATA(1,-2,-1); +data->data_p2_m2_m1 = DATA(2,-2,-1); +data->data_m2_m1_m1 = DATA(-2,-1,-1); +data->data_m1_m1_m1 = DATA(-1,-1,-1); +data->data_0_m1_m1 = DATA(0,-1,-1); +data->data_p1_m1_m1 = DATA(1,-1,-1); +data->data_p2_m1_m1 = DATA(2,-1,-1); +data->data_m2_0_m1 = DATA(-2,0,-1); +data->data_m1_0_m1 = DATA(-1,0,-1); +data->data_0_0_m1 = DATA(0,0,-1); +data->data_p1_0_m1 = DATA(1,0,-1); +data->data_p2_0_m1 = DATA(2,0,-1); +data->data_m2_p1_m1 = DATA(-2,1,-1); +data->data_m1_p1_m1 = DATA(-1,1,-1); +data->data_0_p1_m1 = DATA(0,1,-1); +data->data_p1_p1_m1 = DATA(1,1,-1); +data->data_p2_p1_m1 = DATA(2,1,-1); +data->data_m2_p2_m1 = DATA(-2,2,-1); +data->data_m1_p2_m1 = DATA(-1,2,-1); +data->data_0_p2_m1 = DATA(0,2,-1); +data->data_p1_p2_m1 = DATA(1,2,-1); +data->data_p2_p2_m1 = DATA(2,2,-1); +data->data_m2_m2_0 = DATA(-2,-2,0); +data->data_m1_m2_0 = DATA(-1,-2,0); +data->data_0_m2_0 = DATA(0,-2,0); +data->data_p1_m2_0 = DATA(1,-2,0); +data->data_p2_m2_0 = DATA(2,-2,0); +data->data_m2_m1_0 = DATA(-2,-1,0); +data->data_m1_m1_0 = DATA(-1,-1,0); +data->data_0_m1_0 = DATA(0,-1,0); +data->data_p1_m1_0 = DATA(1,-1,0); +data->data_p2_m1_0 = DATA(2,-1,0); +data->data_m2_0_0 = DATA(-2,0,0); +data->data_m1_0_0 = DATA(-1,0,0); +data->data_0_0_0 = DATA(0,0,0); +data->data_p1_0_0 = DATA(1,0,0); +data->data_p2_0_0 = DATA(2,0,0); +data->data_m2_p1_0 = DATA(-2,1,0); +data->data_m1_p1_0 = DATA(-1,1,0); +data->data_0_p1_0 = DATA(0,1,0); +data->data_p1_p1_0 = DATA(1,1,0); +data->data_p2_p1_0 = DATA(2,1,0); +data->data_m2_p2_0 = DATA(-2,2,0); +data->data_m1_p2_0 = DATA(-1,2,0); +data->data_0_p2_0 = DATA(0,2,0); +data->data_p1_p2_0 = DATA(1,2,0); +data->data_p2_p2_0 = DATA(2,2,0); +data->data_m2_m2_p1 = DATA(-2,-2,1); +data->data_m1_m2_p1 = DATA(-1,-2,1); +data->data_0_m2_p1 = DATA(0,-2,1); +data->data_p1_m2_p1 = DATA(1,-2,1); +data->data_p2_m2_p1 = DATA(2,-2,1); +data->data_m2_m1_p1 = DATA(-2,-1,1); +data->data_m1_m1_p1 = DATA(-1,-1,1); +data->data_0_m1_p1 = DATA(0,-1,1); +data->data_p1_m1_p1 = DATA(1,-1,1); +data->data_p2_m1_p1 = DATA(2,-1,1); +data->data_m2_0_p1 = DATA(-2,0,1); +data->data_m1_0_p1 = DATA(-1,0,1); +data->data_0_0_p1 = DATA(0,0,1); +data->data_p1_0_p1 = DATA(1,0,1); +data->data_p2_0_p1 = DATA(2,0,1); +data->data_m2_p1_p1 = DATA(-2,1,1); +data->data_m1_p1_p1 = DATA(-1,1,1); +data->data_0_p1_p1 = DATA(0,1,1); +data->data_p1_p1_p1 = DATA(1,1,1); +data->data_p2_p1_p1 = DATA(2,1,1); +data->data_m2_p2_p1 = DATA(-2,2,1); +data->data_m1_p2_p1 = DATA(-1,2,1); +data->data_0_p2_p1 = DATA(0,2,1); +data->data_p1_p2_p1 = DATA(1,2,1); +data->data_p2_p2_p1 = DATA(2,2,1); +data->data_m2_m2_p2 = DATA(-2,-2,2); +data->data_m1_m2_p2 = DATA(-1,-2,2); +data->data_0_m2_p2 = DATA(0,-2,2); +data->data_p1_m2_p2 = DATA(1,-2,2); +data->data_p2_m2_p2 = DATA(2,-2,2); +data->data_m2_m1_p2 = DATA(-2,-1,2); +data->data_m1_m1_p2 = DATA(-1,-1,2); +data->data_0_m1_p2 = DATA(0,-1,2); +data->data_p1_m1_p2 = DATA(1,-1,2); +data->data_p2_m1_p2 = DATA(2,-1,2); +data->data_m2_0_p2 = DATA(-2,0,2); +data->data_m1_0_p2 = DATA(-1,0,2); +data->data_0_0_p2 = DATA(0,0,2); +data->data_p1_0_p2 = DATA(1,0,2); +data->data_p2_0_p2 = DATA(2,0,2); +data->data_m2_p1_p2 = DATA(-2,1,2); +data->data_m1_p1_p2 = DATA(-1,1,2); +data->data_0_p1_p2 = DATA(0,1,2); +data->data_p1_p1_p2 = DATA(1,1,2); +data->data_p2_p1_p2 = DATA(2,1,2); +data->data_m2_p2_p2 = DATA(-2,2,2); +data->data_m1_p2_p2 = DATA(-1,2,2); +data->data_0_p2_p2 = DATA(0,2,2); +data->data_p1_p2_p2 = DATA(1,2,2); +data->data_p2_p2_p2 = DATA(2,2,2); diff --git a/src/common/3d.cube.size5/store-coeffs.c b/src/common/3d.cube.size5/store-coeffs.c new file mode 100644 index 0000000..40c057c --- /dev/null +++ b/src/common/3d.cube.size5/store-coeffs.c @@ -0,0 +1,125 @@ +COEFF(-2,-2,-2) = factor * coeffs->coeff_m2_m2_m2; +COEFF(-1,-2,-2) = factor * coeffs->coeff_m1_m2_m2; +COEFF(0,-2,-2) = factor * coeffs->coeff_0_m2_m2; +COEFF(1,-2,-2) = factor * coeffs->coeff_p1_m2_m2; +COEFF(2,-2,-2) = factor * coeffs->coeff_p2_m2_m2; +COEFF(-2,-1,-2) = factor * coeffs->coeff_m2_m1_m2; +COEFF(-1,-1,-2) = factor * coeffs->coeff_m1_m1_m2; +COEFF(0,-1,-2) = factor * coeffs->coeff_0_m1_m2; +COEFF(1,-1,-2) = factor * coeffs->coeff_p1_m1_m2; +COEFF(2,-1,-2) = factor * coeffs->coeff_p2_m1_m2; +COEFF(-2,0,-2) = factor * coeffs->coeff_m2_0_m2; +COEFF(-1,0,-2) = factor * coeffs->coeff_m1_0_m2; +COEFF(0,0,-2) = factor * coeffs->coeff_0_0_m2; +COEFF(1,0,-2) = factor * coeffs->coeff_p1_0_m2; +COEFF(2,0,-2) = factor * coeffs->coeff_p2_0_m2; +COEFF(-2,1,-2) = factor * coeffs->coeff_m2_p1_m2; +COEFF(-1,1,-2) = factor * coeffs->coeff_m1_p1_m2; +COEFF(0,1,-2) = factor * coeffs->coeff_0_p1_m2; +COEFF(1,1,-2) = factor * coeffs->coeff_p1_p1_m2; +COEFF(2,1,-2) = factor * coeffs->coeff_p2_p1_m2; +COEFF(-2,2,-2) = factor * coeffs->coeff_m2_p2_m2; +COEFF(-1,2,-2) = factor * coeffs->coeff_m1_p2_m2; +COEFF(0,2,-2) = factor * coeffs->coeff_0_p2_m2; +COEFF(1,2,-2) = factor * coeffs->coeff_p1_p2_m2; +COEFF(2,2,-2) = factor * coeffs->coeff_p2_p2_m2; +COEFF(-2,-2,-1) = factor * coeffs->coeff_m2_m2_m1; +COEFF(-1,-2,-1) = factor * coeffs->coeff_m1_m2_m1; +COEFF(0,-2,-1) = factor * coeffs->coeff_0_m2_m1; +COEFF(1,-2,-1) = factor * coeffs->coeff_p1_m2_m1; +COEFF(2,-2,-1) = factor * coeffs->coeff_p2_m2_m1; +COEFF(-2,-1,-1) = factor * coeffs->coeff_m2_m1_m1; +COEFF(-1,-1,-1) = factor * coeffs->coeff_m1_m1_m1; +COEFF(0,-1,-1) = factor * coeffs->coeff_0_m1_m1; +COEFF(1,-1,-1) = factor * coeffs->coeff_p1_m1_m1; +COEFF(2,-1,-1) = factor * coeffs->coeff_p2_m1_m1; +COEFF(-2,0,-1) = factor * coeffs->coeff_m2_0_m1; +COEFF(-1,0,-1) = factor * coeffs->coeff_m1_0_m1; +COEFF(0,0,-1) = factor * coeffs->coeff_0_0_m1; +COEFF(1,0,-1) = factor * coeffs->coeff_p1_0_m1; +COEFF(2,0,-1) = factor * coeffs->coeff_p2_0_m1; +COEFF(-2,1,-1) = factor * coeffs->coeff_m2_p1_m1; +COEFF(-1,1,-1) = factor * coeffs->coeff_m1_p1_m1; +COEFF(0,1,-1) = factor * coeffs->coeff_0_p1_m1; +COEFF(1,1,-1) = factor * coeffs->coeff_p1_p1_m1; +COEFF(2,1,-1) = factor * coeffs->coeff_p2_p1_m1; +COEFF(-2,2,-1) = factor * coeffs->coeff_m2_p2_m1; +COEFF(-1,2,-1) = factor * coeffs->coeff_m1_p2_m1; +COEFF(0,2,-1) = factor * coeffs->coeff_0_p2_m1; +COEFF(1,2,-1) = factor * coeffs->coeff_p1_p2_m1; +COEFF(2,2,-1) = factor * coeffs->coeff_p2_p2_m1; +COEFF(-2,-2,0) = factor * coeffs->coeff_m2_m2_0; +COEFF(-1,-2,0) = factor * coeffs->coeff_m1_m2_0; +COEFF(0,-2,0) = factor * coeffs->coeff_0_m2_0; +COEFF(1,-2,0) = factor * coeffs->coeff_p1_m2_0; +COEFF(2,-2,0) = factor * coeffs->coeff_p2_m2_0; +COEFF(-2,-1,0) = factor * coeffs->coeff_m2_m1_0; +COEFF(-1,-1,0) = factor * coeffs->coeff_m1_m1_0; +COEFF(0,-1,0) = factor * coeffs->coeff_0_m1_0; +COEFF(1,-1,0) = factor * coeffs->coeff_p1_m1_0; +COEFF(2,-1,0) = factor * coeffs->coeff_p2_m1_0; +COEFF(-2,0,0) = factor * coeffs->coeff_m2_0_0; +COEFF(-1,0,0) = factor * coeffs->coeff_m1_0_0; +COEFF(0,0,0) = factor * coeffs->coeff_0_0_0; +COEFF(1,0,0) = factor * coeffs->coeff_p1_0_0; +COEFF(2,0,0) = factor * coeffs->coeff_p2_0_0; +COEFF(-2,1,0) = factor * coeffs->coeff_m2_p1_0; +COEFF(-1,1,0) = factor * coeffs->coeff_m1_p1_0; +COEFF(0,1,0) = factor * coeffs->coeff_0_p1_0; +COEFF(1,1,0) = factor * coeffs->coeff_p1_p1_0; +COEFF(2,1,0) = factor * coeffs->coeff_p2_p1_0; +COEFF(-2,2,0) = factor * coeffs->coeff_m2_p2_0; +COEFF(-1,2,0) = factor * coeffs->coeff_m1_p2_0; +COEFF(0,2,0) = factor * coeffs->coeff_0_p2_0; +COEFF(1,2,0) = factor * coeffs->coeff_p1_p2_0; +COEFF(2,2,0) = factor * coeffs->coeff_p2_p2_0; +COEFF(-2,-2,1) = factor * coeffs->coeff_m2_m2_p1; +COEFF(-1,-2,1) = factor * coeffs->coeff_m1_m2_p1; +COEFF(0,-2,1) = factor * coeffs->coeff_0_m2_p1; +COEFF(1,-2,1) = factor * coeffs->coeff_p1_m2_p1; +COEFF(2,-2,1) = factor * coeffs->coeff_p2_m2_p1; +COEFF(-2,-1,1) = factor * coeffs->coeff_m2_m1_p1; +COEFF(-1,-1,1) = factor * coeffs->coeff_m1_m1_p1; +COEFF(0,-1,1) = factor * coeffs->coeff_0_m1_p1; +COEFF(1,-1,1) = factor * coeffs->coeff_p1_m1_p1; +COEFF(2,-1,1) = factor * coeffs->coeff_p2_m1_p1; +COEFF(-2,0,1) = factor * coeffs->coeff_m2_0_p1; +COEFF(-1,0,1) = factor * coeffs->coeff_m1_0_p1; +COEFF(0,0,1) = factor * coeffs->coeff_0_0_p1; +COEFF(1,0,1) = factor * coeffs->coeff_p1_0_p1; +COEFF(2,0,1) = factor * coeffs->coeff_p2_0_p1; +COEFF(-2,1,1) = factor * coeffs->coeff_m2_p1_p1; +COEFF(-1,1,1) = factor * coeffs->coeff_m1_p1_p1; +COEFF(0,1,1) = factor * coeffs->coeff_0_p1_p1; +COEFF(1,1,1) = factor * coeffs->coeff_p1_p1_p1; +COEFF(2,1,1) = factor * coeffs->coeff_p2_p1_p1; +COEFF(-2,2,1) = factor * coeffs->coeff_m2_p2_p1; +COEFF(-1,2,1) = factor * coeffs->coeff_m1_p2_p1; +COEFF(0,2,1) = factor * coeffs->coeff_0_p2_p1; +COEFF(1,2,1) = factor * coeffs->coeff_p1_p2_p1; +COEFF(2,2,1) = factor * coeffs->coeff_p2_p2_p1; +COEFF(-2,-2,2) = factor * coeffs->coeff_m2_m2_p2; +COEFF(-1,-2,2) = factor * coeffs->coeff_m1_m2_p2; +COEFF(0,-2,2) = factor * coeffs->coeff_0_m2_p2; +COEFF(1,-2,2) = factor * coeffs->coeff_p1_m2_p2; +COEFF(2,-2,2) = factor * coeffs->coeff_p2_m2_p2; +COEFF(-2,-1,2) = factor * coeffs->coeff_m2_m1_p2; +COEFF(-1,-1,2) = factor * coeffs->coeff_m1_m1_p2; +COEFF(0,-1,2) = factor * coeffs->coeff_0_m1_p2; +COEFF(1,-1,2) = factor * coeffs->coeff_p1_m1_p2; +COEFF(2,-1,2) = factor * coeffs->coeff_p2_m1_p2; +COEFF(-2,0,2) = factor * coeffs->coeff_m2_0_p2; +COEFF(-1,0,2) = factor * coeffs->coeff_m1_0_p2; +COEFF(0,0,2) = factor * coeffs->coeff_0_0_p2; +COEFF(1,0,2) = factor * coeffs->coeff_p1_0_p2; +COEFF(2,0,2) = factor * coeffs->coeff_p2_0_p2; +COEFF(-2,1,2) = factor * coeffs->coeff_m2_p1_p2; +COEFF(-1,1,2) = factor * coeffs->coeff_m1_p1_p2; +COEFF(0,1,2) = factor * coeffs->coeff_0_p1_p2; +COEFF(1,1,2) = factor * coeffs->coeff_p1_p1_p2; +COEFF(2,1,2) = factor * coeffs->coeff_p2_p1_p2; +COEFF(-2,2,2) = factor * coeffs->coeff_m2_p2_p2; +COEFF(-1,2,2) = factor * coeffs->coeff_m1_p2_p2; +COEFF(0,2,2) = factor * coeffs->coeff_0_p2_p2; +COEFF(1,2,2) = factor * coeffs->coeff_p1_p2_p2; +COEFF(2,2,2) = factor * coeffs->coeff_p2_p2_p2; diff --git a/src/common/3d.cube.size6/coeffs-dcl.h b/src/common/3d.cube.size6/coeffs-dcl.h new file mode 100644 index 0000000..bb2ad77 --- /dev/null +++ b/src/common/3d.cube.size6/coeffs-dcl.h @@ -0,0 +1,216 @@ +fp coeff_m2_m2_m2; +fp coeff_m1_m2_m2; +fp coeff_0_m2_m2; +fp coeff_p1_m2_m2; +fp coeff_p2_m2_m2; +fp coeff_p3_m2_m2; +fp coeff_m2_m1_m2; +fp coeff_m1_m1_m2; +fp coeff_0_m1_m2; +fp coeff_p1_m1_m2; +fp coeff_p2_m1_m2; +fp coeff_p3_m1_m2; +fp coeff_m2_0_m2; +fp coeff_m1_0_m2; +fp coeff_0_0_m2; +fp coeff_p1_0_m2; +fp coeff_p2_0_m2; +fp coeff_p3_0_m2; +fp coeff_m2_p1_m2; +fp coeff_m1_p1_m2; +fp coeff_0_p1_m2; +fp coeff_p1_p1_m2; +fp coeff_p2_p1_m2; +fp coeff_p3_p1_m2; +fp coeff_m2_p2_m2; +fp coeff_m1_p2_m2; +fp coeff_0_p2_m2; +fp coeff_p1_p2_m2; +fp coeff_p2_p2_m2; +fp coeff_p3_p2_m2; +fp coeff_m2_p3_m2; +fp coeff_m1_p3_m2; +fp coeff_0_p3_m2; +fp coeff_p1_p3_m2; +fp coeff_p2_p3_m2; +fp coeff_p3_p3_m2; +fp coeff_m2_m2_m1; +fp coeff_m1_m2_m1; +fp coeff_0_m2_m1; +fp coeff_p1_m2_m1; +fp coeff_p2_m2_m1; +fp coeff_p3_m2_m1; +fp coeff_m2_m1_m1; +fp coeff_m1_m1_m1; +fp coeff_0_m1_m1; +fp coeff_p1_m1_m1; +fp coeff_p2_m1_m1; +fp coeff_p3_m1_m1; +fp coeff_m2_0_m1; +fp coeff_m1_0_m1; +fp coeff_0_0_m1; +fp coeff_p1_0_m1; +fp coeff_p2_0_m1; +fp coeff_p3_0_m1; +fp coeff_m2_p1_m1; +fp coeff_m1_p1_m1; +fp coeff_0_p1_m1; +fp coeff_p1_p1_m1; +fp coeff_p2_p1_m1; +fp coeff_p3_p1_m1; +fp coeff_m2_p2_m1; +fp coeff_m1_p2_m1; +fp coeff_0_p2_m1; +fp coeff_p1_p2_m1; +fp coeff_p2_p2_m1; +fp coeff_p3_p2_m1; +fp coeff_m2_p3_m1; +fp coeff_m1_p3_m1; +fp coeff_0_p3_m1; +fp coeff_p1_p3_m1; +fp coeff_p2_p3_m1; +fp coeff_p3_p3_m1; +fp coeff_m2_m2_0; +fp coeff_m1_m2_0; +fp coeff_0_m2_0; +fp coeff_p1_m2_0; +fp coeff_p2_m2_0; +fp coeff_p3_m2_0; +fp coeff_m2_m1_0; +fp coeff_m1_m1_0; +fp coeff_0_m1_0; +fp coeff_p1_m1_0; +fp coeff_p2_m1_0; +fp coeff_p3_m1_0; +fp coeff_m2_0_0; +fp coeff_m1_0_0; +fp coeff_0_0_0; +fp coeff_p1_0_0; +fp coeff_p2_0_0; +fp coeff_p3_0_0; +fp coeff_m2_p1_0; +fp coeff_m1_p1_0; +fp coeff_0_p1_0; +fp coeff_p1_p1_0; +fp coeff_p2_p1_0; +fp coeff_p3_p1_0; +fp coeff_m2_p2_0; +fp coeff_m1_p2_0; +fp coeff_0_p2_0; +fp coeff_p1_p2_0; +fp coeff_p2_p2_0; +fp coeff_p3_p2_0; +fp coeff_m2_p3_0; +fp coeff_m1_p3_0; +fp coeff_0_p3_0; +fp coeff_p1_p3_0; +fp coeff_p2_p3_0; +fp coeff_p3_p3_0; +fp coeff_m2_m2_p1; +fp coeff_m1_m2_p1; +fp coeff_0_m2_p1; +fp coeff_p1_m2_p1; +fp coeff_p2_m2_p1; +fp coeff_p3_m2_p1; +fp coeff_m2_m1_p1; +fp coeff_m1_m1_p1; +fp coeff_0_m1_p1; +fp coeff_p1_m1_p1; +fp coeff_p2_m1_p1; +fp coeff_p3_m1_p1; +fp coeff_m2_0_p1; +fp coeff_m1_0_p1; +fp coeff_0_0_p1; +fp coeff_p1_0_p1; +fp coeff_p2_0_p1; +fp coeff_p3_0_p1; +fp coeff_m2_p1_p1; +fp coeff_m1_p1_p1; +fp coeff_0_p1_p1; +fp coeff_p1_p1_p1; +fp coeff_p2_p1_p1; +fp coeff_p3_p1_p1; +fp coeff_m2_p2_p1; +fp coeff_m1_p2_p1; +fp coeff_0_p2_p1; +fp coeff_p1_p2_p1; +fp coeff_p2_p2_p1; +fp coeff_p3_p2_p1; +fp coeff_m2_p3_p1; +fp coeff_m1_p3_p1; +fp coeff_0_p3_p1; +fp coeff_p1_p3_p1; +fp coeff_p2_p3_p1; +fp coeff_p3_p3_p1; +fp coeff_m2_m2_p2; +fp coeff_m1_m2_p2; +fp coeff_0_m2_p2; +fp coeff_p1_m2_p2; +fp coeff_p2_m2_p2; +fp coeff_p3_m2_p2; +fp coeff_m2_m1_p2; +fp coeff_m1_m1_p2; +fp coeff_0_m1_p2; +fp coeff_p1_m1_p2; +fp coeff_p2_m1_p2; +fp coeff_p3_m1_p2; +fp coeff_m2_0_p2; +fp coeff_m1_0_p2; +fp coeff_0_0_p2; +fp coeff_p1_0_p2; +fp coeff_p2_0_p2; +fp coeff_p3_0_p2; +fp coeff_m2_p1_p2; +fp coeff_m1_p1_p2; +fp coeff_0_p1_p2; +fp coeff_p1_p1_p2; +fp coeff_p2_p1_p2; +fp coeff_p3_p1_p2; +fp coeff_m2_p2_p2; +fp coeff_m1_p2_p2; +fp coeff_0_p2_p2; +fp coeff_p1_p2_p2; +fp coeff_p2_p2_p2; +fp coeff_p3_p2_p2; +fp coeff_m2_p3_p2; +fp coeff_m1_p3_p2; +fp coeff_0_p3_p2; +fp coeff_p1_p3_p2; +fp coeff_p2_p3_p2; +fp coeff_p3_p3_p2; +fp coeff_m2_m2_p3; +fp coeff_m1_m2_p3; +fp coeff_0_m2_p3; +fp coeff_p1_m2_p3; +fp coeff_p2_m2_p3; +fp coeff_p3_m2_p3; +fp coeff_m2_m1_p3; +fp coeff_m1_m1_p3; +fp coeff_0_m1_p3; +fp coeff_p1_m1_p3; +fp coeff_p2_m1_p3; +fp coeff_p3_m1_p3; +fp coeff_m2_0_p3; +fp coeff_m1_0_p3; +fp coeff_0_0_p3; +fp coeff_p1_0_p3; +fp coeff_p2_0_p3; +fp coeff_p3_0_p3; +fp coeff_m2_p1_p3; +fp coeff_m1_p1_p3; +fp coeff_0_p1_p3; +fp coeff_p1_p1_p3; +fp coeff_p2_p1_p3; +fp coeff_p3_p1_p3; +fp coeff_m2_p2_p3; +fp coeff_m1_p2_p3; +fp coeff_0_p2_p3; +fp coeff_p1_p2_p3; +fp coeff_p2_p2_p3; +fp coeff_p3_p2_p3; +fp coeff_m2_p3_p3; +fp coeff_m1_p3_p3; +fp coeff_0_p3_p3; +fp coeff_p1_p3_p3; +fp coeff_p2_p3_p3; +fp coeff_p3_p3_p3; diff --git a/src/common/3d.cube.size6/data-dcl.h b/src/common/3d.cube.size6/data-dcl.h new file mode 100644 index 0000000..839cd8e --- /dev/null +++ b/src/common/3d.cube.size6/data-dcl.h @@ -0,0 +1,216 @@ +fp data_m2_m2_m2; +fp data_m1_m2_m2; +fp data_0_m2_m2; +fp data_p1_m2_m2; +fp data_p2_m2_m2; +fp data_p3_m2_m2; +fp data_m2_m1_m2; +fp data_m1_m1_m2; +fp data_0_m1_m2; +fp data_p1_m1_m2; +fp data_p2_m1_m2; +fp data_p3_m1_m2; +fp data_m2_0_m2; +fp data_m1_0_m2; +fp data_0_0_m2; +fp data_p1_0_m2; +fp data_p2_0_m2; +fp data_p3_0_m2; +fp data_m2_p1_m2; +fp data_m1_p1_m2; +fp data_0_p1_m2; +fp data_p1_p1_m2; +fp data_p2_p1_m2; +fp data_p3_p1_m2; +fp data_m2_p2_m2; +fp data_m1_p2_m2; +fp data_0_p2_m2; +fp data_p1_p2_m2; +fp data_p2_p2_m2; +fp data_p3_p2_m2; +fp data_m2_p3_m2; +fp data_m1_p3_m2; +fp data_0_p3_m2; +fp data_p1_p3_m2; +fp data_p2_p3_m2; +fp data_p3_p3_m2; +fp data_m2_m2_m1; +fp data_m1_m2_m1; +fp data_0_m2_m1; +fp data_p1_m2_m1; +fp data_p2_m2_m1; +fp data_p3_m2_m1; +fp data_m2_m1_m1; +fp data_m1_m1_m1; +fp data_0_m1_m1; +fp data_p1_m1_m1; +fp data_p2_m1_m1; +fp data_p3_m1_m1; +fp data_m2_0_m1; +fp data_m1_0_m1; +fp data_0_0_m1; +fp data_p1_0_m1; +fp data_p2_0_m1; +fp data_p3_0_m1; +fp data_m2_p1_m1; +fp data_m1_p1_m1; +fp data_0_p1_m1; +fp data_p1_p1_m1; +fp data_p2_p1_m1; +fp data_p3_p1_m1; +fp data_m2_p2_m1; +fp data_m1_p2_m1; +fp data_0_p2_m1; +fp data_p1_p2_m1; +fp data_p2_p2_m1; +fp data_p3_p2_m1; +fp data_m2_p3_m1; +fp data_m1_p3_m1; +fp data_0_p3_m1; +fp data_p1_p3_m1; +fp data_p2_p3_m1; +fp data_p3_p3_m1; +fp data_m2_m2_0; +fp data_m1_m2_0; +fp data_0_m2_0; +fp data_p1_m2_0; +fp data_p2_m2_0; +fp data_p3_m2_0; +fp data_m2_m1_0; +fp data_m1_m1_0; +fp data_0_m1_0; +fp data_p1_m1_0; +fp data_p2_m1_0; +fp data_p3_m1_0; +fp data_m2_0_0; +fp data_m1_0_0; +fp data_0_0_0; +fp data_p1_0_0; +fp data_p2_0_0; +fp data_p3_0_0; +fp data_m2_p1_0; +fp data_m1_p1_0; +fp data_0_p1_0; +fp data_p1_p1_0; +fp data_p2_p1_0; +fp data_p3_p1_0; +fp data_m2_p2_0; +fp data_m1_p2_0; +fp data_0_p2_0; +fp data_p1_p2_0; +fp data_p2_p2_0; +fp data_p3_p2_0; +fp data_m2_p3_0; +fp data_m1_p3_0; +fp data_0_p3_0; +fp data_p1_p3_0; +fp data_p2_p3_0; +fp data_p3_p3_0; +fp data_m2_m2_p1; +fp data_m1_m2_p1; +fp data_0_m2_p1; +fp data_p1_m2_p1; +fp data_p2_m2_p1; +fp data_p3_m2_p1; +fp data_m2_m1_p1; +fp data_m1_m1_p1; +fp data_0_m1_p1; +fp data_p1_m1_p1; +fp data_p2_m1_p1; +fp data_p3_m1_p1; +fp data_m2_0_p1; +fp data_m1_0_p1; +fp data_0_0_p1; +fp data_p1_0_p1; +fp data_p2_0_p1; +fp data_p3_0_p1; +fp data_m2_p1_p1; +fp data_m1_p1_p1; +fp data_0_p1_p1; +fp data_p1_p1_p1; +fp data_p2_p1_p1; +fp data_p3_p1_p1; +fp data_m2_p2_p1; +fp data_m1_p2_p1; +fp data_0_p2_p1; +fp data_p1_p2_p1; +fp data_p2_p2_p1; +fp data_p3_p2_p1; +fp data_m2_p3_p1; +fp data_m1_p3_p1; +fp data_0_p3_p1; +fp data_p1_p3_p1; +fp data_p2_p3_p1; +fp data_p3_p3_p1; +fp data_m2_m2_p2; +fp data_m1_m2_p2; +fp data_0_m2_p2; +fp data_p1_m2_p2; +fp data_p2_m2_p2; +fp data_p3_m2_p2; +fp data_m2_m1_p2; +fp data_m1_m1_p2; +fp data_0_m1_p2; +fp data_p1_m1_p2; +fp data_p2_m1_p2; +fp data_p3_m1_p2; +fp data_m2_0_p2; +fp data_m1_0_p2; +fp data_0_0_p2; +fp data_p1_0_p2; +fp data_p2_0_p2; +fp data_p3_0_p2; +fp data_m2_p1_p2; +fp data_m1_p1_p2; +fp data_0_p1_p2; +fp data_p1_p1_p2; +fp data_p2_p1_p2; +fp data_p3_p1_p2; +fp data_m2_p2_p2; +fp data_m1_p2_p2; +fp data_0_p2_p2; +fp data_p1_p2_p2; +fp data_p2_p2_p2; +fp data_p3_p2_p2; +fp data_m2_p3_p2; +fp data_m1_p3_p2; +fp data_0_p3_p2; +fp data_p1_p3_p2; +fp data_p2_p3_p2; +fp data_p3_p3_p2; +fp data_m2_m2_p3; +fp data_m1_m2_p3; +fp data_0_m2_p3; +fp data_p1_m2_p3; +fp data_p2_m2_p3; +fp data_p3_m2_p3; +fp data_m2_m1_p3; +fp data_m1_m1_p3; +fp data_0_m1_p3; +fp data_p1_m1_p3; +fp data_p2_m1_p3; +fp data_p3_m1_p3; +fp data_m2_0_p3; +fp data_m1_0_p3; +fp data_0_0_p3; +fp data_p1_0_p3; +fp data_p2_0_p3; +fp data_p3_0_p3; +fp data_m2_p1_p3; +fp data_m1_p1_p3; +fp data_0_p1_p3; +fp data_p1_p1_p3; +fp data_p2_p1_p3; +fp data_p3_p1_p3; +fp data_m2_p2_p3; +fp data_m1_p2_p3; +fp data_0_p2_p3; +fp data_p1_p2_p3; +fp data_p2_p2_p3; +fp data_p3_p2_p3; +fp data_m2_p3_p3; +fp data_m1_p3_p3; +fp data_0_p3_p3; +fp data_p1_p3_p3; +fp data_p2_p3_p3; +fp data_p3_p3_p3; diff --git a/src/common/3d.cube.size6/evaluate-molecule.c b/src/common/3d.cube.size6/evaluate-molecule.c new file mode 100644 index 0000000..ccbfa3b --- /dev/null +++ b/src/common/3d.cube.size6/evaluate-molecule.c @@ -0,0 +1,216 @@ + coeffs->coeff_m2_m2_m2*data->data_m2_m2_m2 + + coeffs->coeff_m1_m2_m2*data->data_m1_m2_m2 + + coeffs->coeff_0_m2_m2*data->data_0_m2_m2 + + coeffs->coeff_p1_m2_m2*data->data_p1_m2_m2 + + coeffs->coeff_p2_m2_m2*data->data_p2_m2_m2 + + coeffs->coeff_p3_m2_m2*data->data_p3_m2_m2 + + coeffs->coeff_m2_m1_m2*data->data_m2_m1_m2 + + coeffs->coeff_m1_m1_m2*data->data_m1_m1_m2 + + coeffs->coeff_0_m1_m2*data->data_0_m1_m2 + + coeffs->coeff_p1_m1_m2*data->data_p1_m1_m2 + + coeffs->coeff_p2_m1_m2*data->data_p2_m1_m2 + + coeffs->coeff_p3_m1_m2*data->data_p3_m1_m2 + + coeffs->coeff_m2_0_m2*data->data_m2_0_m2 + + coeffs->coeff_m1_0_m2*data->data_m1_0_m2 + + coeffs->coeff_0_0_m2*data->data_0_0_m2 + + coeffs->coeff_p1_0_m2*data->data_p1_0_m2 + + coeffs->coeff_p2_0_m2*data->data_p2_0_m2 + + coeffs->coeff_p3_0_m2*data->data_p3_0_m2 + + coeffs->coeff_m2_p1_m2*data->data_m2_p1_m2 + + coeffs->coeff_m1_p1_m2*data->data_m1_p1_m2 + + coeffs->coeff_0_p1_m2*data->data_0_p1_m2 + + coeffs->coeff_p1_p1_m2*data->data_p1_p1_m2 + + coeffs->coeff_p2_p1_m2*data->data_p2_p1_m2 + + coeffs->coeff_p3_p1_m2*data->data_p3_p1_m2 + + coeffs->coeff_m2_p2_m2*data->data_m2_p2_m2 + + coeffs->coeff_m1_p2_m2*data->data_m1_p2_m2 + + coeffs->coeff_0_p2_m2*data->data_0_p2_m2 + + coeffs->coeff_p1_p2_m2*data->data_p1_p2_m2 + + coeffs->coeff_p2_p2_m2*data->data_p2_p2_m2 + + coeffs->coeff_p3_p2_m2*data->data_p3_p2_m2 + + coeffs->coeff_m2_p3_m2*data->data_m2_p3_m2 + + coeffs->coeff_m1_p3_m2*data->data_m1_p3_m2 + + coeffs->coeff_0_p3_m2*data->data_0_p3_m2 + + coeffs->coeff_p1_p3_m2*data->data_p1_p3_m2 + + coeffs->coeff_p2_p3_m2*data->data_p2_p3_m2 + + coeffs->coeff_p3_p3_m2*data->data_p3_p3_m2 + + coeffs->coeff_m2_m2_m1*data->data_m2_m2_m1 + + coeffs->coeff_m1_m2_m1*data->data_m1_m2_m1 + + coeffs->coeff_0_m2_m1*data->data_0_m2_m1 + + coeffs->coeff_p1_m2_m1*data->data_p1_m2_m1 + + coeffs->coeff_p2_m2_m1*data->data_p2_m2_m1 + + coeffs->coeff_p3_m2_m1*data->data_p3_m2_m1 + + coeffs->coeff_m2_m1_m1*data->data_m2_m1_m1 + + coeffs->coeff_m1_m1_m1*data->data_m1_m1_m1 + + coeffs->coeff_0_m1_m1*data->data_0_m1_m1 + + coeffs->coeff_p1_m1_m1*data->data_p1_m1_m1 + + coeffs->coeff_p2_m1_m1*data->data_p2_m1_m1 + + coeffs->coeff_p3_m1_m1*data->data_p3_m1_m1 + + coeffs->coeff_m2_0_m1*data->data_m2_0_m1 + + coeffs->coeff_m1_0_m1*data->data_m1_0_m1 + + coeffs->coeff_0_0_m1*data->data_0_0_m1 + + coeffs->coeff_p1_0_m1*data->data_p1_0_m1 + + coeffs->coeff_p2_0_m1*data->data_p2_0_m1 + + coeffs->coeff_p3_0_m1*data->data_p3_0_m1 + + coeffs->coeff_m2_p1_m1*data->data_m2_p1_m1 + + coeffs->coeff_m1_p1_m1*data->data_m1_p1_m1 + + coeffs->coeff_0_p1_m1*data->data_0_p1_m1 + + coeffs->coeff_p1_p1_m1*data->data_p1_p1_m1 + + coeffs->coeff_p2_p1_m1*data->data_p2_p1_m1 + + coeffs->coeff_p3_p1_m1*data->data_p3_p1_m1 + + coeffs->coeff_m2_p2_m1*data->data_m2_p2_m1 + + coeffs->coeff_m1_p2_m1*data->data_m1_p2_m1 + + coeffs->coeff_0_p2_m1*data->data_0_p2_m1 + + coeffs->coeff_p1_p2_m1*data->data_p1_p2_m1 + + coeffs->coeff_p2_p2_m1*data->data_p2_p2_m1 + + coeffs->coeff_p3_p2_m1*data->data_p3_p2_m1 + + coeffs->coeff_m2_p3_m1*data->data_m2_p3_m1 + + coeffs->coeff_m1_p3_m1*data->data_m1_p3_m1 + + coeffs->coeff_0_p3_m1*data->data_0_p3_m1 + + coeffs->coeff_p1_p3_m1*data->data_p1_p3_m1 + + coeffs->coeff_p2_p3_m1*data->data_p2_p3_m1 + + coeffs->coeff_p3_p3_m1*data->data_p3_p3_m1 + + coeffs->coeff_m2_m2_0*data->data_m2_m2_0 + + coeffs->coeff_m1_m2_0*data->data_m1_m2_0 + + coeffs->coeff_0_m2_0*data->data_0_m2_0 + + coeffs->coeff_p1_m2_0*data->data_p1_m2_0 + + coeffs->coeff_p2_m2_0*data->data_p2_m2_0 + + coeffs->coeff_p3_m2_0*data->data_p3_m2_0 + + coeffs->coeff_m2_m1_0*data->data_m2_m1_0 + + coeffs->coeff_m1_m1_0*data->data_m1_m1_0 + + coeffs->coeff_0_m1_0*data->data_0_m1_0 + + coeffs->coeff_p1_m1_0*data->data_p1_m1_0 + + coeffs->coeff_p2_m1_0*data->data_p2_m1_0 + + coeffs->coeff_p3_m1_0*data->data_p3_m1_0 + + coeffs->coeff_m2_0_0*data->data_m2_0_0 + + coeffs->coeff_m1_0_0*data->data_m1_0_0 + + coeffs->coeff_0_0_0*data->data_0_0_0 + + coeffs->coeff_p1_0_0*data->data_p1_0_0 + + coeffs->coeff_p2_0_0*data->data_p2_0_0 + + coeffs->coeff_p3_0_0*data->data_p3_0_0 + + coeffs->coeff_m2_p1_0*data->data_m2_p1_0 + + coeffs->coeff_m1_p1_0*data->data_m1_p1_0 + + coeffs->coeff_0_p1_0*data->data_0_p1_0 + + coeffs->coeff_p1_p1_0*data->data_p1_p1_0 + + coeffs->coeff_p2_p1_0*data->data_p2_p1_0 + + coeffs->coeff_p3_p1_0*data->data_p3_p1_0 + + coeffs->coeff_m2_p2_0*data->data_m2_p2_0 + + coeffs->coeff_m1_p2_0*data->data_m1_p2_0 + + coeffs->coeff_0_p2_0*data->data_0_p2_0 + + coeffs->coeff_p1_p2_0*data->data_p1_p2_0 + + coeffs->coeff_p2_p2_0*data->data_p2_p2_0 + + coeffs->coeff_p3_p2_0*data->data_p3_p2_0 + + coeffs->coeff_m2_p3_0*data->data_m2_p3_0 + + coeffs->coeff_m1_p3_0*data->data_m1_p3_0 + + coeffs->coeff_0_p3_0*data->data_0_p3_0 + + coeffs->coeff_p1_p3_0*data->data_p1_p3_0 + + coeffs->coeff_p2_p3_0*data->data_p2_p3_0 + + coeffs->coeff_p3_p3_0*data->data_p3_p3_0 + + coeffs->coeff_m2_m2_p1*data->data_m2_m2_p1 + + coeffs->coeff_m1_m2_p1*data->data_m1_m2_p1 + + coeffs->coeff_0_m2_p1*data->data_0_m2_p1 + + coeffs->coeff_p1_m2_p1*data->data_p1_m2_p1 + + coeffs->coeff_p2_m2_p1*data->data_p2_m2_p1 + + coeffs->coeff_p3_m2_p1*data->data_p3_m2_p1 + + coeffs->coeff_m2_m1_p1*data->data_m2_m1_p1 + + coeffs->coeff_m1_m1_p1*data->data_m1_m1_p1 + + coeffs->coeff_0_m1_p1*data->data_0_m1_p1 + + coeffs->coeff_p1_m1_p1*data->data_p1_m1_p1 + + coeffs->coeff_p2_m1_p1*data->data_p2_m1_p1 + + coeffs->coeff_p3_m1_p1*data->data_p3_m1_p1 + + coeffs->coeff_m2_0_p1*data->data_m2_0_p1 + + coeffs->coeff_m1_0_p1*data->data_m1_0_p1 + + coeffs->coeff_0_0_p1*data->data_0_0_p1 + + coeffs->coeff_p1_0_p1*data->data_p1_0_p1 + + coeffs->coeff_p2_0_p1*data->data_p2_0_p1 + + coeffs->coeff_p3_0_p1*data->data_p3_0_p1 + + coeffs->coeff_m2_p1_p1*data->data_m2_p1_p1 + + coeffs->coeff_m1_p1_p1*data->data_m1_p1_p1 + + coeffs->coeff_0_p1_p1*data->data_0_p1_p1 + + coeffs->coeff_p1_p1_p1*data->data_p1_p1_p1 + + coeffs->coeff_p2_p1_p1*data->data_p2_p1_p1 + + coeffs->coeff_p3_p1_p1*data->data_p3_p1_p1 + + coeffs->coeff_m2_p2_p1*data->data_m2_p2_p1 + + coeffs->coeff_m1_p2_p1*data->data_m1_p2_p1 + + coeffs->coeff_0_p2_p1*data->data_0_p2_p1 + + coeffs->coeff_p1_p2_p1*data->data_p1_p2_p1 + + coeffs->coeff_p2_p2_p1*data->data_p2_p2_p1 + + coeffs->coeff_p3_p2_p1*data->data_p3_p2_p1 + + coeffs->coeff_m2_p3_p1*data->data_m2_p3_p1 + + coeffs->coeff_m1_p3_p1*data->data_m1_p3_p1 + + coeffs->coeff_0_p3_p1*data->data_0_p3_p1 + + coeffs->coeff_p1_p3_p1*data->data_p1_p3_p1 + + coeffs->coeff_p2_p3_p1*data->data_p2_p3_p1 + + coeffs->coeff_p3_p3_p1*data->data_p3_p3_p1 + + coeffs->coeff_m2_m2_p2*data->data_m2_m2_p2 + + coeffs->coeff_m1_m2_p2*data->data_m1_m2_p2 + + coeffs->coeff_0_m2_p2*data->data_0_m2_p2 + + coeffs->coeff_p1_m2_p2*data->data_p1_m2_p2 + + coeffs->coeff_p2_m2_p2*data->data_p2_m2_p2 + + coeffs->coeff_p3_m2_p2*data->data_p3_m2_p2 + + coeffs->coeff_m2_m1_p2*data->data_m2_m1_p2 + + coeffs->coeff_m1_m1_p2*data->data_m1_m1_p2 + + coeffs->coeff_0_m1_p2*data->data_0_m1_p2 + + coeffs->coeff_p1_m1_p2*data->data_p1_m1_p2 + + coeffs->coeff_p2_m1_p2*data->data_p2_m1_p2 + + coeffs->coeff_p3_m1_p2*data->data_p3_m1_p2 + + coeffs->coeff_m2_0_p2*data->data_m2_0_p2 + + coeffs->coeff_m1_0_p2*data->data_m1_0_p2 + + coeffs->coeff_0_0_p2*data->data_0_0_p2 + + coeffs->coeff_p1_0_p2*data->data_p1_0_p2 + + coeffs->coeff_p2_0_p2*data->data_p2_0_p2 + + coeffs->coeff_p3_0_p2*data->data_p3_0_p2 + + coeffs->coeff_m2_p1_p2*data->data_m2_p1_p2 + + coeffs->coeff_m1_p1_p2*data->data_m1_p1_p2 + + coeffs->coeff_0_p1_p2*data->data_0_p1_p2 + + coeffs->coeff_p1_p1_p2*data->data_p1_p1_p2 + + coeffs->coeff_p2_p1_p2*data->data_p2_p1_p2 + + coeffs->coeff_p3_p1_p2*data->data_p3_p1_p2 + + coeffs->coeff_m2_p2_p2*data->data_m2_p2_p2 + + coeffs->coeff_m1_p2_p2*data->data_m1_p2_p2 + + coeffs->coeff_0_p2_p2*data->data_0_p2_p2 + + coeffs->coeff_p1_p2_p2*data->data_p1_p2_p2 + + coeffs->coeff_p2_p2_p2*data->data_p2_p2_p2 + + coeffs->coeff_p3_p2_p2*data->data_p3_p2_p2 + + coeffs->coeff_m2_p3_p2*data->data_m2_p3_p2 + + coeffs->coeff_m1_p3_p2*data->data_m1_p3_p2 + + coeffs->coeff_0_p3_p2*data->data_0_p3_p2 + + coeffs->coeff_p1_p3_p2*data->data_p1_p3_p2 + + coeffs->coeff_p2_p3_p2*data->data_p2_p3_p2 + + coeffs->coeff_p3_p3_p2*data->data_p3_p3_p2 + + coeffs->coeff_m2_m2_p3*data->data_m2_m2_p3 + + coeffs->coeff_m1_m2_p3*data->data_m1_m2_p3 + + coeffs->coeff_0_m2_p3*data->data_0_m2_p3 + + coeffs->coeff_p1_m2_p3*data->data_p1_m2_p3 + + coeffs->coeff_p2_m2_p3*data->data_p2_m2_p3 + + coeffs->coeff_p3_m2_p3*data->data_p3_m2_p3 + + coeffs->coeff_m2_m1_p3*data->data_m2_m1_p3 + + coeffs->coeff_m1_m1_p3*data->data_m1_m1_p3 + + coeffs->coeff_0_m1_p3*data->data_0_m1_p3 + + coeffs->coeff_p1_m1_p3*data->data_p1_m1_p3 + + coeffs->coeff_p2_m1_p3*data->data_p2_m1_p3 + + coeffs->coeff_p3_m1_p3*data->data_p3_m1_p3 + + coeffs->coeff_m2_0_p3*data->data_m2_0_p3 + + coeffs->coeff_m1_0_p3*data->data_m1_0_p3 + + coeffs->coeff_0_0_p3*data->data_0_0_p3 + + coeffs->coeff_p1_0_p3*data->data_p1_0_p3 + + coeffs->coeff_p2_0_p3*data->data_p2_0_p3 + + coeffs->coeff_p3_0_p3*data->data_p3_0_p3 + + coeffs->coeff_m2_p1_p3*data->data_m2_p1_p3 + + coeffs->coeff_m1_p1_p3*data->data_m1_p1_p3 + + coeffs->coeff_0_p1_p3*data->data_0_p1_p3 + + coeffs->coeff_p1_p1_p3*data->data_p1_p1_p3 + + coeffs->coeff_p2_p1_p3*data->data_p2_p1_p3 + + coeffs->coeff_p3_p1_p3*data->data_p3_p1_p3 + + coeffs->coeff_m2_p2_p3*data->data_m2_p2_p3 + + coeffs->coeff_m1_p2_p3*data->data_m1_p2_p3 + + coeffs->coeff_0_p2_p3*data->data_0_p2_p3 + + coeffs->coeff_p1_p2_p3*data->data_p1_p2_p3 + + coeffs->coeff_p2_p2_p3*data->data_p2_p2_p3 + + coeffs->coeff_p3_p2_p3*data->data_p3_p2_p3 + + coeffs->coeff_m2_p3_p3*data->data_m2_p3_p3 + + coeffs->coeff_m1_p3_p3*data->data_m1_p3_p3 + + coeffs->coeff_0_p3_p3*data->data_0_p3_p3 + + coeffs->coeff_p1_p3_p3*data->data_p1_p3_p3 + + coeffs->coeff_p2_p3_p3*data->data_p2_p3_p3 + + coeffs->coeff_p3_p3_p3*data->data_p3_p3_p3; diff --git a/src/common/3d.cube.size6/load-data.c b/src/common/3d.cube.size6/load-data.c new file mode 100644 index 0000000..7238ef9 --- /dev/null +++ b/src/common/3d.cube.size6/load-data.c @@ -0,0 +1,216 @@ +data->data_m2_m2_m2 = DATA(-2,-2,-2); +data->data_m1_m2_m2 = DATA(-1,-2,-2); +data->data_0_m2_m2 = DATA(0,-2,-2); +data->data_p1_m2_m2 = DATA(1,-2,-2); +data->data_p2_m2_m2 = DATA(2,-2,-2); +data->data_p3_m2_m2 = DATA(3,-2,-2); +data->data_m2_m1_m2 = DATA(-2,-1,-2); +data->data_m1_m1_m2 = DATA(-1,-1,-2); +data->data_0_m1_m2 = DATA(0,-1,-2); +data->data_p1_m1_m2 = DATA(1,-1,-2); +data->data_p2_m1_m2 = DATA(2,-1,-2); +data->data_p3_m1_m2 = DATA(3,-1,-2); +data->data_m2_0_m2 = DATA(-2,0,-2); +data->data_m1_0_m2 = DATA(-1,0,-2); +data->data_0_0_m2 = DATA(0,0,-2); +data->data_p1_0_m2 = DATA(1,0,-2); +data->data_p2_0_m2 = DATA(2,0,-2); +data->data_p3_0_m2 = DATA(3,0,-2); +data->data_m2_p1_m2 = DATA(-2,1,-2); +data->data_m1_p1_m2 = DATA(-1,1,-2); +data->data_0_p1_m2 = DATA(0,1,-2); +data->data_p1_p1_m2 = DATA(1,1,-2); +data->data_p2_p1_m2 = DATA(2,1,-2); +data->data_p3_p1_m2 = DATA(3,1,-2); +data->data_m2_p2_m2 = DATA(-2,2,-2); +data->data_m1_p2_m2 = DATA(-1,2,-2); +data->data_0_p2_m2 = DATA(0,2,-2); +data->data_p1_p2_m2 = DATA(1,2,-2); +data->data_p2_p2_m2 = DATA(2,2,-2); +data->data_p3_p2_m2 = DATA(3,2,-2); +data->data_m2_p3_m2 = DATA(-2,3,-2); +data->data_m1_p3_m2 = DATA(-1,3,-2); +data->data_0_p3_m2 = DATA(0,3,-2); +data->data_p1_p3_m2 = DATA(1,3,-2); +data->data_p2_p3_m2 = DATA(2,3,-2); +data->data_p3_p3_m2 = DATA(3,3,-2); +data->data_m2_m2_m1 = DATA(-2,-2,-1); +data->data_m1_m2_m1 = DATA(-1,-2,-1); +data->data_0_m2_m1 = DATA(0,-2,-1); +data->data_p1_m2_m1 = DATA(1,-2,-1); +data->data_p2_m2_m1 = DATA(2,-2,-1); +data->data_p3_m2_m1 = DATA(3,-2,-1); +data->data_m2_m1_m1 = DATA(-2,-1,-1); +data->data_m1_m1_m1 = DATA(-1,-1,-1); +data->data_0_m1_m1 = DATA(0,-1,-1); +data->data_p1_m1_m1 = DATA(1,-1,-1); +data->data_p2_m1_m1 = DATA(2,-1,-1); +data->data_p3_m1_m1 = DATA(3,-1,-1); +data->data_m2_0_m1 = DATA(-2,0,-1); +data->data_m1_0_m1 = DATA(-1,0,-1); +data->data_0_0_m1 = DATA(0,0,-1); +data->data_p1_0_m1 = DATA(1,0,-1); +data->data_p2_0_m1 = DATA(2,0,-1); +data->data_p3_0_m1 = DATA(3,0,-1); +data->data_m2_p1_m1 = DATA(-2,1,-1); +data->data_m1_p1_m1 = DATA(-1,1,-1); +data->data_0_p1_m1 = DATA(0,1,-1); +data->data_p1_p1_m1 = DATA(1,1,-1); +data->data_p2_p1_m1 = DATA(2,1,-1); +data->data_p3_p1_m1 = DATA(3,1,-1); +data->data_m2_p2_m1 = DATA(-2,2,-1); +data->data_m1_p2_m1 = DATA(-1,2,-1); +data->data_0_p2_m1 = DATA(0,2,-1); +data->data_p1_p2_m1 = DATA(1,2,-1); +data->data_p2_p2_m1 = DATA(2,2,-1); +data->data_p3_p2_m1 = DATA(3,2,-1); +data->data_m2_p3_m1 = DATA(-2,3,-1); +data->data_m1_p3_m1 = DATA(-1,3,-1); +data->data_0_p3_m1 = DATA(0,3,-1); +data->data_p1_p3_m1 = DATA(1,3,-1); +data->data_p2_p3_m1 = DATA(2,3,-1); +data->data_p3_p3_m1 = DATA(3,3,-1); +data->data_m2_m2_0 = DATA(-2,-2,0); +data->data_m1_m2_0 = DATA(-1,-2,0); +data->data_0_m2_0 = DATA(0,-2,0); +data->data_p1_m2_0 = DATA(1,-2,0); +data->data_p2_m2_0 = DATA(2,-2,0); +data->data_p3_m2_0 = DATA(3,-2,0); +data->data_m2_m1_0 = DATA(-2,-1,0); +data->data_m1_m1_0 = DATA(-1,-1,0); +data->data_0_m1_0 = DATA(0,-1,0); +data->data_p1_m1_0 = DATA(1,-1,0); +data->data_p2_m1_0 = DATA(2,-1,0); +data->data_p3_m1_0 = DATA(3,-1,0); +data->data_m2_0_0 = DATA(-2,0,0); +data->data_m1_0_0 = DATA(-1,0,0); +data->data_0_0_0 = DATA(0,0,0); +data->data_p1_0_0 = DATA(1,0,0); +data->data_p2_0_0 = DATA(2,0,0); +data->data_p3_0_0 = DATA(3,0,0); +data->data_m2_p1_0 = DATA(-2,1,0); +data->data_m1_p1_0 = DATA(-1,1,0); +data->data_0_p1_0 = DATA(0,1,0); +data->data_p1_p1_0 = DATA(1,1,0); +data->data_p2_p1_0 = DATA(2,1,0); +data->data_p3_p1_0 = DATA(3,1,0); +data->data_m2_p2_0 = DATA(-2,2,0); +data->data_m1_p2_0 = DATA(-1,2,0); +data->data_0_p2_0 = DATA(0,2,0); +data->data_p1_p2_0 = DATA(1,2,0); +data->data_p2_p2_0 = DATA(2,2,0); +data->data_p3_p2_0 = DATA(3,2,0); +data->data_m2_p3_0 = DATA(-2,3,0); +data->data_m1_p3_0 = DATA(-1,3,0); +data->data_0_p3_0 = DATA(0,3,0); +data->data_p1_p3_0 = DATA(1,3,0); +data->data_p2_p3_0 = DATA(2,3,0); +data->data_p3_p3_0 = DATA(3,3,0); +data->data_m2_m2_p1 = DATA(-2,-2,1); +data->data_m1_m2_p1 = DATA(-1,-2,1); +data->data_0_m2_p1 = DATA(0,-2,1); +data->data_p1_m2_p1 = DATA(1,-2,1); +data->data_p2_m2_p1 = DATA(2,-2,1); +data->data_p3_m2_p1 = DATA(3,-2,1); +data->data_m2_m1_p1 = DATA(-2,-1,1); +data->data_m1_m1_p1 = DATA(-1,-1,1); +data->data_0_m1_p1 = DATA(0,-1,1); +data->data_p1_m1_p1 = DATA(1,-1,1); +data->data_p2_m1_p1 = DATA(2,-1,1); +data->data_p3_m1_p1 = DATA(3,-1,1); +data->data_m2_0_p1 = DATA(-2,0,1); +data->data_m1_0_p1 = DATA(-1,0,1); +data->data_0_0_p1 = DATA(0,0,1); +data->data_p1_0_p1 = DATA(1,0,1); +data->data_p2_0_p1 = DATA(2,0,1); +data->data_p3_0_p1 = DATA(3,0,1); +data->data_m2_p1_p1 = DATA(-2,1,1); +data->data_m1_p1_p1 = DATA(-1,1,1); +data->data_0_p1_p1 = DATA(0,1,1); +data->data_p1_p1_p1 = DATA(1,1,1); +data->data_p2_p1_p1 = DATA(2,1,1); +data->data_p3_p1_p1 = DATA(3,1,1); +data->data_m2_p2_p1 = DATA(-2,2,1); +data->data_m1_p2_p1 = DATA(-1,2,1); +data->data_0_p2_p1 = DATA(0,2,1); +data->data_p1_p2_p1 = DATA(1,2,1); +data->data_p2_p2_p1 = DATA(2,2,1); +data->data_p3_p2_p1 = DATA(3,2,1); +data->data_m2_p3_p1 = DATA(-2,3,1); +data->data_m1_p3_p1 = DATA(-1,3,1); +data->data_0_p3_p1 = DATA(0,3,1); +data->data_p1_p3_p1 = DATA(1,3,1); +data->data_p2_p3_p1 = DATA(2,3,1); +data->data_p3_p3_p1 = DATA(3,3,1); +data->data_m2_m2_p2 = DATA(-2,-2,2); +data->data_m1_m2_p2 = DATA(-1,-2,2); +data->data_0_m2_p2 = DATA(0,-2,2); +data->data_p1_m2_p2 = DATA(1,-2,2); +data->data_p2_m2_p2 = DATA(2,-2,2); +data->data_p3_m2_p2 = DATA(3,-2,2); +data->data_m2_m1_p2 = DATA(-2,-1,2); +data->data_m1_m1_p2 = DATA(-1,-1,2); +data->data_0_m1_p2 = DATA(0,-1,2); +data->data_p1_m1_p2 = DATA(1,-1,2); +data->data_p2_m1_p2 = DATA(2,-1,2); +data->data_p3_m1_p2 = DATA(3,-1,2); +data->data_m2_0_p2 = DATA(-2,0,2); +data->data_m1_0_p2 = DATA(-1,0,2); +data->data_0_0_p2 = DATA(0,0,2); +data->data_p1_0_p2 = DATA(1,0,2); +data->data_p2_0_p2 = DATA(2,0,2); +data->data_p3_0_p2 = DATA(3,0,2); +data->data_m2_p1_p2 = DATA(-2,1,2); +data->data_m1_p1_p2 = DATA(-1,1,2); +data->data_0_p1_p2 = DATA(0,1,2); +data->data_p1_p1_p2 = DATA(1,1,2); +data->data_p2_p1_p2 = DATA(2,1,2); +data->data_p3_p1_p2 = DATA(3,1,2); +data->data_m2_p2_p2 = DATA(-2,2,2); +data->data_m1_p2_p2 = DATA(-1,2,2); +data->data_0_p2_p2 = DATA(0,2,2); +data->data_p1_p2_p2 = DATA(1,2,2); +data->data_p2_p2_p2 = DATA(2,2,2); +data->data_p3_p2_p2 = DATA(3,2,2); +data->data_m2_p3_p2 = DATA(-2,3,2); +data->data_m1_p3_p2 = DATA(-1,3,2); +data->data_0_p3_p2 = DATA(0,3,2); +data->data_p1_p3_p2 = DATA(1,3,2); +data->data_p2_p3_p2 = DATA(2,3,2); +data->data_p3_p3_p2 = DATA(3,3,2); +data->data_m2_m2_p3 = DATA(-2,-2,3); +data->data_m1_m2_p3 = DATA(-1,-2,3); +data->data_0_m2_p3 = DATA(0,-2,3); +data->data_p1_m2_p3 = DATA(1,-2,3); +data->data_p2_m2_p3 = DATA(2,-2,3); +data->data_p3_m2_p3 = DATA(3,-2,3); +data->data_m2_m1_p3 = DATA(-2,-1,3); +data->data_m1_m1_p3 = DATA(-1,-1,3); +data->data_0_m1_p3 = DATA(0,-1,3); +data->data_p1_m1_p3 = DATA(1,-1,3); +data->data_p2_m1_p3 = DATA(2,-1,3); +data->data_p3_m1_p3 = DATA(3,-1,3); +data->data_m2_0_p3 = DATA(-2,0,3); +data->data_m1_0_p3 = DATA(-1,0,3); +data->data_0_0_p3 = DATA(0,0,3); +data->data_p1_0_p3 = DATA(1,0,3); +data->data_p2_0_p3 = DATA(2,0,3); +data->data_p3_0_p3 = DATA(3,0,3); +data->data_m2_p1_p3 = DATA(-2,1,3); +data->data_m1_p1_p3 = DATA(-1,1,3); +data->data_0_p1_p3 = DATA(0,1,3); +data->data_p1_p1_p3 = DATA(1,1,3); +data->data_p2_p1_p3 = DATA(2,1,3); +data->data_p3_p1_p3 = DATA(3,1,3); +data->data_m2_p2_p3 = DATA(-2,2,3); +data->data_m1_p2_p3 = DATA(-1,2,3); +data->data_0_p2_p3 = DATA(0,2,3); +data->data_p1_p2_p3 = DATA(1,2,3); +data->data_p2_p2_p3 = DATA(2,2,3); +data->data_p3_p2_p3 = DATA(3,2,3); +data->data_m2_p3_p3 = DATA(-2,3,3); +data->data_m1_p3_p3 = DATA(-1,3,3); +data->data_0_p3_p3 = DATA(0,3,3); +data->data_p1_p3_p3 = DATA(1,3,3); +data->data_p2_p3_p3 = DATA(2,3,3); +data->data_p3_p3_p3 = DATA(3,3,3); diff --git a/src/common/3d.cube.size6/store-coeffs.c b/src/common/3d.cube.size6/store-coeffs.c new file mode 100644 index 0000000..301292b --- /dev/null +++ b/src/common/3d.cube.size6/store-coeffs.c @@ -0,0 +1,216 @@ +COEFF(-2,-2,-2) = factor * coeffs->coeff_m2_m2_m2; +COEFF(-1,-2,-2) = factor * coeffs->coeff_m1_m2_m2; +COEFF(0,-2,-2) = factor * coeffs->coeff_0_m2_m2; +COEFF(1,-2,-2) = factor * coeffs->coeff_p1_m2_m2; +COEFF(2,-2,-2) = factor * coeffs->coeff_p2_m2_m2; +COEFF(3,-2,-2) = factor * coeffs->coeff_p3_m2_m2; +COEFF(-2,-1,-2) = factor * coeffs->coeff_m2_m1_m2; +COEFF(-1,-1,-2) = factor * coeffs->coeff_m1_m1_m2; +COEFF(0,-1,-2) = factor * coeffs->coeff_0_m1_m2; +COEFF(1,-1,-2) = factor * coeffs->coeff_p1_m1_m2; +COEFF(2,-1,-2) = factor * coeffs->coeff_p2_m1_m2; +COEFF(3,-1,-2) = factor * coeffs->coeff_p3_m1_m2; +COEFF(-2,0,-2) = factor * coeffs->coeff_m2_0_m2; +COEFF(-1,0,-2) = factor * coeffs->coeff_m1_0_m2; +COEFF(0,0,-2) = factor * coeffs->coeff_0_0_m2; +COEFF(1,0,-2) = factor * coeffs->coeff_p1_0_m2; +COEFF(2,0,-2) = factor * coeffs->coeff_p2_0_m2; +COEFF(3,0,-2) = factor * coeffs->coeff_p3_0_m2; +COEFF(-2,1,-2) = factor * coeffs->coeff_m2_p1_m2; +COEFF(-1,1,-2) = factor * coeffs->coeff_m1_p1_m2; +COEFF(0,1,-2) = factor * coeffs->coeff_0_p1_m2; +COEFF(1,1,-2) = factor * coeffs->coeff_p1_p1_m2; +COEFF(2,1,-2) = factor * coeffs->coeff_p2_p1_m2; +COEFF(3,1,-2) = factor * coeffs->coeff_p3_p1_m2; +COEFF(-2,2,-2) = factor * coeffs->coeff_m2_p2_m2; +COEFF(-1,2,-2) = factor * coeffs->coeff_m1_p2_m2; +COEFF(0,2,-2) = factor * coeffs->coeff_0_p2_m2; +COEFF(1,2,-2) = factor * coeffs->coeff_p1_p2_m2; +COEFF(2,2,-2) = factor * coeffs->coeff_p2_p2_m2; +COEFF(3,2,-2) = factor * coeffs->coeff_p3_p2_m2; +COEFF(-2,3,-2) = factor * coeffs->coeff_m2_p3_m2; +COEFF(-1,3,-2) = factor * coeffs->coeff_m1_p3_m2; +COEFF(0,3,-2) = factor * coeffs->coeff_0_p3_m2; +COEFF(1,3,-2) = factor * coeffs->coeff_p1_p3_m2; +COEFF(2,3,-2) = factor * coeffs->coeff_p2_p3_m2; +COEFF(3,3,-2) = factor * coeffs->coeff_p3_p3_m2; +COEFF(-2,-2,-1) = factor * coeffs->coeff_m2_m2_m1; +COEFF(-1,-2,-1) = factor * coeffs->coeff_m1_m2_m1; +COEFF(0,-2,-1) = factor * coeffs->coeff_0_m2_m1; +COEFF(1,-2,-1) = factor * coeffs->coeff_p1_m2_m1; +COEFF(2,-2,-1) = factor * coeffs->coeff_p2_m2_m1; +COEFF(3,-2,-1) = factor * coeffs->coeff_p3_m2_m1; +COEFF(-2,-1,-1) = factor * coeffs->coeff_m2_m1_m1; +COEFF(-1,-1,-1) = factor * coeffs->coeff_m1_m1_m1; +COEFF(0,-1,-1) = factor * coeffs->coeff_0_m1_m1; +COEFF(1,-1,-1) = factor * coeffs->coeff_p1_m1_m1; +COEFF(2,-1,-1) = factor * coeffs->coeff_p2_m1_m1; +COEFF(3,-1,-1) = factor * coeffs->coeff_p3_m1_m1; +COEFF(-2,0,-1) = factor * coeffs->coeff_m2_0_m1; +COEFF(-1,0,-1) = factor * coeffs->coeff_m1_0_m1; +COEFF(0,0,-1) = factor * coeffs->coeff_0_0_m1; +COEFF(1,0,-1) = factor * coeffs->coeff_p1_0_m1; +COEFF(2,0,-1) = factor * coeffs->coeff_p2_0_m1; +COEFF(3,0,-1) = factor * coeffs->coeff_p3_0_m1; +COEFF(-2,1,-1) = factor * coeffs->coeff_m2_p1_m1; +COEFF(-1,1,-1) = factor * coeffs->coeff_m1_p1_m1; +COEFF(0,1,-1) = factor * coeffs->coeff_0_p1_m1; +COEFF(1,1,-1) = factor * coeffs->coeff_p1_p1_m1; +COEFF(2,1,-1) = factor * coeffs->coeff_p2_p1_m1; +COEFF(3,1,-1) = factor * coeffs->coeff_p3_p1_m1; +COEFF(-2,2,-1) = factor * coeffs->coeff_m2_p2_m1; +COEFF(-1,2,-1) = factor * coeffs->coeff_m1_p2_m1; +COEFF(0,2,-1) = factor * coeffs->coeff_0_p2_m1; +COEFF(1,2,-1) = factor * coeffs->coeff_p1_p2_m1; +COEFF(2,2,-1) = factor * coeffs->coeff_p2_p2_m1; +COEFF(3,2,-1) = factor * coeffs->coeff_p3_p2_m1; +COEFF(-2,3,-1) = factor * coeffs->coeff_m2_p3_m1; +COEFF(-1,3,-1) = factor * coeffs->coeff_m1_p3_m1; +COEFF(0,3,-1) = factor * coeffs->coeff_0_p3_m1; +COEFF(1,3,-1) = factor * coeffs->coeff_p1_p3_m1; +COEFF(2,3,-1) = factor * coeffs->coeff_p2_p3_m1; +COEFF(3,3,-1) = factor * coeffs->coeff_p3_p3_m1; +COEFF(-2,-2,0) = factor * coeffs->coeff_m2_m2_0; +COEFF(-1,-2,0) = factor * coeffs->coeff_m1_m2_0; +COEFF(0,-2,0) = factor * coeffs->coeff_0_m2_0; +COEFF(1,-2,0) = factor * coeffs->coeff_p1_m2_0; +COEFF(2,-2,0) = factor * coeffs->coeff_p2_m2_0; +COEFF(3,-2,0) = factor * coeffs->coeff_p3_m2_0; +COEFF(-2,-1,0) = factor * coeffs->coeff_m2_m1_0; +COEFF(-1,-1,0) = factor * coeffs->coeff_m1_m1_0; +COEFF(0,-1,0) = factor * coeffs->coeff_0_m1_0; +COEFF(1,-1,0) = factor * coeffs->coeff_p1_m1_0; +COEFF(2,-1,0) = factor * coeffs->coeff_p2_m1_0; +COEFF(3,-1,0) = factor * coeffs->coeff_p3_m1_0; +COEFF(-2,0,0) = factor * coeffs->coeff_m2_0_0; +COEFF(-1,0,0) = factor * coeffs->coeff_m1_0_0; +COEFF(0,0,0) = factor * coeffs->coeff_0_0_0; +COEFF(1,0,0) = factor * coeffs->coeff_p1_0_0; +COEFF(2,0,0) = factor * coeffs->coeff_p2_0_0; +COEFF(3,0,0) = factor * coeffs->coeff_p3_0_0; +COEFF(-2,1,0) = factor * coeffs->coeff_m2_p1_0; +COEFF(-1,1,0) = factor * coeffs->coeff_m1_p1_0; +COEFF(0,1,0) = factor * coeffs->coeff_0_p1_0; +COEFF(1,1,0) = factor * coeffs->coeff_p1_p1_0; +COEFF(2,1,0) = factor * coeffs->coeff_p2_p1_0; +COEFF(3,1,0) = factor * coeffs->coeff_p3_p1_0; +COEFF(-2,2,0) = factor * coeffs->coeff_m2_p2_0; +COEFF(-1,2,0) = factor * coeffs->coeff_m1_p2_0; +COEFF(0,2,0) = factor * coeffs->coeff_0_p2_0; +COEFF(1,2,0) = factor * coeffs->coeff_p1_p2_0; +COEFF(2,2,0) = factor * coeffs->coeff_p2_p2_0; +COEFF(3,2,0) = factor * coeffs->coeff_p3_p2_0; +COEFF(-2,3,0) = factor * coeffs->coeff_m2_p3_0; +COEFF(-1,3,0) = factor * coeffs->coeff_m1_p3_0; +COEFF(0,3,0) = factor * coeffs->coeff_0_p3_0; +COEFF(1,3,0) = factor * coeffs->coeff_p1_p3_0; +COEFF(2,3,0) = factor * coeffs->coeff_p2_p3_0; +COEFF(3,3,0) = factor * coeffs->coeff_p3_p3_0; +COEFF(-2,-2,1) = factor * coeffs->coeff_m2_m2_p1; +COEFF(-1,-2,1) = factor * coeffs->coeff_m1_m2_p1; +COEFF(0,-2,1) = factor * coeffs->coeff_0_m2_p1; +COEFF(1,-2,1) = factor * coeffs->coeff_p1_m2_p1; +COEFF(2,-2,1) = factor * coeffs->coeff_p2_m2_p1; +COEFF(3,-2,1) = factor * coeffs->coeff_p3_m2_p1; +COEFF(-2,-1,1) = factor * coeffs->coeff_m2_m1_p1; +COEFF(-1,-1,1) = factor * coeffs->coeff_m1_m1_p1; +COEFF(0,-1,1) = factor * coeffs->coeff_0_m1_p1; +COEFF(1,-1,1) = factor * coeffs->coeff_p1_m1_p1; +COEFF(2,-1,1) = factor * coeffs->coeff_p2_m1_p1; +COEFF(3,-1,1) = factor * coeffs->coeff_p3_m1_p1; +COEFF(-2,0,1) = factor * coeffs->coeff_m2_0_p1; +COEFF(-1,0,1) = factor * coeffs->coeff_m1_0_p1; +COEFF(0,0,1) = factor * coeffs->coeff_0_0_p1; +COEFF(1,0,1) = factor * coeffs->coeff_p1_0_p1; +COEFF(2,0,1) = factor * coeffs->coeff_p2_0_p1; +COEFF(3,0,1) = factor * coeffs->coeff_p3_0_p1; +COEFF(-2,1,1) = factor * coeffs->coeff_m2_p1_p1; +COEFF(-1,1,1) = factor * coeffs->coeff_m1_p1_p1; +COEFF(0,1,1) = factor * coeffs->coeff_0_p1_p1; +COEFF(1,1,1) = factor * coeffs->coeff_p1_p1_p1; +COEFF(2,1,1) = factor * coeffs->coeff_p2_p1_p1; +COEFF(3,1,1) = factor * coeffs->coeff_p3_p1_p1; +COEFF(-2,2,1) = factor * coeffs->coeff_m2_p2_p1; +COEFF(-1,2,1) = factor * coeffs->coeff_m1_p2_p1; +COEFF(0,2,1) = factor * coeffs->coeff_0_p2_p1; +COEFF(1,2,1) = factor * coeffs->coeff_p1_p2_p1; +COEFF(2,2,1) = factor * coeffs->coeff_p2_p2_p1; +COEFF(3,2,1) = factor * coeffs->coeff_p3_p2_p1; +COEFF(-2,3,1) = factor * coeffs->coeff_m2_p3_p1; +COEFF(-1,3,1) = factor * coeffs->coeff_m1_p3_p1; +COEFF(0,3,1) = factor * coeffs->coeff_0_p3_p1; +COEFF(1,3,1) = factor * coeffs->coeff_p1_p3_p1; +COEFF(2,3,1) = factor * coeffs->coeff_p2_p3_p1; +COEFF(3,3,1) = factor * coeffs->coeff_p3_p3_p1; +COEFF(-2,-2,2) = factor * coeffs->coeff_m2_m2_p2; +COEFF(-1,-2,2) = factor * coeffs->coeff_m1_m2_p2; +COEFF(0,-2,2) = factor * coeffs->coeff_0_m2_p2; +COEFF(1,-2,2) = factor * coeffs->coeff_p1_m2_p2; +COEFF(2,-2,2) = factor * coeffs->coeff_p2_m2_p2; +COEFF(3,-2,2) = factor * coeffs->coeff_p3_m2_p2; +COEFF(-2,-1,2) = factor * coeffs->coeff_m2_m1_p2; +COEFF(-1,-1,2) = factor * coeffs->coeff_m1_m1_p2; +COEFF(0,-1,2) = factor * coeffs->coeff_0_m1_p2; +COEFF(1,-1,2) = factor * coeffs->coeff_p1_m1_p2; +COEFF(2,-1,2) = factor * coeffs->coeff_p2_m1_p2; +COEFF(3,-1,2) = factor * coeffs->coeff_p3_m1_p2; +COEFF(-2,0,2) = factor * coeffs->coeff_m2_0_p2; +COEFF(-1,0,2) = factor * coeffs->coeff_m1_0_p2; +COEFF(0,0,2) = factor * coeffs->coeff_0_0_p2; +COEFF(1,0,2) = factor * coeffs->coeff_p1_0_p2; +COEFF(2,0,2) = factor * coeffs->coeff_p2_0_p2; +COEFF(3,0,2) = factor * coeffs->coeff_p3_0_p2; +COEFF(-2,1,2) = factor * coeffs->coeff_m2_p1_p2; +COEFF(-1,1,2) = factor * coeffs->coeff_m1_p1_p2; +COEFF(0,1,2) = factor * coeffs->coeff_0_p1_p2; +COEFF(1,1,2) = factor * coeffs->coeff_p1_p1_p2; +COEFF(2,1,2) = factor * coeffs->coeff_p2_p1_p2; +COEFF(3,1,2) = factor * coeffs->coeff_p3_p1_p2; +COEFF(-2,2,2) = factor * coeffs->coeff_m2_p2_p2; +COEFF(-1,2,2) = factor * coeffs->coeff_m1_p2_p2; +COEFF(0,2,2) = factor * coeffs->coeff_0_p2_p2; +COEFF(1,2,2) = factor * coeffs->coeff_p1_p2_p2; +COEFF(2,2,2) = factor * coeffs->coeff_p2_p2_p2; +COEFF(3,2,2) = factor * coeffs->coeff_p3_p2_p2; +COEFF(-2,3,2) = factor * coeffs->coeff_m2_p3_p2; +COEFF(-1,3,2) = factor * coeffs->coeff_m1_p3_p2; +COEFF(0,3,2) = factor * coeffs->coeff_0_p3_p2; +COEFF(1,3,2) = factor * coeffs->coeff_p1_p3_p2; +COEFF(2,3,2) = factor * coeffs->coeff_p2_p3_p2; +COEFF(3,3,2) = factor * coeffs->coeff_p3_p3_p2; +COEFF(-2,-2,3) = factor * coeffs->coeff_m2_m2_p3; +COEFF(-1,-2,3) = factor * coeffs->coeff_m1_m2_p3; +COEFF(0,-2,3) = factor * coeffs->coeff_0_m2_p3; +COEFF(1,-2,3) = factor * coeffs->coeff_p1_m2_p3; +COEFF(2,-2,3) = factor * coeffs->coeff_p2_m2_p3; +COEFF(3,-2,3) = factor * coeffs->coeff_p3_m2_p3; +COEFF(-2,-1,3) = factor * coeffs->coeff_m2_m1_p3; +COEFF(-1,-1,3) = factor * coeffs->coeff_m1_m1_p3; +COEFF(0,-1,3) = factor * coeffs->coeff_0_m1_p3; +COEFF(1,-1,3) = factor * coeffs->coeff_p1_m1_p3; +COEFF(2,-1,3) = factor * coeffs->coeff_p2_m1_p3; +COEFF(3,-1,3) = factor * coeffs->coeff_p3_m1_p3; +COEFF(-2,0,3) = factor * coeffs->coeff_m2_0_p3; +COEFF(-1,0,3) = factor * coeffs->coeff_m1_0_p3; +COEFF(0,0,3) = factor * coeffs->coeff_0_0_p3; +COEFF(1,0,3) = factor * coeffs->coeff_p1_0_p3; +COEFF(2,0,3) = factor * coeffs->coeff_p2_0_p3; +COEFF(3,0,3) = factor * coeffs->coeff_p3_0_p3; +COEFF(-2,1,3) = factor * coeffs->coeff_m2_p1_p3; +COEFF(-1,1,3) = factor * coeffs->coeff_m1_p1_p3; +COEFF(0,1,3) = factor * coeffs->coeff_0_p1_p3; +COEFF(1,1,3) = factor * coeffs->coeff_p1_p1_p3; +COEFF(2,1,3) = factor * coeffs->coeff_p2_p1_p3; +COEFF(3,1,3) = factor * coeffs->coeff_p3_p1_p3; +COEFF(-2,2,3) = factor * coeffs->coeff_m2_p2_p3; +COEFF(-1,2,3) = factor * coeffs->coeff_m1_p2_p3; +COEFF(0,2,3) = factor * coeffs->coeff_0_p2_p3; +COEFF(1,2,3) = factor * coeffs->coeff_p1_p2_p3; +COEFF(2,2,3) = factor * coeffs->coeff_p2_p2_p3; +COEFF(3,2,3) = factor * coeffs->coeff_p3_p2_p3; +COEFF(-2,3,3) = factor * coeffs->coeff_m2_p3_p3; +COEFF(-1,3,3) = factor * coeffs->coeff_m1_p3_p3; +COEFF(0,3,3) = factor * coeffs->coeff_0_p3_p3; +COEFF(1,3,3) = factor * coeffs->coeff_p1_p3_p3; +COEFF(2,3,3) = factor * coeffs->coeff_p2_p3_p3; +COEFF(3,3,3) = factor * coeffs->coeff_p3_p3_p3; diff --git a/src/common/3d.log b/src/common/3d.log new file mode 100644 index 0000000..fb21e89 --- /dev/null +++ b/src/common/3d.log @@ -0,0 +1,1888 @@ + |\^/| Maple 7 (IBM INTEL LINUX) +._|\| |/|_. Copyright (c) 2001 by Waterloo Maple Inc. + \ MAPLE / All rights reserved. Maple is a registered trademark of + <____ ____> Waterloo Maple Inc. + | Type ? for help. +# util.maple -- misc utility routines +# $Header$ +> +# +# fix_rationals - convert numbers to RATIONAL() calls +# nonmatching_names - find names in a list which *don't* have a specified prefix +# sprint_numeric_list - convert a numeric list to a valid C identifier suffix +# print_name_list_dcl - print C declarations for a list of names +# +# hypercube_points - compute all (integer) points in an N-dimensional hypercube +# +# ftruncate - truncate a file to zero length +# +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function converts all {integer, rational} subexpressions of its +# input except integer exponents and -1 factors in products, into function +# calls +# RATIONAL(num,den) +# This is useful in conjunction with the C() library function, since +# +# C( (1/3) * foo * bar ) +# t0 = foo*bar/3; +# +# generates a (slow) division (and runs the risk of mixed-mode-arithmetic +# problems), while +# +# C((1.0/3.0) * foo * bar); +# t0 = 0.3333333333*foo*bar; +# +# suffers from roundoff error. With this function, +# +# fix_rationals((1/3) * foo * bar); +# RATIONAL(1,3) foo bar +# C(%); +# t0 = RATIONAL(1.0,3.0)*foo*bar; +# +# which a C preprocessor macro can easily convert to the desired +# +# t0 = (1.0/3.0)*foo*bar; +# +# Additionally, this function can be told to leave certain types of +# subexpressions unconverged. For example, +# fix_rationals(expr, type, specfunc(integer, DATA)); +# will leave all subexpressions of the form DATA(integer arguments) +# unconverted. +# +# Arguments: +# expr = (in) The expression to be converted. +# inert_fn = (optional in) +# If specified, this argument should be a Boolean procedure +# or the name of a Boolean procedure. This procedure should +# take one or more argument, and return true if and only if +# the first argument should *not* be converted, i.e. if we +# should leave this expression unchanged. See the last +# example above. +# ... = (optional in) +# Any further arguments are passed as additional arguments to +# the inert_fn procedure. +# +> fix_rationals := +> proc( +> expr::{ +> algebraic, name = algebraic, +> list({algebraic, name = algebraic}), +> set ({algebraic, name = algebraic}) +> }, +> inert_fn::{name, procedure} +> ) +> local nn, k, +> base, power, fbase, fpower, +> fn, fn_args_list, +> num, den, mult; +> +# do we want to convert this expression? +> if ((nargs >= 2) and inert_fn(expr, args[3..nargs])) +> then return expr; +> end if; +> +# recurse over lists and sets +> if (type(expr, {list,set})) +> then return map(fix_rationals, expr, args[2..nargs]); +> end if; +> +# recurse over equation right hand sides +> if (type(expr, name = algebraic)) +> then return ( lhs(expr) = fix_rationals(rhs(expr), args[2..nargs]) ); +> end if; +> +# recurse over functions other than RATIONAL() +> if (type(expr, function)) +> then +> fn := op(0, expr); +> if (fn <> 'RATIONAL') +> then +> fn_args_list := [op(expr)]; +> fn_args_list := map(fix_rationals, fn_args_list, args[2..nargs]); +> fn; return '%'( op(fn_args_list) ); +> end if; +> end if; +> +> nn := nops(expr); +> +# recurse over sums +> if (type(expr, `+`)) +> then return sum('fix_rationals(op(k,expr), args[2..nargs])', 'k'=1..nn); +> end if; +> +# recurse over products +# ... leaving leading -1 factors intact, i.e. not converted to RATIONAL(-1,1) +> if (type(expr, `*`)) +> then +> if (op(1, expr) = -1) +> then return -1*fix_rationals(remove(type, expr, 'identical(-1)'), +> args[2..nargs]); +> else return product('fix_rationals(op(k,expr), args[2..nargs])', +> 'k'=1..nn); +> end if; +> end if; +> +# recurse over powers +# ... leaving integer exponents intact +> if (type(expr, `^`)) +> then +> base := op(1, expr); +> power := op(2, expr); +> +> fbase := fix_rationals(base, args[2..nargs]); +> if (type(power, integer)) +> then fpower := power; +> else fpower := fix_rationals(power, args[2..nargs]); +> end if; +> return fbase ^ fpower; +> end if; +> +# fix integers and fractions +> if (type(expr, integer)) +> then return 'RATIONAL'(expr, 1); +> end if; +> if (type(expr, fraction)) +> then +> num := op(1, expr); +> den := op(2, expr); +> +> return 'RATIONAL'(num, den); +> end if; +> +# turn Maple floating-point into integer fraction, then recursively fix that +> if (type(expr, float)) +> then +> mult := op(1, expr); +> power := op(2, expr); +> return fix_rationals(mult * 10^power, args[2..nargs]); +> end if; +> +# identity op on names +> if (type(expr, name)) +> then return expr; +> end if; +> +# unknown type +> error "%0", +> "unknown type for expr!", +> " whattype(expr) = ", whattype(expr), +> " expr = ", expr; +> end proc; +fix_rationals := proc(expr::{algebraic, name = algebraic, +list({algebraic, name = algebraic}), set({algebraic, name = algebraic})}, +inert_fn::{procedure, name}) +local nn, k, base, power, fbase, fpower, fn, fn_args_list, num, den, mult; + if 2 <= nargs and inert_fn(expr, args[3 .. nargs]) then return expr + end if; + if type(expr, {set, list}) then + return map(fix_rationals, expr, args[2 .. nargs]) + end if; + if type(expr, name = algebraic) then + return lhs(expr) = fix_rationals(rhs(expr), args[2 .. nargs]) + end if; + if type(expr, function) then + fn := op(0, expr); + if fn <> 'RATIONAL' then + fn_args_list := [op(expr)]; + fn_args_list := + map(fix_rationals, fn_args_list, args[2 .. nargs]); + fn; + return '%'(op(fn_args_list)) + end if + end if; + nn := nops(expr); + if type(expr, `+`) then return + sum('fix_rationals(op(k, expr), args[2 .. nargs])', 'k' = 1 .. nn) + end if; + if type(expr, `*`) then + if op(1, expr) = -1 then return -fix_rationals( + remove(type, expr, 'identical(-1)'), args[2 .. nargs]) + else return product('fix_rationals(op(k, expr), args[2 .. nargs])', + 'k' = 1 .. nn) + end if + end if; + if type(expr, `^`) then + base := op(1, expr); + power := op(2, expr); + fbase := fix_rationals(base, args[2 .. nargs]); + if type(power, integer) then fpower := power + else fpower := fix_rationals(power, args[2 .. nargs]) + end if; + return fbase^fpower + end if; + if type(expr, integer) then return 'RATIONAL'(expr, 1) end if; + if type(expr, fraction) then + num := op(1, expr); den := op(2, expr); return 'RATIONAL'(num, den) + end if; + if type(expr, float) then + mult := op(1, expr); + power := op(2, expr); + return fix_rationals(mult*10^power, args[2 .. nargs]) + end if; + if type(expr, name) then return expr end if; + error "%0", "unknown type for expr!", " whattype(expr) = ", + whattype(expr), " expr = ", expr +end proc + +> +################################################################################ +> +# +# This function finds names in a list which *don't* have a specified prefix. +# +# Arguments: +# name_list = A list of the names. +# prefix = The prefix we want to filter out. +# +# Results: +# This function returns the subset list of names which don't have the +# specified prefix. +# +> nonmatching_names := +> proc( name_list::list({name,string}), prefix::{name,string} ) +> +> select( proc(n) +> evalb(not StringTools[IsPrefix](prefix,n)); +> end proc +> , +> name_list +> ); +> end proc; +nonmatching_names := proc( +name_list::list({name, string}), prefix::{name, string}) + select(proc(n) evalb(not StringTools[IsPrefix](prefix, n)) end proc, + name_list) +end proc + +> +################################################################################ +> +# +# This function converts a numeric list to a string which is a valid +# C identifier suffix: elements are separated by "_", decimal points are +# replaced by "x", and all nonzero values have explicit +/- signs, which +# are replaced by "p"/"m". +# +# For example, [0,-3.5,+4] --> "0_m3x5_p4". +# +> sprint_numeric_list := +> proc(nlist::list(numeric)) +> +# generate preliminary string, eg "+0_-3.5_+4" +> map2(sprintf, "%+a", nlist); +> ListTools[Join](%, "_"); +> cat(op(%)); +> +# fixup bad characters +> StringTools[SubstituteAll](%, "+0", "0"); +> StringTools[CharacterMap](".+-", "xpm", %); +> +> return %; +> end proc; +sprint_numeric_list := proc(nlist::list(numeric)) + map2(sprintf, "%+a", nlist); + ListTools[Join](%, "_"); + cat(op(%)); + StringTools[SubstituteAll](%, "+0", "0"); + StringTools[CharacterMap](".+-", "xpm", %); + return % +end proc + +> +################################################################################ +> +# +# This function prints a sequence of C declarations for a list of names. +# +# Argument: +# name_list = A list of the names. +# type_name = The C type of the names, eg. "double". +# file_name = The file name to write the declaration to. This is +# truncated before writing. +# +> print_name_list_dcl := +> proc( name_list::list({name,string}), +> type_name::string, +> file_name::string ) +> local blanks, separator_string; +> +> ftruncate(file_name); +> +> map( +> proc(var::{name,string}) +> fprintf(file_name, +> "%s %s;\n", +> type_name, var); +> end proc +> , +> name_list +> ); +> +> fclose(file_name); +> NULL; +> end proc; +print_name_list_dcl := proc( +name_list::list({name, string}), type_name::string, file_name::string) +local blanks, separator_string; + ftruncate(file_name); + map(proc(var::{name, string}) + fprintf(file_name, "%s %s;\n", type_name, var) + end proc, name_list); + fclose(file_name); + NULL +end proc + +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function computes a list of all the (integer) points in an +# N-dimensional hypercube, in lexicographic order. The present +# implementation requires N <= 4. +# +# Arguments: +# cmin,cmax = N-element lists of cube minimum/maximum coordinates. +# +# Results: +# The function returns a set of d-element lists giving the coordinates. +# For example, +# hypercube([0,0], [2,1] +# returns +# { [0,0], [0,1], [1,0], [1,1], [2,0], [2,1] } +> hypercube_points := +> proc(cmin::list(integer), cmax::list(integer)) +> local N, i,j,k,l; +> +> N := nops(cmin); +> if (nops(cmax) <> N) +> then error +> "must have same number of dimensions for min and max coordinates!"; +> fi; +> +> if (N = 1) +> then return [seq([i], i=cmin[1]..cmax[1])]; +> elif (N = 2) +> then return [ +> seq( +> seq([i,j], j=cmin[2]..cmax[2]), +> i=cmin[1]..cmax[1]) +> ]; +> elif (N = 3) +> then return [ +> seq( +> seq( +> seq([i,j,k], k=cmin[3]..cmax[3]), +> j=cmin[2]..cmax[2] ), +> i=cmin[1]..cmax[1]) +> ]; +> elif (N = 4) +> then return [ +> seq( +> seq( +> seq( +> seq([i,j,k,l], l=cmin[4]..cmax[4]), +> k=cmin[3]..cmax[3] ), +> j=cmin[2]..cmax[2]), +> i=cmin[1]..cmax[1]) +> ]; +> else +> error "implementation restriction: must have N <= 4, got %1!", N; +> fi; +> end proc; +hypercube_points := proc(cmin::list(integer), cmax::list(integer)) +local N, i, j, k, l; + N := nops(cmin); + if nops(cmax) <> N then error + "must have same number of dimensions for min and max coordinates!" + end if; + if N = 1 then return [seq([i], i = cmin[1] .. cmax[1])] + elif N = 2 then return + [seq(seq([i, j], j = cmin[2] .. cmax[2]), i = cmin[1] .. cmax[1])] + elif N = 3 then return [seq( + seq(seq([i, j, k], k = cmin[3] .. cmax[3]), j = cmin[2] .. cmax[2]) + , i = cmin[1] .. cmax[1])] + elif N = 4 then return [seq(seq(seq( + seq([i, j, k, l], l = cmin[4] .. cmax[4]), k = cmin[3] .. cmax[3]), + j = cmin[2] .. cmax[2]), i = cmin[1] .. cmax[1])] + else error "implementation restriction: must have N <= 4, got %1!", N + end if +end proc + +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function truncates a file to 0 length if it exists, or creates +# it at that length if it doesn't exist. +# +# Arguments: +# file_name = (in) The name of the file. +# +> ftruncate := +> proc(file_name::string) +> fopen(file_name, 'WRITE'); +> fclose(%); +> NULL; +> end proc; +ftruncate := + + proc(file_name::string) fopen(file_name, 'WRITE'); fclose(%); NULL end proc + +# interpolate.maple -- compute interpolation formulas/coefficients +# $Header$ +> +# +# <<<representation of numbers, data values, etc>>> +# Lagrange_polynomial_interpolant - compute Lagrange polynomial interpolant +# Hermite_polynomial_interpolant - compute Hermite polynomial interpolant +# coeff_as_lc_of_data - coefficients of ... (linear combination of data) +# +# print_coeff__lc_of_data - print C code to compute coefficients +# print_fetch_data - print C code to fetch input array chunk into struct data +# print_store_coeffs - print C code to store struct coeffs "somewhere" +# print_interp_cmpt__lc_of_data - print C code for computation of interpolant +# +# coeff_name - name of coefficient of data at a given [m] coordinate +# data_var_name - name of variable storing data value at a given [m] coordinate +# +> +################################################################################ +> +# +# ***** representation of numbers, data values, etc ***** +# +# We use RATIONAL(p.0,q.0) to denote the rational number p/q. +# +# We use DATA(...) to represent the data values being interpolated at a +# specified [m] coordinate, where the arguments are the [m] coordinates. +# +# We use COEFF(...) to represent the molecule coefficient at a specified +# [m] coordinate, where the arguments are the [m] coordinates. +# +# For example, the usual 1-D centered 2nd order 1st derivative molecule +# would be written +# RATIONAL(-1.0,2.0)*DATA(-1) + RATIONA(1.0,2.0)*DATA(1) +# and its coefficients as +# COEFF(-1) = RATIONAL(-1.0,2.0) +# COEFF(1) = RATIONAL(1.0,2.0) +# +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function computes a Lagrange polynomial interpolant in any +# number of dimensions. +# +# Arguments: +# fn = The interpolation function. This should be a procedure in the +# coordinates, having the coefficients as global variables. For +# example, +# proc(x,y) c00 + c10*x + c01*y end proc +# coeff_list = A set of the interpolation coefficients (coefficients in +# the interpolation function), for example [c00, c10, c01]. +# coord_list = A list of the coordinates (independent variables in the +# interpolation function), for example [x,y]. +# posn_list = A list of positions (each a list of numeric values) where the +# interpolant is to use data, for example hypercube([0,0], [1,1]). +# Any positions may be used; if they're redundant (as in the +# example) the least-squares interpolant is computed. +# +# Results: +# This function returns the interpolating polynomial, in the form of +# an algebraic expression in the coordinates and the data values. +# +> Lagrange_polynomial_interpolant := +> proc( +> fn::procedure, coeff_list::list(name), +> coord_list::list(name), posn_list::list(list(numeric)) +> ) +> local posn, data_eqns, coeff_eqns; +> +# coefficients of interpolating polynomial +> data_eqns := { seq( fn(op(posn))='DATA'(op(posn)) , posn=posn_list ) }; +> coeff_eqns := linalg[leastsqrs](data_eqns, {op(coeff_list)}); +> if (has(coeff_eqns, '_t')) +> then error "interpolation coefficients aren't uniquely determined!"; +> end if; +> +# interpolant as a polynomial in the coordinates +> return subs(coeff_eqns, eval(fn))(op(coord_list)); +> end proc; +Lagrange_polynomial_interpolant := proc(fn::procedure, coeff_list::list(name), +coord_list::list(name), posn_list::list(list(numeric))) +local posn, data_eqns, coeff_eqns; + data_eqns := {seq(fn(op(posn)) = 'DATA'(op(posn)), posn = posn_list)}; + coeff_eqns := linalg[leastsqrs](data_eqns, {op(coeff_list)}); + if has(coeff_eqns, '_t') then + error "interpolation coefficients aren't uniquely determined!" + end if; + return subs(coeff_eqns, eval(fn))(op(coord_list)) +end proc + +> +################################################################################ +> +# +# This function computes a Hermite polynomial interpolant in any +# number of dimensions. This is a polynomial which +# * has values which match the given data DATA() at a specified set of +# points, and +# * has derivatives which match the specified finite-difference derivatives +# of the given data DATA() at a specified set of points +# +# For the derivative matching, we actually match all possible products +# of 1st derivatives, i.e. in 2-D we match dx, dy, and dxy, in 3-D we +# match dx, dy, dz, dxy, dxz, dyz, and dxyz, etc etc. +# +# Arguments: +# fn = The interpolation function. This should be a procedure in the +# coordinates, having the coefficients as global variables. For +# example, +# proc(x,y) +# + c03*y^3 + c13*x*y^3 + c23*x^2*y^3 + c33*x^3*y^3 +# + c02*y^2 + c12*x*y^2 + c22*x^2*y^2 + c32*x^3*y^2 +# + c01*y + c11*x*y + c21*x^2*y + c31*x^3*y +# + c00 + c10*x + c20*x^2 + c30*x^3 +# end proc; +# coeff_set = A set of the interpolation coefficients (coefficients in +# the interpolation function), for example +# { +# c03, c13, c23, c33, +# c02, c12, c22, c32, +# c01, c11, c21, c31, +# c00, c10, c20, c30 +# } +# coord_list = A list of the coordinates (independent variables in the +# interpolation function), for example [x,y]. +# deriv_set = A set of equations of the form +# {coords} = proc +# giving the derivatives which are to be matched, and the +# procedures to compute their finite-difference approximations. +# Each procedure should take N_dims integer arguments specifying +# an evaluation point, and return a suitable linear combination +# of the DATA() for the derivative at that point. For example +# { +# {x} = proc(i::integer, j::integer) +# - 1/2*DATA(i-1,j) + 1/2*DATA(i+1,j) +# end proc +# , +# {y} = proc(i::integer, j::integer) +# - 1/2*DATA(i,j-1) + 1/2*DATA(i,j+1) +# end proc +# , +# {x,y} = proc(i::integer, j::integer) +# - 1/4*DATA(i-1,j+1) + 1/4*DATA(i+1,j+1) +# + 1/4*DATA(i-1,j-1) - 1/4*DATA(i+1,j-1) +# end proc +# } +# fn_posn_set = A set of positions (each a list of numeric values) +# where the interpolant is to match the given data DATA(), +# for example +# {[0,0], [0,1], [1,0], [1,1]} +# deriv_posn_set = A list of positions (each a list of numeric values) +# where the interpolant is to match the derivatives +# specified by deriv_set , for example +# {[0,0], [0,1], [1,0], [1,1]} +# +# Results: +# This function returns the interpolating polynomial, in the form of +# an algebraic expression in the coordinates and the data values. +# +> Hermite_polynomial_interpolant := +> proc( +> fn::procedure, +> coeff_set::set(name), +> coord_list::list(name), +> deriv_set::set(set(name) = procedure), +> fn_posn_set::set(list(numeric)), +> deriv_posn_set::set(list(numeric)) +> ) +> local fn_eqnset, deriv_eqnset, coeff_eqns, subs_eqnset; +> +> +# +# compute a set of equations +# {fn(posn) = DATA(posn)} +# giving the function values to be matched +# +> fn_eqnset := map( +> # return equation that fn(posn) = DATA(posn) +> proc(posn::list(integer)) +> fn(op(posn)) = 'DATA'(op(posn)); +> end proc +> , +> fn_posn_set +> ); +> +> +# +# compute a set of equations +# { diff(fn,coords)(posn) = DERIV(coords)(posn) } +# giving the derivative values to be matched, where DERIV(coords) +# is a placeholder for the appropriate derivative +# +> map( +> # return set of equations for this particular derivative +> proc(deriv_coords::set(name)) +> local deriv_fn; +> fn(op(coord_list)); +> diff(%, op(deriv_coords)); +> deriv_fn := unapply(%, op(coord_list)); +> map( +> proc(posn::list(integer)) +> deriv_fn(op(posn)) = 'DERIV'(op(deriv_coords))(op(posn)); +> end proc +> , +> deriv_posn_set +> ); +> end proc +> , +> map(lhs, deriv_set) +> ); +> deriv_eqnset := `union`(op(%)); +> +> +# +# solve overall set of equations for coefficients +# in terms of DATA() and DERIV() values +# +> coeff_eqns := solve[linear](fn_eqnset union deriv_eqnset, coeff_set); +> if (indets(map(rhs,%)) <> {}) +> then error "no unique solution for coefficients -- %1 eqns for %2 coeffs", +> nops(fn_eqnset union deriv_eqnset), +> nops(coeff_set); +> fi; +> +> +# +# compute a set of substitution equations +# {'DERIV'(coords) = procedure} +# +> subs_eqnset := map( +> proc(eqn::set(name) = procedure) +> 'DERIV'(op(lhs(eqn))) = rhs(eqn); +> end proc +> , +> deriv_set +> ); +> +> +# +# compute the coefficients in terms of the DATA() values +# +> subs(subs_eqnset, coeff_eqns); +> eval(%); +> +# +# compute the interpolant as a polynomial in the coordinates +# +> subs(%, fn(op(coord_list))); +> end proc; +Hermite_polynomial_interpolant := proc(fn::procedure, coeff_set::set(name), +coord_list::list(name), deriv_set::set(set(name) = procedure), +fn_posn_set::set(list(numeric)), deriv_posn_set::set(list(numeric))) +local fn_eqnset, deriv_eqnset, coeff_eqns, subs_eqnset; + fn_eqnset := map( + proc(posn::list(integer)) fn(op(posn)) = 'DATA'(op(posn)) end proc, + fn_posn_set); + map(proc(deriv_coords::set(name)) + local deriv_fn; + fn(op(coord_list)); + diff(%, op(deriv_coords)); + deriv_fn := unapply(%, op(coord_list)); + map(proc(posn::list(integer)) + deriv_fn(op(posn)) = + 'DERIV'(op(deriv_coords))(op(posn)) + end proc, deriv_posn_set) + end proc, map(lhs, deriv_set)); + deriv_eqnset := `union`(op(%)); + coeff_eqns := solve[linear](fn_eqnset union deriv_eqnset, coeff_set); + if indets(map(rhs, %)) <> {} then error + "no unique solution for coefficients -- %1 eqns for %2 coeffs", + nops(fn_eqnset union deriv_eqnset), nops(coeff_set) + end if; + subs_eqnset := map(proc(eqn::(set(name) = procedure)) + 'DERIV'(op(lhs(eqn))) = rhs(eqn) + end proc, deriv_set); + subs(subs_eqnset, coeff_eqns); + eval(%); + subs(%, fn(op(coord_list))) +end proc + +> +################################################################################ +> +# +# This function takes as input an interpolating polynomial, expresses +# it as a linear combination of the data values, and returns the coefficeints +# of that form. +# +# Arguments: +# interpolant = The interpolating polynomial (an algebraic expression +# in the coordinates and the data values). +# posn_list = The same list of data positions used in the interpolant. +# +# Results: +# This function returns the coefficients, as a list of equations of the +# form COEFF(...) = value , where each value is a polynomial in the +# coordinates. The order of the list matches that of posn_list. +# +> coeff_as_lc_of_data := +> proc( +> interpolant::algebraic, +> posn_list::list(list(numeric)) +> ) +> local data_list, interpolant_as_lc_of_data; +> +# interpolant as a linear combination of the data values +> data_list := [ seq( 'DATA'(op(posn)) , posn=posn_list ) ]; +> interpolant_as_lc_of_data := collect(interpolant, data_list); +> +# coefficients of the data values in the linear combination +> return map( +> proc(posn::list(numeric)) +> coeff(interpolant_as_lc_of_data, DATA(op(posn))); +> 'COEFF'(op(posn)) = %; +> end proc +> , +> posn_list +> ); +> end proc; +coeff_as_lc_of_data := proc( +interpolant::algebraic, posn_list::list(list(numeric))) +local data_list, interpolant_as_lc_of_data; + data_list := [seq('DATA'(op(posn)), posn = posn_list)]; + interpolant_as_lc_of_data := collect(interpolant, data_list); + return map(proc(posn::list(numeric)) + coeff(interpolant_as_lc_of_data, DATA(op(posn))); + 'COEFF'(op(posn)) = % + end proc, posn_list) +end proc + +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function prints C expressions for the coefficients of an +# interpolating polynomial. (The polynomial is expressed as linear +# combinations of the data values with coefficients which are +# RATIONAL(p,q) calls.) +# +# Arguments: +# coeff_list = A list of the coefficients, as returned from +# coeff_as_lc_of_data() . +# coeff_name_prefix = A prefix string for the coefficient names. +# temp_name_type = The C type to be used for Maple-introduced temporary +# names, eg. "double". +# file_name = The file name to write the coefficients to. This is +# truncated before writing. +# +> print_coeff__lc_of_data := +> proc( coeff_list::list(specfunc(numeric,COEFF) = algebraic), +> coeff_name_prefix::string, +> temp_name_type::string, +> file_name::string ) +> global `codegen/C/function/informed`; +> local coeff_list2, cmpt_list, temp_name_list; +> +# convert LHS of each equation from a COEFF() call (eg COEFF(-1,+1)) +# to a Maple/C variable name (eg coeff_I_m1_p1) +> coeff_list2 := map( +> proc(coeff_eqn::specfunc(numeric,COEFF) = algebraic) +> local posn; +> posn := [op(lhs(coeff_eqn))]; +> coeff_name(posn,coeff_name_prefix); +> convert(%, name); # codegen[C] wants LHS +> # to be an actual Maple *name* +> % = fix_rationals(rhs(coeff_eqn)); +> end proc +> , +> coeff_list +> ); +> +# +# generate the C code +# +> +# tell codegen[C] not to warn about unknown RATIONAL() and DATA() "fn calls" +# via undocumented :( global table +> `codegen/C/function/informed`['RATIONAL'] := true; +> `codegen/C/function/informed`['DATA'] := true; +> +> ftruncate(file_name); +> +# optimized computation sequence for all the coefficients +# (may use local variables t0,t1,t2,...) +> cmpt_list := [codegen[optimize](coeff_list2, tryhard)]; +> +# list of the t0,t1,t2,... local variables +> temp_name_list := nonmatching_names(map(lhs,cmpt_list), coeff_name_prefix); +> +# declare the t0,t1,t2,... local variables (if there are any) +> if (nops(temp_name_list) > 0) +> then print_name_list_dcl(%, temp_name_type, file_name); +> fi; +> +# now print the optimized computation sequence +> codegen[C](cmpt_list, filename=file_name); +> +> fclose(file_name); +> +> NULL; +> end proc; +print_coeff__lc_of_data := proc( +coeff_list::list(specfunc(numeric, COEFF) = algebraic), +coeff_name_prefix::string, temp_name_type::string, file_name::string) +local coeff_list2, cmpt_list, temp_name_list; +global `codegen/C/function/informed`; + coeff_list2 := map(proc( + coeff_eqn::(specfunc(numeric, COEFF) = algebraic)) + local posn; + posn := [op(lhs(coeff_eqn))]; + coeff_name(posn, coeff_name_prefix); + convert(%, name); + % = fix_rationals(rhs(coeff_eqn)) + end proc, coeff_list); + `codegen/C/function/informed`['RATIONAL'] := true; + `codegen/C/function/informed`['DATA'] := true; + ftruncate(file_name); + cmpt_list := [codegen[optimize](coeff_list2, tryhard)]; + temp_name_list := + nonmatching_names(map(lhs, cmpt_list), coeff_name_prefix); + if 0 < nops(temp_name_list) then + print_name_list_dcl(%, temp_name_type, file_name) + end if; + codegen[C](cmpt_list, filename = file_name); + fclose(file_name); + NULL +end proc + +> +################################################################################ +> +# +# This function prints a sequence of C expression to assign the data-value +# variables, eg +# data->data_m1_p1 = DATA(-1,1); +# +# Arguments: +# posn_list = The same list of positions as was used to compute the +# interpolating polynomial. +# data_var_name_prefix = A prefix string for the data variable names. +# file_name = The file name to write the coefficients to. This is +# truncated before writing. +# +> print_fetch_data := +> proc( +> posn_list::list(list(numeric)), +> data_var_name_prefix::string, +> file_name::string +> ) +> +> ftruncate(file_name); +> map( +> proc(posn::list(numeric)) +> fprintf(file_name, +> "%s = %a;\n", +> data_var_name(posn,data_var_name_prefix), +> DATA(op(posn))); +> end proc +> , +> posn_list +> ); +> fclose(file_name); +> +> NULL; +> end proc; +print_fetch_data := proc(posn_list::list(list(numeric)), +data_var_name_prefix::string, file_name::string) + ftruncate(file_name); + map(proc(posn::list(numeric)) + fprintf(file_name, "%s = %a;\n", + data_var_name(posn, data_var_name_prefix), DATA(op(posn))) + end proc, posn_list); + fclose(file_name); + NULL +end proc + +> +################################################################################ +> +# +# This function prints a sequence of C expression to store the interpolation +# coefficients in COEFF(...) expressions, eg +# COEFF(1,-1) = factor * coeffs->coeff_p1_m1; +# +# Arguments: +# posn_list = The list of positions in the molecule. +# coeff_name_prefix = A prefix string for the coefficient names, +# eg "factor * coeffs->coeff_" +# file_name = The file name to write the coefficients to. This is +# truncated before writing. +# +> print_store_coeffs := +> proc( +> posn_list::list(list(numeric)), +> coeff_name_prefix::string, +> file_name::string +> ) +> +> ftruncate(file_name); +> map( +> proc(posn::list(numeric)) +> fprintf(file_name, +> "%a = %s;\n", +> 'COEFF'(op(posn)), +> coeff_name(posn,coeff_name_prefix)); +> end proc +> , +> posn_list +> ); +> fclose(file_name); +> +> NULL; +> end proc; +print_store_coeffs := proc(posn_list::list(list(numeric)), +coeff_name_prefix::string, file_name::string) + ftruncate(file_name); + map(proc(posn::list(numeric)) + fprintf(file_name, "%a = %s;\n", 'COEFF'(op(posn)), + coeff_name(posn, coeff_name_prefix)) + end proc, posn_list); + fclose(file_name); + NULL +end proc + +> +################################################################################ +> +# +# This function prints a C expression to evaluate a molecule, i.e. +# to compute the molecule as a linear combination of the data values. +# +# Arguments: +# posn_list = The list of positions in the molecule. +# coeff_name_prefix = A prefix string for the coefficient names. +# data_var_name_prefix = A prefix string for the data variable names. +# file_name = The file name to write the coefficients to. This is +# truncated before writing. +# +> print_evaluate_molecule := +> proc( +> posn_list::list(list(numeric)), +> coeff_name_prefix::string, +> data_var_name_prefix::string, +> file_name::string +> ) +> +> ftruncate(file_name); +> +# list of "coeff*data_var" terms +> map( +> proc(posn::list(numeric)) +> sprintf("%s*%s", +> coeff_name(posn,coeff_name_prefix), +> data_var_name(posn,data_var_name_prefix)); +> end proc +> , +> posn_list +> ); +> +> ListTools[Join](%, "\n + "); +> cat(op(%)); +> fprintf(file_name, " %s;\n", %); +> +> fclose(file_name); +> +> NULL; +> end proc; +print_evaluate_molecule := proc(posn_list::list(list(numeric)), +coeff_name_prefix::string, data_var_name_prefix::string, file_name::string) + ftruncate(file_name); + map(proc(posn::list(numeric)) + sprintf("%s*%s", coeff_name(posn, coeff_name_prefix), + data_var_name(posn, data_var_name_prefix)) + end proc, posn_list); + ListTools[Join](%, "\n + "); + cat(op(%)); + fprintf(file_name, " %s;\n", %); + fclose(file_name); + NULL +end proc + +> +################################################################################ +################################################################################ +################################################################################ +> +# +# This function computes the name of the coefficient of the data at a +# given [m] position, i.e. it encapsulates our naming convention for this. +# +# Arguments: +# posn = (in) The [m] coordinates. +# name_prefix = A prefix string for the coefficient name. +# +# Results: +# The function returns the coefficient, as a Maple string. +# +> coeff_name := +> proc(posn::list(numeric), name_prefix::string) +> cat(name_prefix, sprint_numeric_list(posn)); +> end proc; +coeff_name := proc(posn::list(numeric), name_prefix::string) + cat(name_prefix, sprint_numeric_list(posn)) +end proc + +> +################################################################################ +> +# +# This function computes the name of the variable in which the C code +# will store the input data at a given [m] position, i.e. it encapsulates +# our naming convention for this. +# +# Arguments: +# posn = (in) The [m] coordinates. +# name_prefix = A prefix string for the variable name. +# +# Results: +# The function returns the variable name, as a Maple string. +# +> data_var_name := +> proc(posn::list(numeric), name_prefix::string) +> cat(name_prefix, sprint_numeric_list(posn)); +> end proc; +data_var_name := proc(posn::list(numeric), name_prefix::string) + cat(name_prefix, sprint_numeric_list(posn)) +end proc + +# Maple code to compute lists of point positions in hypercube-shaped molecules +# $Header$ +> +################################################################################ +> +# +# 1D interpolation points +# +> posn_list_1d_size2 := hypercube_points([ 0], [+1]); + posn_list_1d_size2 := [[0], [1]] + +> posn_list_1d_size3 := hypercube_points([-1], [+1]); + posn_list_1d_size3 := [[-1], [0], [1]] + +> posn_list_1d_size4 := hypercube_points([-1], [+2]); + posn_list_1d_size4 := [[-1], [0], [1], [2]] + +> posn_list_1d_size5 := hypercube_points([-2], [+2]); + posn_list_1d_size5 := [[-2], [-1], [0], [1], [2]] + +> posn_list_1d_size6 := hypercube_points([-2], [+3]); + posn_list_1d_size6 := [[-2], [-1], [0], [1], [2], [3]] + +> posn_list_1d_size7 := hypercube_points([-3], [+3]); + posn_list_1d_size7 := [[-3], [-2], [-1], [0], [1], [2], [3]] + +> +################################################################################ +> +# +# 2D interpolation points (Fortran ordering) +# +> posn_list_2d_size2 := map(ListTools[Reverse], +> hypercube_points([ 0, 0], [+1,+1])); + posn_list_2d_size2 := [[0, 0], [1, 0], [0, 1], [1, 1]] + +> posn_list_2d_size3 := map(ListTools[Reverse], +> hypercube_points([-1,-1], [+1,+1])); +posn_list_2d_size3 := [[-1, -1], [0, -1], [1, -1], [-1, 0], [0, 0], [1, 0], + + [-1, 1], [0, 1], [1, 1]] + +> posn_list_2d_size4 := map(ListTools[Reverse], +> hypercube_points([-1,-1], [+2,+2])); +posn_list_2d_size4 := [[-1, -1], [0, -1], [1, -1], [2, -1], [-1, 0], [0, 0], + + [1, 0], [2, 0], [-1, 1], [0, 1], [1, 1], [2, 1], [-1, 2], [0, 2], [1, 2], + + [2, 2]] + +> posn_list_2d_size5 := map(ListTools[Reverse], +> hypercube_points([-2,-2], [+2,+2])); +posn_list_2d_size5 := [[-2, -2], [-1, -2], [0, -2], [1, -2], [2, -2], [-2, -1], + + [-1, -1], [0, -1], [1, -1], [2, -1], [-2, 0], [-1, 0], [0, 0], [1, 0], + + [2, 0], [-2, 1], [-1, 1], [0, 1], [1, 1], [2, 1], [-2, 2], [-1, 2], [0, 2], + + [1, 2], [2, 2]] + +> posn_list_2d_size6 := map(ListTools[Reverse], +> hypercube_points([-2,-2], [+3,+3])); +posn_list_2d_size6 := [[-2, -2], [-1, -2], [0, -2], [1, -2], [2, -2], [3, -2], + + [-2, -1], [-1, -1], [0, -1], [1, -1], [2, -1], [3, -1], [-2, 0], [-1, 0], + + [0, 0], [1, 0], [2, 0], [3, 0], [-2, 1], [-1, 1], [0, 1], [1, 1], [2, 1], + + [3, 1], [-2, 2], [-1, 2], [0, 2], [1, 2], [2, 2], [3, 2], [-2, 3], [-1, 3], + + [0, 3], [1, 3], [2, 3], [3, 3]] + +> +################################################################################ +> +# +# 3D interpolation points (Fortran ordering) +# +> posn_list_3d_size2 := map(ListTools[Reverse], +> hypercube_points([ 0, 0, 0], [+1,+1,+1])); +posn_list_3d_size2 := [[0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0], [0, 0, 1], + + [1, 0, 1], [0, 1, 1], [1, 1, 1]] + +> posn_list_3d_size3 := map(ListTools[Reverse], +> hypercube_points([-1,-1,-1], [+1,+1,+1])); +posn_list_3d_size3 := [[-1, -1, -1], [0, -1, -1], [1, -1, -1], [-1, 0, -1], + + [0, 0, -1], [1, 0, -1], [-1, 1, -1], [0, 1, -1], [1, 1, -1], [-1, -1, 0], + + [0, -1, 0], [1, -1, 0], [-1, 0, 0], [0, 0, 0], [1, 0, 0], [-1, 1, 0], + + [0, 1, 0], [1, 1, 0], [-1, -1, 1], [0, -1, 1], [1, -1, 1], [-1, 0, 1], + + [0, 0, 1], [1, 0, 1], [-1, 1, 1], [0, 1, 1], [1, 1, 1]] + +> posn_list_3d_size4 := map(ListTools[Reverse], +> hypercube_points([-1,-1,-1], [+2,+2,+2])); +posn_list_3d_size4 := [[-1, -1, -1], [0, -1, -1], [1, -1, -1], [2, -1, -1], + + [-1, 0, -1], [0, 0, -1], [1, 0, -1], [2, 0, -1], [-1, 1, -1], [0, 1, -1], + + [1, 1, -1], [2, 1, -1], [-1, 2, -1], [0, 2, -1], [1, 2, -1], [2, 2, -1], + + [-1, -1, 0], [0, -1, 0], [1, -1, 0], [2, -1, 0], [-1, 0, 0], [0, 0, 0], + + [1, 0, 0], [2, 0, 0], [-1, 1, 0], [0, 1, 0], [1, 1, 0], [2, 1, 0], + + [-1, 2, 0], [0, 2, 0], [1, 2, 0], [2, 2, 0], [-1, -1, 1], [0, -1, 1], + + [1, -1, 1], [2, -1, 1], [-1, 0, 1], [0, 0, 1], [1, 0, 1], [2, 0, 1], + + [-1, 1, 1], [0, 1, 1], [1, 1, 1], [2, 1, 1], [-1, 2, 1], [0, 2, 1], + + [1, 2, 1], [2, 2, 1], [-1, -1, 2], [0, -1, 2], [1, -1, 2], [2, -1, 2], + + [-1, 0, 2], [0, 0, 2], [1, 0, 2], [2, 0, 2], [-1, 1, 2], [0, 1, 2], + + [1, 1, 2], [2, 1, 2], [-1, 2, 2], [0, 2, 2], [1, 2, 2], [2, 2, 2]] + +> posn_list_3d_size5 := map(ListTools[Reverse], +> hypercube_points([-2,-2,-2], [+2,+2,+2])); +posn_list_3d_size5 := [[-2, -2, -2], [-1, -2, -2], [0, -2, -2], [1, -2, -2], + + [2, -2, -2], [-2, -1, -2], [-1, -1, -2], [0, -1, -2], [1, -1, -2], + + [2, -1, -2], [-2, 0, -2], [-1, 0, -2], [0, 0, -2], [1, 0, -2], [2, 0, -2], + + [-2, 1, -2], [-1, 1, -2], [0, 1, -2], [1, 1, -2], [2, 1, -2], [-2, 2, -2], + + [-1, 2, -2], [0, 2, -2], [1, 2, -2], [2, 2, -2], [-2, -2, -1], [-1, -2, -1], + + [0, -2, -1], [1, -2, -1], [2, -2, -1], [-2, -1, -1], [-1, -1, -1], + + [0, -1, -1], [1, -1, -1], [2, -1, -1], [-2, 0, -1], [-1, 0, -1], [0, 0, -1], + + [1, 0, -1], [2, 0, -1], [-2, 1, -1], [-1, 1, -1], [0, 1, -1], [1, 1, -1], + + [2, 1, -1], [-2, 2, -1], [-1, 2, -1], [0, 2, -1], [1, 2, -1], [2, 2, -1], + + [-2, -2, 0], [-1, -2, 0], [0, -2, 0], [1, -2, 0], [2, -2, 0], [-2, -1, 0], + + [-1, -1, 0], [0, -1, 0], [1, -1, 0], [2, -1, 0], [-2, 0, 0], [-1, 0, 0], + + [0, 0, 0], [1, 0, 0], [2, 0, 0], [-2, 1, 0], [-1, 1, 0], [0, 1, 0], + + [1, 1, 0], [2, 1, 0], [-2, 2, 0], [-1, 2, 0], [0, 2, 0], [1, 2, 0], + + [2, 2, 0], [-2, -2, 1], [-1, -2, 1], [0, -2, 1], [1, -2, 1], [2, -2, 1], + + [-2, -1, 1], [-1, -1, 1], [0, -1, 1], [1, -1, 1], [2, -1, 1], [-2, 0, 1], + + [-1, 0, 1], [0, 0, 1], [1, 0, 1], [2, 0, 1], [-2, 1, 1], [-1, 1, 1], + + [0, 1, 1], [1, 1, 1], [2, 1, 1], [-2, 2, 1], [-1, 2, 1], [0, 2, 1], + + [1, 2, 1], [2, 2, 1], [-2, -2, 2], [-1, -2, 2], [0, -2, 2], [1, -2, 2], + + [2, -2, 2], [-2, -1, 2], [-1, -1, 2], [0, -1, 2], [1, -1, 2], [2, -1, 2], + + [-2, 0, 2], [-1, 0, 2], [0, 0, 2], [1, 0, 2], [2, 0, 2], [-2, 1, 2], + + [-1, 1, 2], [0, 1, 2], [1, 1, 2], [2, 1, 2], [-2, 2, 2], [-1, 2, 2], + + [0, 2, 2], [1, 2, 2], [2, 2, 2]] + +> posn_list_3d_size6 := map(ListTools[Reverse], +> hypercube_points([-2,-2,-2], [+3,+3,+3])); +posn_list_3d_size6 := [[-2, -2, -2], [-1, -2, -2], [0, -2, -2], [1, -2, -2], + + [2, -2, -2], [3, -2, -2], [-2, -1, -2], [-1, -1, -2], [0, -1, -2], + + [1, -1, -2], [2, -1, -2], [3, -1, -2], [-2, 0, -2], [-1, 0, -2], [0, 0, -2], + + [1, 0, -2], [2, 0, -2], [3, 0, -2], [-2, 1, -2], [-1, 1, -2], [0, 1, -2], + + [1, 1, -2], [2, 1, -2], [3, 1, -2], [-2, 2, -2], [-1, 2, -2], [0, 2, -2], + + [1, 2, -2], [2, 2, -2], [3, 2, -2], [-2, 3, -2], [-1, 3, -2], [0, 3, -2], + + [1, 3, -2], [2, 3, -2], [3, 3, -2], [-2, -2, -1], [-1, -2, -1], [0, -2, -1], + + [1, -2, -1], [2, -2, -1], [3, -2, -1], [-2, -1, -1], [-1, -1, -1], + + [0, -1, -1], [1, -1, -1], [2, -1, -1], [3, -1, -1], [-2, 0, -1], + + [-1, 0, -1], [0, 0, -1], [1, 0, -1], [2, 0, -1], [3, 0, -1], [-2, 1, -1], + + [-1, 1, -1], [0, 1, -1], [1, 1, -1], [2, 1, -1], [3, 1, -1], [-2, 2, -1], + + [-1, 2, -1], [0, 2, -1], [1, 2, -1], [2, 2, -1], [3, 2, -1], [-2, 3, -1], + + [-1, 3, -1], [0, 3, -1], [1, 3, -1], [2, 3, -1], [3, 3, -1], [-2, -2, 0], + + [-1, -2, 0], [0, -2, 0], [1, -2, 0], [2, -2, 0], [3, -2, 0], [-2, -1, 0], + + [-1, -1, 0], [0, -1, 0], [1, -1, 0], [2, -1, 0], [3, -1, 0], [-2, 0, 0], + + [-1, 0, 0], [0, 0, 0], [1, 0, 0], [2, 0, 0], [3, 0, 0], [-2, 1, 0], + + [-1, 1, 0], [0, 1, 0], [1, 1, 0], [2, 1, 0], [3, 1, 0], [-2, 2, 0], + + [-1, 2, 0], [0, 2, 0], [1, 2, 0], [2, 2, 0], [3, 2, 0], [-2, 3, 0], + + [-1, 3, 0], [0, 3, 0], [1, 3, 0], [2, 3, 0], [3, 3, 0], [-2, -2, 1], + + [-1, -2, 1], [0, -2, 1], [1, -2, 1], [2, -2, 1], [3, -2, 1], [-2, -1, 1], + + [-1, -1, 1], [0, -1, 1], [1, -1, 1], [2, -1, 1], [3, -1, 1], [-2, 0, 1], + + [-1, 0, 1], [0, 0, 1], [1, 0, 1], [2, 0, 1], [3, 0, 1], [-2, 1, 1], + + [-1, 1, 1], [0, 1, 1], [1, 1, 1], [2, 1, 1], [3, 1, 1], [-2, 2, 1], + + [-1, 2, 1], [0, 2, 1], [1, 2, 1], [2, 2, 1], [3, 2, 1], [-2, 3, 1], + + [-1, 3, 1], [0, 3, 1], [1, 3, 1], [2, 3, 1], [3, 3, 1], [-2, -2, 2], + + [-1, -2, 2], [0, -2, 2], [1, -2, 2], [2, -2, 2], [3, -2, 2], [-2, -1, 2], + + [-1, -1, 2], [0, -1, 2], [1, -1, 2], [2, -1, 2], [3, -1, 2], [-2, 0, 2], + + [-1, 0, 2], [0, 0, 2], [1, 0, 2], [2, 0, 2], [3, 0, 2], [-2, 1, 2], + + [-1, 1, 2], [0, 1, 2], [1, 1, 2], [2, 1, 2], [3, 1, 2], [-2, 2, 2], + + [-1, 2, 2], [0, 2, 2], [1, 2, 2], [2, 2, 2], [3, 2, 2], [-2, 3, 2], + + [-1, 3, 2], [0, 3, 2], [1, 3, 2], [2, 3, 2], [3, 3, 2], [-2, -2, 3], + + [-1, -2, 3], [0, -2, 3], [1, -2, 3], [2, -2, 3], [3, -2, 3], [-2, -1, 3], + + [-1, -1, 3], [0, -1, 3], [1, -1, 3], [2, -1, 3], [3, -1, 3], [-2, 0, 3], + + [-1, 0, 3], [0, 0, 3], [1, 0, 3], [2, 0, 3], [3, 0, 3], [-2, 1, 3], + + [-1, 1, 3], [0, 1, 3], [1, 1, 3], [2, 1, 3], [3, 1, 3], [-2, 2, 3], + + [-1, 2, 3], [0, 2, 3], [1, 2, 3], [2, 2, 3], [3, 2, 3], [-2, 3, 3], + + [-1, 3, 3], [0, 3, 3], [1, 3, 3], [2, 3, 3], [3, 3, 3]] + +# Maple code to compute common coefficients for all 3d interpolation schemes +# $Header$ +> +################################################################################ +> +# +# generic stuff for 3d, cube, size=2 +# +> +> data_list_3d_size2 := map(data_var_name, posn_list_3d_size2, "data_"); +data_list_3d_size2 := ["data_0_0_0", "data_p1_0_0", "data_0_p1_0", + + "data_p1_p1_0", "data_0_0_p1", "data_p1_0_p1", "data_0_p1_p1", + + "data_p1_p1_p1"] + +> coeffs_list_3d_size2 := map(coeff_name, posn_list_3d_size2, "coeff_"); +coeffs_list_3d_size2 := ["coeff_0_0_0", "coeff_p1_0_0", "coeff_0_p1_0", + + "coeff_p1_p1_0", "coeff_0_0_p1", "coeff_p1_0_p1", "coeff_0_p1_p1", + + "coeff_p1_p1_p1"] + +> +> print_name_list_dcl(data_list_3d_size2, "fp", +> "3d.cube.size2/data-dcl.h"); +> print_name_list_dcl(coeffs_list_3d_size2, "fp", +> "3d.cube.size2/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_3d_size2, "data->data_", +> "3d.cube.size2/fetch-data.c"); +> print_evaluate_molecule(posn_list_3d_size2, +> "coeffs->coeff_", "data->data_", +> "3d.cube.size2/evaluate-molecule.c"); +> print_store_coeffs(posn_list_3d_size2, +> "factor * coeffs->coeff_", +> "3d.cube.size2/store-coeffs.c"); +> +################################################################################ +> +# +# generic stuff for 3d, cube, size=3 +# +> +> data_list_3d_size3 := map(data_var_name, posn_list_3d_size3, "data_"); +data_list_3d_size3 := ["data_m1_m1_m1", "data_0_m1_m1", "data_p1_m1_m1", + + "data_m1_0_m1", "data_0_0_m1", "data_p1_0_m1", "data_m1_p1_m1", + + "data_0_p1_m1", "data_p1_p1_m1", "data_m1_m1_0", "data_0_m1_0", + + "data_p1_m1_0", "data_m1_0_0", "data_0_0_0", "data_p1_0_0", "data_m1_p1_0", + + "data_0_p1_0", "data_p1_p1_0", "data_m1_m1_p1", "data_0_m1_p1", + + "data_p1_m1_p1", "data_m1_0_p1", "data_0_0_p1", "data_p1_0_p1", + + "data_m1_p1_p1", "data_0_p1_p1", "data_p1_p1_p1"] + +> coeffs_list_3d_size3 := map(coeff_name, posn_list_3d_size3, "coeff_"); +coeffs_list_3d_size3 := ["coeff_m1_m1_m1", "coeff_0_m1_m1", "coeff_p1_m1_m1", + + "coeff_m1_0_m1", "coeff_0_0_m1", "coeff_p1_0_m1", "coeff_m1_p1_m1", + + "coeff_0_p1_m1", "coeff_p1_p1_m1", "coeff_m1_m1_0", "coeff_0_m1_0", + + "coeff_p1_m1_0", "coeff_m1_0_0", "coeff_0_0_0", "coeff_p1_0_0", + + "coeff_m1_p1_0", "coeff_0_p1_0", "coeff_p1_p1_0", "coeff_m1_m1_p1", + + "coeff_0_m1_p1", "coeff_p1_m1_p1", "coeff_m1_0_p1", "coeff_0_0_p1", + + "coeff_p1_0_p1", "coeff_m1_p1_p1", "coeff_0_p1_p1", "coeff_p1_p1_p1"] + +> +> print_name_list_dcl(data_list_3d_size3, "fp", +> "3d.cube.size3/data-dcl.h"); +> print_name_list_dcl(coeffs_list_3d_size3, "fp", +> "3d.cube.size3/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_3d_size3, "data->data_", +> "3d.cube.size3/fetch-data.c"); +> print_evaluate_molecule(posn_list_3d_size3, +> "coeffs->coeff_", "data->data_", +> "3d.cube.size3/evaluate-molecule.c"); +> print_store_coeffs(posn_list_3d_size3, +> "factor * coeffs->coeff_", +> "3d.cube.size3/store-coeffs.c"); +> +################################################################################ +> +# +# generic stuff for 3d, cube, size=4 +# +> +> data_list_3d_size4 := map(data_var_name, posn_list_3d_size4, "data_"); +data_list_3d_size4 := ["data_m1_m1_m1", "data_0_m1_m1", "data_p1_m1_m1", + + "data_p2_m1_m1", "data_m1_0_m1", "data_0_0_m1", "data_p1_0_m1", + + "data_p2_0_m1", "data_m1_p1_m1", "data_0_p1_m1", "data_p1_p1_m1", + + "data_p2_p1_m1", "data_m1_p2_m1", "data_0_p2_m1", "data_p1_p2_m1", + + "data_p2_p2_m1", "data_m1_m1_0", "data_0_m1_0", "data_p1_m1_0", + + "data_p2_m1_0", "data_m1_0_0", "data_0_0_0", "data_p1_0_0", "data_p2_0_0", + + "data_m1_p1_0", "data_0_p1_0", "data_p1_p1_0", "data_p2_p1_0", + + "data_m1_p2_0", "data_0_p2_0", "data_p1_p2_0", "data_p2_p2_0", + + "data_m1_m1_p1", "data_0_m1_p1", "data_p1_m1_p1", "data_p2_m1_p1", + + "data_m1_0_p1", "data_0_0_p1", "data_p1_0_p1", "data_p2_0_p1", + + "data_m1_p1_p1", "data_0_p1_p1", "data_p1_p1_p1", "data_p2_p1_p1", + + "data_m1_p2_p1", "data_0_p2_p1", "data_p1_p2_p1", "data_p2_p2_p1", + + "data_m1_m1_p2", "data_0_m1_p2", "data_p1_m1_p2", "data_p2_m1_p2", + + "data_m1_0_p2", "data_0_0_p2", "data_p1_0_p2", "data_p2_0_p2", + + "data_m1_p1_p2", "data_0_p1_p2", "data_p1_p1_p2", "data_p2_p1_p2", + + "data_m1_p2_p2", "data_0_p2_p2", "data_p1_p2_p2", "data_p2_p2_p2"] + +> coeffs_list_3d_size4 := map(coeff_name, posn_list_3d_size4, "coeff_"); +coeffs_list_3d_size4 := ["coeff_m1_m1_m1", "coeff_0_m1_m1", "coeff_p1_m1_m1", + + "coeff_p2_m1_m1", "coeff_m1_0_m1", "coeff_0_0_m1", "coeff_p1_0_m1", + + "coeff_p2_0_m1", "coeff_m1_p1_m1", "coeff_0_p1_m1", "coeff_p1_p1_m1", + + "coeff_p2_p1_m1", "coeff_m1_p2_m1", "coeff_0_p2_m1", "coeff_p1_p2_m1", + + "coeff_p2_p2_m1", "coeff_m1_m1_0", "coeff_0_m1_0", "coeff_p1_m1_0", + + "coeff_p2_m1_0", "coeff_m1_0_0", "coeff_0_0_0", "coeff_p1_0_0", + + "coeff_p2_0_0", "coeff_m1_p1_0", "coeff_0_p1_0", "coeff_p1_p1_0", + + "coeff_p2_p1_0", "coeff_m1_p2_0", "coeff_0_p2_0", "coeff_p1_p2_0", + + "coeff_p2_p2_0", "coeff_m1_m1_p1", "coeff_0_m1_p1", "coeff_p1_m1_p1", + + "coeff_p2_m1_p1", "coeff_m1_0_p1", "coeff_0_0_p1", "coeff_p1_0_p1", + + "coeff_p2_0_p1", "coeff_m1_p1_p1", "coeff_0_p1_p1", "coeff_p1_p1_p1", + + "coeff_p2_p1_p1", "coeff_m1_p2_p1", "coeff_0_p2_p1", "coeff_p1_p2_p1", + + "coeff_p2_p2_p1", "coeff_m1_m1_p2", "coeff_0_m1_p2", "coeff_p1_m1_p2", + + "coeff_p2_m1_p2", "coeff_m1_0_p2", "coeff_0_0_p2", "coeff_p1_0_p2", + + "coeff_p2_0_p2", "coeff_m1_p1_p2", "coeff_0_p1_p2", "coeff_p1_p1_p2", + + "coeff_p2_p1_p2", "coeff_m1_p2_p2", "coeff_0_p2_p2", "coeff_p1_p2_p2", + + "coeff_p2_p2_p2"] + +> +> print_name_list_dcl(data_list_3d_size4, "fp", +> "3d.cube.size4/data-dcl.h"); +> print_name_list_dcl(coeffs_list_3d_size4, "fp", +> "3d.cube.size4/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_3d_size4, "data->data_", +> "3d.cube.size4/fetch-data.c"); +> print_evaluate_molecule(posn_list_3d_size4, +> "coeffs->coeff_", "data->data_", +> "3d.cube.size4/evaluate-molecule.c"); +bytes used=1000080, alloc=917336, time=0.12 +> print_store_coeffs(posn_list_3d_size4, +> "factor * coeffs->coeff_", +> "3d.cube.size4/store-coeffs.c"); +> +################################################################################ +> +# +# generic stuff for 3d, cube, size=5 +# +> +> data_list_3d_size5 := map(data_var_name, posn_list_3d_size5, "data_"); +data_list_3d_size5 := ["data_m2_m2_m2", "data_m1_m2_m2", "data_0_m2_m2", + + "data_p1_m2_m2", "data_p2_m2_m2", "data_m2_m1_m2", "data_m1_m1_m2", + + "data_0_m1_m2", "data_p1_m1_m2", "data_p2_m1_m2", "data_m2_0_m2", + + "data_m1_0_m2", "data_0_0_m2", "data_p1_0_m2", "data_p2_0_m2", + + "data_m2_p1_m2", "data_m1_p1_m2", "data_0_p1_m2", "data_p1_p1_m2", + + "data_p2_p1_m2", "data_m2_p2_m2", "data_m1_p2_m2", "data_0_p2_m2", + + "data_p1_p2_m2", "data_p2_p2_m2", "data_m2_m2_m1", "data_m1_m2_m1", + + "data_0_m2_m1", "data_p1_m2_m1", "data_p2_m2_m1", "data_m2_m1_m1", + + "data_m1_m1_m1", "data_0_m1_m1", "data_p1_m1_m1", "data_p2_m1_m1", + + "data_m2_0_m1", "data_m1_0_m1", "data_0_0_m1", "data_p1_0_m1", + + "data_p2_0_m1", "data_m2_p1_m1", "data_m1_p1_m1", "data_0_p1_m1", + + "data_p1_p1_m1", "data_p2_p1_m1", "data_m2_p2_m1", "data_m1_p2_m1", + + "data_0_p2_m1", "data_p1_p2_m1", "data_p2_p2_m1", "data_m2_m2_0", + + "data_m1_m2_0", "data_0_m2_0", "data_p1_m2_0", "data_p2_m2_0", + + "data_m2_m1_0", "data_m1_m1_0", "data_0_m1_0", "data_p1_m1_0", + + "data_p2_m1_0", "data_m2_0_0", "data_m1_0_0", "data_0_0_0", "data_p1_0_0", + + "data_p2_0_0", "data_m2_p1_0", "data_m1_p1_0", "data_0_p1_0", + + "data_p1_p1_0", "data_p2_p1_0", "data_m2_p2_0", "data_m1_p2_0", + + "data_0_p2_0", "data_p1_p2_0", "data_p2_p2_0", "data_m2_m2_p1", + + "data_m1_m2_p1", "data_0_m2_p1", "data_p1_m2_p1", "data_p2_m2_p1", + + "data_m2_m1_p1", "data_m1_m1_p1", "data_0_m1_p1", "data_p1_m1_p1", + + "data_p2_m1_p1", "data_m2_0_p1", "data_m1_0_p1", "data_0_0_p1", + + "data_p1_0_p1", "data_p2_0_p1", "data_m2_p1_p1", "data_m1_p1_p1", + + "data_0_p1_p1", "data_p1_p1_p1", "data_p2_p1_p1", "data_m2_p2_p1", + + "data_m1_p2_p1", "data_0_p2_p1", "data_p1_p2_p1", "data_p2_p2_p1", + + "data_m2_m2_p2", "data_m1_m2_p2", "data_0_m2_p2", "data_p1_m2_p2", + + "data_p2_m2_p2", "data_m2_m1_p2", "data_m1_m1_p2", "data_0_m1_p2", + + "data_p1_m1_p2", "data_p2_m1_p2", "data_m2_0_p2", "data_m1_0_p2", + + "data_0_0_p2", "data_p1_0_p2", "data_p2_0_p2", "data_m2_p1_p2", + + "data_m1_p1_p2", "data_0_p1_p2", "data_p1_p1_p2", "data_p2_p1_p2", + + "data_m2_p2_p2", "data_m1_p2_p2", "data_0_p2_p2", "data_p1_p2_p2", + + "data_p2_p2_p2"] + +> coeffs_list_3d_size5 := map(coeff_name, posn_list_3d_size5, "coeff_"); +coeffs_list_3d_size5 := ["coeff_m2_m2_m2", "coeff_m1_m2_m2", "coeff_0_m2_m2", + + "coeff_p1_m2_m2", "coeff_p2_m2_m2", "coeff_m2_m1_m2", "coeff_m1_m1_m2", + + "coeff_0_m1_m2", "coeff_p1_m1_m2", "coeff_p2_m1_m2", "coeff_m2_0_m2", + + "coeff_m1_0_m2", "coeff_0_0_m2", "coeff_p1_0_m2", "coeff_p2_0_m2", + + "coeff_m2_p1_m2", "coeff_m1_p1_m2", "coeff_0_p1_m2", "coeff_p1_p1_m2", + + "coeff_p2_p1_m2", "coeff_m2_p2_m2", "coeff_m1_p2_m2", "coeff_0_p2_m2", + + "coeff_p1_p2_m2", "coeff_p2_p2_m2", "coeff_m2_m2_m1", "coeff_m1_m2_m1", + + "coeff_0_m2_m1", "coeff_p1_m2_m1", "coeff_p2_m2_m1", "coeff_m2_m1_m1", + + "coeff_m1_m1_m1", "coeff_0_m1_m1", "coeff_p1_m1_m1", "coeff_p2_m1_m1", + + "coeff_m2_0_m1", "coeff_m1_0_m1", "coeff_0_0_m1", "coeff_p1_0_m1", + + "coeff_p2_0_m1", "coeff_m2_p1_m1", "coeff_m1_p1_m1", "coeff_0_p1_m1", + + "coeff_p1_p1_m1", "coeff_p2_p1_m1", "coeff_m2_p2_m1", "coeff_m1_p2_m1", + + "coeff_0_p2_m1", "coeff_p1_p2_m1", "coeff_p2_p2_m1", "coeff_m2_m2_0", + + "coeff_m1_m2_0", "coeff_0_m2_0", "coeff_p1_m2_0", "coeff_p2_m2_0", + + "coeff_m2_m1_0", "coeff_m1_m1_0", "coeff_0_m1_0", "coeff_p1_m1_0", + + "coeff_p2_m1_0", "coeff_m2_0_0", "coeff_m1_0_0", "coeff_0_0_0", + + "coeff_p1_0_0", "coeff_p2_0_0", "coeff_m2_p1_0", "coeff_m1_p1_0", + + "coeff_0_p1_0", "coeff_p1_p1_0", "coeff_p2_p1_0", "coeff_m2_p2_0", + + "coeff_m1_p2_0", "coeff_0_p2_0", "coeff_p1_p2_0", "coeff_p2_p2_0", + + "coeff_m2_m2_p1", "coeff_m1_m2_p1", "coeff_0_m2_p1", "coeff_p1_m2_p1", + + "coeff_p2_m2_p1", "coeff_m2_m1_p1", "coeff_m1_m1_p1", "coeff_0_m1_p1", + + "coeff_p1_m1_p1", "coeff_p2_m1_p1", "coeff_m2_0_p1", "coeff_m1_0_p1", + + "coeff_0_0_p1", "coeff_p1_0_p1", "coeff_p2_0_p1", "coeff_m2_p1_p1", + + "coeff_m1_p1_p1", "coeff_0_p1_p1", "coeff_p1_p1_p1", "coeff_p2_p1_p1", + + "coeff_m2_p2_p1", "coeff_m1_p2_p1", "coeff_0_p2_p1", "coeff_p1_p2_p1", + + "coeff_p2_p2_p1", "coeff_m2_m2_p2", "coeff_m1_m2_p2", "coeff_0_m2_p2", + + "coeff_p1_m2_p2", "coeff_p2_m2_p2", "coeff_m2_m1_p2", "coeff_m1_m1_p2", + + "coeff_0_m1_p2", "coeff_p1_m1_p2", "coeff_p2_m1_p2", "coeff_m2_0_p2", + + "coeff_m1_0_p2", "coeff_0_0_p2", "coeff_p1_0_p2", "coeff_p2_0_p2", + + "coeff_m2_p1_p2", "coeff_m1_p1_p2", "coeff_0_p1_p2", "coeff_p1_p1_p2", + + "coeff_p2_p1_p2", "coeff_m2_p2_p2", "coeff_m1_p2_p2", "coeff_0_p2_p2", + + "coeff_p1_p2_p2", "coeff_p2_p2_p2"] + +> +> print_name_list_dcl(data_list_3d_size5, "fp", +> "3d.cube.size5/data-dcl.h"); +> print_name_list_dcl(coeffs_list_3d_size5, "fp", +> "3d.cube.size5/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_3d_size5, "data->data_", +> "3d.cube.size5/fetch-data.c"); +> print_evaluate_molecule(posn_list_3d_size5, +> "coeffs->coeff_", "data->data_", +> "3d.cube.size5/evaluate-molecule.c"); +> print_store_coeffs(posn_list_3d_size5, +> "factor * coeffs->coeff_", +> "3d.cube.size5/store-coeffs.c"); +bytes used=2000360, alloc=1244956, time=0.21 +> +################################################################################ +> +# +# generic stuff for 3d, cube, size=6 +# +> +> data_list_3d_size6 := map(data_var_name, posn_list_3d_size6, "data_"); +data_list_3d_size6 := ["data_m2_m2_m2", "data_m1_m2_m2", "data_0_m2_m2", + + "data_p1_m2_m2", "data_p2_m2_m2", "data_p3_m2_m2", "data_m2_m1_m2", + + "data_m1_m1_m2", "data_0_m1_m2", "data_p1_m1_m2", "data_p2_m1_m2", + + "data_p3_m1_m2", "data_m2_0_m2", "data_m1_0_m2", "data_0_0_m2", + + "data_p1_0_m2", "data_p2_0_m2", "data_p3_0_m2", "data_m2_p1_m2", + + "data_m1_p1_m2", "data_0_p1_m2", "data_p1_p1_m2", "data_p2_p1_m2", + + "data_p3_p1_m2", "data_m2_p2_m2", "data_m1_p2_m2", "data_0_p2_m2", + + "data_p1_p2_m2", "data_p2_p2_m2", "data_p3_p2_m2", "data_m2_p3_m2", + + "data_m1_p3_m2", "data_0_p3_m2", "data_p1_p3_m2", "data_p2_p3_m2", + + "data_p3_p3_m2", "data_m2_m2_m1", "data_m1_m2_m1", "data_0_m2_m1", + + "data_p1_m2_m1", "data_p2_m2_m1", "data_p3_m2_m1", "data_m2_m1_m1", + + "data_m1_m1_m1", "data_0_m1_m1", "data_p1_m1_m1", "data_p2_m1_m1", + + "data_p3_m1_m1", "data_m2_0_m1", "data_m1_0_m1", "data_0_0_m1", + + "data_p1_0_m1", "data_p2_0_m1", "data_p3_0_m1", "data_m2_p1_m1", + + "data_m1_p1_m1", "data_0_p1_m1", "data_p1_p1_m1", "data_p2_p1_m1", + + "data_p3_p1_m1", "data_m2_p2_m1", "data_m1_p2_m1", "data_0_p2_m1", + + "data_p1_p2_m1", "data_p2_p2_m1", "data_p3_p2_m1", "data_m2_p3_m1", + + "data_m1_p3_m1", "data_0_p3_m1", "data_p1_p3_m1", "data_p2_p3_m1", + + "data_p3_p3_m1", "data_m2_m2_0", "data_m1_m2_0", "data_0_m2_0", + + "data_p1_m2_0", "data_p2_m2_0", "data_p3_m2_0", "data_m2_m1_0", + + "data_m1_m1_0", "data_0_m1_0", "data_p1_m1_0", "data_p2_m1_0", + + "data_p3_m1_0", "data_m2_0_0", "data_m1_0_0", "data_0_0_0", "data_p1_0_0", + + "data_p2_0_0", "data_p3_0_0", "data_m2_p1_0", "data_m1_p1_0", "data_0_p1_0", + + "data_p1_p1_0", "data_p2_p1_0", "data_p3_p1_0", "data_m2_p2_0", + + "data_m1_p2_0", "data_0_p2_0", "data_p1_p2_0", "data_p2_p2_0", + + "data_p3_p2_0", "data_m2_p3_0", "data_m1_p3_0", "data_0_p3_0", + + "data_p1_p3_0", "data_p2_p3_0", "data_p3_p3_0", "data_m2_m2_p1", + + "data_m1_m2_p1", "data_0_m2_p1", "data_p1_m2_p1", "data_p2_m2_p1", + + "data_p3_m2_p1", "data_m2_m1_p1", "data_m1_m1_p1", "data_0_m1_p1", + + "data_p1_m1_p1", "data_p2_m1_p1", "data_p3_m1_p1", "data_m2_0_p1", + + "data_m1_0_p1", "data_0_0_p1", "data_p1_0_p1", "data_p2_0_p1", + + "data_p3_0_p1", "data_m2_p1_p1", "data_m1_p1_p1", "data_0_p1_p1", + + "data_p1_p1_p1", "data_p2_p1_p1", "data_p3_p1_p1", "data_m2_p2_p1", + + "data_m1_p2_p1", "data_0_p2_p1", "data_p1_p2_p1", "data_p2_p2_p1", + + "data_p3_p2_p1", "data_m2_p3_p1", "data_m1_p3_p1", "data_0_p3_p1", + + "data_p1_p3_p1", "data_p2_p3_p1", "data_p3_p3_p1", "data_m2_m2_p2", + + "data_m1_m2_p2", "data_0_m2_p2", "data_p1_m2_p2", "data_p2_m2_p2", + + "data_p3_m2_p2", "data_m2_m1_p2", "data_m1_m1_p2", "data_0_m1_p2", + + "data_p1_m1_p2", "data_p2_m1_p2", "data_p3_m1_p2", "data_m2_0_p2", + + "data_m1_0_p2", "data_0_0_p2", "data_p1_0_p2", "data_p2_0_p2", + + "data_p3_0_p2", "data_m2_p1_p2", "data_m1_p1_p2", "data_0_p1_p2", + + "data_p1_p1_p2", "data_p2_p1_p2", "data_p3_p1_p2", "data_m2_p2_p2", + + "data_m1_p2_p2", "data_0_p2_p2", "data_p1_p2_p2", "data_p2_p2_p2", + + "data_p3_p2_p2", "data_m2_p3_p2", "data_m1_p3_p2", "data_0_p3_p2", + + "data_p1_p3_p2", "data_p2_p3_p2", "data_p3_p3_p2", "data_m2_m2_p3", + + "data_m1_m2_p3", "data_0_m2_p3", "data_p1_m2_p3", "data_p2_m2_p3", + + "data_p3_m2_p3", "data_m2_m1_p3", "data_m1_m1_p3", "data_0_m1_p3", + + "data_p1_m1_p3", "data_p2_m1_p3", "data_p3_m1_p3", "data_m2_0_p3", + + "data_m1_0_p3", "data_0_0_p3", "data_p1_0_p3", "data_p2_0_p3", + + "data_p3_0_p3", "data_m2_p1_p3", "data_m1_p1_p3", "data_0_p1_p3", + + "data_p1_p1_p3", "data_p2_p1_p3", "data_p3_p1_p3", "data_m2_p2_p3", + + "data_m1_p2_p3", "data_0_p2_p3", "data_p1_p2_p3", "data_p2_p2_p3", + + "data_p3_p2_p3", "data_m2_p3_p3", "data_m1_p3_p3", "data_0_p3_p3", + + "data_p1_p3_p3", "data_p2_p3_p3", "data_p3_p3_p3"] + +> coeffs_list_3d_size6 := map(coeff_name, posn_list_3d_size6, "coeff_"); +coeffs_list_3d_size6 := ["coeff_m2_m2_m2", "coeff_m1_m2_m2", "coeff_0_m2_m2", + + "coeff_p1_m2_m2", "coeff_p2_m2_m2", "coeff_p3_m2_m2", "coeff_m2_m1_m2", + + "coeff_m1_m1_m2", "coeff_0_m1_m2", "coeff_p1_m1_m2", "coeff_p2_m1_m2", + + "coeff_p3_m1_m2", "coeff_m2_0_m2", "coeff_m1_0_m2", "coeff_0_0_m2", + + "coeff_p1_0_m2", "coeff_p2_0_m2", "coeff_p3_0_m2", "coeff_m2_p1_m2", + + "coeff_m1_p1_m2", "coeff_0_p1_m2", "coeff_p1_p1_m2", "coeff_p2_p1_m2", + + "coeff_p3_p1_m2", "coeff_m2_p2_m2", "coeff_m1_p2_m2", "coeff_0_p2_m2", + + "coeff_p1_p2_m2", "coeff_p2_p2_m2", "coeff_p3_p2_m2", "coeff_m2_p3_m2", + + "coeff_m1_p3_m2", "coeff_0_p3_m2", "coeff_p1_p3_m2", "coeff_p2_p3_m2", + + "coeff_p3_p3_m2", "coeff_m2_m2_m1", "coeff_m1_m2_m1", "coeff_0_m2_m1", + + "coeff_p1_m2_m1", "coeff_p2_m2_m1", "coeff_p3_m2_m1", "coeff_m2_m1_m1", + + "coeff_m1_m1_m1", "coeff_0_m1_m1", "coeff_p1_m1_m1", "coeff_p2_m1_m1", + + "coeff_p3_m1_m1", "coeff_m2_0_m1", "coeff_m1_0_m1", "coeff_0_0_m1", + + "coeff_p1_0_m1", "coeff_p2_0_m1", "coeff_p3_0_m1", "coeff_m2_p1_m1", + + "coeff_m1_p1_m1", "coeff_0_p1_m1", "coeff_p1_p1_m1", "coeff_p2_p1_m1", + + "coeff_p3_p1_m1", "coeff_m2_p2_m1", "coeff_m1_p2_m1", "coeff_0_p2_m1", + + "coeff_p1_p2_m1", "coeff_p2_p2_m1", "coeff_p3_p2_m1", "coeff_m2_p3_m1", + + "coeff_m1_p3_m1", "coeff_0_p3_m1", "coeff_p1_p3_m1", "coeff_p2_p3_m1", + + "coeff_p3_p3_m1", "coeff_m2_m2_0", "coeff_m1_m2_0", "coeff_0_m2_0", + + "coeff_p1_m2_0", "coeff_p2_m2_0", "coeff_p3_m2_0", "coeff_m2_m1_0", + + "coeff_m1_m1_0", "coeff_0_m1_0", "coeff_p1_m1_0", "coeff_p2_m1_0", + + "coeff_p3_m1_0", "coeff_m2_0_0", "coeff_m1_0_0", "coeff_0_0_0", + + "coeff_p1_0_0", "coeff_p2_0_0", "coeff_p3_0_0", "coeff_m2_p1_0", + + "coeff_m1_p1_0", "coeff_0_p1_0", "coeff_p1_p1_0", "coeff_p2_p1_0", + + "coeff_p3_p1_0", "coeff_m2_p2_0", "coeff_m1_p2_0", "coeff_0_p2_0", + + "coeff_p1_p2_0", "coeff_p2_p2_0", "coeff_p3_p2_0", "coeff_m2_p3_0", + + "coeff_m1_p3_0", "coeff_0_p3_0", "coeff_p1_p3_0", "coeff_p2_p3_0", + + "coeff_p3_p3_0", "coeff_m2_m2_p1", "coeff_m1_m2_p1", "coeff_0_m2_p1", + + "coeff_p1_m2_p1", "coeff_p2_m2_p1", "coeff_p3_m2_p1", "coeff_m2_m1_p1", + + "coeff_m1_m1_p1", "coeff_0_m1_p1", "coeff_p1_m1_p1", "coeff_p2_m1_p1", + + "coeff_p3_m1_p1", "coeff_m2_0_p1", "coeff_m1_0_p1", "coeff_0_0_p1", + + "coeff_p1_0_p1", "coeff_p2_0_p1", "coeff_p3_0_p1", "coeff_m2_p1_p1", + + "coeff_m1_p1_p1", "coeff_0_p1_p1", "coeff_p1_p1_p1", "coeff_p2_p1_p1", + + "coeff_p3_p1_p1", "coeff_m2_p2_p1", "coeff_m1_p2_p1", "coeff_0_p2_p1", + + "coeff_p1_p2_p1", "coeff_p2_p2_p1", "coeff_p3_p2_p1", "coeff_m2_p3_p1", + + "coeff_m1_p3_p1", "coeff_0_p3_p1", "coeff_p1_p3_p1", "coeff_p2_p3_p1", + + "coeff_p3_p3_p1", "coeff_m2_m2_p2", "coeff_m1_m2_p2", "coeff_0_m2_p2", + + "coeff_p1_m2_p2", "coeff_p2_m2_p2", "coeff_p3_m2_p2", "coeff_m2_m1_p2", + + "coeff_m1_m1_p2", "coeff_0_m1_p2", "coeff_p1_m1_p2", "coeff_p2_m1_p2", + + "coeff_p3_m1_p2", "coeff_m2_0_p2", "coeff_m1_0_p2", "coeff_0_0_p2", + + "coeff_p1_0_p2", "coeff_p2_0_p2", "coeff_p3_0_p2", "coeff_m2_p1_p2", + + "coeff_m1_p1_p2", "coeff_0_p1_p2", "coeff_p1_p1_p2", "coeff_p2_p1_p2", + + "coeff_p3_p1_p2", "coeff_m2_p2_p2", "coeff_m1_p2_p2", "coeff_0_p2_p2", + + "coeff_p1_p2_p2", "coeff_p2_p2_p2", "coeff_p3_p2_p2", "coeff_m2_p3_p2", + + "coeff_m1_p3_p2", "coeff_0_p3_p2", "coeff_p1_p3_p2", "coeff_p2_p3_p2", + + "coeff_p3_p3_p2", "coeff_m2_m2_p3", "coeff_m1_m2_p3", "coeff_0_m2_p3", + + "coeff_p1_m2_p3", "coeff_p2_m2_p3", "coeff_p3_m2_p3", "coeff_m2_m1_p3", + + "coeff_m1_m1_p3", "coeff_0_m1_p3", "coeff_p1_m1_p3", "coeff_p2_m1_p3", + + "coeff_p3_m1_p3", "coeff_m2_0_p3", "coeff_m1_0_p3", "coeff_0_0_p3", + + "coeff_p1_0_p3", "coeff_p2_0_p3", "coeff_p3_0_p3", "coeff_m2_p1_p3", + + "coeff_m1_p1_p3", "coeff_0_p1_p3", "coeff_p1_p1_p3", "coeff_p2_p1_p3", + + "coeff_p3_p1_p3", "coeff_m2_p2_p3", "coeff_m1_p2_p3", "coeff_0_p2_p3", + + "coeff_p1_p2_p3", "coeff_p2_p2_p3", "coeff_p3_p2_p3", "coeff_m2_p3_p3", + + "coeff_m1_p3_p3", "coeff_0_p3_p3", "coeff_p1_p3_p3", "coeff_p2_p3_p3", + + "coeff_p3_p3_p3"] + +> +> print_name_list_dcl(data_list_3d_size6, "fp", +> "3d.cube.size6/data-dcl.h"); +> print_name_list_dcl(coeffs_list_3d_size6, "fp", +> "3d.cube.size6/coeffs-dcl.h"); +> +> print_fetch_data(posn_list_3d_size6, "data->data_", +> "3d.cube.size6/fetch-data.c"); +> print_evaluate_molecule(posn_list_3d_size6, +> "coeffs->coeff_", "data->data_", +> "3d.cube.size6/evaluate-molecule.c"); +bytes used=3000572, alloc=1310480, time=0.30 +> print_store_coeffs(posn_list_3d_size6, +> "factor * coeffs->coeff_", +> "3d.cube.size6/store-coeffs.c"); +> quit +bytes used=3528664, alloc=1310480, time=0.36 diff --git a/src/common/3d.maple b/src/common/3d.maple new file mode 100644 index 0000000..6e60822 --- /dev/null +++ b/src/common/3d.maple @@ -0,0 +1,117 @@ +# Maple code to compute common coefficients for all 3d interpolation schemes +# $Header$ + +################################################################################ + +# +# generic stuff for 3d, cube, size=2 +# + +data_list_3d_size2 := map(data_var_name, posn_list_3d_size2, "data_"); +coeffs_list_3d_size2 := map(coeff_name, posn_list_3d_size2, "coeff_"); + +print_name_list_dcl(data_list_3d_size2, "fp", + "3d.cube.size2/data-dcl.h"); +print_name_list_dcl(coeffs_list_3d_size2, "fp", + "3d.cube.size2/coeffs-dcl.h"); + +print_load_data(posn_list_3d_size2, "data->data_", + "3d.cube.size2/load-data.c"); +print_evaluate_molecule(posn_list_3d_size2, + "coeffs->coeff_", "data->data_", + "3d.cube.size2/evaluate-molecule.c"); +print_store_coeffs(posn_list_3d_size2, + "factor * coeffs->coeff_", + "3d.cube.size2/store-coeffs.c"); + +################################################################################ + +# +# generic stuff for 3d, cube, size=3 +# + +data_list_3d_size3 := map(data_var_name, posn_list_3d_size3, "data_"); +coeffs_list_3d_size3 := map(coeff_name, posn_list_3d_size3, "coeff_"); + +print_name_list_dcl(data_list_3d_size3, "fp", + "3d.cube.size3/data-dcl.h"); +print_name_list_dcl(coeffs_list_3d_size3, "fp", + "3d.cube.size3/coeffs-dcl.h"); + +print_load_data(posn_list_3d_size3, "data->data_", + "3d.cube.size3/load-data.c"); +print_evaluate_molecule(posn_list_3d_size3, + "coeffs->coeff_", "data->data_", + "3d.cube.size3/evaluate-molecule.c"); +print_store_coeffs(posn_list_3d_size3, + "factor * coeffs->coeff_", + "3d.cube.size3/store-coeffs.c"); + +################################################################################ + +# +# generic stuff for 3d, cube, size=4 +# + +data_list_3d_size4 := map(data_var_name, posn_list_3d_size4, "data_"); +coeffs_list_3d_size4 := map(coeff_name, posn_list_3d_size4, "coeff_"); + +print_name_list_dcl(data_list_3d_size4, "fp", + "3d.cube.size4/data-dcl.h"); +print_name_list_dcl(coeffs_list_3d_size4, "fp", + "3d.cube.size4/coeffs-dcl.h"); + +print_load_data(posn_list_3d_size4, "data->data_", + "3d.cube.size4/load-data.c"); +print_evaluate_molecule(posn_list_3d_size4, + "coeffs->coeff_", "data->data_", + "3d.cube.size4/evaluate-molecule.c"); +print_store_coeffs(posn_list_3d_size4, + "factor * coeffs->coeff_", + "3d.cube.size4/store-coeffs.c"); + +################################################################################ + +# +# generic stuff for 3d, cube, size=5 +# + +data_list_3d_size5 := map(data_var_name, posn_list_3d_size5, "data_"); +coeffs_list_3d_size5 := map(coeff_name, posn_list_3d_size5, "coeff_"); + +print_name_list_dcl(data_list_3d_size5, "fp", + "3d.cube.size5/data-dcl.h"); +print_name_list_dcl(coeffs_list_3d_size5, "fp", + "3d.cube.size5/coeffs-dcl.h"); + +print_load_data(posn_list_3d_size5, "data->data_", + "3d.cube.size5/load-data.c"); +print_evaluate_molecule(posn_list_3d_size5, + "coeffs->coeff_", "data->data_", + "3d.cube.size5/evaluate-molecule.c"); +print_store_coeffs(posn_list_3d_size5, + "factor * coeffs->coeff_", + "3d.cube.size5/store-coeffs.c"); + +################################################################################ + +# +# generic stuff for 3d, cube, size=6 +# + +data_list_3d_size6 := map(data_var_name, posn_list_3d_size6, "data_"); +coeffs_list_3d_size6 := map(coeff_name, posn_list_3d_size6, "coeff_"); + +print_name_list_dcl(data_list_3d_size6, "fp", + "3d.cube.size6/data-dcl.h"); +print_name_list_dcl(coeffs_list_3d_size6, "fp", + "3d.cube.size6/coeffs-dcl.h"); + +print_load_data(posn_list_3d_size6, "data->data_", + "3d.cube.size6/load-data.c"); +print_evaluate_molecule(posn_list_3d_size6, + "coeffs->coeff_", "data->data_", + "3d.cube.size6/evaluate-molecule.c"); +print_store_coeffs(posn_list_3d_size6, + "factor * coeffs->coeff_", + "3d.cube.size6/store-coeffs.c"); diff --git a/src/common/README b/src/common/README new file mode 100644 index 0000000..cf22912 --- /dev/null +++ b/src/common/README @@ -0,0 +1,6 @@ +This directory contains Maple code to generate machine-generated coefficient +files which are common to multiple interpolation operators. In practice +these files depend only on the dimensionality and the molecule size/shape +(eg 3d, cube, size 4). + +The subdirectories contain the actual machine-generated files. diff --git a/src/common/cube_posns.maple b/src/common/cube_posns.maple new file mode 100644 index 0000000..2431e82 --- /dev/null +++ b/src/common/cube_posns.maple @@ -0,0 +1,46 @@ +# Maple code to compute lists of point positions in hypercube-shaped molecules +# $Header$ + +################################################################################ + +# +# 1D interpolation points +# +posn_list_1d_size2 := hypercube_points([ 0], [+1]); +posn_list_1d_size3 := hypercube_points([-1], [+1]); +posn_list_1d_size4 := hypercube_points([-1], [+2]); +posn_list_1d_size5 := hypercube_points([-2], [+2]); +posn_list_1d_size6 := hypercube_points([-2], [+3]); +posn_list_1d_size7 := hypercube_points([-3], [+3]); + +################################################################################ + +# +# 2D interpolation points (Fortran ordering) +# +posn_list_2d_size2 := map(ListTools[Reverse], + hypercube_points([ 0, 0], [+1,+1])); +posn_list_2d_size3 := map(ListTools[Reverse], + hypercube_points([-1,-1], [+1,+1])); +posn_list_2d_size4 := map(ListTools[Reverse], + hypercube_points([-1,-1], [+2,+2])); +posn_list_2d_size5 := map(ListTools[Reverse], + hypercube_points([-2,-2], [+2,+2])); +posn_list_2d_size6 := map(ListTools[Reverse], + hypercube_points([-2,-2], [+3,+3])); + +################################################################################ + +# +# 3D interpolation points (Fortran ordering) +# +posn_list_3d_size2 := map(ListTools[Reverse], + hypercube_points([ 0, 0, 0], [+1,+1,+1])); +posn_list_3d_size3 := map(ListTools[Reverse], + hypercube_points([-1,-1,-1], [+1,+1,+1])); +posn_list_3d_size4 := map(ListTools[Reverse], + hypercube_points([-1,-1,-1], [+2,+2,+2])); +posn_list_3d_size5 := map(ListTools[Reverse], + hypercube_points([-2,-2,-2], [+2,+2,+2])); +posn_list_3d_size6 := map(ListTools[Reverse], + hypercube_points([-2,-2,-2], [+3,+3,+3])); diff --git a/src/common/evaluate.c b/src/common/evaluate.c new file mode 100644 index 0000000..60156b3 --- /dev/null +++ b/src/common/evaluate.c @@ -0,0 +1,138 @@ +/* evaluate.c -- evaluate a molecule (as a linear combination of the data) */ +/* $Header$ */ + +#include "cctk.h" +#include "../InterpLocalUniform.h" + +#include "structs.h" +#include "evaluate.h" + +/******************************************************************************/ + +/* + * 1-D routines + */ + +fp AEILocalInterp_eval_1dcube2(const struct coeffs_struct_1d_cube_size2 *coeffs, + const struct data_struct_1d_cube_size2 *data) +{ +return + #include "1d.cube.size2/evaluate-molecule.c" +} + +fp AEILocalInterp_eval_1dcube3(const struct coeffs_struct_1d_cube_size3 *coeffs, + const struct data_struct_1d_cube_size3 *data) +{ +return + #include "1d.cube.size3/evaluate-molecule.c" +} + +fp AEILocalInterp_eval_1dcube4(const struct coeffs_struct_1d_cube_size4 *coeffs, + const struct data_struct_1d_cube_size4 *data) +{ +return + #include "1d.cube.size4/evaluate-molecule.c" +} + +fp AEILocalInterp_eval_1dcube5(const struct coeffs_struct_1d_cube_size5 *coeffs, + const struct data_struct_1d_cube_size5 *data) +{ +return + #include "1d.cube.size5/evaluate-molecule.c" +} + +fp AEILocalInterp_eval_1dcube6(const struct coeffs_struct_1d_cube_size6 *coeffs, + const struct data_struct_1d_cube_size6 *data) +{ +return + #include "1d.cube.size6/evaluate-molecule.c" +} + +fp AEILocalInterp_eval_1dcube7(const struct coeffs_struct_1d_cube_size7 *coeffs, + const struct data_struct_1d_cube_size7 *data) +{ +return + #include "1d.cube.size7/evaluate-molecule.c" +} + +/******************************************************************************/ + +/* + * 2-D routines + */ + +fp AEILocalInterp_eval_2dcube2(const struct coeffs_struct_2d_cube_size2 *coeffs, + const struct data_struct_2d_cube_size2 *data) +{ +return + #include "2d.cube.size2/evaluate-molecule.c" +} + +fp AEILocalInterp_eval_2dcube3(const struct coeffs_struct_2d_cube_size3 *coeffs, + const struct data_struct_2d_cube_size3 *data) +{ +return + #include "2d.cube.size3/evaluate-molecule.c" +} + +fp AEILocalInterp_eval_2dcube4(const struct coeffs_struct_2d_cube_size4 *coeffs, + const struct data_struct_2d_cube_size4 *data) +{ +return + #include "2d.cube.size4/evaluate-molecule.c" +} + +fp AEILocalInterp_eval_2dcube5(const struct coeffs_struct_2d_cube_size5 *coeffs, + const struct data_struct_2d_cube_size5 *data) +{ +return + #include "2d.cube.size5/evaluate-molecule.c" +} + +fp AEILocalInterp_eval_2dcube6(const struct coeffs_struct_2d_cube_size6 *coeffs, + const struct data_struct_2d_cube_size6 *data) +{ +return + #include "2d.cube.size6/evaluate-molecule.c" +} + +/******************************************************************************/ + +/* + * 3-D routines + */ + +fp AEILocalInterp_eval_3dcube2(const struct coeffs_struct_3d_cube_size2 *coeffs, + const struct data_struct_3d_cube_size2 *data) +{ +return + #include "3d.cube.size2/evaluate-molecule.c" +} + +fp AEILocalInterp_eval_3dcube3(const struct coeffs_struct_3d_cube_size3 *coeffs, + const struct data_struct_3d_cube_size3 *data) +{ +return + #include "3d.cube.size3/evaluate-molecule.c" +} + +fp AEILocalInterp_eval_3dcube4(const struct coeffs_struct_3d_cube_size4 *coeffs, + const struct data_struct_3d_cube_size4 *data) +{ +return + #include "3d.cube.size4/evaluate-molecule.c" +} + +fp AEILocalInterp_eval_3dcube5(const struct coeffs_struct_3d_cube_size5 *coeffs, + const struct data_struct_3d_cube_size5 *data) +{ +return + #include "3d.cube.size5/evaluate-molecule.c" +} + +fp AEILocalInterp_eval_3dcube6(const struct coeffs_struct_3d_cube_size6 *coeffs, + const struct data_struct_3d_cube_size6 *data) +{ +return + #include "3d.cube.size6/evaluate-molecule.c" +} diff --git a/src/common/evaluate.h b/src/common/evaluate.h new file mode 100644 index 0000000..4e2046a --- /dev/null +++ b/src/common/evaluate.h @@ -0,0 +1,44 @@ +/* evaluate.h -- evaluate a molecule (as a linear combination of the data) */ +/* $Header$ */ + +/* + * prerequisite headers: + * "cctk.h" + * "../InterpLocalUniform.h" + * "structs.h" + */ + +fp AEILocalInterp_eval_1dcube2(const struct coeffs_struct_1d_cube_size2 *coeffs, + const struct data_struct_1d_cube_size2 *data); +fp AEILocalInterp_eval_1dcube3(const struct coeffs_struct_1d_cube_size3 *coeffs, + const struct data_struct_1d_cube_size3 *data); +fp AEILocalInterp_eval_1dcube4(const struct coeffs_struct_1d_cube_size4 *coeffs, + const struct data_struct_1d_cube_size4 *data); +fp AEILocalInterp_eval_1dcube5(const struct coeffs_struct_1d_cube_size5 *coeffs, + const struct data_struct_1d_cube_size5 *data); +fp AEILocalInterp_eval_1dcube6(const struct coeffs_struct_1d_cube_size6 *coeffs, + const struct data_struct_1d_cube_size6 *data); +fp AEILocalInterp_eval_1dcube7(const struct coeffs_struct_1d_cube_size7 *coeffs, + const struct data_struct_1d_cube_size7 *data); + +fp AEILocalInterp_eval_2dcube2(const struct coeffs_struct_2d_cube_size2 *coeffs, + const struct data_struct_2d_cube_size2 *data); +fp AEILocalInterp_eval_2dcube3(const struct coeffs_struct_2d_cube_size3 *coeffs, + const struct data_struct_2d_cube_size3 *data); +fp AEILocalInterp_eval_2dcube4(const struct coeffs_struct_2d_cube_size4 *coeffs, + const struct data_struct_2d_cube_size4 *data); +fp AEILocalInterp_eval_2dcube5(const struct coeffs_struct_2d_cube_size5 *coeffs, + const struct data_struct_2d_cube_size5 *data); +fp AEILocalInterp_eval_2dcube6(const struct coeffs_struct_2d_cube_size6 *coeffs, + const struct data_struct_2d_cube_size6 *data); + +fp AEILocalInterp_eval_3dcube2(const struct coeffs_struct_3d_cube_size2 *coeffs, + const struct data_struct_3d_cube_size2 *data); +fp AEILocalInterp_eval_3dcube3(const struct coeffs_struct_3d_cube_size3 *coeffs, + const struct data_struct_3d_cube_size3 *data); +fp AEILocalInterp_eval_3dcube4(const struct coeffs_struct_3d_cube_size4 *coeffs, + const struct data_struct_3d_cube_size4 *data); +fp AEILocalInterp_eval_3dcube5(const struct coeffs_struct_3d_cube_size5 *coeffs, + const struct data_struct_3d_cube_size5 *data); +fp AEILocalInterp_eval_3dcube6(const struct coeffs_struct_3d_cube_size6 *coeffs, + const struct data_struct_3d_cube_size6 *data); diff --git a/src/common/load-template.c b/src/common/load-template.c new file mode 100644 index 0000000..5caa23b --- /dev/null +++ b/src/common/load-template.c @@ -0,0 +1,94 @@ +/* load-template.c -- template for load functions */ +/* $Header$ */ + +/* + * Each of the functions defined in this file loades a molecule-sized + * piece of an input array into a data struct. There is one function for + * each combination of molecule size and input array datatype. + */ + +/******************************************************************************/ + +/* + * load-data routines for real datatypes + */ + +#undef DATA +#define DATA DATA_REAL + +void LOAD_FUNCTION_NAME(r)(const CCTK_REAL *ptr, + INT_STRIDE_IJK, + struct DATA_STRUCT *data) +{ +#include LOAD_DATA_FILE_NAME +} + +#ifdef HAVE_CCTK_REAL4 + void LOAD_FUNCTION_NAME(r4)(const CCTK_REAL4 *ptr, + INT_STRIDE_IJK, + struct DATA_STRUCT *data) + { + #include LOAD_DATA_FILE_NAME + } +#endif + +#ifdef HAVE_CCTK_REAL8 + void LOAD_FUNCTION_NAME(r8)(const CCTK_REAL8 *ptr, + INT_STRIDE_IJK, + struct DATA_STRUCT *data) + { + #include LOAD_DATA_FILE_NAME + } +#endif + +#ifdef HAVE_CCTK_REAL16 + void LOAD_FUNCTION_NAME(r16)(const CCTK_REAL16 *ptr, + INT_STRIDE_IJK, + struct DATA_STRUCT *data) + { + #include LOAD_DATA_FILE_NAME + } +#endif + +/******************************************************************************/ + +/* + * load-data routines for complex datatypes + */ + +#undef DATA +#define DATA DATA_COMPLEX + +void LOAD_FUNCTION_NAME(c)(const CCTK_REAL (*ptr)[COMPLEX_N_PARTS], + INT_STRIDE_IJK, int part, + struct DATA_STRUCT *data) +{ +#include LOAD_DATA_FILE_NAME +} + +#ifdef HAVE_CCTK_COMPLEX8 + void LOAD_FUNCTION_NAME(c8)(const CCTK_REAL4 (*ptr)[COMPLEX_N_PARTS], + INT_STRIDE_IJK, int part, + struct DATA_STRUCT *data) + { + #include LOAD_DATA_FILE_NAME + } +#endif + +#ifdef HAVE_CCTK_COMPLEX16 + void LOAD_FUNCTION_NAME(c16)(const CCTK_REAL8 (*ptr)[COMPLEX_N_PARTS], + INT_STRIDE_IJK, int part, + struct DATA_STRUCT *data) + { + #include LOAD_DATA_FILE_NAME + } +#endif + +#ifdef HAVE_CCTK_COMPLEX32 + void LOAD_FUNCTION_NAME(c32)(const CCTK_REAL16 (*ptr)[COMPLEX_N_PARTS], + INT_STRIDE_IJK, int part, + struct DATA_STRUCT *data) + { + #include LOAD_DATA_FILE_NAME + } +#endif diff --git a/src/common/load-template.h b/src/common/load-template.h new file mode 100644 index 0000000..08cdfd4 --- /dev/null +++ b/src/common/load-template.h @@ -0,0 +1,69 @@ +/* load-template.h -- prototype template for load functions */ +/* $Header$ */ + +/* + * Each of the functions defined in this file loades a molecule-sized + * piece of an input array into a data struct. There is one function for + * each combination of molecule size and input array datatype. + * + * The following macros should be #defined + * LOAD_FUNCTION_NAME + * INT_STRIDE_IJK + * DATA_STRUCT + */ + +/******************************************************************************/ + +/* + * load-data routines for real datatypes + */ + +void LOAD_FUNCTION_NAME(r)(const CCTK_REAL *ptr, + INT_STRIDE_IJK, + struct DATA_STRUCT *data); + +#ifdef HAVE_CCTK_REAL4 + void LOAD_FUNCTION_NAME(r4)(const CCTK_REAL4 *ptr, + INT_STRIDE_IJK, + struct DATA_STRUCT *data); +#endif + +#ifdef HAVE_CCTK_REAL8 + void LOAD_FUNCTION_NAME(r8)(const CCTK_REAL8 *ptr, + INT_STRIDE_IJK, + struct DATA_STRUCT *data); +#endif + +#ifdef HAVE_CCTK_REAL16 + void LOAD_FUNCTION_NAME(r16)(const CCTK_REAL16 *ptr, + INT_STRIDE_IJK, + struct DATA_STRUCT *data); +#endif + +/******************************************************************************/ + +/* + * load-data routines for complex datatypes + */ + +void LOAD_FUNCTION_NAME(c)(const CCTK_REAL (*ptr)[COMPLEX_N_PARTS], + INT_STRIDE_IJK, int part, + struct DATA_STRUCT *data); + +#ifdef HAVE_CCTK_COMPLEX8 + void LOAD_FUNCTION_NAME(c8)(const CCTK_REAL4 (*ptr)[COMPLEX_N_PARTS], + INT_STRIDE_IJK, int part, + struct DATA_STRUCT *data); +#endif + +#ifdef HAVE_CCTK_COMPLEX16 + void LOAD_FUNCTION_NAME(c16)(const CCTK_REAL8 (*ptr)[COMPLEX_N_PARTS], + INT_STRIDE_IJK, int part, + struct DATA_STRUCT *data); +#endif + +#ifdef HAVE_CCTK_COMPLEX32 + void LOAD_FUNCTION_NAME(c32)(const CCTK_REAL16 (*ptr)[COMPLEX_N_PARTS], + INT_STRIDE_IJK, int part, + struct DATA_STRUCT *data); +#endif diff --git a/src/common/load.c b/src/common/load.c new file mode 100644 index 0000000..6272b74 --- /dev/null +++ b/src/common/load.c @@ -0,0 +1,179 @@ +/* load.c -- load molecule-sized piece of input array into struct data */ +/* $Header$ */ + +#include "cctk.h" +#include "../InterpLocalUniform.h" + +#include "structs.h" +#include "load.h" + +/******************************************************************************/ + +/* + * 1-D routines + */ + +#undef INT_STRIDE_IJK +#define INT_STRIDE_IJK int stride_i +#undef DATA_REAL +#define DATA_REAL(mi) ptr[stride_i*mi] +#undef DATA_COMPLEX +#define DATA_COMPLEX(mi) ptr[stride_i*mi][part] + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_1dcube2_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_1d_cube_size2 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "1d.cube.size2/load-data.c" +#include "load-template.c" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_1dcube3_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_1d_cube_size3 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "1d.cube.size3/load-data.c" +#include "load-template.c" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_1dcube4_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_1d_cube_size4 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "1d.cube.size4/load-data.c" +#include "load-template.c" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_1dcube5_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_1d_cube_size5 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "1d.cube.size5/load-data.c" +#include "load-template.c" +#undef LOAD_FUNCTION_NAME_PREFIX + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_1dcube6_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_1d_cube_size6 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "1d.cube.size6/load-data.c" +#include "load-template.c" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_1dcube7_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_1d_cube_size7 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "1d.cube.size7/load-data.c" +#include "load-template.c" + +/******************************************************************************/ + +/* + * 2-D routines + */ + +#undef INT_STRIDE_IJK +#define INT_STRIDE_IJK int stride_i, int stride_j +#undef DATA_REAL +#define DATA_REAL(mi,mj) ptr[stride_i*mi + stride_j*mj] +#undef DATA_COMPLEX +#define DATA_COMPLEX(mi,mj) ptr[stride_i*mi + stride_j*mj][part] + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_2dcube2_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_2d_cube_size2 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "2d.cube.size2/load-data.c" +#include "load-template.c" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_2dcube3_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_2d_cube_size3 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "2d.cube.size3/load-data.c" +#include "load-template.c" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_2dcube4_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_2d_cube_size4 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "2d.cube.size4/load-data.c" +#include "load-template.c" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_2dcube5_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_2d_cube_size5 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "2d.cube.size5/load-data.c" +#include "load-template.c" +#undef LOAD_FUNCTION_NAME_PREFIX + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_2dcube6_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_2d_cube_size6 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "2d.cube.size6/load-data.c" +#include "load-template.c" + +/******************************************************************************/ + +/* + * 3-D routines + */ + +#undef INT_STRIDE_IJK +#define INT_STRIDE_IJK int stride_i, int stride_j, int stride_k +#undef DATA_REAL +#define DATA_REAL(mi,mj,mk) ptr[stride_i*mi + stride_j*mj + stride_k*mk] +#undef DATA_COMPLEX +#define DATA_COMPLEX(mi,mj,mk) ptr[stride_i*mi + stride_j*mj + stride_k*mk] \ + [part] + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_3dcube2_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_3d_cube_size2 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "3d.cube.size2/load-data.c" +#include "load-template.c" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_3dcube3_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_3d_cube_size3 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "3d.cube.size3/load-data.c" +#include "load-template.c" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_3dcube4_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_3d_cube_size4 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "3d.cube.size4/load-data.c" +#include "load-template.c" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_3dcube5_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_3d_cube_size5 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "3d.cube.size5/load-data.c" +#include "load-template.c" +#undef LOAD_FUNCTION_NAME_PREFIX + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_3dcube6_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_3d_cube_size6 +#undef LOAD_DATA_FILE_NAME +#define LOAD_DATA_FILE_NAME "3d.cube.size6/load-data.c" +#include "load-template.c" diff --git a/src/common/load.h b/src/common/load.h new file mode 100644 index 0000000..98ff266 --- /dev/null +++ b/src/common/load.h @@ -0,0 +1,149 @@ +/* load.h -- load molecule-sized piece of input array into struct data */ +/* $Header$ */ + +/* + * prerequisite headers: + * "cctk.h" + * "../InterpLocalUniform.h" + * "structs.h" + */ + +/******************************************************************************/ + +/* + * 1-D load routines + */ + +#undef INT_STRIDE_IJK +#define INT_STRIDE_IJK int stride_i + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_1dcube2_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_1d_cube_size2 +#include "load-template.h" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_1dcube3_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_1d_cube_size3 +#include "load-template.h" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_1dcube4_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_1d_cube_size4 +#include "load-template.h" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_1dcube5_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_1d_cube_size5 +#include "load-template.h" +#undef LOAD_FUNCTION_NAME_PREFIX + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_1dcube6_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_1d_cube_size6 +#include "load-template.h" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_1dcube7_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_1d_cube_size7 +#include "load-template.h" + +/******************************************************************************/ + +/* + * 2-D load routines + */ + +#undef INT_STRIDE_IJK +#define INT_STRIDE_IJK int stride_i, int stride_j + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_2dcube2_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_2d_cube_size2 +#include "load-template.h" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_2dcube3_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_2d_cube_size3 +#include "load-template.h" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_2dcube4_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_2d_cube_size4 +#include "load-template.h" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_2dcube5_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_2d_cube_size5 +#include "load-template.h" +#undef LOAD_FUNCTION_NAME_PREFIX + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_2dcube6_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_2d_cube_size6 +#include "load-template.h" + +/******************************************************************************/ + +/* + * 3-D load routines + */ + +#undef INT_STRIDE_IJK +#define INT_STRIDE_IJK int stride_i, int stride_j, int stride_k + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_3dcube2_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_3d_cube_size2 +#include "load-template.h" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_3dcube3_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_3d_cube_size3 +#include "load-template.h" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_3dcube3_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_3d_cube_size3 +#include "load-template.h" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_3dcube4_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_3d_cube_size4 +#include "load-template.h" + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_3dcube5_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_3d_cube_size5 +#include "load-template.h" +#undef LOAD_FUNCTION_NAME_PREFIX + +#undef LOAD_FUNCTION_NAME +#define LOAD_FUNCTION_NAME(type) AEILocalInterp_load_3dcube6_ ## type +#undef DATA_STRUCT +#define DATA_STRUCT data_struct_3d_cube_size6 +#include "load-template.h" + +/******************************************************************************/ + +/* + * We don't want to leave DATA_STRUCT defined -- this would confuse + * later code that wants to define it and include "load-template.c" + */ +#undef DATA_STRUCT diff --git a/src/common/make.code.defn b/src/common/make.code.defn new file mode 100644 index 0000000..460d71a --- /dev/null +++ b/src/common/make.code.defn @@ -0,0 +1,5 @@ +# make.code.defn file for support routines common to multiple molecule families +# $Header$ + +# Source files in this directory +SRCS = load.c evaluate.c store.c diff --git a/src/common/makefile b/src/common/makefile new file mode 100644 index 0000000..03b634d --- /dev/null +++ b/src/common/makefile @@ -0,0 +1,64 @@ +# +# main targets: rebuild machine-generated coefficient files +# + +default : 1d 2d 3d +dirs : 1d.dirs 2d.dirs 3d.dirs + +.PHONY : 1d +1d : + -rm -f 1d.cube.size*/*.c 1d.cube.size*/*.h + cat ../util.maple ../interpolate.maple \ + cube_posns.maple 1d.maple \ + | maple 2>&1 >1d.log + +.PHONY : 2d +2d : + -rm -f 2d.cube.size*/*.c 2d.cube.size*/*.h + cat ../util.maple ../interpolate.maple \ + cube_posns.maple 2d.maple \ + | maple 2>&2 >2d.log + +.PHONY : 3d +3d : + -rm -f 3d.cube.size*/*.c 3d.cube.size*/*.h + cat ../util.maple ../interpolate.maple \ + cube_posns.maple 3d.maple \ + | maple 2>&2 >3d.log + +################################################################################ + +# +# targets to initially create directories for machine-generated coefficients +# these only need to be run if you're setting up a new interpolator, +# i.e. if you don't already have the directories in cvs +# (you still have to add them to cvs by hand) +# + +.PHONY : 1d.dirs +1d.dirs: + -rm -rf 1d.cube.size* + mkdir 1d.cube.size2 + mkdir 1d.cube.size3 + mkdir 1d.cube.size4 + mkdir 1d.cube.size5 + mkdir 1d.cube.size6 + mkdir 1d.cube.size7 + +.PHONY : 2d.dirs +2d.dirs: + -rm -rf 2d.cube.size* + mkdir 2d.cube.size2 + mkdir 2d.cube.size3 + mkdir 2d.cube.size4 + mkdir 2d.cube.size5 + mkdir 2d.cube.size6 + +.PHONY : 3d.dirs +3d.dirs: + -rm -rf 3d.cube.size* + mkdir 3d.cube.size2 + mkdir 3d.cube.size3 + mkdir 3d.cube.size4 + mkdir 3d.cube.size5 + mkdir 3d.cube.size6 diff --git a/src/common/store.c b/src/common/store.c new file mode 100644 index 0000000..3ed6003 --- /dev/null +++ b/src/common/store.c @@ -0,0 +1,166 @@ +/* store.c -- store molecule coefficients in Jacobian */ +/* $Header$ */ + +#include "cctk.h" +#include "../InterpLocalUniform.h" + +#include "structs.h" +#include "store.h" + +/******************************************************************************/ + +/* + * 1-D routines + */ + +#undef COEFF +#define COEFF(mi) Jacobian_ptr[Jacobian_mi_stride*mi] + +void AEILocalInterp_store_1dcube2 + (fp factor, const struct coeffs_struct_1d_cube_size2 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride) +{ +#include "1d.cube.size2/store-coeffs.c" +} + +void AEILocalInterp_store_1dcube3 + (fp factor, const struct coeffs_struct_1d_cube_size3 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride) +{ +#include "1d.cube.size3/store-coeffs.c" +} + +void AEILocalInterp_store_1dcube4 + (fp factor, const struct coeffs_struct_1d_cube_size4 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride) +{ +#include "1d.cube.size4/store-coeffs.c" +} + +void AEILocalInterp_store_1dcube5 + (fp factor, const struct coeffs_struct_1d_cube_size5 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride) +{ +#include "1d.cube.size5/store-coeffs.c" +} + +void AEILocalInterp_store_1dcube6 + (fp factor, const struct coeffs_struct_1d_cube_size6 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride) +{ +#include "1d.cube.size6/store-coeffs.c" +} + +void AEILocalInterp_store_1dcube7 + (fp factor, const struct coeffs_struct_1d_cube_size7 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride) +{ +#include "1d.cube.size7/store-coeffs.c" +} + +/******************************************************************************/ + +/* + * 2-D routines + */ + +#undef COEFF +#define COEFF(mi,mj) Jacobian_ptr[ Jacobian_mi_stride*mi \ + + Jacobian_mj_stride*mj ] + +void AEILocalInterp_store_2dcube2 + (fp factor, const struct coeffs_struct_2d_cube_size2 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride) +{ +#include "2d.cube.size2/store-coeffs.c" +} + +void AEILocalInterp_store_2dcube3 + (fp factor, const struct coeffs_struct_2d_cube_size3 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride) +{ +#include "2d.cube.size3/store-coeffs.c" +} + +void AEILocalInterp_store_2dcube4 + (fp factor, const struct coeffs_struct_2d_cube_size4 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride) +{ +#include "2d.cube.size4/store-coeffs.c" +} + +void AEILocalInterp_store_2dcube5 + (fp factor, const struct coeffs_struct_2d_cube_size5 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride) +{ +#include "2d.cube.size5/store-coeffs.c" +} + +void AEILocalInterp_store_2dcube6 + (fp factor, const struct coeffs_struct_2d_cube_size6 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride) +{ +#include "2d.cube.size6/store-coeffs.c" +} + +/******************************************************************************/ + +/* + * 3-D routines + */ + +#undef COEFF +#define COEFF(mi,mj,mk) Jacobian_ptr[ Jacobian_mi_stride*mi \ + + Jacobian_mj_stride*mj \ + + Jacobian_mk_stride*mk ] + +void AEILocalInterp_store_3dcube2 + (fp factor, const struct coeffs_struct_3d_cube_size2 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride, int Jacobian_mk_stride) +{ +#include "3d.cube.size2/store-coeffs.c" +} + +void AEILocalInterp_store_3dcube3 + (fp factor, const struct coeffs_struct_3d_cube_size3 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride, int Jacobian_mk_stride) +{ +#include "3d.cube.size3/store-coeffs.c" +} + +void AEILocalInterp_store_3dcube4 + (fp factor, const struct coeffs_struct_3d_cube_size4 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride, int Jacobian_mk_stride) +{ +#include "3d.cube.size4/store-coeffs.c" +} + +void AEILocalInterp_store_3dcube5 + (fp factor, const struct coeffs_struct_3d_cube_size5 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride, int Jacobian_mk_stride) +{ +#include "3d.cube.size5/store-coeffs.c" +} + +void AEILocalInterp_store_3dcube6 + (fp factor, const struct coeffs_struct_3d_cube_size6 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride, int Jacobian_mk_stride) +{ +#include "3d.cube.size6/store-coeffs.c" +} diff --git a/src/common/store.h b/src/common/store.h new file mode 100644 index 0000000..e042552 --- /dev/null +++ b/src/common/store.h @@ -0,0 +1,76 @@ +/* store.h -- store molecule coefficients in Jacobian */ +/* $Header$ */ + +/* + * prerequisite headers: + * "cctk.h" + * "../InterpLocalUniform.h" + * "structs.h" + */ + +void AEILocalInterp_store_1dcube2 + (fp factor, const struct coeffs_struct_1d_cube_size2 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride); +void AEILocalInterp_store_1dcube3 + (fp factor, const struct coeffs_struct_1d_cube_size3 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride); +void AEILocalInterp_store_1dcube4 + (fp factor, const struct coeffs_struct_1d_cube_size4 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride); +void AEILocalInterp_store_1dcube5 + (fp factor, const struct coeffs_struct_1d_cube_size5 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride); +void AEILocalInterp_store_1dcube6 + (fp factor, const struct coeffs_struct_1d_cube_size6 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride); +void AEILocalInterp_store_1dcube7 + (fp factor, const struct coeffs_struct_1d_cube_size7 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride); + +void AEILocalInterp_store_2dcube2 + (fp factor, const struct coeffs_struct_2d_cube_size2 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride); +void AEILocalInterp_store_2dcube3 + (fp factor, const struct coeffs_struct_2d_cube_size3 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride); +void AEILocalInterp_store_2dcube4 + (fp factor, const struct coeffs_struct_2d_cube_size4 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride); +void AEILocalInterp_store_2dcube5 + (fp factor, const struct coeffs_struct_2d_cube_size5 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride); +void AEILocalInterp_store_2dcube6 + (fp factor, const struct coeffs_struct_2d_cube_size6 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride); + +void AEILocalInterp_store_3dcube2 + (fp factor, const struct coeffs_struct_3d_cube_size2 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride, int Jacobian_mk_stride); +void AEILocalInterp_store_3dcube3 + (fp factor, const struct coeffs_struct_3d_cube_size3 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride, int Jacobian_mk_stride); +void AEILocalInterp_store_3dcube4 + (fp factor, const struct coeffs_struct_3d_cube_size4 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride, int Jacobian_mk_stride); +void AEILocalInterp_store_3dcube5 + (fp factor, const struct coeffs_struct_3d_cube_size5 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride, int Jacobian_mk_stride); +void AEILocalInterp_store_3dcube6 + (fp factor, const struct coeffs_struct_3d_cube_size6 *coeffs, + fp Jacobian_ptr[], + int Jacobian_mi_stride, int Jacobian_mj_stride, int Jacobian_mk_stride); diff --git a/src/common/structs.h b/src/common/structs.h new file mode 100644 index 0000000..07481ca --- /dev/null +++ b/src/common/structs.h @@ -0,0 +1,157 @@ +/* structs.h -- definitions of data/coeffsicient structures */ +/* $Header$ */ + +/* + * prerequisite headers: + * "cctk.h" + * "../InterpLocalUniform.h" + */ + +/******************************************************************************/ + +/* + * Each of these structures holds a molecule-sized piece of a single + * real data array, or of a single real/imaginary component of a single + * complex data array. + */ + +struct data_struct_1d_cube_size2 + { + #include "1d.cube.size2/data-dcl.h" + }; +struct data_struct_1d_cube_size3 + { + #include "1d.cube.size3/data-dcl.h" + }; +struct data_struct_1d_cube_size4 + { + #include "1d.cube.size4/data-dcl.h" + }; +struct data_struct_1d_cube_size5 + { + #include "1d.cube.size5/data-dcl.h" + }; +struct data_struct_1d_cube_size6 + { + #include "1d.cube.size6/data-dcl.h" + }; +struct data_struct_1d_cube_size7 + { + #include "1d.cube.size7/data-dcl.h" + }; + +struct data_struct_2d_cube_size2 + { + #include "2d.cube.size2/data-dcl.h" + }; +struct data_struct_2d_cube_size3 + { + #include "2d.cube.size3/data-dcl.h" + }; +struct data_struct_2d_cube_size4 + { + #include "2d.cube.size4/data-dcl.h" + }; +struct data_struct_2d_cube_size5 + { + #include "2d.cube.size5/data-dcl.h" + }; +struct data_struct_2d_cube_size6 + { + #include "2d.cube.size6/data-dcl.h" + }; + +struct data_struct_3d_cube_size2 + { + #include "3d.cube.size2/data-dcl.h" + }; +struct data_struct_3d_cube_size3 + { + #include "3d.cube.size3/data-dcl.h" + }; +struct data_struct_3d_cube_size4 + { + #include "3d.cube.size4/data-dcl.h" + }; +struct data_struct_3d_cube_size5 + { + #include "3d.cube.size5/data-dcl.h" + }; +struct data_struct_3d_cube_size6 + { + #include "3d.cube.size6/data-dcl.h" + }; + +/******************************************************************************/ + +/* + * Each of these structures holds all the coeffsicients for a single + * molecule (written as a linear combination of the input data). + */ + +struct coeffs_struct_1d_cube_size2 + { + #include "1d.cube.size2/coeffs-dcl.h" + }; +struct coeffs_struct_1d_cube_size3 + { + #include "1d.cube.size3/coeffs-dcl.h" + }; +struct coeffs_struct_1d_cube_size4 + { + #include "1d.cube.size4/coeffs-dcl.h" + }; +struct coeffs_struct_1d_cube_size5 + { + #include "1d.cube.size5/coeffs-dcl.h" + }; +struct coeffs_struct_1d_cube_size6 + { + #include "1d.cube.size6/coeffs-dcl.h" + }; +struct coeffs_struct_1d_cube_size7 + { + #include "1d.cube.size7/coeffs-dcl.h" + }; + +struct coeffs_struct_2d_cube_size2 + { + #include "2d.cube.size2/coeffs-dcl.h" + }; +struct coeffs_struct_2d_cube_size3 + { + #include "2d.cube.size3/coeffs-dcl.h" + }; +struct coeffs_struct_2d_cube_size4 + { + #include "2d.cube.size4/coeffs-dcl.h" + }; +struct coeffs_struct_2d_cube_size5 + { + #include "2d.cube.size5/coeffs-dcl.h" + }; +struct coeffs_struct_2d_cube_size6 + { + #include "2d.cube.size6/coeffs-dcl.h" + }; + +struct coeffs_struct_3d_cube_size2 + { + #include "3d.cube.size2/coeffs-dcl.h" + }; +struct coeffs_struct_3d_cube_size3 + { + #include "3d.cube.size3/coeffs-dcl.h" + }; +struct coeffs_struct_3d_cube_size4 + { + #include "3d.cube.size4/coeffs-dcl.h" + }; +struct coeffs_struct_3d_cube_size5 + { + #include "3d.cube.size5/coeffs-dcl.h" + }; +struct coeffs_struct_3d_cube_size6 + { + #include "3d.cube.size6/coeffs-dcl.h" + }; |