Opened 10 years ago

Closed 7 years ago

#234 closed defect (fixed)

using holes when creating a mesh does not work with fitting

Reported by: duncan Owned by: hudson
Priority: normal Milestone:
Component: Architecture and API Version:
Severity: minor Keywords:
Cc:

Description (last modified by hudson)

Hi,

I have a problem using the function add_hole_from_polygon(). When I set up a mesh using add_region_from_polygon() for the outer model boundary, add_hole_from_polygon() to set up a hole inside this outer polygon and generate_mesh() + export_mesh_file() to create the mesh, I get an error message when trying to initialize the domain: ... File "C:\Python24\lib\site-packages\anuga\fit_interpolate\fit.py", line 301, in _build_matrix_AtA_Atz raise Exception(msg) Exception: ('Could not find triangle for point', array([ 650491.032685, 9894786.210949]))

Thats exactly one point that is inside the hole. I wonder how the program knows, that there should be a point inside... (erased .python cache before) The mesh is created in the correct way, I looked at it with graphical_mesh_generator. However, how can I get this working?

Best regards,

Arne Stahlmann

The problem is fitting does not know about holes and reckons all data points should be in a triangle.

The work-around is not to use add_hole_from_polygon(). Use add_region_from_polygon() and make the maximum triangle size huge.

Note, this error would be easier to avoid if fitting did not back track.

Change History (5)

comment:1 Changed 8 years ago by nariman

  • Owner changed from Duncan to steve

comment:2 Changed 7 years ago by hudson

  • Description modified (diff)
  • Owner changed from steve to hudson

comment:3 Changed 7 years ago by hudson

I wrote a test for this problem, but need more information on the problem. What is the stack trace for the exception? Should fitting just ignore points which fall within holes, and leave them out of the calculation? The documentation for fit.py does not give enough context to understand the module on its own, or what effect discontinuities in the mesh should have.

comment:4 Changed 7 years ago by steve

Replying to James, the fitting algorithm will work fine with domains with holes. The data matrix should be produced by iterating through each data point, and then finding a triangle which contains the point and then contributing to the data matrix, i.e. to the vertices associated with that triangle. If no triangle is found, then there is no need to contribute to the data matrix.

comment:5 Changed 7 years ago by hudson

  • Resolution set to fixed
  • Status changed from new to closed

Points that fall within a hole are no longer used in fitting - they are simply ignored. Unit test written for regression. Fixed in rev:7801.

Note: See TracTickets for help on using tickets.