# Cannot voxelize Top :less than 2 boundaries on X

**URL:** <https://root-forum.cern.ch/t/cannot-voxelize-top-less-than-2-boundaries-on-x/47979>\
**Category:** Garfield++\
**Created:** [December 7, 2021, 1:47pm UTC](https://root-forum.cern.ch/t/cannot-voxelize-top-less-than-2-boundaries-on-x/47979 "2021-12-07T13:47:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 7, 2021, 1:47pm UTC](https://root-forum.cern.ch/t/cannot-voxelize-top-less-than-2-boundaries-on-x/47979/1 "2021-12-07T13:47:39Z")

</div>

When I import the Ansys model to the Garfield++, the results show in the below. but the contour plot is empty. the error notice that" Cannot voxelize Top :less than 2 boundaries on X"

```auto
mponentAnsys123::Initialise:
    Read 2235639 elements from file ELIST.lis,
    highest node number: 3236513,
    background elements skipped: 0
ComponentAnsys123::Initialise:
    Read 3236513 nodes from file NLIST.lis.
ComponentAnsys123::Initialise:
    Read 3236513 potentials from file PRNSOL.lis.
ComponentAnsys123::Prepare:
    Caching the bounding boxes of all elements... done.
ComponentAnsys123::InitializeTetrahedralTree: Success.
ComponentAnsys123::PrintRange:
        Dimensions of the elementary block
                 -0.0167044 < x < -0.00670436 cm,
                  0.0172927 < y < 0.0205927 cm,
                 -0.0115321 < z < -0.00353211 cm,
                          0 < V < 1500 V.
        Periodicities
            x: none
            y: none
            z: none
Info in <TGeoManager::TGeoManager>: Geometry ViewFEMeshGeoManager, created
Info in <TGeoManager::SetTopVolume>: Top volume is Top. Master volume is Top
Info in <TGeoNavigator::BuildCache>: --- Maximum geometry depth set to 100
Info in <TGeoManager::CheckGeometry>: Fixing runtime shapes...
Info in <TGeoManager::CheckGeometry>: ...Nothing to fix
Info in <TGeoManager::CloseGeometry>: Counting nodes...
Info in <TGeoManager::Voxelize>: Voxelizing...
Error in <TGeoVoxelFinder::SortAll>: Cannot voxelize Top :less than 2 boundaries on X
Info in <TGeoManager::CloseGeometry>: Building cache...
Info in <TGeoManager::CountLevels>: max level = 1, max placements = 13134
Info in <TGeoManager::CloseGeometry>: 13135 nodes/ 13135 volume UID's in 
Info in <TGeoManager::CloseGeometry>: ----------------modeler ready----------------
Info in <TGeoManager::SetMaxVisNodes>: Automatic visible depth for 13136 visible nodes

```

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [December 9, 2021, 9:09pm UTC](https://root-forum.cern.ch/t/cannot-voxelize-top-less-than-2-boundaries-on-x/47979/2 "2021-12-09T21:09:20Z")

</div>

You’ll find attached a simple program to make a contour plot of the electrostatic potential and the plot that I get using it.

[contours.pdf](https://root-forum.cern.ch/uploads/short-url/tdmiGLS8r4d5yI2XuKpwwBjXCG.pdf) (206.5 KB)  
[test.C](https://root-forum.cern.ch/uploads/short-url/2UuNrCIjfwCYwPXpNQ2wlmFiISF.C) (796 Bytes)

PS: are you sure that “mm” is the right unit for your field map?

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 11, 2021, 2:05am UTC](https://root-forum.cern.ch/t/cannot-voxelize-top-less-than-2-boundaries-on-x/47979/3 "2021-12-11T02:05:55Z")

</div>

Sorry for missing your reply, Thanks a lot for helping me, the files are really helpful. my actual model’s size is mm, so I can chose the mm unit, I will think whether the unit is right in the Garfield++ . thanks a lot for your help again.  
now the mesh view is still empty,but the field view is ok

 ![微信图片_20211211100506](https://root-forum.cern.ch/uploads/default/original/3X/2/7/27f630064b01ddf6c342866646ee1a158d4dde81.png)  
ComponentAnsys123::Initialise:  
Read properties of 2 materials from file MPLIST.lis.  
ComponentAnsys123::Initialise:  
Read 2159067 elements from file ELIST.lis,  
highest node number: 3124105,  
background elements skipped: 0  
ComponentAnsys123::Initialise:  
Read 3124105 nodes from file NLIST.lis.  
ComponentAnsys123::Initialise:  
Read 3124105 potentials from file PRNSOL.lis.  
ComponentAnsys123::Prepare:  
Caching the bounding boxes of all elements… done.  
ComponentAnsys123::InitializeTetrahedralTree: Success.  
ComponentAnsys123::PrintRange:  
Dimensions of the elementary block  
-0.0167044 \< x \< -0.00670436 cm,  
0.0172927 \< y \< 0.0205927 cm,  
-0.0115321 \< z \< -0.00353211 cm,  
0 \< V \< 1500 V.  
Periodicities  
x: none  
y: none  
z: none  
Info in TGeoManager::TGeoManager: Geometry ViewFEMeshGeoManager, created  
Info in TGeoManager::SetTopVolume: Top volume is Top. Master volume is Top  
Info in TGeoNavigator::BuildCache: — Maximum geometry depth set to 100  
Info in TGeoManager::CheckGeometry: Fixing runtime shapes…  
Info in TGeoManager::CheckGeometry: …Nothing to fix  
Info in TGeoManager::CloseGeometry: Counting nodes…  
Info in TGeoManager::Voxelize: Voxelizing…  
Error in TGeoVoxelFinder::SortAll: Cannot voxelize Top :less than 2 boundaries on X  
Info in TGeoManager::CloseGeometry: Building cache…  
Info in TGeoManager::CountLevels: max level = 1, max placements = 10437  
Info in TGeoManager::CloseGeometry: 10438 nodes/ 10438 volume UID’s in  
Info in TGeoManager::CloseGeometry: ----------------modeler ready----------------

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 11, 2021, 7:39am UTC](https://root-forum.cern.ch/t/cannot-voxelize-top-less-than-2-boundaries-on-x/47979/4 "2021-12-11T07:39:36Z")

</div>

Hi,  
I have got the 2D model plot, that’s shown in the below, and it is a little bit strange, the plot seems too coarse. and how can I change the black color to some other color?  
my code is"  
meshview.setcolor( 1, kyellow);  
meshview.setcolor( 2, kpink +6);

Thanks a lot for helping me, although these are trivial problem, but it seems hard to me, and these may spend me several days to solve. So without your help, I can’t proceed so fast. Thanks again.

 ![plot](https://root-forum.cern.ch/uploads/default/original/3X/4/f/4f04237c2782373b67a5c3f65480f82305fcf5be.png)

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 11, 2021, 7:40am UTC](https://root-forum.cern.ch/t/cannot-voxelize-top-less-than-2-boundaries-on-x/47979/5 "2021-12-11T07:40:52Z")

</div>

Hi,  
I just forget to say, I still want to get the three dimensional model plot, and I really don’t know why it is still empty, would you please tell me?

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 11, 2021, 8:09am UTC](https://root-forum.cern.ch/t/cannot-voxelize-top-less-than-2-boundaries-on-x/47979/6 "2021-12-11T08:09:42Z")

</div>

Hi,  
I want to try the private member function ,but the errors notice that this is a private member function,and used in a wrong way. would you please tell me how to use these private member functions especially the DrawElements 3d() function?  
 ![image](https://root-forum.cern.ch/uploads/default/original/3X/4/5/455b45926574758d69981735e3154d24dc566337.png)

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [December 12, 2021, 9:51am UTC](https://root-forum.cern.ch/t/cannot-voxelize-top-less-than-2-boundaries-on-x/47979/7 "2021-12-12T09:51:02Z")

</div>

Apologies for my late reply.

The empty 3D mesh plot was due to a bug in the `ViewFEMesh` class. Sorry for that (it’s a feature that was introduced only quite recently). It should be fixed now:

> **[Fix bug in calculation of world volume dimensions; take bounding box... (!265)...](https://gitlab.cern.ch/garfield/garfieldpp/-/merge_requests/265)**
>
> Fix bug in calculation of world volume dimensions; take bounding box coordinates from field map if not set explicitly by the user.

Can you update to the HEAD version of the master branch (`git pull`), re-build the project (re-run `make; make install`) and try again?

After updating, you should be able to get a plot like the one attached with these lines of code:

```auto
ViewFEMesh meshView;
meshView.SetComponent(&fm);
meshView.SetColor(1, kGreen + 2);
meshView.Plot(false)

```

In the canvas, click on “View” → “View With” → “OpenGL”.

 ![viewer](https://root-forum.cern.ch/uploads/default/original/3X/a/8/a81971727aa8dc7fad251aaac77147582c11f724.jpeg)  
 ![Screenshot](https://root-forum.cern.ch/uploads/default/original/3X/a/f/af4dbf365339148749c2cbb55b303ff3ab16ac93.png)

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [December 12, 2021, 10:11am UTC](https://root-forum.cern.ch/t/cannot-voxelize-top-less-than-2-boundaries-on-x/47979/8 "2021-12-12T10:11:14Z")

</div>

```auto
ViewFEMesh meshView;
meshView.SetComponent(&fm);
meshView.SetFillMeshWithBorders();
meshView.SetPlane(0, -1, 0, 0., 0.5 * (y0 + y1), 0.);
meshView.SetColor(0, kPink + 6);
meshView.SetColor(1, kYellow);
meshView.Plot();

```

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 13, 2021, 3:35am UTC](https://root-forum.cern.ch/t/cannot-voxelize-top-less-than-2-boundaries-on-x/47979/9 "2021-12-13T03:35:11Z")

</div>

Hi,  
Wow, Thanks a lot for helping me to solve the problem. Now I have updated to the HEAD version of the master branch (`git pull` ), re-builded the project (re-run `make; make install` ) and tried again. And it works. However there are something confused me.

 ![model](https://root-forum.cern.ch/uploads/default/original/3X/7/8/78d7fcedd277b8ec4e64b3ba6986082fea996b3b.png)  
 ![model 2](https://root-forum.cern.ch/uploads/default/original/3X/5/1/51daa14227e7a0650e0efd28962bc3b953130a1b.png)  
The 3D model plot seems vague, I can’t distinguish neither the model shape nor the number of them.  
And it just can rotate around a axis, and can’t move as I wish, when I amplify the second plot, it just disappeared,I need to zoom in on a clear picture.  
Would you please help me again? Thanks a lot.

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [December 13, 2021, 6:14am UTC](https://root-forum.cern.ch/t/cannot-voxelize-top-less-than-2-boundaries-on-x/47979/10 "2021-12-13T06:14:02Z")

</div>

You can find some information about the GL viewer here:  
[https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html#the-gl-viewer](https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html#the-gl-viewer)

The reason the plot looks somewhat fuzzy is that the shapes are drawn filled, with 70% transparency. Unfortunately the transparency setting is hard-coded in `ViewFEMesh` at the moment ([Source/ViewFEMesh.cc · master · garfield / garfieldpp](https://gitlab.cern.ch/garfield/garfieldpp/-/blob/master/Source/ViewFEMesh.cc#L615), if you want to change it). I should add a function to make it configurable.

Maybe try to draw the mesh as a wireframe (type ‘w’ after opening the GL viewer)…

 ![wireframe](https://root-forum.cern.ch/uploads/default/original/3X/e/4/e4c0ce289fe2ca59ff64c9572ab8de10f2296943.jpeg)

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [December 27, 2021, 6:14am UTC](https://root-forum.cern.ch/t/cannot-voxelize-top-less-than-2-boundaries-on-x/47979/11 "2021-12-27T06:14:34Z")

</div>

Closed on December 27, 2021, 6:14am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
