From 1df8b22e239e0f1397dff744c437b2d14a26e2ea Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 12 Mar 2019 09:28:06 +0100 Subject: [PATCH] clearer names --- src/lattice.f90 | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/lattice.f90 b/src/lattice.f90 index a636cdb15..ec4d35bd5 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -2272,38 +2272,41 @@ end function coordinateSystem_slip !-------------------------------------------------------------------------------------------------- !> @brief Populates reduced interaction matrix !-------------------------------------------------------------------------------------------------- -function buildInteraction(activeA,activeB,maxA,maxB,values,matrix) +function buildInteraction(acting_used,reacting_used,acting_max,reacting_max,values,matrix) use IO, only: & IO_error implicit none integer, dimension(:), intent(in) :: & - activeA, & !< number of active systems as specified in material.config - activeB, & !< number of active systems as specified in material.config - maxA, & !< number of maximum available systems - maxB !< number of maximum available systems - real(pReal), dimension(:), intent(in) :: values !< interaction values - integer, dimension(:,:), intent(in) :: matrix !< complete interaction matrix - real(pReal), dimension(sum(activeA),sum(activeB)) :: buildInteraction + acting_used, & !< # of acting systems per family as specified in material.config + reacting_used, & !< # of reacting systems per family as specified in material.config + acting_max, & + reacting_max + real(pReal), dimension(:), intent(in) :: values !< interaction values + integer, dimension(:,:), intent(in) :: matrix !< interaction matrix + real(pReal), dimension(sum(acting_used),sum(reacting_used)) :: buildInteraction integer :: & - index_myFamily, index_otherFamily, & - mf, ms, of, os + acting_family_index, reacting_family_index, & + acting_family, acting_system, reacting_family, reacting_system - myFamilies: do mf = 1,size(activeA,1) - index_myFamily = sum(activeA(1:mf-1)) - mySystems: do ms = 1,activeA(mf) + do acting_family = 1,size(acting_used,1) + acting_family_index = sum(acting_used(1:acting_family-1)) + do acting_system = 1,acting_used(acting_family) - otherFamilies: do of = 1,size(activeB,1) - index_otherFamily = sum(activeB(1:of-1)) - otherSystems: do os = 1,activeB(of) - if(matrix(sum(maxA(1:mf-1))+ms, sum(maxB(1:of-1))+os) > size(values)) & + do reacting_family = 1,size(reacting_used,1) + reacting_family_index = sum(reacting_used(1:reacting_family-1)) + do reacting_system = 1,reacting_used(reacting_family) + + if(matrix(sum(acting_max(1:acting_family-1))+acting_system, & + sum(reacting_max(1:reacting_family-1))+reacting_system) > size(values)) & call IO_error(138,ext_msg='buildInteraction') - buildInteraction(index_myFamily+ms,index_otherFamily+os) = & - values(matrix(sum(maxA(1:mf-1))+ms, sum(maxB(1:of-1))+os)) - enddo otherSystems; enddo otherFamilies; + buildInteraction(acting_family_index+acting_system,reacting_family_index+reacting_system) = & + values(matrix(sum(acting_max(1:acting_family-1))+acting_system, & + sum(reacting_max(1:reacting_family-1))+reacting_system)) + enddo; enddo - enddo mySystems;enddo myFamilies + enddo; enddo end function buildInteraction