summaryrefslogtreecommitdiff
path: root/Donjon/src/D2PSOI.f
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 /Donjon/src/D2PSOI.f
Initial commit from Polytechnique Montreal
Diffstat (limited to 'Donjon/src/D2PSOI.f')
-rw-r--r--Donjon/src/D2PSOI.f42
1 files changed, 42 insertions, 0 deletions
diff --git a/Donjon/src/D2PSOI.f b/Donjon/src/D2PSOI.f
new file mode 100644
index 0000000..8a7a14d
--- /dev/null
+++ b/Donjon/src/D2PSOI.f
@@ -0,0 +1,42 @@
+*DECK D2PSOI
+ SUBROUTINE D2PSOI(TAB,DIMTAB)
+*
+*-----------------------------------------------------------------------
+*
+*Purpose:
+* Sort D2PSOR state variable integer array to match GENPMAXS order, in
+* ascendent order
+*
+*Author(s):
+* J. Taforeau
+*
+*Parameters: input
+* TAB vector of rank index of state variables
+* DIMTAB dimension of TAB
+*
+*-----------------------------------------------------------------------
+*
+*----
+* SUBROUTINE ARGUMENTS
+*----
+ INTEGER DIMTAB
+ INTEGER TAB(DIMTAB)
+*----
+* LOCAL VARIABLES
+*----
+ INTEGER Rtmp
+ INTEGER :: I, J
+
+ DO I = 2, DIMTAB
+ Rtmp = TAB(I)
+ DO J = I-1, 1, -1
+ IF (Rtmp < TAB(J)) THEN
+ TAB(J+1) = TAB(J)
+ ELSE
+ EXIT
+ ENDIF
+ ENDDO
+ TAB(J+1) = Rtmp
+ ENDDO
+ RETURN
+ END