<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Aug 8, 2018 at 4:39 AM, Дмитрий Бабков <span dir="ltr"><<a href="mailto:dsbabkov@gmail.com" target="_blank">dsbabkov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Allie, thank you very much!<br><div>I don't believe, that I missed points data. I was sure, that it was used in Implementation class.</div><div>Now I am able to run UGrid example on mapped grid. There was one more issue: I had to call Allocate for vtkIdList *ptIds in GetCellPoints method. Otherwise I can see corrupted elements. I don't know is it normal to VTK preallocate list or it's just mapped grid class issue.</div></div></blockquote><div><br></div><div>In the original implementation of GetCellPoints, you had:</div><div><br></div><div><div> const Element &element = elements[cellId];</div><div> for (vtkIdType i = 0; i < element.pointsCount; ++i) {</div><div> ptIds->InsertNextId(element.points[i]);</div><div> }<br><br>The issue here is that calling InsertNextId always appends to the ptIds, without clear old data first. So the list will always keep growing. Many algorithms reuse the same vtkIdList object in repeated calls to GetPointIds, since the memory can often be reused without reallocating. In this case, you'll definitely see incorrect results.<br><br>As you mentioned, resizing the list and setting elements explicitly by index would fix this. Class methods in VTK are expected to manually set the size of these containers prior to filling them.</div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I have no idea which classes VTK should I use for better performance and RAM consumption in my project, because I have no experience with VTK</div><div>Let me tell you some features of project:</div><div> - Goal of project is to display loaded from custom or known format FEM tetra mesh, modify it and save to custom format</div><div> - There are element/face/node selectors, sections constructed with user planes, display feature angles (edges).</div><div> - Each face of element has it color from global list of ~100 colors.</div><div> - Elements grouped in collectors and visible of collectors can be toggled.</div><div> - It will not be run on HPC node, I think</div><div><br></div><div>Memory consumption of application now is about 2-3Gb if i load ~10M elements.</div><div>The reason of taking mapped grid was usage of VTK rendering and, maybe, VTK algorithms without significant additional RAM consumption.</div><div>Will it be reasonable to build my own vtkPolyData for each type of objects (mesh, sections, selected elements/faces/nodes)? It seems VTK algorithms can work better than mine and with less issues. Also it seems It will take less time.</div></div></blockquote><div><br>The mapped unstructured grid was originally intended to be used in a workflow such as:<br><br>1) Generate large dataset in a native format<br>2) Create MappedUnstructuredGrid wrapper around native data<br>3) Use a VTK algorithm to massively reduce the data (extract faces, threshold, clip, etc)</div><div>4) Create a renderable vtkPolyData of the reduced dataset that will fit in memory<br><br>as opposed to creating a large in-memory copy of the complete dataset in step two.<br><br>If you plan to use a simple pipeline, or a filter that converts to a different dataset type early in the pipeline, you should be fine with the mapped unstructured grid. The only caution is that not all filters that work on vtkUnstructuredGrid will work with vtkMappedUnstructuredGrid, though many will.<br><br>It makes sense that you want to let VTK handle the conversion of the dataset to a renderable form. In this case, I'd say try using the mapped grid and see if it works for you on the filters you wish to use. But if you run into to trouble, you may need to update a troublesome filter to work on a vtkUnstructuredGridBase instead of vtkUnstructuredGrid, or switch to using vtkUnstructuredGrid directly instead of a vtkMappedUnstructuredGrid.<br><br></div><div>Allie</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">вт, 7 авг. 2018 г. в 20:19, Allie Vacanti <<a href="mailto:allison.vacanti@kitware.com" target="_blank">allison.vacanti@kitware.com</a>>:<br></div><div><div class="gmail-h5"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">The rendering engine is shortcircuiting because the dataset has no coordinate information (the `x` array is never used by the mapped grid implementation -- `mesh->GetPoints()` is returning nullptr). Adding `mesh->SetPoints(points);` to the test script will complete the dataset and let the renderer progress.<br><br>Be warned, however, that the mapped unstructured grid stuff is not widely used and there may be some further issues lurking as you go farther with it. They may be a need to debug/patch VTK itself if you want to use it.<br><br>I should also point out that the mapped unstructured grid is not used directly in the rendering -- it is first converted to a `vtkPolyData` by a `vtkDataSetSurfaceFilter` inside of the `vtkDataSetMapper`. If you encounter a lot of issues with the mapped grid, you may find it easier to just build a `vtkPolyData` directly from your application's data. The mapped grids were intended to be used on extremely large simulation datasets that could not be physically copied without running out of memory on an HPC node -- if that's not your usecase, directly building the `vtkPolyData` will likely save you a lot of hassle.<br><br>HTH,<br>Allie</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 7, 2018 at 1:45 AM, dsbabkov <span dir="ltr"><<a href="mailto:dsbabkov@gmail.com" target="_blank">dsbabkov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello, everyone!<br>
I'm new to VTK and would like to use it in my project instead of my own<br>
OpenGL rendering system;<br>
I think, I need to keep data structures as it is and it seems I have to use<br>
vtkMappedUnstructuredGrid class.<br>
I found an example UGrid, which demonstrates, how to work with<br>
vtkUnstructuredGrid.<br>
To examine vtkMappedUnstructuredGrid I decided to modify this example. I<br>
have implemented required by manual Implementation class methods and<br>
replaced usage of vtkUnstructuredGrid to vtkMappedUnstructuredGrid with my<br>
Implementation. But nothing is displayed... I was trying to set breakpoints<br>
to vtkMappedUnstructuredGrid template methods to understand, what I have<br>
missed, but it seems no methods called to request data information. Only<br>
constructor, destructor and GetMTime, which seems not required to be<br>
implemented in Implementation class. <br>
Here is my c++ code: main.cpp<br>
<<a href="http://vtk.1045678.n5.nabble.com/file/t342524/main.cpp" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.<wbr>com/file/t342524/main.cpp</a>> <br>
And CMake project file: CMakeLists.txt<br>
<<a href="http://vtk.1045678.n5.nabble.com/file/t342524/CMakeLists.txt" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.<wbr>com/file/t342524/CMakeLists.<wbr>txt</a>> <br>
Please, help me to understand this template class and find my fault.<br>
My OS is arch linux and VTK vtk-8.1.0 installed.<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.<wbr>com/VTK-Users-f1224199.html</a><br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>
</blockquote></div></div></div></div>
</blockquote></div><br></div></div>