diff --git a/examples/structured/test.py b/examples/structured/test.py index 1dead3e..fbe61f1 100644 --- a/examples/structured/test.py +++ b/examples/structured/test.py @@ -1,10 +1,14 @@ # this is a simple script to test the IDWarp module +import os from mpi4py import MPI from idwarp import USMesh +# Get the path of this file +baseDir = os.path.dirname(os.path.abspath(__file__)) + options = { "fileType": "CGNS", - "gridFile": "../../input_files/o_mesh.cgns", + "gridFile": os.path.join(baseDir,"../../input_files/o_mesh.cgns"), "aExp": 3.0, "bExp": 5.0, "LdefFact": 100.0, diff --git a/src/IO/readStructuredCGNS.F90 b/src/IO/readStructuredCGNS.F90 index 560831d..6966aff 100644 --- a/src/IO/readStructuredCGNS.F90 +++ b/src/IO/readStructuredCGNS.F90 @@ -38,7 +38,7 @@ subroutine readStructuredCGNS(cg) ! Always the first base base = 1_intType - call cg_nzones_f(cg, base, nZones, ierr); + call cg_nzones_f(cg, base, nZones, ierr) if (ierr .eq. CG_ERROR) call cg_error_exit_f allocate (zones(nZones)) diff --git a/src/IO/writeCGNS.F90 b/src/IO/writeCGNS.F90 index 5803cca..e96658b 100644 --- a/src/IO/writeCGNS.F90 +++ b/src/IO/writeCGNS.F90 @@ -4,6 +4,7 @@ subroutine writeCGNS(cgns_file) use communication use CGNSGrid use gridData + use petscCompat, only: VecGetArrayCompat, VecRestoreArrayCompat implicit none ! Input Arguments @@ -30,7 +31,7 @@ subroutine writeCGNS(cgns_file) ! Only do writing on root proc: rootProc: if (myid == 0) then - call VecGetArrayF90(XvLocal, xx, ierr) + call VecGetArrayCompat(XvLocal, xx, ierr) call EChk(ierr, __FILE__, __LINE__) ! Open and get the number of zones: @@ -79,7 +80,7 @@ subroutine writeCGNS(cgns_file) call cg_close_f(cg, ierr) if (ierr .eq. CG_ERROR) call cg_error_exit_f - call VecRestoreArrayF90(XvLocal, xx, ierr) + call VecRestoreArrayCompat(XvLocal, xx, ierr) call EChk(ierr, __FILE__, __LINE__) end if rootProc diff --git a/src/IO/writePlot3d.F90 b/src/IO/writePlot3d.F90 index 1894e06..f7e9a75 100644 --- a/src/IO/writePlot3d.F90 +++ b/src/IO/writePlot3d.F90 @@ -4,6 +4,7 @@ subroutine writePlot3d(plot3d_file) use communication use CGNSGrid use gridData + use petscCompat, only: VecGetArrayCompat, VecRestoreArrayCompat implicit none ! Input Arguments @@ -29,7 +30,7 @@ subroutine writePlot3d(plot3d_file) ! Only do writing on root proc: rootProc: if (myid == 0) then - call VecGetArrayF90(XvLocal, xx, ierr) + call VecGetArrayCompat(XvLocal, xx, ierr) call EChk(ierr, __FILE__, __LINE__) ! Open the new file @@ -79,7 +80,7 @@ subroutine writePlot3d(plot3d_file) deallocate (coorX, coorY, coorZ) end do - call VecRestoreArrayF90(XvLocal, xx, ierr) + call VecRestoreArrayCompat(XvLocal, xx, ierr) call EChk(ierr, __FILE__, __LINE__) ! Close the output file diff --git a/src/modules/Makefile b/src/modules/Makefile index c2f5eb9..ef66c98 100644 --- a/src/modules/Makefile +++ b/src/modules/Makefile @@ -20,6 +20,7 @@ FF90_OBJECTS_3 = gridInput.o\ communication.o\ FF90_OBJECTS_4 = gridData.o\ + petscCompat.o\ FF90_OBJECTS_5 = kd_tree.o\ kd_tree2.o\ @@ -30,6 +31,7 @@ FILES_TO_COMPLEXIFY = precision.F90\ gridInput.f90\ communication.f90\ gridData.F90\ + petscCompat.F90\ kd_tree.F90\ cgnsGrid.F90\ kd_tree2.f90\ diff --git a/src/modules/gridData.F90 b/src/modules/gridData.F90 index a4299e0..6ff4708 100644 --- a/src/modules/gridData.F90 +++ b/src/modules/gridData.F90 @@ -54,7 +54,7 @@ module gridData real(kind=realType), dimension(:), allocatable :: d2wall real(kind=realType), dimension(:), allocatable :: denominator, denominator0 - real(kind=realType), dimension(:, :), allocatable :: numerator + real(kind=realType), dimension(:, :), allocatable, target :: numerator ! Symmetry Information integer(kind=intType) :: nLoop diff --git a/src/modules/kd_tree.F90 b/src/modules/kd_tree.F90 index f41da44..966c846 100644 --- a/src/modules/kd_tree.F90 +++ b/src/modules/kd_tree.F90 @@ -1552,6 +1552,7 @@ subroutine initNodalProperties(tp) use gridInput use gridData use communication + use petscCompat, only: VecGetArrayCompat, VecRestoreArrayCompat implicit none Type(tree_master_record), Pointer :: tp @@ -1565,14 +1566,14 @@ subroutine initNodalProperties(tp) call EChk(ierr, __FILE__, __LINE__) ! Extract a pointer from Xs to use in the main routine - call VecGetArrayF90(XsLocal, XsPtr, ierr) + call VecGetArrayCompat(XsLocal, XsPtr, ierr) call EChk(ierr, __FILE__, __LINE__) call computeNodalProperties(tp, .True.) call determineCorners(tp) ! Restore all the arrays - call VecRestoreArrayF90(XsLocal, XsPtr, ierr) + call VecRestoreArrayCompat(XsLocal, XsPtr, ierr) call EChk(ierr, __FILE__, __LINE__) end subroutine initNodalProperties diff --git a/src/modules/petscCompat.F90 b/src/modules/petscCompat.F90 new file mode 100644 index 0000000..af7d28b --- /dev/null +++ b/src/modules/petscCompat.F90 @@ -0,0 +1,131 @@ +module petscCompat +! Include PETSc version macros +#include + ! Module for PETSc compatibility functions + ! This module provides compatibility for various subroutines in PETSc + ! This is because of the changes in the API between different versions of PETSc + ! This module is used to ensure that the code works with different versions of PETSc + + use petscvec + use constants + use communication + implicit none + save + + ! Internal static array needed for PETSc <3.23 VecGetOwnershipRanges + integer(kind=intType), allocatable, target :: array(:) + logical :: arrayAllocated = .false. + +contains + + subroutine VecGetArrayCompat(v, array, ierr) + ! PETSc compatibility routine to get array from vector + implicit none + Vec :: v + real(kind=realType), pointer :: array(:) + integer(kind=intType) :: ierr + +#if PETSC_VERSION_LT(3,20,0) + call VecGetArrayF90(v, array, ierr) +#else + call VecGetArray(v, array, ierr) +#endif + + end subroutine VecGetArrayCompat + + subroutine VecRestoreArrayCompat(v, array, ierr) + ! PETSc compatibility routine to restore array + implicit none + Vec :: v + real(kind=realType), pointer :: array(:) + integer(kind=intType) :: ierr + +#if PETSC_VERSION_LT(3,20,0) + call VecRestoreArrayF90(v, array, ierr) +#else + call VecRestoreArray(v, array, ierr) +#endif + + end subroutine VecRestoreArrayCompat + + subroutine VecCreateMPIWithArrayCompat(comm, bs, n, nGlobal, array, v, ierr) + ! PETSc compatibility routine to create a MPI vector with an array. + ! In some cases array is not supplied so it supports optional array argument. + implicit none + integer(kind=intType), intent(in) :: comm, bs + integer(kind=intType), intent(in) :: n, nGlobal + real(kind=realType), dimension(:), intent(in), optional :: array + Vec :: v + integer(kind=intType) :: ierr + +#if PETSC_VERSION_GE(3,22,0) + ! PETSc >= 3.22, need to use PETSC_NULL_SCALAR_ARRAY + if (present(array)) then + call VecCreateMPIWithArray(comm, bs, n, nGlobal, array, v, ierr) + else + call VecCreateMPIWithArray(comm, bs, n, nGlobal, PETSC_NULL_SCALAR_ARRAY, v, ierr) + end if +#else + ! Older PETSc, use PETSC_NULL_SCALAR for older versions + if (present(array)) then + call VecCreateMPIWithArray(comm, bs, n, nGlobal, array, v, ierr) + else + call VecCreateMPIWithArray(comm, bs, n, nGlobal, PETSC_NULL_SCALAR, v, ierr) + end if +#endif + + end subroutine VecCreateMPIWithArrayCompat + + subroutine VecGetOwnershipRangesCompat(v, ptr, ierr) + ! PETSc compatibility routine to get ownership ranges + Vec :: v + integer(kind=intType), pointer :: ptr(:) + integer(kind=intType), intent(out) :: ierr + +#if PETSC_VERSION_GE(3,23,0) + ! PETSc >= 3.23, directly get pointer + call VecGetOwnershipRanges(v, ptr, ierr) +#else + ! Older PETSc, allocate array that gets passed to PETSc and set pointer + integer(kind=intType), allocatable, target, save :: array(:) + + ! Check if we already have an allocated array + if (allocated(array)) then + deallocate (array) + end if + ! Use zero-based indexing to match to rank + allocate (array(0:nProc)) + array = zero + arrayAllocated = .true. + + ! Get the ownership ranges into the static array and set the pointer + call VecGetOwnershipRanges(v, array, ierr) + ptr => array +#endif + + end subroutine VecGetOwnershipRangesCompat + + subroutine VecRestoreOwnershipRangesCompat(v, ptr, ierr) + ! PETSc compatibility routine to restore ownership ranges pointer + Vec :: v + integer(kind=intType), pointer :: ptr(:) + integer(kind=intType), intent(out) :: ierr + +#if PETSC_VERSION_GE(3,23,0) + ! PETSc >= 3.23, just restore ranges using the pointer + call VecRestoreOwnershipRanges(v, ptr, ierr) +#else + ! Older PETSc, deallocate the internal static array and nullify pointer + if (arrayAllocated) then + if (allocated(array)) then + deallocate (array) + end if + nullify (ptr) + arrayAllocated = .false. + end if + ierr = 0 +#endif + + end subroutine VecRestoreOwnershipRangesCompat + +end module petscCompat diff --git a/src/warp/getCommonVolumeCoordinates.F90 b/src/warp/getCommonVolumeCoordinates.F90 index 8186ee1..ba9f719 100644 --- a/src/warp/getCommonVolumeCoordinates.F90 +++ b/src/warp/getCommonVolumeCoordinates.F90 @@ -3,6 +3,7 @@ subroutine getCommonVolumeCoordinates(gridNodes, nDOF) use gridData + use petscCompat, only: VecGetArrayCompat, VecRestoreArrayCompat implicit none ! Subroutine variables @@ -20,13 +21,13 @@ subroutine getCommonVolumeCoordinates(gridNodes, nDOF) INSERT_VALUES, SCATTER_REVERSE, ierr) call EChk(ierr, __FILE__, __LINE__) - call VecGetArrayF90(commonGridVec, xx, ierr) + call VecGetArrayCompat(commonGridVec, xx, ierr) call EChk(ierr, __FILE__, __LINE__) ! Perform the actual copy gridNodes = xx - call VecRestoreArrayF90(Xv, xx, ierr) + call VecRestoreArrayCompat(Xv, xx, ierr) call EChk(ierr, __FILE__, __LINE__) end subroutine getCommonVolumeCoordinates @@ -34,6 +35,7 @@ end subroutine getCommonVolumeCoordinates subroutine setCommonVolumeCoordinates(gridNodes, nDOF) use gridData + use petscCompat, only: VecGetArrayCompat, VecRestoreArrayCompat implicit none ! Subroutine variables @@ -42,13 +44,13 @@ subroutine setCommonVolumeCoordinates(gridNodes, nDOF) real(kind=realType), pointer, dimension(:) :: xx integer(kind=intType) :: ierr - call VecGetArrayF90(commonGridVec, xx, ierr) + call VecGetArrayCompat(commonGridVec, xx, ierr) call EChk(ierr, __FILE__, __LINE__) ! Perform actual copy xx = gridNodes - call VecRestoreArrayF90(commonGridVec, xx, ierr) + call VecRestoreArrayCompat(commonGridVec, xx, ierr) call EChk(ierr, __FILE__, __LINE__) ! Now do the vecScatter: warp_to_common in REVERSE diff --git a/src/warp/getVolumeCoordinates.F90 b/src/warp/getVolumeCoordinates.F90 index 10cbb3e..e16fc01 100644 --- a/src/warp/getVolumeCoordinates.F90 +++ b/src/warp/getVolumeCoordinates.F90 @@ -2,6 +2,7 @@ subroutine getVolumeCoordinates(gridNodes, nDOF) use gridData + use petscCompat, only: VecGetArrayCompat, VecRestoreArrayCompat implicit none ! Subroutine variables @@ -11,13 +12,13 @@ subroutine getVolumeCoordinates(gridNodes, nDOF) integer(kind=intType) :: ierr ! No error checking here! - call VecGetArrayF90(Xv, xx, ierr) + call VecGetArrayCompat(Xv, xx, ierr) call EChk(ierr, __FILE__, __LINE__) ! Perform copy gridNodes = xx - call VecRestoreArrayF90(Xv, xx, ierr) + call VecRestoreArrayCompat(Xv, xx, ierr) call EChk(ierr, __FILE__, __LINE__) end subroutine getVolumeCoordinates @@ -25,6 +26,7 @@ end subroutine getVolumeCoordinates subroutine setVolumeCoordinates(gridNodes, nDOF) use gridData + use petscCompat, only: VecGetArrayCompat, VecRestoreArrayCompat implicit none ! Subroutine variables @@ -34,13 +36,13 @@ subroutine setVolumeCoordinates(gridNodes, nDOF) integer(kind=intType) :: ierr ! No error checking here! - call VecGetArrayF90(Xv, xx, ierr) + call VecGetArrayCompat(Xv, xx, ierr) call EChk(ierr, __FILE__, __LINE__) ! Perform copy xx = gridNodes - call VecRestoreArrayF90(Xv, xx, ierr) + call VecRestoreArrayCompat(Xv, xx, ierr) call EChk(ierr, __FILE__, __LINE__) end subroutine setVolumeCoordinates diff --git a/src/warp/initializeWarping.F90 b/src/warp/initializeWarping.F90 index 26680e1..c88dd37 100644 --- a/src/warp/initializeWarping.F90 +++ b/src/warp/initializeWarping.F90 @@ -5,6 +5,8 @@ subroutine initializeWarping(pts, uniquePts, link, faceSizes, faceConn, & use communication use kd_tree use gridData + use petscCompat, only: VecGetArrayCompat, VecRestoreArrayCompat, & + VecGetOwnershipRangesCompat, VecRestoreOwnershipRangesCompat implicit none ! Input @@ -18,7 +20,9 @@ subroutine initializeWarping(pts, uniquePts, link, faceSizes, faceConn, & ! Working integer(kind=intType) :: nNodesTotal, ierr, iStart, iEnd, iProc integer(kind=intType) :: i, j, ii, kk - real(kind=realType), dimension(:), allocatable :: costs, procEndCosts, cumNodesProc + integer(kind=intType), pointer :: cumNodesProc(:) + real(kind=realType), pointer :: numerator1D(:) + real(kind=realType), dimension(:), allocatable :: costs, procEndCosts integer(kind=intType), dimension(:), allocatable :: procSplits, procSplitsLocal real(kind=realType), dimension(:), allocatable :: denominator0Copy real(kind=realtype) :: costOffset, totalCost, averageCost, c, tmp, r(3) @@ -75,7 +79,7 @@ subroutine initializeWarping(pts, uniquePts, link, faceSizes, faceConn, & ! 3. Load balance file name is supplied and exists. Load and check a few ! If they don't match, do regular dry run - call VecGetArrayF90(commonGridVec, Xv0Ptr, ierr) + call VecGetArrayCompat(commonGridVec, Xv0Ptr, ierr) call EChk(ierr, __FILE__, __LINE__) ! Allocate the denominator estimate and costs. These may be loaded @@ -87,9 +91,7 @@ subroutine initializeWarping(pts, uniquePts, link, faceSizes, faceConn, & ! Get the ownership ranges for common grid vector, we need that to ! determine where to write things. - allocate (cumNodesProc(0:nProc)) - - call VecGetOwnershipRanges(commonGridVec, cumNodesProc, ierr) + call VecGetOwnershipRangesCompat(commonGridVec, cumNodesProc, ierr) call EChk(ierr, __FILE__, __LINE__) ! Divide that by 3 since that includes the 3 dof per popint @@ -312,7 +314,11 @@ subroutine initializeWarping(pts, uniquePts, link, faceSizes, faceConn, & end if ! Don't forget to restore arrays! - call VecRestoreArrayF90(commonGridVec, Xv0Ptr, ierr) + call VecRestoreArrayCompat(commonGridVec, Xv0Ptr, ierr) + call EChk(ierr, __FILE__, __LINE__) + + ! Release the ownership ranges + call VecRestoreOwnershipRangesCompat(commonGridVec, cumNodesProc, ierr) call EChk(ierr, __FILE__, __LINE__) ! Now put the costs in cumulative format @@ -458,6 +464,9 @@ subroutine initializeWarping(pts, uniquePts, link, faceSizes, faceConn, & ! We can now also allocate the final space for the denominator allocate (numerator(3, newDOFProc / 3)) + ! We alias the numerator using the pointer numerator1D so we can pass it directly to VecPlaceArray + numerator1D(1:size(numerator)) => numerator + allocate (denominator(newDOFProc / 3)) allocate (denominator0Copy(nVol * 3)) do i = 1, nVol @@ -471,7 +480,7 @@ subroutine initializeWarping(pts, uniquePts, link, faceSizes, faceConn, & call VecPlaceArray(commonGridVec, denominator0Copy, ierr) call EChk(ierr, __FILE__, __LINE__) - call VecPlaceArray(Xv, numerator, ierr) + call VecPlaceArray(Xv, numerator1D, ierr) call EChk(ierr, __FILE__, __LINE__) ! Actual scatter @@ -498,7 +507,6 @@ subroutine initializeWarping(pts, uniquePts, link, faceSizes, faceConn, & commonMeshDOF = nVol * 3 ! Deallocate the memory from this subroutine - deallocate (cumNodesProc) deallocate (costs, procEndCosts, procSplits, procSplitsLocal, denominator0Copy) if (myid == 0) then diff --git a/src/warp/setExternalMeshIndices.F90 b/src/warp/setExternalMeshIndices.F90 index 8d395aa..17f5dc9 100644 --- a/src/warp/setExternalMeshIndices.F90 +++ b/src/warp/setExternalMeshIndices.F90 @@ -2,6 +2,7 @@ subroutine setExternalMeshIndices(ndof_solver, solver_indices) use communication use gridData + use petscCompat, only: VecCreateMPIWithArrayCompat implicit none ! Subroutine Arguments @@ -28,8 +29,7 @@ subroutine setExternalMeshIndices(ndof_solver, solver_indices) ! Create an 'empty' PETSc vector. This will have an array ! vecPlace'd in them for doing the actual scatters. - call VecCreateMPIWithArray(WARP_COMM_WORLD, 1, ndof_solver, PETSC_DECIDE, & - PETSC_NULL_SCALAR, solverGridVec, ierr) + call VecCreateMPIWithArrayCompat(WARP_COMM_WORLD, 1, ndof_solver, PETSC_DECIDE, v=solverGridVec, ierr=ierr) call EChk(ierr, __FILE__, __LINE__) ! ~~~~~~~~ Common to Solver Scatter~~~~~~~~~ diff --git a/src/warp/verifyWarpDeriv.F90 b/src/warp/verifyWarpDeriv.F90 index 0929421..6b01de3 100644 --- a/src/warp/verifyWarpDeriv.F90 +++ b/src/warp/verifyWarpDeriv.F90 @@ -4,6 +4,7 @@ subroutine verifyWarpDeriv(dXv_f, ndof_warp, dof_start, dof_end, h) use gridData use gridInput use communication + use petscCompat, only: VecGetArrayCompat, VecRestoreArrayCompat implicit none @@ -52,15 +53,11 @@ subroutine verifyWarpDeriv(dXv_f, ndof_warp, dof_start, dof_end, h) ! add h to dof if (dof >= istart .and. dof < iend) then -#if PETSC_VERSION_GE(3,14,0) - call VecGetValues(Xs, 1, dof, orig_value, ierr) -#else - call VecGetValues(Xs, 1, (/dof/), orig_value, ierr) -#endif + call VecGetValues(Xs, 1, [dof], orig_value, ierr) call EChk(ierr, __FILE__, __LINE__) val = orig_value(1) + h - call VecSetValue(Xs, (/dof/), val, INSERT_VALUES, ierr) + call VecSetValue(Xs, dof, val, INSERT_VALUES, ierr) call EChk(ierr, __FILE__, __LINE__) end if @@ -72,18 +69,18 @@ subroutine verifyWarpDeriv(dXv_f, ndof_warp, dof_start, dof_end, h) call warpMesh() ! Copy what is is Xv into Xplus - call VecGetArrayF90(Xv, XvPtr, ierr) + call VecGetArrayCompat(Xv, XvPtr, ierr) call EChk(ierr, __FILE__, __LINE__) xplus = XvPtr - call VecRestoreArrayF90(Xv, XvPtr, ierr) + call VecRestoreArrayCompat(Xv, XvPtr, ierr) call EChk(ierr, __FILE__, __LINE__) ! Subtract 2h from dof to get x(dof)-h if (dof >= istart .and. dof < iend) then val = orig_value(1) - h - call VecSetValue(Xs, (/dof/), val, INSERT_VALUES, ierr) + call VecSetValue(Xs, dof, val, INSERT_VALUES, ierr) call EChk(ierr, __FILE__, __LINE__) end if @@ -96,17 +93,17 @@ subroutine verifyWarpDeriv(dXv_f, ndof_warp, dof_start, dof_end, h) call warpMesh() ! Copy what is is Xv into Xminus - call VecGetArrayF90(Xv, XvPtr, ierr) + call VecGetArrayCompat(Xv, XvPtr, ierr) call EChk(ierr, __FILE__, __LINE__) xminus = XvPtr - call VecRestoreArrayF90(Xv, XvPtr, ierr) + call VecRestoreArrayCompat(Xv, XvPtr, ierr) call EChk(ierr, __FILE__, __LINE__) ! reset the original value if (dof >= istart .and. dof < iend) then - call VecSetValue(Xs, (/dof/), orig_value(1), INSERT_VALUES, ierr) + call VecSetValue(Xs, dof, orig_value(1), INSERT_VALUES, ierr) call EChk(ierr, __FILE__, __LINE__) end if @@ -128,11 +125,7 @@ subroutine verifyWarpDeriv(dXv_f, ndof_warp, dof_start, dof_end, h) call EChk(ierr, __FILE__, __LINE__) if (dof >= istart .and. dof < iend) then -#if PETSC_VERSION_GE(3,14,0) - call VecGetValues(dXs, 1, dof, ADvalue, ierr) -#else - call VecGetValues(dXs, 1, (/dof/), ADvalue, ierr) -#endif + call VecGetValues(dXs, 1, [dof], ADvalue, ierr) call EChk(ierr, __FILE__, __LINE__) if (abs(half * (FDValue + ADValue(1))) < 1e-16) then err = 1e-16 diff --git a/src/warp/warpDeriv.F90 b/src/warp/warpDeriv.F90 index 469f44e..943185a 100644 --- a/src/warp/warpDeriv.F90 +++ b/src/warp/warpDeriv.F90 @@ -8,6 +8,7 @@ subroutine warpDeriv(dXv_f, ndof_warp) use gridInput use communication use kd_tree + use petscCompat, only: VecGetArrayCompat, VecRestoreArrayCompat implicit none ! Input @@ -29,17 +30,17 @@ subroutine warpDeriv(dXv_f, ndof_warp) call EChk(ierr, __FILE__, __LINE__) ! Extract a pointer from Xs to use in the main routine - call VecGetArrayF90(XsLocal, XsPtr, ierr) + call VecGetArrayCompat(XsLocal, XsPtr, ierr) call EChk(ierr, __FILE__, __LINE__) ! Extract the pointers for the volume nodes that we wish to operate on - call VecGetArrayF90(Xv0, Xv0Ptr, ierr) + call VecGetArrayCompat(Xv0, Xv0Ptr, ierr) call EChk(ierr, __FILE__, __LINE__) - call VecGetArrayF90(Xv, XvPtr, ierr) + call VecGetArrayCompat(Xv, XvPtr, ierr) call EChk(ierr, __FILE__, __LINE__) - call VecGetArrayF90(dXs, dXsPtr, ierr) + call VecGetArrayCompat(dXs, dXsPtr, ierr) call EChk(ierr, __FILE__, __LINE__) ! Allocate the extra data we need for the warping derivative: @@ -116,16 +117,16 @@ subroutine warpDeriv(dXv_f, ndof_warp) deallocate (XvPtrb, XsPtrb) ! Restore all the arrays - call VecRestoreArrayF90(XsLocal, XsPtr, ierr) + call VecRestoreArrayCompat(XsLocal, XsPtr, ierr) call EChk(ierr, __FILE__, __LINE__) - call VecRestoreArrayF90(Xv0, Xv0Ptr, ierr) + call VecRestoreArrayCompat(Xv0, Xv0Ptr, ierr) call EChk(ierr, __FILE__, __LINE__) - call VecRestoreArrayF90(Xv, XvPtr, ierr) + call VecRestoreArrayCompat(Xv, XvPtr, ierr) call EChk(ierr, __FILE__, __LINE__) - call VecRestoreArrayF90(dXs, dXsPtr, ierr) + call VecRestoreArrayCompat(dXs, dXsPtr, ierr) call EChk(ierr, __FILE__, __LINE__) #endif end subroutine warpDeriv diff --git a/src/warp/warpDerivFwd.F90 b/src/warp/warpDerivFwd.F90 index fc58025..d7a0eab 100644 --- a/src/warp/warpDerivFwd.F90 +++ b/src/warp/warpDerivFwd.F90 @@ -3,6 +3,7 @@ subroutine warpDerivFwd(Xsdot, cDof, Xvdot, meshDOF) use gridData use gridInput use kd_tree + use petscCompat, only: VecGetArrayCompat, VecRestoreArrayCompat implicit none @@ -45,14 +46,14 @@ subroutine warpDerivFwd(Xsdot, cDof, Xvdot, meshDOF) call EChk(ierr, __FILE__, __LINE__) ! Extract a pointer from XsLocal and XsLoacld to use in the main routine - call VecGetArrayF90(XsLocal, XsPtr, ierr) + call VecGetArrayCompat(XsLocal, XsPtr, ierr) call EChk(ierr, __FILE__, __LINE__) - call VecGetArrayF90(dXsLocal, XsPtrd, ierr) + call VecGetArrayCompat(dXsLocal, XsPtrd, ierr) call EChk(ierr, __FILE__, __LINE__) ! Extract the pointers for the volume nodes that we wish to operate on - call VecGetArrayF90(Xv0, Xv0Ptr, ierr) + call VecGetArrayCompat(Xv0, Xv0Ptr, ierr) call EChk(ierr, __FILE__, __LINE__) call allocDerivValues(mytrees(1)%tp) @@ -99,13 +100,13 @@ subroutine warpDerivFwd(Xsdot, cDof, Xvdot, meshDOF) end do updateLoop ! Restore all the arrays - call VecRestoreArrayF90(XsLocal, XsPtr, ierr) + call VecRestoreArrayCompat(XsLocal, XsPtr, ierr) call EChk(ierr, __FILE__, __LINE__) - call VecRestoreArrayF90(dXsLocal, dXsPtr, ierr) + call VecRestoreArrayCompat(dXsLocal, dXsPtr, ierr) call EChk(ierr, __FILE__, __LINE__) - call VecRestoreArrayF90(Xv0, Xv0Ptr, ierr) + call VecRestoreArrayCompat(Xv0, Xv0Ptr, ierr) call EChk(ierr, __FILE__, __LINE__) #endif end subroutine warpDerivFwd diff --git a/src/warp/warpMesh.F90 b/src/warp/warpMesh.F90 index fe9e62e..73b6273 100644 --- a/src/warp/warpMesh.F90 +++ b/src/warp/warpMesh.F90 @@ -8,6 +8,7 @@ subroutine warpMesh() use gridData use gridInput use kd_tree + use petscCompat, only: VecGetArrayCompat, VecRestoreArrayCompat implicit none @@ -24,14 +25,14 @@ subroutine warpMesh() call EChk(ierr, __FILE__, __LINE__) ! Extract a pointer from Xs to use in the main routine - call VecGetArrayF90(XsLocal, XsPtr, ierr) + call VecGetArrayCompat(XsLocal, XsPtr, ierr) call EChk(ierr, __FILE__, __LINE__) ! Extract the pointers for the volume nodes that we wish to operate on - call VecGetArrayF90(Xv0, Xv0Ptr, ierr) + call VecGetArrayCompat(Xv0, Xv0Ptr, ierr) call EChk(ierr, __FILE__, __LINE__) - call VecGetArrayF90(Xv, XvPtr, ierr) + call VecGetArrayCompat(Xv, XvPtr, ierr) call EChk(ierr, __FILE__, __LINE__) nVol = size(XvPtr) / 3 @@ -70,13 +71,13 @@ subroutine warpMesh() end do updateLoop ! Restore all the arrays - call VecRestoreArrayF90(XsLocal, XsPtr, ierr) + call VecRestoreArrayCompat(XsLocal, XsPtr, ierr) call EChk(ierr, __FILE__, __LINE__) - call VecRestoreArrayF90(Xv0, Xv0Ptr, ierr) + call VecRestoreArrayCompat(Xv0, Xv0Ptr, ierr) call EChk(ierr, __FILE__, __LINE__) - call VecRestoreArrayF90(Xv, XvPtr, ierr) + call VecRestoreArrayCompat(Xv, XvPtr, ierr) call EChk(ierr, __FILE__, __LINE__) end subroutine warpMesh