Skip to content

Commit 56f959c

Browse files
Merge pull request #481 from easifem/03-19-updates_in_abstractmesh_import
Updates in AbstractMesh Import
2 parents 36cdec6 + 90687e6 commit 56f959c

File tree

1 file changed

+92
-8
lines changed

1 file changed

+92
-8
lines changed

src/submodules/AbstractMesh/src/AbstractMeshUtility.F90

Lines changed: 92 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,45 @@ SUBROUTINE MeshImportNodeData(obj, connectivity, internalNptrs)
332332

333333
END SUBROUTINE MeshImportNodeData
334334

335+
!----------------------------------------------------------------------------
336+
! MeshImportNodeData
337+
!----------------------------------------------------------------------------
338+
339+
SUBROUTINE MeshImportNodeDataFromDim(obj, connectivity)
340+
CLASS(AbstractMesh_), INTENT(INOUT) :: obj
341+
INTEGER(I4B), INTENT(IN) :: connectivity(:, :)
342+
343+
! Internal veriables
344+
INTEGER(I4B) :: ii, jj, aint, dummy
345+
346+
aint = SIZE(connectivity, 1)
347+
CALL Reallocate(obj%local_nptrs, obj%maxNptrs)
348+
349+
DO ii = 1, obj%tElements
350+
DO jj = 1, aint
351+
dummy = connectivity(jj, ii)
352+
IF (dummy .NE. 0) THEN
353+
obj%local_nptrs(dummy) = dummy
354+
END IF
355+
END DO
356+
END DO
357+
358+
obj%tNodes = COUNT(obj%local_nptrs .NE. 0)
359+
ALLOCATE (obj%nodeData(obj%tNodes))
360+
361+
dummy = 0
362+
DO ii = 1, obj%maxNptrs
363+
IF (obj%local_nptrs(ii) .EQ. 0) CYCLE
364+
365+
dummy = dummy + 1
366+
obj%nodeData(dummy)%globalNodeNum = obj%local_nptrs(ii)
367+
obj%nodeData(dummy)%localNodeNum = dummy
368+
obj%nodeData(dummy)%nodeType = INTERNAL_NODE
369+
obj%local_nptrs(ii) = dummy
370+
END DO
371+
372+
END SUBROUTINE MeshImportNodeDataFromDim
373+
335374
!----------------------------------------------------------------------------
336375
! MeshImportFromGroup
337376
!----------------------------------------------------------------------------
@@ -429,10 +468,10 @@ SUBROUTINE MeshImportFromDim(obj, hdf5, group, dim, entities, tEntities)
429468
! internal variables
430469
CHARACTER(*), PARAMETER :: myName = "MeshImportFromDim()"
431470
INTEGER(I4B), ALLOCATABLE :: connectivity(:, :), elemNumber(:), &
432-
& internalNptrs(:), temp_int_2d(:, :), temp_int_1d(:)
433-
INTEGER(I4B) :: ii, tElements(tEntities), tIntNodes(tEntities), &
471+
& temp_int_2d(:, :), temp_int_1d(:), boundingEntity(:)
472+
INTEGER(I4B) :: ii, jj, kk, tElements(tEntities), tIntNodes(tEntities), &
434473
& nsd(tEntities), uid(tEntities), elemType(tEntities), nne(tEntities), &
435-
& aint, bint
474+
& aint, bint, maxBoundingEntities
436475
! TYPE(CPUTime_) :: TypeCPUTime
437476
CHARACTER(:), ALLOCATABLE :: dsetname, prefix
438477
REAL(DFP), DIMENSION(3, tEntities) :: xyz, min_xyz, max_xyz
@@ -447,6 +486,7 @@ SUBROUTINE MeshImportFromDim(obj, hdf5, group, dim, entities, tEntities)
447486
SELECT CASE (dim)
448487
CASE (0_I4B)
449488
prefix = group//"/pointEntities_"
489+
maxBoundingEntities = 0_I4B
450490
CASE (1_I4B)
451491
prefix = group//"/curveEntities_"
452492
CASE (2_I4B)
@@ -478,6 +518,19 @@ SUBROUTINE MeshImportFromDim(obj, hdf5, group, dim, entities, tEntities)
478518
xyz(2, ii) = obj%y
479519
xyz(3, ii) = obj%z
480520

