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

Add tests for IntegrateOnCells

parent d1514df1
No related branches found
No related tags found
1 merge request!128Feature/unit tests
...@@ -150,10 +150,12 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu ...@@ -150,10 +150,12 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu
} }
break; break;
} }
// LCOV_EXCL_START
default: { default: {
invalid_cell = std::make_pair(true, cell_id); invalid_cell = std::make_pair(true, cell_id);
break; break;
} }
// LCOV_EXCL_STOP
} }
} else if constexpr (Dimension == 2) { } else if constexpr (Dimension == 2) {
switch (cell_type[cell_id]) { switch (cell_type[cell_id]) {
...@@ -181,10 +183,12 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu ...@@ -181,10 +183,12 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu
} }
break; break;
} }
// LCOV_EXCL_START
default: { default: {
invalid_cell = std::make_pair(true, cell_id); invalid_cell = std::make_pair(true, cell_id);
break; break;
} }
// LCOV_EXCL_STOP
} }
} else { } else {
static_assert(Dimension == 3); static_assert(Dimension == 3);
...@@ -218,8 +222,10 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu ...@@ -218,8 +222,10 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu
value[index] += qf.weight(i_point) * T.jacobianDeterminant(xi) * convert_result(std::move(result)); value[index] += qf.weight(i_point) * T.jacobianDeterminant(xi) * convert_result(std::move(result));
} }
} else { } else {
// LCOV_EXCL_START
throw NotImplementedError("integration on pyramid with non-quadrangular base (number of nodes " + throw NotImplementedError("integration on pyramid with non-quadrangular base (number of nodes " +
std::to_string(cell_to_node.size()) + ")"); std::to_string(cell_to_node.size()) + ")");
// LCOV_EXCL_STOP
} }
break; break;
} }
...@@ -279,8 +285,10 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu ...@@ -279,8 +285,10 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu
} }
} }
} else { } else {
// LCOV_EXCL_START
throw NotImplementedError("integration on diamond with non-quadrangular base (" + throw NotImplementedError("integration on diamond with non-quadrangular base (" +
std::to_string(cell_to_node.size()) + ")"); std::to_string(cell_to_node.size()) + ")");
// LCOV_EXCL_STOP
} }
break; break;
} }
...@@ -311,21 +319,25 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu ...@@ -311,21 +319,25 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu
} }
break; break;
} }
// LCOV_EXCL_START
default: { default: {
invalid_cell = std::make_pair(true, cell_id); invalid_cell = std::make_pair(true, cell_id);
break; break;
} }
// LCOV_EXCL_STOP
} }
} }
tokens.release(t); tokens.release(t);
}); });
// LCOV_EXCL_START
if (invalid_cell.first) { if (invalid_cell.first) {
std::ostringstream os; std::ostringstream os;
os << "invalid cell type for integration: " << name(cell_type[invalid_cell.second]); os << "invalid cell type for integration: " << name(cell_type[invalid_cell.second]);
throw UnexpectedError(os.str()); throw UnexpectedError(os.str());
} }
// LCOV_EXCL_STOP
} }
template <typename MeshType, typename OutputArrayT, typename ListTypeT> template <typename MeshType, typename OutputArrayT, typename ListTypeT>
...@@ -391,10 +403,12 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu ...@@ -391,10 +403,12 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu
} }
break; break;
} }
// LCOV_EXCL_START
default: { default: {
invalid_cell = std::make_pair(true, cell_id); invalid_cell = std::make_pair(true, cell_id);
break; break;
} }
// LCOV_EXCL_STOP
} }
} else if constexpr (Dimension == 2) { } else if constexpr (Dimension == 2) {
switch (cell_type[cell_id]) { switch (cell_type[cell_id]) {
...@@ -423,10 +437,12 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu ...@@ -423,10 +437,12 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu
} }
break; break;
} }
// LCOV_EXCL_START
default: { default: {
invalid_cell = std::make_pair(true, cell_id); invalid_cell = std::make_pair(true, cell_id);
break; break;
} }
// LCOV_EXCL_STOP
} }
} else { } else {
static_assert(Dimension == 3); static_assert(Dimension == 3);
...@@ -458,7 +474,9 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu ...@@ -458,7 +474,9 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu
value[index] += qf.weight(i_point) * T.jacobianDeterminant(xi) * convert_result(std::move(result)); value[index] += qf.weight(i_point) * T.jacobianDeterminant(xi) * convert_result(std::move(result));
} }
} else { } else {
// LCOV_EXCL_START
throw NotImplementedError("integration on pyramid with non-quadrangular base"); throw NotImplementedError("integration on pyramid with non-quadrangular base");
// LCOV_EXCL_STOP
} }
break; break;
} }
...@@ -512,8 +530,10 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu ...@@ -512,8 +530,10 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu
} }
} }
} else { } else {
// LCOV_EXCL_START
throw NotImplementedError("integration on diamond with non-quadrangular base (" + throw NotImplementedError("integration on diamond with non-quadrangular base (" +
std::to_string(cell_to_node.size()) + ")"); std::to_string(cell_to_node.size()) + ")");
// LCOV_EXCL_STOP
} }
break; break;
} }
...@@ -544,21 +564,25 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu ...@@ -544,21 +564,25 @@ class IntegrateOnCells<OutputType(InputType)> : public PugsFunctionAdapter<Outpu
} }
break; break;
} }
// LCOV_EXCL_START
default: { default: {
invalid_cell = std::make_pair(true, cell_id); invalid_cell = std::make_pair(true, cell_id);
break; break;
} }
// LCOV_EXCL_STOP
} }
} }
tokens.release(t); tokens.release(t);
}); });
// LCOV_EXCL_START
if (invalid_cell.first) { if (invalid_cell.first) {
std::ostringstream os; std::ostringstream os;
os << "invalid cell type for integration: " << name(cell_type[invalid_cell.second]); os << "invalid cell type for integration: " << name(cell_type[invalid_cell.second]);
throw UnexpectedError(os.str()); throw UnexpectedError(os.str());
} }
// LCOV_EXCL_STOP
} }
public: public:
......
...@@ -98,6 +98,7 @@ add_executable (unit_tests ...@@ -98,6 +98,7 @@ add_executable (unit_tests
test_GaussQuadratureDescriptor.cpp test_GaussQuadratureDescriptor.cpp
test_IfProcessor.cpp test_IfProcessor.cpp
test_IncDecExpressionProcessor.cpp test_IncDecExpressionProcessor.cpp
test_IntegrateOnCells.cpp
test_INodeProcessor.cpp test_INodeProcessor.cpp
test_ItemId.cpp test_ItemId.cpp
test_ItemType.cpp test_ItemType.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