<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-

#---------------------------------------------------------------------
# visualization of the simulation
#--------------------------------------------------------------------- 

import vtk
import settings as st

class VtkVisualizer:
    ren = None
    renWin = None

    beam = None
    beamMapper = None
    beamActor = None
    beamProp = None

    ball = None
    ballMapper = None
    ballActor = None
    ballProp = None

    vPlane = None
    vPlaneMapper = None
    vPlaneActor = None
    vPlaneProp = None

    iren = None

    def __init__(self, parent):
        # create renderer and window
        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(1, 1, 1)

        self.parent = parent
        parent.GetRenderWindow().AddRenderer(self.ren)

        #-------- add the beam ----
        # geometry
        self.beam = vtk.vtkCubeSource()
        self.beam.SetXLength(st.beam_length)
        self.beam.SetYLength(st.beam_width)
        self.beam.SetZLength(st.beam_depth)

        #mapper
        self.beamMapper = vtk.vtkPolyDataMapper()
        self.beamMapper.SetInputConnection(self.beam.GetOutputPort())

        # actor
        self.beamActor = vtk.vtkLODActor()
        self.beamActor.SetMapper(self.beamMapper)
        self.beamActor.SetScale(st.scale)

        #make it look nice
        self.beamProp = self.beamActor.GetProperty()
        self.beamProp.SetColor(0.3, 0.3, 0.3)
        self.beamProp.SetAmbient(0.2)
        self.beamProp.SetDiffuse(0.8)
        self.beamProp.SetSpecular(0.5)
        self.beamProp.SetSpecularPower(0.5)

        self.ren.AddActor(self.beamActor)

        #-------- add the ball ----
        # geometry
        self.ball = vtk.vtkSphereSource()
        self.ball.SetRadius(st.R)
        self.ball.SetThetaResolution(20)
        self.ball.SetPhiResolution(20)

        # mapper
        self.ballMapper = vtk.vtkPolyDataMapper()
        self.ballMapper.SetInputConnection(self.ball.GetOutputPort())

        # actor
        self.ballActor = vtk.vtkLODActor()
        self.ballActor.SetMapper(self.ballMapper)
        self.ballActor.SetScale(st.scale)

        # make it look nice
        self.ballProp = self.ballActor.GetProperty()
        self.ballProp.SetColor(1, 1, 0)
        self.ballProp.SetAmbient(0.2)<commit_msg>added failure flag to results. tweaked error integral<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-

#---------------------------------------------------------------------
# visualization of the simulation
#--------------------------------------------------------------------- 

import vtk
import settings as st

class VtkVisualizer:
    ren = None
    renWin = None

    beam = None
    beamMapper = None
    beamActor = None
    beamProp = None

    ball = None
    ballMapper = None
    ballActor = None
    ballProp = None

    vPlane = None
    vPlaneMapper = None
    vPlaneActor = None
    vPlaneProp = None

    iren = None

    def __init__(self, parent):
        # create renderer and window
        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(1, 1, 1)

        self.parent = parent
        parent.GetRenderWindow().AddRenderer(self.ren)

        #-------- add the beam ----
        # geometry
        self.beam = vtk.vtkCubeSource()
        self.beam.SetXLength(st.beam_length)
        self.beam.SetYLength(st.beam_width)
        self.beam.SetZLength(st.beam_depth)

        #mapper
        self.beamMapper = vtk.vtkPolyDataMapper()
        self.beamMapper.SetInputConnection(self.beam.GetOutputPort())

        # actor
        self.beamActor = vtk.vtkLODActor()
        self.beamActor.SetMapper(self.beamMapper)
        self.beamActor.SetScale(st.scale)

        #make it look nice
        self.beamProp = self.beamActor.GetProperty()
        self.beamProp.SetColor(0.3, 0.3, 0.3)
        self.beamProp.SetAmbient(0.2)
        self.beamProp.SetDiffuse(0.8)
        self.beamProp.SetSpecular(0.5)
        self.beamProp.SetSpecularPower(0.5)

        self.ren.AddActor(self.beamActor)

        #-------- add the ball ----
        # geometry
        self.ball = vtk.vtkSphereSource()
        self.ball.SetRadius(st.R)
        self.ball.SetThetaResolution(20)
        self.ball.SetPhiResolution(20)

        # mapper
        self.ballMapper = vtk.vtkPolyDataMapper()
        self.ballMapper.SetInputConnection(self.ball.GetOutputPort())

        # actor
        self.ballActor = vtk.vtkLODActor()
        self.ballActor.SetMapper(self.ballMapper)
        self.ballActor.SetScale(2*st.scale)

        # make it look nice
        self.ballProp = self.ballActor.GetProperty()
        self.ballProp.SetColor(1, 1, 0)
        self.ballProp.SetAmbient(0.2)
{'fraction_non_alphanumeric': 0.1629974597798476, 'fraction_numerical': 0.011642675698560543, 'mean_word_length': 1.7810476751030018, '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': '1826608', 'n_tokens_mistral': 1532, 'n_tokens_neox': 1426, 'n_words': 246}