polygon_in_mesh_m Module

Definition of polygon running within mesh


Uses


Contents


Interfaces

interface

  • public module subroutine init_polygon_in_mesh(self, equi, mesh, inds, dir_counterclockwise, dbgout)

    Initialises polygon in mesh

    Arguments

    Type IntentOptional Attributes Name
    class(polygon_in_mesh_t), intent(inout) :: self

    Instance of type

    class(equilibrium_t) :: equi

    Equilibrium

    type(mesh_cart_t), intent(in) :: mesh

    Mesh

    integer, intent(in), dimension(:) :: inds

    Indices (on mesh) of polygon

    logical, intent(in), optional :: dir_counterclockwise

    If true (=default) the direction of the polygons is set counter-clockwise otherwise it is clockwise

    integer, intent(in), optional :: dbgout

    Debug output level

interface

  • public module subroutine build_adjacency(self, mesh, nadj, adjacency)

    Returns adjacency for given point list Note: The polygon must be sufficiently uniquely defined, i.e. there must be not more than 2 candidates as adjacent points for any point

    Arguments

    Type IntentOptional Attributes Name
    class(polygon_in_mesh_t), intent(in) :: self

    Instance of type

    type(mesh_cart_t), intent(in) :: mesh

    Mesh

    integer, intent(out), dimension(self%np) :: nadj

    Number of adjacent points for given point

    integer, intent(out), dimension(self%np, 2) :: adjacency

    Adjacency information, i.e. indices (of polygon) of up to two adjacent points If value is zero, no adjacent point could be determined

interface

  • public module subroutine build_segmentation(self, nadj, kends)

    Determines segmentation of polygon, i.e. if polygon is closed, number of segments, end points of segments

    Arguments

    Type IntentOptional Attributes Name
    class(polygon_in_mesh_t), intent(inout) :: self

    Instance of type

    integer, intent(in), dimension(self%np) :: nadj

    Number of adjacent points for given point (from build_adjacency)

    integer, intent(out), allocatable, dimension(:) :: kends

    Polygon indices of end points of polygon segments

interface

  • public module subroutine build_ranking(self, nadj, adjacency, kends, rnk, np_segs)

    Builds ranking of polygon indices for sorting

    Arguments

    Type IntentOptional Attributes Name
    class(polygon_in_mesh_t), intent(inout) :: self

    Instance of type

    integer, intent(in), dimension(self%np) :: nadj

    Number of adjacent points for given point (from build_adjacency)

    integer, intent(in), dimension(self%np, 2) :: adjacency

    Adjacency information (from build_adjacency)

    integer, intent(in), dimension(2*self%nsegs) :: kends

    Polygon indices of end points of polygon segments. On succesfull return, will be sorted according to segments.

    integer, intent(out), dimension(self%np) :: rnk

    Ranking array, i.e. indices of polygon to sort

    integer, intent(out), dimension(self%nsegs) :: np_segs

    Number of points of segment

interface

  • public module subroutine execute_sort(self, rnk, np_segs)

    Executes sorting of indices based on given ranking

    Arguments

    Type IntentOptional Attributes Name
    class(polygon_in_mesh_t), intent(inout) :: self

    Instance of type

    integer, intent(in), dimension(self%np) :: rnk

    Ranking array (from build_ranking)

    integer, intent(in), dimension(self%nsegs) :: np_segs

    Number of points of segment (from build_ranking)

interface

  • public module subroutine direction_order(self, equi, mesh)

    Sorts polgon in co- or counter-clockwise order, depending on is_cc_wise For open segments, direction of each segment is defined w.r.t. magnetic axis

    Arguments

    Type IntentOptional Attributes Name
    class(polygon_in_mesh_t), intent(inout) :: self

    Instance of type

    class(equilibrium_t) :: equi

    Equilibrium

    type(mesh_cart_t), intent(in) :: mesh

    Mesh

interface

  • public module subroutine write_netcdf_polygon_in_mesh(self, fgid)

    Writes polygon_in_mesh to netcdf file

    Arguments

    Type IntentOptional Attributes Name
    class(polygon_in_mesh_t), intent(in) :: self

    Instance of the type

    integer, intent(in) :: fgid

    Netcdf file or group id

interface

  • public module subroutine read_netcdf_polygon_in_mesh(self, fgid)

    Reads polygon_in_mesh from netcdf file

    Arguments

    Type IntentOptional Attributes Name
    class(polygon_in_mesh_t), intent(inout) :: self

    Instance of the type

    integer, intent(in) :: fgid

    Netcdf file or group id

interface

  • public module subroutine destructor(self)

    Frees memory associated with polygon_in_mesh_t

    Arguments

    Type IntentOptional Attributes Name
    type(polygon_in_mesh_t), intent(inout) :: self

Derived Types

type, public ::  polygon_in_mesh_t

Datatype for polygon running on mesh points This can either be a single closed polygon, or any positive number of open polygon segments (but not both simultaneously). The polgon must be sufficiently well defined, such that only up to two adjacent points can be uniquely determined for each point.

Components

Type Visibility Attributes Name Initial
integer, public, allocatable, dimension(:) :: ki_seg

Index of initial point of polygon segment

Finalizations Procedures

final :: destructor

Type-Bound Procedures

procedure , public :: init => init_polygon_in_mesh Interface
procedure , public :: is_periodic Function
procedure , public :: get_np_total Function
procedure , public :: get_nsegs Function
procedure , public :: get_nps Function
procedure , public :: get_ind_on_mesh Function
procedure , public :: display => display_polygon_in_mesh Subroutine
procedure , public :: write_netcdf => write_netcdf_polygon_in_mesh Interface
procedure , public :: read_netcdf => read_netcdf_polygon_in_mesh Interface

Functions

public pure function is_periodic(self) result(res)

Returns tru if polygon is closed (periodic)

Arguments

Type IntentOptional Attributes Name
class(polygon_in_mesh_t), intent(in) :: self

Instance of the type

Return Value logical

public pure function get_np_total(self) result(res)

Returns total number of polygon points

Arguments

Type IntentOptional Attributes Name
class(polygon_in_mesh_t), intent(in) :: self

Instance of the type

Return Value integer

public pure function get_nsegs(self) result(res)

Returns number of segements

Arguments

Type IntentOptional Attributes Name
class(polygon_in_mesh_t), intent(in) :: self

Instance of the type

Return Value integer

public pure function get_nps(self, iseg) result(res)

Returns number of points of segment

Arguments

Type IntentOptional Attributes Name
class(polygon_in_mesh_t), intent(in) :: self

Instance of the type

integer, intent(in), optional :: iseg

Number of segment (default 1)

Return Value integer

public pure function get_ind_on_mesh(self, ks, iseg) result(res)

Returns mesh index of point of segement

Arguments

Type IntentOptional Attributes Name
class(polygon_in_mesh_t), intent(in) :: self

Instance of the type

integer, intent(in) :: ks

Index on segment For closed polygon this is treated periodically For open segments zero is returned

integer, intent(in), optional :: iseg

Number of segment (default 1)

Return Value integer


Subroutines

public subroutine display_polygon_in_mesh(self)

Displays information on polygon_in_mesh

Arguments

Type IntentOptional Attributes Name
class(polygon_in_mesh_t), intent(in) :: self

Instance of the type