Boost logo

Proto :

Subject: Re: [proto] How to customize an expression in an EDSL , so as to make a deep copy of it?
From: 伊藤 (itoh.masakatsu_at_[hidden])
Date: 2015-12-25 08:06:29


Hi Bart,

Thank you so much for fixing my source code and giving me
this good starting point for my first mini-EDSL .
I'll try to extend grammar objects and will learn more about Proto.

> You can create a proper proto terminal in your domain using:
> ExprWrapper<boost::proto::terminal<DifferenceOperator>::type> const
> opr = {{}};

Actually I tried to adapt my DiffereneceOperator type to Proto
as Proto Users Guide explains in "Adapting Existing Types to Proto".

http://www.boost.org/doc/libs/1_57_0/doc/html/proto/users_guide.html#boost_proto.users_guide.front_end.define_operators

And I wondered when it is necessary to write a code such like

calculator< proto::terminal< placeholder<0> >::type > const _1;

in |"The extends< > Expression Wrapper".

http://www.boost.org/doc/libs/1_57_0/doc/html/proto/users_guide.html#boost_proto.users_guide.front_end.customizing_expressions_in_your_domain.extends
|||||
<http://www.boost.org/doc/libs/1_57_0/doc/html/proto/users_guide.html#boost_proto.users_guide.front_end.customizing_expressions_in_your_domain.extends>

But I now see there's a big difference between these two ways.
although I still don't understand why .

So I'm reading your paper,
"Finite Element Assembly Using an Embedded Domain Specific Language",
Bart Janssens, Támas Bányai, Karim Limam, and Walter Bosschaerts,
Scientific Programming Volume 2015 (2015), Article ID 797325, 22 pages.

It's very interesting and helpful to me.

Wishing you a merry Christmas,
Masa

> p.s. It's awfully quiet on this list, is it still the place to discuss
> Proto?
>
I wish there could be a place where lots of people discuss about
how to use Proto for scientific simulations.

On 2015年12月22日 20:57, Bart Janssens wrote:
> Hi Masa,
>
> The problem is that you were not really building a proto expression,
> but just calling your DifferenceOperator directly. You can create a
> proper proto terminal in your domain using:
> ExprWrapper<boost::proto::terminal<DifferenceOperator>::type> const
> opr = {{}};
>
> Once that is done, only the deep copy compiles, but you need a proper
> grammar for evaluation to work, and a << overload for printing and
> starting evaluation. The fixed code with a small start of the grammar
> is attached.
>
> p.s. It's awfully quiet on this list, is it still the place to discuss
> Proto?
>
> Cheers,
>
> Bart
>
> On Mon, Dec 14, 2015 at 12:48 PM Masakatsu ITO(伊藤)
> <itoh.masakatsu_at_[hidden] <mailto:itoh.masakatsu_at_[hidden]>> wrote:
>
> Hello,
>
> I'm trying to make an EDSL for finite volume method,
> which translates a formula of the method into
> executable code.
>
> Now I've confirmed that such a formula
>
> std::cout << MyEDSL::opr( 0.1, 0.1) + 1.0 << std::endl;
>
> can be compiled and prints out the correct answer.
>
>
>
> _______________________________________________
> proto mailing list
> proto_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/proto



Proto list run by eric at boostpro.com