From 5acbfffa83b08e233d4379a944554b76ec90a4ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com>
Date: Wed, 1 Dec 2021 15:28:57 +0100
Subject: [PATCH] Fix output array type and give more calling flexibility

'integrate' method can now be called with non 'Array' types of array.
---
 src/language/utils/IntegrateOnCells.hpp | 28 ++++++++++++-------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/language/utils/IntegrateOnCells.hpp b/src/language/utils/IntegrateOnCells.hpp
index 669190ca6..0290b3692 100644
--- a/src/language/utils/IntegrateOnCells.hpp
+++ b/src/language/utils/IntegrateOnCells.hpp
@@ -566,38 +566,38 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu
   }
 
  public:
-  template <typename MeshType, typename OutputArrayT>
+  template <typename MeshType, typename ArrayT>
   static PUGS_INLINE void
   integrateTo(const FunctionSymbolId& function_symbol_id,
               const IQuadratureDescriptor& quadrature_descriptor,
               const MeshType& mesh,
-              OutputArrayT& value)
+              ArrayT& value)
   {
     constexpr size_t Dimension = MeshType::Dimension;
 
     if (quadrature_descriptor.isTensorial()) {
-      _tensorialIntegrateTo<MeshType, OutputArrayT>(function_symbol_id, quadrature_descriptor, mesh,
-                                                    AllCells<Dimension>{mesh.connectivity()}, value);
+      _tensorialIntegrateTo<MeshType, ArrayT>(function_symbol_id, quadrature_descriptor, mesh,
+                                              AllCells<Dimension>{mesh.connectivity()}, value);
     } else {
-      _directIntegrateTo<MeshType, OutputArrayT>(function_symbol_id, quadrature_descriptor, mesh,
-                                                 AllCells<Dimension>{mesh.connectivity()}, value);
+      _directIntegrateTo<MeshType, ArrayT>(function_symbol_id, quadrature_descriptor, mesh,
+                                           AllCells<Dimension>{mesh.connectivity()}, value);
     }
   }
 
-  template <typename MeshType, typename OutputArrayT>
-  static PUGS_INLINE Array<OutputType>
+  template <typename MeshType, template <typename DataType> typename ArrayT>
+  static PUGS_INLINE ArrayT<OutputType>
   integrate(const FunctionSymbolId& function_symbol_id,
             const IQuadratureDescriptor& quadrature_descriptor,
             const MeshType& mesh,
-            const Array<CellId>& cell_list)
+            const ArrayT<CellId>& cell_list)
   {
-    Array<OutputType> value(size(cell_list));
+    ArrayT<OutputType> value(size(cell_list));
     if (quadrature_descriptor.isTensorial()) {
-      _tensorialIntegrateTo<MeshType, OutputArrayT>(function_symbol_id, quadrature_descriptor, mesh,
-                                                    CellList{cell_list}, value);
+      _tensorialIntegrateTo<MeshType, ArrayT<OutputType>>(function_symbol_id, quadrature_descriptor, mesh,
+                                                          CellList{cell_list}, value);
     } else {
-      _directIntegrateTo<MeshType, OutputArrayT>(function_symbol_id, quadrature_descriptor, mesh, CellList{cell_list},
-                                                 value);
+      _directIntegrateTo<MeshType, ArrayT<OutputType>>(function_symbol_id, quadrature_descriptor, mesh,
+                                                       CellList{cell_list}, value);
     }
 
     return value;
-- 
GitLab