Skip to content

Commit

Permalink
fixup: Kokkos math
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed Nov 1, 2024
1 parent 975974f commit 2bd1a17
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions examples/mechanics/compact_tension_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,14 @@ void crackBranchingExample( const std::string filename )
auto init_op = KOKKOS_LAMBDA( const int, const double x[3] )
{
// Thin rectangle
if ( x[0] < low_corner[1] + 0.25 * W + a && abs( x[1] ) < 0.5 * dy )
if ( x[0] < low_corner[1] + 0.25 * W + a &&
Kokkos::abs( x[1] ) < 0.5 * dy )
{
return false;
}
// Thick rectangle
else if ( x[0] < low_corner[1] + 0.25 * W && abs( x[1] ) < 25e-4 )
else if ( x[0] < low_corner[1] + 0.25 * W &&
Kokkos::abs( x[1] ) < 25e-4 )
{
return false;
}
Expand Down Expand Up @@ -140,8 +142,8 @@ void crackBranchingExample( const std::string filename )
auto ypos = x( pid, 1 );
auto distsq =
( xpos - x_pin ) * ( xpos - x_pin ) +
( std::abs( ypos ) - y_pin ) * ( std::abs( ypos ) - y_pin );
auto sign = std::abs( ypos ) / ypos;
( Kokkos::abs( ypos ) - y_pin ) * ( Kokkos::abs( ypos ) - y_pin );
auto sign = Kokkos::abs( ypos ) / ypos;

// pins' y-velocity
if ( distsq < R * R )
Expand Down Expand Up @@ -172,7 +174,8 @@ void crackBranchingExample( const std::string filename )
auto xpos = x( pid, 0 );
auto ypos = x( pid, 1 );
if ( ( xpos - x_pin ) * ( xpos - x_pin ) +
( std::abs( ypos ) - y_pin ) * ( std::abs( ypos ) - y_pin ) <
( Kokkos::abs( ypos ) - y_pin ) *
( Kokkos::abs( ypos ) - y_pin ) <
R * R )
f( pid, 1 ) = 0;
};
Expand Down

0 comments on commit 2bd1a17

Please sign in to comment.