Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The integration of MESHIT into PZERO. #137

Open
waqashussain117 opened this issue Feb 27, 2025 · 10 comments
Open

The integration of MESHIT into PZERO. #137

waqashussain117 opened this issue Feb 27, 2025 · 10 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@waqashussain117
Copy link
Collaborator

How to integrate?
Both PZero and Meshit have same Core Data structures i.e., something in the form of x,y,z. MESHIT input it can take is as an x, y, z file like csv file, and on the other hand PZERO, have numpy arrays in the form x,y,z that we can use.

Step1:
We need to make a file that would be named as mesh_integration.py, it would include these steps:

1- Gather PZERO data from geo-collections in the form of x, y, z.
2- Convert them into suitable format that a meshit would expect like x, y, z
3- Call MESHIT (Both stages, pre mesh and meshit) using a wrapper instead of writing the whole code.
For this specific purpose we can use pybind11 which wraps C++ code, that we can access
4. Bring back results that can be viewed in PZERO may be in VTK

Main thing no need to write the whole code, just wrapping it like a package would save us more time and preserve the functionality of meshit more efficiently.

@waqashussain117 waqashussain117 added documentation Improvements or additions to documentation enhancement New feature or request labels Feb 27, 2025
@andrea-bistacchi
Copy link
Collaborator

Hi, according to some discussion with @mcacace, at some point interactive selection and editing of different elements of the piecewise linear complex (PLC) is needed. For this the PZero GUI would be useful, so we need to understand if (i) this is compatible with the strategy outlined above, or (ii) we need to use a divide and conquer approach, splitting the MeshIt workflow in smaller processes in order to make them compatible with the PZero GUI.

@andrea-bistacchi
Copy link
Collaborator

Side note: we are working with @r-monti14 on surface normals. Would this be useful? I guess it could be important for triangulation with triangle.

@andrea-bistacchi
Copy link
Collaborator

One more side note: triangle performs 2.5D Delaunay tessellation, thus truly 3D geometries like refolded folds cannot be meshed. We will obviously start with triangle but we can start evaluating alternatives. For instance in PZero we already have Poisson interpolation/tessellation that, using also surface normals, works for truly 3D surfaces.

@waqashussain117
Copy link
Collaborator Author

I guess we will get to the stage. At the moment, I have successfully bind meshit functions into python and testing the code if it works normally, then we will proceed to the next stage. For PLC and other parameters, just like Loop Structural a dedicated GUI would be nice to have all the constraints for processing.

@andrea-bistacchi
Copy link
Collaborator

Great!

@mcacace
Copy link
Collaborator

mcacace commented Mar 3, 2025

One more side note: triangle performs 2.5D Delaunay tessellation, thus truly 3D geometries like refolded folds cannot be meshed. We will obviously start with triangle but we can start evaluating alternatives. For instance in PZero we already have Poisson interpolation/tessellation that, using also surface normals, works for truly 3D surfaces.

Interesting! I would need to get myself educated a bit more, but if that might help to overcome current limitations of surface reconstruction implemented in MeshIT that would be a really big step. This said, I agree with @waqashussain117 I also think that the best for him would be to define all calls and test the interface/integration without adding any variations in MeshIT and after testing that we can move forward. As a matter of fact, @waqashussain117 is single-handling each calls so we can easily mix/change/modify each single step. I will discuss it in details with @waqashussain117 once back to office on Wednesday.

Greetings from Bergen,
Mauro

@andrea-bistacchi
Copy link
Collaborator

Great to know you are making progress!

@waqashussain117
Copy link
Collaborator Author

The idea would be to make meshit-python package more easily installed and for this reason, I am testing meshit as python package on https://test.pypi.org/project/meshit/0.1.0/. Now we can just install meshit using pip install meshit or through conda environment, at the moment you can generate points and surface using meshit through python. I am adding more functions through pybind and then we will have complete package soon. The idea is very simple, use pybind at the beginning and end of each c++ file, convert it to meshit-python, add a setup file. build it and then release the package on github and then on pypi upload it. In this way, meshit can be easily accessed for python users in future and can be very well integrated into pzero, just like vtk and other c++ code.

https://github.com/[waqashussain117/meshit](https://github.com/waqashussain117/meshit)

@mcacace
Copy link
Collaborator

mcacace commented Mar 4, 2025

That's nice plan @waqashussain117. I like ti idea, since it would ease integration of new feature not only via python and PZero but also on top of the existing c++ MeshIt environment. Excellent!

@andrea-bistacchi
Copy link
Collaborator

Hi, looks really cool!

We can add PIP modules to our conda environment - we just have to add them at the end of the list.

If you could manage to create a conda module, that will be even easier!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants