AFEPack
组合类型 | 公有类型 | 公有成员 | 私有类型 | 私有成员 | 私有属性
MPI::HLoadBalance< FOREST >模板类参考

#include <MPI_LoadBalance.h>

所有成员的列表。

组合类型

struct  rank_map_val

公有类型

enum  { dim = FOREST::dim, dow = FOREST::dow }
enum  { dim = FOREST::dim, dow = FOREST::dow }
typedef FOREST forest_t
typedef forest_t::matcher_t matcher_t
typedef FOREST forest_t
typedef forest_t::matcher_t matcher_t
typedef std::map< int,
rank_map_val
rank_map_t

公有成员

 HLoadBalance (forest_t &forest)
 新分区的秩
 ~HLoadBalance ()
void clear ()
template<class GEO >
std::map< int, int > * get_rank_map (GEO &geo) const
template<class GEO >
unsigned long * get_global_idx (const GEO &geo) const
bool is_save_on_this_rank (std::map< int, int > *map, int new_rank)
template<class GEO >
void merge_global_pointer (int type, unsigned long global_idx, GEO *&p_geo)
template<class GEO >
void share_global_pointer (int rank, unsigned long global_idx, GEO *&p_geo)
template<class GEO >
bool is_refined_on_new_rank (const GEO &geo, int new_rank) const
template<class GEO >
void set_is_saved (const GEO &geo) const
 HLoadBalance (forest_t &forest)
 存储时候的根单元
 ~HLoadBalance ()
forest_tforest () const
int rank () const
void clear ()
template<class GEO >
rank_map_tget_rank_map (const GEO &geo) const
template<class GEO >
unsigned long * get_global_idx (const GEO &geo) const
template<class GEO >
bool is_on_this_new_rank (const GEO &geo, int new_rank) const
template<class GEO >
bool is_save_on_this_rank (const GEO &geo, int new_rank) const
template<class GEO >
void merge_global_pointer (int type, unsigned long global_idx, GEO *&p_geo)
template<class GEO >
void share_global_pointer (int rank, unsigned long global_idx, GEO *&p_geo)
template<class GEO >
void print_geo_rank_map (const GEO &geo) const
void print_rank_map (const rank_map_t *p_map) const

私有类型

typedef std::map< unsigned
long, std::pair< int, void * > > 
tuple_map_t
typedef BirdView< forest_tbirdview_t
typedef BirdViewSet< forest_tbirdview_set_t
typedef HLoadBalance< forest_tthis_t
typedef std::map< unsigned
long, std::pair< int, void * > > 
tuple_map_t
typedef BirdView< forest_tbirdview_t
typedef BirdViewSet< forest_tbirdview_set_t
typedef HLoadBalance< forest_tthis_t

私有成员

template<class GEO >
std::map< int, int > * new_rank_map (GEO &geo) const
template<class GEO >
unsigned long * new_global_idx (const GEO &geo) const
void share_global_pointer ()
template<class GEO >
rank_map_tnew_rank_map (const GEO &geo) const
template<class GEO >
unsigned long * new_global_idx (const GEO &geo) const
void share_global_pointer ()
void refine_root_element (double tol, bool is_renum_root, void(*f)(double, double, double, double &, double &, double &))
void refine_root_element (double tol, HGeometry< dim, dow > &geo, typename forest_t::container_t &nre) const
void coarse_root_element ()
void coarse_root_element (const property_id_t< bool > &pid, HGeometry< dim, dow > &geo, typename forest_t::container_t &nre) const

私有属性

property_id_t< u_int > _pid_loading
property_id_t< std::map< int,
int > > 
_pid_rank_map
property_id_t< unsigned long > _pid_global_idx
std::map< unsigned long, void * > _global_pointer_to_merge
std::map< int, tuple_map_t_global_pointer_to_share
forest_t_forest
std::vector< u_int > _cut_point
 树结构
std::vector< int > _new_rank
 重新分区的拆分点
property_id_t _pid_is_saved
property_id_t< rank_map_t_pid_rank_map
std::map< unsigned long,
std::list< void * > > 
_global_pointer_to_merge_later
forest_t::container_t _nre
 新分区的秩
