-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Core] Adding debug check in CheckAndCorrectZeroDiagonalValues
#12782
base: master
Are you sure you want to change the base?
[Core] Adding debug check in CheckAndCorrectZeroDiagonalValues
#12782
Conversation
kratos/spaces/ublas_space.h
Outdated
} | ||
} | ||
KRATOS_ERROR << "Diagonal term (" << Index << ", " << Index << ") is not defined in the system matrix" << std::endl; | ||
#else | ||
rA(Index, Index) = scale_factor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isnt this still some find
operation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, what alternative there is?. Only executed in debug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, i would use the following (surely to be slightly adapted to make it to compile)
auto pos = std::lower_bound(&Acolndices[col_begin],&Acolndices[col_end]);
if pos != &Acolndices[col_end] //it was found
rValues[pos - &Acolndices[col_begin]] = scale_factor;
#ifdef _DEBUG
else
KRATOS_ERROR ...
#endif
this code shall be a bit faster than what you have, and it will use a binary search
if you do not like this, there is a function "find_element(i,i)" which will do the same as calling the lower bound.
i think my version should be slightly faster because we already have col_begin and col_end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anycase looks like we have tests failing in full debug, hurray
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you take a look to what are the cases failing? to know if it is a realistic scenario or just something we use in the tests (my bet is that there are constraints ... )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With your code:
[ FAILED ] KratosCoreFastSuite.BasicDisplacementBlockBuilderAndSolver
[ FAILED ] KratosCoreFastSuite.BasicDisplacementBlockBuilderAndSolverWithZeroContribution
[ FAILED ] KratosCoreFastSuite.BasicDisplacementBlockBuilderAndSolverWithConstraints
[ FAILED ] KratosCoreFastSuite.BasicDisplacementBlockBuilderAndSolverWithInactiveConstraints
[ FAILED ] KratosCoreFastSuite.BasicDisplacementBlockBuilderAndSolverWithConstraintsAuxiliarNode
[ FAILED ] KratosCoreFastSuite.BasicDisplacementBlockBuilderAndSolverWithConstraintsAuxiliarNodeInverted
[ FAILED ] KratosCoreFastSuite.BasicDisplacementBlockBuilderAndSolverAllDoFsMaster
[ FAILED ] KratosCoreFastSuite.BasicDisplacementBlockBuilderAndSolverAllDoFsMasterFromStructureSide
[ FAILED ] KratosCoreFastSuite.BasicDisplacementEliminationBuilderAndSolverWithZeroContribution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my code was wrong. it should be
pos - &Acolndices[0]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, still failing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, still failing
Wait it was my fault, testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay now it only fails in Debug (in my machine) and the failing tests are the same:
[ FAILED ] KratosCoreFastSuite.BasicDisplacementBlockBuilderAndSolver
[ FAILED ] KratosCoreFastSuite.BasicDisplacementBlockBuilderAndSolverWithZeroContribution
[ FAILED ] KratosCoreFastSuite.BasicDisplacementBlockBuilderAndSolverWithConstraints
[ FAILED ] KratosCoreFastSuite.BasicDisplacementBlockBuilderAndSolverWithInactiveConstraints
[ FAILED ] KratosCoreFastSuite.BasicDisplacementBlockBuilderAndSolverAllDoFsMaster
[ FAILED ] KratosCoreFastSuite.BasicDisplacementEliminationBuilderAndSolverWithZeroContribution
📝 Description
Initial work for #12768.
Basically checks in debug that the daigonal terms exist instead of directly asign them. This will not actually fix the issue in not initialzed diagonals, but this is a first step.
🆕 Changelog
CheckAndCorrectZeroDiagonalValues