Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Configure main build
run: >
GTEST_ROOT=/usr/local
cmake -B ./build -DCMAKE_BUILD_TYPE=Release -DUSE_FORTRAN=ON
cmake -B ./build -DCMAKE_BUILD_TYPE=Release -DUSE_VERTEXOBJ=ON

- name: Build binaries and execute tests
run: cmake --build ./build --target check
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
#
# This file is part of FEDEM - https://openfedem.org

################################################################################
# This is the top-level cmake project file for the Fedem Foundation modules.
# Its main purpose is to manage the build and execution of associated tests,
# which typically is not performed when included as a sub-module.
################################################################################

cmake_minimum_required ( VERSION 2.8...3.10 )

# Project setup

set ( APPLICATION_ID fedemKernel )
set ( APPLICATION_ID fedemFoundation )
set ( DOMAIN_ID FEDEM )
set ( PACKAGE_ID FOUNDATION )

Expand All @@ -17,7 +23,8 @@ option ( USE_VTFAPI "Build with VTF API included" OFF )
option ( USE_MEMPOOL "Use memory pool for heap allocation in FE library" OFF )
option ( USE_PROFILER "Use CPU and Memory profiler" OFF )
option ( USE_REFCOUNT "Use reference counting in FFlLib" OFF )
mark_as_advanced ( USE_FORTRAN USE_MEMPOOL USE_PROFILER )
option ( USE_VERTEXOBJ "Build FFlLib with visualization classes" OFF )
mark_as_advanced ( USE_FORTRAN USE_MEMPOOL USE_PROFILER USE_VERTEXOBJ )

if ( USE_FORTRAN)
project ( ${APPLICATION_ID} CXX Fortran )
Expand Down Expand Up @@ -57,6 +64,7 @@ if ( BUILD_TESTS )
include ( pFUnit ) # Using the pFUnit test framework for Fortran unit tests
endif ( USE_FORTRAN )

set ( BUILD_FOUNDATION_TESTS ON ) # Include the Fedem Foundation unit tests
endif ( BUILD_TESTS )

add_subdirectory ( src )
10 changes: 5 additions & 5 deletions src/FFaFunctionLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ set ( LIB_ID FFaFunctionLib )
set ( LIB_ID_LIST )
if ( "${APPLICATION_ID}" STREQUAL "fedemKernel" )
set ( LIB_ID_LIST FFaFunctionDLL )
if ( BUILD_TESTS )
list ( APPEND LIB_ID_LIST FFaFunctionTests )
endif ( BUILD_TESTS )
endif ( "${APPLICATION_ID}" STREQUAL "fedemKernel" )
if ( BUILD_FOUNDATION_TESTS )
list ( APPEND LIB_ID_LIST FFaFunctionTests )
endif ( BUILD_FOUNDATION_TESTS )
set ( UNIT_ID ${DOMAIN_ID}_${PACKAGE_ID}_${LIB_ID} )

message ( STATUS "INFORMATION : Processing unit ${UNIT_ID}" )
Expand Down Expand Up @@ -65,8 +65,8 @@ foreach ( FILE ${F90_FILE_LIST} )
list ( APPEND F90_SOURCE_FILES ${FILE}.f90 )
endforeach ( FILE ${F90_FILE_LIST} )

option ( USE_OPENMP "Build with OpenMP-parallelisation of wave functions" false )
option ( USE_CWAVE "Use plugin for nonlinear wave functions (Univ. of Southampton)" false )
option ( USE_OPENMP "Build with OpenMP-parallelisation of wave functions" OFF )
option ( USE_CWAVE "Use plugin for nonlinear wave functions (Univ. of Southampton)" OFF )
mark_as_advanced ( USE_OPENMP USE_CWAVE )