template<class LOADER >
void config (birdview_t &ir_mesh, LOADER &loader, u_int(LOADER::*value)(GeometryBM &))
void config (birdview_t &ir_mesh, u_int(*value)(GeometryBM &)=&_default_element_loading)
static u_int _default_element_loading (GeometryBM &)
void partition (u_int n_new_rank=0)
void reuse_partition ()
u_int lump_loading () const
template<class GEO >
u_int get_loading (GEO &geo) const
template<int GDIM>
void pack_set_new_rank (HGeometry< GDIM, dow > *geo, int remote_rank, AFEPack::ostream<> &os)
template<int GDIM>
void unpack_set_new_rank (HGeometry< GDIM, dow > *geo, int remote_rank, AFEPack::istream<> &is)
void set_new_rank ()
template<class GEO >
void geometry_set_new_rank (GEO &geo, int new_rank) const
template<int GDIM>
void pack_global_index (HGeometry< GDIM, dow > *geo, int remote_rank, AFEPack::ostream<> &os)
template<int GDIM>
void unpack_global_index (HGeometry< GDIM, dow > *geo, int remote_rank, AFEPack::istream<> &is)
void global_index ()
template<class GEO >
void geometry_global_index (GEO &geo, unsigned long &idx) const
void write_config_file (const std::string &dirname)
void save_data (const std::string &dirname, birdview_set_t &bvs)
void export_birdview (birdview_t &ir_mesh, Migration::data_id_t data_id, u_int idx)
int load_config_file (const std::string &dirname)
void load_data (const std::string &dirname, birdview_set_t &bvs)
void reconstruct_birdview (HElement< dim, dow > &ele, Migration::data_id_t data_id, u_int idx) const
void reconstruct_birdview (birdview_t &ir_mesh, Migration::data_id_t data_id, u_int idx) const
template<class GEO >
void set_shared_info_sent (GEO &geo) const
void set_shared_info_sent () const
template<class LOADER >
void config (birdview_t &ir_mesh, LOADER &loader, u_int(LOADER::*value)(const GeometryBM &))
void config (birdview_t &ir_mesh, u_int(*value)(const GeometryBM &)=&_default_element_loading)
static u_int _default_element_loading (const GeometryBM &)
void partition (u_int n_new_rank=0, double tol_percent=0.05, bool is_renumerate_root=false, void(*f)(double, double, double, double &, double &, double &)=NULL)
u_int lump_loading ()
template<class GEO >
u_int get_loading (const GEO &geo) const
template<int GDIM>
void pack_set_new_rank (HGeometry< GDIM, dow > *geo, int remote_rank, AFEPack::ostream<> &os)
template<int GDIM>
void unpack_set_new_rank (HGeometry< GDIM, dow > *geo, int remote_rank, AFEPack::istream<> &is)
template<int GDIM>
void pack_check_new_rank (HGeometry< GDIM, dow > *geo, int remote_rank, AFEPack::ostream<> &os)
template<int GDIM>
void unpack_check_new_rank (HGeometry< GDIM, dow > *geo, int remote_rank, AFEPack::istream<> &is)
void set_new_rank ()
void check_new_rank ()
template<class GEO >
void geometry_set_new_rank_down (const GEO &geo, int new_rank) const
void set_new_rank_down ()
template<class GEO >
void geometry_set_new_rank_up (const GEO &geo, int new_rank) const
void set_new_rank_up ()
template<int GDIM>
void pack_global_index (HGeometry< GDIM, dow > *geo, int remote_rank, AFEPack::ostream<> &os)
template<int GDIM>
void unpack_global_index (HGeometry< GDIM, dow > *geo, int remote_rank, AFEPack::istream<> &is)
void global_index ()
template<class GEO >
void geometry_global_index (GEO &geo, unsigned long &idx) const
std::vector< u_int > _n_orphans
std::vector< std::list< void * > > _orphans_ptr
void write_config_file (const std::string &dirname)
void save_data (const std::string &dirname, birdview_set_t &bvs)
void export_birdview (birdview_t &ir_mesh, Migration::data_id_t data_id, u_int idx)
template<class GEO >
void geometry_collect_orphans (GEO &geo, const property_id_t<> &pid, int new_rank)
void collect_orphans (int new_rank)
template<int D>
void save_dim_orphans (boost::archive::HGeometry_oarchive< this_t > &oa)
void save_orphans (boost::archive::HGeometry_oarchive< this_t > &oa)
int load_config_file (const std::string &dirname)
void check_integrity () const
void load_data (const std::string &dirname, birdview_set_t &bvs, bool is_has_orphans=false)
void reconstruct_birdview (HElement< dim, dow > &ele, Migration::data_id_t data_id, u_int idx)
void reconstruct_birdview (birdview_t &ir_mesh, Migration::data_id_t data_id, u_int idx)
template<class GEO >
void set_dummy_flag (GEO &geo) const
template<class GEO >
void clear_dummy_flag (GEO &geo) const
void set_dummy_flag ()
template<int D>
void load_dim_orphans (boost::archive::HGeometry_iarchive< this_t > &ia) const
void load_orphans (boost::archive::HGeometry_iarchive< this_t > &ia) const
template<class GEO >
void geometry_check_integrity (const GEO &geo) const
 调试用代码:检查树的完整性

template<class FOREST>
class MPI::HLoadBalance< FOREST >


成员类型定义文档

