(cell_type)
| 51 | |
| 52 | |
| 53 | def random_point_in_reference(cell_type): |
| 54 | if cell_type == CellType.interval: |
| 55 | return (random.random(), 0, 0) |
| 56 | elif cell_type == CellType.triangle: |
| 57 | x, y = random.random(), random.random() |
| 58 | # If point is outside cell, move it back inside |
| 59 | if x + y > 1: |
| 60 | x, y = 1 - x, 1 - y |
| 61 | return (x, y, 0) |
| 62 | elif cell_type == CellType.tetrahedron: |
| 63 | x, y, z = random.random(), random.random(), random.random() |
| 64 | # If point is outside cell, move it back inside |
| 65 | if x + y > 1: |
| 66 | x, y = 1 - x, 1 - y |
| 67 | if y + z > 1: |
| 68 | y, z = 1 - z, 1 - x - y |
| 69 | if x + y + z > 1: |
| 70 | x, z = 1 - x - y, x + y + z - 1 |
| 71 | return (x, y, z) |
| 72 | elif cell_type == CellType.quadrilateral: |
| 73 | x, y = random.random(), random.random() |
| 74 | return (x, y, 0) |
| 75 | elif cell_type == CellType.hexahedron: |
| 76 | return (random.random(), random.random(), random.random()) |
| 77 | |
| 78 | |
| 79 | def random_point_in_cell(mesh): |
no outgoing calls
no test coverage detected