13#include "../data/allvars.h"
18#include "../data/dtypes.h"
19#include "../mpi_utils/setcomm.h"
28template <
typename partset>
47 typedef typename partset::pdata
pdata;
90 struct local_topnode_data
100 struct domain_peano_hilbert_data
106 struct domain_cost_data
111 struct domain_count_data
118 struct domain_segments_data
120 int task, start, end, used;
129 domain_cost_data *domain_leaf_cost;
131 local_topnode_data *topNodes;
135 int NumTimeBinsToBeBalanced;
136 int ListOfTimeBinsToBeBalanced[
TIMEBINS];
137 double GravCostPerListedTimeBin[
TIMEBINS];
138 double MaxGravCostPerListedTimeBin[
TIMEBINS];
139 double GravCostNormFactors[
TIMEBINS];
140 double HydroCostPerListedTimeBin[
TIMEBINS];
141 double HydroCostNormFactors[
TIMEBINS];
142 double NormFactorLoad;
143 double NormFactorLoadSph;
148 int domain_to_be_balanced[
TIMEBINS];
150 void domain_find_total_cost(
void);
151 void domain_report_balance(
void);
152 void domain_combine_multipledomains(
void);
153 void domain_init_sum_cost(
void);
154 void domain_countToGo(
int *toGoDM,
int *toGoSph);
155 void domain_exchange(
void);
156 void domain_determineTopTree(
void);
158 void domain_printf(
char *buf);
159 void domain_rearrange_particle_sequence(
void);
161 void do_box_wrapping(
void);
162 void domain_coll_subfind_prepare_exchange(
void);
163 void domain_do_local_refine(
int n,
int *list);
164 void domain_walktoptree(
int no);
165 double domain_get_cost_summed_over_timebins(
int i);
168 static bool domain_compare_count(
const domain_count_data &a,
const domain_count_data &b) {
return a.count > b.count; }
170 static bool domain_compare_key(
const domain_peano_hilbert_data &a,
const domain_peano_hilbert_data &b) {
return a.key < b.key; }
172 static bool domain_sort_candidates(
const int &a,
const int &b) {
return a < b; }
174 struct cost_queue_data
177#ifdef SIMPLE_DOMAIN_AGGREGATION
178 double aggregated_value;
183 static bool domain_sort_cost_queue_data(
const cost_queue_data &a,
const cost_queue_data &b)
185#ifdef SIMPLE_DOMAIN_AGGREGATION
186 if(a.aggregated_value > b.aggregated_value)
188 else if(a.aggregated_value < b.aggregated_value)
191 return a.value > b.value;
194 void domain_determinate_aggregated_value(cost_queue_data *data,
int ndomains);
196 inline int n_to_no(
int n)
219 struct peano_hilbert_data
225 static bool compare_peano_hilbert_data(
const peano_hilbert_data &a,
const peano_hilbert_data &b) {
return a.key < b.key; }
227 void peano_hilbert_order(
peanokey *key);
229 struct balance_try_data
235 static bool domain_compare_trybalance(
const balance_try_data &a,
const balance_try_data &b) {
return a.try_balance < b.try_balance; }
247 struct local_sort_data
253 static inline bool compare_local_sort_data_targetindex(
const local_sort_data &a,
const local_sort_data &b)
255 return a.targetindex < b.targetindex;
258#if defined(RANDOMIZE_DOMAINCENTER_TYPES) || defined(RANDOMIZE_DOMAINCENTER)
263 void domain_find_type_extension(
void);
264 int domain_type_extension_overlap(
int j);
267#ifdef DOMAIN_SPECIAL_CHECK
268 void domain_special_check(
int mode,
int ndomains);
271 void domain_printf(
const char *fmt, ...)
void reorder_gas(int *Id)
void reorder_PS(int *Id, int Nstart, int N)
void reorder_particles(int *Id, int Nstart, int N)
void particle_exchange_based_on_PS(MPI_Comm Communicator)
void reorder_P_and_PS(int *Id)
void domain_allocate(void)
void reorder_P_PS(int NumGas, int NumPart)
size_t domain_sizeof_topnode_data(void)
domain(MPI_Comm comm, partset *Tp_ptr)
void domain_resize_storage(int count_get, int count_get_sph, int option_flag)
void domain_decomposition(domain_options mode)
int32_t MySignedIntPosType
#define BITS_FOR_POSITIONS