From 5e9d0140d77b04818c3f5c219edbdf5c15ee6a8e Mon Sep 17 00:00:00 2001
From: renchao_lu <renchao.lu@gmail.com>
Date: Wed, 17 Jun 2020 08:27:27 +0200
Subject: [PATCH] [PL] Get interpolated local solution.

---
 .../ComponentTransportFEM.h                   | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/ProcessLib/ComponentTransport/ComponentTransportFEM.h b/ProcessLib/ComponentTransport/ComponentTransportFEM.h
index 0e64d8fda20..c362b29ab69 100644
--- a/ProcessLib/ComponentTransport/ComponentTransportFEM.h
+++ b/ProcessLib/ComponentTransport/ComponentTransportFEM.h
@@ -70,6 +70,12 @@ public:
         std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_table,
         std::vector<double>& cache) const = 0;
 
+    virtual std::vector<double> const& getInterpolatedLocalSolution(
+        const double /*t*/,
+        std::vector<GlobalVector*> const& int_pt_x,
+        std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
+        std::vector<double>& cache) const = 0;
+
 protected:
     CoupledSolutionsForStaggeredScheme* _coupled_solutions{nullptr};
 };
@@ -891,6 +897,24 @@ public:
         return flux;
     }
 
+    std::vector<double> const& getInterpolatedLocalSolution(
+        const double /*t*/,
+        std::vector<GlobalVector*> const& int_pt_x,
+        std::vector<NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/,
+        std::vector<double>& cache) const override
+    {
+        assert(_process_data.chemical_process_data);
+        assert(int_pt_x.size() == 1);
+
+        cache.clear();
+        auto const ele_id = _element.getID();
+        auto const& indices = _process_data.chemical_process_data
+                                  ->chemical_system_index_map[ele_id];
+        cache = int_pt_x[0]->get(indices);
+
+        return cache;
+    }
+
 private:
     MeshLib::Element const& _element;
     ComponentTransportProcessData const& _process_data;
-- 
GitLab