1 #ifndef FIELD_DECOMPOSITION_HPP
2 #define FIELD_DECOMPOSITION_HPP
11 template<
class Device>
76 exit_XGC(
"\nError in field_decomposition: n_ranks must be divisible by n_phi_domains");
81 exit_XGC(
"\nError in field_decomposition: n_phi_domains must divide evenly into nplanes");
84 exit_XGC(
"\nError in field_decomposition: total XGC ranks must be divisible by field_decomp_param n_ranks");
93 int first_owned_node_r = nodes_per_pol_domain*i_pol;
94 int n_owned_nodes_r = (i_pol==
n_pol_domains-1 ? (nnodes - first_owned_node_r) : nodes_per_pol_domain);
96 int first_owned_plane_r = nodes_per_phi_domain*i_phi;
97 int n_owned_planes_r = (i_phi==
n_phi_domains-1 ? (nplanes - first_owned_plane_r) : nodes_per_phi_domain);
111 printf(
"\nall_first_plane(%d) = (first_owned_plane_r - n_ghost_planes)modnplanes = (%d - %d)mod %d = %d \n", i, first_owned_plane_r,
n_ghost_planes, nplanes,
all_first_plane(i));
136 KOKKOS_INLINE_FUNCTION
int find_domain_owner(
int global_plane_index,
int nplanes_total,
int global_node_index,
int nnodes_total)
const{
139 int intpl_pid = global_plane_index/planes_per_phi_domain;
143 int plane_pid = global_node_index/n_vertices_per_pol_domain;
Definition: field_decomposition.hpp:12
FieldDecomposition()
Definition: field_decomposition.hpp:46
int n_pol_domains
Number of domains in the poloidal plane.
Definition: field_decomposition.hpp:23
int first_owned_plane
First plane belonging to this rank, NOT including ghost planes.
Definition: field_decomposition.hpp:29
int n_ghost_planes
Number of ghost planes on each side of domain.
Definition: field_decomposition.hpp:24
View< int *, CLayout, HostType > all_last_node
Last node of each rank.
Definition: field_decomposition.hpp:42
int n_ranks
Number of ranks the field will be divided between.
Definition: field_decomposition.hpp:21
int last_node
Last node belonging to this rank, including ghost nodes.
Definition: field_decomposition.hpp:33
int n_planes
Number of planes belonging to this rank, including ghost planes.
Definition: field_decomposition.hpp:37
View< int *, CLayout, HostType > all_last_plane
Last plane of each rank.
Definition: field_decomposition.hpp:44
int n_ghost_vertices
Number of ghost vertices on each side of domain.
Definition: field_decomposition.hpp:25
int nplanes_owned
Number of planes belonging to this rank, NOT including ghost planes.
Definition: field_decomposition.hpp:30
int first_plane
First plane belonging to this rank, including ghost planes.
Definition: field_decomposition.hpp:35
View< int *, CLayout, HostType > all_first_node
First node of each rank.
Definition: field_decomposition.hpp:41
int n_nodes
Number of nodes belonging to this rank, including ghost nodes.
Definition: field_decomposition.hpp:34
int first_node
First mesh node belonging to this rank, including ghost nodes.
Definition: field_decomposition.hpp:32
View< int *, CLayout, HostType > all_first_plane
First plane of each rank.
Definition: field_decomposition.hpp:43
int n_phi_domains
Number of domains in the phi direction.
Definition: field_decomposition.hpp:22
int last_plane
Last plane belonging to this rank, including ghost planes.
Definition: field_decomposition.hpp:36
int first_owned_node
First mesh node belonging to this rank, NOT including ghost nodes.
Definition: field_decomposition.hpp:27
FieldDecomposition(NLReader::NamelistReader &nlr, int nplanes, int nnodes)
Definition: field_decomposition.hpp:49
View< int *, CLayout, HostType > map_from_global_intpl
Rank in this communicator for each rank global intpl.
Definition: field_decomposition.hpp:40
int nnodes_owned
Number of nodes belonging to this rank, NOT including ghost nodes.
Definition: field_decomposition.hpp:28
KOKKOS_INLINE_FUNCTION int find_domain_owner(int global_plane_index, int nplanes_total, int global_node_index, int nnodes_total) const
Definition: field_decomposition.hpp:136
int all_n_nodes(int local_pid) const
Definition: field_decomposition.hpp:149
int all_n_planes(int local_pid, int nplanes) const
Definition: field_decomposition.hpp:153
Definition: NamelistReader.hpp:193
T get(const string ¶m, const T default_val, int val_ind=0)
Definition: NamelistReader.hpp:386
void use_namelist(const string &namelist, Options required=Required)
Definition: NamelistReader.hpp:360
void exit_XGC(std::string msg)
Definition: globals.hpp:37
KOKKOS_INLINE_FUNCTION unsigned positive_modulo(int value, unsigned m)
Definition: globals.hpp:231
int SML_COMM_RANK
Definition: my_mpi.cpp:5
MPI_Comm SML_COMM_WORLD
Definition: my_mpi.cpp:4
Definition: my_mpi.hpp:19
int nranks
Definition: my_mpi.hpp:23
int my_rank
Definition: my_mpi.hpp:24