template<class FOREST>
typedef BirdViewSet<forest_t> MPI::HLoadBalance< FOREST >::birdview_set_t [private]
template<class FOREST>
typedef BirdViewSet<forest_t> MPI::HLoadBalance< FOREST >::birdview_set_t [private]
template<class FOREST>
typedef BirdView<forest_t> MPI::HLoadBalance< FOREST >::birdview_t [private]
template<class FOREST>
typedef BirdView<forest_t> MPI::HLoadBalance< FOREST >::birdview_t [private]
template<class FOREST>
typedef FOREST MPI::HLoadBalance< FOREST >::forest_t
template<class FOREST>
typedef FOREST MPI::HLoadBalance< FOREST >::forest_t
template<class FOREST>
typedef forest_t::matcher_t MPI::HLoadBalance< FOREST >::matcher_t
template<class FOREST>
typedef forest_t::matcher_t MPI::HLoadBalance< FOREST >::matcher_t
template<class FOREST>
typedef std::map<int,rank_map_val> MPI::HLoadBalance< FOREST >::rank_map_t
template<class FOREST>
typedef HLoadBalance<forest_t> MPI::HLoadBalance< FOREST >::this_t [private]
template<class FOREST>
typedef HLoadBalance<forest_t> MPI::HLoadBalance< FOREST >::this_t [private]
template<class FOREST>
typedef std::map<unsigned long, std::pair<int, void *> > MPI::HLoadBalance< FOREST >::tuple_map_t [private]
template<class FOREST>
typedef std::map<unsigned long, std::pair<int, void *> > MPI::HLoadBalance< FOREST >::tuple_map_t [private]

成员枚举类型文档

template<class FOREST>
anonymous enum
枚举值:
dim 
dow 
template<class FOREST>
anonymous enum
枚举值:
dim 
dow 

构造及析构函数文档

template<class FOREST>
MPI::HLoadBalance< FOREST >::HLoadBalance ( forest_t forest) [inline]

新分区的秩

template<class FOREST>
MPI::HLoadBalance< FOREST >::~HLoadBalance ( ) [inline]
template<class FOREST>
MPI::HLoadBalance< FOREST >::HLoadBalance ( forest_t forest) [inline]

存储时候的根单元

template<class FOREST>
MPI::HLoadBalance< FOREST >::~HLoadBalance ( ) [inline]

成员函数文档

template<class FOREST>
static u_int MPI::HLoadBalance< FOREST >::_default_element_loading ( GeometryBM ) [inline, static]
template<class FOREST>
static u_int MPI::HLoadBalance< FOREST >::_default_element_loading ( const GeometryBM ) [inline, static]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::check_integrity ( ) const [inline]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::check_new_rank ( ) [inline, private]

对所有共享几何体的存储秩进行验证,确保每个新秩上的每个几何体只被 存储一次。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::clear ( ) [inline]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::clear ( ) [inline]
template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::clear_dummy_flag ( GEO geo) const [inline, private]

清除几何体身上的哑旗标,并对边界和后代做递归。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::coarse_root_element ( ) [inline, private]

对新载入的树的根单元进行粗化。如果一个根单元的父节点不是共享几何 体,则说明其所有兄弟均在此分区上,则取其父节点为根单元。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::coarse_root_element ( const property_id_t< bool > &  pid,
HGeometry< dim, dow > &  geo,
typename forest_t::container_t &  nre 
) const [inline, private]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::collect_orphans ( int  new_rank) [inline, private]
template<class FOREST>
template<class LOADER >
void MPI::HLoadBalance< FOREST >::config ( birdview_t ir_mesh,
LOADER &  loader,
u_int(LOADER::*)(GeometryBM &)  value 
) [inline]

config 计算在基于几何遗传树上的一个正则网格上的每个单元上的负载量, 计算的方法由用户提供。此函数有两个接口,一个是类的成员函数形式提供 计算方法,一个是由一个普通函数提供计算方法。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::config ( birdview_t ir_mesh,
u_int(*)(GeometryBM &)  value = &_default_element_loading 
) [inline]
template<class FOREST>
template<class LOADER >
void MPI::HLoadBalance< FOREST >::config ( birdview_t ir_mesh,
LOADER &  loader,
u_int(LOADER::*)(const GeometryBM &)  value 
) [inline]

config 计算在基于几何遗传树上的一个正则网格上的每个单元上的负载量, 计算的方法由用户提供。此函数有两个接口,一个是类的成员函数形式提供 计算方法,一个是由一个普通函数提供计算方法。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::config ( birdview_t ir_mesh,
u_int(*)(const GeometryBM &)  value = &_default_element_loading 
) [inline]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::export_birdview ( birdview_t ir_mesh,
Migration::data_id_t  data_id,
u_int  idx 
) [inline, private]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::export_birdview ( birdview_t ir_mesh,
Migration::data_id_t  data_id,
u_int  idx 
) [inline, private]
template<class FOREST>
forest_t& MPI::HLoadBalance< FOREST >::forest ( ) const [inline]
template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::geometry_check_integrity ( const GEO geo) const [inline, private]

