I have a (discontinous) function f from R^n to {0, 1}, provided by the user. E.g. something like this "circle inquality":
def charfunc(x):
# assume x is a numpy array
return x[0]**2 + x[1]**2 < 1
I want to find the border of the region(s) where f == 1 holds by sampling function values on a regular grid and refine that grid (iteratively) in regions where the value changes. I think that should to a be not so exotic problem and I bet that it has already been solved in the python universe. However I only found complicated PDE/FEM-Packages and NDTAMR. The former seem too much overhead. NDTAMR looks very promising but delivers strange results (at least with the default parameters from the examples):
There are cells refined which are not close to the border, and some cells which are close, are not refined. Code for this example lives in this repo.
Question: How to use NDTAMR or some other Python package to get a mesh which is refined everywhere near the border but nowhere else?