Skip to content
Snippets Groups Projects
Commit 5acbfffa authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Fix output array type and give more calling flexibility

'integrate' method can now be called with non 'Array' types of array.
parent e2d6e29f
No related branches found
No related tags found
1 merge request!124Add files for high order integration with quadratures
...@@ -566,38 +566,38 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu ...@@ -566,38 +566,38 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu
} }
public: public:
template <typename MeshType, typename OutputArrayT> template <typename MeshType, typename ArrayT>
static PUGS_INLINE void static PUGS_INLINE void
integrateTo(const FunctionSymbolId& function_symbol_id, integrateTo(const FunctionSymbolId& function_symbol_id,
const IQuadratureDescriptor& quadrature_descriptor, const IQuadratureDescriptor& quadrature_descriptor,
const MeshType& mesh, const MeshType& mesh,
OutputArrayT& value) ArrayT& value)
{ {
constexpr size_t Dimension = MeshType::Dimension; constexpr size_t Dimension = MeshType::Dimension;
if (quadrature_descriptor.isTensorial()) { if (quadrature_descriptor.isTensorial()) {
_tensorialIntegrateTo<MeshType, OutputArrayT>(function_symbol_id, quadrature_descriptor, mesh, _tensorialIntegrateTo<MeshType, ArrayT>(function_symbol_id, quadrature_descriptor, mesh,
AllCells<Dimension>{mesh.connectivity()}, value); AllCells<Dimension>{mesh.connectivity()}, value);
} else { } else {
_directIntegrateTo<MeshType, OutputArrayT>(function_symbol_id, quadrature_descriptor, mesh, _directIntegrateTo<MeshType, ArrayT>(function_symbol_id, quadrature_descriptor, mesh,
AllCells<Dimension>{mesh.connectivity()}, value); AllCells<Dimension>{mesh.connectivity()}, value);
} }
} }
template <typename MeshType, typename OutputArrayT> template <typename MeshType, template <typename DataType> typename ArrayT>
static PUGS_INLINE Array<OutputType> static PUGS_INLINE ArrayT<OutputType>
integrate(const FunctionSymbolId& function_symbol_id, integrate(const FunctionSymbolId& function_symbol_id,
const IQuadratureDescriptor& quadrature_descriptor, const IQuadratureDescriptor& quadrature_descriptor,
const MeshType& mesh, 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()) { if (quadrature_descriptor.isTensorial()) {
_tensorialIntegrateTo<MeshType, OutputArrayT>(function_symbol_id, quadrature_descriptor, mesh, _tensorialIntegrateTo<MeshType, ArrayT<OutputType>>(function_symbol_id, quadrature_descriptor, mesh,
CellList{cell_list}, value); CellList{cell_list}, value);
} else { } else {
_directIntegrateTo<MeshType, OutputArrayT>(function_symbol_id, quadrature_descriptor, mesh, CellList{cell_list}, _directIntegrateTo<MeshType, ArrayT<OutputType>>(function_symbol_id, quadrature_descriptor, mesh,
value); CellList{cell_list}, value);
} }
return value; return value;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment