dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #21248
Re: Mesh refine
-
To:
Anders Logg <logg@xxxxxxxxx>
-
From:
"Garth N. Wells" <gnw20@xxxxxxxxx>
-
Date:
Thu, 03 Feb 2011 20:54:10 +0000
-
Cc:
DOLFIN Mailing List <dolfin@xxxxxxxxxxxxxxxxxxx>
-
In-reply-to:
<20110203204932.GK3534@eowyn>
-
User-agent:
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7
On 03/02/11 20:49, Anders Logg wrote:
> On Thu, Feb 03, 2011 at 08:26:14PM +0000, Garth N. Wells wrote:
>> I haven't looked at the new mesh refine code, but I'm not too keen on
>> the interface. It was neat to do
>>
>> Mesh mesh("lshape.xml.gz");
>> mesh = refine(mesh);
>>
>> Doing the above, there is no compile time error, but there is a runtime
>> error. Now we have to do
>>
>> Mesh mesh0("lshape.xml.gz");
>> Mesh& mesh = refine(mesh0);
>
> The above is not possible. You have to do
>
... seems that it is. Look at the NS demo.
> Mesh mesh0("lshape.xml.gz");
> const Mesh& mesh = refine(mesh0);
>
> (const since the returned mesh has access to mesh0 which is a const
> argument of refine)
>
> Alternatively, as I've done in the Navier-Stokes demo, you can do
>
> Mesh mesh0("lshape.xml.gz");
> refine(mesh0);
> Mesh& mesh = mesh0.child(); // no const here
>
>> which I think is a bit clumsy. How can I refine a mesh easily if I'm not
>> interested in keeping a hierarchy?
>
> I agree it's more clumsy.
>
> I don't know what the best solution is. Perhaps one could have a
> global parameter "store_hierarchy" which defaults to False in
> combination with return by value in the refine functions.
>
> Assignment would then only work when the depth of the hierarchy is 1
> (when no hierarchy is stored).
>
I think that it's essential that the hierarchy can be disregarded. I use
refine, but I'm not yet interested the hierarchy.
> Another option would be to allow assignment from the returned
> reference but then make sure that whenever we assign to an object that
> is a member of a hierarchy, we destroy the (entire) hierarchy. This
> might be cleaner since we don't need the parameter.
>
I would like to keep Mesh simple. Could we have something like a
HierarchicalFoo container that can wrap a Mesh, and store the hierarchy,
etc?
Garth
> --
> Anders
Follow ups
References