D-Sheet Piling
VIKTOR's D-Sheet Piling integration requires a specific D-Sheet Piling worker which can be installed using these instructions.
Analyzing a D-Sheet Piling model in VIKTOR can be done using the
DSheetPilingAnalysis
class (worker required).
No binding is provided by VIKTOR for this module, which means that the input file has to be generated manually or
by using the GEOLIB:
import viktor as vkt
# Generate the input SHI file.
input_file = ...
# Run the analysis and obtain the output file.
analysis = vkt.dsheetpiling.DSheetPilingAnalysis(input_file)
analysis.execute(timeout=10)
output_file = analysis.get_output_file()
Testing
New in v13.5.0
mock_DSheetPilingAnalysis
decorator for easier testing of DSheetPilingAnalysis
DSheetPilingAnalysis.execute
needs to be mocked
within the context of (automated) testing.
The viktor.testing
module provides the mock_DSheetPilingAnalysis
decorator that facilitate mocking of workers:
import unittest
from viktor import File
from viktor.testing import mock_DSheetPilingAnalysis
from app.my_entity_type.controller import MyEntityTypeController
class TestMyEntityTypeController(unittest.TestCase):
@mock_DSheetPilingAnalysis(get_output_file={
'.shd': File.from_path('test_output.shd'),
'.shl': File.from_path('test_output.shl'),
'.shs': File.from_path('test_output.shs'),
'.sho': File.from_path('test_output.sho')
})
def test_dsheetpiling_analysis(self):
MyEntityTypeController().dsheetpiling_analysis()
For the decorator's input parameters the following holds:
- If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised.
- If a single object is provided, the object is returned each time the corresponding method is called (endlessly).
- If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly).