← Back to team overview

dolfin team mailing list archive

Re: Mesh refinement broken

 

On Thu, Feb 03, 2011 at 12:16:29PM +0100, Murtazo Nazarov wrote:
> On 02/02/2011 07:57 PM, Anders Logg wrote:
> >On Wed, Feb 02, 2011 at 06:56:02PM +0000, Garth N. Wells wrote:
> >>
> >>On 02/02/11 10:55, Anders Logg wrote:
> >>>On Mon, Jan 31, 2011 at 09:40:19AM +0100, Anders Logg wrote:
> >>>>I'm working on a fix. The problem wasn't visible when DOLFIN_NOPLOT
> >>>>was not set.
> >>>This should now be fixed. There might still be some minor issues that
> >>>the buildbot will pick up.
> >>>
> >>>Here's a short summary of what has changed:
> >>>
> >>>1. The refine() function returns a reference to the refined mesh
> >>>instead of return-by-value in C++. The following no longer works:
> >>>
> >>>   mesh = refine(mesh);
> >>>
> >>>Instead, one must do
> >>>
> >>>   Mesh&  refined_mesh = refine(mesh);
>
> How can I copy back the refined mesh into mesh? This does not work for me:
>
>   Mesh& refined_mesh = refine(mesh1);
>   mesh1 = refined_mesh;

This is not allowed since you would overwrite the original mesh by its
own child (which would mess up the child-parent relationships of the
mesh).

Either use refined_mesh, or mesh1.child().

--
Anders


> murtazo
>
> >>>or equivalently
> >>>
> >>>   refine(mesh);
> >>>   Mesh&  refined_mesh = mesh.child();
> >>>
> >>Can get a shared pointer? Otherwise we're in trouble if mesh goes out of
> >>scope.
> >One can use
> >
> >   mesh.parent_shared_ptr()
> >   mesh.child_shared_ptr()
> >
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References