Skip to content

Commit 23afc02

Browse files
committed
Merge branch 'housekeeping_2024-12-17' into 'development'
housekeeping 2024-12-17 See merge request damask/DAMASK!1014
2 parents ba2ae87 + 67af24a commit 23afc02

29 files changed

+90
-78
lines changed

.github/workflows/Fortran.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
strategy:
1919
matrix:
20-
gcc_v: [9, 10, 11, 12, 13]
20+
gcc_v: [11, 12, 13]
2121
fail-fast: false
2222

2323
env:

.gitlab-ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@ pytest:
7979
- python3 -m pytest -v --cov=damask --cov-report=xml --damaskroot=${DAMASK_ROOT}
8080
- coverage report --fail-under=90 --show-missing
8181

82+
doctest:
83+
stage: python
84+
tags:
85+
- matesting2-container-runner
86+
image: git.damask-multiphysics.org:5050/damask/damask:python310_2407
87+
before_script: []
88+
script:
89+
- export DAMASK_ROOT=$(pwd)
90+
- PYTHONPATH=${DAMASK_ROOT}/python:$PYTHONPATH
91+
- cd python
92+
- python3 -m pytest -v --doctest-modules -k 'not result and not configmaterial and not orientation and not rotation and not geomgrid' damask
93+
8294
mypy:
8395
stage: python
8496
tags:

CMakeLists.txt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ endif()
1010
# Dummy project to determine compiler names and version
1111
project(Prerequisites LANGUAGES)
1212
set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
13-
pkg_check_modules(PETSC_MIN REQUIRED PETSc>=3.12.0 QUIET) #CMake does not support version range
13+
pkg_check_modules(PETSC_MIN REQUIRED PETSc>=3.15.0 QUIET) #CMake does not support version range
1414
pkg_check_modules(PETSC REQUIRED PETSc<3.23.0)
1515

1616
pkg_get_variable(CMAKE_Fortran_COMPILER PETSc fcompiler)
@@ -20,7 +20,7 @@ pkg_get_variable(CMAKE_C_COMPILER PETSc ccompiler)
2020
string(TOUPPER "${DAMASK_SOLVER}" DAMASK_SOLVER_UPPER)
2121
string(TOLOWER "${DAMASK_SOLVER}" DAMASK_SOLVER_LOWER)
2222
if("${DAMASK_SOLVER_UPPER}" MATCHES "^(GRID|MESH|TEST)$")
23-
project("damask-${DAMASK_SOLVER_LOWER}" HOMEPAGE_URL https://damask.mpie.de LANGUAGES Fortran C)
23+
project("damask-${DAMASK_SOLVER_LOWER}" HOMEPAGE_URL https://damask-multiphysics.org LANGUAGES Fortran C)
2424
else()
2525
message(FATAL_ERROR "Invalid solver: DAMASK_SOLVER=${DAMASK_SOLVER}")
2626
endif()
@@ -33,15 +33,18 @@ set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/externalpackages:$ENV
3333
pkg_check_modules(HDF5 hdf5)
3434
pkg_check_modules(FFTW3 fftw3)
3535
pkg_check_modules(fYAML libfyaml)
36-
pkg_check_modules(zlib zlib)
36+
if(DAMASK_SOLVER_UPPER STREQUAL "GRID")
37+
pkg_check_modules(zlib zlib)
38+
endif()
3739

3840
file(STRINGS ${PROJECT_SOURCE_DIR}/VERSION DAMASK_VERSION)
3941

4042
message("\nBuilding ${CMAKE_PROJECT_NAME} ${DAMASK_VERSION}\n")
4143

4244
add_definitions(-DPETSC)
43-
add_definitions(-DDAMASKVERSION="${DAMASK_VERSION}")
44-
add_definitions(-DCMAKE_SYSTEM="${CMAKE_SYSTEM}")
45+
add_definitions(-DDAMASK_VERSION="${DAMASK_VERSION}")
46+
add_definitions(-DCMAKE_SYSTEM_NAME="${CMAKE_SYSTEM_NAME}")
47+
add_definitions(-DCMAKE_SYSTEM_PROCESSOR="${CMAKE_SYSTEM_PROCESSOR}")
4548
if(PETSC_VERSION VERSION_EQUAL 3.17.0)
4649
add_definitions("-DCHKERRQ=PetscCall")
4750
endif()
@@ -126,7 +129,10 @@ endif()
126129

127130
set(CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}} ${PETSC_INCLUDES} ${BUILDCMD_POST}")
128131

129-
set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -L${PETSC_LIBRARY_DIRS} -lpetsc ${PETSC_EXTERNAL_LIB} -lz")
132+
set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -L${PETSC_LIBRARY_DIRS} -lpetsc ${PETSC_EXTERNAL_LIB}")
133+
if(DAMASK_SOLVER_UPPER STREQUAL "GRID")
134+
set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} -lz")
135+
endif()
130136

131137
if(fYAML_FOUND STREQUAL "1")
132138
set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} -L${fYAML_LIBRARY_DIRS}")

PRIVATE

python/damask/_geomgrid.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -564,12 +564,9 @@ def from_Voronoi_tessellation(cells: IntSequence,
564564
565565
"""
566566
coords = grid_filters.coordinates0_point(cells,size).reshape(-1,3)
567-
tree = spatial.cKDTree(seeds,boxsize=size) if periodic else \
568-
spatial.cKDTree(seeds)
569-
try:
570-
material_ = tree.query(coords, workers = int(os.environ.get('OMP_NUM_THREADS',4)))[1]
571-
except TypeError:
572-
material_ = tree.query(coords, n_jobs = int(os.environ.get('OMP_NUM_THREADS',4)))[1] # scipy <1.6
567+
tree = spatial.KDTree(seeds,boxsize=size) if periodic else \
568+
spatial.KDTree(seeds)
569+
material_ = tree.query(coords, workers = int(os.environ.get('OMP_NUM_THREADS',4)))[1]
573570

574571
return GeomGrid(material = (material_ if material is None else np.array(material)[material_]).reshape(cells),
575572
size = size,

python/damask/_rotation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def allclose(self: MyType,
231231
return np.all(self.isclose(other,rtol,atol,equal_nan))
232232

233233

234-
def __array__(self,*, copy: bool = None) -> np.ndarray:
234+
def __array__(self,*, copy: Optional[bool] = None) -> np.ndarray:
235235
"""Initializer for numpy."""
236236
return self.quaternion.copy() if copy is True else self.quaternion # noqa: E712
237237

python/damask/_vtk.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,6 @@ def save(self,
451451
writer.Write()
452452

453453

454-
# Check https://blog.kitware.com/ghost-and-blanking-visibility-changes/ for missing data
455454
def set(self,
456455
label: Optional[str] = None,
457456
data: Union[None, np.ndarray, np.ma.MaskedArray] = None,

python/damask/seeds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ def from_grid(grid,
155155
# materials: 29
156156
>>> COG,matID = damask.seeds.from_grid(g,average=True)
157157
>>> distance,ID = scipy.spatial.KDTree(COG,boxsize=g.size).query(seeds)
158-
>>> np.max(distance) / np.linalg.norm(g.size/g.cells)
158+
>>> print(np.max(distance) / np.linalg.norm(g.size/g.cells))
159159
10.1
160-
>>> (ID == matID).all()
160+
>>> print((ID == matID).all())
161161
True
162162
163163
"""

python/mypy.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[mypy]
22
warn_redundant_casts = True
3+
plugins = numpy.typing.mypy_plugin
4+
35
[mypy-scipy.*]
46
ignore_missing_imports = True
57
[mypy-h5py.*]

src/CLI.f90

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
66
!> @brief Parse command line interface for PETSc-based solvers
77
!--------------------------------------------------------------------------------------------------
8-
#define PETSC_MINOR_MIN 12
8+
#define PETSC_MINOR_MIN 15
99
#define PETSC_MINOR_MAX 22
1010

1111
module CLI
@@ -109,19 +109,18 @@ subroutine CLI_init()
109109
print'(1x,a)', 'https://doi.org/'//PETSc_DOI
110110
#endif
111111
#endif
112-
print'(/,1x,a)', 'Version: '//DAMASKVERSION
112+
print'(/,1x,a)', 'Version: '//DAMASK_VERSION
113113

114+
! https://github.com/jeffhammond/HPCInfo/blob/master/docs/Preprocessor-Macros.md
114115
print'(/,1x,a)', 'Compiled with: '//compiler_version()
115-
print'(1x,a)', 'Compiled on: '//CMAKE_SYSTEM
116116
print'(1x,a)', 'Compiler options: '//compiler_options()
117+
print'(1x,a)', 'Compiled for: '//CMAKE_SYSTEM_NAME//' on '//CMAKE_SYSTEM_PROCESSOR
118+
print'(1x,a,1x,i0,a,i0,a,i0)', &
119+
'PETSc version:',PETSC_VERSION_MAJOR,'.',PETSC_VERSION_MINOR,'.',PETSC_VERSION_SUBMINOR
117120

118-
! https://github.com/jeffhammond/HPCInfo/blob/master/docs/Preprocessor-Macros.md
119-
print'(/,1x,a)', 'Compiled on: '//__DATE__//' at '//__TIME__
120-
121-
print'(/,1x,a,1x,i0,a,i0,a,i0)', &
122-
'PETSc version:',PETSC_VERSION_MAJOR,'.',PETSC_VERSION_MINOR,'.',PETSC_VERSION_SUBMINOR
121+
print'(/,1x,a)', 'Compiled at: '//__DATE__//' at '//__TIME__
123122

124-
call date_and_time(values = dateAndTime)
123+
call date_and_time(values = dateAndTime)
125124
print'(/,1x,a,1x,2(i2.2,a),i4.4)', 'Date:',dateAndTime(3),'/',dateAndTime(2),'/',dateAndTime(1)
126125
print'(1x,a,1x,2(i2.2,a),i2.2)', 'Time:',dateAndTime(5),':',dateAndTime(6),':',dateAndTime(7)
127126

0 commit comments

Comments
 (0)