コード例 #1
0
ファイル: test_rod.py プロジェクト: armantekinalp/PyElastica
def test_bootstrapping_types_for_symplectic_steppers(
        load_data_for_bootstrapping_state):
    all_states = _bootstrap_from_data("symplectic",
                                      *load_data_for_bootstrapping_state)
    from elastica.rod.data_structures import _KinematicState, _DynamicState

    assert_instance(all_states[0], _KinematicState)
    assert_instance(all_states[1], _DynamicState)
コード例 #2
0
def test_bootstrapping_types_for_symplectic_steppers(
        load_data_for_bootstrapping_state):
    """For block structure we drop the boot strap from data function. Thus this test fails."""
    all_states = _bootstrap_from_data("symplectic",
                                      *load_data_for_bootstrapping_state)
    from elastica.rod.data_structures import (
        _KinematicState,
        _DynamicState,
    )

    assert_instance(all_states[0], _KinematicState)
    assert_instance(all_states[1], _DynamicState)
コード例 #3
0
ファイル: test_rod.py プロジェクト: armantekinalp/PyElastica
def test_bootstrapping_types_for_explicit_steppers(
        load_data_for_bootstrapping_state):
    all_states = _bootstrap_from_data("explicit",
                                      *load_data_for_bootstrapping_state)
    from elastica.rod.data_structures import _State, _DerivativeState

    assert_instance(all_states[0], _State)
    assert_instance(all_states[1], _DerivativeState)

    test_states = all_states[0]
    test_derivatives = all_states[1]

    assert np.shares_memory(test_states.kinematic_rate_collection,
                            test_derivatives.rate_collection
                            ), "Explicit states does not share memory"
コード例 #4
0
ファイル: test_rod.py プロジェクト: armantekinalp/PyElastica
def test_bootstrapping_integrity(load_data_for_bootstrapping_state,
                                 stepper_type):
    (n_elem, vectors, directors) = load_data_for_bootstrapping_state
    all_states = _bootstrap_from_data(stepper_type,
                                      *load_data_for_bootstrapping_state)

    assert np.shares_memory(
        all_states[2],
        vectors), "Integrity of bootstrapping from vector states compromised"
    assert np.shares_memory(
        all_states[3],
        directors), "Integrity of bootstrapping from matrix states compromised"
    for state in all_states[4:]:
        assert np.shares_memory(
            state, vectors
        ), "Integrity of bootstrapping from vector states compromised"
コード例 #5
0
ファイル: test_rod.py プロジェクト: armantekinalp/PyElastica
    def load_states(self, load_data_for_bootstrapping_state):
        (n_elem, vectors, directors) = load_data_for_bootstrapping_state
        self.Vectors = vectors.copy()
        self.Directors = directors.copy()
        # Stepper Type found in base-classes TestExplicitStepperStateBehavior
        # and TestSymplecticStepperStateBehavior below.
        all_states = _bootstrap_from_data(self.StepperType,
                                          *load_data_for_bootstrapping_state)

        # Create copies of states (position, velocity etc) into
        # the states dictionary. We then do the SAME manipulation
        # of self.States and all_states to check their correctness
        for src_state, tgt_key in zip(all_states[2:], self.States):
            self.States[tgt_key] = src_state.copy()

        # all_states[0,1] here depends on the StepperType used above
        # if TestExplicitStepperStateBehavior.StepperType, then [_State, _DerivativeState]
        # if TestSymplecticStepperStateBehavior.StepperType, then [_KinematicState, _DynamicState]
        return all_states[0], all_states[1]