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

MedApplication #11419

Merged
merged 99 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 95 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
a051155
initial add empty app
philbucher Oct 26, 2022
08f0d49
add MedIO
philbucher Oct 26, 2022
f6b0257
expose to python
philbucher Oct 26, 2022
35988a1
Merge remote-tracking branch 'origin/master' into med-application
philbucher Nov 27, 2022
af3f067
add empty WriteModelpart
philbucher Nov 27, 2022
7e3fb89
minor
philbucher Nov 27, 2022
0244fcc
prepare C++ testing
philbucher Nov 27, 2022
6c289ec
missing const in ModelPart
philbucher Nov 27, 2022
5843bf2
check SubModelParts too
philbucher Nov 27, 2022
6b0f2ac
WIP add logo to reame
philbucher Nov 27, 2022
76486e6
adding const corrected function
philbucher Nov 27, 2022
f1b0574
hide deprecation in BaseClass
philbucher Nov 27, 2022
1359f8c
using const function
philbucher Nov 27, 2022
e23b4ac
fixes
philbucher Nov 27, 2022
a42facc
Merge remote-tracking branch 'origin/master' into med-application
philbucher Dec 3, 2022
325d4f7
move to utilities
philbucher Dec 3, 2022
b2e1e79
WIP test geometries
philbucher Dec 3, 2022
75d2a52
fixes
philbucher Dec 3, 2022
0a74605
initial add FindMED
philbucher Dec 3, 2022
89383be
use test name as file name
philbucher Dec 3, 2022
70aa9f9
prepare py tests
philbucher Dec 3, 2022
70db4f8
WIP include Med
philbucher Dec 3, 2022
4f52b32
dummy usage of Med
philbucher Dec 3, 2022
7d9d992
minor in readme
philbucher Dec 3, 2022
c8d5b03
minor
philbucher Dec 3, 2022
003466f
draft for partitioning support
philbucher Dec 9, 2022
3e570f1
minor in FindMED
philbucher Dec 9, 2022
3146489
handle med file handle types correctly
philbucher Dec 9, 2022
4a0b85b
missing
philbucher Dec 9, 2022
7cf750e
starting to add some version checks
philbucher Dec 9, 2022
cf48eca
using aux classs for MedFile Access
philbucher Dec 12, 2022
22e9fa6
some testing
philbucher Dec 13, 2022
476fbb4
adding checks and tests for opening files
philbucher Dec 13, 2022
1eb7507
started to move checks
philbucher Dec 13, 2022
b3a0ac1
some improvements
philbucher Dec 13, 2022
56454cf
minor in tests
philbucher Dec 13, 2022
c6b28cc
add missing CTor to python
philbucher Dec 13, 2022
e73f978
check for loading the correct so
philbucher Dec 17, 2022
19668e0
starting to write mesh
philbucher Dec 17, 2022
203660c
writing Nodes
philbucher Dec 17, 2022
f6e1d7b
some comments and checks
philbucher Dec 17, 2022
f99a549
minor bugfix
philbucher Dec 18, 2022
b873ef6
Merge remote-tracking branch 'origin/master' into med-application
philbucher Dec 23, 2022
0d22ffa
big WIP
philbucher Dec 23, 2022
d13af59
WIP using new interface
philbucher Dec 23, 2022
2658cd6
making WriteMesh const
philbucher Dec 27, 2022
23c40cc
WIP write geometries
philbucher Dec 28, 2022
5df664c
Merge remote-tracking branch 'origin/master' into med-application
philbucher Jan 6, 2023
389717a
WIP writing ModelPart
philbucher Jan 6, 2023
95916f7
WIP py tests
philbucher Jan 6, 2023
8150bd4
minor
philbucher Jan 6, 2023
97315de
adding some med files
philbucher Jan 7, 2023
b3be4e9
adding more med files
philbucher Jan 7, 2023
e868fe1
minor
philbucher Jan 7, 2023
7ca99fb
bugfix
philbucher Jan 7, 2023
e636a75
implemented first python test
philbucher Jan 7, 2023
d72b4f7
improve test
philbucher Jan 7, 2023
2a9bcec
WIP python tests
philbucher Jan 7, 2023
60521ff
Merge remote-tracking branch 'origin/master' into med-application
philbucher Jan 14, 2023
e687ed7
fix bug iterator
philbucher Jan 14, 2023
7a0ce89
WIP reading nodes
philbucher Jan 14, 2023
5ebb9fa
WIP read ModelPart
philbucher Jan 15, 2023
ca66181
more WIP in reading geometries
philbucher Jan 15, 2023
9c53cdc
advances
philbucher Jan 17, 2023
1b4bc91
variable utils accept std::vector
philbucher Jan 17, 2023
e091c5f
multiple fixes
philbucher Jan 20, 2023
c28aaa2
almost working
philbucher Jan 21, 2023
25d24cb
WIP compiles
philbucher Jan 21, 2023
ce8239b
make parallel geom construction work
philbucher Jan 21, 2023
1a8b045
Merge remote-tracking branch 'origin/master' into med-application
philbucher Jan 23, 2023
f4d1a44
Merge remote-tracking branch 'origin/master' into med-application
philbucher Mar 27, 2023
973985c
basic version of reading geometries
philbucher Mar 27, 2023
d9aef13
check geometries
philbucher Mar 30, 2023
326a31d
add utility fct
philbucher Mar 30, 2023
2b55c1a
several fixes
philbucher Apr 3, 2023
db0ccbd
make non-consecutive node ids work
philbucher Apr 3, 2023
3d9a483
add node id check
philbucher Apr 3, 2023
bcfaedd
add test for mixed geoms
philbucher Apr 3, 2023
3a3ee55
bug fix reading
philbucher Apr 3, 2023
79c6551
minor
philbucher Apr 3, 2023
3bf5ae5
unifying MED-include
philbucher Apr 4, 2023
185ff07
fix geometry writing
philbucher Apr 4, 2023
449a69c
minor readme update
philbucher Apr 4, 2023
8b06f44
WIP write SubModelParts
philbucher Apr 7, 2023
5eaf609
making compile
philbucher Apr 7, 2023
0eab9a6
Merge remote-tracking branch 'origin/master' into med-application
philbucher Jun 19, 2023
1ca7f21
Merge remote-tracking branch 'origin/master' into med-application
philbucher Jul 23, 2023
7b25904
update Node<3> => Node
philbucher Jul 23, 2023
3d3cb57
remove SMP stuff for now
philbucher Jul 23, 2023
a10eab5
some updates
philbucher Jul 23, 2023
e4b5e49
some fixes
philbucher Jul 23, 2023
3e8828b
update python tests
philbucher Jul 23, 2023
26a48f0
skip tests that ware not yet implemented
philbucher Jul 23, 2023
ca2fb14
check error codes
philbucher Jul 23, 2023
c168c0e
update redame
philbucher Jul 23, 2023
482c36d
minor
philbucher Jul 23, 2023
f4345c5
only forward declare
philbucher Aug 13, 2023
d1b14e7
Merge remote-tracking branch 'origin/master' into med-application
philbucher Aug 13, 2023
b42fdbd
review requests
philbucher Aug 17, 2023
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
83 changes: 83 additions & 0 deletions applications/MedApplication/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)

