Octopus
mesh_oct_m Module Reference

This module defines the meshes, which are used in Octopus. More...

Detailed Description

This module defines the meshes, which are used in Octopus.

Data Types

type  mesh_line_t
 This data type defines a line, and a regular grid defined on this line (or rather, on a portion of this line). NB: only works for 2D grids. More...
 
type  mesh_plane_t
 define a grid on a plane. More...
 
type  mesh_t
 Describes mesh distribution to nodes. More...
 

Functions/Subroutines

subroutine mesh_init (this)
 
subroutine, public mesh_double_box (space, mesh, alpha, db)
 finds the dimension of a box doubled in the non-periodic dimensions More...
 
subroutine, public mesh_write_info (this, iunit, namespace)
 
pure subroutine, public mesh_r (mesh, ip, rr, origin, coords)
 return the distance to the origin for a given grid point More...
 
subroutine mesh_r_global (mesh, ipg, rr, origin, coords)
 return the distance to the origin for a given grid point More...
 
integer function, public mesh_nearest_point (mesh, pos, dmin, rankmin)
 Returns the index of the point which is nearest to a given vector position pos. More...
 
subroutine, public mesh_discretize_values_to_mesh (mesh, values)
 Assign a set of values to their nearest discrete points on the mesh. More...
 
real(real64) function, public mesh_gcutoff (mesh)
 mesh_gcutoff returns the "natural" band limitation of the grid mesh, in terms of the maximum G vector. For a cubic regular grid, it is M_PI/spacing. More...
 
subroutine, public mesh_write_fingerprint (mesh, dir, filename, mpi_grp, namespace, ierr)
 
subroutine, public mesh_read_fingerprint (mesh, dir, filename, mpi_grp, namespace, read_np_part, read_np, bits, type, offset, nn, ierr)
 This function reads the fingerprint of a mesh written in filename. If the meshes are equal (same fingerprint) return values are 0, otherwise it returns the size of the mesh stored. fingerprint cannot be read, it returns ierr /= 0. More...
 
subroutine, public mesh_check_dump_compatibility (mesh, dir, filename, namespace, mpi_grp, grid_changed, grid_reordered, map, ierr)
 
recursive subroutine, public mesh_end (this)
 
integer(int64) function, public mesh_periodic_point (mesh, space, ip)
 This function returns the point inside the grid corresponding to a boundary point when PBCs are used. In case the point does not have a correspondence (i.e. other BCs are used in that direction), the same point is returned. Note that this function returns a global point number when parallelization in domains is used. More...
 
integer(int64) function, public mesh_periodic_point_global (mesh, space, ipg_in)
 
real(real64) pure function, public mesh_global_memory (mesh)
 
real(real64) pure function, public mesh_local_memory (mesh)
 
real(real64) function, dimension(1:mesh%box%dim), public mesh_x_global (mesh, ipg)
 Given a global point index, this function returns the coordinates of the point. More...
 
subroutine, public mesh_check_symmetries (mesh, symm, periodic_dim)
 
integer(int64) function, public mesh_global_index_from_coords (mesh, ix)
 This function returns the true global index of the point for a given vector of integer coordinates. More...
 
subroutine, public mesh_global_index_to_coords (mesh, ipg, ix)
 Given a global point index, this function returns the set of integer coordinates of the point. More...
 
integer function, public mesh_local_index_from_coords (mesh, ix)
 This function returns the local index of the point for a given vector of integer coordinates. More...
 
subroutine, public mesh_local_index_to_coords (mesh, ip, ix)
 Given a local point index, this function returns the set of integer coordinates of the point. More...
 
integer(int64) function, public mesh_local2global (mesh, ip)
 This function returns the global mesh index for a given local index. More...
 
integer function, public mesh_global2local (mesh, ipg)
 This function returns the local mesh index for a given global index. More...
 
subroutine, public mesh_minmaxloc (mesh, min_or_max, rank_min_or_max, op)
 Given a local min/max this returns the global min/max and the rank where this is located. More...
 
subroutine dmesh_allreduce_0 (mesh, aa)
 
subroutine dmesh_allreduce_1 (mesh, aa, dim)
 
subroutine dmesh_allreduce_2 (mesh, aa, dim)
 
