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

Missing feature: cut_facets #22

Closed
janmodderman opened this issue Apr 19, 2023 · 6 comments
Closed

Missing feature: cut_facets #22

janmodderman opened this issue Apr 19, 2023 · 6 comments

Comments

@janmodderman
Copy link
Contributor

Missing the cut_facets feature required to intersect non-embedded with embedded boundaries. Available in Gridap.Embedded package, should be implemented in a similar way.

@pmartorell
Copy link
Collaborator

pmartorell commented Apr 19, 2023

Hi @janmodderman thanks for reporting.

I add @oriolcg to the conversation.

The issue is to implement: cut_facets(::STLCutter,model::DiscreteModel,geo::STLGeometry)

As STLCutter is computationally more expensive than LevelSetCutters. Thus, it would be convenient that
cut() returns cutgeo,f_to_bgf,cutgeo_facets which will avoid recomputations.

Note that STLCutter only supports one single geometry and cannot be intersected with a LevelSetGeometry.

So that, the following functions should be modified (from high to low level):

  • cut_facets(): new function that wraps _cut_stl()
  • cut(): return also cutgeo_facets
  • _cut_stl(): compute EmbeddedFacetDiscretizations data fields
  • subtriangulate():
    • _get_threaded_empty_arrays
    • save_submesh!
    • _append_threaded_submesh!
    • delete_small_subfacets!
  • save_submesh():
    • extract cut cell boundary simplices with the followoing lines ( since Adding simplexify_cell_boundary #23 )
       T_Fin,X_Fin,f_to_lbgf = simplexify_cell_boundary(Kin,p)
       T_Fout,X_Fout,f_to_lbgf = simplexify_cell_boundary(Kout,p)
      
    • save simplices into mesh arrays: modifications into _append_submesh()

Let me know if there is anything unclear.

@janmodderman
Copy link
Contributor Author

janmodderman commented May 23, 2023

Hi @pmartorell,

I looked into adding this feature this week and I have a question on the last 2 functions; subtriangulate() and save_submesh().

In the save_submesh() function calling the simplexify on the inner and outer boundary is straightforward, I was wondering how to save the simplices into the mesh arrays. I assume that _append_subfacets should be used for this modification, but should that replace the current subfacets being appended as well? Or just have 2 additional append subfacets calls?

Secondly, should all the functions placed under the subtriangulate() bullet be modified or only the save_submesh() function?

Best regards,

Jan

@pmartorell
Copy link
Collaborator

Hi @janmodderman,

I would append the cell boundary simplices in the same mesh arrays than the interface simplices. In order to do so, you need to distinguish them by adding a new array, e.g., f_to_type.

This array has to be initialized in _get_threaded_empty_arrays() and modified in _append_subfacets(). In these function you can rename the local variables f_to_stlface and f_to_ios by more general names, e.g., f_to_tag and f_to_io.

Then the cell boundary facets need to be re-indexed to the global background facets. Outside the cell loop.

Both types of facets should be filtered within the subtriangulation function to avoid interface changes.

Regarding the first question, you should add additional calls to _append_subfacets.

Regarding the second one, the functions to be modified are the followings: get_threaded_arrays, save_submesh, _append_submesh, _append_subfacets and subtriangulate itself.

I hope this helps.

The modifications are quite narrow, but if you open a branch/fork I can help you with any part you need help with.

Regards,

@janmodderman
Copy link
Contributor Author

Hi @pmartorell,

Thank you for the quick reply! I made a fork which is available here https://github.com/janmodderman/STLCutters.jl

I pushed the changes I have made up to this point to this fork.

Best regards,

Jan Modderman

@pmartorell
Copy link
Collaborator

pmartorell commented Dec 15, 2023

After a meeting with @janmodderman on 14 Dec 2023, the workflow is functioning (janmodderman@9ef7ee6)

Still, there are the following tasks to do:

  • Code cleaning and style (@pmartorell)
    • Merge arrays
    • Remove inline annotations
  • Missing devs (@pmartorell)
    • Remove small facets
    • Append threaded arrays
    • Extend AbstractEmbeddedDiscretization to hold both
  • Testing (@janmodderman)
    • Test area vs. known value
    • Test area in + out vs. total
    • Moment fitting test (@pmartorell)
    • Functional example

pmartorell added a commit to janmodderman/STLCutters.jl that referenced this issue Jan 31, 2024
@pmartorell
Copy link
Collaborator

This feature will be available in the next release (v0.2.0)

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

No branches or pull requests

2 participants