Space elements order through numpy

More
2 years 2 weeks ago - 2 years 2 weeks ago #4529 by alecontri
Hi,

   I was doing a convergence test, feeding the elements of a numpy array as the parameter "order" in the space definition. I noticed that no matter the number I was giving, the convergence was as if order = 1. This is a simple example where I show the order before and after the space definition:

Code:
import numpy as np from ngsolve import * from netgen.geom2d import unit_square from netgen.geom2d import SplineGeometry geo = SplineGeometry() geo.AddRectangle( (0, 0), (1, 1), bcs = ("bottom", "right", "top", "left")) mesh = Mesh(unit_square.GenerateMesh(maxh=0.1)) mesh.Curve(1) order_n = np.array([4]) print(order_n[0]) V = H1(mesh, order=order_n[0], dirichlet="bottom|right|left|top") print(V.globalorder)


Is it a bug or is it supposed to be like this (of course writing
Code:
order=int(order_n[0])
solved the problem)?

Thanks a lot
Last edit: 2 years 2 weeks ago by alecontri.
More
2 years 2 weeks ago #4532 by christopher
Hm yes, we expect an int python type here and numpy gives a numpy.int64... But asking for all the possible types would also be too much in the code... I think we have to stick here to convert the parameter to int.
The following user(s) said Thank You: alecontri
Time to create page: 0.101 seconds