subroutine dmesh_allreduce_3 (mesh, aa, dim)
 
subroutine dmesh_allreduce_4 (mesh, aa)
 
subroutine dmesh_allreduce_5 (mesh, aa)
 
subroutine dmesh_allreduce_6 (mesh, aa)
 
subroutine zmesh_allreduce_0 (mesh, aa)
 
subroutine zmesh_allreduce_1 (mesh, aa, dim)
 
subroutine zmesh_allreduce_2 (mesh, aa, dim)
 
subroutine zmesh_allreduce_3 (mesh, aa, dim)
 
subroutine zmesh_allreduce_4 (mesh, aa)
 
subroutine zmesh_allreduce_5 (mesh, aa)
 
subroutine zmesh_allreduce_6 (mesh, aa)
 
subroutine imesh_allreduce_0 (mesh, aa)
 
subroutine imesh_allreduce_1 (mesh, aa, dim)
 
subroutine imesh_allreduce_2 (mesh, aa, dim)
 
subroutine imesh_allreduce_3 (mesh, aa, dim)
 
subroutine imesh_allreduce_4 (mesh, aa)
 
subroutine imesh_allreduce_5 (mesh, aa)
 
subroutine imesh_allreduce_6 (mesh, aa)
 
subroutine lmesh_allreduce_0 (mesh, aa)
 
subroutine lmesh_allreduce_1 (mesh, aa, dim)
 
subroutine lmesh_allreduce_2 (mesh, aa, dim)
 
subroutine lmesh_allreduce_3 (mesh, aa, dim)
 
subroutine lmesh_allreduce_4 (mesh, aa)
 
subroutine lmesh_allreduce_5 (mesh, aa)
 
subroutine lmesh_allreduce_6 (mesh, aa)
 

Function/Subroutine Documentation

◆ mesh_init()

subroutine mesh_oct_m::mesh_init ( class(mesh_t), intent(inout)  this)
private

Definition at line 272 of file mesh.F90.

◆ mesh_double_box()

subroutine, public mesh_oct_m::mesh_double_box ( class(space_t), intent(in)  space,
type(mesh_t), intent(in)  mesh,
real(real64), intent(in)  alpha,
integer, dimension(:), intent(out)  db 
)

finds the dimension of a box doubled in the non-periodic dimensions

Parameters
[in]alphaenlargement factor for double box

Definition at line 284 of file mesh.F90.

◆ mesh_write_info()

subroutine, public mesh_oct_m::mesh_write_info ( class(mesh_t), intent(in)  this,
integer, intent(in), optional  iunit,
type(namespace_t), intent(in), optional  namespace 
)

Definition at line 309 of file mesh.F90.

◆ mesh_r()

pure subroutine, public mesh_oct_m::mesh_r ( class(mesh_t), intent(in)  mesh,
integer, intent(in)  ip,
real(real64), intent(out)  rr,
real(real64), dimension(:), intent(in), optional  origin,
real(real64), dimension(:), intent(out), optional  coords 
)

return the distance to the origin for a given grid point

Parameters
[in]ippoint index
[out]rrdistance with respect to the origin as given by the next parameter
[in]originorigin(sbdim), default (0,0,0)
[out]coordscoords(sbdim), optional output of shifted coordinates

Definition at line 341 of file mesh.F90.

◆ mesh_r_global()

subroutine mesh_oct_m::mesh_r_global ( class(mesh_t), intent(in)  mesh,
integer(int64), intent(in)  ipg,
real(real64), intent(out)  rr,
real(real64), dimension(:), intent(in), optional  origin,
real(real64), dimension(:), intent(out), optional  coords 
)
private

return the distance to the origin for a given grid point

Parameters
[in]ipgglobal point index
[out]rrdistance with respect to the origin as given by the next parameter
[in]originorigin(sbdim), default (0,0,0)
[out]coordscoords(sbdim), optional output of shifted coordinates

Definition at line 361 of file mesh.F90.

◆ mesh_nearest_point()

integer function, public mesh_oct_m::mesh_nearest_point ( class(mesh_t), intent(in)  mesh,
real(real64), dimension(:), intent(in)  pos,
real(real64), intent(out)  dmin,
integer, intent(out)  rankmin 
)

