← 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 13:45:28 Marie E. Rognes wrote:
> On 08/29/11 22:41, Johan Hake wrote:
> > 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()
> 
> Definitely! Briliant, thanks, I was looking for something like this.
> 
> Just checking: is it possible to just ignore and rename some of the
> Hierarchical::fine's?
> for instance Hierarchical<Function>::fine but not Hierarchical<Mesh>::fine?

You can change back the rename change you did in common_pre.i. Then you 
overload the methods in Function, the same as you have done already. Remember 
that you then need to change:

  f = self._fine()

to:

  f = HierarchicalFunction.fine(self)

Cheers!

Johan

> --
> Marie
> 
> > ...
> > 
> > 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-n
> > a
> > 
> > > 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-subscriptio
> > > n
> > 
> > _______________________________________________
> > 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