diff --git a/src/modules/CSRMatrix/src/CSRMatrix_GetMethods.F90 b/src/modules/CSRMatrix/src/CSRMatrix_GetMethods.F90 index 8bc4a9ea..7aa0f754 100644 --- a/src/modules/CSRMatrix/src/CSRMatrix_GetMethods.F90 +++ b/src/modules/CSRMatrix/src/CSRMatrix_GetMethods.F90 @@ -34,6 +34,41 @@ MODULE CSRMatrix_GetMethods PUBLIC :: OPERATOR(.endColumn.) PUBLIC :: GetSingleValue PUBLIC :: Get +PUBLIC :: GetIA +PUBLIC :: GetJA +PUBLIC :: GetValue + +!---------------------------------------------------------------------------- +! GetIA@GetMethods +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 2023-12-14 +! summary: Get entry in IA + +INTERFACE GetIA + MODULE PURE FUNCTION obj_GetIA(obj, irow) RESULT(ans) + TYPE(CSRMatrix_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: irow + INTEGER(I4B) :: ans + END FUNCTION obj_GetIA +END INTERFACE GetIA + +!---------------------------------------------------------------------------- +! GetJA@GetMethods +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 2023-12-14 +! summary: Get entry in JA + +INTERFACE GetJA + MODULE PURE FUNCTION obj_GetJA(obj, indx) RESULT(ans) + TYPE(CSRMatrix_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: indx + INTEGER(I4B) :: ans + END FUNCTION obj_GetJA +END INTERFACE GetJA !---------------------------------------------------------------------------- ! GetSingleValue @@ -63,12 +98,16 @@ END FUNCTION obj_GetSingleValue ! date: 2023-12-14 ! summary: Get single value -INTERFACE Get +INTERFACE GetSeveralValue MODULE PURE FUNCTION obj_GetSeveralValue(obj, indx) RESULT(ans) TYPE(CSRMatrix_), INTENT(IN) :: obj INTEGER(I4B), INTENT(IN) :: indx(:) REAL(DFP) :: ans(SIZE(indx)) END FUNCTION obj_GetSeveralValue +END INTERFACE GetSeveralValue + +INTERFACE Get + MODULE PROCEDURE obj_GetSeveralValue END INTERFACE Get !---------------------------------------------------------------------------- @@ -200,4 +239,393 @@ MODULE PURE FUNCTION obj_endColumn(obj, irow) RESULT(ans) END FUNCTION obj_endColumn END INTERFACE OPERATOR(.endColumn.) +!---------------------------------------------------------------------------- +! Get@getMethods +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 2023-12-23 +! summary: This subroutine Get the value in sparse matrix +! +!# Introduction +! +! - This subroutine Gets the value in [[CSRMatrix_]] +! - Shape( value ) = [SIZE(nodenum)*tdof, SIZE(nodenum)*tdof] +! - Usually `value` denotes the element matrix +! - Symbolic we are performing following task `obj(nodenum, nodenum)=value` + +INTERFACE GetValue + MODULE PURE SUBROUTINE obj_Get0(obj, nodenum, VALUE) + TYPE(CSRMatrix_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: nodenum(:) + REAL(DFP), INTENT(INOUT) :: VALUE(:, :) + END SUBROUTINE obj_Get0 +END INTERFACE GetValue + +!---------------------------------------------------------------------------- +! Get@getMethods +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 22 March 2021 +! summary: This subroutine Get the value in sparse matrix +! +!# Introduction +! +! This subroutine Gets the values in sparse matrix. +! +!$$ +! obj(Nptrs,Nptrs)=value(:,:) +!$$ +! +! - Usually `value(:,:)` represents the element finite element matrix +! - The shape of `value` should be the tdof*size(nodenum), tdof*size(nodenum) +! - `tdof` is the total degree of freedom in obj%csr%dof +! +! - `StorageFMT` denotes the storage format of `value` +! It can be `Nodes_FMT` or `DOF_FMT` +! +! - Usually, element matrix is stored with `DOF_FMT` + +INTERFACE GetValue + MODULE PURE SUBROUTINE obj_Get1(obj, nodenum, storageFMT, VALUE) + TYPE(CSRMatrix_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: nodenum(:) + REAL(DFP), INTENT(INOUT) :: VALUE(:, :) + INTEGER(I4B), INTENT(IN) :: storageFMT + !! storage format of value (desired format of value) + END SUBROUTINE obj_Get1 +END INTERFACE GetValue + +!---------------------------------------------------------------------------- +! Get@getMethods +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 22 March 2021 +! summary: Gets a single entry of sparse matrix +! +!# Introduction +! +! - This subroutine Gets a single entry of sparse matrix. +! - Before using this routine the user should be aware of the storage +! pattern of degree of freedom. +! - However, if total number of degrees of freedom is one then there is not +! need to worry. +! +!@warning +! This routine should be avoided by general user. +!@endwarning + +INTERFACE GetValue + MODULE PURE SUBROUTINE obj_Get2(obj, irow, icolumn, VALUE) + TYPE(CSRMatrix_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: irow + !! row index + INTEGER(I4B), INTENT(IN) :: icolumn + !! column index + REAL(DFP), INTENT(INOUT) :: VALUE + !! value + END SUBROUTINE obj_Get2 +END INTERFACE GetValue + +!---------------------------------------------------------------------------- +! Get@getMethods +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 2023-12-23 +! summary: Gets the specific row and column entry to a given value +! +!# Introduction +! +! - This routine Gets the specific row and column entry to a given value. +! - The irow and icolumn index in [[CSRMatrix_]] are calculated by using +! (iNodeNum, iDOF) and (jNodeNum, jDOF), respectively. +! - To do the above task, the routine employs [[DOF_Method:getNodeLoc]] +! method +! - After computing the irow and icolumn (internally) this routine calls, +! `obj_Get3`. +! +!@note +! General user should prefer this routine over +! [[CSRMatrix_Method:obj_Get2]] +!@endnote +! +!@note +! idof, jdof are continuously numbered, so if there are two +! or more physical variables, then idof and jdof of the second +! or later physical variables will not start from 1. +!@endnote + +INTERFACE GetValue + MODULE PURE SUBROUTINE obj_Get3(obj, iNodeNum, jNodeNum, iDOF, & + & jDOF, VALUE) + TYPE(CSRMatrix_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: iNodeNum + !! row node number + INTEGER(I4B), INTENT(IN) :: jNodeNum + !! column node number + INTEGER(I4B), INTENT(IN) :: iDOF + !! row degree of freedom + INTEGER(I4B), INTENT(IN) :: jDOF + !! col degree of freedom + REAL(DFP), INTENT(INOUT) :: VALUE + !! scalar value to be Get + END SUBROUTINE obj_Get3 +END INTERFACE GetValue + +!---------------------------------------------------------------------------- +! Get@getMethods +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 2023-12-23 +! summary: This subroutine get the value from the sparse matrix +! +!# Introduction +! +! - This subroutine Gets the values from block sparse matrix. +! - The storage pattern of both sparse matrix and value +! (the element matrix) should be in `FMT_DOF`. +! +!$$ +! obj(Nptrs,Nptrs)=value(:,:) +!$$ + +INTERFACE GetValue + MODULE PURE SUBROUTINE obj_Get4(obj, iNodeNum, jNodeNum, & + & ivar, jvar, VALUE) + TYPE(CSRMatrix_), INTENT(IN) :: obj + !! Block csr matrix + INTEGER(I4B), INTENT(IN) :: iNodeNum(:) + !! row node numbers + INTEGER(I4B), INTENT(IN) :: jNodeNum(:) + !! column node numbers + INTEGER(I4B), INTENT(IN) :: ivar + !! row physical variables + INTEGER(I4B), INTENT(IN) :: jvar + !! column physical variables + REAL(DFP), INTENT(INOUT) :: VALUE(:, :) + !! value + END SUBROUTINE obj_Get4 +END INTERFACE GetValue + +!---------------------------------------------------------------------------- +! Get@getMethods +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 2023-12-23 +! summary: Gets the specific row and column entry to a given value +! +!# Introduction +! +! - This routine Gets the specific row and column entry to a given value. +! - The irow and icolumn index in [[CSRMatrix_]] are calculated by using +! (iNodeNum, iDOF) and (jNodeNum, jDOF), respectively. +! - To do the above task, routine employs [[DOF_Method:getNodeLoc]] method +! - After computing the irow and icolumn (internally) this routine calls, +! `obj_Get3`. +! +!@note +! General user should prefer this routine over +! [[CSRMatrix_Method:obj_Get3]] +!@endnote +! +!@note +! rowdof, coldof are continuously numbered, so if there are two +! or more physical variables, then rowdof and coldof of the second +! or later physical variables will not start from 1. +!@endnote + +INTERFACE GetValue + MODULE PURE SUBROUTINE obj_Get5(obj, iNodeNum, jNodeNum, ivar, & + & jvar, iDOF, jDOF, VALUE) + TYPE(CSRMatrix_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: iNodeNum + !! row node number + INTEGER(I4B), INTENT(IN) :: jNodeNum + !! column node number + INTEGER(I4B), INTENT(IN) :: ivar + !! + INTEGER(I4B), INTENT(IN) :: jvar + !! + INTEGER(I4B), INTENT(IN) :: iDOF + !! row degree of freedom + INTEGER(I4B), INTENT(IN) :: jDOF + !! col degree of freedom + REAL(DFP), INTENT(INOUT) :: VALUE + !! scalar value to be Get + END SUBROUTINE obj_Get5 +END INTERFACE GetValue + +!---------------------------------------------------------------------------- +! Get@getMethods +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 2023-12-23 +! summary: Gets the specific row and column entry from a given value + +INTERFACE GetValue + MODULE PURE SUBROUTINE obj_Get6(obj, iNodeNum, jNodeNum, ivar, & + & jvar, iDOF, jDOF, VALUE) + TYPE(CSRMatrix_), INTENT(IN) :: obj + !! block matrix field + INTEGER(I4B), INTENT(IN) :: iNodeNum(:) + !! row node number + INTEGER(I4B), INTENT(IN) :: jNodeNum(:) + !! column node number + INTEGER(I4B), INTENT(IN) :: ivar + !! row physical variables + INTEGER(I4B), INTENT(IN) :: jvar + !! column physical variable + INTEGER(I4B), INTENT(IN) :: iDOF + !! row degree of freedom + INTEGER(I4B), INTENT(IN) :: jDOF + !! col degree of freedom + REAL(DFP), INTENT(INOUT) :: VALUE(:, :) + !! Matrix value + END SUBROUTINE obj_Get6 +END INTERFACE GetValue + +!---------------------------------------------------------------------------- +! Get@getMethods +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 2023-12-23 +! summary: Gets the specific row and column entry from the matrix +! +!# Introduction +! +! - This routine Gets the specific row and column entry from the matrix. +! - The irow and icolumn index in `CSRMatrix_` are calculated by using +! (iNodeNum, iDOF) and (jNodeNum, jDOF), respectively. +! - To do above task, the routine employs [[DOF_Method:getNodeLoc]] method +! - After computing the irow and icolumn (internally) this routine calls, +! `obj_Get3`. +! +!@note +! General user should prefer this routine over +! [[CSRMatrix_Method:obj_Get3]] +!@endnote +! +!@note +! rowdof, coldof are continuously numbered, so if there are two +! or more physical variables, then rowdof and coldof of the second +! or later physical variables will not start from 1. +!@endnote + +INTERFACE GetValue + MODULE PURE SUBROUTINE obj_Get7(obj, iNodeNum, jNodeNum, ivar, & + & jvar, ispacecompo, itimecompo, jspacecompo, jtimecompo, VALUE) + TYPE(CSRMatrix_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: iNodeNum + !! row node number + INTEGER(I4B), INTENT(IN) :: jNodeNum + !! column node number + INTEGER(I4B), INTENT(IN) :: ivar + !! row physical variable + INTEGER(I4B), INTENT(IN) :: jvar + !! col physical variable + INTEGER(I4B), INTENT(IN) :: ispacecompo + !! row space component + INTEGER(I4B), INTENT(IN) :: itimecompo + !! row time component + INTEGER(I4B), INTENT(IN) :: jspacecompo + !! col space component + INTEGER(I4B), INTENT(IN) :: jtimecompo + !! col time component + REAL(DFP), INTENT(INOUT) :: VALUE + !! scalar value to be Get + END SUBROUTINE obj_Get7 +END INTERFACE GetValue + +!---------------------------------------------------------------------------- +! Get@GetMethod +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 2023-12-23 +! summary: Gets the specific row and column entry from the matrix +! +!# Introduction +! +! - The number of nodes in obj1 and obj2 should be same + +INTERFACE GetValue + MODULE SUBROUTINE obj_Get8(obj1, obj2, & + & ivar1, jvar1, & + & ispacecompo1, jspacecompo1, & + & itimecompo1, jtimecompo1, & + & ivar2, jvar2, & + & ispacecompo2, jspacecompo2, & + & itimecompo2, jtimecompo2, ierr) + TYPE(CSRMatrix_), INTENT(IN) :: obj1 + !! master object + TYPE(CSRMatrix_), INTENT(INOUT) :: obj2 + !! slave object + INTEGER(I4B), OPTIONAL, INTENT(IN) :: ivar1 + !! row physical variable obj1 + INTEGER(I4B), OPTIONAL, INTENT(IN) :: jvar1 + !! col physical variable obj1 + INTEGER(I4B), OPTIONAL, INTENT(IN) :: ispacecompo1 + !! row space component obj1 + INTEGER(I4B), OPTIONAL, INTENT(IN) :: itimecompo1 + !! row time component obj1 + INTEGER(I4B), OPTIONAL, INTENT(IN) :: jspacecompo1 + !! col space component obj1 + INTEGER(I4B), OPTIONAL, INTENT(IN) :: jtimecompo1 + !! col time component obj1 + INTEGER(I4B), OPTIONAL, INTENT(IN) :: ivar2 + !! row physical variable obj2 + INTEGER(I4B), OPTIONAL, INTENT(IN) :: jvar2 + !! col physical variable obj2 + INTEGER(I4B), OPTIONAL, INTENT(IN) :: ispacecompo2 + !! row space component obj2 + INTEGER(I4B), OPTIONAL, INTENT(IN) :: itimecompo2 + !! row time component obj2 + INTEGER(I4B), OPTIONAL, INTENT(IN) :: jspacecompo2 + !! col space component obj2 + INTEGER(I4B), OPTIONAL, INTENT(IN) :: jtimecompo2 + !! col time component obj2 + INTEGER(I4B), OPTIONAL, INTENT(INOUT) :: ierr + !! Error code, if 0 no error, else error + END SUBROUTINE obj_Get8 +END INTERFACE GetValue + +!---------------------------------------------------------------------------- +! Get@GetMethod +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 2023-12-23 +! summary: Gets the specific row and column entry from the matrix +! +!# Introduction +! +! - The number of nodes in obj1 and obj2 should be same + +INTERFACE + MODULE SUBROUTINE CSR2CSR_Get_Master(obj1, obj2, idof1, jdof1, idof2, & + & jdof2, tNodes1, tNodes2) + TYPE(CSRMatrix_), INTENT(IN) :: obj1 + !! master object + TYPE(CSRMatrix_), INTENT(INOUT) :: obj2 + !! slave object + INTEGER(I4B), INTENT(IN) :: idof1 + !! row space component obj1 + INTEGER(I4B), INTENT(IN) :: jdof1 + !! row time component obj1 + INTEGER(I4B), INTENT(IN) :: idof2 + !! col space component obj1 + INTEGER(I4B), INTENT(IN) :: jdof2 + !! col time component obj1 + INTEGER(I4B), INTENT(IN) :: tNodes1 + INTEGER(I4B), INTENT(IN) :: tNodes2 + END SUBROUTINE CSR2CSR_Get_Master +END INTERFACE + END MODULE CSRMatrix_GetMethods diff --git a/src/modules/CSRSparsity/src/CSRSparsity_Method.F90 b/src/modules/CSRSparsity/src/CSRSparsity_Method.F90 index 0f5e797e..479d0be9 100644 --- a/src/modules/CSRSparsity/src/CSRSparsity_Method.F90 +++ b/src/modules/CSRSparsity/src/CSRSparsity_Method.F90 @@ -43,6 +43,8 @@ MODULE CSRSparsity_Method PUBLIC :: OPERATOR(.endColumn.) PUBLIC :: SetIA PUBLIC :: SetJA +PUBLIC :: GetIA +PUBLIC :: GetJA !---------------------------------------------------------------------------- ! Initiate@ConstructorMethods @@ -722,7 +724,7 @@ END SUBROUTINE obj_SetSparsity_final END INTERFACE SetSparsity !---------------------------------------------------------------------------- -! SetIA@GetMethods +! SetIA@SetMethods !---------------------------------------------------------------------------- !> author: Vikas Sharma, Ph. D. @@ -738,7 +740,7 @@ END SUBROUTINE obj_SetIA END INTERFACE SetIA !---------------------------------------------------------------------------- -! SetJA@GetMethods +! SetJA@SetMethods !---------------------------------------------------------------------------- !> author: Vikas Sharma, Ph. D. @@ -753,6 +755,38 @@ MODULE PURE SUBROUTINE obj_SetJA(obj, indx, VALUE) END SUBROUTINE obj_SetJA END INTERFACE SetJA +!---------------------------------------------------------------------------- +! GetIA@GetMethods +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 2023-12-23 +! summary: Get entry from IA + +INTERFACE GetIA + MODULE PURE FUNCTION obj_GetIA(obj, irow) RESULT(ans) + TYPE(CSRSparsity_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: irow + INTEGER(I4B) :: ans + END FUNCTION obj_GetIA +END INTERFACE GetIA + +!---------------------------------------------------------------------------- +! GetJA@GetMethods +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 2023-12-14 +! summary: Get entry from JA + +INTERFACE GetJA + MODULE PURE FUNCTION obj_GetJA(obj, indx) RESULT(ans) + TYPE(CSRSparsity_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: indx + INTEGER(I4B) :: ans + END FUNCTION obj_GetJA +END INTERFACE GetJA + !---------------------------------------------------------------------------- ! GetSym@SymMethods !---------------------------------------------------------------------------- diff --git a/src/modules/Utility/src/ConvertUtility.F90 b/src/modules/Utility/src/ConvertUtility.F90 index b8cdf8d2..9deec430 100644 --- a/src/modules/Utility/src/ConvertUtility.F90 +++ b/src/modules/Utility/src/ConvertUtility.F90 @@ -21,6 +21,7 @@ MODULE ConvertUtility PRIVATE PUBLIC :: Convert +PUBLIC :: ConvertSafe !---------------------------------------------------------------------------- ! Convert@ConvertMethods @@ -47,7 +48,7 @@ MODULE ConvertUtility ! this routine works when matrix is square. !@endnote -INTERFACE +INTERFACE Convert MODULE PURE SUBROUTINE convert_1(From, To, Conversion, nns, tdof) REAL(DFP), INTENT(IN) :: From(:, :) !! Matrix in one format @@ -57,12 +58,45 @@ MODULE PURE SUBROUTINE convert_1(From, To, Conversion, nns, tdof) !! `Conversion` can be `NodesToDOF` or `DOFToNodes` INTEGER(I4B), INTENT(IN) :: nns, tdof END SUBROUTINE convert_1 -END INTERFACE - -INTERFACE Convert - MODULE PROCEDURE convert_1 END INTERFACE Convert +!---------------------------------------------------------------------------- +! Convert@ConvertMethods +!---------------------------------------------------------------------------- + +!> author: Vikas Sharma, Ph. D. +! date: 6 March 2021 +! summary: Rearrange the degrees of freedom in a finite element matrix +! +!# Introduction +! +! This subroutine changes the storage pattern of a two-d matrix +! - Usually element matrix in easifem are stored in `FMT_DOF` +! - Global matrices/tanmat, however, are stored in `FMT_Nodes` +! - This subroutine is, therefore, in settings or adding values in +! [[SparseMatrix_]]. +! +! > This subroutine converts changes the storage format of dense matrix. +! Usually, elemental finite element matrix is stored in `DOF_FMT`, and global +! matrix/ tanmat, may be stored in `Nodes_FMT`. +! +!@note +! All dof should have the same order of interpolation, therefore, +! this routine works when matrix is square. +!@endnote + +INTERFACE ConvertSafe + MODULE PURE SUBROUTINE convert_1_safe(From, To, Conversion, nns, tdof) + REAL(DFP), INTENT(IN) :: From(:, :) + !! Matrix in one format + REAL(DFP), INTENT(INOUT) :: To(:, :) + !! Matrix is desired format + INTEGER(I4B), INTENT(IN) :: Conversion + !! `Conversion` can be `NodesToDOF` or `DOFToNodes` + INTEGER(I4B), INTENT(IN) :: nns, tdof + END SUBROUTINE convert_1_safe +END INTERFACE ConvertSafe + !---------------------------------------------------------------------------- ! Convert@ConvertMethods !---------------------------------------------------------------------------- @@ -85,15 +119,11 @@ END SUBROUTINE convert_1 ! ! Contains the block matrix structure in 2D. -INTERFACE +INTERFACE Convert MODULE PURE SUBROUTINE convert_2(From, To) REAL(DFP), INTENT(IN) :: From(:, :, :, :) REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: To(:, :) END SUBROUTINE convert_2 -END INTERFACE - -INTERFACE Convert - MODULE PROCEDURE convert_2 END INTERFACE Convert !---------------------------------------------------------------------------- @@ -105,17 +135,13 @@ END SUBROUTINE convert_2 ! summary: This subroutine converts rank4 matrix to rank2 matrix ! -INTERFACE +INTERFACE Convert MODULE PURE SUBROUTINE convert_3(From, To) REAL(DFP), INTENT(IN) :: From(:, :, :, :, :, :) !! I, J, ii, jj, a, b REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: To(:, :, :, :) !! I, J, a, b END SUBROUTINE convert_3 -END INTERFACE - -INTERFACE Convert - MODULE PROCEDURE convert_3 END INTERFACE Convert !---------------------------------------------------------------------------- diff --git a/src/submodules/CSRMatrix/src/CSRMatrix_ConstructorMethods@Methods.F90 b/src/submodules/CSRMatrix/src/CSRMatrix_ConstructorMethods@Methods.F90 index 080d2546..f16fcdd2 100644 --- a/src/submodules/CSRMatrix/src/CSRMatrix_ConstructorMethods@Methods.F90 +++ b/src/submodules/CSRMatrix/src/CSRMatrix_ConstructorMethods@Methods.F90 @@ -137,11 +137,15 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE obj_Initiate3 -CALL DEALLOCATE (obj) +CALL Initiate(obj=obj%csr, IA=IA, JA=JA, ncol=ncol) obj%csrOwnership = .TRUE. IF (PRESENT(matrixProp)) obj%matrixProp = TRIM(matrixProp) -CALL Initiate(obj=obj%csr, IA=IA, JA=JA, ncol=ncol) +CALL Reallocate(obj%A, SIZE(A)) +#ifdef USE_BLAS95 +CALL Copy(y=obj%A, x=A) +#else obj%A = A +#endif CALL SetTotalDimension(obj, 2_I4B) CALL SetSparsity(obj) END PROCEDURE obj_Initiate3 diff --git a/src/submodules/CSRMatrix/src/CSRMatrix_GetMethods@Methods.F90 b/src/submodules/CSRMatrix/src/CSRMatrix_GetMethods@Methods.F90 index d3c674c3..0d9f42f6 100644 --- a/src/submodules/CSRMatrix/src/CSRMatrix_GetMethods@Methods.F90 +++ b/src/submodules/CSRMatrix/src/CSRMatrix_GetMethods@Methods.F90 @@ -20,10 +20,34 @@ ! summary: This submodule contains the methods for sparse matrix SUBMODULE(CSRMatrix_GetMethods) Methods -USE BaseMethod +USE CSRSparsity_Method +USE ConvertUtility +USE InputUtility +USE BaseType, ONLY: DOF_ +USE DOF_GetMethods +USE CSRMatrix_GetMethods +USE CSRMatrix_SetMethods +USE ErrorHandling +USE GlobalData, ONLY: DofToNodes, NodesToDOF, FMT_NODES, FMT_DOF, stderr IMPLICIT NONE CONTAINS +!---------------------------------------------------------------------------- +! GetIA +!---------------------------------------------------------------------------- + +MODULE PROCEDURE obj_GetIA +ans = GetIA(obj%csr, irow) +END PROCEDURE obj_GetIA + +!---------------------------------------------------------------------------- +! GetJA +!---------------------------------------------------------------------------- + +MODULE PROCEDURE obj_GetJA +ans = GetJA(obj%csr, indx) +END PROCEDURE obj_GetJA + !---------------------------------------------------------------------------- ! GetSingleValue !---------------------------------------------------------------------------- @@ -130,4 +154,329 @@ ans = obj%csr.endColumn.irow END PROCEDURE obj_endColumn +!---------------------------------------------------------------------------- +! GetValue +!---------------------------------------------------------------------------- + +MODULE PROCEDURE obj_Get0 +! Internal variables +INTEGER(I4B), ALLOCATABLE :: row(:), col(:) +INTEGER(I4B) :: ii, jj + +row = GetIndex(obj=obj%csr%idof, nodeNum=nodenum) +col = GetIndex(obj=obj%csr%jdof, nodeNum=nodenum) +VALUE = 0.0_DFP +DO ii = 1, SIZE(row) + DO jj = 1, SIZE(col) + CALL GetValue(obj=obj, VALUE=VALUE(ii, jj), irow=row(ii), & + & icolumn=col(jj)) + END DO +END DO + +IF (ALLOCATED(row)) DEALLOCATE (row) +IF (ALLOCATED(col)) DEALLOCATE (col) +END PROCEDURE obj_Get0 + +!---------------------------------------------------------------------------- +! GetValue +!---------------------------------------------------------------------------- + +MODULE PROCEDURE obj_Get1 +REAL(DFP) :: m2(SIZE(VALUE, 1), SIZE(VALUE, 2)) +INTEGER(I4B) :: tdof, nns, myfmt + +CALL GetValue(obj=obj, nodenum=nodenum, VALUE=m2) + +tdof = .tdof. (obj%csr%idof) +nns = SIZE(nodenum) +myfmt = GetStorageFMT(obj, 1) + +IF (myfmt .EQ. storageFMT) THEN + VALUE = m2 + RETURN +END IF + +SELECT CASE (storageFMT) + +CASE (FMT_NODES) + + CALL ConvertSafe(From=m2, To=VALUE, Conversion=DOFToNodes, nns=nns, & + & tDOF=tdof) + +CASE (FMT_DOF) + + CALL ConvertSafe(From=m2, To=VALUE, Conversion=NodesToDOF, nns=nns, & + & tDOF=tdof) + +END SELECT + +END PROCEDURE obj_Get1 + +!---------------------------------------------------------------------------- +! GetValue +!---------------------------------------------------------------------------- + +MODULE PROCEDURE obj_Get2 +INTEGER(I4B) :: j + +VALUE = 0.0_DFP +DO j = obj%csr%IA(irow), obj%csr%IA(irow + 1) - 1 + IF (obj%csr%JA(j) .EQ. icolumn) THEN + VALUE = obj%A(j) + EXIT + END IF +END DO + +END PROCEDURE obj_Get2 + +!---------------------------------------------------------------------------- +! GetValue +!---------------------------------------------------------------------------- + +MODULE PROCEDURE obj_Get3 +INTEGER(I4B) :: irow, icolumn +irow = GetNodeLoc(obj=obj%csr%idof, nodenum=iNodeNum, idof=iDOF) +icolumn = GetNodeLoc(obj=obj%csr%jdof, nodenum=jNodeNum, idof=jDOF) +CALL GetValue(obj=obj, irow=irow, icolumn=icolumn, VALUE=VALUE) +END PROCEDURE obj_Get3 + +!---------------------------------------------------------------------------- +! GetValue +!---------------------------------------------------------------------------- + +MODULE PROCEDURE obj_Get4 +! Internal variables +INTEGER(I4B), ALLOCATABLE :: row(:), col(:) +INTEGER(I4B) :: ii, jj + +row = GetIndex(obj=obj%csr%idof, nodeNum=iNodeNum, ivar=ivar) +col = GetIndex(obj=obj%csr%jdof, nodeNum=jNodeNum, ivar=jvar) + +DO ii = 1, SIZE(row) + DO jj = 1, SIZE(col) + CALL GetValue(obj=obj, VALUE=VALUE(ii, jj), irow=row(ii), & + & icolumn=col(jj)) + END DO +END DO + +IF (ALLOCATED(row)) DEALLOCATE (row) +IF (ALLOCATED(col)) DEALLOCATE (col) +END PROCEDURE obj_Get4 + +!---------------------------------------------------------------------------- +! GetValue +!---------------------------------------------------------------------------- + +MODULE PROCEDURE obj_Get5 +INTEGER(I4B) :: irow, icolumn +irow = GetNodeLoc(obj=obj%csr%idof, nodenum=iNodeNum, ivar=ivar, idof=iDOF) +icolumn = GetNodeLoc(obj=obj%csr%jdof, nodenum=jNodeNum, ivar=jvar, idof=jDOF) +CALL GetValue(obj=obj, irow=irow, icolumn=icolumn, VALUE=VALUE) +END PROCEDURE obj_Get5 + +!---------------------------------------------------------------------------- +! GetValue +!---------------------------------------------------------------------------- + +MODULE PROCEDURE obj_Get6 +! Internal variables +INTEGER(I4B), ALLOCATABLE :: row(:), col(:) +INTEGER(I4B) :: ii, jj, trow, tcol + +row = GetIndex(obj=obj%csr%idof, nodeNum=iNodeNum, ivar=ivar, idof=idof) +col = GetIndex(obj=obj%csr%jdof, nodeNum=jNodeNum, ivar=jvar, idof=jdof) + +trow = SIZE(row) +tcol = SIZE(col) + +DO ii = 1, trow + DO jj = 1, tcol + CALL GetValue(obj=obj, VALUE=VALUE(ii, jj), irow=row(ii), & + & icolumn=col(jj)) + END DO +END DO + +IF (ALLOCATED(row)) DEALLOCATE (row) +IF (ALLOCATED(col)) DEALLOCATE (col) +END PROCEDURE obj_Get6 + +!---------------------------------------------------------------------------- +! GetValue +!---------------------------------------------------------------------------- + +MODULE PROCEDURE obj_Get7 +INTEGER(I4B) :: irow, icolumn + +irow = GetNodeLoc( & + & obj=obj%csr%idof, & + & nodenum=iNodeNum, & + & ivar=ivar, & + & spacecompo=ispacecompo, & + & timecompo=itimecompo) + +icolumn = GetNodeLoc( & + & obj=obj%csr%jdof, & + & nodenum=jNodeNum, & + & ivar=jvar, & + & spacecompo=jspacecompo, & + & timecompo=jtimecompo) + +CALL GetValue(obj=obj, irow=irow, icolumn=icolumn, VALUE=VALUE) +END PROCEDURE obj_Get7 + +!---------------------------------------------------------------------------- +! GetValue +!---------------------------------------------------------------------------- + +MODULE PROCEDURE obj_Get8 +CHARACTER(*), PARAMETER :: myName = "CSR2CSR_Get_Master()" +CHARACTER(*), PARAMETER :: filename = __FILE__ +INTEGER(I4B) :: myindx(6, 2), idof1, jdof1, idof2, jdof2, & + & row1, row2, col1, col2, ierr0 +CLASS(DOF_), POINTER :: dof_obj +LOGICAL(LGT) :: problem + +! 1 ivar +! 2 ispacecompo +! 3 itimecompo +! 4 jvar +! 5 jspacecompo +! 6 jtimecompo + +IF (PRESENT(ierr)) ierr = 0 + +myindx(1, 1) = Input(default=1, option=ivar1) +myindx(2, 1) = Input(default=1, option=ispacecompo1) +myindx(3, 1) = Input(default=1, option=itimecompo1) +myindx(4, 1) = Input(default=1, option=jvar1) +myindx(5, 1) = Input(default=1, option=jspacecompo1) +myindx(6, 1) = Input(default=1, option=jtimecompo1) + +myindx(1, 2) = Input(default=1, option=ivar2) +myindx(2, 2) = Input(default=1, option=ispacecompo2) +myindx(3, 2) = Input(default=1, option=itimecompo2) +myindx(4, 2) = Input(default=1, option=jvar2) +myindx(5, 2) = Input(default=1, option=jspacecompo2) +myindx(6, 2) = Input(default=1, option=jtimecompo2) + +NULLIFY (dof_obj) + +dof_obj => GetDOFPointer(obj1, 1) +problem = .NOT. ASSOCIATED(dof_obj) +IF (problem) THEN + CALL ErrorMSG( & + & "Cannot get idof pointer from obj1", & + & filename, & + & myName, & + & __LINE__, stderr) + ierr0 = -1 + IF (PRESENT(ierr)) ierr = ierr0 + RETURN +END IF +idof1 = GetIDOF(obj=dof_obj, & + & ivar=myindx(1, 1), & + & spacecompo=myindx(2, 1), & + & timecompo=myindx(3, 1)) +row1 = dof_obj.tNodes.idof1 + +dof_obj => GetDOFPointer(obj1, 2) +problem = .NOT. ASSOCIATED(dof_obj) +IF (problem) THEN + CALL ErrorMSG( & + & "Cannot get jdof pointer from obj1", & + & filename, & + & myName, & + & __LINE__, stderr) + ierr0 = -2 + IF (PRESENT(ierr)) ierr = ierr0 + RETURN +END IF +jdof1 = GetIDOF(obj=dof_obj, & + & ivar=myindx(4, 1), & + & spacecompo=myindx(5, 1), & + & timecompo=myindx(6, 1)) +col1 = dof_obj.tNodes.jdof1 + +dof_obj => GetDOFPointer(obj2, 1) +problem = .NOT. ASSOCIATED(dof_obj) +IF (problem) THEN + CALL ErrorMSG( & + & "Cannot get idof pointer from obj2", & + & filename, & + & myName, & + & __LINE__, stderr) + ierr0 = -3 + IF (PRESENT(ierr)) ierr = ierr0 + RETURN +END IF +idof2 = GetIDOF(obj=dof_obj, & + & ivar=myindx(1, 2), & + & spacecompo=myindx(2, 2), & + & timecompo=myindx(3, 2)) +row2 = dof_obj.tNodes.idof2 + +dof_obj => GetDOFPointer(obj2, 2) +problem = .NOT. ASSOCIATED(dof_obj) +IF (problem) THEN + CALL ErrorMSG( & + & "Cannot get jdof pointer from obj2", & + & filename, & + & myName, & + & __LINE__, stderr) + ierr0 = -4 + IF (PRESENT(ierr)) ierr = ierr0 + RETURN +END IF +jdof2 = GetIDOF(obj=dof_obj, & + & ivar=myindx(4, 2), & + & spacecompo=myindx(5, 2), & + & timecompo=myindx(6, 2)) +col2 = dof_obj.tNodes.jdof2 + +NULLIFY (dof_obj) + +problem = (row1 .NE. row2) .OR. (col1 .NE. col2) +IF (problem) THEN + CALL ErrorMSG( & + & "Some error occured in sizes.", & + & filename, & + & myName, & + & __LINE__, stderr) + ierr0 = -5 + IF (PRESENT(ierr)) ierr = ierr0 + RETURN +END IF + +CALL CSR2CSR_Get_Master(obj1=obj1, obj2=obj2, idof1=idof1, idof2=idof2, & +& jdof1=jdof1, jdof2=jdof2, tNodes1=row1, tNodes2=col1) + +END PROCEDURE obj_Get8 + +!---------------------------------------------------------------------------- +! CSR2CSRGetValue +!---------------------------------------------------------------------------- + +MODULE PROCEDURE CSR2CSR_Get_Master +INTEGER(I4B) :: ii, jj +REAL(DFP) :: VALUE +DO jj = 1, tNodes2 + DO ii = 1, tNodes1 + CALL GetValue(obj=obj1, & + & idof=idof1, & + & jdof=jdof1, & + & iNodeNum=ii, & + & jNodeNum=jj, & + & VALUE=VALUE) + + CALL Set(obj=obj2, & + & idof=idof2, & + & jdof=jdof2, & + & iNodeNum=ii, & + & jNodeNum=jj, & + & VALUE=VALUE) + END DO +END DO + +END PROCEDURE CSR2CSR_Get_Master + END SUBMODULE Methods diff --git a/src/submodules/CSRMatrix/src/CSRMatrix_IOMethods@Methods.F90 b/src/submodules/CSRMatrix/src/CSRMatrix_IOMethods@Methods.F90 index f3f0e3e4..5d7005e3 100644 --- a/src/submodules/CSRMatrix/src/CSRMatrix_IOMethods@Methods.F90 +++ b/src/submodules/CSRMatrix/src/CSRMatrix_IOMethods@Methods.F90 @@ -232,12 +232,11 @@ END SUBROUTINE obj_SPY_gnuplot TYPE(String) :: aline CHARACTER(1024) :: iomsg CHARACTER(50) :: rep, field, symm -! + ! Open file -! OPEN (FILE=filename, NEWUNIT=unitno, STATUS="OLD", ACTION="READ", & & IOSTAT=iostat, iomsg=iomsg) -! + IF (iostat .NE. 0) THEN CALL ErrorMSG(& & msg="Error in opening file, following msg = "//TRIM(iomsg), & @@ -247,10 +246,10 @@ END SUBROUTINE obj_SPY_gnuplot & unitno=stderr) RETURN END IF -! + CALL MMRead(unitno=unitno, rep=rep, field=field, symm=symm, rows=rows, & & cols=cols, nnz=nnz, indx=indx, jndx=jndx, rval=rval) -! + CALL toUpperCase(symm) IF (symm .EQ. "SYMMETRIC") THEN symm = "SYM" @@ -259,15 +258,13 @@ END SUBROUTINE obj_SPY_gnuplot ELSE symm = "UNSYM" END IF -! + ALLOCATE (IA(rows + 1), JA(nnz), A(nnz)) -! + ! Call COOCSR from sparsekit -! CALL COOCSR(rows, nnz, rval, indx, jndx, A, JA, IA) -! CALL Initiate(obj=obj, A=A, IA=IA, JA=JA, MatrixProp=symm) -! + CLOSE (unitNo) DEALLOCATE (indx, jndx, rval, IA, JA, A) END PROCEDURE obj_IMPORT diff --git a/src/submodules/CSRSparsity/src/CSRSparsity_Method@ConstructorMethods.F90 b/src/submodules/CSRSparsity/src/CSRSparsity_Method@ConstructorMethods.F90 index 6c8c8f80..4f0a1cf4 100644 --- a/src/submodules/CSRSparsity/src/CSRSparsity_Method@ConstructorMethods.F90 +++ b/src/submodules/CSRSparsity/src/CSRSparsity_Method@ConstructorMethods.F90 @@ -63,7 +63,8 @@ problem = tnodes1 .NE. nrow .OR. tnodes2 .NE. ncol IF (problem) THEN CALL ErrorMSG( & - & "Size of the matrix does not conform with the dof data!", & + & "Size of the matrix does not conform with the dof data! "// & + & "tNodes1 = "//tostring(tnodes1)//" tNodes2="//tostring(tNodes2), & & "CSRSparsity_Method@Constructor.F90", & & "obj_initiate1()", & & __LINE__, stderr) @@ -98,7 +99,7 @@ CALL Reallocate(obj%idiag, nrow) IF (obj%nnz .GT. 0) THEN - ALLOCATE (obj%row(obj%nnz), obj%JA(obj%nnz)) + CALL Reallocate(obj%JA, obj%nnz) END IF END PROCEDURE obj_initiate1 @@ -136,16 +137,13 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE obj_Initiate3 -INTEGER(I4B) :: nrow, ncol0 +INTEGER(I4B) :: nrow, ncol0, nnz -CALL DEALLOCATE (obj) nrow = SIZE(IA) - 1 -ncol0 = Input(default=MAXVAL(JA), option=ncol) -CALL Initiate(obj=obj, nrow=nrow, ncol=ncol0) -obj%nnz = SIZE(JA) -CALL Reallocate(obj%IA, SIZE(IA)) +ncol0 = Input(default=nrow, option=ncol) +nnz = SIZE(JA) +CALL Initiate(obj=obj, nrow=nrow, ncol=ncol0, nnz=nnz) obj%IA = IA -CALL Reallocate(obj%JA, SIZE(JA)) obj%JA = JA END PROCEDURE obj_Initiate3 diff --git a/src/submodules/CSRSparsity/src/CSRSparsity_Method@GetMethods.F90 b/src/submodules/CSRSparsity/src/CSRSparsity_Method@GetMethods.F90 index d77fe40f..661012ff 100644 --- a/src/submodules/CSRSparsity/src/CSRSparsity_Method@GetMethods.F90 +++ b/src/submodules/CSRSparsity/src/CSRSparsity_Method@GetMethods.F90 @@ -102,7 +102,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE GetNNZ_Add_Subtract -INTEGER(I4B) :: ii, jcol, kb, jpos, ka +INTEGER(I4B) :: ii, jcol, kb, ka LOGICAL(LGT) :: iw(ncol) ans = 0 @@ -311,7 +311,7 @@ END PROCEDURE obj_GetColIndex1 !---------------------------------------------------------------------------- -! startColumn +! startColumn !---------------------------------------------------------------------------- MODULE PROCEDURE obj_startColumn1 @@ -319,11 +319,27 @@ END PROCEDURE obj_startColumn1 !---------------------------------------------------------------------------- -! endColumn +! endColumn !---------------------------------------------------------------------------- MODULE PROCEDURE obj_endColumn1 ans = obj%IA(irow + 1) - 1 END PROCEDURE obj_endColumn1 +!---------------------------------------------------------------------------- +! GetIA +!---------------------------------------------------------------------------- + +MODULE PROCEDURE obj_GetIA +ans = obj%IA(irow) +END PROCEDURE obj_GetIA + +!---------------------------------------------------------------------------- +! GetJA +!---------------------------------------------------------------------------- + +MODULE PROCEDURE obj_GetJA +ans = obj%JA(indx) +END PROCEDURE obj_GetJA + END SUBMODULE GetMethods diff --git a/src/submodules/DOF/src/DOF_Method@GetMethods.F90 b/src/submodules/DOF/src/DOF_Method@GetMethods.F90 index cf138bbe..59243f63 100644 --- a/src/submodules/DOF/src/DOF_Method@GetMethods.F90 +++ b/src/submodules/DOF/src/DOF_Method@GetMethods.F90 @@ -25,7 +25,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_DOFStartIndex - ans = obj%map(ivar,5) +ans = obj%map(ivar, 5) END PROCEDURE dof_DOFStartIndex !---------------------------------------------------------------------------- @@ -33,7 +33,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_DOFEndIndex - ans = obj%map(ivar+1,5)-1 +ans = obj%map(ivar + 1, 5) - 1 END PROCEDURE dof_DOFEndIndex !---------------------------------------------------------------------------- @@ -41,11 +41,10 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_tNodes1 - IF( ALLOCATED( obj%map ) ) THEN - ans = obj%map( SIZE( obj%map, 1 ), 6 ) - ELSE - ans = 0 - END IF +ans = 0 +IF (ALLOCATED(obj%map)) THEN + ans = obj%map(SIZE(obj%map, 1), 6) +END IF END PROCEDURE dof_tNodes1 !---------------------------------------------------------------------------- @@ -53,12 +52,10 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_tNodes2 - ans = 0 - IF( ALLOCATED( obj%valmap ) ) THEN - ans = obj%valmap( idof + 1 ) - obj%valmap( idof ) - ELSE - ans = 0 - END IF +ans = 0 +IF (ALLOCATED(obj%valmap)) THEN + ans = obj%valmap(idof + 1) - obj%valmap(idof) +END IF END PROCEDURE dof_tNodes2 !---------------------------------------------------------------------------- @@ -66,7 +63,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_tNodes3 - ans = obj .tNodes. NameToIndex( obj, varName ) +ans = obj.tNodes.NameToIndex(obj, varName) END PROCEDURE dof_tNodes3 !---------------------------------------------------------------------------- @@ -74,11 +71,11 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_tNodes4 - INTEGER( I4B ) :: ii - ans = 0 - DO ii = 1, SIZE( idof ) - ans = ans + (obj .tNodes. idof( ii )) - END DO +INTEGER(I4B) :: ii +ans = 0 +DO ii = 1, SIZE(idof) + ans = ans + (obj.tNodes.idof(ii)) +END DO END PROCEDURE dof_tNodes4 !---------------------------------------------------------------------------- @@ -86,11 +83,11 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_tdof1 - IF( ALLOCATED( obj%map ) ) THEN - ans = obj%map( SIZE( obj%map, 1 ), 4 ) - ELSE - ans = 0 - END IF +IF (ALLOCATED(obj%map)) THEN + ans = obj%map(SIZE(obj%map, 1), 4) +ELSE + ans = 0 +END IF END PROCEDURE dof_tdof1 !---------------------------------------------------------------------------- @@ -98,15 +95,15 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_tdof2 - INTEGER( I4B ) :: i, k - k = ICHAR( Name ) - IF( ALLOCATED( obj%map ) ) THEN - DO i = 1, SIZE( obj%map, 1 ) - 1 - IF( obj%map( i, 1 ) .EQ. k ) ans = obj%map( i, 4 ) - END DO - ELSE - ans = 0 - END IF +INTEGER(I4B) :: i, k +k = ICHAR(Name) +IF (ALLOCATED(obj%map)) THEN + DO i = 1, SIZE(obj%map, 1) - 1 + IF (obj%map(i, 1) .EQ. k) ans = obj%map(i, 4) + END DO +ELSE + ans = 0 +END IF END PROCEDURE dof_tdof2 !---------------------------------------------------------------------------- @@ -114,14 +111,14 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_tdof3 - INTEGER( I4B ) :: i +INTEGER(I4B) :: i - i = SIZE( obj%map, 1 ) - 1 - IF( ALLOCATED( obj%map ) .AND. ivar .LE. i ) THEN - ans = obj%map( ivar, 4 ) - ELSE - ans = 0 - END IF +i = SIZE(obj%map, 1) - 1 +IF (ALLOCATED(obj%map) .AND. ivar .LE. i) THEN + ans = obj%map(ivar, 4) +ELSE + ans = 0 +END IF END PROCEDURE dof_tdof3 !---------------------------------------------------------------------------- @@ -129,11 +126,11 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_tNames - IF( ALLOCATED( obj%map ) ) THEN - ans = SIZE( obj%map, 1 ) - 1 - ELSE - ans = 0 - END IF +IF (ALLOCATED(obj%map)) THEN + ans = SIZE(obj%map, 1) - 1 +ELSE + ans = 0 +END IF END PROCEDURE dof_tNames !---------------------------------------------------------------------------- @@ -141,14 +138,14 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_names1 - INTEGER( I4B ) :: ii, n +INTEGER(I4B) :: ii, n - n = SIZE( obj%map, 1 ) - 1 - ALLOCATE( ans( n ) ) +n = SIZE(obj%map, 1) - 1 +ALLOCATE (ans(n)) - DO ii = 1, n - ans( ii ) = ACHAR( obj%map( ii, 1 ) ) - END DO +DO ii = 1, n + ans(ii) = ACHAR(obj%map(ii, 1)) +END DO END PROCEDURE dof_names1 !---------------------------------------------------------------------------- @@ -156,7 +153,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_names2 - ans = ACHAR( obj%map( ii, 1 ) ) +ans = ACHAR(obj%map(ii, 1)) END PROCEDURE dof_names2 !---------------------------------------------------------------------------- @@ -164,16 +161,16 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE NameToIndex - INTEGER( I4B ) :: n, i, ic - n = SIZE( obj%map, 1 ) - 1 - ic = ICHAR( Name ) - ans = 0 - DO i =1, n - IF( obj%map( i, 1 ) .EQ. ic ) THEN - ans = i - EXIT - END IF - END DO +INTEGER(I4B) :: n, i, ic +n = SIZE(obj%map, 1) - 1 +ic = ICHAR(Name) +ans = 0 +DO i = 1, n + IF (obj%map(i, 1) .EQ. ic) THEN + ans = i + EXIT + END IF +END DO END PROCEDURE NameToIndex !---------------------------------------------------------------------------- @@ -181,12 +178,12 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_tspacecomponents - INTEGER( I4B ) :: n, i - n = SIZE( obj%map, 1 ) - 1 - ans = 0 - DO i = 1, n - IF( obj%map( i, 2 ) .GT. 0 ) ans = ans + 1 - END DO +INTEGER(I4B) :: n, i +n = SIZE(obj%map, 1) - 1 +ans = 0 +DO i = 1, n + IF (obj%map(i, 2) .GT. 0) ans = ans + 1 +END DO END PROCEDURE dof_tspacecomponents !---------------------------------------------------------------------------- @@ -194,11 +191,11 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_spacecomponents1 - INTEGER( I4B ) :: n, i - CALL Reallocate( ans, SIZE( obj%map, 1 ) - 1 ) - DO i = 1, SIZE(ans) - ans( i ) = obj%map( i, 2 ) - END DO +INTEGER(I4B) :: n, i +CALL Reallocate(ans, SIZE(obj%map, 1) - 1) +DO i = 1, SIZE(ans) + ans(i) = obj%map(i, 2) +END DO END PROCEDURE dof_spacecomponents1 !---------------------------------------------------------------------------- @@ -206,7 +203,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_spacecomponents2 - ans = obj%map( ivar, 2 ) +ans = obj%map(ivar, 2) END PROCEDURE dof_spacecomponents2 !---------------------------------------------------------------------------- @@ -214,12 +211,12 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_ttimecomponents - INTEGER( I4B ) :: n, i - n = SIZE( obj%map, 1 ) - 1 - ans = 0 - DO i = 1, n - IF( obj%map( i, 3 ) .GT. 1 ) ans = ans + 1 - END DO +INTEGER(I4B) :: n, i +n = SIZE(obj%map, 1) - 1 +ans = 0 +DO i = 1, n + IF (obj%map(i, 3) .GT. 1) ans = ans + 1 +END DO END PROCEDURE dof_ttimecomponents !---------------------------------------------------------------------------- @@ -227,11 +224,11 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_timecomponents1 - INTEGER( I4B ) :: n, i - CALL Reallocate( ans, SIZE( obj%map, 1 ) - 1 ) - DO i = 1, SIZE(ans) - ans( i ) = obj%map( i, 3 ) - END DO +INTEGER(I4B) :: n, i +CALL Reallocate(ans, SIZE(obj%map, 1) - 1) +DO i = 1, SIZE(ans) + ans(i) = obj%map(i, 3) +END DO END PROCEDURE dof_timecomponents1 !---------------------------------------------------------------------------- @@ -239,7 +236,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_timecomponents2 - ans = obj%map( ivar, 3 ) +ans = obj%map(ivar, 3) END PROCEDURE dof_timecomponents2 !---------------------------------------------------------------------------- @@ -247,10 +244,10 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_isEqual - ans = .TRUE. - IF( obj1%storageFMT .NE. obj2%storageFMT ) ans = .FALSE. - IF( ANY( obj1%map( :, 2: ) .NE. obj2%map( :, 2: ) ) ) ans = .FALSE. - IF( ANY( obj1%valmap .NE. obj2%valmap ) ) ans = .FALSE. +ans = .TRUE. +IF (obj1%storageFMT .NE. obj2%storageFMT) ans = .FALSE. +IF (ANY(obj1%map(:, 2:) .NE. obj2%map(:, 2:))) ans = .FALSE. +IF (ANY(obj1%valmap .NE. obj2%valmap)) ans = .FALSE. END PROCEDURE dof_isEqual !---------------------------------------------------------------------------- @@ -258,7 +255,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_isNE - ans = .NOT. ( dof_isEqual( obj1, obj2 ) ) +ans = .NOT. (dof_isEqual(obj1, obj2)) END PROCEDURE dof_isNE !---------------------------------------------------------------------------- @@ -266,7 +263,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIDOF1 - ans = spacecompo + (timecompo-1)*tspacecompo +ans = spacecompo + (timecompo - 1) * tspacecompo END PROCEDURE dof_getIDOF1 !---------------------------------------------------------------------------- @@ -274,9 +271,9 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIDOF2 - ans = (obj .DOFStartIndex. ivar) & - & + spacecompo - 1 & - & + (timecompo-1)*(obj .spacecomponents. ivar) +ans = (obj.DOFStartIndex.ivar) & + & + spacecompo - 1 & + & + (timecompo - 1) * (obj.spacecomponents.ivar) END PROCEDURE dof_getIDOF2 !---------------------------------------------------------------------------- @@ -284,9 +281,9 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIDOF3 - ans = (obj .DOFStartIndex. ivar) & - & + spacecompo - 1 & - & + (timecompo-1)*(obj .spacecomponents. ivar) +ans = (obj.DOFStartIndex.ivar) & + & + spacecompo - 1 & + & + (timecompo - 1) * (obj.spacecomponents.ivar) END PROCEDURE dof_getIDOF3 !---------------------------------------------------------------------------- @@ -294,9 +291,9 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIDOF4 - ans = (obj .DOFStartIndex. ivar) & - & + spacecompo - 1 & - & + (timecompo-1)*(obj .spacecomponents. ivar) +ans = (obj.DOFStartIndex.ivar) & + & + spacecompo - 1 & + & + (timecompo - 1) * (obj.spacecomponents.ivar) END PROCEDURE dof_getIDOF4 !---------------------------------------------------------------------------- @@ -304,7 +301,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIDOF5 - ans = spacecompo + (timecompo-1)*tspacecompo +ans = spacecompo + (timecompo - 1) * tspacecompo END PROCEDURE dof_getIDOF5 !---------------------------------------------------------------------------- @@ -312,7 +309,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIDOF6 - ans = spacecompo + (timecompo-1)*tspacecompo +ans = spacecompo + (timecompo - 1) * tspacecompo END PROCEDURE dof_getIDOF6 !---------------------------------------------------------------------------- @@ -320,7 +317,7 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIDOF7 - ans = (obj .DOFStartIndex. ivar) + idof - 1 +ans = (obj.DOFStartIndex.ivar) + idof - 1 END PROCEDURE dof_getIDOF7 !---------------------------------------------------------------------------- @@ -328,9 +325,9 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIDOF8 - ans = (obj .DOFStartIndex. ivar) & - & + arange(1, obj .tdof. ivar ) & - & - 1 +ans = (obj.DOFStartIndex.ivar) & + & + arange(1, obj.tdof.ivar) & + & - 1 END PROCEDURE dof_getIDOF8 !---------------------------------------------------------------------------- @@ -338,11 +335,11 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getNodeLoc1 - IF( obj%storageFMT .EQ. NODES_FMT ) THEN - ans = (nodenum-1)*(.tdof. obj) + idof - ELSE - ans = obj%valmap(idof) + nodenum - 1 - END IF +IF (obj%storageFMT .EQ. NODES_FMT) THEN + ans = (nodenum - 1) * (.tdof.obj) + idof +ELSE + ans = obj%valmap(idof) + nodenum - 1 +END IF END PROCEDURE dof_getNodeLoc1 !---------------------------------------------------------------------------- @@ -350,11 +347,11 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getNodeLoc2 - IF( obj%storageFMT .EQ. NODES_FMT ) THEN - ans = (nodenum-1)*(.tdof. obj) + idof - ELSE - ans = obj%valmap(idof) - 1 + nodenum - END IF +IF (obj%storageFMT .EQ. NODES_FMT) THEN + ans = (nodenum - 1) * (.tdof.obj) + idof +ELSE + ans = obj%valmap(idof) - 1 + nodenum +END IF END PROCEDURE dof_getNodeLoc2 !---------------------------------------------------------------------------- @@ -362,11 +359,11 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getNodeLoc3 - IF( obj%storageFMT .EQ. NODES_FMT ) THEN - ans = (nodenum-1)*(.tdof. obj) + idof - ELSE - ans = obj%valmap(idof) - 1 + nodenum - END IF +IF (obj%storageFMT .EQ. NODES_FMT) THEN + ans = (nodenum - 1) * (.tdof.obj) + idof +ELSE + ans = obj%valmap(idof) - 1 + nodenum +END IF END PROCEDURE dof_getNodeLoc3 !---------------------------------------------------------------------------- @@ -374,11 +371,11 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getNodeLoc4 - IF( obj%storageFMT .EQ. NODES_FMT ) THEN - ans = [idof, .tnodes. obj, .tdof. obj ] - ELSE - ans = [obj%valmap( idof ), obj%valmap(idof+1)-1, 1 ] - END IF +IF (obj%storageFMT .EQ. NODES_FMT) THEN + ans = [idof, .tnodes.obj, .tdof.obj] +ELSE + ans = [obj%valmap(idof), obj%valmap(idof + 1) - 1, 1] +END IF END PROCEDURE dof_getNodeLoc4 !---------------------------------------------------------------------------- @@ -387,11 +384,11 @@ MODULE PROCEDURE dof_getNodeLoc5 !! main - IF ( obj%storageFMT .EQ. DOF_FMT ) THEN - ans = obj%valmap( obj%map( ivar, 5) - 1 + idof ) + nodenum - 1 - ELSE - ans = (nodenum-1)*(.tdof. obj) + (obj%map( ivar, 5) - 1 + idof) - END IF +IF (obj%storageFMT .EQ. DOF_FMT) THEN + ans = obj%valmap(obj%map(ivar, 5) - 1 + idof) + nodenum - 1 +ELSE + ans = (nodenum - 1) * (.tdof.obj) + (obj%map(ivar, 5) - 1 + idof) +END IF !! END PROCEDURE dof_getNodeLoc5 @@ -401,11 +398,11 @@ MODULE PROCEDURE dof_getNodeLoc6 !! main - IF ( obj%storageFMT .EQ. DOF_FMT ) THEN - ans = obj%valmap( obj%map( ivar, 5) - 1 + idof ) + nodenum - 1 - ELSE - ans = (nodenum-1)*(.tdof. obj) + (obj%map( ivar, 5) - 1 + idof) - END IF +IF (obj%storageFMT .EQ. DOF_FMT) THEN + ans = obj%valmap(obj%map(ivar, 5) - 1 + idof) + nodenum - 1 +ELSE + ans = (nodenum - 1) * (.tdof.obj) + (obj%map(ivar, 5) - 1 + idof) +END IF !! END PROCEDURE dof_getNodeLoc6 @@ -414,13 +411,13 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getNodeLoc7 - ans = getNodeLoc(obj=obj, & - & nodenum=nodenum, & - & ivar=ivar, & - & idof=GetIDOF( & - & spacecompo=spacecompo, & - & timecompo=timecompo, & - & tspacecompo=obj .spacecomponents. ivar) ) +ans = getNodeLoc(obj=obj, & + & nodenum=nodenum, & + & ivar=ivar, & + & idof=GetIDOF( & + & spacecompo=spacecompo, & + & timecompo=timecompo, & + & tspacecompo=obj.spacecomponents.ivar)) END PROCEDURE dof_getNodeLoc7 !---------------------------------------------------------------------------- @@ -428,13 +425,13 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getNodeLoc8 - ans = getNodeLoc(obj=obj, & - & nodenum=nodenum, & - & ivar=ivar, & - & idof=GetIDOF( & - & spacecompo=spacecompo, & - & timecompo=timecompo, & - & tspacecompo=obj .spacecomponents. ivar) ) +ans = getNodeLoc(obj=obj, & + & nodenum=nodenum, & + & ivar=ivar, & + & idof=GetIDOF( & + & spacecompo=spacecompo, & + & timecompo=timecompo, & + & tspacecompo=obj.spacecomponents.ivar)) END PROCEDURE dof_getNodeLoc8 !---------------------------------------------------------------------------- @@ -442,23 +439,23 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getNodeLoc9 - INTEGER( I4B ) :: ii +INTEGER(I4B) :: ii !! !! main !! - IF ( obj%storageFMT .EQ. DOF_FMT ) THEN +IF (obj%storageFMT .EQ. DOF_FMT) THEN !! - DO ii = 1, size(idof) - ans(ii) = obj%valmap( obj%map( ivar, 5) - 1 + idof(ii) ) + nodenum - 1 - END DO + DO ii = 1, SIZE(idof) + ans(ii) = obj%valmap(obj%map(ivar, 5) - 1 + idof(ii)) + nodenum - 1 + END DO !! - ELSE +ELSE !! - DO ii = 1, size(idof) - ans(ii) = (nodenum-1)*(.tdof. obj) + (obj%map( ivar, 5) - 1 + idof(ii)) - END DO + DO ii = 1, SIZE(idof) + ans(ii) = (nodenum - 1) * (.tdof.obj) + (obj%map(ivar, 5) - 1 + idof(ii)) + END DO !! - END IF +END IF !! END PROCEDURE dof_getNodeLoc9 @@ -467,13 +464,13 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getNodeLoc10 - ans = getNodeLoc(obj=obj, & - & nodenum=nodenum, & - & ivar=ivar, & - & idof=GetIDOF( & - & spacecompo=spacecompo,& - & timecompo=timecompo, & - & tspacecompo=obj .spacecomponents. ivar) ) +ans = getNodeLoc(obj=obj, & + & nodenum=nodenum, & + & ivar=ivar, & + & idof=GetIDOF( & + & spacecompo=spacecompo,& + & timecompo=timecompo, & + & tspacecompo=obj.spacecomponents.ivar)) END PROCEDURE dof_getNodeLoc10 !---------------------------------------------------------------------------- @@ -481,13 +478,13 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getNodeLoc11 - ans = getNodeLoc(obj=obj, & - & nodenum=nodenum, & - & ivar=ivar, & - & idof=GetIDOF( & - & spacecompo=spacecompo, & - & timecompo=timecompo, & - & tspacecompo=obj .spacecomponents. ivar) ) +ans = getNodeLoc(obj=obj, & + & nodenum=nodenum, & + & ivar=ivar, & + & idof=GetIDOF( & + & spacecompo=spacecompo, & + & timecompo=timecompo, & + & tspacecompo=obj.spacecomponents.ivar)) END PROCEDURE dof_getNodeLoc11 !---------------------------------------------------------------------------- @@ -495,22 +492,22 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getNodeLoc12 - INTEGER( I4B ) ::idofs( size(timecompo) ), ii +INTEGER(I4B) :: idofs(SIZE(timecompo)), ii !! !! - idofs = GetIDOF(spacecompo=spacecompo, timecompo=timecompo, & - & tspacecompo=obj .spacecomponents. ivar) +idofs = GetIDOF(spacecompo=spacecompo, timecompo=timecompo, & + & tspacecompo=obj.spacecomponents.ivar) !! !! - DO ii =1, size(nodenum) +DO ii = 1, SIZE(nodenum) !! - ans( (ii-1)*size(idofs) + 1 : ii*size(idofs) ) = getNodeLoc( & - & obj=obj, & - & nodenum=nodenum(ii), & - & ivar=ivar, & - & idof=idofs ) + ans((ii - 1) * SIZE(idofs) + 1:ii * SIZE(idofs)) = getNodeLoc( & + & obj=obj, & + & nodenum=nodenum(ii), & + & ivar=ivar, & + & idof=idofs) !! - END DO +END DO !! END PROCEDURE dof_getNodeLoc12 @@ -519,22 +516,22 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getNodeLoc13 - INTEGER( I4B ) ::idofs( size(spacecompo) ), ii +INTEGER(I4B) :: idofs(SIZE(spacecompo)), ii !! !! - idofs = GetIDOF(spacecompo=spacecompo, timecompo=timecompo, & - & tspacecompo=obj .spacecomponents. ivar) +idofs = GetIDOF(spacecompo=spacecompo, timecompo=timecompo, & + & tspacecompo=obj.spacecomponents.ivar) !! !! - DO ii =1, size(nodenum) +DO ii = 1, SIZE(nodenum) !! - ans( (ii-1)*size(idofs) + 1 : ii*size(idofs) ) = getNodeLoc( & - & obj=obj, & - & nodenum=nodenum(ii), & - & ivar=ivar, & - & idof=idofs ) + ans((ii - 1) * SIZE(idofs) + 1:ii * SIZE(idofs)) = getNodeLoc( & + & obj=obj, & + & nodenum=nodenum(ii), & + & ivar=ivar, & + & idof=idofs) !! - END DO +END DO !! END PROCEDURE dof_getNodeLoc13 @@ -543,10 +540,10 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIndex1 - ans = getNodeLoc( & - & obj=obj, & - & nodenum=nodenum, & - & idof=arange(1, .tdof. obj)) +ans = getNodeLoc( & + & obj=obj, & + & nodenum=nodenum, & + & idof=arange(1, .tdof.obj)) END PROCEDURE dof_getIndex1 !---------------------------------------------------------------------------- @@ -554,10 +551,10 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIndex2 - ans = getNodeLoc( & - & obj=obj, & - & nodenum=nodenum, & - & idof=arange( obj .DOFStartIndex. ivar, obj .DOFEndIndex. ivar ) ) +ans = getNodeLoc( & + & obj=obj, & + & nodenum=nodenum, & + & idof=arange(obj.DOFStartIndex.ivar, obj.DOFEndIndex.ivar)) END PROCEDURE dof_getIndex2 !---------------------------------------------------------------------------- @@ -565,10 +562,10 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIndex3 - ans = getIndex( & - & obj=obj, & - & ivar=NameToIndex( obj, varName ), & - & nodenum=nodenum ) +ans = getIndex( & + & obj=obj, & + & ivar=NameToIndex(obj, varName), & + & nodenum=nodenum) END PROCEDURE dof_getIndex3 !---------------------------------------------------------------------------- @@ -576,32 +573,32 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIndex4 - INTEGER( I4B ) :: jj, ii, tdof, nn +INTEGER(I4B) :: jj, ii, tdof, nn !! !! main !! - tdof = .tdof. obj - nn = SIZE(nodenum) - ALLOCATE(ans(tdof*nn)) - ans = 0 +tdof = .tdof.obj +nn = SIZE(nodenum) +ALLOCATE (ans(tdof * nn)) +ans = 0 !! - IF( obj%storageFMT .EQ. FMT_NODES ) then +IF (obj%storageFMT .EQ. FMT_NODES) THEN !! - DO ii = 1, nn - ans( (ii-1)*tdof+1:ii*tdof ) = getIndex( obj=obj, & - & nodenum=nodenum(ii) ) - END DO + DO ii = 1, nn + ans((ii - 1) * tdof + 1:ii * tdof) = getIndex(obj=obj, & + & nodenum=nodenum(ii)) + END DO !! - ELSE +ELSE !! - DO jj = 1, tdof - DO ii = 1, nn - ans((jj-1)*nn + ii ) = getNodeLoc(obj=obj, & - & nodenum=nodenum(ii), idof=jj) - END DO + DO jj = 1, tdof + DO ii = 1, nn + ans((jj - 1) * nn + ii) = getNodeLoc(obj=obj, & + & nodenum=nodenum(ii), idof=jj) END DO + END DO !! - END IF +END IF !! END PROCEDURE dof_getIndex4 @@ -610,34 +607,34 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIndex5 - INTEGER( I4B ) :: jj, ii, tdof, nn +INTEGER(I4B) :: jj, ii, tdof, nn !! !! main !! - tdof = obj .tdof. ivar - nn=SIZE(nodenum) - ALLOCATE( ans(tdof*nn)) - ans=0 +tdof = obj.tdof.ivar +nn = SIZE(nodenum) +ALLOCATE (ans(tdof * nn)) +ans = 0 !! - IF( obj%storageFMT .EQ. FMT_NODES ) THEN +IF (obj%storageFMT .EQ. FMT_NODES) THEN !! - DO ii = 1, nn - ans( (ii-1) * tdof + 1 : ii*tdof ) = getIndex( obj=obj, & - & nodenum=nodenum(ii), ivar=ivar ) - END DO + DO ii = 1, nn + ans((ii - 1) * tdof + 1:ii * tdof) = getIndex(obj=obj, & + & nodenum=nodenum(ii), ivar=ivar) + END DO !! - ELSE +ELSE !! - tdof = 0 ! using tdof as counter - DO jj = ( obj .DOFStartIndex. ivar), (obj .DOFEndIndex. ivar) - tdof=tdof+1 - DO ii = 1, nn - ans((tdof-1)*nn + ii ) = getNodeLoc(obj=obj, nodenum=nodenum(ii), & - & idof=jj) - ! here tdof is local counter - END DO + tdof = 0 ! using tdof as counter + DO jj = (obj.DOFStartIndex.ivar), (obj.DOFEndIndex.ivar) + tdof = tdof + 1 + DO ii = 1, nn + ans((tdof - 1) * nn + ii) = getNodeLoc(obj=obj, nodenum=nodenum(ii), & + & idof=jj) + ! here tdof is local counter END DO - END IF + END DO +END IF !! END PROCEDURE dof_getIndex5 @@ -646,10 +643,10 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE dof_getIndex6 - ans = getIndex( & - & obj=obj, & - & ivar=NameToIndex( obj, varName ), & - & nodenum=nodenum ) +ans = getIndex( & + & obj=obj, & + & ivar=NameToIndex(obj, varName), & + & nodenum=nodenum) END PROCEDURE dof_getIndex6 -END SUBMODULE GetMethods \ No newline at end of file +END SUBMODULE GetMethods diff --git a/src/submodules/Utility/src/ConvertUtility@Methods.F90 b/src/submodules/Utility/src/ConvertUtility@Methods.F90 index 6ffdcf79..658b358e 100644 --- a/src/submodules/Utility/src/ConvertUtility@Methods.F90 +++ b/src/submodules/Utility/src/ConvertUtility@Methods.F90 @@ -20,7 +20,8 @@ ! summary: This submodule contains method for swaping SUBMODULE(ConvertUtility) Methods -USE BaseMethod +USE ReallocateUtility +USE EyeUtility IMPLICIT NONE CONTAINS @@ -29,14 +30,25 @@ !---------------------------------------------------------------------------- MODULE PROCEDURE convert_1 +CALL Reallocate(to, nns * tdof, nns * tdof) +CALL ConvertSafe(from=from, to=to, Conversion=conversion, & + & nns=nns, tdof=tdof) +END PROCEDURE convert_1 + +!---------------------------------------------------------------------------- +! ConvertSafe +!---------------------------------------------------------------------------- + +MODULE PROCEDURE convert_1_safe INTEGER(I4B) :: m, inode, idof, i, j -INTEGER(I4B), ALLOCATABLE :: T(:, :) +INTEGER(I4B) :: T(nns * tdof, nns * tdof) !> main m = nns * tdof -ALLOCATE (T(m, m)) -T = Eye(m, TypeInt) +T = eye(m, TypeInt) + SELECT CASE (Conversion) CASE (DofToNodes) + DO inode = 1, nns DO idof = 1, tdof j = (inode - 1) * tdof + idof @@ -45,7 +57,9 @@ T(i, j) = 1 END DO END DO + CASE (NodesToDOF) + DO idof = 1, tdof DO inode = 1, nns j = (idof - 1) * nns + inode @@ -54,10 +68,11 @@ T(i, j) = 1 END DO END DO + END SELECT + to = MATMUL(TRANSPOSE(T), MATMUL(from, T)) -DEALLOCATE (T) -END PROCEDURE convert_1 +END PROCEDURE convert_1_safe !---------------------------------------------------------------------------- ! Convert @@ -74,7 +89,7 @@ c2 = b * I(2) r1 = 0; r2 = 0 DO a = 1, I(3) - r1 = r2 + 1; + r1 = r2 + 1; r2 = a * I(1) To(r1:r2, c1:c2) = From(:, :, a, b) END DO