elmerfem
elmerfem copied to clipboard
Modularizing METIS
Following this discussion, I'm looking into the possibilities of modularizing METIS instead of just dropping the code into this repository. So the possibilities:
-
Cross-platform:
- Sadly Conan does not have a METIS library yet. I have created a package request here. If you can help please do.
- The METIS developers do not provide a direct URL link to the source code but a bunch of zip files. I'm not sure if we can something like a
.gitmodule
to put a "virtual" version of that library here. Or if you have any communication with them please ask them to expose their direct source code, maybe upload the entire library on GitHub/BitBucket/GitLab... - The vcpkg package manager, an alternative to Conan, has a METIS package. I'm going to test it but I have no experience with this tool before.
-
Windows only:
- MSYS2 also has a METIS package
mingw-w64-x86_64-metis-5.1.0-3
which one can install withpacman -S
- Also, CygWin has a METIS package, though I prefer MSYS2.
- MSYS2 also has a METIS package
-
For macOS, there is actually a HomeBrew package for METIS here.
-
For other operating systems (e.g., GNU/Linux, *BSD) there are plenty of prebuild packages as you may see here on Repology.
-
For the CMake instructions, we may use the FindMETIS script provided by the Eigen library.
I am interested to know your thoughts on what is the best way to approach this.
ElmerGrid:
MSYS2 - MinGW-w64
I was able to compile ElmerGrid on MSYS2 using the MinGW-w64 compiler(s):
- isolate the
elmergrid
folder - delete the
src\metis-5.1.0
folder - delete these lines of the
src/CMakeList.txt
:
SET(METIS_INSTALL FALSE CACHE BOOL "")
ADD_SUBDIRECTORY(metis-5.1.0)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/metis)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/elmergrid/src/metis)
- add the
build/
to the.gitignore
- in the file
src/femelmer.c
follow the instructions here to replace the C macros:
// #ifdef MINGW32
// fail = mkdir(subdirectoryname);
// #else
// fail = mkdir(subdirectoryname,0750);
// #endif
#ifdef __linux__
mkdir(directoryname, 0750);
#else
_mkdir(directoryname);
#endif
- add the
#include <direct.h>
header to thefemelmer.c
file - in
femelmer.c
make sure you have#include "metis.h"
-
cmake .. -G "MinGW Makefiles" -DCMAKE_SH="CMAKE_SH-NOTFOUND"
-
make -I /mingw64/include/
Dear @raback ,
I created a new repository for ElmerGrid here. Your review and feedback would be highly appreciated.
The develop branch here now compiles in both MSVC-Vcpkg and MSYS2-MinGW64. @raback test and review would be highly appreciated.
Are the METIS routines called from Fortran? If so, I wrote a module with the C bindings to be able and interface safely from Fortran: https://github.com/ivan-pi/fmetis
As an update, it appears that someone has eventually added METIs to Conan here.