Skip to content

Commit

Permalink
Merge pull request #28 from precice/develop
Browse files Browse the repository at this point in the history
Switch to dynamic error checking
  • Loading branch information
davidscn authored Jun 26, 2020
2 parents e16f4da + 4522fdb commit f58caee
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
12 changes: 8 additions & 4 deletions adapter/adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,14 @@ namespace Adapter
const VectorType & deal_to_precice,
VectorType & precice_to_deal)
{
Assert(dim == precice.getDimensions(),
ExcDimensionMismatch(dim, precice.getDimensions()));

Assert(dim > 1, ExcNotImplemented());
AssertThrow(
dim == precice.getDimensions(),
ExcMessage("The dimension of your solver needs to be consistent with the "
"dimension specified in your precice-config file. In case you "
"run one of the tutorials, the dimension can be specified via "
"cmake -D DIM=dim ."));

AssertThrow(dim > 1, ExcNotImplemented());

// get precice specific IDs from precice and store them in the class
// they are later needed for data transfer
Expand Down
13 changes: 7 additions & 6 deletions linear_elasticity/linear_elasticity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,12 @@ namespace Linear_Elasticity
// The IDs must not be the same:
std::string error_message(
"The interface_id cannot be the same as the clamped one");
Assert(clamped_mesh_id != interface_boundary_id, ExcMessage(error_message));
Assert(out_of_plane_clamped_mesh_id != interface_boundary_id,
ExcMessage(error_message));
Assert(interface_boundary_id == adapter.deal_boundary_interface_id,
ExcMessage("Wrong interface ID in the Adapter specified"));
AssertThrow(clamped_mesh_id != interface_boundary_id,
ExcMessage(error_message));
AssertThrow(out_of_plane_clamped_mesh_id != interface_boundary_id,
ExcMessage(error_message));
AssertThrow(interface_boundary_id == adapter.deal_boundary_interface_id,
ExcMessage("Wrong interface ID in the Adapter specified"));

// Iterate over all cells and set the IDs
for (const auto &cell : triangulation.active_cell_iterators())
Expand Down Expand Up @@ -695,7 +696,7 @@ namespace Linear_Elasticity

// Check, if the output directory exists
std::ifstream output_directory(case_path + "dealii_output");
Assert(
AssertThrow(
output_directory,
ExcMessage(
"Unable to find the output directory. "
Expand Down
10 changes: 5 additions & 5 deletions nonlinear_elasticity/nonlinear_elasticity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ namespace Nonlinear_Elasticity
{
// Assert here, since dimension information is not available in parameter
// class and the input is parsed as List
Assert(
AssertThrow(
(dim == 2 && body_force[2] == 0) || dim == 3,
ExcMessage(
"Setting body forces in z-direction for a two dimensional simulation has no effect"));
Expand Down Expand Up @@ -538,16 +538,16 @@ namespace Nonlinear_Elasticity
"condition?"))
}
// Check, whether the given IDs are mutually exclusive
Assert(
AssertThrow(
clamped_id != neumann_boundary_id,
ExcMessage(
"Boundary IDs must not be the same, for different boundary types."));
Assert(
AssertThrow(
boundary_interface_id != out_of_plane_clamped_mesh_id,
ExcMessage(
"Boundary IDs must not be the same, for different boundary types."));
Assert(boundary_interface_id == adapter.deal_boundary_interface_id,
ExcMessage("Wrong interface ID in the Adapter."));
AssertThrow(boundary_interface_id == adapter.deal_boundary_interface_id,
ExcMessage("Wrong interface ID in the Adapter."));

vol_reference = GridTools::volume(triangulation);
vol_current = vol_reference;
Expand Down

0 comments on commit f58caee

Please sign in to comment.