521+
aint = GetElementIndex(elemType(ii))
522+
obj%tElements_topology_wise(aint) = obj%tElements_topology_wise(aint) + &
523+
& tElements(ii)
524+
525+
END DO
526+
527+
DO ii = 1, SIZE(obj%tElements_topology_wise)
528+
aint = obj%tElements_topology_wise(ii)
529+
IF (aint .GT. 0) THEN
530+
obj%tElemTopologies = obj%tElemTopologies + 1
531+
obj%elemTopologies(obj%tElemTopologies) = &
532+
& ReferenceElementInfo%elemTopologyName(ii)
533+
END IF
481534
END DO
482535

483536
obj%maxNNE = MAXVAL(nne)
@@ -486,6 +539,15 @@ SUBROUTINE MeshImportFromDim(obj, hdf5, group, dim, entities, tEntities)
486539
CALL Reallocate(connectivity, obj%maxNNE, obj%tElements)
487540
CALL Reallocate(elemNumber, obj%tElements)
488541

542+
IF (dim .GT. 0) THEN
543+
CALL HDF5GetEntities(hdf5=hdf5, group=group, dim=dim - 1, &
544+
& tEntities=maxBoundingEntities, myName=myName, modName=modName)
545+
ELSE
546+
maxBoundingEntities = 0
547+
END IF
548+
549+
CALL Reallocate(boundingEntity, maxBoundingEntities)
550+
489551
aint = 0
490552
bint = 0
491553
DO ii = 1, tEntities
@@ -496,6 +558,26 @@ SUBROUTINE MeshImportFromDim(obj, hdf5, group, dim, entities, tEntities)
496558
connectivity(1:nne(ii), aint:bint) = &
497559
& temp_int_2d(1:nne(ii), 1:tElements(ii))
498560
elemNumber(aint:bint) = temp_int_1d(1:tElements(ii))
561+
562+
DO jj = 1, SIZE(obj%boundingEntity)
563+
kk = ABS(obj%boundingEntity(jj))
564+
boundingEntity(kk) = boundingEntity(kk) + obj%boundingEntity(jj)
565+
END DO
566+
END DO
567+
568+
aint = 0
569+
DO ii = 1, SIZE(boundingEntity)
570+
IF (boundingEntity(ii) .NE. 0) aint = aint + 1
571+
END DO
572+
573+
CALL Reallocate(obj%boundingEntity, aint)
574+
575+
aint = 0
576+
DO ii = 1, SIZE(boundingEntity)
577+
IF (boundingEntity(ii) .NE. 0) THEN
578+
aint = aint + 1
579+
obj%boundingEntity(aint) = boundingEntity(ii)
580+
END IF
499581
END DO
500582

501583
obj%maxElemNum = MAXVAL(elemNumber)
@@ -521,11 +603,13 @@ SUBROUTINE MeshImportFromDim(obj, hdf5, group, dim, entities, tEntities)
521603
& nne=nne(ii))
522604
END DO
523605

524-
! CALL MeshImportNodeData(obj, connectivity, internalNptrs)
525-
!
526-
! IF (ALLOCATED(elemNumber)) DEALLOCATE (elemNumber)
527-
! IF (ALLOCATED(connectivity)) DEALLOCATE (connectivity)
528-
! IF (ALLOCATED(internalNptrs)) DEALLOCATE (internalNptrs)
606+
CALL MeshImportNodeDataFromDim(obj, connectivity)
607+
608+
IF (ALLOCATED(connectivity)) DEALLOCATE (connectivity)
609+
IF (ALLOCATED(elemNumber)) DEALLOCATE (elemNumber)
610+
IF (ALLOCATED(temp_int_2d)) DEALLOCATE (temp_int_2d)
611+
IF (ALLOCATED(temp_int_1d)) DEALLOCATE (temp_int_1d)
612+
IF (ALLOCATED(boundingEntity)) DEALLOCATE (boundingEntity)
529613

530614
#ifdef DEBUG_VER
531615
CALL e%RaiseInformation(modName//'::'//myName//' - '// &

0 commit comments

Comments
 (0)