Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2008-03-18 18:39:28


Markus Werle wrote:
> Eric Niebler wrote:
>
>
>> In picking a max arity for a DSEL, I think we reach the limits of human
>> readability (a function that takes 20 arguments?! Really?) before we
>> reach Proto's breaking point.
>
> I am dreaming of:
>
> scalar_field<0> rho;
> scalar_field<1> u;
> scalar_field<2> v;
> ....
>
> Solver.AddPDESystem()
> [ddt(rho) + ddx(rho * u) + ddy(rho * v) + sourceterm == 0],
> [ddt(rho * u) + ddx(rho * pow<2, 1>(u)) + ddy(rho * u * v) == 0],
> [.. some other 10-20 partial differential eqns. omitted ];

Cool!

> What is not readable here and how many operands are in the
> whole expression?

I don't see anything besides unary and binary expressions here, so a max
arity of 2 would suffice for your purposes. (But Proto requires max
arity to be at least 3 to support the ternary ?: operator.)

> P.S.: rational power is missing in proto! tss, tss ...

Proto also doesn't have abs, sign, cos, sin, etc., etc. These are
functions, not operators. You would probably handle pow<2,1>(u) like I
handle construct<T>(_1, _2) in the Expression Construction Utilities
section.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk