Azzera filtri
Azzera filtri

Visualizations of finite element calculations too slow?

4 visualizzazioni (ultimi 30 giorni)
I have a vectorized finite elements code for my study problems in mechanics, I am very happy with. It computes several fields on two dimensional uniform rectangular mesh and where each of these fields is constant on every rectangle. Typical result of my computation is displayed on the picture available at link.
The computation itself takes few seconds on meshes with 100.000 elements which is absolutely satisfactory (here I finally :) learnt how to vectorize a finite element code). However, my visualizations is much slower as the following profiler information shows:
time calls line
1 function visualize_constant(elements,coordinates,constant_function)
12 2 ne=size(elements,1);
3
0.03 12 4 X=reshape(coordinates(elements,1),ne,4);
0.02 12 5 Y=reshape(coordinates(elements,2),ne,4);
0.02 12 6 Z=kron(ones(1,4),constant_function);
7
0.02 12 8 X=X';
< 0.01 12 9 Y=Y';
< 0.01 12 10 Z=Z';
11
55.69 12 12 fill3(X,Y,Z,Z);
13
9.14 12 14 xlabel('x'); ylabel('y');
73.62 12 15 axis tight;
41.08 12 16 colorbar;
43.13 12 17 shading flat
1.17 12 18 view(2); %view(-70.5,30);
12 19 end
The command fill3 takes long time. Is this really needed? What even surprises me more are other very time demanding commands such as colorbar, axis tight, shading flat. Is there perhaps any way to at least reorder these commands to achieve higher performance?
Thank you in advance for your possible suggestions. Jan.

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by