Octopus
centroids_oct_m Module Reference

Data Types

type  centroids_t
 Encapsulate centroid points and their indexing across a domain-decomposed mesh. More...
 

Functions/Subroutines

subroutine centroids_init (this, mesh, positions, check_duplicates)
 Initialise a centroids_t instance. More...
 
subroutine centroids_init_from_file (this, mesh, fname, check_duplicates)
 Initialise a centroids_t instance from grid points in file. More...
 
pure integer function centroids_get_n_centroids (this)
 Number of centroids in local domain. More...
 
pure integer function centroids_get_n_centroids_global (this)
 Total number of centroids in system. More...
 
pure integer(int64) function centroids_global_centroid_to_global_mesh_index (this, ic)
 Given centroid index ic, return the global mesh index ipg. More...
 
pure integer(int64) function, dimension(:), allocatable centroids_global_centroid_to_global_mesh_indices (this)
 Return global mesh indices for all centroids in this domain. More...
 
pure integer function centroids_get_local_mesh_index (this, ic)
 Get the mesh index ip of centroid ic in this domain. More...
 
pure integer function, dimension(:), allocatable centroids_get_local_mesh_indices (this)
 Return mesh indices ip for all centroids in this domain. More...
 
pure integer function centroids_local_index_to_global_index (this, ic)
 Get the global centroid index, given centroid ic this domain. More...
 
pure integer function, dimension(:), allocatable centroids_local_index_to_global_indices (this)
 Return global centroid indices for all centroids in this domain. More...
 
pure real(real64) function, dimension(this%ndim) centroids_get_local_position (this, mesh, ic)
 Get the position of the centroid ic. More...
 
pure real(real64) function, dimension(:, :), allocatable centroids_get_all_positions (this)
 Return a copy of all centroid positions. More...
 
subroutine centroids_output_all_indices (this, namespace, grp, fname)
 Output all centroid indices, across all domains. More...
 
subroutine, public centroids_read_all_indices (grp, fname, n_centroids_global, icg_to_ipg)
 Read all centroid indices from a file written using centroids_output_all_indices. More...
 
subroutine centroids_end (this)
 Type-bound routine to manually deallocate a centroids instance. More...
 
subroutine centroids_finalize (this)
 Finalize a centroids instance. More...
 
subroutine convert_coordinates_to_global_indices (this, mesh)
 Convert coordinates to the mesh global index. More...
 
subroutine convert_global_indices_to_coordinates (this, mesh)
 Convert mesh global index to coordinates. More...
 
subroutine exact_centroids_init_index_maps (this, mesh, check_duplicates)
 Initialise index maps with centroid points that are commensurate with the grid. More...
 
subroutine remove_duplicates_int64 (indices)
 Remove duplicates from an array of integers. More...
 

Function/Subroutine Documentation

◆ centroids_init()

subroutine centroids_oct_m::centroids_init ( class(centroids_t), intent(out)  this,
class(mesh_t), intent(in)  mesh,
real(real64), dimension(:, :), intent(in)  positions,
logical, intent(in), optional  check_duplicates 
)
private

Initialise a centroids_t instance.

Centroid positions must correspond to grid points.

Parameters
[out]thisCentroid instance
[in]meshMesh or grid instance
[in]positionsAll centroid cartesian positions
[in]check_duplicatesCheck for duplicate grid indices,

Definition at line 201 of file centroids.F90.

◆ centroids_init_from_file()

subroutine centroids_oct_m::centroids_init_from_file ( class(centroids_t), intent(out)  this,
class(mesh_t), intent(in)  mesh,
character(len=*), intent(in)  fname,
logical, intent(in), optional  check_duplicates 
)
private

Initialise a centroids_t instance from grid points in file.

Parameters
[out]thisCentroid instance
[in]meshMesh or grid instance
[in]fnamefile name, prefixed with directory
[in]check_duplicatesCheck for duplicate grid indices,

Definition at line 222 of file centroids.F90.

◆ centroids_get_n_centroids()

pure integer function centroids_oct_m::centroids_get_n_centroids ( class(centroids_t), intent(in)  this)
private

Number of centroids in local domain.

Definition at line 242 of file centroids.F90.

◆ centroids_get_n_centroids_global()

pure integer function centroids_oct_m::centroids_get_n_centroids_global ( class(centroids_t), intent(in)  this)
private

Total number of centroids in system.

Definition at line 252 of file centroids.F90.

◆ centroids_global_centroid_to_global_mesh_index()

pure integer(int64) function centroids_oct_m::centroids_global_centroid_to_global_mesh_index ( class(centroids_t), intent(in)  this,
integer, intent(in)  ic 
)
private

Given centroid index ic, return the global mesh index ipg.

Note
One could alternatively implement this with:
ip = this%ic_to_ip(ic)
ipg = mesh_local2global(mesh, ip)
which would remove the need to store icg_to_ipg, but this would require mesh to be an argument of the function.

Definition at line 271 of file centroids.F90.

◆ centroids_global_centroid_to_global_mesh_indices()

pure integer(int64) function, dimension(:), allocatable centroids_oct_m::centroids_global_centroid_to_global_mesh_indices ( class(centroids_t), intent(in)  this)
private