调试用代码:检查树的完整性

如果父亲不是空指针,检查自己确实是父亲的孩子。

对边界几何体做递归。

如果自己加密了,确认所有孩子都不是空指针,且所有孩子的父亲指 针都是自己。

如果自己没有加密,确认所有的孩子指针都是空指针。

template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::geometry_collect_orphans ( GEO geo,
const property_id_t<> &  pid,
int  new_rank 
) [inline, private]
template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::geometry_global_index ( GEO geo,
unsigned long &  idx 
) const [inline, private]

对已经共享的几何体和将会共享的几何体进行全局标号。

跳过已经处理过的几何体

原本是共享的几何体

或者新秩个数大于 1 的情形都编号

然后对顶点、边界和后代做递归

template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::geometry_global_index ( GEO geo,
unsigned long &  idx 
) const [inline, private]

对已经共享的几何体和将会共享的几何体进行全局标号。

跳过已经处理过的几何体

原本是共享的几何体

或者新秩个数大于 1 的情形都编号

然后对顶点、边界和后代做递归

template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::geometry_set_new_rank ( GEO geo,
int  new_rank 
) const [inline, private]

对几何体标记为将位于新分区的第 new_rank 个进程上,并且由本进程进行 存储。此函数对其所有的顶点、边界和后代做递归。

将存储秩设为当前的秩

然后对顶点、边界和后代做递归

template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::geometry_set_new_rank_down ( const GEO geo,
int  new_rank 
) const [inline, private]

对几何体标记为将位于新分区的第 new_rank 个进程上,并且由本进程进行 存储。此函数对其所有的顶点、边界和后代做递归。

已经设置过的情形

将存储秩设为当前的秩

然后对顶点、边界和后代做递归

template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::geometry_set_new_rank_up ( const GEO geo,
int  new_rank 
) const [inline, private]

对几何体标记为将位于新分区的第 new_rank 个进程上。当一个几何体位于 某个进程上时,其所有的低维组件和祖先当然也在此几何体上,并且我们使 得其所有的兄弟也在此几何体上,因此此函数对其所有的顶点、边界、祖先 和兄弟做递归。

将存储秩设为当前的秩

然后对顶点、边界、祖先和兄弟做递归

是自己

template<class FOREST>
template<class GEO >
unsigned long* MPI::HLoadBalance< FOREST >::get_global_idx ( const GEO geo) const [inline]
template<class FOREST>
template<class GEO >
unsigned long* MPI::HLoadBalance< FOREST >::get_global_idx ( const GEO geo) const [inline]
template<class FOREST>
template<class GEO >
u_int MPI::HLoadBalance< FOREST >::get_loading ( GEO geo) const [inline, private]

计算几何体 geo 上的负载。此函数将计算所有后代的负载,并将其累加到 自身的负载上。

template<class FOREST>
template<class GEO >
u_int MPI::HLoadBalance< FOREST >::get_loading ( const GEO geo) const [inline, private]

计算几何体 geo 上的负载。此函数将计算所有后代的负载,并将其累加到 自身的负载上。

对空指针返回 0

template<class FOREST>
template<class GEO >
std::map<int,int>* MPI::HLoadBalance< FOREST >::get_rank_map ( GEO geo) const [inline]
template<class FOREST>
template<class GEO >
rank_map_t* MPI::HLoadBalance< FOREST >::get_rank_map ( const GEO geo) const [inline]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::global_index ( ) [inline, private]

对现在处于共享状态的所有几何体进行自洽标号,使得几何体在存储后恢复 的时候能够被正确合并。几何体的合并是一个非常困难的操作,目前设想的 实现方式如下:对于每一个在整个分布式内存中具有多个拷贝的对象,所在 的m个进程的秩为(r1, ..., rm),假设在重分区以后,这个对象将会在n个 进程上被恢复,这n个进程的秩为(R1, ..., Rn)。其中,在Rk上恢复出来的 这个对象,将会被进行输出的m个进程中的一部分进程输出,假定为(r1, ..., rl)这l个进程。在实现过程中,我们使得(r1, ..., rl)这l个进程事 实上只是在进程号最小的进程上输出一个备份,并对自身记录一个标号,其 它l-1进程对此对象的指针进行输出的时候,则输出这个标号,这样在恢复 的时候就获得唯一的备份指针。

实现这个全局自洽标号的功能由 global_index, pack_global_index, unpack_global_index, geometry_global_index 四个函数完成。

先清点需要加全局标号的几何体的个数。

对从0开始的标号进行清除

计算本进程上全局标号的开始值。

