struct mrc_domain * psc_setup_mrc_domain(struct psc *psc, int nr_patches) { if (psc_ops(psc)->setup_mrc_domain) { return psc_ops(psc)->setup_mrc_domain(psc, nr_patches); } // FIXME, should be split to create, set_from_options, setup time? struct mrc_domain *domain = mrc_domain_create(MPI_COMM_WORLD); // create a very simple domain decomposition int bc[3] = {}; for (int d = 0; d < 3; d++) { if (psc->domain.bnd_fld_lo[d] == BND_FLD_PERIODIC && psc->domain.gdims[d] > 1) { bc[d] = BC_PERIODIC; } } mrc_domain_set_type(domain, "multi"); if(psc->use_dynamic_patches) { psc_patchmanager_timestep(&psc->patchmanager); mrc_domain_set_param_ptr(domain, "activepatches", psc->patchmanager.activepatches); } mrc_domain_set_param_int3(domain, "m", psc->domain.gdims); mrc_domain_set_param_int(domain, "bcx", bc[0]); mrc_domain_set_param_int(domain, "bcy", bc[1]); mrc_domain_set_param_int(domain, "bcz", bc[2]); mrc_domain_set_param_int(domain, "nr_patches", nr_patches); mrc_domain_set_param_int3(domain, "np", psc->domain.np); struct mrc_crds *crds = mrc_domain_get_crds(domain); mrc_crds_set_type(crds, "uniform"); mrc_crds_set_param_int(crds, "sw", 2); mrc_crds_set_param_double3(crds, "l", (double[3]) { psc->domain.corner[0], psc->domain.corner[1], psc->domain.corner[2] });
int main(int argc, char **argv) { MPI_Init(&argc, &argv); libmrc_params_init(argc, argv); struct mrc_domain *domain = mrc_domain_create(MPI_COMM_WORLD); mrc_domain_set_type(domain, "simple"); struct mrc_crds *crds = mrc_domain_get_crds(domain); int testcase = 1; mrc_params_get_option_int("case", &testcase); switch (testcase) { case 1: mrc_crds_set_type(crds, "uniform"); mrc_domain_set_from_options(domain); mrc_domain_setup(domain); test_read_write(domain); break; case 2: ; mrc_crds_set_type(crds, "rectilinear"); mrc_crds_set_param_int(crds, "sw", 2); mrc_domain_set_from_options(domain); mrc_domain_setup(domain); mrctest_set_crds_rectilinear_1(domain); test_read_write(domain); break; } mrc_domain_destroy(domain); MPI_Finalize(); }