<commit_before>#!/usr/bin/python
#
# sodtube1d.py
#
#
# 1D Sod Tube Test
#
# This program is implemented by OO style to be
# a part of ipython notebook demo materials.
#
# DEBUG: search string 'DEBUG'

import scipy.optimize as so

class PlotManager():
    """
    Manage how to show the data generated by SodTube.
    Roughly speaking, it is a wrapper of matplotlib
    """
    def __init__(self):
        pass

    def plotMesh(self, mesh):
        pass

    def plotSolution(self, solution):
        pass

class DataManager(PlotManager):
    """
    Manage how to get extended information by input data.
    """
    def __init__(self):
        pass

    def get_ErrorNorm(self, solution_A, solution_B):
        return solution_errornorm

    def get_L2Norm(self, solution_A, solution_B):
        return solution_errornorm

class SodTube():
    """
    The core to generate the 1D Sod tube test
    """
    def __init__(self):
        # initial condition
        # [(rhol, ul, pl), (rhor, ur, pr)]
        #
        # Sod's initial condition
        self.RHOL = 1.0
        self.UL = 0.0
        self.PL = 1.0
        self.RHOR = 0.125
        self.UR = 0.0
        self.PR = 0.1
        self.initcondition_sod = [(self.RHOL, self.UL, self.PL),
                                  (self.RHOR, self.UR, self.PR)]
        # initial condition for a shock tube problem
        # default is Sod's initial condition
        # users could change this initial conditions
        self.initcondition = self.initcondition_sod
        # constants and conventions
        self.GAMMA = 1.4 # ideal gas constant
        self.GAMMA2 = (self.GAMMA - 1.0) / (self.GAMMA + 1.0)
        self.ALPHA = (self.GAMMA + 1.0) / (self.GAMMA - 1.0)
        self.BETA = (self.GAMMA - 1.0) / (2.0*self.GAMMA)
        # a mesh, which has this format:
        # [point0, point1, point2, point3, ......, pointn]
        self.mesh = []
        # solution has this format:
        # [(x0, rho0, u0, p0),
        #  (x1, rho1, u1, p1),
        #  ......,
        #  (xn, rhon, un, pn)]
        self.solution = []
        self.ceseparameters = []

    def get_Initcondition(self):
        return self.initcondition

    def setInitcondition(self, initcondition):
        self.initcondition = initcondition

    def get_Mesh(self):
        return self.mesh

    def get_AnalyticSolution(self):
        return self.calAnalyticSolution()

    def calAnalyticSolution(self, initcondition=None):
        # where implementing the code to get the analytic solution
        # by users' input condition
        # default is the Sod's condition
        initcondition = initcondition or self.initcondition
        solution = []
        return solution

    ##########################
    ### Analytical formula ###
    ##########################
    def analyticPressureRegion4(self, x):<commit_msg>follow pep8 naming style, move set to be set_<commit_after>#!/usr/bin/python
#
# sodtube1d.py
#
#
# 1D Sod Tube Test
#
# This program is implemented by OO style to be
# a part of ipython notebook demo materials.
#
# DEBUG: search string 'DEBUG'

import scipy.optimize as so

class PlotManager():
    """
    Manage how to show the data generated by SodTube.
    Roughly speaking, it is a wrapper of matplotlib
    """
    def __init__(self):
        pass

    def plotMesh(self, mesh):
        pass

    def plotSolution(self, solution):
        pass

class DataManager(PlotManager):
    """
    Manage how to get extended information by input data.
    """
    def __init__(self):
        pass

    def get_ErrorNorm(self, solution_A, solution_B):
        return solution_errornorm

    def get_L2Norm(self, solution_A, solution_B):
        return solution_errornorm

class SodTube():
    """
    The core to generate the 1D Sod tube test
    """
    def __init__(self):
        # initial condition
        # [(rhol, ul, pl), (rhor, ur, pr)]
        #
        # Sod's initial condition
        self.RHOL = 1.0
        self.UL = 0.0
        self.PL = 1.0
        self.RHOR = 0.125
        self.UR = 0.0
        self.PR = 0.1
        self.initcondition_sod = [(self.RHOL, self.UL, self.PL),
                                  (self.RHOR, self.UR, self.PR)]
        # initial condition for a shock tube problem
        # default is Sod's initial condition
        # users could change this initial conditions
        self.initcondition = self.initcondition_sod
        # constants and conventions
        self.GAMMA = 1.4 # ideal gas constant
        self.GAMMA2 = (self.GAMMA - 1.0) / (self.GAMMA + 1.0)
        self.ALPHA = (self.GAMMA + 1.0) / (self.GAMMA - 1.0)
        self.BETA = (self.GAMMA - 1.0) / (2.0*self.GAMMA)
        # a mesh, which has this format:
        # [point0, point1, point2, point3, ......, pointn]
        self.mesh = []
        # solution has this format:
        # [(x0, rho0, u0, p0),
        #  (x1, rho1, u1, p1),
        #  ......,
        #  (xn, rhon, un, pn)]
        self.solution = []
        self.ceseparameters = []

    def get_Initcondition(self):
        return self.initcondition

    def set_Initcondition(self, initcondition):
        self.initcondition = initcondition

    def get_Mesh(self):
        return self.mesh

    def get_AnalyticSolution(self):
        return self.calAnalyticSolution()

    def calAnalyticSolution(self, initcondition=None):
        # where implementing the code to get the analytic solution
        # by users' input condition
        # default is the Sod's condition
        initcondition = initcondition or self.initcondition
        solution = []
        return solution

    ##########################
    ### Analytical formula ###
    ##########################
    def analyticPressureRegion4(self, x):
{'fraction_non_alphanumeric': 0.11987436747513523, 'fraction_numerical': 0.016227534461699528, 'mean_word_length': 2.11352525801195, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4717350', 'n_tokens_mistral': 1873, 'n_tokens_neox': 1759, 'n_words': 509}