Skip to content

Commit

Permalink
fix LinearTransform::setData
Browse files Browse the repository at this point in the history
  • Loading branch information
rrsettgast committed Oct 29, 2024
1 parent f06f420 commit d3c2a8e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
15 changes: 11 additions & 4 deletions src/geometry/mapping/LinearTransform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,22 @@ class LinearTransform
* @brief Sets the coordinates of the vertices of the cell
* @param[in] coords The coordinates of the vertices of the cell
*/
constexpr SHIVA_HOST_DEVICE SHIVA_FORCE_INLINE void setData( DataType const & coords )
template< typename T >
constexpr SHIVA_HOST_DEVICE SHIVA_FORCE_INLINE void setData( T const & coords )
{
for ( int a = 0; a < numVertices; ++a )

SupportIndexType index;
forRange( index = {0, 0, 0}, [&] ( auto const & aa )
{
int const a = aa.data[0];
int const b = aa.data[1];
int const c = aa.data[2];

for ( int i = 0; i < numDims; ++i )
{
m_vertexCoords[a][i] = coords[a][i];
m_vertexCoords(a,b,c,i) = coords[a + 2 * b + 4 * c][i];
}
}
});
}

private:
Expand Down
26 changes: 14 additions & 12 deletions src/geometry/mapping/unitTests/testLinearTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,23 @@ SHIVA_HOST_DEVICE auto makeLinearTransform( REAL_TYPE const (&X)[8][3] )
LagrangeBasis< double, 1, EqualSpacing >,
LagrangeBasis< double, 1, EqualSpacing > > > cell;

typename decltype(cell)::SupportIndexType index;
// typename decltype(cell)::SupportIndexType index;

auto & transformData = cell.getData();
// auto & transformData = cell.getData();

forRange( index = {0, 0, 0}, [&transformData, &X] ( auto const & i )
{
int const a = i.data[0];
int const b = i.data[1];
int const c = i.data[2];
cell.setData( X );

for ( int j = 0; j < 3; ++j )
{
transformData( a, b, c, j ) = X[ a + 2 * b + 4 * c ][j];
}
} );
// forRange( index = {0, 0, 0}, [&transformData, &X] ( auto const & i )
// {
// int const a = i.data[0];
// int const b = i.data[1];
// int const c = i.data[2];

// for ( int j = 0; j < 3; ++j )
// {
// transformData( a, b, c, j ) = X[ a + 2 * b + 4 * c ][j];
// }
// } );

return cell;
}
Expand Down

0 comments on commit d3c2a8e

Please sign in to comment.