From 73abd04283dac788537d856a70c4da08fe045046 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 21:51:14 +0200
Subject: [PATCH] Changed code to create data dict for mesh separately.

---
 Troubled_Cell_Detector.py | 7 +++----
 projection_utils.py       | 7 +++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/Troubled_Cell_Detector.py b/Troubled_Cell_Detector.py
index 32038c4..532ed29 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 6bfd9b3..f9974ca 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,
-- 
GitLab