UG4 / ugcore

The core functionality of UG4. Includes sources, build-scripts, and utility scripts.
https://github.com/UG4/ugcore
Other
36 stars 23 forks source link

[FEATURE] Get number of geometric elements in domain subset (Lua) #39

Open stephanmg opened 3 years ago

stephanmg commented 3 years ago

Problem:

Given a domain, how can one find the number of a certain type of geometric element (e.g. Vertex, Edge) in a subset from Lua?

Workarounds (Thanks to @mastep84):

obj = Mesh()
LoadMesh(obj, gridName)
SelectSubset(obj, 0, false, true, false, false)
print(obj:selector():num_edges())

Proposed solution by @sreiter:

Use dom:subset_handler() which returns the subset handler of a domain (see domain_bridge.cpp). And there is subset_handler_bridge.cpp, where the different subset-handlers are registered. Here you could easily add the different overloads of num_vertices, num_edges, etc. methods and use them directly in your script: dom:subset_handler():num_edges(subsetIndex)`.

See branch https://github.com/stephanmg/ugcore/tree/featureNumElements for details and status (WIP).