diff --git a/cxxfem/CMakeLists.txt b/cxxfem/CMakeLists.txt index 67d856291aca6db9ceaf819d9441e2f746e6d374..85255932863555751b3cef37ce824436753ac126 100644 --- a/cxxfem/CMakeLists.txt +++ b/cxxfem/CMakeLists.txt @@ -1,5 +1,5 @@ -PROJECT(FEM CXX) CMAKE_MINIMUM_REQUIRED(VERSION 3.14) +PROJECT(FEM CXX) OPTION(FEM_USE_MKL "Use Pardiso linear solver from MKL" ON) diff --git a/cxxfem/src/femMedium.cpp b/cxxfem/src/femMedium.cpp index d6037909cbecc6bd792b33cf3eaccc79c02c086a..efbbe7eea2316ce2bafc01751b0e4f29e49ea3e3 100644 --- a/cxxfem/src/femMedium.cpp +++ b/cxxfem/src/femMedium.cpp @@ -11,7 +11,12 @@ Medium::Medium(Problem &pbl, std::string const &groupname, if (pbl.entities.empty()) // is the problem already sync'ed? pbl.sync(); - group = pbl.groups_by_name.at(groupname); + group = pbl.groups_by_name.at(groupname); + // (windows) if "fossils" fails here, check that gmsh.dll is not in both bin and lib + // folders of the gmsh folder (otherwise, both are loaded simultaneously, + // one from python, the other from c++! => 2 gmsh DBs are in use!) + // => move (do not copy) the dll from lib to bin + pbl.media.push_back(this); // construct 2D-plane-stress Hooke matrix diff --git a/envs/win-mingw64.cmd b/envs/win-mingw64.cmd index 105d323801a8ef1b88e8a5e32cd6712e50162039..a87c7338217f9ce06a899b3bdf8bd52bb6c69350 100644 --- a/envs/win-mingw64.cmd +++ b/envs/win-mingw64.cmd @@ -5,10 +5,8 @@ set COMPILERPATH="C:\mingw-w64" :: Intel MKL -set "INTELPATH=C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.5.281\windows" -@REM set LIB=%INTELPATH%\mkl\lib\intel64_win;%INTELPATH%\compiler\lib\intel64_win;%LIB% -@REM set INCLUDE=%INTELPATH%\mkl\include;%INCLUDE% -call "%INTELPATH%\mkl\bin\mklvars.bat" intel64 vs2019 +set "INTELPATH=C:\Program Files (x86)\Intel\oneAPI" +call "%INTELPATH%\mkl\latest\env\vars.bat" intel64 lp64 :: set the environment of the MinGW compiler CD /d "%~dp0" diff --git a/envs/win-msvc.cmd b/envs/win-msvc.cmd index f6ab0f37d0cf6758e6c898d149792113fd82b910..be24e18c6dfedf97690eedc916dc520e4c0a8029 100644 --- a/envs/win-msvc.cmd +++ b/envs/win-msvc.cmd @@ -1,14 +1,12 @@ @echo off :: This file opens a terminal which allows you to compile the code with -:: Microsoft Visual Studio 2019 (x64) on Windows +:: Microsoft Visual Studio 2022 (x64) on Windows -set COMPILERPATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build" +set COMPILERPATH="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build" :: Intel MKL -set "INTELPATH=C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.5.281\windows" -@REM set LIB=%INTELPATH%\mkl\lib\intel64_win;%INTELPATH%\compiler\lib\intel64_win;%LIB% -@REM set INCLUDE=%INTELPATH%\mkl\include;%INCLUDE% -call "%INTELPATH%\mkl\bin\mklvars.bat" intel64 vs2019 +set "INTELPATH=C:\Program Files (x86)\Intel\oneAPI" +call "%INTELPATH%\mkl\latest\env\vars.bat" intel64 lp64 :: set the environment of the msvc compiler CD /d "%~dp0" diff --git a/fossils.py b/fossils.py index 7fefe953fe473739c8aacbd80c0330b04ff4439e..fc77b59d7185d0767a885099fb1228a1f251eb3b 100755 --- a/fossils.py +++ b/fossils.py @@ -2,6 +2,13 @@ # -*- coding: utf-8 -*- # Fossils: # main script +# +# note: +# if starting Qt fails with +# qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" +# this means that an application in the PATH provides another version of Qt +# which is incompatible (MikTeX) +# => move MikTeX to the bottom of the user PATH. from PyQt5.QtCore import * from PyQt5.QtGui import * @@ -246,6 +253,12 @@ def setup_pythonpath(): # 'gmsh-sdk', 'bin')) # gmsh # print(f'sys.path={sys.path}') + # add_dll_directory for python>3.8 (add all folders) + import platform + if platform.system() == 'Windows' and sys.version_info.minor >= 8: + for v in os.environ['path'].split(';'): + if os.path.exists(v): + os.add_dll_directory(v) def build_workspace_name(workspace, testname): """create workspace folder and chdir into it @@ -277,8 +290,11 @@ if __name__ == "__main__": # add main program folder and binaries dir to the PYTHONPATH setup_pythonpath() - # redirect C++ streams to Python + # if the following import fails, check that all the dlls are in the PATH + # (in particular gmsh.dll) import cxxfem + + # redirect C++ streams to Python redirect = cxxfem.StdOutErr2Py() args = cxxfem.parseargs() diff --git a/models/bonemodel2.py b/models/bonemodel2.py index 5a08f4d2c8b2849565a24b3c144f4dbbc8a0a31c..bd7cd8f85f4644c9dc91308c9634bca5bb83d9d1 100644 --- a/models/bonemodel2.py +++ b/models/bonemodel2.py @@ -8,6 +8,8 @@ import cxxfem as fem from . import boneload import os import gmsh +if not gmsh.isInitialized(): + gmsh.initialize() import numpy as np