def test_element_recorder(): recorder = ElementRecorder( file='/path/to/file', elements=1, dofs=[1, 2], response='localForce', ) generated = recorder.tcl_code() expected = 'recorder Element -file {/path/to/file} -ele 1 -dof 1 2 localForce' assert generated == expected
def test_element_recorder_all_elements(): recorder = ElementRecorder( file='/path/to/file', elements='all', dofs=[1, 2, 3], response='globalForce', ) generated = recorder.tcl_code() expected = 'recorder Element -file {/path/to/file} -ele {*}[getEleTags] -dof 1 2 3 globalForce' assert generated == expected
def test_element_recorder_pass_array(): recorder = ElementRecorder( file=R'C:\Scratch\forces.dat', elements=np.array([1, 2, 3, 4, 5]), dofs=np.array([1, 2, 3, 4, 5, 6]), response='force', ) generated = recorder.tcl_code() expected = ( 'recorder Element -file {C:/Scratch/forces.dat} ' '-ele 1 2 3 4 5 -dof 1 2 3 4 5 6 force' ) assert generated == expected
def test_element_recorder_all_elements_delayed_file_then_format(): recorder = ElementRecorder(elements='all', dofs=1, response='force') generated = recorder.tcl_code().format(file='/path/to/file') expected = 'recorder Element -file {/path/to/file} -ele {*}[getEleTags] -dof 1 force' assert generated == expected
def test_element_recorder_all_elements_delayed_file(): recorder = ElementRecorder(elements='all', dofs=1, response='force') generated = recorder.tcl_code() expected = 'recorder Element -file {{{file!s}}} -ele {{*}}[getEleTags] -dof 1 force' assert generated == expected