set ( DEPENDENCY_LIST FFaMathExpr FiDeviceFunctions FFaAlgebra )
Expand Down
10 changes: 5 additions & 5 deletions src/FFaLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ if ( USE_PROFILER )
endif ( USE_PROFILER )
if ( "${APPLICATION_ID}" STREQUAL "fedemKernel" )
list ( APPEND LIB_ID_LIST FFaCmdLineArg )
if ( BUILD_TESTS )
list ( APPEND LIB_ID_LIST FFaTests )
endif ( BUILD_TESTS )
else ( "${APPLICATION_ID}" STREQUAL "fedemKernel" )
# These libraries are used by the GUI only
if ( "${APPLICATION_ID}" STREQUAL "fedemGui" )
if ( "${APPLICATION_ID}" STREQUAL "fedemGui" OR BUILD_FOUNDATION_TESTS )
list ( APPEND LIB_ID_LIST FFaCmdLineArg )
endif ( "${APPLICATION_ID}" STREQUAL "fedemGui" )
endif ( "${APPLICATION_ID}" STREQUAL "fedemGui" OR BUILD_FOUNDATION_TESTS )
if ( USE_CONNECTORS )
list ( APPEND LIB_ID_LIST FFaGeometry )
endif ( USE_CONNECTORS )
list ( APPEND LIB_ID_LIST FFaContainers FFaDynCalls FFaTypeCheck )
endif ( "${APPLICATION_ID}" STREQUAL "fedemKernel" )
if ( BUILD_FOUNDATION_TESTS )
list ( APPEND LIB_ID_LIST FFaTests )
endif ( BUILD_FOUNDATION_TESTS )
set ( UNIT_ID ${DOMAIN_ID}_${PACKAGE_ID}_${LIB_ID} )

if ( USE_PROFILER )
Expand Down
4 changes: 2 additions & 2 deletions src/FFaLib/FFaTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if ( GTest_FOUND )
add_executable ( test_FFa test_FFa.C BodyTest.C )
add_executable ( test_FFaEnum test_FFaEnum.C )
add_executable ( test_FFaVersion test_FFaVersion.C )
add_cpp_test ( test_FFa FFaAlgebra )
add_cpp_test ( test_FFa FFaAlgebra FFaOS )
add_cpp_test ( test_FFaEnum FFaString )
add_cpp_test ( test_FFaVersion FFaDefinitions )
endif ( GTest_FOUND )
Expand All @@ -26,7 +26,7 @@ endif ( GTest_FOUND )
add_executable ( ${LIB_ID} FFaTest.C BodyTest.C GeometryTest.C )
add_executable ( cad2ftc cad2ftc.C )
target_link_libraries ( ${LIB_ID} FFaAlgebra FFaCmdLineArg )
target_link_libraries ( cad2ftc FFaAlgebra )
target_link_libraries ( cad2ftc FFaAlgebra FFaOS )
if ( TARGET FFaGeometry )
target_link_libraries ( ${LIB_ID} FFaGeometry )
string ( APPEND CMAKE_CXX_FLAGS " -DFT_HAS_GEOMETRY" )
Expand Down
4 changes: 2 additions & 2 deletions src/FFaMathExpr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

set ( LIB_ID FFaMathExpr )
set ( LIB_ID_LIST )
if ( "${APPLICATION_ID}" STREQUAL "fedemKernel" AND BUILD_TESTS )
if ( BUILD_FOUNDATION_TESTS )
set ( LIB_ID_LIST FFaMathExprTests )
endif ( "${APPLICATION_ID}" STREQUAL "fedemKernel" AND BUILD_TESTS )
endif ( BUILD_FOUNDATION_TESTS )
set ( UNIT_ID ${DOMAIN_ID}_${PACKAGE_ID}_${LIB_ID} )

message ( STATUS "INFORMATION : Processing unit ${UNIT_ID}" )
Expand Down
45 changes: 17 additions & 28 deletions src/FFlLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@

set ( LIB_ID FFlLib )
set ( LIB_ID_LIST FFlFEParts FFlIOAdaptors )
if ( "${APPLICATION_ID}" STREQUAL "fedemKernel" AND BUILD_TESTS )
if ( BUILD_FOUNDATION_TESTS )
list ( APPEND LIB_ID_LIST FFlTests )
endif ( "${APPLICATION_ID}" STREQUAL "fedemKernel" AND BUILD_TESTS )
endif ( BUILD_FOUNDATION_TESTS )
set ( UNIT_ID ${DOMAIN_ID}_${PACKAGE_ID}_${LIB_ID} )

message ( STATUS "INFORMATION : Processing unit ${UNIT_ID}" )

set ( USE_STRAINCOAT TRUE )

set ( USE_STRAINCOAT ON )
set ( USE_FORTRAN_INTERFACE OFF )

