[Getfem-commits] [getfem-commits] branch master updated: Fix issues with cmake builds

2024-03-11 Thread Konstantinos Poulios via Getfem-commits
This is an automated email from the git hooks/post-receive script.

logari81 pushed a commit to branch master
in repository getfem.

The following commit(s) were added to refs/heads/master by this push:
 new 99920d7b Fix issues with cmake builds
99920d7b is described below

commit 99920d7b5cbf020a795a8b2371b1b26b1acaf75e
Author: Konstantinos Poulios 
AuthorDate: Mon Mar 11 13:40:09 2024 +0100

Fix issues with cmake builds
---
 CMakeLists.txt | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 184e9392..0f8694be 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -461,7 +461,7 @@ if(ENABLE_SUPERLU)
 endif()
 if(ENABLE_MUMPS)
   target_include_directories(libgetfem PRIVATE ${MUMPS_INCLUDE_PATH})
-  target_link_libraries(libgetfem PRIVATE "${MUMPS_LIBS}")
+  target_link_libraries(libgetfem PUBLIC "${MUMPS_LIBS}")
 endif()
 
 if(NOT GETFEM_PARA_LEVEL MATCHES "^(0|1|2)$")
@@ -570,6 +570,9 @@ if(ENABLE_PYTHON)
 target_include_directories(libgetfemint PRIVATE ${CMAKE_BINARY_DIR})
 target_include_directories(libgetfemint PRIVATE ${CMAKE_SOURCE_DIR}/src)
 target_include_directories(libgetfemint PRIVATE 
${CMAKE_SOURCE_DIR}/interface/src)
+if(ENABLE_MUMPS)
+  target_include_directories(libgetfemint PRIVATE ${MUMPS_INCLUDE_PATH})
+endif()
 
 find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
 
@@ -589,6 +592,7 @@ if(ENABLE_PYTHON)
 $)
 target_include_directories(_getfem PRIVATE ${CMAKE_BINARY_DIR}/getfem)
 target_include_directories(_getfem PRIVATE 
${CMAKE_SOURCE_DIR}/interface/src)
+target_include_directories(_getfem PRIVATE ${Python3_NumPy_INCLUDE_DIRS})
 target_link_libraries(_getfem PRIVATE libgetfem)
 
 # find the installation directory for python libraries (ported from 
