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

Levelset values on vertices of volOctree #467

Open
gitg0n opened this issue May 27, 2024 · 2 comments
Open

Levelset values on vertices of volOctree #467

gitg0n opened this issue May 27, 2024 · 2 comments

Comments

@gitg0n
Copy link

gitg0n commented May 27, 2024

Good evening

Is it somehow possible to calculate accurate levelset values on the vertices of a volOctree instead of the cell centers?

I'm currently calculating cell values for the levelset (based on a STL geometry) and then interpolating the cell values onto the vertices by hand. However, this can lead to strange results on vertices close to sharp corners of the source geometry.

Cheers

@andrea-iob
Copy link
Member

It is possible to evaluate the levelset both on cell centroids and on arbitrary points.

The functions that allows to evaluate information on cell centroids have "Cell" in their name and take in input the id of the cell:

    double                              evalCellValue(long id, bool signedLevelSet) const;
    std::array<double,3>                evalCellGradient(long id, bool signedLevelSet) const;
    std::array<double,3>                evalCellProjectionPoint(long id) const;

The functions that allows to evaluate information on arbitrary points desn't have any prefix and take in input the coordinates of the point:

    short                               evalSign(const std::array<double,3> &point) const;
    double                              evalValue(const std::array<double,3> &point, bool signedLevelSet) const;
    std::array<double,3>                evalGradient(const std::array<double,3> &point, bool signedLevelSet) const;
    std::array<double,3>                evalProjectionPoint(const std::array<double,3> &point) const;

Therefore you can loop the vertices of the mesh, and evaluate the levelset directly on the vertices.

Note that, when evaluating the levelset on arbitrary points, no caching will be performed. The functions setCellBulkEvaluationMode/enableFieldCellCache only affects how levelset is evaluated on cell centroids.

@gitg0n
Copy link
Author

gitg0n commented Jun 7, 2024

Ah I see. I think I missed the levelset rework entirely, I still had an old version where these functions didn't exist ...
I'll have to do some reworking. Thanks for the info!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants