Skip to content

Commit

Permalink
Merge pull request #5464 from gassmoeller/fix_assert_semicolons
Browse files Browse the repository at this point in the history
Add semicolon to asserts that were missing it.
  • Loading branch information
tjhei authored Oct 23, 2023
2 parents 0e7f4ae + a71dec7 commit 4fc9e5e
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 37 deletions.
2 changes: 1 addition & 1 deletion source/initial_temperature/continental_geotherm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ namespace aspect

// To obtain the radioactive heating rate in W/kg, we divide the volumetric heating rate by density
AssertThrow(heat_productivities.size() == 3 && densities.size() == 3 && conductivities.size() == 3,
ExcMessage("The entries for density, conductivity and heat production do not match with the expected number of layers (3)."))
ExcMessage("The entries for density, conductivity and heat production do not match with the expected number of layers (3)."));

for (unsigned int i = 0; i<3; ++i)
heat_productivities[i] /= densities[i];
Expand Down
2 changes: 1 addition & 1 deletion source/material_model/rheology/strain_dependent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ namespace aspect
ExcMessage("A material model with strain weakening using the full strain tensor only works if there are "
"compositional fields called sij, with i=1,..,dim and j=1,...,dim listed in the following order: "
"s11, s12, s21, s22."));
AssertThrow(n_s22 == n_s11+s-1, ExcMessage("The strain tensor components should be represented by consecutive fields."))
AssertThrow(n_s22 == n_s11+s-1, ExcMessage("The strain tensor components should be represented by consecutive fields."));
}
if (dim==3)
{
Expand Down
6 changes: 3 additions & 3 deletions source/material_model/utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -608,17 +608,17 @@ namespace aspect
{
first_natural_variable = column_name;
in >> column_name;
AssertThrow(column_name == "T(K)", ExcMessage("The second column name in PerpleX lookup file " + filename + " should be T(K)."))
AssertThrow(column_name == "T(K)", ExcMessage("The second column name in PerpleX lookup file " + filename + " should be T(K)."));
}
else if (column_name == "T(K)")
{
first_natural_variable = column_name;
in >> column_name;
AssertThrow(column_name == "P(bar)", ExcMessage("The second column name in PerpleX lookup file " + filename + " should be P(bar)."))
AssertThrow(column_name == "P(bar)", ExcMessage("The second column name in PerpleX lookup file " + filename + " should be P(bar)."));
}
else
{
AssertThrow(false, ExcMessage("The first column name in the PerpleX lookup file " + filename + " should be P(bar) or T(K)."))
AssertThrow(false, ExcMessage("The first column name in the PerpleX lookup file " + filename + " should be P(bar) or T(K)."));
}

for (unsigned int n=2; n<n_columns; ++n)
Expand Down
8 changes: 4 additions & 4 deletions source/particle/property/crystal_preferred_orientation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ namespace aspect
{
#ifdef ASPECT_WITH_WORLD_BUILDER
AssertThrow(false,
ExcMessage("Not implemented."))
ExcMessage("Not implemented."));
#else
AssertThrow(false,
ExcMessage("The world builder was requested but not provided. Make sure that aspect is "
"compiled with the World Builder and that you provide a world builder file in the input."))
"compiled with the World Builder and that you provide a world builder file in the input."));
#endif
}
else
Expand Down Expand Up @@ -1139,7 +1139,7 @@ namespace aspect
{
AssertThrow(false,
ExcMessage("The CPO derivatives algorithm needs to be one of the following: "
"Spin tensor, D-Rex 2004."))
"Spin tensor, D-Rex 2004."));
}

const std::string temp_advection_method = prm.get("Property advection method");
Expand Down Expand Up @@ -1206,7 +1206,7 @@ namespace aspect
AssertThrow(false,
ExcMessage("The fabric needs to be assigned one of the following comma-delimited values: Olivine: Karato 2008, "
"Olivine: A-fabric, Olivine: B-fabric, Olivine: C-fabric, Olivine: D-fabric,"
"Olivine: E-fabric, Enstatite, Passive."))
"Olivine: E-fabric, Enstatite, Passive."));
}
}

Expand Down
6 changes: 3 additions & 3 deletions source/postprocess/crystal_preferred_orientation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ namespace aspect

AssertThrow (out, ExcMessage(std::string("Trying to write to file <") +
filename +
">, but the file can't be opened!"))
">, but the file can't be opened!"));

// now write and then move the tmp file to its final destination
// if necessary
Expand Down Expand Up @@ -747,7 +747,7 @@ namespace aspect
Output cpo_fabric_instruction = string_to_output_enum(split_raw_cpo_instructions[1]);

AssertThrow(cpo_fabric_instruction != Output::not_found,
ExcMessage("Value \""+ write_raw_cpo_list[i] +"\", set in \"Write out raw cpo data\", is not a correct option."))
ExcMessage("Value \""+ write_raw_cpo_list[i] +"\", set in \"Write out raw cpo data\", is not a correct option."));

if (cpo_fabric_instruction == Output::EulerAngles)
found_euler_angles = true;
Expand Down Expand Up @@ -790,7 +790,7 @@ namespace aspect
Output cpo_fabric_instruction = string_to_output_enum(split_draw_volume_weighted_cpo_instructions[1]);

