Skip to content
Draft
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
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "T8code"
uuid = "d0cc0030-9a40-4274-8435-baadcfd54fa1"
authors = ["Johannes Markert <johannes.markert@dlr.de>"]
version = "0.7.4"
version = "0.7.5-DEV"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand All @@ -22,4 +22,4 @@ Preferences = "1.2"
Reexport = "0.2, 1.0"
UUIDs = "1"
julia = "1.6"
t8code_jll = "=3.0.1"
t8code_jll = "=4.0.0"
106 changes: 14 additions & 92 deletions dev/fixes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,93 +9,40 @@ LIB_JL="Libt8.jl"

set -euxo pipefail

sed -i "s/using CEnum/using CEnum: @cenum/g" "${LIB_JL}"

# Remove Fortran macros
sed -i "/INTEGER(KIND/d" "${LIB_JL}"

# Remove other probably unused macros
sed -i "/P4EST_NOTICE/d" "${LIB_JL}"
sed -i "/P4EST_GLOBAL_NOTICE/d" "${LIB_JL}"

# Fix MPI types that have been wrongly converted to Julia types
sed -i "s/mpicomm::Cint/mpicomm::MPI_Comm/g" "${LIB_JL}"
sed -i "s/\bcomm::Cint/comm::MPI_Comm/g" "${LIB_JL}"
sed -i "s/\bintranode::Ptr{Cint}/intranode::Ptr{MPI_Comm}/g" "${LIB_JL}"
sed -i "s/\binternode::Ptr{Cint}/internode::Ptr{MPI_Comm}/g" "${LIB_JL}"
sed -i "s/mpifile::Cint/mpifile::MPI_File/g" "${LIB_JL}"
sed -i "s/mpidatatype::Cint/mpidatatype::MPI_Datatype/g" "${LIB_JL}"
sed -i "s/\bt::Cint/t::MPI_Datatype/g" "${LIB_JL}"

sed -i "s/t8_forest_get_mpicomm\(forest::t8_forest_t\)::Cint/t8_forest_get_mpicomm(forest::t8_forest_t)::MPI_Comm/g" "${LIB_JL}"

sed -i "s/forest::Cint/forest::t8_forest_t/" "${LIB_JL}"
sed -i "s/t8_forest_get_mpicomm(forest::t8_forest_t)::Cint/t8_forest_get_mpicomm(forest::t8_forest_t)::MPI_Comm/g" "${LIB_JL}"

# Use libsc for `sc_*` functions
sed -i "s/libt8\.sc_/libsc.sc_/g" "${LIB_JL}"
# Remove struct t8_forest definition and replace by forward declaration
sed -i -z 's/\nstruct t8_forest.*stats_computed::Cint\nend/\n# This struct is not supposed to be read and modified directly.\n# Besides, there is a circular dependency with `t8_forest_t`\n# leading to an error output by Julia.\nmutable struct t8_forest end/g' "${LIB_JL}"

# Use libp4est for `p4est_*` functions
sed -i "s/libt8\.p4est_/libp4est.p4est_/g" "${LIB_JL}"

# Use libp4est for `p6est_*` functions
sed -i "s/libt8\.p6est_/libp4est.p6est_/g" "${LIB_JL}"

# Use libp4est for `p8est_*` functions
sed -i "s/libt8\.p8est_/libp4est.p8est_/g" "${LIB_JL}"


# Fix type of `sc_array` field `array`
sed -i "s/array::Cstring/array::Ptr{Int8}/g" "${LIB_JL}"
sed -i "s/forest::Cint/forest::t8_forest_t/" "${LIB_JL}"

