Skip to content

Commit

Permalink
Merge pull request #6007 from tjhei/std-debug-checks
Browse files Browse the repository at this point in the history
turn on c++ standard library debug checks
  • Loading branch information
gassmoeller authored Aug 20, 2024
2 parents cfc86b8 + 92cf6bf commit a15f78a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,11 @@ if(${ASPECT_BUILD_RELEASE} STREQUAL "ON")
endif()
endif()

# turn on debug checks like invalid element access in c++ standard library:
if(${ASPECT_BUILD_DEBUG} STREQUAL "ON")
target_compile_definitions(${TARGET_EXE_DEBUG} PUBLIC "_GLIBCXX_ASSERTIONS")
endif()


# ##############################################################################
# Make sure we correctly link with external libraries
Expand Down
9 changes: 7 additions & 2 deletions source/particle/property/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,19 @@ namespace aspect
const std::vector<std::vector<Tensor<1,dim>>> &gradients,
typename ParticleHandler<dim>::particle_iterator_range &particles) const
{
const Vector<double> invalid_solution;
const std::vector<Tensor<1,dim>> invalid_gradient;

unsigned int i = 0;
for (typename ParticleHandler<dim>::particle_iterator particle = particles.begin();
particle != particles.end(); ++particle, ++i)
{
// call the deprecated version of this function
update_particle_property(data_position,
solution[i],
gradients[i],
(solution.size()>0) ?
solution[i] : invalid_solution,
(gradients.size()>0) ?
gradients[i] : invalid_gradient,
particle);
}
}
Expand Down

0 comments on commit a15f78a

Please sign in to comment.