# Tips and tricks category

**URL:** https://discourse.vtk.org/t/tips-and-tricks-category/4644
**Category:** Site Feedback
**Created:** [November 12, 2020, 1:47pm UTC](https://discourse.vtk.org/t/tips-and-tricks-category/4644 "2020-11-12T13:47:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 12, 2020, 1:47pm UTC](https://discourse.vtk.org/t/tips-and-tricks-category/4644/1 "2020-11-12T13:47:30Z")

</div>

It would be nice to have a place to host all tricks, hacks, best practices and maybe even dark arts type shenanigans possible in VTK C++. Very much like the one at [discourse.paraview.org](https://discourse.paraview.org/c/tips-and-tricks/9)

I’d envision it to contain code snippets/methodologies targeted to intermediate/advanced C++ developers new to VTK.

Some trivial but greatly helpful stuff I can think of when writing this post,

1. Get pointer access to cell structure (w/o invoking a copy)
2. Invoke `CopyStructure` on `vtkDataSet`s when possible. (I didn’t know this existed until I poked around VTK’s source)
3. Thread-safe cell traversal
4. Thread-safe point retrieval
5. Best practices - filter development
6. Usage of `SafeDownCast` to develop generic apps (vtkAlgorithm/vtkXMLUnstructuredDataReader derived)
7. Similar… `FastDownCast` for `vtkDataArray` when the data type is known.

I’m sure there are many more in the rendering side of things. Ideally, these posts could be limited to the core C++ VTK library and avoid general C++, wrappers to VTK

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [November 13, 2020, 2:31pm UTC](https://discourse.vtk.org/t/tips-and-tricks-category/4644/2 "2020-11-13T14:31:36Z")

</div>

Tricks, hacks, and best practices tend to be quite specific and may even contain code snippets and so they all change as VTK evolves.

I like discourse very much and it has awesome convenience features that would be useful for creating a tips&tricks collection (e.g., direct copy-paste of images), but long-term sustainability would require versioning of the content, which discourse cannot do.

A git repository that mirrors VTK repository’s versioning (or the VTK repository itself) would be a more suitable home of such knowledge base in the long term.

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [November 13, 2020, 2:40pm UTC](https://discourse.vtk.org/t/tips-and-tricks-category/4644/3 "2020-11-13T14:40:57Z")

</div>

Yes. Apart from that, a clear distinction must exist as to what classifies under this category versus the VTK Examples. The line b/w the two should not be crossed as that defeats the purpose.
