mirror of
https://github.com/cosmo-sims/MUSIC.git
synced 2024-09-19 17:03:46 +02:00
Add preserve_dims config option.
preserve_dims=yes The default behavior is to extend the subgrid dimensions to satisfy constraints imposed by the parameters that control how grids are centered. When preserve_dims=yes it instead keeps the dimensions but moves the grid towards the center.
This commit is contained in:
parent
6747c54f3b
commit
b39a91de1d
1 changed files with 22 additions and 5 deletions
21
src/mesh.hh
21
src/mesh.hh
|
@ -1293,6 +1293,7 @@ class refinement_hierarchy
|
|||
config_file& cf_; //!< reference to config_file
|
||||
|
||||
bool align_top_, //!< bool whether to align all grids with coarsest grid cells
|
||||
preserve_dims_, //!< bool whether to preserve user-specified grid dimensions
|
||||
equal_extent_; //!< bool whether the simulation code requires squared refinement regions (e.g. RAMSES)
|
||||
|
||||
double
|
||||
|
@ -1323,6 +1324,7 @@ public:
|
|||
levelmax_ = cf_.getValue<unsigned>("setup","levelmax");
|
||||
levelmin_tf_= cf_.getValueSafe<unsigned>("setup","levelmin_TF",levelmin_);
|
||||
align_top_ = cf_.getValueSafe<bool>("setup","align_top",false);
|
||||
preserve_dims_ = cf_.getValueSafe<bool>("setup","preserve_dims",false);
|
||||
equal_extent_ = cf_.getValueSafe<bool>("setup","force_equal_extent",false);
|
||||
blocking_factor_= cf.getValueSafe<unsigned>( "setup", "blocking_factor",0);
|
||||
|
||||
|
@ -1478,8 +1480,13 @@ public:
|
|||
kr = (int)((double)kr/nref + 1.0)*nref;
|
||||
else
|
||||
kr = krr;
|
||||
|
||||
|
||||
}else if (preserve_dims_) {
|
||||
//... require alignment with coarser grid
|
||||
int alx = (xshift_[0] >= 0) - (xshift_[0] < 0);
|
||||
int aly = (xshift_[1] >= 0) - (xshift_[1] < 0);
|
||||
int alz = (xshift_[2] >= 0) - (xshift_[2] < 0);
|
||||
il += alx*(il%2); jl += aly*(jl%2); kl += alz*(kl%2);
|
||||
ir += alx*(ir%2); jr += aly*(jr%2); kr += alz*(kr%2);
|
||||
}else{
|
||||
//... require alignment with coarser grid
|
||||
il -= il%2; jl -= jl%2; kl -= kl%2;
|
||||
|
@ -1578,6 +1585,15 @@ public:
|
|||
jr = (int)((double)jr/nref+1.0)*nref;
|
||||
kr = (int)((double)kr/nref+1.0)*nref;
|
||||
|
||||
}
|
||||
|
||||
else if (preserve_dims_) {
|
||||
//... require alignment with coarser grid
|
||||
int alx = (xshift_[0] >= 0) - (xshift_[0] < 0);
|
||||
int aly = (xshift_[1] >= 0) - (xshift_[1] < 0);
|
||||
int alz = (xshift_[2] >= 0) - (xshift_[2] < 0);
|
||||
il += alx*(il%2); jl += aly*(jl%2); kl += alz*(kl%2);
|
||||
ir += alx*(ir%2); jr += aly*(jr%2); kr += alz*(kr%2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1687,6 +1703,7 @@ public:
|
|||
padding_ = o.padding_;
|
||||
cf_ = o.cf_;
|
||||
align_top_ = o.align_top_;
|
||||
preserve_dims_ = o.preserve_dims_;
|
||||
for( int i=0; i<3; ++i )
|
||||
{
|
||||
x0ref_[i] = o.x0ref_[i];
|
||||
|
|
Loading…
Reference in a new issue