从 idx 开始重新对几何体进行标号,完成自洽标号的指定。

将各个分区上具有多个拷贝的几何体的变号进行同步,我们取那个最小 的标号。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::global_index ( ) [inline, private]

对现在处于共享状态的所有几何体进行自洽标号,使得几何体在存储后恢复 的时候能够被正确合并。几何体的合并是一个非常困难的操作,目前设想的 实现方式如下:对于每一个在整个分布式内存中具有多个拷贝的对象,所在 的m个进程的秩为(r1, ..., rm),假设在重分区以后,这个对象将会在n个 进程上被恢复,这n个进程的秩为(R1, ..., Rn)。其中,在Rk上恢复出来的 这个对象,将会被进行输出的m个进程中的一部分进程输出,假定为(r1, ..., rl)这l个进程。在实现过程中,我们使得(r1, ..., rl)这l个进程事 实上只是在进程号最小的进程上输出一个备份,并对自身记录一个标号,其 它l-1进程对此对象的指针进行输出的时候,则输出这个标号,这样在恢复 的时候就获得唯一的备份指针。

实现这个全局自洽标号的功能由 global_index, pack_global_index, unpack_global_index, geometry_global_index 四个函数完成。

先清点需要加全局标号的几何体的个数。

对从0开始的标号进行清除

计算本进程上全局标号的开始值。

从 idx 开始重新对几何体进行标号,完成自洽标号的指定。

将各个分区上具有多个拷贝的几何体的变号进行同步,我们取那个最小 的标号。

template<class FOREST>
template<class GEO >
bool MPI::HLoadBalance< FOREST >::is_on_this_new_rank ( const GEO geo,
int  new_rank 
) const [inline]

检测几何体是否会在 new_rank 上存在。

template<class FOREST>
template<class GEO >
bool MPI::HLoadBalance< FOREST >::is_refined_on_new_rank ( const GEO geo,
int  new_rank 
) const [inline]
template<class FOREST>
bool MPI::HLoadBalance< FOREST >::is_save_on_this_rank ( std::map< int, int > *  map,
int  new_rank 
) [inline]

判断一个几何体在新分区上的存储是否由本进程完成。

参数:
map几何体的 rank_map 性质指针
new_rank几何体在新分区上的秩
返回:
在本进程存储为真,否则为假

如果几何体的 rank_map 性质中应该不会没有 new_rank 的入口

如果几何体对 new_rank 分区的存储在本进程上完成,返回真

否则返回假

template<class FOREST>
template<class GEO >
bool MPI::HLoadBalance< FOREST >::is_save_on_this_rank ( const GEO geo,
int  new_rank 
) const [inline]

判断一个几何体在新分区上的存储是否由本进程完成。

参数:
map几何体的 rank_map 性质指针
new_rank几何体在新分区上的秩
返回:
在本进程存储为真,否则为假

如果几何体的 rank_map 性质中没有 new_rank 的入口

如果几何体对 new_rank 分区的存储在本进程上完成,返回真

否则返回假

template<class FOREST>
int MPI::HLoadBalance< FOREST >::load_config_file ( const std::string &  dirname) [inline]
template<class FOREST>
int MPI::HLoadBalance< FOREST >::load_config_file ( const std::string &  dirname) [inline]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::load_data ( const std::string &  dirname,
birdview_set_t bvs 
) [inline]

开始正式读数据以前同步一次,以保证要读入的数据已经准备好

建立目录

重造半正则网格

则打开文件为流

打开正确,则开始读入

将流做成输入档案

template<class FOREST>
void MPI::HLoadBalance< FOREST >::load_data ( const std::string &  dirname,
birdview_set_t bvs,
bool  is_has_orphans = false 
) [inline]

开始正式读数据以前同步一次,以保证要读入的数据已经准备好

建立目录

重造半正则网格

则打开文件为流

打开正确,则开始读入

将流做成输入档案

template<class FOREST>
template<int D>
void MPI::HLoadBalance< FOREST >::load_dim_orphans ( boost::archive::HGeometry_iarchive< this_t > &  ia) const [inline, private]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::load_orphans ( boost::archive::HGeometry_iarchive< this_t > &  ia) const [inline, private]
template<class FOREST>
u_int MPI::HLoadBalance< FOREST >::lump_loading ( ) const [inline, private]

lump_loading 函数利用 get_loading 函数的对后代递归的性质将正则网格 的单元上的负载集中到背景网格的单元上。

template<class FOREST>
u_int MPI::HLoadBalance< FOREST >::lump_loading ( ) [inline, private]

根节点计算负载。利用get_loading 函数的对后代递归的性质将正则网格的 单元上的负载集中到背景网格的单元上。

template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::merge_global_pointer ( int  type,
unsigned long  global_idx,
GEO *&  p_geo 
) [inline]

