← Back to team overview

dolfin team mailing list archive

Re: normalized vectors; got SIGSEGV

 

On Mon, Jul 24, 2006 at 06:56:32PM +0200, Dag Lindbo wrote:
> Hi all,
> 
> The Function class is causing some headaches for me, as I try to
> normalize 2-vectors on my mesh. I have a form that defines the
> computation of a gradient, so in my solver i have a vactor-values
> function, normal_phi (whose components are the gradient vectors at each
> vertex). So far it's OK. Now I loop over all vertices and manually
> normalize each vector in normal_phi. This works too.
> 
> But then the function, normal_phi, goes into a another form, as a
> Function("vector-element"). Upon this call I get a sig11: Segmentation
> Violation. If I do no normalization I get no violation! So I wonder what
> has happened. The code is very short, so I hope someone could look at
> it:
> 
> 
> unsigned int Nv = FEM::size(mesh, element);
> (...)
> grad_pde.solve(norml_phi); //When I write norml_phi[0] and norml_phi[1]
> to file they look great
> Function grad_phi = norml_phi[0];	  
> Vector& norml = grad_phi.vector();
> 
> for(VertexIterator vertex(mesh); !vertex.end(); ++vertex)
>  {
>   unsigned int vid = vertex->id();
>   real gpx = norml( vid );
>   real gpy = norml( vid + Nv);
>   real p = std::sqrt( gpx*gpx+gpy*gpy );
> 
>   norml( vid ) = gpx/p;
>   norml( vid + Nv) = gpy/p;
>  }
> 
> norml_phi.attach(norml); // I write to VTK-file here and it looks
> perfect
> (...)
> 
> kappa_pde.solve(kappa); // < SIG 11
> 
> 
> 
> Best regards,
> Dag Lindbo
> 
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev

Just back from my vacation...

Did you solve this or is this still a problem?

/Anders


Follow ups

References