if ( USE_FORTRAN )
if ( "${APPLICATION_ID}" STREQUAL "fedemKernel" OR BUILD_FOUNDATION_TESTS )
set ( USE_FORTRAN_INTERFACE ON )
endif ( "${APPLICATION_ID}" STREQUAL "fedemKernel" OR BUILD_FOUNDATION_TESTS )
endif ( USE_FORTRAN )

if ( USE_VTFAPI )
find_package ( VTFAPI )
Expand Down Expand Up @@ -84,15 +92,6 @@ set ( HEADER_FILE_LIST FFlFEResultBase FFlField FFlInit
FFlLinkCSMask FFlReference FFlTypeInfoSpec
)

## Pure implementation files, i.e., source files without corresponding header
set ( SOURCE_FILE_LIST )
if ( "${APPLICATION_ID}" STREQUAL "fedemKernel" AND USE_FORTRAN )
set ( SOURCE_FILE_LIST FFlLinkHandler_F )
endif ( "${APPLICATION_ID}" STREQUAL "fedemKernel" AND USE_FORTRAN )

## Fortran 90 source files
set ( F90_FILE_LIST FFlLinkHandlerInterface )


foreach ( FILE ${COMPONENT_FILE_LIST} )
list ( APPEND CPP_SOURCE_FILES ${FILE}.C )
Expand All @@ -103,21 +102,9 @@ foreach ( FILE ${HEADER_FILE_LIST} )
list ( APPEND CPP_HEADER_FILES ${FILE}.H )
endforeach ( FILE ${HEADER_FILE_LIST} )

foreach ( FILE ${SOURCE_FILE_LIST} )
list ( APPEND CPP_SOURCE_FILES ${FILE}.C )
endforeach ( FILE ${SOURCE_FILE_LIST} )

foreach ( FILE ${F90_FILE_LIST} )
list ( APPEND F90_SOURCE_FILES ${FILE}.f90 )
endforeach ( FILE ${F90_FILE_LIST} )


set ( DEPENDENCY_LIST FFlFEParts FFaAlgebra FFaDefinitions )

if ( "${APPLICATION_ID}" STREQUAL "fedemKernel" AND USE_FORTRAN )
list ( INSERT DEPENDENCY_LIST 0 FFlIOAdaptors )
endif ( "${APPLICATION_ID}" STREQUAL "fedemKernel" AND USE_FORTRAN )

if ( USE_MEMPOOL )
list ( APPEND DEPENDENCY_LIST FFaPatterns )
endif ( USE_MEMPOOL )
Expand All @@ -133,7 +120,9 @@ endif ( VTFAPI_FOUND )
add_library ( ${LIB_ID} ${CPP_SOURCE_FILES} ${CPP_HEADER_FILES} )
target_link_libraries ( ${LIB_ID} ${DEPENDENCY_LIST} )

if ( "${APPLICATION_ID}" STREQUAL "fedemKernel" AND USE_FORTRAN )
add_library ( ${LIB_ID}_F ${F90_SOURCE_FILES} )
target_link_libraries ( ${LIB_ID}_F ${LIB_ID} FFaCmdLineArg )
endif ( "${APPLICATION_ID}" STREQUAL "fedemKernel" AND USE_FORTRAN )
if ( USE_FORTRAN_INTERFACE )
add_library ( ${LIB_ID}_FC FFlLinkHandler_F.C )
target_link_libraries ( ${LIB_ID}_FC FFlIOAdaptors FFaCmdLineArg )
add_library ( ${LIB_ID}_F FFlLinkHandlerInterface.f90 )
target_link_libraries ( ${LIB_ID}_F ${LIB_ID}_FC )
endif ( USE_FORTRAN_INTERFACE )
2 changes: 1 addition & 1 deletion src/FFlLib/FFlIOAdaptors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ endforeach ( FILE ${SOURCE_FILE_LIST} )


add_library ( ${LIB_ID} ${CPP_SOURCE_FILES} ${CPP_HEADER_FILES} )
target_link_libraries ( ${LIB_ID} FFlLib Admin ${VKI_LIBRARY} ${VTF_LIBRARY} )
target_link_libraries ( ${LIB_ID} FFlLib FFaOS Admin ${VKI_LIBRARY} ${VTF_LIBRARY} )
12 changes: 12 additions & 0 deletions src/FFlLib/FFlLinkHandler.C
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,18 @@ FFlNode* FFlLinkHandler::getNodeConnectivity(int ID, Strings& elmList) const


