diff --git a/src/modules/Utility/src/AppendUtility.F90 b/src/modules/Utility/src/AppendUtility.F90 index 15873615..24760d33 100644 --- a/src/modules/Utility/src/AppendUtility.F90 +++ b/src/modules/Utility/src/AppendUtility.F90 @@ -128,6 +128,7 @@ MODULE PURE SUBROUTINE expand_real32(vec, n, chunk_size, val, finished) !! set to true to return `vec` !! as its correct size (`n`) END SUBROUTINE expand_real32 + MODULE PURE SUBROUTINE expand_real64(vec, n, chunk_size, val, finished) REAL(REAL64), ALLOCATABLE, INTENT(INOUT) :: vec(:) INTEGER(I4B), INTENT(INOUT) :: n @@ -159,45 +160,33 @@ END SUBROUTINE expand_real64 !- Append a scalar real to an real vector !- Append a real vector to a real vector -INTERFACE - !> +INTERFACE Append ! Append a scalar int to a vector of int - ! MODULE PURE SUBROUTINE Append_1a(A, ENTRY) INTEGER(I4B), ALLOCATABLE, INTENT(INOUT) :: A(:) INTEGER(I4B), INTENT(IN) :: ENTRY END SUBROUTINE Append_1a - !> ! Append a scalar real to a vector of real - ! MODULE PURE SUBROUTINE Append_1b(A, ENTRY) REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: A(:) REAL(DFP), INTENT(IN) :: ENTRY END SUBROUTINE Append_1b - !> ! Append a scalar and vector int to a vector of int - ! MODULE PURE SUBROUTINE Append_1c(C, A, B) INTEGER(I4B), ALLOCATABLE, INTENT(INOUT) :: C(:) INTEGER(I4B), INTENT(IN) :: A(:) INTEGER(I4B), INTENT(IN) :: B END SUBROUTINE Append_1c - !> ! Append a scalar and vector real to a vector of real - ! MODULE PURE SUBROUTINE Append_1d(C, A, B) REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: C(:) REAL(DFP), INTENT(IN) :: A(:) REAL(DFP), INTENT(IN) :: B END SUBROUTINE Append_1d -END INTERFACE - -INTERFACE Append - MODULE PROCEDURE Append_1a, Append_1b, Append_1c, Append_1d -END INTERFACE +END INTERFACE Append !---------------------------------------------------------------------------- ! Append@Methods @@ -214,7 +203,7 @@ END SUBROUTINE Append_1d !- Append two vectors of int to another vector of int !- Append two vector of real to another vector of real -INTERFACE +INTERFACE Append MODULE PURE SUBROUTINE Append_2a(A, ENTRY) INTEGER(I4B), ALLOCATABLE, INTENT(INOUT) :: A(:) INTEGER(I4B), INTENT(IN) :: ENTRY(:) @@ -236,11 +225,22 @@ MODULE PURE SUBROUTINE Append_2d(C, A, B) REAL(DFP), INTENT(IN) :: A(:) REAL(DFP), INTENT(IN) :: B(:) END SUBROUTINE Append_2d -END INTERFACE -INTERFACE Append - MODULE PROCEDURE Append_2a, Append_2b, Append_2c, Append_2d -END INTERFACE + MODULE PURE SUBROUTINE Append_2e(D, C, A, B) + INTEGER(I4B), ALLOCATABLE, INTENT(INOUT) :: D(:) + INTEGER(I4B), INTENT(IN) :: A(:) + INTEGER(I4B), INTENT(IN) :: B(:) + INTEGER(I4B), INTENT(IN) :: C(:) + END SUBROUTINE Append_2e + + MODULE PURE SUBROUTINE Append_2f(D, C, A, B) + REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: D(:) + REAL(DFP), INTENT(IN) :: A(:) + REAL(DFP), INTENT(IN) :: B(:) + REAL(DFP), INTENT(IN) :: C(:) + END SUBROUTINE Append_2f + +END INTERFACE Append !---------------------------------------------------------------------------- ! Append@Methods @@ -257,7 +257,7 @@ END SUBROUTINE Append_2d !- Append a scalar and vector of int to another vector of int !- Append a scalar and vector real to another vector of real -INTERFACE +INTERFACE Append MODULE PURE SUBROUTINE Append_3a(A, ENTRY, mask) INTEGER(I4B), ALLOCATABLE, INTENT(INOUT) :: A(:) INTEGER(I4B), INTENT(IN) :: ENTRY @@ -283,11 +283,7 @@ MODULE PURE SUBROUTINE Append_3d(C, A, B, mask) REAL(DFP), INTENT(IN) :: B LOGICAL(LGT), INTENT(IN) :: mask END SUBROUTINE Append_3d -END INTERFACE - -INTERFACE Append - MODULE PROCEDURE Append_3a, Append_3b, Append_3c, Append_3d -END INTERFACE +END INTERFACE Append !---------------------------------------------------------------------------- ! Append@Methods @@ -302,7 +298,7 @@ END SUBROUTINE Append_3d !- Append a vector of int to another vector of int !- Append a vector of real to another vector of real -INTERFACE +INTERFACE Append MODULE PURE SUBROUTINE Append_4a(A, ENTRY, mask) INTEGER(I4B), ALLOCATABLE, INTENT(INOUT) :: A(:) INTEGER(I4B), INTENT(IN) :: ENTRY(:) @@ -328,11 +324,7 @@ MODULE PURE SUBROUTINE Append_4d(C, A, B, mask) REAL(DFP), INTENT(IN) :: B(:) LOGICAL(LGT), INTENT(IN) :: mask(:) END SUBROUTINE Append_4d -END INTERFACE - -INTERFACE Append - MODULE PROCEDURE Append_4a, Append_4b, Append_4c, Append_4d -END INTERFACE +END INTERFACE Append !---------------------------------------------------------------------------- ! Append@Methods @@ -342,7 +334,7 @@ END SUBROUTINE Append_4d ! date: 22 March 2021 ! summary: Append a scalar INTEGER to INTEGER vec tor -INTERFACE +INTERFACE OPERATOR(.Append.) MODULE PURE FUNCTION func_Append_1a(A, ENTRY) RESULT(ans) INTEGER(I4B), INTENT(IN) :: A(:) INTEGER(I4B), INTENT(IN) :: ENTRY @@ -356,10 +348,6 @@ MODULE PURE FUNCTION func_Append_1b(A, ENTRY) RESULT(ans) END FUNCTION func_Append_1b END INTERFACE -INTERFACE OPERATOR(.APPEND.) - MODULE PROCEDURE func_Append_1a, func_Append_1b -END INTERFACE - !---------------------------------------------------------------------------- ! Append@Methods !---------------------------------------------------------------------------- @@ -368,7 +356,7 @@ END FUNCTION func_Append_1b ! date: 22 March 2021 ! summary: Append two vectors of INTEGER -INTERFACE +INTERFACE OPERATOR(.APPEND.) MODULE PURE FUNCTION func_Append_2a(A, ENTRY) RESULT(ans) INTEGER(I4B), INTENT(IN) :: A(:) INTEGER(I4B), INTENT(IN) :: ENTRY(:) @@ -383,10 +371,6 @@ END FUNCTION func_Append_2b END INTERFACE -INTERFACE OPERATOR(.APPEND.) - MODULE PROCEDURE func_Append_2a, func_Append_2b -END INTERFACE - !---------------------------------------------------------------------------- ! ColConcat@Methods !---------------------------------------------------------------------------- @@ -396,7 +380,7 @@ END FUNCTION func_Append_2b ! update: 2021-11-24 ! summary: Concat columns of two vectors -INTERFACE +INTERFACE ColConcat MODULE PURE FUNCTION colConcat_1a(a, b) RESULT(ans) REAL(REAL32), INTENT(IN) :: a(:) REAL(REAL32), INTENT(IN) :: b(:) @@ -432,11 +416,6 @@ MODULE PURE FUNCTION colConcat_1f(a, b) RESULT(ans) INTEGER(INT8), INTENT(IN) :: b(:) INTEGER(INT8), ALLOCATABLE :: ans(:, :) END FUNCTION colConcat_1f -END INTERFACE - -INTERFACE ColConcat - MODULE PROCEDURE colConcat_1a, colConcat_1b, colConcat_1c, & - & colConcat_1d, colConcat_1e, colConcat_1f END INTERFACE ColConcat INTERFACE OPERATOR(.ColConcat.) @@ -453,7 +432,7 @@ END FUNCTION colConcat_1f ! update: 2021-11-24 ! summary: Concat columns of a matrix and a vector -INTERFACE +INTERFACE ColConcat MODULE PURE FUNCTION colConcat_2a(a, b) RESULT(ans) REAL(REAL32), INTENT(IN) :: a(:, :) REAL(REAL32), INTENT(IN) :: b(:) @@ -489,11 +468,6 @@ MODULE PURE FUNCTION colConcat_2f(a, b) RESULT(ans) INTEGER(INT8), INTENT(IN) :: b(:) INTEGER(INT8), ALLOCATABLE :: ans(:, :) END FUNCTION colConcat_2f -END INTERFACE - -INTERFACE ColConcat - MODULE PROCEDURE colConcat_2a, colConcat_2b, colConcat_2c, & - & colConcat_2d, colConcat_2e, colConcat_2f END INTERFACE ColConcat INTERFACE OPERATOR(.ColConcat.) @@ -510,7 +484,7 @@ END FUNCTION colConcat_2f ! update: 2021-11-24 ! summary: Concat columns of rank1 and rank2 array -INTERFACE +INTERFACE ColConcat MODULE PURE FUNCTION colConcat_3a(a, b) RESULT(ans) REAL(REAL32), INTENT(IN) :: a(:) REAL(REAL32), INTENT(IN) :: b(:, :) @@ -546,11 +520,6 @@ MODULE PURE FUNCTION colConcat_3f(a, b) RESULT(ans) INTEGER(INT8), INTENT(IN) :: b(:, :) INTEGER(INT8), ALLOCATABLE :: ans(:, :) END FUNCTION colConcat_3f -END INTERFACE - -INTERFACE ColConcat - MODULE PROCEDURE colConcat_3a, colConcat_3b, colConcat_3c, & - & colConcat_3d, colConcat_3e, colConcat_3f END INTERFACE ColConcat INTERFACE OPERATOR(.ColConcat.) @@ -567,7 +536,7 @@ END FUNCTION colConcat_3f ! update: 2021-11-24 ! summary: Concat columns of rank2 and rank2 array -INTERFACE +INTERFACE ColConcat MODULE PURE FUNCTION colConcat_4a(a, b) RESULT(ans) REAL(REAL32), INTENT(IN) :: a(:, :) REAL(REAL32), INTENT(IN) :: b(:, :) @@ -603,11 +572,6 @@ MODULE PURE FUNCTION colConcat_4f(a, b) RESULT(ans) INTEGER(INT8), INTENT(IN) :: b(:, :) INTEGER(INT8), ALLOCATABLE :: ans(:, :) END FUNCTION colConcat_4f -END INTERFACE - -INTERFACE ColConcat - MODULE PROCEDURE colConcat_4a, colConcat_4b, colConcat_4c, & - & colConcat_4d, colConcat_4e, colConcat_4f END INTERFACE ColConcat INTERFACE OPERATOR(.ColConcat.) @@ -624,7 +588,7 @@ END FUNCTION colConcat_4f ! update: 2021-11-24 ! summary: Concat rows of two vectors -INTERFACE +INTERFACE RowConcat MODULE PURE FUNCTION rowConcat_1a(a, b) RESULT(ans) REAL(REAL32), INTENT(IN) :: a(:) REAL(REAL32), INTENT(IN) :: b(:) @@ -660,12 +624,7 @@ MODULE PURE FUNCTION rowConcat_1f(a, b) RESULT(ans) INTEGER(INT8), INTENT(IN) :: b(:) INTEGER(INT8), ALLOCATABLE :: ans(:, :) END FUNCTION rowConcat_1f -END INTERFACE - -INTERFACE rowConcat - MODULE PROCEDURE rowConcat_1a, rowConcat_1b, rowConcat_1c, & - & rowConcat_1d, rowConcat_1e, rowConcat_1f -END INTERFACE rowConcat +END INTERFACE RowConcat INTERFACE OPERATOR(.rowConcat.) MODULE PROCEDURE rowConcat_1a, rowConcat_1b, rowConcat_1c, & @@ -681,7 +640,7 @@ END FUNCTION rowConcat_1f ! update: 2021-11-24 ! summary: Concat rows of a matrix and a vector -INTERFACE +INTERFACE RowConcat MODULE PURE FUNCTION rowConcat_2a(a, b) RESULT(ans) REAL(REAL32), INTENT(IN) :: a(:, :) REAL(REAL32), INTENT(IN) :: b(:) @@ -717,12 +676,7 @@ MODULE PURE FUNCTION rowConcat_2f(a, b) RESULT(ans) INTEGER(INT8), INTENT(IN) :: b(:) INTEGER(INT8), ALLOCATABLE :: ans(:, :) END FUNCTION rowConcat_2f -END INTERFACE - -INTERFACE rowConcat - MODULE PROCEDURE rowConcat_2a, rowConcat_2b, rowConcat_2c, & - & rowConcat_2d, rowConcat_2e, rowConcat_2f -END INTERFACE rowConcat +END INTERFACE RowConcat INTERFACE OPERATOR(.rowConcat.) MODULE PROCEDURE rowConcat_2a, rowConcat_2b, rowConcat_2c, & @@ -738,7 +692,7 @@ END FUNCTION rowConcat_2f ! update: 2021-11-24 ! summary: Concat rows of rank1 and rank2 array -INTERFACE +INTERFACE RowConcat MODULE PURE FUNCTION rowConcat_3a(a, b) RESULT(ans) REAL(REAL32), INTENT(IN) :: a(:) REAL(REAL32), INTENT(IN) :: b(:, :) @@ -774,12 +728,7 @@ MODULE PURE FUNCTION rowConcat_3f(a, b) RESULT(ans) INTEGER(INT8), INTENT(IN) :: b(:, :) INTEGER(INT8), ALLOCATABLE :: ans(:, :) END FUNCTION rowConcat_3f -END INTERFACE - -INTERFACE rowConcat - MODULE PROCEDURE rowConcat_3a, rowConcat_3b, rowConcat_3c, & - & rowConcat_3d, rowConcat_3e, rowConcat_3f -END INTERFACE rowConcat +END INTERFACE RowConcat INTERFACE OPERATOR(.rowConcat.) MODULE PROCEDURE rowConcat_3a, rowConcat_3b, rowConcat_3c, & @@ -795,7 +744,7 @@ END FUNCTION rowConcat_3f ! update: 2021-11-24 ! summary: Concat rows of rank2 and rank2 array -INTERFACE +INTERFACE RowConcat MODULE PURE FUNCTION rowConcat_4a(a, b) RESULT(ans) REAL(REAL32), INTENT(IN) :: a(:, :) REAL(REAL32), INTENT(IN) :: b(:, :) @@ -831,12 +780,7 @@ MODULE PURE FUNCTION rowConcat_4f(a, b) RESULT(ans) INTEGER(INT8), INTENT(IN) :: b(:, :) INTEGER(INT8), ALLOCATABLE :: ans(:, :) END FUNCTION rowConcat_4f -END INTERFACE - -INTERFACE rowConcat - MODULE PROCEDURE rowConcat_4a, rowConcat_4b, rowConcat_4c, & - & rowConcat_4d, rowConcat_4e, rowConcat_4f -END INTERFACE rowConcat +END INTERFACE RowConcat INTERFACE OPERATOR(.rowConcat.) MODULE PROCEDURE rowConcat_4a, rowConcat_4b, rowConcat_4c, & diff --git a/src/submodules/Utility/src/Append/Append_2abcd.inc b/src/submodules/Utility/src/Append/Append_2abcd.inc new file mode 100644 index 00000000..79093c57 --- /dev/null +++ b/src/submodules/Utility/src/Append/Append_2abcd.inc @@ -0,0 +1,29 @@ +! This program is a part of EASIFEM library +! Copyright (C) 2020-2021 Vikas Sharma, Ph.D +! +! This program is free software: you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation, either version 3 of the License, or +! (at your option) any later version. +! +! This program is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this program. If not, see +! + +INTEGER(I4B) :: na, nb, nc + +na = SIZE( A ) +nb = SIZE( B ) +nc = SIZE( C ) + +CALL Reallocate( D, na+nb+nc ) +IF(na .gt. 0) D(1:na) = A +IF(nb .gt. 0) D(na + 1: na+nb) = B +IF(nc .gt. 0) D(na + nb + 1:) = C + + diff --git a/src/submodules/Utility/src/AppendUtility@Methods.F90 b/src/submodules/Utility/src/AppendUtility@Methods.F90 index fdb47a12..6a8c9021 100644 --- a/src/submodules/Utility/src/AppendUtility@Methods.F90 +++ b/src/submodules/Utility/src/AppendUtility@Methods.F90 @@ -25,22 +25,22 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE expand_int8 -INTEGER(Int8), ALLOCATABLE :: tmp(:) +INTEGER(INT8), ALLOCATABLE :: tmp(:) #include "./Expand/Expand.inc" END PROCEDURE expand_int8 MODULE PROCEDURE expand_int16 -INTEGER(Int16), ALLOCATABLE :: tmp(:) +INTEGER(INT16), ALLOCATABLE :: tmp(:) #include "./Expand/Expand.inc" END PROCEDURE expand_int16 MODULE PROCEDURE expand_int32 -INTEGER(Int32), ALLOCATABLE :: tmp(:) +INTEGER(INT32), ALLOCATABLE :: tmp(:) #include "./Expand/Expand.inc" END PROCEDURE expand_int32 MODULE PROCEDURE expand_int64 -INTEGER(Int64), ALLOCATABLE :: tmp(:) +INTEGER(INT64), ALLOCATABLE :: tmp(:) #include "./Expand/Expand.inc" END PROCEDURE expand_int64 @@ -49,7 +49,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE expand_real32 -REAL(Real32), ALLOCATABLE :: tmp(:) +REAL(REAL32), ALLOCATABLE :: tmp(:) #include "./Expand/Expand.inc" END PROCEDURE expand_real32 @@ -58,7 +58,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE expand_real64 -REAL(Real64), ALLOCATABLE :: tmp(:) +REAL(REAL64), ALLOCATABLE :: tmp(:) #include "./Expand/Expand.inc" END PROCEDURE expand_real64 @@ -138,6 +138,22 @@ ! Append !---------------------------------------------------------------------------- +MODULE PROCEDURE Append_2e +#include "./Append/Append_2abcd.inc" +END PROCEDURE Append_2e + +!---------------------------------------------------------------------------- +! Append +!---------------------------------------------------------------------------- + +MODULE PROCEDURE Append_2f +#include "./Append/Append_2abcd.inc" +END PROCEDURE Append_2f + +!---------------------------------------------------------------------------- +! Append +!---------------------------------------------------------------------------- + MODULE PROCEDURE Append_3a INTEGER(I4B), ALLOCATABLE :: Dummy(:) INTEGER(I4B) :: n @@ -242,113 +258,113 @@ ! colConcat !---------------------------------------------------------------------------- -module procedure colconcat_1a +MODULE PROCEDURE colconcat_1a #include "./ColConcat/ColConcat_1.inc" -end procedure colconcat_1a +END PROCEDURE colconcat_1a -module procedure colconcat_1b +MODULE PROCEDURE colconcat_1b #include "./ColConcat/ColConcat_1.inc" -end procedure colconcat_1b +END PROCEDURE colconcat_1b -module procedure colconcat_1c +MODULE PROCEDURE colconcat_1c #include "./ColConcat/ColConcat_1.inc" -end procedure colconcat_1c +END PROCEDURE colconcat_1c -module procedure colconcat_1d +MODULE PROCEDURE colconcat_1d #include "./ColConcat/ColConcat_1.inc" -end procedure colconcat_1d +END PROCEDURE colconcat_1d -module procedure colconcat_1e +MODULE PROCEDURE colconcat_1e #include "./ColConcat/ColConcat_1.inc" -end procedure colconcat_1e +END PROCEDURE colconcat_1e -module procedure colconcat_1f +MODULE PROCEDURE colconcat_1f #include "./ColConcat/ColConcat_1.inc" -end procedure colconcat_1f +END PROCEDURE colconcat_1f !---------------------------------------------------------------------------- ! colConcat !---------------------------------------------------------------------------- -module procedure colconcat_2a +MODULE PROCEDURE colconcat_2a #include "./ColConcat/ColConcat_2.inc" -end procedure colconcat_2a +END PROCEDURE colconcat_2a -module procedure colconcat_2b +MODULE PROCEDURE colconcat_2b #include "./ColConcat/ColConcat_2.inc" -end procedure colconcat_2b +END PROCEDURE colconcat_2b -module procedure colconcat_2c +MODULE PROCEDURE colconcat_2c #include "./ColConcat/ColConcat_2.inc" -end procedure colconcat_2c +END PROCEDURE colconcat_2c -module procedure colconcat_2d +MODULE PROCEDURE colconcat_2d #include "./ColConcat/ColConcat_2.inc" -end procedure colconcat_2d +END PROCEDURE colconcat_2d -module procedure colconcat_2e +MODULE PROCEDURE colconcat_2e #include "./ColConcat/ColConcat_2.inc" -end procedure colconcat_2e +END PROCEDURE colconcat_2e -module procedure colconcat_2f +MODULE PROCEDURE colconcat_2f #include "./ColConcat/ColConcat_2.inc" -end procedure colconcat_2f +END PROCEDURE colconcat_2f !---------------------------------------------------------------------------- ! colConcat !---------------------------------------------------------------------------- -module procedure colconcat_3a +MODULE PROCEDURE colconcat_3a #include "./ColConcat/ColConcat_3.inc" -end procedure colconcat_3a +END PROCEDURE colconcat_3a -module procedure colconcat_3b +MODULE PROCEDURE colconcat_3b #include "./ColConcat/ColConcat_3.inc" -end procedure colconcat_3b +END PROCEDURE colconcat_3b -module procedure colconcat_3c +MODULE PROCEDURE colconcat_3c #include "./ColConcat/ColConcat_3.inc" -end procedure colconcat_3c +END PROCEDURE colconcat_3c -module procedure colconcat_3d +MODULE PROCEDURE colconcat_3d #include "./ColConcat/ColConcat_3.inc" -end procedure colconcat_3d +END PROCEDURE colconcat_3d -module procedure colconcat_3e +MODULE PROCEDURE colconcat_3e #include "./ColConcat/ColConcat_3.inc" -end procedure colconcat_3e +END PROCEDURE colconcat_3e -module procedure colconcat_3f +MODULE PROCEDURE colconcat_3f #include "./ColConcat/ColConcat_3.inc" -end procedure colconcat_3f +END PROCEDURE colconcat_3f !---------------------------------------------------------------------------- ! colConcat !---------------------------------------------------------------------------- -module procedure colconcat_4a +MODULE PROCEDURE colconcat_4a #include "./ColConcat/ColConcat_4.inc" -end procedure colconcat_4a +END PROCEDURE colconcat_4a -module procedure colconcat_4b +MODULE PROCEDURE colconcat_4b #include "./ColConcat/ColConcat_4.inc" -end procedure colconcat_4b +END PROCEDURE colconcat_4b -module procedure colconcat_4c +MODULE PROCEDURE colconcat_4c #include "./ColConcat/ColConcat_4.inc" -end procedure colconcat_4c +END PROCEDURE colconcat_4c -module procedure colconcat_4d +MODULE PROCEDURE colconcat_4d #include "./ColConcat/ColConcat_4.inc" -end procedure colconcat_4d +END PROCEDURE colconcat_4d -module procedure colconcat_4e +MODULE PROCEDURE colconcat_4e #include "./ColConcat/ColConcat_4.inc" -end procedure colconcat_4e +END PROCEDURE colconcat_4e -module procedure colconcat_4f +MODULE PROCEDURE colconcat_4f #include "./ColConcat/ColConcat_4.inc" -end procedure colconcat_4f +END PROCEDURE colconcat_4f !---------------------------------------------------------------------------- ! colConcat