From d1a477c51c1cd05cd19906aec2152c11514ec21c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=BChle=2C=20Laura=20Christine=20=28lakue103=29?= <laura.kuehle@uni-duesseldorf.de> Date: Thu, 2 Jun 2022 22:05:05 +0200 Subject: [PATCH] Changed code to create data dict for basis separately. --- Basis_Function.py | 6 ++++++ Troubled_Cell_Detector.py | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Basis_Function.py b/Basis_Function.py index 32af0aa..35faf2d 100644 --- a/Basis_Function.py +++ b/Basis_Function.py @@ -44,6 +44,8 @@ class Basis(ABC): ------- calculate_cell_average(projection, stencil_length, add_reconstructions) Calculate cell averages for a given projection. + create_data_dict() + Return dictionary with data necessary to construct basis. """ @@ -207,6 +209,10 @@ class Basis(ABC): self.basis) return left_reconstructions, right_reconstructions + def create_data_dict(self): + """Return dictionary with data necessary to construct basis.""" + return {'polynomial_degree': self.polynomial_degree} + class Legendre(Basis): """Class for Legendre basis.""" diff --git a/Troubled_Cell_Detector.py b/Troubled_Cell_Detector.py index 532ed29..8ac1646 100644 --- a/Troubled_Cell_Detector.py +++ b/Troubled_Cell_Detector.py @@ -27,6 +27,8 @@ class TroubledCellDetector(ABC): Returns string of class name. get_cells(projection) Calculates troubled cells in a given projection. + create_data_dict(projection) + Return dictionary with data necessary to plot troubled cells. """ def __init__(self, config, init_cond, quadrature, basis, mesh, @@ -91,7 +93,7 @@ class TroubledCellDetector(ABC): """Return dictionary with data necessary to plot troubled cells.""" return {'projection': projection, 'wave_speed': self._wave_speed, 'final_time': self._final_time, - 'basis': {'polynomial_degree': self._basis.polynomial_degree}, + 'basis': self._basis.create_data_dict(), 'mesh': self._mesh.create_data_dict() } -- GitLab