← Back to team overview

dolfin team mailing list archive

Re: [Branch ~dolfin-core/dolfin/rognes] Rev 6161: Redefine fine() in function_post.i.

 

On Monday August 29 2011 05:54:29 noreply@xxxxxxxxxxxxx wrote:
> ------------------------------------------------------------
> revno: 6161
> committer: Marie E. Rognes <meg@xxxxxxxxx>
> branch nick: rognes
> timestamp: Mon 2011-08-29 14:52:00 +0200
> message:
>   Redefine fine() in function_post.i.
> 
>   Johan: does this look ok? Will add coarse/child/parent for Function
>   too if yes.
> modified:

Yes I think this is the correct way to do it. Maybe you can add a copy method 
which did the conversion? It might come handy some other time!

  def copy(self, deepcopy=False):
      "Return a dolfin.Function of itself"
      from dolfin.functions.function import Function
      if deepcopy:
          return Function(self.function_space(), self.vector().copy())
      return Function(self.function_space(), self.vector())

and then from each of the hierarchy methods:

  def fine(self):
      "Return the finest Function in hierarchy"
      f = self._fine()
      return f.copy()

  def child(self):
      "Return the childiest Function in hierarchy"
      f = self._child()
      return f.copy()

...

I like the way the shared_ptr interface makes it possible to not copy data :)

Johan
  
> demo/undocumented/auto-adaptive-navier-stokes/python/demo_auto-adaptive-na
> vier-stokes.py dolfin/swig/common_pre.i
>   dolfin/swig/docstrings.i
>   dolfin/swig/function_post.i
> 
> 
> --
> lp:~dolfin-core/dolfin/rognes
> https://code.launchpad.net/~dolfin-core/dolfin/rognes
> 
> Your team DOLFIN Core Team is subscribed to branch
> lp:~dolfin-core/dolfin/rognes. To unsubscribe from this branch go to
> https://code.launchpad.net/~dolfin-core/dolfin/rognes/+edit-subscription

Follow ups