Return global mesh indices for all centroids in this domain.

Definition at line 284 of file centroids.F90.

◆ centroids_get_local_mesh_index()

pure integer function centroids_oct_m::centroids_get_local_mesh_index ( class(centroids_t), intent(in)  this,
integer, intent(in)  ic 
)
private

Get the mesh index ip of centroid ic in this domain.

Definition at line 300 of file centroids.F90.

◆ centroids_get_local_mesh_indices()

pure integer function, dimension(:), allocatable centroids_oct_m::centroids_get_local_mesh_indices ( class(centroids_t), intent(in)  this)
private

Return mesh indices ip for all centroids in this domain.

Definition at line 311 of file centroids.F90.

◆ centroids_local_index_to_global_index()

pure integer function centroids_oct_m::centroids_local_index_to_global_index ( class(centroids_t), intent(in)  this,
integer, intent(in)  ic 
)
private

Get the global centroid index, given centroid ic this domain.

Definition at line 321 of file centroids.F90.

◆ centroids_local_index_to_global_indices()

pure integer function, dimension(:), allocatable centroids_oct_m::centroids_local_index_to_global_indices ( class(centroids_t), intent(in)  this)
private

Return global centroid indices for all centroids in this domain.

Definition at line 332 of file centroids.F90.

◆ centroids_get_local_position()

pure real(real64) function, dimension(this%ndim) centroids_oct_m::centroids_get_local_position ( class(centroids_t), intent(in)  this,
class(mesh_t), intent(in)  mesh,
integer, intent(in)  ic 
)
private

Get the position of the centroid ic.

Definition at line 342 of file centroids.F90.

◆ centroids_get_all_positions()

pure real(real64) function, dimension(:, :), allocatable centroids_oct_m::centroids_get_all_positions ( class(centroids_t), intent(in)  this)
private

Return a copy of all centroid positions.

Definition at line 355 of file centroids.F90.

◆ centroids_output_all_indices()

subroutine centroids_oct_m::centroids_output_all_indices ( class(centroids_t), intent(in)  this,
type(namespace_t), intent(in)  namespace,
type(mpi_grp_t), intent(in)  grp,
character(len=*), intent(in)  fname 
)
private

Output all centroid indices, across all domains.

Parameters
[in]thisCentroid instance
[in]grpMPI group performing write
[in]fnameFile name

Definition at line 365 of file centroids.F90.

◆ centroids_read_all_indices()

subroutine, public centroids_oct_m::centroids_read_all_indices ( type(mpi_grp_t), intent(in)  grp,
character(len=*), intent(in)  fname,
integer, intent(out)  n_centroids_global,
integer(int64), dimension(:), intent(out), allocatable  icg_to_ipg 
)

Read all centroid indices from a file written using centroids_output_all_indices.

Parameters
[in]grpMPI group performing read
[in]fnamefile name, prefixed with directory
[out]n_centroids_globalTotal number of centroids
[out]icg_to_ipgMap of global centroid indices

Definition at line 395 of file centroids.F90.

◆ centroids_end()

subroutine centroids_oct_m::centroids_end ( class(centroids_t), intent(inout)  this)
private

Type-bound routine to manually deallocate a centroids instance.

Parameters
[in,out]thisCentroid instance

Definition at line 430 of file centroids.F90.

◆ centroids_finalize()

subroutine centroids_oct_m::centroids_finalize ( type(centroids_t), intent(inout)  this)
private

Finalize a centroids instance.

Parameters
[in,out]thisCentroid instance

Definition at line 446 of file centroids.F90.

◆ convert_coordinates_to_global_indices()

subroutine centroids_oct_m::convert_coordinates_to_global_indices ( type(centroids_t), intent(inout)  this,
class(mesh_t), intent(in)  mesh 
)
private

Convert coordinates to the mesh global index.

Parameters
[in]meshMesh or grid instance

Definition at line 459 of file centroids.F90.

◆ convert_global_indices_to_coordinates()

subroutine centroids_oct_m::convert_global_indices_to_coordinates ( type(centroids_t), intent(inout)  this,
class(mesh_t), intent(in)  mesh 
)
private

Convert mesh global index to coordinates.

Parameters
[in]meshMesh or grid instance

Definition at line 486 of file centroids.F90.

◆ exact_centroids_init_index_maps()

subroutine centroids_oct_m::exact_centroids_init_index_maps ( type(centroids_t), intent(inout)  this,
class(mesh_t), intent(in)  mesh,
logical, intent(in)  check_duplicates 
)
private

Initialise index maps with centroid points that are commensurate with the grid.

This routine computes:

  • Map of the global centroid index icg to centroid index in domain associated with process
  • Map of the centroid index ic in domain process, to mesh index ip in the same domain
  • Sets the number of centroids in the domain of process
    Parameters
    [in]meshMesh or grid instance
    [in]check_duplicatesCheck for duplicate grid indices,

Definition at line 514 of file centroids.F90.

◆ remove_duplicates_int64()

subroutine centroids_oct_m::remove_duplicates_int64 ( integer(int64), dimension(:), intent(inout), allocatable  indices)
private

Remove duplicates from an array of integers.

Parameters
[in,out]indicesIn: Set of indices

Definition at line 575 of file centroids.F90.