一个几何体的多个备份归并到一个秩上时,完成其相应指针的归并。存储 的时候,因为一个几何体的多个备份事实上只存储了一次,其它分区上的 这个指针在载入的时候将会仅仅获得全局标号。因此,如果该几何体事实 上存储在此归档中,我们会记录下该指针的位置;如果该几何体不存储于 此归档中,我们直接取出该指针。

参数:
type类型(0: 存储在此文档;1: 不存储在此文档中)
global_idx全局标号
p_geo几何体指针的引用
template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::merge_global_pointer ( int  type,
unsigned long  global_idx,
GEO *&  p_geo 
) [inline]

一个几何体的多个备份归并到一个秩上时,完成其相应指针的归并。存储 的时候,因为一个几何体的多个备份事实上只存储了一次,其它分区上的 这个指针在载入的时候将会仅仅获得全局标号。因此,如果该几何体事实 上存储在此归档中,我们会记录下该指针的位置;如果该几何体不存储于 此归档中,我们直接取出该指针。

参数:
type类型(2: 存储在此文档;4: 不存储在此文档中)
global_idx全局标号
p_geo几何体指针的引用

对不在第一个秩上存储的指针进行合并。

template<class FOREST>
template<class GEO >
unsigned long* MPI::HLoadBalance< FOREST >::new_global_idx ( const GEO geo) const [inline, private]
template<class FOREST>
template<class GEO >
unsigned long* MPI::HLoadBalance< FOREST >::new_global_idx ( const GEO geo) const [inline, private]
template<class FOREST>
template<class GEO >
std::map<int,int>* MPI::HLoadBalance< FOREST >::new_rank_map ( GEO geo) const [inline, private]
template<class FOREST>
template<class GEO >
rank_map_t* MPI::HLoadBalance< FOREST >::new_rank_map ( const GEO geo) const [inline, private]
template<class FOREST>
template<int GDIM>
void MPI::HLoadBalance< FOREST >::pack_check_new_rank ( HGeometry< GDIM, dow > *  geo,
int  remote_rank,
AFEPack::ostream<> &  os 
) [inline]
template<class FOREST>
template<int GDIM>
void MPI::HLoadBalance< FOREST >::pack_global_index ( HGeometry< GDIM, dow > *  geo,
int  remote_rank,
AFEPack::ostream<> &  os 
) [inline]

传输自身的原始全局标号

template<class FOREST>
template<int GDIM>
void MPI::HLoadBalance< FOREST >::pack_global_index ( HGeometry< GDIM, dow > *  geo,
int  remote_rank,
AFEPack::ostream<> &  os 
) [inline]

传输自身的原始全局标号

template<class FOREST>
template<int GDIM>
void MPI::HLoadBalance< FOREST >::pack_set_new_rank ( HGeometry< GDIM, dow > *  geo,
int  remote_rank,
AFEPack::ostream<> &  os 
) [inline]
template<class FOREST>
template<int GDIM>
void MPI::HLoadBalance< FOREST >::pack_set_new_rank ( HGeometry< GDIM, dow > *  geo,
int  remote_rank,
AFEPack::ostream<> &  os 
) [inline]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::partition ( u_int  n_new_rank = 0) [inline]

对区域进行重新拆分,获取使得负载平衡的拆分点位置。这个功能由 partition, lump_loading, get_loading 三个函数完成。

缺省取为旧的分区数

put a "0" at beginning

最后一个进程上会多几个单元

template<class FOREST>
void MPI::HLoadBalance< FOREST >::partition ( u_int  n_new_rank = 0,
double  tol_percent = 0.05,
bool  is_renumerate_root = false,
void(*)(double, double, double, double &, double &, double &)  f = NULL 
) [inline]

对区域进行重新拆分,获取使得负载平衡的拆分点位置。这个功能由 partition, lump_loading, get_loading 三个函数完成。

此处引进了新的参数 tol,其目标是为了使得树结构的根节点可以进行调 整。如果一个节点的负载大于这个值,则将细分根节点。

缺省取为旧的分区数

如果一个根单元的负载比 mean_loading*tol_percent 大,则将根单元细分。

put a "0" at beginning

最后一个进程上会多几个单元

template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::print_geo_rank_map ( const GEO geo) const [inline]

打印出几何体的 rank_map 供调试时用。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::print_rank_map ( const rank_map_t p_map) const [inline]
template<class FOREST>
int MPI::HLoadBalance< FOREST >::rank ( ) const [inline]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::reconstruct_birdview ( HElement< dim, dow > &  ele,
Migration::data_id_t  data_id,
u_int  idx 
) const [inline, private]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::reconstruct_birdview ( birdview_t ir_mesh,
Migration::data_id_t  data_id,
u_int  idx 
) const [inline, private]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::reconstruct_birdview ( HElement< dim, dow > &  ele,
Migration::data_id_t  data_id,
u_int  idx 
) [inline, private]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::reconstruct_birdview ( birdview_t ir_mesh,
Migration::data_id_t  data_id,
u_int  idx 
) [inline, private]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::refine_root_element ( double  tol,
bool  is_renum_root,
void(*)(double, double, double, double &, double &, double &)  f 
) [inline, private]