Returns the index of the point which is nearest to a given vector position pos.

Returns the index of the point, ind. This index is domain-specific, and is only meaningful rankmin.

Parameters
[in]posPosition vector
[out]dminDistance between pos and this nearest mesh point
[out]rankminRank of the processor that holds the point

Definition at line 385 of file mesh.F90.

◆ mesh_discretize_values_to_mesh()

subroutine, public mesh_oct_m::mesh_discretize_values_to_mesh ( class(mesh_t), intent(in)  mesh,
real(real64), dimension(:, :), intent(inout)  values 
)

Assign a set of values to their nearest discrete points on the mesh.

Parameters
[in]meshmesh instance
[in,out]valuesIn: Values of shape(dim, nvalues)

Definition at line 415 of file mesh.F90.

◆ mesh_gcutoff()

real(real64) function, public mesh_oct_m::mesh_gcutoff ( class(mesh_t), intent(in)  mesh)

mesh_gcutoff returns the "natural" band limitation of the grid mesh, in terms of the maximum G vector. For a cubic regular grid, it is M_PI/spacing.

Definition at line 449 of file mesh.F90.

◆ mesh_write_fingerprint()

subroutine, public mesh_oct_m::mesh_write_fingerprint ( type(mesh_t), intent(in)  mesh,
character(len=*), intent(in)  dir,
character(len=*), intent(in)  filename,
type(mpi_grp_t), intent(in)  mpi_grp,
type(namespace_t), intent(in)  namespace,
integer, intent(out)  ierr 
)

Definition at line 459 of file mesh.F90.

◆ mesh_read_fingerprint()

subroutine, public mesh_oct_m::mesh_read_fingerprint ( type(mesh_t), intent(in)  mesh,
character(len=*), intent(in)  dir,
character(len=*), intent(in)  filename,
type(mpi_grp_t), intent(in)  mpi_grp,
type(namespace_t), intent(in)  namespace,
integer(int64), intent(out)  read_np_part,
integer(int64), intent(out)  read_np,
integer, intent(out)  bits,
integer, intent(out)  type,
integer, dimension(1:mesh%idx%dim), intent(out)  offset,
integer, dimension(1:mesh%idx%dim), intent(out)  nn,
integer, intent(out)  ierr 
)

This function reads the fingerprint of a mesh written in filename. If the meshes are equal (same fingerprint) return values are 0, otherwise it returns the size of the mesh stored. fingerprint cannot be read, it returns ierr /= 0.

Definition at line 507 of file mesh.F90.

◆ mesh_check_dump_compatibility()

subroutine, public mesh_oct_m::mesh_check_dump_compatibility ( type(mesh_t), intent(in)  mesh,
character(len=*), intent(in)  dir,
character(len=*), intent(in)  filename,
type(namespace_t), intent(in)  namespace,
type(mpi_grp_t), intent(in)  mpi_grp,
logical, intent(out)  grid_changed,
logical, intent(out)  grid_reordered,
integer(int64), dimension(:), intent(out), allocatable  map,
integer, intent(out)  ierr 
)

Definition at line 595 of file mesh.F90.

◆ mesh_end()

recursive subroutine, public mesh_oct_m::mesh_end ( class(mesh_t), intent(inout)  this)

Definition at line 685 of file mesh.F90.

◆ mesh_periodic_point()

integer(int64) function, public mesh_oct_m::mesh_periodic_point ( class(mesh_t), intent(in)  mesh,
class(space_t), intent(in)  space,
integer, intent(in)  ip 
)

This function returns the point inside the grid corresponding to a boundary point when PBCs are used. In case the point does not have a correspondence (i.e. other BCs are used in that direction), the same point is returned. Note that this function returns a global point number when parallelization in domains is used.

Parameters
[in]iplocal point for which periodic copy is searched

Definition at line 723 of file mesh.F90.

◆ mesh_periodic_point_global()

integer(int64) function, public mesh_oct_m::mesh_periodic_point_global ( class(mesh_t), intent(in)  mesh,
class(space_t), intent(in)  space,
integer(int64), intent(in)  ipg_in 
)
Parameters
[in]ipg_inlocal point for which periodic copy is searched

