Locks for particle lists are now inside the type.

The lock of a particle list is no longer an external variable, it is now
part of the type.

New procedures have been added to set and unset the lock.
This commit is contained in:
Jorge Gonzalez 2022-12-31 11:22:02 +01:00
commit 8199a228c8
5 changed files with 39 additions and 16 deletions

View file

@ -347,7 +347,6 @@ MODULE moduleCollisions
ELSEIF (electron%weight < neutral%weight) THEN
!If primary electron is ligther than neutral, change weight of neutral and create new neutral
ALLOCATE(remainingNeutral)
PRINT *, "ionize"
remainingNeutral = neutral
@ -369,13 +368,13 @@ MODULE moduleCollisions
END SELECT
!Adds new particles to the list
CALL OMP_SET_LOCK(lockCollisions)
CALL partCollisions%setLock()
CALL partCollisions%add(newElectron)
IF (ASSOCIATED(remainingNeutral)) THEN
CALL partCollisions%add(remainingNeutral)
END IF
CALL OMP_UNSET_LOCK(lockCollisions)
CALL partCollisions%unsetLock()
END IF
@ -495,9 +494,9 @@ MODULE moduleCollisions
!Adds new particles to the list
IF (ASSOCIATED(remainingIon)) THEN
CALL OMP_SET_LOCK(lockCollisions)
CALL partCollisions%setLock()
CALL partCollisions%add(remainingIon)
CALL OMP_UNSET_LOCK(lockCollisions)
CALL partCollisions%unsetLock()
END IF
END SUBROUTINE collideBinaryRecombination