On Mon, 09 Mar 2015 19:35:36 +0100 simone <[email protected]> wrote:
> > > > -------- Forwarded Message -------- > Subject: cannot modify anymore .vector() attribute of > Function objects Date: Tue, 03 Feb 2015 18:54:38 +0100 > From: simone <[email protected]> > To: [email protected] > > > > Good evening, > i've had a problem after last fenics update. > > Q=Function(V0) > for i in range(n): > > current_Q_value=numpy.zeros(i+1) > disp[i].mark(domains,i) > if i>0: > current_Q_value[i]=Q_values[i] > help = numpy.asarray(domains.array(), dtype=numpy.int32) > current_Q_value_array=numpy.asarray(current_Q_value) > Q.vector()[:] += numpy.choose(help, > current_Q_value_array) > > is the code that run with no problem before the update, but now it > gives me MemoryError, even if the RAM is still empty and the stack > memory limit is not reached. We would need a minimal working example to reproduce it. > In addiction, if I try to comment this part of the code, i receive > another error from another similar instruction: > > for i in range(len(primal.domain.array())): > i_domain=primal.domain.array()[i] > if i_domain==i_omega: > residual.vector()[i]=T_function.vector()[i]-t_a_function.vector()[i] > > TypeError: provide a scalar to set single item > > where residual, T_function, t_a_function are all functions defined on > the same space. > > I need to sum Functions, until last update i do it element by element, > but now this syntax doesn't work. > Could you explain me what has been modified please? I cannot find an > alternative syntax in python. Relevant changes were introduced by https://bitbucket.org/fenics-project/dolfin/pull-request/192 and discussed in http://fenicsproject.org/pipermail/fenics/2014-December/002221.html. You should find there which operations are now supported. The snippet residual.vector()[index] = scalar should work. If it does not, maybe type recognition/casting of index and/or scalar does not work in this case. Again we would need minimal example to track it down. But note, that usually there is a way to avoid fiddling with DOFs and I'd suggest you ask at http://fenicsproject.org/qa. Jan > Thank you for support. > Best regards > > > _______________________________________________ fenics-support mailing list [email protected] http://fenicsproject.org/mailman/listinfo/fenics-support
