<commit_before>#!/usr/bin/env python

#
# Example of a bouncing ball with OpenCascade contactors
#
import siconos.io.mechanics_io
siconos.io.mechanics_io.set_implementation('original')
siconos.io.mechanics_io.set_backend('occ')

from siconos.mechanics.contact_detection.tools import Contactor
from siconos.mechanics import occ
from siconos.io.mechanics_io import Hdf5
import siconos.numerics as Numerics

import siconos.io.mechanics_io
siconos.io.mechanics_io.set_implementation('original')
siconos.io.mechanics_io.set_backend('occ')

from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox, BRepPrimAPI_MakeSphere

sphere = BRepPrimAPI_MakeSphere(1.).Shape()
ground = BRepPrimAPI_MakeBox(100., 100., .5).Shape()

# Creation of the hdf5 file for input/output
with Hdf5() as io:

    io.addOccShape('Sphere', sphere)
    io.addOccShape('Ground', ground)

    io.addObject('sphere',
                 [Contactor('Sphere', contact_type='Face', contact_index=0)],
                 mass=1, translation=[50, 50, 10], velocity=[0, 0, 0, 0, 0, 0])
<commit_msg>[mechanics proposed] remove repeated set_implementation() in occ example.<commit_after>#!/usr/bin/env python

#
# Example of a bouncing ball with OpenCascade contactors
#

from siconos.mechanics.contact_detection.tools import Contactor
from siconos.mechanics import occ
from siconos.io.mechanics_io import Hdf5
import siconos.numerics as Numerics

import siconos.io.mechanics_io
siconos.io.mechanics_io.set_implementation('original')
siconos.io.mechanics_io.set_backend('occ')

from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox, BRepPrimAPI_MakeSphere

sphere = BRepPrimAPI_MakeSphere(1.).Shape()
ground = BRepPrimAPI_MakeBox(100., 100., .5).Shape()

# Creation of the hdf5 file for input/output
with Hdf5() as io:

    io.addOccShape('Sphere', sphere)
    io.addOccShape('Ground', ground)

    io.addObject('sphere',
                 [Contactor('Sphere', contact_type='Face', contact_index=0)],
                 mass=1, translation=[50, 50, 10], velocity=[0, 0, 0, 0, 0, 0])

{'fraction_non_alphanumeric': 0.11551809618244918, 'fraction_numerical': 0.02478929102627665, 'mean_word_length': 4.952802359882006, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4734494', 'n_tokens_mistral': 754, 'n_tokens_neox': 696, 'n_words': 151}