Fiber intersection algorithm fails if fiber ends at intersection inside grid
Description
The compute_grid_fibre_intersections()
algorithm returns wrong fiber intersection if a fiber ends inside a grid cell at an intersection inside the grid (starting inside a cell works fine). The algorithm returns an additional intersection on curve interval [1, 1]
. This leads to a singular matrix error within the LineGeometry
which is computed from the resulting cell coordinates. Additionally, the two fibers do not seem to have a common cell they both intersect. Is this just an artifact of the indexing or an error in the algorithm?
The error can be produced by splitting the single fiber of the example case hansbo_reproduction/fig23_3.yml
into two fibers:
fig23_3.yml
Verbose output
Parsed a total of 2 fibres from the configuration. A restart of the curve cutting algorithm was needed at t=0.192308 A restart of the curve cutting algorithm was needed at t=0.791667 Fibre intersection summary: Cell 400 intersects fibre 0 on the curve interval [0.192692,0.230769] Cell 401 intersects fibre 0 on the curve interval [0.192308,0.192692] Cell 402 intersects fibre 0 on the curve interval [0.231154,0.269231] Cell 403 intersects fibre 0 on the curve interval [0.230769,0.231154] Cell 404 intersects fibre 0 on the curve interval [0.269615,0.307692] Cell 405 intersects fibre 0 on the curve interval [0.269231,0.269615] Cell 406 intersects fibre 0 on the curve interval [0.308077,0.346154] Cell 407 intersects fibre 0 on the curve interval [0.307692,0.308077] Cell 408 intersects fibre 0 on the curve interval [0.346538,0.384615] Cell 409 intersects fibre 0 on the curve interval [0.346154,0.346538] Cell 410 intersects fibre 0 on the curve interval [0.385,0.423077] Cell 411 intersects fibre 0 on the curve interval [0.384615,0.385] Cell 412 intersects fibre 0 on the curve interval [0.423462,0.461538] Cell 413 intersects fibre 0 on the curve interval [0.423077,0.423462] Cell 414 intersects fibre 0 on the curve interval [0.461923,0.5] Cell 415 intersects fibre 0 on the curve interval [0.461538,0.461923] Cell 416 intersects fibre 0 on the curve interval [0.500385,0.538462] Cell 417 intersects fibre 0 on the curve interval [0.5,0.500385] Cell 418 intersects fibre 0 on the curve interval [0.538846,0.576923] Cell 419 intersects fibre 0 on the curve interval [0.538462,0.538846] Cell 420 intersects fibre 0 on the curve interval [0.577308,0.615385] Cell 421 intersects fibre 0 on the curve interval [0.576923,0.577308] Cell 422 intersects fibre 0 on the curve interval [0.615769,0.653846] Cell 423 intersects fibre 0 on the curve interval [0.615385,0.615769] Cell 424 intersects fibre 0 on the curve interval [0.654231,0.692308] Cell 425 intersects fibre 0 on the curve interval [0.653846,0.654231] Cell 426 intersects fibre 0 on the curve interval [0.692692,0.730769] Cell 427 intersects fibre 0 on the curve interval [0.692308,0.692692] Cell 428 intersects fibre 0 on the curve interval [0.731154,0.769231] Cell 429 intersects fibre 0 on the curve interval [0.730769,0.731154] Cell 430 intersects fibre 0 on the curve interval [0.769615,0.807692] Cell 431 intersects fibre 0 on the curve interval [0.769231,0.769615] Cell 432 intersects fibre 0 on the curve interval [0.808077,0.846154] Cell 433 intersects fibre 0 on the curve interval [0.807692,0.808077] Cell 434 intersects fibre 0 on the curve interval [0.846538,0.884615] Cell 435 intersects fibre 0 on the curve interval [0.846154,0.846538] Cell 436 intersects fibre 0 on the curve interval [0.885,0.923077] Cell 437 intersects fibre 0 on the curve interval [0.884615,0.885] Cell 438 intersects fibre 0 on the curve interval [0.923462,0.961538] Cell 439 intersects fibre 0 on the curve interval [0.923077,0.923462] Cell 440 intersects fibre 0 on the curve interval [0.961923,1] Cell 441 intersects fibre 0 on the curve interval [0.961538,0.961923] Cell 443 intersects fibre 0 on the curve interval [1,1] Facet between cell 400 and 403 intersects fibre 0 at t=0.230769 Facet between cell 401 and 400 intersects fibre 0 at t=0.192692 Facet between cell 402 and 405 intersects fibre 0 at t=0.269231 Facet between cell 403 and 402 intersects fibre 0 at t=0.231154 Facet between cell 404 and 407 intersects fibre 0 at t=0.307692 Facet between cell 405 and 404 intersects fibre 0 at t=0.269615 Facet between cell 406 and 409 intersects fibre 0 at t=0.346154 Facet between cell 407 and 406 intersects fibre 0 at t=0.308077 Facet between cell 408 and 411 intersects fibre 0 at t=0.384615 Facet between cell 409 and 408 intersects fibre 0 at t=0.346538 Facet between cell 410 and 413 intersects fibre 0 at t=0.423077 Facet between cell 411 and 410 intersects fibre 0 at t=0.385 Facet between cell 412 and 415 intersects fibre 0 at t=0.461538 Facet between cell 413 and 412 intersects fibre 0 at t=0.423462 Facet between cell 414 and 417 intersects fibre 0 at t=0.5 Facet between cell 415 and 414 intersects fibre 0 at t=0.461923 Facet between cell 416 and 419 intersects fibre 0 at t=0.538462 Facet between cell 417 and 416 intersects fibre 0 at t=0.500385 Facet between cell 418 and 421 intersects fibre 0 at t=0.576923 Facet between cell 419 and 418 intersects fibre 0 at t=0.538846 Facet between cell 420 and 423 intersects fibre 0 at t=0.615385 Facet between cell 421 and 420 intersects fibre 0 at t=0.577308 Facet between cell 422 and 425 intersects fibre 0 at t=0.653846 Facet between cell 423 and 422 intersects fibre 0 at t=0.615769 Facet between cell 424 and 427 intersects fibre 0 at t=0.692308 Facet between cell 425 and 424 intersects fibre 0 at t=0.654231 Facet between cell 426 and 429 intersects fibre 0 at t=0.730769 Facet between cell 427 and 426 intersects fibre 0 at t=0.692692 Facet between cell 428 and 431 intersects fibre 0 at t=0.769231 Facet between cell 429 and 428 intersects fibre 0 at t=0.731154 Facet between cell 430 and 433 intersects fibre 0 at t=0.807692 Facet between cell 431 and 430 intersects fibre 0 at t=0.769615 Facet between cell 432 and 435 intersects fibre 0 at t=0.846154 Facet between cell 433 and 432 intersects fibre 0 at t=0.808077 Facet between cell 434 and 437 intersects fibre 0 at t=0.884615 Facet between cell 435 and 434 intersects fibre 0 at t=0.846538 Facet between cell 436 and 439 intersects fibre 0 at t=0.923077 Facet between cell 437 and 436 intersects fibre 0 at t=0.885 Facet between cell 438 and 441 intersects fibre 0 at t=0.961538 Facet between cell 439 and 438 intersects fibre 0 at t=0.923462 Facet between cell 440 and 443 intersects fibre 0 at t=1 Facet between cell 441 and 440 intersects fibre 0 at t=0.961923 Cell 202 intersects fibre 1 on the curve interval [0.000416667,0.0416667] Cell 203 intersects fibre 1 on the curve interval [0,0.000416667] Cell 204 intersects fibre 1 on the curve interval [0.0420833,0.0833333] Cell 205 intersects fibre 1 on the curve interval [0.0416667,0.0420833] Cell 206 intersects fibre 1 on the curve interval [0.08375,0.125] Cell 207 intersects fibre 1 on the curve interval [0.0833333,0.08375] Cell 208 intersects fibre 1 on the curve interval [0.125417,0.166667] Cell 209 intersects fibre 1 on the curve interval [0.125,0.125417] Cell 210 intersects fibre 1 on the curve interval [0.167083,0.208333] Cell 211 intersects fibre 1 on the curve interval [0.166667,0.167083] Cell 212 intersects fibre 1 on the curve interval [0.20875,0.25] Cell 213 intersects fibre 1 on the curve interval [0.208333,0.20875] Cell 214 intersects fibre 1 on the curve interval [0.250417,0.291667] Cell 215 intersects fibre 1 on the curve interval [0.25,0.250417] Cell 216 intersects fibre 1 on the curve interval [0.292083,0.333333] Cell 217 intersects fibre 1 on the curve interval [0.291667,0.292083] Cell 218 intersects fibre 1 on the curve interval [0.33375,0.375] Cell 219 intersects fibre 1 on the curve interval [0.333333,0.33375] Cell 220 intersects fibre 1 on the curve interval [0.375417,0.416667] Cell 221 intersects fibre 1 on the curve interval [0.375,0.375417] Cell 222 intersects fibre 1 on the curve interval [0.417083,0.458333] Cell 223 intersects fibre 1 on the curve interval [0.416667,0.417083] Cell 224 intersects fibre 1 on the curve interval [0.45875,0.5] Cell 225 intersects fibre 1 on the curve interval [0.458333,0.45875] Cell 226 intersects fibre 1 on the curve interval [0.500417,0.541667] Cell 227 intersects fibre 1 on the curve interval [0.5,0.500417] Cell 228 intersects fibre 1 on the curve interval [0.542083,0.583333] Cell 229 intersects fibre 1 on the curve interval [0.541667,0.542083] Cell 230 intersects fibre 1 on the curve interval [0.58375,0.625] Cell 231 intersects fibre 1 on the curve interval [0.583333,0.58375] Cell 232 intersects fibre 1 on the curve interval [0.625417,0.666667] Cell 233 intersects fibre 1 on the curve interval [0.625,0.625417] Cell 234 intersects fibre 1 on the curve interval [0.667083,0.708333] Cell 235 intersects fibre 1 on the curve interval [0.666667,0.667083] Cell 236 intersects fibre 1 on the curve interval [0.70875,0.75] Cell 237 intersects fibre 1 on the curve interval [0.708333,0.70875] Cell 238 intersects fibre 1 on the curve interval [0.750417,0.791667] Cell 239 intersects fibre 1 on the curve interval [0.75,0.750417] Facet between cell 202 and 205 intersects fibre 1 at t=0.0416667 Facet between cell 203 and 202 intersects fibre 1 at t=0.000416667 Facet between cell 204 and 207 intersects fibre 1 at t=0.0833333 Facet between cell 205 and 204 intersects fibre 1 at t=0.0420833 Facet between cell 206 and 209 intersects fibre 1 at t=0.125 Facet between cell 207 and 206 intersects fibre 1 at t=0.08375 Facet between cell 208 and 211 intersects fibre 1 at t=0.166667 Facet between cell 209 and 208 intersects fibre 1 at t=0.125417 Facet between cell 210 and 213 intersects fibre 1 at t=0.208333 Facet between cell 211 and 210 intersects fibre 1 at t=0.167083 Facet between cell 212 and 215 intersects fibre 1 at t=0.25 Facet between cell 213 and 212 intersects fibre 1 at t=0.20875 Facet between cell 214 and 217 intersects fibre 1 at t=0.291667 Facet between cell 215 and 214 intersects fibre 1 at t=0.250417 Facet between cell 216 and 219 intersects fibre 1 at t=0.333333 Facet between cell 217 and 216 intersects fibre 1 at t=0.292083 Facet between cell 218 and 221 intersects fibre 1 at t=0.375 Facet between cell 219 and 218 intersects fibre 1 at t=0.33375 Facet between cell 220 and 223 intersects fibre 1 at t=0.416667 Facet between cell 221 and 220 intersects fibre 1 at t=0.375417 Facet between cell 222 and 225 intersects fibre 1 at t=0.458333 Facet between cell 223 and 222 intersects fibre 1 at t=0.417083 Facet between cell 224 and 227 intersects fibre 1 at t=0.5 Facet between cell 225 and 224 intersects fibre 1 at t=0.45875 Facet between cell 226 and 229 intersects fibre 1 at t=0.541667 Facet between cell 227 and 226 intersects fibre 1 at t=0.500417 Facet between cell 228 and 231 intersects fibre 1 at t=0.583333 Facet between cell 229 and 228 intersects fibre 1 at t=0.542083 Facet between cell 230 and 233 intersects fibre 1 at t=0.625 Facet between cell 231 and 230 intersects fibre 1 at t=0.58375 Facet between cell 232 and 235 intersects fibre 1 at t=0.666667 Facet between cell 233 and 232 intersects fibre 1 at t=0.625417 Facet between cell 234 and 237 intersects fibre 1 at t=0.708333 Facet between cell 235 and 234 intersects fibre 1 at t=0.667083 Facet between cell 236 and 239 intersects fibre 1 at t=0.75 Facet between cell 237 and 236 intersects fibre 1 at t=0.70875 Facet between cell 239 and 238 intersects fibre 1 at t=0.750417
Open Questions
It remains unclear if the fiber actually intersects the last cell (in this case, cell 443
). I'll have to understand the intersection algorithm first and do some more debugging.