On 23.06.2015 18:59, Andreas Kloeckner wrote:
Dmitry Grebennikov <dmitry.ew(a)gmail.com>
Could you please explain what is the content of mesh.element_volumes?
I tried to get the values of it with:
1) for i in mesh.element_volumes:
but received Traceback:
File "<stdin>", line 1, in <module>
RuntimeError: Array unallocated
What is the reason of such behavior?
element_volumes is not allocated by default
(since it is not needed in
the default case). Calling element_volumes.setup() should do that for
I've just tried to call:
volumes = np.array(mesh.element_volumes)
array([ 6.92455981e-310, 6.92455981e-310, 6.92456161e-310, ...,
1.97626258e-323, 0.00000000e+000, 0.00000000e+000])
So there are near-zero values, and it doesn't correspond to the actual
volumes of tetrahedra of mine mesh.
Doing something wrong again?
.setup() only allocates the memory, so these are garbage values that
just happened to be sitting where the array got allocated. If you're
intending to use .element_volumes as input to a mesh generator (such as
for volume constraints), figure out what flags to pass to the generator
and fill the array yourself. If you're wanting element volumes
calculated for you, again, figure out what flag tells the mesh generator
to do that for you, and then this array should be filled on return from