Definition at line 757 of file mesh.F90.

◆ mesh_global_memory()

real(real64) pure function, public mesh_oct_m::mesh_global_memory ( class(mesh_t), intent(in)  mesh)

Definition at line 790 of file mesh.F90.

◆ mesh_local_memory()

real(real64) pure function, public mesh_oct_m::mesh_local_memory ( class(mesh_t), intent(in)  mesh)

Definition at line 801 of file mesh.F90.

◆ mesh_x_global()

real(real64) function, dimension(1:mesh%box%dim), public mesh_oct_m::mesh_x_global ( class(mesh_t), intent(in)  mesh,
integer(int64), intent(in)  ipg 
)

Given a global point index, this function returns the coordinates of the point.

Definition at line 816 of file mesh.F90.

◆ mesh_check_symmetries()

subroutine, public mesh_oct_m::mesh_check_symmetries ( class(mesh_t), intent(in)  mesh,
type(symmetries_t), intent(in)  symm,
integer, intent(in)  periodic_dim 
)

Definition at line 834 of file mesh.F90.

◆ mesh_global_index_from_coords()

integer(int64) function, public mesh_oct_m::mesh_global_index_from_coords ( class(mesh_t), intent(in)  mesh,
integer, dimension(:), intent(in)  ix 
)

This function returns the true global index of the point for a given vector of integer coordinates.

Definition at line 918 of file mesh.F90.

◆ mesh_global_index_to_coords()

subroutine, public mesh_oct_m::mesh_global_index_to_coords ( type(mesh_t), intent(in)  mesh,
integer(int64), intent(in)  ipg,
integer, dimension(:), intent(out)  ix 
)

Given a global point index, this function returns the set of integer coordinates of the point.

Definition at line 927 of file mesh.F90.

◆ mesh_local_index_from_coords()

integer function, public mesh_oct_m::mesh_local_index_from_coords ( type(mesh_t), intent(in)  mesh,
integer, dimension(:), intent(in)  ix 
)

This function returns the local index of the point for a given vector of integer coordinates.

Definition at line 937 of file mesh.F90.

◆ mesh_local_index_to_coords()

subroutine, public mesh_oct_m::mesh_local_index_to_coords ( type(mesh_t), intent(in)  mesh,
integer, intent(in)  ip,
integer, dimension(:), intent(out)  ix 
)

Given a local point index, this function returns the set of integer coordinates of the point.

Definition at line 949 of file mesh.F90.

◆ mesh_local2global()

integer(int64) function, public mesh_oct_m::mesh_local2global ( type(mesh_t), intent(in)  mesh,
integer, intent(in)  ip 
)

This function returns the global mesh index for a given local index.

Definition at line 961 of file mesh.F90.

◆ mesh_global2local()

integer function, public mesh_oct_m::mesh_global2local ( type(mesh_t), intent(in)  mesh,
integer(int64), intent(in)  ipg 
)

This function returns the local mesh index for a given global index.

If ip < 1 or ip > np, the point is not available on the local process

Definition at line 971 of file mesh.F90.

◆ mesh_minmaxloc()

subroutine, public mesh_oct_m::mesh_minmaxloc ( type(mesh_t), intent(in)  mesh,
real(real64), intent(inout)  min_or_max,
integer, intent(out)  rank_min_or_max,
type(mpi_op), intent(in)  op 
)

Given a local min/max this returns the global min/max and the rank where this is located.

Parameters
[in,out]min_or_maxOn entry, the local value, on exit the global value
[out]rank_min_or_maxOn exit, the rank where the min/max is located
[in]opMPI_MINLOC or MPI_MAXLOC

Definition at line 980 of file mesh.F90.

◆ dmesh_allreduce_0()

subroutine mesh_oct_m::dmesh_allreduce_0 ( class(mesh_t), intent(in)  mesh,
real(real64), intent(inout)  aa 
)
private

Definition at line 1073 of file mesh.F90.

◆ dmesh_allreduce_1()

subroutine mesh_oct_m::dmesh_allreduce_1 ( class(mesh_t), intent(in)  mesh,
real(real64), dimension(:), intent(inout), contiguous  aa,
integer, intent(in), optional  dim 
)
private