message("**** configuring KratosMedApplication ****")

################### PYBIND11
include(pybind11Tools)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) # for FindMED
find_package(MED REQUIRED)

# MED uses HDF
# TODO check interoperability with the HDFapp, both in serial and parallel
if (NOT HDF5_FOUND)
find_package(HDF5 REQUIRED COMPONENTS C)
endif()

include_directories(${MED_INCLUDE_DIR} ${HDF5_INCLUDE_DIRS})

include_directories( ${KRATOS_SOURCE_DIR}/kratos )

## Med Core sources
file(GLOB_RECURSE KRATOS_MED_APPLICATION_CORE
${CMAKE_CURRENT_SOURCE_DIR}/med_application.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_io/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_utilities/*.cpp
)

## Med testing sources
if(${KRATOS_BUILD_TESTING} MATCHES ON)
file(GLOB_RECURSE KRATOS_MED_APPLICATION_TESTING_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/tests/*.cpp)
endif(${KRATOS_BUILD_TESTING} MATCHES ON)

## Med python interface sources
file(GLOB_RECURSE KRATOS_MED_APPLICATION_PYTHON_INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/custom_python/*.cpp)

add_library(KratosMedCore SHARED ${KRATOS_MED_APPLICATION_CORE} ${KRATOS_MED_APPLICATION_TESTING_SOURCES})
target_link_libraries(KratosMedCore PUBLIC KratosCore ${MED_LIBRARIES} ${HDF5_C_LIBRARIES})
set_target_properties(KratosMedCore PROPERTIES COMPILE_DEFINITIONS "MED_APPLICATION=EXPORT,API")
target_include_directories(KratosMedCore SYSTEM PRIVATE hdf5::hdf5)


###############################################################
## define library Kratos which defines the basic python interface
pybind11_add_module(KratosMedApplication MODULE THIN_LTO ${KRATOS_MED_APPLICATION_PYTHON_INTERFACE})
target_link_libraries(KratosMedApplication PRIVATE KratosMedCore)
set_target_properties(KratosMedApplication PROPERTIES PREFIX "")

# changing the .dll suffix to .pyd (Windows)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set_target_properties(KratosMedApplication PROPERTIES SUFFIX .pyd)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")

# changing the .dylib suffix to .so (OS X)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set_target_properties(KratosMedApplication PROPERTIES SUFFIX .so)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

# Add to the KratosMultiphisics Python module
kratos_python_install(${INSTALL_PYTHON_USING_LINKS} ${CMAKE_CURRENT_SOURCE_DIR}/MedApplication.py KratosMultiphysics/MedApplication/__init__.py )

# Install python files
get_filename_component (CURRENT_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
kratos_python_install_directory(${INSTALL_PYTHON_USING_LINKS} ${CMAKE_CURRENT_SOURCE_DIR}/python_scripts KratosMultiphysics/${CURRENT_DIR_NAME} )

# Kratos Testing. Install everything except sources to ensure that reference and configuration files are copied.
if(${INSTALL_TESTING_FILES} MATCHES ON )
get_filename_component (CURRENT_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests DESTINATION applications/${CURRENT_DIR_NAME}
PATTERN "*.git" EXCLUDE
PATTERN "*.c" EXCLUDE
PATTERN "*.h" EXCLUDE
PATTERN "*.cpp" EXCLUDE
PATTERN "*.hpp" EXCLUDE
)
endif(${INSTALL_TESTING_FILES} MATCHES ON)

# Install targets
install(TARGETS KratosMedCore DESTINATION libs )
install(TARGETS KratosMedApplication DESTINATION libs )

# Define custom targets
set(KRATOS_KERNEL "${KRATOS_KERNEL};KratosMedCore" PARENT_SCOPE)
set(KRATOS_PYTHON_INTERFACE "${KRATOS_PYTHON_INTERFACE};KratosMedApplication" PARENT_SCOPE)
38 changes: 38 additions & 0 deletions applications/MedApplication/FindMED.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

# include(FindPackageHandleStandardArgs)
# find_package_handle_standard_args






# Find the MED includes and libraries
#
# MED_INCLUDE_DIR - where to find autopack.h
# MED_LIBRARIES - List of fully qualified libraries to link against.
# MED_FOUND - Do not attempt to use if "no" or undefined.

FIND_PATH(MED_INCLUDE_DIR "med.h"
PATHS
"${MED_ROOT}/include"
/usr/local/include
/usr/include
)

FIND_LIBRARY(MED_LIBRARY medC
PATHS
"${MED_ROOT}/lib"
/usr/local/lib/*
/usr/lib/*
)

IF(MED_INCLUDE_DIR AND MED_LIBRARY)
SET( MED_LIBRARIES ${MED_LIBRARY})
SET( MED_FOUND "YES" )
message(STATUS "MED found!")
message(STATUS "MED includes: ${MED_INCLUDE_DIR}")
message(STATUS "MED libraries: ${MED_LIBRARY}")
else()
message(WARNING "finding MED failed, please try to set the var MED_ROOT")
ENDIF()
7 changes: 7 additions & 0 deletions applications/MedApplication/MedApplication.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Application dependent names and paths
from KratosMultiphysics import _ImportApplication
from KratosMedApplication import *
application = KratosMedApplication()
application_name = "KratosMedApplication"

_ImportApplication(application, application_name)
12 changes: 12 additions & 0 deletions applications/MedApplication/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# MedApplication

The Med Application an interface to the MED-library. This library writes med-files, which contain mesh, field results and other data, and is based on [HDF5](https://www.hdfgroup.org/solutions/hdf5/). This format is used by [Salome](https://www.salome-platform.org/) and [Code_Aster](https://code-aster.org).

## Installation
The MED-library is an external library, which must be installed before the application can be compiled

On Ubuntu, it can be installed with `sudo apt-get install libmedc-dev`. This installs all required dependencies, including HDF5

The source code is available on the Salome website for a manual installation. In this case also HDF5 needs to be installed separately.

Use `MED_ROOT` to specify the path to the MED installation in the CMake of Kratos.
Loading
Loading