--- trunk/OOPSE/libmdtools/mpiSimulation_module.F90 2004/06/01 18:07:34 1213 +++ trunk/OOPSE/libmdtools/mpiSimulation_module.F90 2004/06/01 18:42:58 1214 @@ -7,7 +7,7 @@ !! !! @author Charles F. Vardeman II !! @author Matthew Meineke -!! @version $Id: mpiSimulation_module.F90,v 1.14 2004-05-27 18:59:15 gezelter Exp $, $Date: 2004-05-27 18:59:15 $, $Name: not supported by cvs2svn $, $Revision: 1.14 $ +!! @version $Id: mpiSimulation_module.F90,v 1.15 2004-06-01 18:42:58 gezelter Exp $, $Date: 2004-06-01 18:42:58 $, $Name: not supported by cvs2svn $, $Revision: 1.15 $ module mpiSimulation use definitions @@ -141,17 +141,18 @@ contains !! Sets up mpiComponentPlan with structure passed from C++. subroutine setupSimParallel(thisComponentPlan, nAtomTags, atomTags, & - status) + nGroupTags, groupTags, status) !! Passed Arguments !! mpiComponentPlan struct from C type (mpiComponentPlan), intent(inout) :: thisComponentPlan !! Number of tags passed - integer, intent(in) :: nAtomTags + integer, intent(in) :: nAtomTags, nGroupTags !! Result status, 0 = normal, -1 = error integer, intent(out) :: status integer :: localStatus !! Global reference tag for local particles integer, dimension(nAtomTags), intent(inout) :: atomTags + integer, dimension(nGroupTags), intent(inout) :: groupTags !write(*,*) 'mpiSim_mod thinks node', thisComponentPlan%myNode, & ! ' has atomTags(1) = ', atomTags(1) @@ -210,6 +211,14 @@ contains status = -1 return endif + + + call setGroupTags(groupTags,localStatus) + if (localStatus /= 0) then + status = -1 + return + endif + isSimSet = .true. ! call printComponentPlan(mpiSim,0) @@ -708,6 +717,54 @@ contains call gather(tags, AtomColToGlobal, plan_atom_col) end subroutine setAtomTags + + subroutine setGroupTags(tags, status) + integer, dimension(:) :: tags + integer :: status + + integer :: alloc_stat + + integer :: nGroupsInCol + integer :: nGroupsInRow + + status = 0 + + nGroupsInRow = getNgroupsInRow(plan_group_row) + nGroupsInCol = getNgroupsInCol(plan_group_col) + + if(allocated(GroupLocalToGlobal)) then + deallocate(GroupLocalToGlobal) + endif + allocate(GroupLocalToGlobal(size(tags)),STAT=alloc_stat) + if (alloc_stat /= 0 ) then + status = -1 + return + endif + + GroupLocalToGlobal = tags + + if(allocated(GroupRowToGlobal)) then + deallocate(GroupRowToGlobal) + endif + allocate(GroupRowToGlobal(nGroupsInRow),STAT=alloc_stat) + if (alloc_stat /= 0 ) then + status = -1 + return + endif + + if(allocated(GroupColToGlobal)) then + deallocate(GroupColToGlobal) + endif + allocate(GroupColToGlobal(nGroupsInCol),STAT=alloc_stat) + if (alloc_stat /= 0 ) then + status = -1 + return + endif + + call gather(tags, GroupRowToGlobal, plan_group_row) + call gather(tags, GroupColToGlobal, plan_group_col) + + end subroutine setGroupTags function getNatomsInCol(thisplan) result(nInCol) type (gs_plan), intent(in) :: thisplan