summaryrefslogtreecommitdiff
path: root/Dragon/src/g2s_unfold.f90
diff options
context:
space:
mode:
authorstainer_t <thomas.stainer@oecd-nea.org>2025-09-08 13:48:49 +0200
committerstainer_t <thomas.stainer@oecd-nea.org>2025-09-08 13:48:49 +0200
commit7dfcc480ba1e19bd3232349fc733caef94034292 (patch)
tree03ee104eb8846d5cc1a981d267687a729185d3f3 /Dragon/src/g2s_unfold.f90
Initial commit from Polytechnique Montreal
Diffstat (limited to 'Dragon/src/g2s_unfold.f90')
-rw-r--r--Dragon/src/g2s_unfold.f9065
1 files changed, 65 insertions, 0 deletions
diff --git a/Dragon/src/g2s_unfold.f90 b/Dragon/src/g2s_unfold.f90
new file mode 100644
index 0000000..d116bea
--- /dev/null
+++ b/Dragon/src/g2s_unfold.f90
@@ -0,0 +1,65 @@
+!
+!-----------------------------------------------------------------------
+!
+!Purpose:
+! Unfold the geometry.
+!
+!Copyright:
+! Copyright (C) 2020 Ecole Polytechnique de Montreal.
+! This library is free software; you can redistribute it and/or
+! modify it under the terms of the GNU Lesser General Public
+! License as published by the Free Software Foundation; either
+! version 2.1 of the License, or (at your option) any later version.
+!
+!Author(s):
+! A. Hebert
+!
+!-----------------------------------------------------------------------
+!
+subroutine g2s_unfold(geoIp,impx)
+ use GANLIB
+ use constType
+ type(c_ptr),intent(in) :: geoIp
+ integer,intent(in) :: impx
+ !
+ integer,parameter :: nstate=40
+ integer,dimension(nstate) :: st
+ integer,allocatable,dimension(:) :: idp,ind1,ind2
+ !
+ call LCMGET(geoIp,'STATE-VECTOR',st)
+ select case(st(1))
+ case(G_Hex)
+ call LCMLIB(geoIp)
+ call LCMGET(geoIp,'IHEX ',iHex)
+ lxold=st(6)
+ if((iHex /= 9).and.(lxold > 1)) then
+ call LCMLEN(geoIp,'TURN ',ilong,itylcm)
+ if(ilong > 0) call XABORT('g2s_unfold: TURN not supported.')
+ ! caution: HEXCEL cells are not rotated according to symmetries in BIVALL
+ maxpts=12*lxold
+ allocate(idp(maxpts))
+ call BIVALL(maxpts,iHex,lxold,lx,idp)
+ if(impx > 0) write(*,*) 'g2s_unfold: nb of hexagons=',lxold,'-->',lx
+ allocate(ind1(lxold),ind2(lx))
+ call LCMGET(geoIp,'MIX ',ind1)
+ do i=1,lx
+ ind2(i)=ind1(idp(i))
+ enddo
+ call LCMPUT(geoIp,'MIX ',lx,1,ind2)
+ call LCMLEN(geoIp,'MERGE ',ilong,itylcm)
+ if(ilong > 0) then
+ call LCMGET(geoIp,'MERGE ',ind1)
+ do i=1,lx
+ ind2(i)=ind1(idp(i))
+ enddo
+ call LCMPUT(geoIp,'MERGE ',lx,1,ind2)
+ endif
+ deallocate(ind2,ind1,idp)
+ st(3)=lx
+ st(6)=lx
+ call LCMPUT(geoIp,'STATE-VECTOR',nstate,1,st)
+ iHex=9
+ call LCMPUT(geoIp,'IHEX ',1,1,iHex)
+ endif
+ end select
+end subroutine g2s_unfold