<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi, <br>
</p>
<p>I have a stress field saved as a h5 file that I read using an xdmf file.<br>
The stress is defined as a symmetric tensor XX, YY, XZ and in so is interpreted as a vector with X, Y, Z components.</p>
<p>I would like to visualize the tensors using paraview TensorGlyphs which expects a symmetric tensor with the order XX. YY, ZZ, XY, YZ, XZ.</p>
<p>I tried to apply a programmable to my dataset but without luck...</p>
<p>Here is what I have done: </p>
<pre style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier'; font-weight:600; color:#008000;">import</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; font-weight:600; color:#0000ff;">numpy</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; font-weight:600; color:#008000;">as</span><span style=" font-family:'Courier New,courier';"> </span><span style=" font-family:'Courier New,courier'; font-weight:600; color:#0000ff;">np</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier'; font-weight:600; color:#0000ff;">
</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">data </span><span style=" font-family:'Courier New,courier'; color:#666666;">=</span><span style=" font-family:'Courier New,courier';"> np</span><span style=" font-family:'Courier New,courier'; color:#666666;">.</span><span style=" font-family:'Courier New,courier';">zeros((inputs[</span><span style=" font-family:'Courier New,courier'; color:#666666;">0</span><span style=" font-family:'Courier New,courier';">]</span><span style=" font-family:'Courier New,courier'; color:#666666;">.</span><span style=" font-family:'Courier New,courier';">PointData[</span><span style=" font-family:'Courier New,courier'; color:#ba2121;">"projStressField"</span><span style=" font-family:'Courier New,courier';">][</span><span style=" font-family:'Courier New,courier'; color:#666666;">0</span><span style=" font-family:'Courier New,courier';">]</span><span style=" font-family:'Courier New,courier'; color:#666666;">.</span><span style=" font-family:'Courier New,courier';">size, </span><span style=" font-family:'Courier New,courier'; color:#666666;">6</span><span style=" font-family:'Courier New,courier';">))</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';">
</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">data[:,</span><span style=" font-family:'Courier New,courier'; color:#666666;">0</span><span style=" font-family:'Courier New,courier';">] </span><span style=" font-family:'Courier New,courier'; color:#666666;">=</span><span style=" font-family:'Courier New,courier';"> inputs[</span><span style=" font-family:'Courier New,courier'; color:#666666;">0</span><span style=" font-family:'Courier New,courier';">]</span><span style=" font-family:'Courier New,courier'; color:#666666;">.</span><span style=" font-family:'Courier New,courier';">PointData[</span><span style=" font-family:'Courier New,courier'; color:#ba2121;">"projStressField"</span><span style=" font-family:'Courier New,courier';">][</span><span style=" font-family:'Courier New,courier'; color:#666666;">0</span><span style=" font-family:'Courier New,courier';">] # XX</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">data[:,</span><span style=" font-family:'Courier New,courier'; color:#666666;">1</span><span style=" font-family:'Courier New,courier';">] </span><span style=" font-family:'Courier New,courier'; color:#666666;">=</span><span style=" font-family:'Courier New,courier';"> inputs[</span><span style=" font-family:'Courier New,courier'; color:#666666;">0</span><span style=" font-family:'Courier New,courier';">]</span><span style=" font-family:'Courier New,courier'; color:#666666;">.</span><span style=" font-family:'Courier New,courier';">PointData[</span><span style=" font-family:'Courier New,courier'; color:#ba2121;">"projStressField"</span><span style=" font-family:'Courier New,courier';">][</span><span style=" font-family:'Courier New,courier'; color:#666666;">1</span><span style=" font-family:'Courier New,courier';">] # YY</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">data[:,</span><span style=" font-family:'Courier New,courier'; color:#666666;">3</span><span style=" font-family:'Courier New,courier';">] </span><span style=" font-family:'Courier New,courier'; color:#666666;">=</span><span style=" font-family:'Courier New,courier';"> inputs[</span><span style=" font-family:'Courier New,courier'; color:#666666;">0</span><span style=" font-family:'Courier New,courier';">]</span><span style=" font-family:'Courier New,courier'; color:#666666;">.</span><span style=" font-family:'Courier New,courier';">PointData[</span><span style=" font-family:'Courier New,courier'; color:#ba2121;">"projStressField"</span><span style=" font-family:'Courier New,courier';">][</span><span style=" font-family:'Courier New,courier'; color:#666666;">2</span><span style=" font-family:'Courier New,courier';">] # XY</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';">
</pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';">
</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';">output</span><span style=" font-family:'Courier New,courier'; color:#666666;">.</span><span style=" font-family:'Courier New,courier';">PointData</span><span style=" font-family:'Courier New,courier'; color:#666666;">.</span><span style=" font-family:'Courier New,courier';">append(data</span><span style=" font-family:'Courier New,courier';">, </span><span style=" font-family:'Courier New,courier'; color:#ba2121;">"Stress Tensor"</span><span style=" font-family:'Courier New,courier';">)

</span><span style=" font-family:'Courier New,courier';"></span>
</pre>
I suspect the shape of my numpy array is wrong... I do get a new variable called "Stress Tensor" but it has components 1..17...<br>
<br>
<br>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"></span><span style=" font-family:'Courier New,courier';">
</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';">I had a look at <a class="moz-txt-link-freetext" href="https://www.paraview.org/pipermail/paraview/2017-November/041497.html">https://www.paraview.org/pipermail/paraview/2017-November/041497.html</a>
did not really helped...

<font color="#094183"><font size="2"><i>Romain</i></font></font>
</pre>
</body>
</html>