common.f90 Source File


Files dependent on this one

sourcefile~~common.f90~3~~AfferentGraph sourcefile~common.f90~3 common.f90 sourcefile~allocator.f90 allocator.f90 sourcefile~allocator.f90->sourcefile~common.f90~3 sourcefile~field.f90 field.f90 sourcefile~allocator.f90->sourcefile~field.f90 sourcefile~mesh.f90 mesh.f90 sourcefile~allocator.f90->sourcefile~mesh.f90 sourcefile~allocator.f90~2 allocator.f90 sourcefile~allocator.f90~2->sourcefile~common.f90~3 sourcefile~allocator.f90~2->sourcefile~allocator.f90 sourcefile~allocator.f90~2->sourcefile~field.f90 sourcefile~allocator.f90~2->sourcefile~mesh.f90 sourcefile~backend.f90 backend.f90 sourcefile~backend.f90->sourcefile~common.f90~3 sourcefile~backend.f90->sourcefile~allocator.f90 sourcefile~backend.f90~3 backend.f90 sourcefile~backend.f90->sourcefile~backend.f90~3 sourcefile~exec_dist.f90 exec_dist.f90 sourcefile~backend.f90->sourcefile~exec_dist.f90 sourcefile~backend.f90->sourcefile~field.f90 sourcefile~backend.f90->sourcefile~mesh.f90 sourcefile~ordering.f90 ordering.f90 sourcefile~backend.f90->sourcefile~ordering.f90 sourcefile~poisson_fft.f90 poisson_fft.f90 sourcefile~backend.f90->sourcefile~poisson_fft.f90 sourcefile~sendrecv.f90 sendrecv.f90 sourcefile~backend.f90->sourcefile~sendrecv.f90 sourcefile~tdsops.f90~2 tdsops.f90 sourcefile~backend.f90->sourcefile~tdsops.f90~2 sourcefile~backend.f90~2 backend.f90 sourcefile~backend.f90~2->sourcefile~common.f90~3 sourcefile~backend.f90~2->sourcefile~allocator.f90 sourcefile~backend.f90~2->sourcefile~allocator.f90~2 sourcefile~backend.f90~2->sourcefile~backend.f90~3 sourcefile~distributed.f90 distributed.f90 sourcefile~backend.f90~2->sourcefile~distributed.f90 sourcefile~exec_dist.f90~2 exec_dist.f90 sourcefile~backend.f90~2->sourcefile~exec_dist.f90~2 sourcefile~backend.f90~2->sourcefile~field.f90 sourcefile~fieldops.f90 fieldops.f90 sourcefile~backend.f90~2->sourcefile~fieldops.f90 sourcefile~backend.f90~2->sourcefile~mesh.f90 sourcefile~poisson_fft.f90~3 poisson_fft.f90 sourcefile~backend.f90~2->sourcefile~poisson_fft.f90~3 sourcefile~reorder.f90 reorder.f90 sourcefile~backend.f90~2->sourcefile~reorder.f90 sourcefile~sendrecv.f90~2 sendrecv.f90 sourcefile~backend.f90~2->sourcefile~sendrecv.f90~2 sourcefile~tdsops.f90 tdsops.f90 sourcefile~backend.f90~2->sourcefile~tdsops.f90 sourcefile~backend.f90~2->sourcefile~tdsops.f90~2 sourcefile~backend.f90~3->sourcefile~common.f90~3 sourcefile~backend.f90~3->sourcefile~allocator.f90 sourcefile~backend.f90~3->sourcefile~field.f90 sourcefile~backend.f90~3->sourcefile~mesh.f90 sourcefile~poisson_fft.f90~2 poisson_fft.f90 sourcefile~backend.f90~3->sourcefile~poisson_fft.f90~2 sourcefile~backend.f90~3->sourcefile~tdsops.f90~2 sourcefile~base_case.f90 base_case.f90 sourcefile~base_case.f90->sourcefile~common.f90~3 sourcefile~base_case.f90->sourcefile~allocator.f90 sourcefile~base_case.f90->sourcefile~backend.f90~3 sourcefile~base_case.f90->sourcefile~field.f90 sourcefile~base_case.f90->sourcefile~mesh.f90 sourcefile~solver.f90 solver.f90 sourcefile~base_case.f90->sourcefile~solver.f90 sourcefile~channel.f90 channel.f90 sourcefile~channel.f90->sourcefile~common.f90~3 sourcefile~channel.f90->sourcefile~allocator.f90 sourcefile~channel.f90->sourcefile~backend.f90~3 sourcefile~channel.f90->sourcefile~base_case.f90 sourcefile~config.f90 config.f90 sourcefile~channel.f90->sourcefile~config.f90 sourcefile~channel.f90->sourcefile~mesh.f90 sourcefile~channel.f90->sourcefile~solver.f90 sourcefile~config.f90->sourcefile~common.f90~3 sourcefile~distributed.f90->sourcefile~common.f90~3 sourcefile~distributed.f90~2 distributed.f90 sourcefile~distributed.f90~2->sourcefile~common.f90~3 sourcefile~exec_dist.f90->sourcefile~common.f90~3 sourcefile~exec_dist.f90->sourcefile~distributed.f90~2 sourcefile~exec_dist.f90->sourcefile~sendrecv.f90 sourcefile~exec_dist.f90->sourcefile~tdsops.f90~2 sourcefile~exec_dist.f90~2->sourcefile~common.f90~3 sourcefile~exec_dist.f90~2->sourcefile~distributed.f90 sourcefile~exec_dist.f90~2->sourcefile~sendrecv.f90~2 sourcefile~exec_dist.f90~2->sourcefile~tdsops.f90 sourcefile~exec_thom.f90 exec_thom.f90 sourcefile~exec_thom.f90->sourcefile~common.f90~3 sourcefile~exec_thom.f90->sourcefile~tdsops.f90 sourcefile~thomas.f90~2 thomas.f90 sourcefile~exec_thom.f90->sourcefile~thomas.f90~2 sourcefile~exec_thom.f90~2 exec_thom.f90 sourcefile~exec_thom.f90~2->sourcefile~common.f90~3 sourcefile~exec_thom.f90~2->sourcefile~tdsops.f90~2 sourcefile~thomas.f90 thomas.f90 sourcefile~exec_thom.f90~2->sourcefile~thomas.f90 sourcefile~field.f90->sourcefile~common.f90~3 sourcefile~fieldops.f90->sourcefile~common.f90~3 sourcefile~generic.f90 generic.f90 sourcefile~generic.f90->sourcefile~common.f90~3 sourcefile~generic.f90->sourcefile~allocator.f90 sourcefile~generic.f90->sourcefile~backend.f90~3 sourcefile~generic.f90->sourcefile~base_case.f90 sourcefile~generic.f90->sourcefile~field.f90 sourcefile~generic.f90->sourcefile~mesh.f90 sourcefile~generic.f90->sourcefile~solver.f90 sourcefile~mesh.f90->sourcefile~common.f90~3 sourcefile~mesh.f90->sourcefile~field.f90 sourcefile~mesh_content.f90 mesh_content.f90 sourcefile~mesh.f90->sourcefile~mesh_content.f90 sourcefile~decomp_dummy.f90 decomp_dummy.f90 sourcefile~mesh.f90->sourcefile~decomp_dummy.f90 sourcefile~mesh_content.f90->sourcefile~common.f90~3 sourcefile~ordering.f90->sourcefile~common.f90~3 sourcefile~ordering.f90->sourcefile~mesh.f90 sourcefile~poisson_fft.f90->sourcefile~common.f90~3 sourcefile~poisson_fft.f90->sourcefile~field.f90 sourcefile~poisson_fft.f90->sourcefile~mesh.f90 sourcefile~poisson_fft.f90->sourcefile~poisson_fft.f90~2 sourcefile~spectral_processing.f90~2 spectral_processing.f90 sourcefile~poisson_fft.f90->sourcefile~spectral_processing.f90~2 sourcefile~poisson_fft.f90->sourcefile~tdsops.f90~2 sourcefile~poisson_fft.f90~2->sourcefile~common.f90~3 sourcefile~poisson_fft.f90~2->sourcefile~field.f90 sourcefile~poisson_fft.f90~2->sourcefile~mesh.f90 sourcefile~poisson_fft.f90~2->sourcefile~tdsops.f90~2 sourcefile~poisson_fft.f90~3->sourcefile~common.f90~3 sourcefile~poisson_fft.f90~3->sourcefile~allocator.f90~2 sourcefile~poisson_fft.f90~3->sourcefile~field.f90 sourcefile~poisson_fft.f90~3->sourcefile~mesh.f90 sourcefile~poisson_fft.f90~3->sourcefile~poisson_fft.f90~2 sourcefile~spectral_processing.f90 spectral_processing.f90 sourcefile~poisson_fft.f90~3->sourcefile~spectral_processing.f90 sourcefile~poisson_fft.f90~3->sourcefile~tdsops.f90~2 sourcefile~reorder.f90->sourcefile~common.f90~3 sourcefile~sendrecv.f90->sourcefile~common.f90~3 sourcefile~sendrecv.f90~2->sourcefile~common.f90~3 sourcefile~solver.f90->sourcefile~common.f90~3 sourcefile~solver.f90->sourcefile~allocator.f90 sourcefile~solver.f90->sourcefile~backend.f90~3 sourcefile~solver.f90->sourcefile~config.f90 sourcefile~solver.f90->sourcefile~field.f90 sourcefile~solver.f90->sourcefile~mesh.f90 sourcefile~solver.f90->sourcefile~tdsops.f90~2 sourcefile~time_integrator.f90 time_integrator.f90 sourcefile~solver.f90->sourcefile~time_integrator.f90 sourcefile~vector_calculus.f90 vector_calculus.f90 sourcefile~solver.f90->sourcefile~vector_calculus.f90 sourcefile~spectral_processing.f90->sourcefile~common.f90~3 sourcefile~spectral_processing.f90~2->sourcefile~common.f90~3 sourcefile~tdsops.f90->sourcefile~common.f90~3 sourcefile~tdsops.f90->sourcefile~tdsops.f90~2 sourcefile~tdsops.f90~2->sourcefile~common.f90~3 sourcefile~tgv.f90 tgv.f90 sourcefile~tgv.f90->sourcefile~common.f90~3 sourcefile~tgv.f90->sourcefile~allocator.f90 sourcefile~tgv.f90->sourcefile~backend.f90~3 sourcefile~tgv.f90->sourcefile~base_case.f90 sourcefile~tgv.f90->sourcefile~field.f90 sourcefile~tgv.f90->sourcefile~mesh.f90 sourcefile~tgv.f90->sourcefile~solver.f90 sourcefile~thomas.f90->sourcefile~common.f90~3 sourcefile~thomas.f90~2->sourcefile~common.f90~3 sourcefile~time_integrator.f90->sourcefile~common.f90~3 sourcefile~time_integrator.f90->sourcefile~allocator.f90 sourcefile~time_integrator.f90->sourcefile~backend.f90~3 sourcefile~time_integrator.f90->sourcefile~field.f90 sourcefile~vector_calculus.f90->sourcefile~common.f90~3 sourcefile~vector_calculus.f90->sourcefile~allocator.f90 sourcefile~vector_calculus.f90->sourcefile~backend.f90~3 sourcefile~vector_calculus.f90->sourcefile~field.f90 sourcefile~vector_calculus.f90->sourcefile~tdsops.f90~2 sourcefile~xcompact.f90 xcompact.f90 sourcefile~xcompact.f90->sourcefile~common.f90~3 sourcefile~xcompact.f90->sourcefile~allocator.f90 sourcefile~xcompact.f90->sourcefile~allocator.f90~2 sourcefile~xcompact.f90->sourcefile~backend.f90 sourcefile~xcompact.f90->sourcefile~backend.f90~2 sourcefile~xcompact.f90->sourcefile~backend.f90~3 sourcefile~xcompact.f90->sourcefile~base_case.f90 sourcefile~xcompact.f90->sourcefile~channel.f90 sourcefile~xcompact.f90->sourcefile~config.f90 sourcefile~xcompact.f90->sourcefile~generic.f90 sourcefile~xcompact.f90->sourcefile~mesh.f90 sourcefile~xcompact.f90->sourcefile~tgv.f90 sourcefile~decomp_2decompfft.f90 decomp_2decompfft.f90 sourcefile~decomp_2decompfft.f90->sourcefile~mesh_content.f90 sourcefile~decomp_dummy.f90->sourcefile~mesh_content.f90

