diff --git a/Troubled_Cell_Detector.py b/Troubled_Cell_Detector.py index 32038c46fc2f7c349f7292d81c850200c8746ec0..532ed294ccdb571bd1471dee286defa7f3eafbd9 100644 --- a/Troubled_Cell_Detector.py +++ b/Troubled_Cell_Detector.py @@ -88,13 +88,11 @@ class TroubledCellDetector(ABC): pass def create_data_dict(self, projection): + """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}, - 'mesh': {'num_grid_cells': self._mesh.num_grid_cells, - 'left_bound': self._mesh.bounds[0], - 'right_bound': self._mesh.bounds[1], - 'num_ghost_cells': 2} + 'mesh': self._mesh.create_data_dict() } @@ -324,6 +322,7 @@ class WaveletDetector(TroubledCellDetector): return coarse_projection def create_data_dict(self, projection): + """Return dictionary with data necessary to plot troubled cells.""" # Create general directory data_dict = super().create_data_dict(projection) diff --git a/projection_utils.py b/projection_utils.py index 6bfd9b34da1c67949aa4336ea94a7bdeebf7de8a..f9974ca0ce5f6f0e54108b866c5cd85742d2a645 100644 --- a/projection_utils.py +++ b/projection_utils.py @@ -93,6 +93,13 @@ class Mesh: """Return the cell centers of the mesh (excluding ghost cells).""" return self.cells[self._num_ghost_cells:-self._num_ghost_cells] + def create_data_dict(self): + """Return dictionary with data necessary to construct mesh.""" + return {'num_grid_cells': self._num_grid_cells, + 'left_bound': self._left_bound, + 'right_bound': self._right_bound, + 'num_ghost_cells': self._num_ghost_cells} + def calculate_approximate_solution( projection: ndarray, points: ndarray, polynomial_degree: int,