Thread Previous • Date Previous • Date Next • Thread Next |
Alessio Quaglino wrote:
Ok very simple thanks (I thought it might have been dependent to the finite element shape). I still have one question about the new Funcion interface. When I define a User-defined Function, only eval() is used for the FEM assembly?
Yes, and note that there are two versions, one for general tensor-valued functions and a simple one for scalar functions. You can choose to overload any of these.
I ask this because I have some problems in understanding if overloading this method is enough in order to define a source term.
Yes, that should be enough.
Also this method is defined as const, hence if this happens to be the case, I have to redisign a part of my source class. Thanks.
Yes, it needs to be const. If your class needs to modify some data, then make the data mutable.
/Anders
AlessioJust do the following: Mesh mesh; Function f; real* vertex_values = new real[mesh.numVertices()]; f.interpolate(vertex_values); Then vertex_values will be an array with the values at all vertices. For a scalar function, you simply get all the vertex values and for a vector (or in general tensor-valued) function, you first get all the values for component 0, then all values for component 1 etc. /Anders Alessio Quaglino wrote:On Tue, Jun 26, 2007 at 02:56:52PM +0200, Alessio Quaglino wrote:I'm trying to get my code working with the new dolfin 0.7.0-1 but it seems there are a several problems. For example, a part of the dolfin::Function interface has disappeared. In particular, it is not possible to get the value corresponding to a vertex or the finite element space where the function is living. Have these functionalities been moved somewhere else? Regards, Alessio QuaglinoUse Function::interpolate() to access the values. Often, one can avoid ever needing to access the values directly, but if they should be needed, then it is possible to either interpolate the Function to a given Cell (getting the expansion coefficients in the local finite element basis) or get the values at all vertices. So, try to avoid accessing the values but if you really need the values at vertices you can still get them. /Anders _______________________________________________ DOLFIN-dev mailing list DOLFIN-dev@xxxxxxxxxx http://www.fenics.org/mailman/listinfo/dolfin-devOk I see, however with interpolate() I can either get all the Vertex values or the values at a given Cell. While the latter case is unefficient for my purpose because I'd pass through the same Vertex several times, in the former I get a vector with the values at all vertices but no information about how to access such a vector. Regards, Alessio _______________________________________________ DOLFIN-dev mailing list DOLFIN-dev@xxxxxxxxxx http://www.fenics.org/mailman/listinfo/dolfin-dev_______________________________________________ DOLFIN-dev mailing list DOLFIN-dev@xxxxxxxxxx http://www.fenics.org/mailman/listinfo/dolfin-dev
Thread Previous • Date Previous • Date Next • Thread Next |