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

Add tests for DiscreteFunctionIntegrator (globally)

Also fixed a type conversion error
parent ac95a8ca
No related branches found
No related tags found
1 merge request!138Fix a g++-9 warning
...@@ -73,26 +73,12 @@ DiscreteFunctionIntegrator::_integrateGlobally() const ...@@ -73,26 +73,12 @@ DiscreteFunctionIntegrator::_integrateGlobally() const
using MeshType = Mesh<Connectivity<Dimension>>; using MeshType = Mesh<Connectivity<Dimension>>;
std::shared_ptr mesh = std::dynamic_pointer_cast<const MeshType>(m_mesh); std::shared_ptr mesh = std::dynamic_pointer_cast<const MeshType>(m_mesh);
if constexpr (std::is_same_v<DataType, ValueType>) { static_assert(std::is_convertible_v<DataType, ValueType>);
return std::make_shared< return std::make_shared<
DiscreteFunctionP0<Dimension, ValueType>>(mesh, DiscreteFunctionP0<Dimension, ValueType>>(mesh,
IntegrateCellValue<DataType(TinyVector<Dimension>)>::template integrate< IntegrateCellValue<ValueType(TinyVector<Dimension>)>::template integrate<
MeshType>(m_function_id, *m_quadrature_descriptor, *mesh)); MeshType>(m_function_id, *m_quadrature_descriptor, *mesh));
} else {
static_assert(std::is_convertible_v<DataType, ValueType>);
CellValue<DataType> cell_data =
IntegrateCellValue<DataType(TinyVector<Dimension>)>::template integrate<MeshType>(m_function_id,
*m_quadrature_descriptor,
*mesh);
CellValue<ValueType> cell_value{mesh->connectivity()};
parallel_for(
mesh->numberOfCells(), PUGS_LAMBDA(const CellId cell_id) { cell_value[cell_id] = cell_data[cell_id]; });
return std::make_shared<DiscreteFunctionP0<Dimension, ValueType>>(mesh, cell_value);
}
} }
template <size_t Dimension, typename DataType, typename ValueType> template <size_t Dimension, typename DataType, typename ValueType>
......
...@@ -157,6 +157,7 @@ add_executable (unit_tests ...@@ -157,6 +157,7 @@ add_executable (unit_tests
add_executable (mpi_unit_tests add_executable (mpi_unit_tests
mpi_test_main.cpp mpi_test_main.cpp
test_Connectivity.cpp test_Connectivity.cpp
test_DiscreteFunctionIntegrator.cpp
test_DiscreteFunctionInterpoler.cpp test_DiscreteFunctionInterpoler.cpp
test_DiscreteFunctionInterpolerByZone.cpp test_DiscreteFunctionInterpolerByZone.cpp
test_DiscreteFunctionP0.cpp test_DiscreteFunctionP0.cpp
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment