Skip to content
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

fixes for using shiva as submodule #36

Merged
merged 6 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 8 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ if( NOT is_submodule )
#include( cmake/SetupTPL.cmake )
else()
if( NOT BLT_LOADED )
message( FATAL_ERROR "When using LvArray as a submodule you must have already loaded BLT." )
message( FATAL_ERROR "When using Shiva as a submodule you must have already loaded BLT." )
endif()
include( cmake/CMakeBasics.cmake )
endif()
Expand All @@ -70,8 +70,12 @@ add_subdirectory( src )
add_subdirectory( tpl/camp )
target_compile_options( camp PRIVATE "-Wno-shadow")

# if( SHIVA_ENABLE_DOCS )
add_subdirectory( docs )
# endif()
configure_file(tpl/camp/include/camp/config.in.hpp
${PROJECT_BINARY_DIR}/include/camp/config.hpp)


if( SHIVA_ENABLE_DOCS )
add_subdirectory( docs )
endif()


2 changes: 1 addition & 1 deletion cmake/shiva-config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if( NOT SHIVA_FOUND )
include(${CMAKE_CURRENT_LIST_DIR}/../../../lib/cmake/shiva/shiva-targets.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../../../lib/cmake/shiva/shiva.cmake)


set(SHIVA_FOUND TRUE)
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ install( FILES ${shiva_headers}


install( TARGETS shiva
EXPORT shiva-targets
EXPORT shiva
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib )

install( EXPORT shiva-targets
install( EXPORT shiva
DESTINATION lib/cmake/shiva )

shiva_add_code_checks( PREFIX shiva
Expand Down
14 changes: 9 additions & 5 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set( common_sources
)

if( ENABLE_HIP )
list( APPEND common_dependencies blt::hip )
list( APPEND common_dependencies blt::hip camp )
endif()

if( ENABLE_CUDA )
Expand All @@ -30,24 +30,28 @@ blt_add_library( NAME common
DEPENDS_ON ${common_dependencies}
)



target_include_directories( common
INTERFACE
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src> )
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include> )

target_include_directories( common
SYSTEM INTERFACE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/tpl/camp/include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/tpl/camp/include> )


install( FILES ${common_headers}
DESTINATION include/common )

install( TARGETS common
EXPORT shiva-targets
EXPORT shiva
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib )

add_subdirectory( unitTests )
if( SHIVA_ENABLE_UNIT_TESTS )
add_subdirectory( unitTests )
endif()
7 changes: 4 additions & 3 deletions src/discretizations/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ install( FILES ${discretizations_headers}
DESTINATION include/discretizations )

install( TARGETS discretizations
EXPORT shiva-targets
EXPORT shiva
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib )


add_subdirectory( unitTests )
if( SHIVA_ENABLE_UNIT_TESTS )
add_subdirectory( unitTests )
endif()
6 changes: 4 additions & 2 deletions src/functions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ foreach( _header ${functions_headers} )
endforeach()

install( TARGETS functions
EXPORT shiva-targets
EXPORT shiva
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib )


add_subdirectory( unitTests )
if( SHIVA_ENABLE_UNIT_TESTS )
add_subdirectory( unitTests )
endif()
9 changes: 6 additions & 3 deletions src/geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ endforeach()
# DESTINATION include/geometry )

install( TARGETS geometry
EXPORT shiva-targets
EXPORT shiva
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib )

add_subdirectory( mapping/unitTests )
add_subdirectory( shapes/unitTests )

if( SHIVA_ENABLE_UNIT_TESTS )
add_subdirectory( mapping/unitTests )
add_subdirectory( shapes/unitTests )
endif()
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
Loading