dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #13408
Re: [HG DOLFIN] Add initial version of new parameter?system. See test in sandbox/misc.
On Fri, May 08, 2009 at 03:01:18PM +0200, Johan Hake wrote:
> On Friday 08 May 2009 14:57:11 Anders Logg wrote:
> > On Fri, May 08, 2009 at 02:49:01PM +0200, Johan Hake wrote:
> > > On Friday 08 May 2009 14:11:32 DOLFIN wrote:
> > > > One or more new changesets pushed to the primary dolfin repository.
> > > > A short summary of the last three changesets is included below.
> > > >
> > > > changeset: 6101:f22b49031d081323d6c6ce18eccbb12c80240b22
> > > > tag: tip
> > > > user: Anders Logg <logg@xxxxxxxxx>
> > > > date: Fri May 08 14:11:28 2009 +0200
> > > > files: ChangeLog dolfin/parameter/NewParameter.cpp
> > > > dolfin/parameter/NewParameter.h dolfin/parameter/Parameters.cpp
> > > > dolfin/parameter/Parameters.h dolfin/parameter/dolfin_parameter.h
> > > > sandbox/misc/cpp/main.cpp description:
> > > > Add initial version of new parameter system. See test in sandbox/misc.
> > > >
> > > > Implementation similar to before, but much simplified as a result of
> > > > removing the ParameterValue class and subclassing (New)Parameter
> > > > directly.
> > > >
> > > > Implementation consists of two classes: Parameters and (New)Parameter.
> > > > Only supports int and double so far. Range checks implemented.
> > > >
> > > > Check if this looks ok. Will continue to add more features.
> > >
> > > Looks nice. The info was a bit verbose for me, but that's details.
> >
> > I'm working on an ever more verbose version now, but it's prettier and
> > looks more like what you suggested to me a few days back.
>
> Ok!
>
> > > Will it be possible to
> > >
> > > my_params.add("another params",my_other_params);
> > >
> > > where my_other_params is a Parameters?
> >
> > Yes, that should be possible to fix. And I guess you mean those should
> > then be nested? So after the above line, one may do
> >
> > my_params["another params"]["foo"] = 1.0;
>
> Exactly!
I've implemented this, but I had to change the last [] to ().
Having [] both for nested databases and parameters works fine in
Python but doing it in C++ would mess up the inheritance completely.
I think it's doable but it would complicate the implementation.
So the above example would be
my_params.add(my_other_params);
my_params["another params"]("foo") = 1.0;
So the pattern is
parameters[][][][]()
or just
parameters()
--
Anders
Attachment:
signature.asc
Description: Digital signature
Follow ups
References