From 853517b9ceda24340dcd09d50c357c8834ff8c28 Mon Sep 17 00:00:00 2001
From: Jean-Paul Pelteret <jppelteret@gmail.com>
Date: Sat, 30 Jan 2021 21:56:48 +0100
Subject: [PATCH] Add const version of
 MeshWorker::ScratchData::get_general_data_storage()

---
 doc/news/changes/minor/20210313Jean-PaulPelteret | 5 +++++
 include/deal.II/meshworker/scratch_data.h        | 8 ++++++++
 source/meshworker/scratch_data.cc                | 9 +++++++++
 3 files changed, 22 insertions(+)
 create mode 100644 doc/news/changes/minor/20210313Jean-PaulPelteret

diff --git a/doc/news/changes/minor/20210313Jean-PaulPelteret b/doc/news/changes/minor/20210313Jean-PaulPelteret
new file mode 100644
index 0000000000..2e9d92ffb5
--- /dev/null
+++ b/doc/news/changes/minor/20210313Jean-PaulPelteret
@@ -0,0 +1,5 @@
+Improved: The MeshWorker::ScratchData::get_general_data_storage() method now has
+a `const` variant.
+<br>
+(Jean-Paul Pelteret, 2021/03/13)
+
diff --git a/include/deal.II/meshworker/scratch_data.h b/include/deal.II/meshworker/scratch_data.h
index 2d7b3b5255..36c42ad360 100644
--- a/include/deal.II/meshworker/scratch_data.h
+++ b/include/deal.II/meshworker/scratch_data.h
@@ -523,6 +523,14 @@ namespace MeshWorker
     GeneralDataStorage &
     get_general_data_storage();
 
+    /**
+     * Return a GeneralDataStorage object that can be used to store any amount
+     * of data, of any type, which is then made accessible by an identifier
+     * string.
+     */
+    const GeneralDataStorage &
+    get_general_data_storage() const;
+
     /**
      * @name Evaluation of finite element fields and their derivatives on the current cell
      */
diff --git a/source/meshworker/scratch_data.cc b/source/meshworker/scratch_data.cc
index 85f3ed4f6d..de34ac5312 100644
--- a/source/meshworker/scratch_data.cc
+++ b/source/meshworker/scratch_data.cc
@@ -375,6 +375,15 @@ namespace MeshWorker
 
 
 
+  template <int dim, int spacedim>
+  const GeneralDataStorage &
+  ScratchData<dim, spacedim>::get_general_data_storage() const
+  {
+    return user_data_storage;
+  }
+
+
+
   template <int dim, int spacedim>
   const Mapping<dim, spacedim> &
   ScratchData<dim, spacedim>::get_mapping() const
-- 
2.39.5