Source Code

module m_common
  implicit none

  integer, parameter :: dp = kind(0.0d0)
  real(dp), parameter :: pi = 4*atan(1.0_dp)

  integer, parameter :: RDR_X2Y = 12, RDR_X2Z = 13, RDR_Y2X = 21, &
                        RDR_Y2Z = 23, RDR_Z2X = 31, RDR_Z2Y = 32, &
                        RDR_C2X = 41, RDR_C2Y = 42, RDR_C2Z = 43, &
                        RDR_X2C = 14, RDR_Y2C = 24, RDR_Z2C = 34
  integer, parameter :: DIR_X = 1, DIR_Y = 2, DIR_Z = 3, DIR_C = 4
  integer, parameter :: POISSON_SOLVER_FFT = 0, POISSON_SOLVER_CG = 1
  integer, parameter :: VERT = 0000, & ! Vertex centered data
                        CELL = 1110, & ! Cell centered data
                        X_FACE = 1100, & ! Data on faces normal to X
                        Y_FACE = 1010, & ! Data on faces normal to Y
                        Z_FACE = 0110, & ! Data on faces normal to Z
                        X_EDGE = 0010, & ! Data on edges along X
                        Y_EDGE = 0100, & ! Data on edges along Y
                        Z_EDGE = 1000, & ! Data on edges along Z
                        NULL_LOC = -0001 ! The location of data isn't specified
  integer, parameter :: BC_PERIODIC = 0, BC_NEUMANN = 1, BC_DIRICHLET = 2, &
                        BC_HALO = -1
  integer, protected :: &
    rdr_map(4, 4) = reshape([0, RDR_Y2X, RDR_Z2X, RDR_C2X, &
                             RDR_X2Y, 0, RDR_Z2Y, RDR_C2Y, &
                             RDR_X2Z, RDR_Y2Z, 0, RDR_C2Z, &
                             RDR_X2C, RDR_Y2C, RDR_Z2C, 0], shape=[4, 4])