对树的根单元进行调整。在数据存储以前,我们对根单元进行加细,使得新 分区能够更加合理一些。在数据装载以后,我们对根单元进行粗化,使得分 区上的自适应能够更加灵活一些,特别是在粗化的时候能够充分放粗。 对于负载大于 tol 的根单元进行递归细分,使得新构造的根单元的负载都 小于 tol。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::refine_root_element ( double  tol,
HGeometry< dim, dow > &  geo,
typename forest_t::container_t &  nre 
) const [inline, private]

负载足够大

几何体有被细分

孩子上也有负载

template<class FOREST>
void MPI::HLoadBalance< FOREST >::reuse_partition ( ) [inline]

使用原有分区。此功能可以用来存储和重新载入数据。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::save_data ( const std::string &  dirname,
birdview_set_t bvs 
) [inline]

最后做一次同步

template<class FOREST>
void MPI::HLoadBalance< FOREST >::save_data ( const std::string &  dirname,
birdview_set_t bvs 
) [inline]

将树的根单元恢复回来

最后做一次同步

template<class FOREST>
template<int D>
void MPI::HLoadBalance< FOREST >::save_dim_orphans ( boost::archive::HGeometry_oarchive< this_t > &  oa) [inline, private]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::save_orphans ( boost::archive::HGeometry_oarchive< this_t > &  oa) [inline, private]
template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::set_dummy_flag ( GEO geo) const [inline, private]

如果几何体是共享几何体,则将几何体自身设置成哑几何体,并对其边界和 后代做递归。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::set_dummy_flag ( ) [inline, private]

通过两个步骤来将部分的共享几何体上设置上哑旗标:

1. 对所有共享几何体都设置上哑旗标;

2. 对当前根单元及其后代都清除哑旗标;

对一个单元几何体进行一个操作的时候,对其所有边界和后代都递归进行。

template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::set_is_saved ( const GEO geo) const [inline]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::set_new_rank ( ) [inline, private]

对整个网格的几何体进行标识,判断几何体在负载平衡完成后每个几何体所 处的分区。这个功能由 set_new_rank, pack_collect_rank, unpack_collect_rank, geometry_set_new_rank 四个函数完成。

在每个分区上计算每个背景网格中的几何体所在分区。

将各个分区上所加的分区标识进行汇总。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::set_new_rank ( ) [inline, private]

对整个网格的几何体进行标识,判断几何体在负载平衡完成后每个几何体所 处的分区。这个功能由 set_new_rank_down, set_new_rank_up, pack_collect_rank, unpack_collect_rank 四个函数完成。

将各个分区上所加的分区标识进行汇总。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::set_new_rank_down ( ) [inline, private]

根据根单元所属的分区确定根单元所有后代的新分区。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::set_new_rank_up ( ) [inline, private]

对于根单元以上层次的几何体设定新分区。

template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::set_shared_info_sent ( GEO geo) const [inline, private]

对几何体的 shared_info_sent 旗标进行设置。如果一个几何体自身是被 加密了的,则我们设置此旗标,这是因为在 share_global_pointer 的时 候,此信息已经进行了进程间的同步。

template<class FOREST>
void MPI::HLoadBalance< FOREST >::set_shared_info_sent ( ) const [inline, private]

对所有的根单元,设置其所有几何体的 shared_info_sent 旗标。

template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::share_global_pointer ( int  rank,
unsigned long  global_idx,
GEO *&  p_geo 
) [inline]

记录一个指针将被共享的信息。其将会被共享给秩为 rank 的进程,全局指 标为 global_idx,几何体的指针为 p_geo。

参数:
rank去给共享的秩
global_idx全局标号
p_geo几何体的指针
template<class FOREST>
void MPI::HLoadBalance< FOREST >::share_global_pointer ( ) [inline, private]

在进程之间交换共享几何体的信息,建立共享信息表。

global index

dimension

pointer

template<class FOREST>
template<class GEO >
void MPI::HLoadBalance< FOREST >::share_global_pointer ( int  rank,
unsigned long  global_idx,
GEO *&  p_geo 
) [inline]

记录一个指针将被共享的信息。其将会被共享给秩为 rank 的进程,全局指 标为 global_idx,几何体的指针为 p_geo。

参数:
rank去给共享的秩
global_idx全局标号
p_geo几何体的指针
template<class FOREST>
void MPI::HLoadBalance< FOREST >::share_global_pointer ( ) [inline, private]

