amr_Morton_order Subroutine

public subroutine amr_Morton_order()

Uses

  • proc~~amr_morton_order~~UsesGraph proc~amr_morton_order amr_Morton_order module~mod_comm_lib mod_comm_lib proc~amr_morton_order->module~mod_comm_lib module~mod_forest mod_forest proc~amr_morton_order->module~mod_forest module~mod_global_parameters mod_global_parameters proc~amr_morton_order->module~mod_global_parameters module~mod_basic_types mod_basic_types module~mod_global_parameters->module~mod_basic_types module~mod_connectivity mod_connectivity module~mod_global_parameters->module~mod_connectivity module~mod_constants mod_constants module~mod_global_parameters->module~mod_constants module~mod_physicaldata mod_physicaldata module~mod_global_parameters->module~mod_physicaldata module~mod_variables mod_variables module~mod_global_parameters->module~mod_variables mpi mpi module~mod_global_parameters->mpi module~mod_variables->module~mod_basic_types

Construct Morton-order as a global recursive lexicographic ordering.

Arguments

None

Calls

proc~~amr_morton_order~~CallsGraph proc~amr_morton_order amr_Morton_order proc~mpistop mpistop proc~amr_morton_order->proc~mpistop mpi_abort mpi_abort proc~mpistop->mpi_abort

Called by

proc~~amr_morton_order~~CalledByGraph proc~amr_morton_order amr_Morton_order proc~amr_coarsen_refine amr_coarsen_refine proc~amr_coarsen_refine->proc~amr_morton_order proc~load_balance load_balance proc~amr_coarsen_refine->proc~load_balance proc~init_forest_root init_forest_root proc~init_forest_root->proc~amr_morton_order proc~load_balance->proc~amr_morton_order proc~read_forest read_forest proc~read_forest->proc~amr_morton_order proc~initlevelone initlevelone proc~initlevelone->proc~init_forest_root proc~read_snapshot read_snapshot proc~read_snapshot->proc~read_forest proc~read_snapshot_old read_snapshot_old proc~read_snapshot->proc~read_snapshot_old proc~read_snapshot_old->proc~read_forest proc~resettree resettree proc~resettree->proc~amr_coarsen_refine proc~resettree_convert resettree_convert proc~resettree_convert->proc~amr_coarsen_refine proc~settree settree proc~settree->proc~amr_coarsen_refine proc~main main proc~main->proc~initlevelone proc~main->proc~read_snapshot proc~main->proc~resettree_convert proc~main->proc~settree proc~timeintegration timeintegration proc~main->proc~timeintegration proc~timeintegration->proc~resettree program~agile agile program~agile->proc~main

Source Code

  subroutine amr_Morton_order
    use mod_forest
    use mod_global_parameters
    use mod_comm_lib, only: mpistop

    integer :: ig1,ig2,ig3, Morton_no, isfc

    Morton_no=0
    nglev1=ng1(1)*ng2(1)*ng3(1)
    do isfc=1,nglev1
       ig1=sfc_iglevel1(1,isfc)
       ig2=sfc_iglevel1(2,isfc)
       ig3=sfc_iglevel1(3,isfc) 
       call get_Morton_number(tree_root(ig1,ig2,ig3))
    end do

!FIXME: why does this fail with Cray even if the values are equal? Different types somehow?
#ifndef _CRAYFTN
    if (Morton_no/=nleafs) then
       call mpistop("error in amr_Morton_order: Morton_no/=nleafs")
    end if
#endif

    contains

    recursive subroutine get_Morton_number(tree)

      type(tree_node_ptr) :: tree

      integer :: ic1,ic2,ic3

      if (tree%node%leaf) then
         Morton_no=Morton_no+1
         sfc(1,Morton_no)=tree%node%igrid
         sfc(2,Morton_no)=tree%node%ipe
         if (tree%node%active) then 
            sfc(3,Morton_no)=1 
         else 
            sfc(3,Morton_no)=0 
         end if
         if(tree%node%ipe==mype) igrid_to_sfc(tree%node%igrid)=Morton_no
      else
         do ic3=1,2
         do ic2=1,2
         do ic1=1,2
            call get_Morton_number(tree%node%child(ic1,ic2,ic3))
         end do
         end do
         end do
      end if

    end subroutine get_Morton_number

  end subroutine amr_Morton_order