Definition at line 1081 of file mesh.F90.

◆ dmesh_allreduce_2()

subroutine mesh_oct_m::dmesh_allreduce_2 ( class(mesh_t), intent(in)  mesh,
real(real64), dimension(:, :), intent(inout), contiguous  aa,
integer, dimension(:), intent(in), optional  dim 
)
private
Parameters
[in]dim(2)

Definition at line 1090 of file mesh.F90.

◆ dmesh_allreduce_3()

subroutine mesh_oct_m::dmesh_allreduce_3 ( class(mesh_t), intent(in)  mesh,
real(real64), dimension(:, :, :), intent(inout), contiguous  aa,
integer, dimension(:), intent(in), optional  dim 
)
private
Parameters
[in]dim(3)

Definition at line 1099 of file mesh.F90.

◆ dmesh_allreduce_4()

subroutine mesh_oct_m::dmesh_allreduce_4 ( class(mesh_t), intent(in)  mesh,
real(real64), dimension(:, :, :, :), intent(inout), contiguous  aa 
)
private

Definition at line 1108 of file mesh.F90.

◆ dmesh_allreduce_5()

subroutine mesh_oct_m::dmesh_allreduce_5 ( class(mesh_t), intent(in)  mesh,
real(real64), dimension(:, :, :, :, :), intent(inout), contiguous  aa 
)
private

Definition at line 1116 of file mesh.F90.

◆ dmesh_allreduce_6()

subroutine mesh_oct_m::dmesh_allreduce_6 ( class(mesh_t), intent(in)  mesh,
real(real64), dimension(:, :, :, :, :, :), intent(inout), contiguous  aa 
)
private

Definition at line 1124 of file mesh.F90.

◆ zmesh_allreduce_0()

subroutine mesh_oct_m::zmesh_allreduce_0 ( class(mesh_t), intent(in)  mesh,
complex(real64), intent(inout)  aa 
)
private

Definition at line 1205 of file mesh.F90.

◆ zmesh_allreduce_1()

subroutine mesh_oct_m::zmesh_allreduce_1 ( class(mesh_t), intent(in)  mesh,
complex(real64), dimension(:), intent(inout), contiguous  aa,
integer, intent(in), optional  dim 
)
private

Definition at line 1213 of file mesh.F90.

◆ zmesh_allreduce_2()

subroutine mesh_oct_m::zmesh_allreduce_2 ( class(mesh_t), intent(in)  mesh,
complex(real64), dimension(:, :), intent(inout), contiguous  aa,
integer, dimension(:), intent(in), optional  dim 
)
private
Parameters
[in]dim(2)

Definition at line 1222 of file mesh.F90.

◆ zmesh_allreduce_3()

subroutine mesh_oct_m::zmesh_allreduce_3 ( class(mesh_t), intent(in)  mesh,
complex(real64), dimension(:, :, :), intent(inout), contiguous  aa,
integer, dimension(:), intent(in), optional  dim 
)
private
Parameters
[in]dim(3)

Definition at line 1231 of file mesh.F90.

◆ zmesh_allreduce_4()

subroutine mesh_oct_m::zmesh_allreduce_4 ( class(mesh_t), intent(in)  mesh,
complex(real64), dimension(:, :, :, :), intent(inout), contiguous  aa 
)
private

Definition at line 1240 of file mesh.F90.

◆ zmesh_allreduce_5()

subroutine mesh_oct_m::zmesh_allreduce_5 ( class(mesh_t), intent(in)  mesh,
complex(real64), dimension(:, :, :, :, :), intent(inout), contiguous  aa 
)
private

Definition at line 1248 of file mesh.F90.

◆ zmesh_allreduce_6()

subroutine mesh_oct_m::zmesh_allreduce_6 ( class(mesh_t), intent(in)  mesh,
complex(real64), dimension(:, :, :, :, :, :), intent(inout), contiguous  aa 
)
private

Definition at line 1256 of file mesh.F90.

◆ imesh_allreduce_0()

subroutine mesh_oct_m::imesh_allreduce_0 ( class(mesh_t), intent(in)  mesh,
integer, intent(inout)  aa 
)
private

