From 4e8eb7142eb1cda7338a5ff5242f05dc58713e85 Mon Sep 17 00:00:00 2001 From: Graeme Kennedy Date: Wed, 6 Mar 2024 17:34:27 -0500 Subject: [PATCH] updated cython --- Makefile | 2 +- setup.py | 3 +++ tmr/TMR.pxd | 47 +++++++++++++++++++++++++++++++++++------------ tmr/TMR.pyx | 4 +++- 4 files changed, 42 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index c32c27e..8f35eeb 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ debug: ${CXX} ${SO_LINK_FLAGS} ${TMR_OBJS} ${TMR_EXTERN_LIBS} -o ${TMR_DIR}/lib/libtmr.${SO_EXT} interface: - pip install -e .\[all\] + pip install -e . clean: ${RM} lib/*.a lib/*.so diff --git a/setup.py b/setup.py index 471c395..78cfc43 100644 --- a/setup.py +++ b/setup.py @@ -76,6 +76,7 @@ def get_mpi_flags(): if "tacs" in sys.modules: inc_dirs.extend(tacs.get_include()) inc_dirs.extend(tacs.get_cython_include()) + inc_dirs.append(os.path.split(tacs.get_cython_include()[0])[0]) tacs_lib_dirs, tacs_libs = tacs.get_libraries() lib_dirs.extend(tacs_lib_dirs) libs.extend(tacs_libs) @@ -87,6 +88,7 @@ def get_mpi_flags(): if "paropt" in sys.modules: inc_dirs.extend(paropt.get_include()) inc_dirs.extend(paropt.get_cython_include()) + inc_dirs.append(os.path.split(paropt.get_cython_include()[0])[0]) paropt_lib_dirs, paropt_libs = paropt.get_libraries() lib_dirs.extend(paropt_lib_dirs) libs.extend(paropt_libs) @@ -98,6 +100,7 @@ def get_mpi_flags(): if "egads4py" in sys.modules: inc_dirs.extend(egads4py.get_include()) inc_dirs.extend(egads4py.get_cython_include()) + inc_dirs.append(os.path.split(egads4py.get_cython_include()[0])[0]) egads4py_lib_dirs, egads4py_libs = egads4py.get_libraries() lib_dirs.extend(egads4py_lib_dirs) libs.extend(egads4py_libs) diff --git a/tmr/TMR.pxd b/tmr/TMR.pxd index 7a7d36a..721e573 100644 --- a/tmr/TMR.pxd +++ b/tmr/TMR.pxd @@ -19,7 +19,6 @@ # limitations under the License. # For MPI -from mpi4py.libmpi cimport * cimport mpi4py.MPI as MPI # Import numpy @@ -29,21 +28,45 @@ import numpy as np # Import TACS from tacs import TACS from tacs cimport TACS -from tacs.TACS import * -from tacs.TACS cimport * -from tacs.constitutive import * -from tacs.constitutive cimport * +from tacs.TACS import Vec, VecInterp, Assembler, Mg, Element, Function, Pc +from tacs.TACS cimport ( + Vec, + VecInterp, + Assembler, + Mg, + Element, + Function, + Pc, + TACSFunction, + TACSBVec, + TACSBVecInterp, + TACSAssembler, + TACSMg, + _init_Vec, + _init_VecInterp, + _init_Assembler, + _init_Mg, + _dynamicTACSMg, +) +from tacs.constitutive import ( + PlaneStressConstitutive, + SolidConstitutive, + MaterialProperties, +) +from tacs.constitutive cimport ( + PlaneStressConstitutive, + SolidConstitutive, + MaterialProperties, + TACSMaterialProperties, +) # Import ParOpt -from paropt.ParOpt import * -from paropt.ParOpt cimport * +from paropt.ParOpt import PVec, ProblemBase +from paropt.ParOpt cimport PVec, ProblemBase, ParOptVec, _init_PVec # Import EGADS -from egads4py.egads import * -from egads4py.egads cimport * - -# Import all of the TMR header files -from tmr.cpp_headers.TMR cimport * +from egads4py.egads import pyego +from egads4py.egads cimport pyego cdef inline char* tmr_convert_str_to_chars(s): if isinstance(s, unicode): diff --git a/tmr/TMR.pyx b/tmr/TMR.pyx index 31e6484..346f72c 100644 --- a/tmr/TMR.pyx +++ b/tmr/TMR.pyx @@ -19,7 +19,6 @@ # limitations under the License. # # For the use of MPI -from mpi4py.libmpi cimport * cimport mpi4py.MPI as MPI # Import numpy @@ -41,6 +40,9 @@ from libcpp cimport bool # Import C methods for python from cpython cimport PyObject, Py_INCREF +# Import all of the TMR header files +from tmr.cpp_headers.TMR cimport * + cdef tmr_init(): if not TMRIsInitialized(): TMRInitialize()