Commit 246fd62a authored by René Fritze's avatar René Fritze
Browse files

[grids] better size/ratio warning message

parent 1db34314
......@@ -530,14 +530,13 @@ class Grid(CacheableObject):
def _check_domain(cls, domain):
ll, rr = np.array(domain[0]), np.array(domain[1])
sizes = rr - ll
too_large = (
np.linalg.norm(sizes) > cls.MAX_DOMAIN_WIDTH
or np.max(sizes) / np.min(sizes) > cls.MAX_DOMAIN_RATIO
)
if too_large:
logger = getLogger('pymor.discretizers.builtin.grid')
logger = getLogger('pymor.discretizers.builtin.grid')
if np.linalg.norm(sizes) > cls.MAX_DOMAIN_WIDTH:
logger.warning(f'Domain {domain} for {cls} exceeds width limit. Results may be inaccurate')
return False
if np.max(sizes) / np.min(sizes) > cls.MAX_DOMAIN_RATIO:
logger.warning(f'Domain {domain} for {cls} exceeds ratio limit. Results may be inaccurate')
return False
return True
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment