From f0a75d8d62ded688975591dfdb0a108ae1155e2b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 4 Jul 2021 17:01:24 +0200 Subject: [PATCH] consistent capitalization Capitals for pre processor macros to avoid clashes --- CMakeLists.txt | 9 ++++----- Makefile | 4 ++-- PRIVATE | 2 +- src/CPFEM2.f90 | 10 +++++----- src/DAMASK_Marc.f90 | 12 +++++++----- src/DAMASK_interface.f90 | 5 +++++ 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6a133fe4..6a0cd63a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,16 +15,15 @@ pkg_get_variable (CMAKE_Fortran_COMPILER PETSc fcompiler) pkg_get_variable (CMAKE_C_COMPILER PETSc ccompiler) # Solver determines name of project -string(TOLOWER "${DAMASK_SOLVER}" DAMASK_SOLVER) -if (DAMASK_SOLVER STREQUAL "grid") +string(TOUPPER "${DAMASK_SOLVER}" DAMASK_SOLVER) +if (DAMASK_SOLVER STREQUAL "GRID") project (damask-grid HOMEPAGE_URL https://damask.mpie.de LANGUAGES Fortran C) - add_definitions (-DGrid) -elseif (DAMASK_SOLVER STREQUAL "mesh") +elseif (DAMASK_SOLVER STREQUAL "MESH") project (damask-mesh HOMEPAGE_URL https://damask.mpie.de LANGUAGES Fortran C) - add_definitions (-DMesh) else () message (FATAL_ERROR "Build target (DAMASK_SOLVER) is not defined") endif () +add_definitions ("-D${DAMASK_SOLVER}") file (STRINGS ${PROJECT_SOURCE_DIR}/VERSION DAMASK_VERSION) diff --git a/Makefile b/Makefile index dfbcbd5ae..e73205702 100644 --- a/Makefile +++ b/Makefile @@ -9,13 +9,13 @@ all: grid mesh .PHONY: grid grid: - @cmake -B build/grid -DDAMASK_SOLVER=GRID -DCMAKE_INSTALL_PREFIX=${PWD} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} + @cmake -B build/grid -DDAMASK_SOLVER=grid -DCMAKE_INSTALL_PREFIX=${PWD} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} @cmake --build build/grid --parallel @cmake --install build/grid .PHONY: mesh mesh: - @cmake -B build/mesh -DDAMASK_SOLVER=MESH -DCMAKE_INSTALL_PREFIX=${PWD} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} + @cmake -B build/mesh -DDAMASK_SOLVER=mesh -DCMAKE_INSTALL_PREFIX=${PWD} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} @cmake --build build/mesh --parallel @cmake --install build/mesh diff --git a/PRIVATE b/PRIVATE index 9fec97ad8..89ee5ced4 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 9fec97ad816c50d33ce235ca2e65602f525c1194 +Subproject commit 89ee5ced410c0d7f50ef20e39080f2c637b1b0f7 diff --git a/src/CPFEM2.f90 b/src/CPFEM2.f90 index bf044bef9..07f64b72a 100644 --- a/src/CPFEM2.f90 +++ b/src/CPFEM2.f90 @@ -20,10 +20,10 @@ module CPFEM2 use HDF5_utilities use homogenization use phase -#if defined(Mesh) +#if defined(MESH) use FEM_quadrature use discretization_mesh -#elif defined(Grid) +#elif defined(GRID) use discretization_grid #endif @@ -43,7 +43,7 @@ subroutine CPFEM_initAll call prec_init call IO_init call base64_init -#ifdef Mesh +#ifdef MESH call FEM_quadrature_init #endif call YAML_types_init @@ -54,9 +54,9 @@ subroutine CPFEM_initAll call lattice_init call HDF5_utilities_init call results_init(restart=interface_restartInc>0) -#if defined(Mesh) +#if defined(MESH) call discretization_mesh_init(restart=interface_restartInc>0) -#elif defined(Grid) +#elif defined(GRID) call discretization_grid_init(restart=interface_restartInc>0) #endif call material_init(restart=interface_restartInc>0) diff --git a/src/DAMASK_Marc.f90 b/src/DAMASK_Marc.f90 index 910ca86c0..e4859b4ab 100644 --- a/src/DAMASK_Marc.f90 +++ b/src/DAMASK_Marc.f90 @@ -11,15 +11,17 @@ #define QUOTE(x) #x #define PASTE(x,y) x ## y +#ifdef Marc4DAMASK +#define MARC4DAMASK Marc4DAMASK +#endif + #include "prec.f90" module DAMASK_interface use prec -#if __INTEL_COMPILER >= 1800 use, intrinsic :: ISO_fortran_env, only: & compiler_version, & compiler_options -#endif use ifport, only: & CHDIR @@ -212,8 +214,8 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & ! Marc common blocks are in fixed format so they have to be reformated to free format (f90) ! Beware of changes in newer Marc versions -#include QUOTE(PASTE(./Marc/include/concom,Marc4DAMASK)) ! concom is needed for inc, lovl -#include QUOTE(PASTE(./Marc/include/creeps,Marc4DAMASK)) ! creeps is needed for timinc (time increment) +#include QUOTE(PASTE(./Marc/include/concom,MARC4DAMASK)) ! concom is needed for inc, lovl +#include QUOTE(PASTE(./Marc/include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment) logical :: cutBack real(pReal), dimension(6) :: stress @@ -365,7 +367,7 @@ subroutine uedinc(inc,incsub) integer :: n, nqncomp, nqdatatype integer, save :: inc_written real(pReal), allocatable, dimension(:,:) :: d_n -#include QUOTE(PASTE(./Marc/include/creeps,Marc4DAMASK)) ! creeps is needed for timinc (time increment) +#include QUOTE(PASTE(./Marc/include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment) if (inc > inc_written) then diff --git a/src/DAMASK_interface.f90 b/src/DAMASK_interface.f90 index e5fbe20ac..0c3bdca80 100644 --- a/src/DAMASK_interface.f90 +++ b/src/DAMASK_interface.f90 @@ -86,6 +86,11 @@ subroutine DAMASK_interface_init print*, ' _/ _/ _/_/_/_/ _/ _/ _/ _/_/_/_/ _/_/ _/_/ _/_/' print*, ' _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/' print*, ' _/_/_/ _/ _/ _/ _/ _/ _/ _/_/_/ _/ _/ _/_/_/' +#if defined(GRID) + print*, ' Grid solver' +#elif defined(Mesh) + print*, ' Mesh solver' +#endif #ifdef DEBUG print'(/,a)', ' debug version - debug version - debug version - debug version - debug version' #endif