Definition at line 1337 of file mesh.F90.

◆ imesh_allreduce_1()

subroutine mesh_oct_m::imesh_allreduce_1 ( class(mesh_t), intent(in)  mesh,
integer, dimension(:), intent(inout), contiguous  aa,
integer, intent(in), optional  dim 
)
private

Definition at line 1345 of file mesh.F90.

◆ imesh_allreduce_2()

subroutine mesh_oct_m::imesh_allreduce_2 ( class(mesh_t), intent(in)  mesh,
integer, dimension(:, :), intent(inout), contiguous  aa,
integer, dimension(:), intent(in), optional  dim 
)
private
Parameters
[in]dim(2)

Definition at line 1354 of file mesh.F90.

◆ imesh_allreduce_3()

subroutine mesh_oct_m::imesh_allreduce_3 ( class(mesh_t), intent(in)  mesh,
integer, dimension(:, :, :), intent(inout), contiguous  aa,
integer, dimension(:), intent(in), optional  dim 
)
private
Parameters
[in]dim(3)

Definition at line 1363 of file mesh.F90.

◆ imesh_allreduce_4()

subroutine mesh_oct_m::imesh_allreduce_4 ( class(mesh_t), intent(in)  mesh,
integer, dimension(:, :, :, :), intent(inout), contiguous  aa 
)
private

Definition at line 1372 of file mesh.F90.

◆ imesh_allreduce_5()

subroutine mesh_oct_m::imesh_allreduce_5 ( class(mesh_t), intent(in)  mesh,
integer, dimension(:, :, :, :, :), intent(inout), contiguous  aa 
)
private

Definition at line 1380 of file mesh.F90.

◆ imesh_allreduce_6()

subroutine mesh_oct_m::imesh_allreduce_6 ( class(mesh_t), intent(in)  mesh,
integer, dimension(:, :, :, :, :, :), intent(inout), contiguous  aa 
)
private

Definition at line 1388 of file mesh.F90.

◆ lmesh_allreduce_0()

subroutine mesh_oct_m::lmesh_allreduce_0 ( class(mesh_t), intent(in)  mesh,
integer(int64), intent(inout)  aa 
)
private

Definition at line 1470 of file mesh.F90.

◆ lmesh_allreduce_1()

subroutine mesh_oct_m::lmesh_allreduce_1 ( class(mesh_t), intent(in)  mesh,
integer(int64), dimension(:), intent(inout), contiguous  aa,
integer, intent(in), optional  dim 
)
private

Definition at line 1478 of file mesh.F90.

◆ lmesh_allreduce_2()

subroutine mesh_oct_m::lmesh_allreduce_2 ( class(mesh_t), intent(in)  mesh,
integer(int64), dimension(:, :), intent(inout), contiguous  aa,
integer, dimension(:), intent(in), optional  dim 
)
private
Parameters
[in]dim(2)

Definition at line 1487 of file mesh.F90.

◆ lmesh_allreduce_3()

subroutine mesh_oct_m::lmesh_allreduce_3 ( class(mesh_t), intent(in)  mesh,
integer(int64), dimension(:, :, :), intent(inout), contiguous  aa,
integer, dimension(:), intent(in), optional  dim 
)
private
Parameters
[in]dim(3)

Definition at line 1496 of file mesh.F90.

◆ lmesh_allreduce_4()

subroutine mesh_oct_m::lmesh_allreduce_4 ( class(mesh_t), intent(in)  mesh,
integer(int64), dimension(:, :, :, :), intent(inout), contiguous  aa 
)
private

Definition at line 1505 of file mesh.F90.

◆ lmesh_allreduce_5()

subroutine mesh_oct_m::lmesh_allreduce_5 ( class(mesh_t), intent(in)  mesh,
integer(int64), dimension(:, :, :, :, :), intent(inout), contiguous  aa 
)
private

Definition at line 1513 of file mesh.F90.

◆ lmesh_allreduce_6()

subroutine mesh_oct_m::lmesh_allreduce_6 ( class(mesh_t), intent(in)  mesh,
integer(int64), dimension(:, :, :, :, :, :), intent(inout), contiguous  aa 
)
private

Definition at line 1521 of file mesh.F90.