static_cast in pkg/dem/GlobalStiffnessTimeStepper.cpp, possibility of using zero stiffness (e.g. divide by zero) in four tests.

This issue arises from discussion in !618 (merged), if necessary we could split this issue into a couple separate issues. In case if these things turn out to be too unrelated.

Following tests are affected:

  1. check_TwoPhaseFlowEngine_PressureInjection.py
  2. checkTestTriax.py
  3. checkDEM-PFVPressureInjection.py
  4. DEM-PFV-check.py

The following discussions from !618 (merged) should be addressed:

  • @cosurgi started a discussion: (+1 comment)

    Wow, thanks for the cleanup Anton :)

    I noticed now that kr and ktw are actually declared in several places:

    1. CohFrictPhys
    2. MindlinPhys
    3. InelastCohFrictPhys

    If the inheritance tree was rearranged a bit, this could be unified. But I guess that's a matter of another merge request :)

  • @cosurgi started a discussion: (+2 comments)

    yeah. In fact static_cast is dangerous. It forces to interpret the pointed-to class as the one with the memory layout of casted-to class (or the classes deriving from it). The throws discovered by Anton could be an indication that we have a bug hiding here. Perhaps dynamic_cast would be better here. Also we had some boost dynamic cast macros, not much used recently (that #97 still wasn't cleaned up). The idea was to use dynamic casts in debug builds and static casts in release builds.

    Could be possible that some of the already opened issues are because of this line.

    Hm, we have some problems here. Although the MR opened by Klaus is very innocent, and is good in fact. Should we defer this stuff to another issue and fix it later?

Edited by Janek Kozicki