|
| 1 | +# SPDX-License-Identifier: Apache-2.0 |
| 2 | +# SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies. |
| 3 | +# SPDX-FileContributor: Lucas Givord - Kitware |
| 4 | +from trame.app import get_server |
| 5 | +from trame_client.utils.testing import enable_testing |
| 6 | +from geos_trame.app.core import GeosTrame |
| 7 | + |
| 8 | + |
| 9 | +def test_internal_well_intersection(): |
| 10 | + |
| 11 | + server = enable_testing( get_server( client_type="vue3" ), "message" ) |
| 12 | + file_name = "geos-trame/tests/data/geosDeck/geosDeck.xml" |
| 13 | + |
| 14 | + app = GeosTrame( server, file_name ) |
| 15 | + app.state.ready() |
| 16 | + |
| 17 | + app.deckInspector.state.object_state = [ "Problem/Mesh/0/VTKMesh/0", True ] |
| 18 | + app.deckInspector.state.flush() |
| 19 | + |
| 20 | + app.deckInspector.state.object_state = [ |
| 21 | + "Problem/Mesh/0/VTKMesh/0/InternalWell/0", |
| 22 | + True, |
| 23 | + ] |
| 24 | + app.deckInspector.state.flush() |
| 25 | + |
| 26 | + app.deckInspector.state.object_state = [ |
| 27 | + "Problem/Mesh/0/VTKMesh/0/InternalWell/0/Perforation/0", |
| 28 | + True, |
| 29 | + ] |
| 30 | + app.deckInspector.state.flush() |
| 31 | + |
| 32 | + app.deckInspector.state.object_state = [ |
| 33 | + "Problem/Mesh/0/VTKMesh/0/InternalWell/0/Perforation/1", |
| 34 | + True, |
| 35 | + ] |
| 36 | + app.deckInspector.state.flush() |
| 37 | + |
| 38 | + assert app.deckViewer.well_engine.get_number_of_wells() == 1 |
| 39 | + assert len( app.deckViewer._perforations ) == 2 |
| 40 | + |
| 41 | + |
| 42 | +def test_vtk_well_intersection(): |
| 43 | + |
| 44 | + server = enable_testing( get_server( client_type="vue3" ), "message" ) |
| 45 | + file_name = "geos-trame/tests/data/geosDeck/geosDeck.xml" |
| 46 | + |
| 47 | + app = GeosTrame( server, file_name ) |
| 48 | + app.state.ready() |
| 49 | + |
| 50 | + app.deckInspector.state.object_state = [ "Problem/Mesh/0/VTKMesh/0", True ] |
| 51 | + app.deckInspector.state.flush() |
| 52 | + |
| 53 | + app.deckInspector.state.object_state = [ "Problem/Mesh/0/VTKMesh/0/VTKWell/0", True ] |
| 54 | + app.deckInspector.state.flush() |
| 55 | + |
| 56 | + app.deckInspector.state.object_state = [ |
| 57 | + "Problem/Mesh/0/VTKMesh/0/VTKWell/0/Perforation/0", |
| 58 | + True, |
| 59 | + ] |
| 60 | + app.deckInspector.state.flush() |
| 61 | + |
| 62 | + app.deckInspector.state.object_state = [ |
| 63 | + "Problem/Mesh/0/VTKMesh/0/VTKWell/0/Perforation/1", |
| 64 | + True, |
| 65 | + ] |
| 66 | + app.deckInspector.state.flush() |
| 67 | + |
| 68 | + assert app.deckViewer.well_engine.get_number_of_wells() == 1 |
| 69 | + assert len( app.deckViewer._perforations ) == 2 |
| 70 | + |
| 71 | + app.deckInspector.state.object_state = [ "Problem/Mesh/0/VTKMesh/0/VTKWell/0", False ] |
| 72 | + app.deckInspector.state.flush() |
| 73 | + |
| 74 | + assert app.deckViewer.well_engine.get_number_of_wells() == 0 |
0 commit comments