autotools)
@@ -600,6 +604,7 @@ print(sysconfig.get_path('purelib', scheme, vars={'base': 
'${CMAKE_INSTALL_PREFI
 message("Python3_SITEARCH = ${Python3_SITEARCH} (not used)")
 message("Python3_SITELIB = ${Python3_SITELIB} (not used)")
 message("PYTHON_SITE_PACKAGES = ${PYTHON_SITE_PACKAGES} (used)")
+message("Python3_NumPy_INCLUDE_DIRS = ${Python3_NumPy_INCLUDE_DIRS} 
(used)")
   endif()
 endif()
 
@@ -625,7 +630,7 @@ endif()
 # in the cmake build, BLAS and Lapack are hard requirements
 find_package(BLAS REQUIRED)
 find_package(LAPACK REQUIRED)
-target_link_libraries(libgetfem PRIVATE ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
+target_link_libraries(libgetfem PUBLIC ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
 set(GMM_USES_BLAS 1)
 set(GMM_USES_LAPACK 1)
 



[Getfem-commits] [getfem-commits] branch master updated: Fix compilation warning

2024-03-11 Thread Konstantinos Poulios via Getfem-commits
This is an automated email from the git hooks/post-receive script.

logari81 pushed a commit to branch master
in repository getfem.

The following commit(s) were added to refs/heads/master by this push:
 new 105e1626 Fix compilation warning
105e1626 is described below

commit 105e1626c8f03ad49eb3fcec53012c278f48294f
Author: Konstantinos Poulios 
AuthorDate: Mon Mar 11 09:03:09 2024 +0100

Fix compilation warning
---
 contrib/crack_plate/crack_bilaplacian_problem.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/crack_plate/crack_bilaplacian_problem.cc 
b/contrib/crack_plate/crack_bilaplacian_problem.cc
index 13ad0a13..ff114914 100644
--- a/contrib/crack_plate/crack_bilaplacian_problem.cc
+++ b/contrib/crack_plate/crack_bilaplacian_problem.cc
@@ -1081,10 +1081,10 @@ bool bilaplacian_crack_problem::solve(plain_vector ) {
 plain_vector b = model.real_rhs();
 gmm::scale(b, -1.);
 plain_vector X(b);
-scalar_type condest;
 #if defined(GMM_USES_MUMPS)
 gmm::MUMPS_solve(A, X, gmm::scaled(b, scalar_type(-1)));
 #else
+scalar_type condest;
 gmm::SuperLU_solve(A, X, gmm::scaled(b, scalar_type(-1)), condest, 1);
 cout << "cond super LU = " << 1./condest << "\n";
 #endif



[Getfem-commits] [getfem-commits] master updated (e3372b14 -> 8921634b)

2024-03-11 Thread Konstantinos Poulios via Getfem-commits
logari81 pushed a change to branch master.

from e3372b14 Move function implementations from header to source file
 new 5ddd2b51 Improve compatibility with MSVC compiler
 new 8921634b Improve portability of auxiliary python script


Summary of changes:
 bin/extract_doc  | 34 +-
 interface/src/python/getfem_python.c |  7 +++
 2 files changed, 16 insertions(+), 25 deletions(-)



[Getfem-commits] (no subject)

2024-03-11 Thread Konstantinos Poulios via Getfem-commits
branch: master
commit 5ddd2b51f5bf0dc7086eadc2ae24230acfc11e8e
Author: Konstantinos Poulios 
AuthorDate: Fri Mar 8 00:16:50 2024 +0100

Improve compatibility with MSVC compiler
---
 interface/src/python/getfem_python.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/interface/src/python/getfem_python.c 
b/interface/src/python/getfem_python.c
index 0f5c6f5d..2a42e844 100644
--- a/interface/src/python/getfem_python.c
+++ b/interface/src/python/getfem_python.c
@@ -739,7 +739,11 @@ call_getfem_(PyObject *self, PyObject *args, int 
in__init__)
 result = Py_None; Py_INCREF(Py_None);
   } else if (out) {
 int i, err = 0;
+#if defined(_MSC_VER)
+PyObject **d = (PyObject **)malloc(out_cnt*sizeof(PyObject*));
+#else
 PyObject *d[out_cnt];
+#endif
 for (i = 0; i < out_cnt; ++i) {
   if (!err && !(d[i] = gfi_array_to_PyObject(out[i], in__init__)))
 err = 1;
@@ -753,6 +757,9 @@ call_getfem_(PyObject *self, PyObject *args, int in__init__)
 for (i = 0; i < out_cnt; ++i) PyTuple_SET_ITEM(result,i,d[i]);
   } else result = d[0];
 }
+#if defined(_MSC_VER)
+free(d);
+#endif
   }
 }
   }



[Getfem-commits] (no subject)

2024-03-11 Thread Konstantinos Poulios via Getfem-commits
branch: master
commit 8921634bf2c210f28eadebe0a7a202fd2be573c3
Author: Konstantinos Poulios 
AuthorDate: Mon Mar 11 09:01:59 2024 +0100

Improve portability of auxiliary python script
---
 bin/extract_doc | 34 +-
 1 file changed, 9 insertions(+), 25 deletions(-)

diff --git a/bin/extract_doc b/bin/extract_doc
index d444e652..fc41752a 100755
--- a/bin/extract_doc
+++ b/bin/extract_doc
@@ -30,6 +30,7 @@ import string
 import os
 import textwrap
 import sys
+import glob
 
 class ParseError(Exception):
 def __init__(self, value):
@@ -483,14 +484,9 @@ option = sys.argv[2]
 # List the filenames and extract object and command names.
 #
 
-fl = os.popen('(cd ' + directory + '; ls gf_*.cc)');
-lines = fl.readlines();
-a = fl.close()
-if (a) : # Windows
-fl = os.popen('((cd ' + directory + ') & (ls gf_*.cc))');
-lines = fl.readlines();
-a = fl.close()
-
+directory=os.path.abspath(directory)
+os.chdir(directory)
+lines = glob.glob('gf_*.cc')
 
 objects = set()
 objects.add('eltm');
@@ -519,19 +515,12 @@ commands = sorted(commands, key=cmp_to_key(cmpobj))
 
 if (option == 'pseudo_loc'):
 
-fl = os.popen('cd ' + directory + ' && ls gf_*.cc')
-
-for l in fl:
-l = l.strip()
+for l in glob.glob('gf_*.cc'):
 sys.stdout.write(l+' ')
 
 elif (option == 'pseudo_gen'):
 
-directory_abs=os.path.abspath(directory)
-fl = os.popen('ls ' + directory_abs+'/gf_*.cc')
-
-for l in fl:
-l = l.strip()
+for l in glob.glob(directory+'/gf_*.cc'):
 sys.stdout.write(l+' ')
 
 elif (option == 'mobj_dirs'):
@@ -541,19 +530,14 @@ elif (option == 'mobj_dirs'):
 sys.stdout.write('@gf'+oname+' ')
 
 elif (option == 'cubature'):
-directory_abs=os.path.abspath(directory+'/../../cubature')
-fl = os.popen('ls ' + directory_abs+'/*.IM')
 
-for l in fl:
-l = l.strip()
+for l in glob.glob(os.path.abspath(directory+'/../../cubature/*.IM')):
 sys.stdout.write(l+' ')
 
 elif (option == 'cubature_loc'):
-directory_abs=os.path.abspath(directory+'/../../cubature')
-fl = os.popen('cd ' + directory_abs + ' && ls *.IM')
 
-for l in fl:
-l = l.strip()
+os.chdir(os.path.abspath(directory+'/../../cubature'))
+for l in glob.glob('*.IM'):
 sys.stdout.write(l+' ')