#ifdef FT_USE_VERTEX
bool FFlLinkHandler::coLinearVertices(size_t i, size_t j, size_t k,
double tolerance) const
{
if (i >= myVertices.size() || j > myVertices.size() || k > myVertices.size())
return false;

FaVec3 v1 = *myVertices[j] - *myVertices[k];
FaVec3 v2 = *myVertices[i] - *myVertices[j];
return v1.angle(v2) < tolerance;
}


FFlVertex* FFlLinkHandler::getVertex(size_t i) const
{
return i < myVertices.size() ? static_cast<FFlVertex*>(myVertices[i]) : NULL;
Expand Down
3 changes: 2 additions & 1 deletion src/FFlLib/FFlLinkHandler.H
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ public:
#ifdef FT_USE_VERTEX
size_t getVertexCount() const { return myVertices.size(); }
const VertexVec& getVertexes() const { return myVertices; }
const FaVec3& getVertexPos(size_t idx) const { return *myVertices[idx]; }
bool coLinearVertices(size_t i1, size_t i2, size_t i3,
double tolerance = 1.0e-8) const;
FFlVertex* getVertex(size_t idx) const;
void addVertex(FFlVertex* aVertex);

Expand Down
26 changes: 18 additions & 8 deletions src/FFlLib/FFlTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,35 @@ add_executable ( cad2vtf cad2vtf.C )
target_link_libraries ( ${LIB_ID} FFlIOAdaptors )
target_link_libraries ( fem2vtf FFlIOAdaptors )
target_link_libraries ( cad2vtf FFlIOAdaptors )
if ( USE_FORTRAN )
add_executable ( test_fflmemchk testMemchk.f90 )
target_link_libraries ( test_fflmemchk FFlLib_F )
endif ( USE_FORTRAN )
if ( USE_FORTRAN_INTERFACE )
add_executable ( test_FFlMemChk testMemchk.f90 )
target_link_libraries ( test_FFlMemChk FFlLib_F )
endif ( USE_FORTRAN_INTERFACE )

if ( pFUnit_FOUND )
if ( pFUnit_FOUND AND USE_FORTRAN_INTERFACE )
# Add some unit tests using pFUnit (executed via ctest)
enable_fortran_tests ()
unset ( CMAKE_Fortran_MODULE_DIRECTORY )
include_directories ( ${PROJECT_BINARY_DIR}/f90_modules )
add_fortran_test ( test_spring testSpring.pf FFlLib_F )
endif ( pFUnit_FOUND )
endif ( pFUnit_FOUND AND USE_FORTRAN_INTERFACE )

if ( GTest_FOUND )
# Add some unit tests using gtest (executed via ctest)
string ( APPEND CMAKE_CXX_FLAGS " -DFT_HAS_GTEST" )
add_executable ( test_invert testInvert.C )
add_cpp_test ( test_invert FFlLib )
add_executable ( test_FEparser testParser.C )
add_cpp_test ( test_FEparser FFlIOAdaptors )
add_executable ( test_parser testParser.C )
add_cpp_test ( test_parser FFlIOAdaptors )
add_executable ( test_sections testXsections.C )
add_cpp_test ( test_sections FFlIOAdaptors )
endif ( GTest_FOUND )

if ( TARGET FFlVisualization )
add_executable ( test_FFlViz testFFlVis.C )
if ( GTest_FOUND )
add_cpp_test ( test_FFlViz FFlVisualization FFlIOAdaptors )
else ( GTest_FOUND )
target_link_libraries ( test_FFlViz FFlVisualization FFlIOAdaptors )
endif ( GTest_FOUND )
endif ( TARGET FFlVisualization )
1 change: 1 addition & 0 deletions src/FFlLib/FFlTests/main.C
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "FFlLib/FFlIOAdaptors/FFlFedemWriter.H"
#include "FFaLib/FFaAlgebra/FFaUnitCalculator.H"
#include "FFaLib/FFaAlgebra/FFaTensor3.H"
#include "FFaLib/FFaAlgebra/FFaVec3.H"
#include <iterator>
#include <cstring>

Expand Down
Loading
Loading