Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/cut/4C_cut_kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2200,16 +2200,22 @@ namespace Cut::Kernel
if (det < 1.0e-16) std::cout << "!!! determinant of jacobian is smaller than 1.0e-16 !!!\n";
}

if (det < 1.0e-16 && det > 1.0e-16)
if (det < -1.0e-16)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use a numerical limit here?

{
std::stringstream msg;
msg << "Determinant in compute position is negative: " << det;
FOUR_C_THROW("{}", msg.str());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FOUR_C_THROW can format strings directly

Suggested change
FOUR_C_THROW("{}", msg.str());
FOUR_C_THROW("Determinant in compute position is negative: {}", det);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and no.
A std::formatter<T> specialization is neccessary for every {} argument type. Since FloatType is a template parameter that can be instantiated with things like double, Sacado::Fad::DFad<double>, or Core::CLN::ClnWrapper, there is no generic formatter for it. To circumvent adding those at the moment, the workaround with the operator<< which is available for all template types.

}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same applies here.

if (Core::MathOperations<FloatType>::abs(det) < 1.0e-16)
{
#if EXTENDED_CUT_DEBUG_OUTPUT
std::cout << "Determinant in compute position is very close to zero" << std::endl;
std::cout << "Determinant in compute position is very close to zero" << std::endl;
#endif
if (Core::MathOperations<FloatType>::abs(det) == 0.0) // here might lie problem for the cln
{
/* then calculation of a normal to a line like this makes no sense at
* all! */
#if EXTENDED_CUT_DEBUG_OUTPUT
std::cout << "Absolute value of the determinant is zero " << std::endl;
std::cout << "Absolute value of the determinant is close to zero" << std::endl;
#endif
zeroarea_ = true;
return false;
Expand Down
Loading