# Remove cross references that are not found
sed -i "s/\[\`p4est\`](@ref)/\`p4est\`/g" "${LIB_JL}"
sed -i "s/\[\`p6est\`](@ref)/\`p6est\`/g" "${LIB_JL}"
sed -i "s/\[\`p8est\`](@ref)/\`p8est\`/g" "${LIB_JL}"
sed -i "s/\[\`P4EST_QMAXLEVEL\`](@ref)/\`P4EST_QMAXLEVEL\`/g" "${LIB_JL}"
sed -i "s/\[\`P8EST_QMAXLEVEL\`](@ref)/\`P8EST_QMAXLEVEL\`/g" "${LIB_JL}"
sed -i "s/\[\`P4EST_CONN_DISK_PERIODIC\`](@ref)/\`P4EST_CONN_DISK_PERIODIC\`/g" "${LIB_JL}"
sed -i "s/\[\`p8est_iter_corner_side_t\`](@ref)/\`p8est_iter_corner_side_t\`/g" "${LIB_JL}"
sed -i "s/\[\`p8est_iter_edge_side_t\`](@ref)/\`p8est_iter_edge_side_t\`/g" "${LIB_JL}"
sed -i "s/\[\`p4est_corner_info_t\`](@ref)/\`p4est_corner_info_t\`/g" "${LIB_JL}"
sed -i "s/\[\`p8est_corner_info_t\`](@ref)/\`p8est_corner_info_t\`/g" "${LIB_JL}"
sed -i "s/\[\`p8est_edge_info_t\`](@ref)/\`p8est_edge_info_t\`/g" "${LIB_JL}"
sed -i "s/\[\`sc_MPI_Barrier\`](@ref)/\`sc_MPI_Barrier\`/g" "${LIB_JL}"
sed -i "s/\[\`sc_MPI_COMM_NULL\`](@ref)/\`sc_MPI_COMM_NULL\`/g" "${LIB_JL}"
sed -i "s/\[\`SC_CHECK_ABORT\`](@ref)/\`SC_CHECK_ABORT\`/g" "${LIB_JL}"
sed -i "s/\[\`SC_LP_DEFAULT\`](@ref)/\`SC_LP_DEFAULT\`/g" "${LIB_JL}"
sed -i "s/\[\`SC_LC_NORMAL\`](@ref)/\`SC_LC_NORMAL\`/g" "${LIB_JL}"
sed -i "s/\[\`SC_LC_GLOBAL\`](@ref)/\`SC_LC_GLOBAL\`/g" "${LIB_JL}"
sed -i "s/\[\`SC_LP_ALWAYS\`](@ref)/\`SC_LP_ALWAYS\`/g" "${LIB_JL}"
sed -i "s/\[\`SC_LP_SILENT\`](@ref)/\`SC_LP_SILENT\`/g" "${LIB_JL}"
sed -i "s/\[\`SC_LP_THRESHOLD\`](@ref)/\`SC_LP_THRESHOLD\`/g" "${LIB_JL}"
sed -i "s/\[\`sc_logf\`](@ref)/\`sc_logf\`/g" "${LIB_JL}"
# Remove Fortran macros
sed -i "/INTEGER(KIND/d" "${LIB_JL}"

# For nicer docstrings
sed -i "s/\`p4est\`.h/\`p4est.h\`/g" "${LIB_JL}"
sed -i "s/\`p8est\`.h/\`p8est.h\`/g" "${LIB_JL}"

sed -i "/_sc_const/d" "${LIB_JL}"
sed -i "/_sc_restrict/d" "${LIB_JL}"
sed -i "/sc_keyvalue_t/d" "${LIB_JL}"
# Remove local arrays
sed -i "/T8_.*_VALUES/d" "${LIB_JL}"

# Remove misc
sed -i "/T8_VERSION_POINT/d" "${LIB_JL}"
sed -i "/P4EST_VERSION_POINT/d" "${LIB_JL}"

sed -i "/P4EST_GLOBAL_NOTICE/d" "${LIB_JL}"
sed -i "/P4EST_NOTICE/d" "${LIB_JL}"

sed -i "/P4EST_F90_QCOORD/d" "${LIB_JL}"
sed -i "/P4EST_F90_TOPIDX/d" "${LIB_JL}"
sed -i "/P4EST_F90_LOCIDX/d" "${LIB_JL}"
sed -i "/P4EST_F90_GLOIDX/d" "${LIB_JL}"

sed -i "/MPI_ERR_GROUP/d" "${LIB_JL}"

sed -i "/SC_VERSION_POINT/d" "${LIB_JL}"
sed -i "/_sc_const/d" "${LIB_JL}"
sed -i "/_sc_restrict/d" "${LIB_JL}"

# Remove MPI macros not available in MPI.jl
sed -i "/sc_MPI_PACKED/d" "${LIB_JL}"
sed -i "/sc_MPI_Pack/d" "${LIB_JL}"
sed -i "/sc_MPI_Unpack/d" "${LIB_JL}"
sed -i "/sc_MPI_DOUBLE_INT/d" "${LIB_JL}"

sed -i "/= MPI_MODE_/d" "${LIB_JL}"
sed -i "/= MPI_SEEK_/d" "${LIB_JL}"
Expand All @@ -104,31 +51,6 @@ sed -i "/= MPI_MAX_/d" "${LIB_JL}"
sed -i "/= MPI_Type_/d" "${LIB_JL}"
sed -i "/= MPI_Offset/d" "${LIB_JL}"
sed -i "/= MPI_File_/d" "${LIB_JL}"
sed -i "/= MPI_Aint/d" "${LIB_JL}"

sed -i "s/= MPI_/= MPI./" "${LIB_JL}"

sed -i "s/packageid/package_id/" "${LIB_JL}"

cat << EOT >&2

# !!!!!! #
# !!!!!! #

# Manual fix. #

Additionally, comment out

struct t8_forest
[...]
end

and add

mutable struct t8_forest end

in order to avoid error output due to
circular dependency of 't8_forest_t'.

# !!!!!! #
# !!!!!! #
EOT
Loading
Loading