contains

  pure subroutine get_dirs_from_rdr(dir_from, dir_to, rdr_dir)
    integer, intent(out) :: dir_from, dir_to
    integer, intent(in) :: rdr_dir
    integer, dimension(2) :: dirs

    dirs = findloc(rdr_map, rdr_dir)
    dir_from = dirs(1)
    dir_to = dirs(2)

  end subroutine

  pure integer function get_rdr_from_dirs(dir_from, dir_to) result(rdr_dir)
      !! Returns RDR_?2? value based on two direction inputs
    integer, intent(in) :: dir_from, dir_to

    rdr_dir = rdr_map(dir_from, dir_to)
  end function get_rdr_from_dirs

  function get_argument(pos) result(arg)
    integer, intent(in) :: pos
    character(:), allocatable :: arg

    character(len=200) :: temp
    integer :: stat

    call get_command_argument(pos, temp, status=stat)

    if (stat > 0) then
      error stop 'Argument retrieval failed!'
    else if (stat == -1) then
      error stop 'Argument is truncated!'
    end if

    arg = trim(temp)
  end function get_argument

  integer function move_data_loc(in_data_loc, dir, move) result(out_data_loc)
    integer, intent(in) :: in_data_loc, dir, move

    out_data_loc = in_data_loc + move*(10**dir)
  end function move_data_loc

end module m_common