-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from dareg/field_resize
Field resize
- Loading branch information
Showing
8 changed files
with
290 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
! (C) Copyright 2022- ECMWF. | ||
! (C) Copyright 2022- Meteo-France. | ||
! | ||
! This software is licensed under the terms of the Apache Licence Version 2.0 | ||
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
! In applying this licence, ECMWF does not waive the privileges and immunities | ||
! granted to it by virtue of its status as an intergovernmental organisation | ||
! nor does it submit to any jurisdiction. | ||
|
||
PROGRAM GET_DIMS | ||
!TEST THAT GET DIMS RETURN THE RIGHT VALUES | ||
|
||
USE FIELD_MODULE | ||
USE FIELD_FACTORY_MODULE | ||
USE PARKIND1 | ||
USE OML_MOD, ONLY: OML_MAX_THREADS | ||
IMPLICIT NONE | ||
CLASS(FIELD_2RB), POINTER :: O => NULL() | ||
CLASS(FIELD_2RB), POINTER :: W => NULL() | ||
REAL(KIND=JPRB) :: D(2:33,2:4) | ||
INTEGER :: L(2), U(2) | ||
|
||
|
||
CALL FIELD_NEW(O, LBOUNDS=[10,5], UBOUNDS=[21,11]) | ||
CALL O%GET_DIMS(LBOUNDS=L, UBOUNDS=U) | ||
IF(L(1)/= 10 .AND. L(2)/=5)THEN | ||
WRITE(*,*)"OWNER BAD LOWER BOUNDS" | ||
ERROR STOP | ||
END IF | ||
IF(U(1)/= 21 .AND. U(2) /= 11)THEN | ||
WRITE(*,*)"OWNER BAD UPPER BOUNDS" | ||
ERROR STOP | ||
END IF | ||
CALL FIELD_DELETE(O) | ||
|
||
|
||
CALL FIELD_NEW(O, LBOUNDS=[10,5], UBOUNDS=[21,11], PERSISTENT=.FALSE.) | ||
IF(L(1)/= 10 .AND. L(2)/=1)THEN | ||
WRITE(*,*)"OWNER BAD LOWER BOUNDS WHEN PERSISTENT" | ||
ERROR STOP | ||
END IF | ||
IF(U(1)/= 21 .AND. U(2) /= OML_MAX_THREADS())THEN | ||
WRITE(*,*)"OWNER BAD UPPER BOUNDS WHEN PERSISTENT" | ||
ERROR STOP | ||
END IF | ||
CALL FIELD_DELETE(O) | ||
|
||
|
||
CALL FIELD_NEW(W, DATA=D) | ||
CALL W%GET_DIMS(LBOUNDS=L, UBOUNDS=U) | ||
IF(L(1)/= 1 .AND. L(2)/=1)THEN | ||
WRITE(*,*)"WRAPPER BAD LOWER BOUNDS" | ||
ERROR STOP | ||
END IF | ||
IF(U(1)/= 32 .AND. U(2) /= 3)THEN | ||
WRITE(*,*)"WRAPPER BAD UPPER BOUNDS" | ||
ERROR STOP | ||
END IF | ||
CALL FIELD_DELETE(W) | ||
|
||
|
||
CALL FIELD_NEW(W, DATA=D, LBOUNDS=[2,2]) | ||
CALL W%GET_DIMS(LBOUNDS=L, UBOUNDS=U) | ||
IF(L(1)/= 2 .AND. L(2)/=2)THEN | ||
WRITE(*,*)"WRAPPER BAD LOWER BOUNDS WITH LBOUNDS ARG" | ||
ERROR STOP | ||
END IF | ||
IF(U(1)/= 33 .AND. U(2) /= 4)THEN | ||
WRITE(*,*)"WRAPPER BAD UPPER BOUNDS WITH LBOUNDS ARG" | ||
ERROR STOP | ||
END IF | ||
CALL FIELD_DELETE(W) | ||
|
||
END PROGRAM GET_DIMS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
! (C) Copyright 2022- ECMWF. | ||
! (C) Copyright 2022- Meteo-France. | ||
! | ||
! This software is licensed under the terms of the Apache Licence Version 2.0 | ||
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
! In applying this licence, ECMWF does not waive the privileges and immunities | ||
! granted to it by virtue of its status as an intergovernmental organisation | ||
! nor does it submit to any jurisdiction. | ||
|
||
PROGRAM RESIZE_OWNER | ||
!TEST IF RESIZING A OWNER IS WORKING | ||
|
||
USE FIELD_MODULE | ||
USE FIELD_FACTORY_MODULE | ||
USE PARKIND1 | ||
IMPLICIT NONE | ||
CLASS(FIELD_2RB), POINTER :: O => NULL() | ||
REAL(KIND=JPRB), POINTER :: PTR(:,:) | ||
INTEGER(KIND=JPIM) :: L(2),U(2) | ||
|
||
CALL FIELD_NEW(O, LBOUNDS=[10,1], UBOUNDS=[21,11], PERSISTENT=.TRUE.) | ||
CALL O%GET_HOST_DATA_RDWR(PTR) | ||
PTR=42 | ||
|
||
CALL FIELD_RESIZE(O, UBOUNDS=[100,100], PERSISTENT=.TRUE.) | ||
CALL O%GET_HOST_DATA_RDWR(PTR) | ||
PTR=7 | ||
|
||
CALL O%GET_DIMS(LBOUNDS=L,UBOUNDS=U) | ||
IF(.NOT. U(1) == 100)THEN | ||
WRITE(*,*)"U(1) != 100" | ||
ERROR STOP | ||
END IF | ||
IF(.NOT. U(2) == 100)THEN | ||
WRITE(*,*)"U(2) != 100" | ||
ERROR STOP | ||
END IF | ||
IF (.NOT. ALL(PTR == 7)) THEN | ||
WRITE(*,*)"PTR != 7" | ||
ERROR STOP | ||
END IF | ||
CALL FIELD_DELETE(O) | ||
END PROGRAM RESIZE_OWNER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
! (C) Copyright 2022- ECMWF. | ||
! (C) Copyright 2022- Meteo-France. | ||
! | ||
! This software is licensed under the terms of the Apache Licence Version 2.0 | ||
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
! In applying this licence, ECMWF does not waive the privileges and immunities | ||
! granted to it by virtue of its status as an intergovernmental organisation | ||
! nor does it submit to any jurisdiction. | ||
|
||
PROGRAM RESIZE_OWNER | ||
!TEST IF RESIZING A OWNER IS WORKING WHEN SIZE IS REDUCED | ||
|
||
USE FIELD_MODULE | ||
USE FIELD_FACTORY_MODULE | ||
USE PARKIND1 | ||
IMPLICIT NONE | ||
CLASS(FIELD_2RB), POINTER :: O => NULL() | ||
REAL(KIND=JPRB), POINTER :: PTR(:,:) | ||
INTEGER(KIND=JPIM) :: L(2),U(2) | ||
|
||
CALL FIELD_NEW(O, LBOUNDS=[10,1], UBOUNDS=[21,11], PERSISTENT=.TRUE.) | ||
CALL O%GET_HOST_DATA_RDWR(PTR) | ||
PTR=42 | ||
|
||
CALL FIELD_RESIZE(O, UBOUNDS=[1,1], PERSISTENT=.TRUE.) | ||
CALL O%GET_HOST_DATA_RDWR(PTR) | ||
PTR=7 | ||
|
||
CALL O%GET_DIMS(UBOUNDS=U,LBOUNDS=L) | ||
IF(.NOT. U(1) == 1)THEN | ||
WRITE(*,*)"U(1) != 1" | ||
ERROR STOP | ||
END IF | ||
IF(.NOT. U(2) == 1)THEN | ||
WRITE(*,*)"U(2) != 1" | ||
ERROR STOP | ||
END IF | ||
IF (.NOT. ALL(PTR == 7)) THEN | ||
WRITE(*,*)"PTR != 7" | ||
ERROR STOP | ||
END IF | ||
CALL FIELD_DELETE(O) | ||
END PROGRAM RESIZE_OWNER |
Oops, something went wrong.