From a96f92a1cc021a82725fa9bdffee5f3624f7dde3 Mon Sep 17 00:00:00 2001 From: "Vikas@easifem@archlinux@work" Date: Thu, 1 Feb 2024 13:47:17 +0900 Subject: [PATCH] Making NodeToElements faster --- .../src/AbstractMesh_Class@NodeDataMethods.F90 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/submodules/AbstractMesh/src/AbstractMesh_Class@NodeDataMethods.F90 b/src/submodules/AbstractMesh/src/AbstractMesh_Class@NodeDataMethods.F90 index 25522d42b..dd761611b 100644 --- a/src/submodules/AbstractMesh/src/AbstractMesh_Class@NodeDataMethods.F90 +++ b/src/submodules/AbstractMesh/src/AbstractMesh_Class@NodeDataMethods.F90 @@ -29,8 +29,9 @@ MODULE PROCEDURE obj_InitiateNodeToElements CHARACTER(*), PARAMETER :: myName = "obj_InitiateNodeToElements()" INTEGER(I4B) :: ii, jj, globalElemNum, nn, localNodeNum, & - & globalNodeNum + & globalNodeNum, nodewise_size(obj%tNodes) TYPE(CPUTime_) :: TypeCPUTime +INTEGER(I4B), PARAMETER :: chunk_size = 32 #ifdef DEBUG_VER CALL e%RaiseInformation(modName//'::'//myName//' - '// & @@ -47,6 +48,8 @@ obj%isNodeToElementsInitiated = .TRUE. +nodewise_size = 0 + DO ii = 1, obj%tElements globalElemNum = obj%elementData(ii)%globalElemNum @@ -56,13 +59,19 @@ globalNodeNum = obj%elementData(ii)%globalNodes(jj) localNodeNum = obj%local_nptrs(globalNodeNum) - CALL Append(obj%nodeData(localNodeNum)%globalElements, & - & globalElemNum) - + CALL Expand(vec=obj%nodeData(localNodeNum)%globalElements, & + & n=nodewise_size(localNodeNum), chunk_size=chunk_size, & + & val=globalElemNum) END DO END DO +! Now we have to fix the size of `nodeData%globalElements` +DO ii = 1, obj%tNodes + CALL Expand(vec=obj%nodeData(ii)%globalElements, & + & n=nodewise_size(ii), chunk_size=chunk_size, finished=.TRUE.) +END DO + IF (obj%showTime) THEN CALL TypeCPUTime%SetEndTime() CALL Display(modName//" : "//myName// &