AssertThrow(cpo_fabric_instruction != Output::not_found,
ExcMessage("Value \""+ write_draw_volume_weighted_cpo_list[i] +"\", set in \"Write out draw volume weighted cpo data\", is not a correct option."))
ExcMessage("Value \""+ write_draw_volume_weighted_cpo_list[i] +"\", set in \"Write out draw volume weighted cpo data\", is not a correct option."));

if (cpo_fabric_instruction == Output::RotationMatrix)
found_rotation_matrix = true;
Expand Down
2 changes: 1 addition & 1 deletion source/postprocess/particles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ namespace aspect

AssertThrow (out, ExcMessage(std::string("Trying to write to file <") +
filename +
">, but the file can't be opened!"))
">, but the file can't be opened!"));

// now write and then move the tmp file to its final destination
// if necessary
Expand Down
2 changes: 1 addition & 1 deletion source/postprocess/visualization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ namespace aspect

AssertThrow (out, ExcMessage(std::string("Trying to write to file <") +
filename +
">, but the file can't be opened!"))
">, but the file can't be opened!"));

// now write and then move the tmp file to its final destination
// if necessary
Expand Down
2 changes: 1 addition & 1 deletion source/simulator/core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ namespace aspect
geometry_model->create_coarse_mesh (triangulation);
Assert (triangulation.all_reference_cells_are_hyper_cube(),
ExcMessage ("ASPECT only supports meshes that are composed of quadrilateral "
"or hexahedral cells."))
"or hexahedral cells."));
global_Omega_diameter = GridTools::diameter (triangulation);

// After creating the coarse mesh, initialize mapping cache if one is used
Expand Down
18 changes: 11 additions & 7 deletions source/simulator/solver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -549,13 +549,15 @@ namespace aspect
#if DEAL_II_VERSION_GTE(9,6,0)
{
const unsigned int block_vel = introspection.block_indices.velocities;
(void) block_vel;

Assert (block_vel == 0, ExcNotImplemented());
if (parameters.use_direct_stokes_solver == false)
{
const unsigned int block_p = (parameters.include_melt_transport) ?
introspection.variable("fluid pressure").block_index
: introspection.block_indices.pressure;
(void) block_p;
Assert (block_p == 1, ExcNotImplemented());
}
}
Expand Down Expand Up @@ -649,13 +651,15 @@ namespace aspect
catch (const std::exception &exc)
{
if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
AssertThrow (false,
ExcMessage (std::string("The direct Stokes solver "
"did not succeed. It reported the following error:\n\n")
+
exc.what()))
else
throw QuietException();
{
AssertThrow (false,
ExcMessage (std::string("The direct Stokes solver "
"did not succeed. It reported the following error:\n\n")
+
exc.what()));
}
else
throw QuietException();
}


Expand Down
2 changes: 1 addition & 1 deletion source/volume_of_fluid/handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ namespace aspect
ExcMessage("Volume of Fluid Interface Tracking is currently incompatible with the Free Surface implementation."));

AssertThrow(!this->get_parameters().include_melt_transport,
ExcMessage("Volume of Fluid Interface Tracking has not been tested with melt transport yet, so inclusion of both is currently disabled."))
ExcMessage("Volume of Fluid Interface Tracking has not been tested with melt transport yet, so inclusion of both is currently disabled."));

if ( this->get_parameters().initial_adaptive_refinement > 0 ||
this->get_parameters().adaptive_refinement_interval > 0 )
Expand Down
16 changes: 9 additions & 7 deletions source/volume_of_fluid/solver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ namespace aspect
catch (const std::exception &exc)
{
if (Utilities::MPI::this_mpi_process(this->get_mpi_communicator()) == 0)
AssertThrow (false,
ExcMessage (std::string("The iterative advection solver "
"did not converge. It reported the following error:\n\n")
+
exc.what()))
else
throw QuietException();
{
AssertThrow (false,
ExcMessage (std::string("The iterative advection solver "
"did not converge. It reported the following error:\n\n")
+
exc.what()));
}
else
throw QuietException();
}

sim.current_constraints.distribute (distributed_solution);
Expand Down
12 changes: 5 additions & 7 deletions tests/solidus_initial_conditions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ namespace aspect
/**
* Return the initial temperature as a function of position.
*/
virtual
double initial_temperature (const Point<dim> &position) const;
double initial_temperature (const Point<dim> &position) const override;

/**
* Declare the parameters this class takes through input files.
Expand All @@ -108,9 +107,8 @@ namespace aspect
/**
* Read the parameters this class declares from the parameter file.
*/
virtual
void
parse_parameters (ParameterHandler &prm);
parse_parameters (ParameterHandler &prm) override;

private:
/**
Expand Down Expand Up @@ -193,7 +191,7 @@ namespace aspect
else if (T_Unit!="K")
{
AssertThrow(false,ExcMessage ("Unit of the first column of melting curve data "
"has to be one of the following: C/K."))
"has to be one of the following: C/K."));
}

is_radius=false; // Second column is pressure
Expand All @@ -208,8 +206,8 @@ namespace aspect
p*=1.e3; // km to meters
else if (P_Unit!="m")
AssertThrow(false,ExcMessage ("Unit of the second column of melting curve data "
"has to be one of the following: Pa/GPa/km/m."))
}
"has to be one of the following: Pa/GPa/km/m."));
}
T_array.push_back(T);
P_or_R_array.push_back(p);
n_points++;
Expand Down

0 comments on commit 4fc9e5e

Please sign in to comment.