在进程之间交换共享几何体的信息,建立共享信息表。

检查是否所有发出去信息的几何体都收到了共享信息。

template<class FOREST>
template<int GDIM>
void MPI::HLoadBalance< FOREST >::unpack_check_new_rank ( HGeometry< GDIM, dow > *  geo,
int  remote_rank,
AFEPack::istream<> &  is 
) [inline]
template<class FOREST>
template<int GDIM>
void MPI::HLoadBalance< FOREST >::unpack_global_index ( HGeometry< GDIM, dow > *  geo,
int  remote_rank,
AFEPack::istream<> &  is 
) [inline]

对于在目前分区状态下已经有共享的几何体,其最终的全局标号取为其所 有备份上的预设全局标号的最小值。这使得所有具有全局标号的几何体的 全局标号并不成为一个连续的序列,但是是自洽的。

将标号取为所有拷贝中标号最小的

template<class FOREST>
template<int GDIM>
void MPI::HLoadBalance< FOREST >::unpack_global_index ( HGeometry< GDIM, dow > *  geo,
int  remote_rank,
AFEPack::istream<> &  is 
) [inline]

对于在目前分区状态下已经有共享的几何体,其最终的全局标号取为其所 有备份上的预设全局标号的最小值。这使得所有具有全局标号的几何体的 全局标号并不成为一个连续的序列,但是是自洽的。

将标号取为所有拷贝中标号最小的

template<class FOREST>
template<int GDIM>
void MPI::HLoadBalance< FOREST >::unpack_set_new_rank ( HGeometry< GDIM, dow > *  geo,
int  remote_rank,
AFEPack::istream<> &  is 
) [inline]

设置对每个几何体进行输出的最小秩。输出的时候,几何体跟随单元进行 输出,因此只有当一个几何体所属于的单元,在某个进程上输出的时候, 该几何体才会被输出。对于非单元的几何体,我们就将对其进行输出的最 小秩进程作为最后对其进行输出的进程。

取较小的输出秩

template<class FOREST>
template<int GDIM>
void MPI::HLoadBalance< FOREST >::unpack_set_new_rank ( HGeometry< GDIM, dow > *  geo,
int  remote_rank,
AFEPack::istream<> &  is 
) [inline]

在每个新分区上,对于每个几何体我们确保只有一个旧分区进行一次的数 据输出。对于旧分区的选择,遵循以下的原则:

1. 如果一个旧分区会输出该几何体,并且不是哑几何体,则具有优先权; 2. 如果两个旧分区具有完全相同的条件,则秩比较小的那个分区具有优 先权;

取较小的输出秩

template<class FOREST>
void MPI::HLoadBalance< FOREST >::write_config_file ( const std::string &  dirname) [inline]
template<class FOREST>
void MPI::HLoadBalance< FOREST >::write_config_file ( const std::string &  dirname) [inline]

成员数据文档

template<class FOREST>
std::vector< u_int > MPI::HLoadBalance< FOREST >::_cut_point [private]

树结构

template<class FOREST>
forest_t * MPI::HLoadBalance< FOREST >::_forest [private]
template<class FOREST>
std::map< unsigned long, void * > MPI::HLoadBalance< FOREST >::_global_pointer_to_merge [private]
template<class FOREST>
std::map<unsigned long, std::list<void *> > MPI::HLoadBalance< FOREST >::_global_pointer_to_merge_later [private]
template<class FOREST>
std::map< int, tuple_map_t > MPI::HLoadBalance< FOREST >::_global_pointer_to_share [private]
template<class FOREST>
std::vector<u_int> MPI::HLoadBalance< FOREST >::_n_orphans [private]
template<class FOREST>
std::vector< int > MPI::HLoadBalance< FOREST >::_new_rank [private]

重新分区的拆分点

template<class FOREST>
forest_t::container_t MPI::HLoadBalance< FOREST >::_nre [private]

新分区的秩

template<class FOREST>
std::vector<std::list<void *> > MPI::HLoadBalance< FOREST >::_orphans_ptr [private]
template<class FOREST>
property_id_t< unsigned long > MPI::HLoadBalance< FOREST >::_pid_global_idx [private]
template<class FOREST>
property_id_t MPI::HLoadBalance< FOREST >::_pid_is_saved [private]
template<class FOREST>
property_id_t< u_int > MPI::HLoadBalance< FOREST >::_pid_loading [private]
template<class FOREST>
property_id_t<std::map<int, int> > MPI::HLoadBalance< FOREST >::_pid_rank_map [private]
template<class FOREST>
property_id_t<rank_map_t> MPI::HLoadBalance< FOREST >::_pid_rank_map [private]

这个性质的 first 为新分区中的秩, second 为对其进行存储的秩和在新 分区上是否进行了加密。


该类的文档由以下文件生成: