分享
 
 
 

GenericGridCollection.h 注释

王朝c#·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

#ifndef _GenericGridCollection

#define _GenericGridCollection

//

// Who to blame:? Geoff Chesshire

//

#include "GenericGrid.h"

#ifdef USE_STL

#include "RCVector.h"

#else

#include "ListOfGenericGrid.h"

#include "ListOfGenericGridCollection.h"

#endif // USE_STL

#include "GCMath.h"

/*! \class GenericGridCollectionData

\brif GenericGridCollection的可引用核心数据

*/

class GenericGridCollection;

//

//? Class for reference-counted data.

//? GenericGridCollection的核心数据

class GenericGridCollectionData:

? public ReferenceCounting {

? /** 一个枚举变量,定义了若干“位”常量,用于update操作选项

? */

? public:

??? enum {

????? THEbaseGrid???????????????????? = 1

????? THErefinementLevel????????????? = THEbaseGrid???????

????? THEcomponentGrid??????????????? = THErefinementLevel

????? THEmultigridLevel?????????????? = THEcomponentGrid??

????? ENDtheGenericGridCollectionData = THEmultigridLevel?

????? NOTHING???????????????????????? = GenericGridData::NOTHING,

????? THEusualSuspects??????????????? = GenericGridData::THEusualSuspects,

????? THElists??????????????????????? = THEbaseGrid

????????????????????????????????????? | THErefinementLevel

????????????????????????????????????? | THEcomponentGrid

????????????????????????????????????? | THEmultigridLevel,

????? EVERYTHING????????????????????? = GenericGridData::EVERYTHING

????????????????????????????????????? | THEbaseGrid

????????????????????????????????????? | THErefinementLevel

????????????????????????????????????? | THEcomponentGrid

????????????????????????????????????? | THEmultigridLevel,

????? COMPUTEnothing????????????????? = GenericGridData::COMPUTEnothing,

????? COMPUTEtheUsual???????????????? = GenericGridData::COMPUTEtheUsual,

????? COMPUTEfailed?????????????????? = GenericGridData::COMPUTEfailed

??? };

??? Integer???????????????????????? computedGeometry;

// 网格集合元素的分组,详见GenericGridCollection中的注释???

#ifdef USE_STL

??? Integer???????????????????????? numberOfGrids;

??? RCVector?????????? grid;

??? IntegerArray??????????????????? gridNumber;

??? Integer???????????????????????? numberOfBaseGrids;

??? RCVector baseGrid;

??? IntegerArray??????????????????? baseGridNumber;

??? Integer???????????????????????? numberOfRefinementLevels;

??? RCVector refinementLevel;

??? IntegerArray??????????????????? refinementLevelNumber;

??? Integer???????????????????????? numberOfComponentGrids;

??? RCVector componentGrid;

??? IntegerArray??????????????????? componentGridNumber;

??? Integer???????????????????????? numberOfMultigridLevels;

??? RCVector multigridLevel;

??? IntegerArray??????????????????? multigridLevelNumber;

#else

??? Integer???????????????????????? numberOfGrids;

??? ListOfGenericGrid?????????????? grid;????????

??? IntegerArray??????????????????? gridNumber;???

??? Integer???????????????????????? numberOfBaseGrids;

??? ListOfGenericGridCollection???? baseGrid;??????

??? IntegerArray??????????????????? baseGridNumber;

??? Integer???????????????????????? numberOfRefinementLevels;

??? ListOfGenericGridCollection???? refinementLevel;?

??? IntegerArray??????????????????? refinementLevelNumber;?

??? Integer???????????????????????? numberOfComponentGrids;

??? ListOfGenericGridCollection???? componentGrid;?????????

??? IntegerArray??????????????????? componentGridNumber;???

??? Integer???????????????????????? numberOfMultigridLevels;?

??? ListOfGenericGridCollection???? multigridLevel;?

??? IntegerArray??????????????????? multigridLevelNumber;

#endif // USE_STL

// 默认构造函数、拷贝构造函数和解构函数

??? GenericGridCollectionData(const Integer numberOfGrids_ = 0);

??? GenericGridCollectionData(

????? const GenericGridCollectionData& x,

????? const CopyType?????????????????? ct = DEEP);

??? virtual ~GenericGridCollectionData();

// =, [] 操作符重载???

??? GenericGridCollectionData& operator=(const GenericGridCollectionData& x);

??? inline GenericGrid& operator[](const Integer& i) { return grid[i]; }

??? inline const GenericGrid& operator[](const Integer& i) const

????? { return grid[i]; }

// 引用关联操作,引用切断操作和引用合法性检测

??? void reference(const GenericGridCollectionData& x);

??? virtual void breakReference();

??? virtual void consistencyCheck() const;

// 文件IO读取和写入

??? virtual Integer get(

????? const GenericDataBase& db,

????? const aString&???????? name);

??? virtual Integer put(

????? GenericDataBase& db,

????? const aString&?? name) const;

// 两种形式的更新操作和指定数据删除操作

??? inline Integer update(

????? const Integer what = THEusualSuspects,

????? const Integer how = COMPUTEtheUsual)

????? { return update(*this, what, how); }

??? virtual Integer update(

????? GenericGridCollectionData& x,

????? const Integer????????????? what = THEusualSuspects,

????? const Integer????????????? how = COMPUTEtheUsual);

??? virtual void destroy(const Integer what = NOTHING);

// 改变几何形状改动标记

??? virtual void geometryHasChanged(const Integer what = ~NOTHING);

// 增加网格加密层操作

??? virtual Integer addRefinement(

????? const Integer& level,

????? const Integer? k = 0 );

??? virtual Integer addRefinements(

????? const Integer? level,

????? const Integer? k,

????? const Integer numberToAdd );

// 删除网格加密层操作

??? virtual void deleteRefinement(const Integer& k);

??? virtual void deleteRefinementLevels(const Integer level = 0);

// 这个不知道干嘛的,似乎是置换某个加密层的网格

??? virtual void referenceRefinementLevels(

????? GenericGridCollectionData& x,

????? const Integer????????????? level = INTEGER_MAX);

// 增加、删除多重网格的加粗层

??? virtual Integer addMultigridCoarsening(

????? const Integer& level,

????? const Integer? k = 0);

??? virtual void deleteMultigridCoarsening(const Integer& k);

// 删除多重网格层

??? virtual void deleteMultigridLevels(const Integer level = 0);

// 设置网格数量

??? virtual void setNumberOfGrids(const Integer& numberOfGrids_);

// 初始化操作

??? void initialize(const Integer& numberOfGrids_);

? protected:

? /** 代表GridCollection类型的枚举常量

? */

??? enum GridCollectionTypes

??? {

????? masterGridCollection,?????????????????? /*!

????? refinementLevelGridCollection,????????? /*!

????? multigridLevelGridCollection,?????????? /*!

????? baseGridGridCollection????????????????? /*!

??? } gridCollectionType;??

// 更新网格集合

??? Integer updateCollection(

????? const Integer&?????????????????? what,

????? Integer&???????????????????????? numberOfCollections,

#ifdef USE_STL

????? RCVector& list,

#else

????? ListOfGenericGridCollection&???? list,

#endif // USE_STL

????? IntegerArray&??????????????????? number);

//

//? Virtual member functions used only through class ReferenceCounting:

//? 若干来源于ReferenceCounting,并只能通过ReferenceCounting调用的函数

? private:

??? inline virtual ReferenceCounting& operator=(const ReferenceCounting& x)

????? { return operator=((GenericGridCollectionData&)x); }

??? inline virtual void reference(const ReferenceCounting& x)

????? { reference((GenericGridCollectionData&)x); }

??? inline virtual ReferenceCounting* virtualConstructor(

????? const CopyType ct = DEEP) const

????? { return new GenericGridCollectionData(*this, ct); }

??? aString className;

? public:

??? inline virtual aString getClassName() const { return className; }

};

/*! \class GenericGridCollection

\brief 网格集合的基类

*/

class GenericGridCollection:

? public ReferenceCounting {

? public:

//? Public constants:

//? Constants to be ORed to form the first argument of update() and destroy():

/** 一个定义了若干位常量的枚举

通过位OR操作来组合成为update()和destroy()操作的第一参数,以定义操作的对象what

*/

??? enum {

????? THEbaseGrid??????? = GenericGridCollectionData::THEbaseGrid,

????? THErefinementLevel = GenericGridCollectionData::THErefinementLevel,

????? THEcomponentGrid?? = GenericGridCollectionData::THEcomponentGrid,

????? THEmultigridLevel? = GenericGridCollectionData::THEmultigridLevel,

????? NOTHING??????????? = GenericGridCollectionData::NOTHING,

????? THEusualSuspects?? = GenericGridCollectionData::THEusualSuspects,

????? THElists?????????? = GenericGridCollectionData::THElists,

????? EVERYTHING???????? = GenericGridCollectionData::EVERYTHING

??? };

//? Constants to be ORed to form the second argument of update():

/** 一个定义了若干位常量的枚举

通过位OR操作来组合成为update()和destroy()操作的第二参数,以定义操作的动作how

*/

??? enum {

????? COMPUTEnothing???? = GenericGridCollectionData::COMPUTEnothing,

????? COMPUTEtheUsual??? = GenericGridCollectionData::COMPUTEtheUsual,

????? COMPUTEfailed????? = GenericGridCollectionData::COMPUTEfailed

??? };

//? Public data:

#ifdef USE_STL

//? List of grids.

??? RCVector???????????????? grid;

??? const IntegerArray??????????????????? gridNumber;

//? Collections of grids having the same base grid.

??? RCVector?????? baseGrid;

??? const IntegerArray??????????????????? baseGridNumber;

//? Collections of grids having the same refinement level.

??? RCVector?????? refinementLevel;

??? const IntegerArray??????????????????? refinementLevelNumber;

//? Collections of multigrid coarsenings of the same component grid

??? RCVector?????? componentGrid;

??? const IntegerArray??????????????????? componentGridNumber;

//? Collections of grids having the same multigrid level.

??? RCVector?????? multigridLevel;

??? const IntegerArray??????????????????? multigridLevelNumber;

#else

//? List of grids.

??? ListOfGenericGrid???????????????????? grid;?? /*!

??? const IntegerArray??????????????????? gridNumber; /*!

//? Collections of grids having the same base grid. /*!

??? ListOfGenericGridCollection?????????? baseGrid;? /*!

??? const IntegerArray??????????????????? baseGridNumber; /*!

//? Collections of grids having the same refinement level.

??? ListOfGenericGridCollection?????????? refinementLevel; /*!

??? const IntegerArray??????????????????? refinementLevelNumber; /*!

//? Collections of multigrid coarsenings of the same component grid

??? ListOfGenericGridCollection?????????? componentGrid;? /*!

??? const IntegerArray??????????????????? componentGridNumber; /*!

//? Collections of grids having the same multigrid level.

??? ListOfGenericGridCollection?????????? multigridLevel;? /*!

??? const IntegerArray??????????????????? multigridLevelNumber; /* 它们的编号 */

#endif // USE_STL

//

//? Public member functions for access to data:

//

//? This is a mask that indicates which geometrical data has been computed.

//? This must be reset to zero to invalidate the data when the geometry changes.

/** 返回几何形状改变标志

*/

??? inline const Integer& computedGeometry() const

????? { return rcData-computedGeometry; }

//

//? The number of grids in the grid list.

/** 返回网格集合中的网格编号

*/

??? inline const Integer& numberOfGrids() const { return rcData-numberOfGrids; }

//

//? The number of GridCollections in baseGrid.

/**? 返回baseGrid分组编号

*/

??? inline const Integer& numberOfBaseGrids() const

????? { return rcData-numberOfBaseGrids; }

//

//? The number of GridCollections in refinementLevel.

/** 返回refinementLevel分组编号

*/

??? inline const Integer& numberOfRefinementLevels() const

????? { return rcData-numberOfRefinementLevels; }

//

//? The number of GridCollections in componentGrid.

/** 返回ComponentGrid分组编号

*/

??? inline const Integer& numberOfComponentGrids() const

????? { return rcData-numberOfComponentGrids; }

//

//? The number of GridCollections in multigridLevel.

/** 返回MultigridLevel分组编号

*/

??? inline const Integer& numberOfMultigridLevels() const

????? { return rcData-numberOfMultigridLevels; }

//

//? Public member functions:

//

//? Default constructor.

//

//? Create a GenericGridCollection with the given number of dimensions

//? and number of component grids.

// 默认构造函数

??? GenericGridCollection(const Integer numberOfGrids_ = 0);

//

//? Copy constructor.? (Does deep copy by default.)

//? 拷贝构造函数

??? GenericGridCollection(

?????? const GenericGridCollection& x,

?????? const CopyType?????????????? ct = DEEP);

//

//? Destructor.

//? 解构函数

??? virtual ~GenericGridCollection();

//

//? Assignment operator.? (Does a deep copy.)

//? 赋值操作符 =(深层拷贝)

??? GenericGridCollection& operator=(const GenericGridCollection& x);

//

//? Get a reference to a component grid using C or Fortran indexing.

//? 按索引访问操作符 []

??? inline GenericGrid& operator[](const Integer& i) { return grid[i]; }

??? inline const GenericGrid& operator[](const Integer& i) const

????? { return grid[i]; }

//

//? Make a reference.? (Does a shallow copy.)

//? 引用关联操作(浅层拷贝)

??? void reference(const GenericGridCollection& x);

??? void reference(GenericGridCollectionData& x);

//

//? Break a reference.? (Replaces with a deep copy.)

//? 切断引用,代之以深层拷贝

??? virtual void breakReference();

//

//? Check that the data structure is self-consistent.

//? 检查引用合法性

??? virtual void consistencyCheck() const;

//

//? "Get" and "put" database operations.

//? 文件IO

??? virtual Integer get(

????? const GenericDataBase& db,

????? const aString&???????? name);

??? virtual Integer put(

????? GenericDataBase& db,

????? const aString&?? name) const;

//

//? Set references to reference-counted data.

//? 更新引用

??? void updateReferences(const Integer what = EVERYTHING);

//

//? Update the grid.

//? 更新网格集合

??? inline Integer update(

????? const Integer what = THEusualSuspects,

????? const Integer how = COMPUTEtheUsual)

????? { return update(*this, what, how); }

//

//? Update the grid, sharing the data of another grid.

//? 更新网格集合,并和指定的另外一个网格集合共享核心数据

??? virtual Integer update(

????? GenericGridCollection& x,

????? const Integer????????? what = THEusualSuspects,

????? const Integer????????? how = COMPUTEtheUsual);

//

//? Destroy optional grid data.

//? 删除可选数据

??? virtual void destroy(const Integer what = NOTHING);

//

//? Mark all of the geometric data out-of-date.

/**? 标记网格几何对应的几何形状改变,相应数据失效

*/

??? inline void geometryHasChanged(const Integer what = ~NOTHING)

????? { rcData-geometryHasChanged(what); }

//

//? Add a refinement grid to the collection.

//? 增加一个加密网格

??? virtual Integer addRefinement(

????? const Integer& level,? /*!

????? const Integer? k = 0); /*!

//

//? Delete all multigrid levels of refinement grid k.

//? 删除作为祖先的网格k的所有加密层

??? virtual void deleteRefinement(const Integer& k);

//

//? Delete all grids with refinement level greater than the given level.

//? 删除level层以上的加密层

??? virtual void deleteRefinementLevels(const Integer level = 0);

//

//? Reference x[i] for refinementLevelNumber(i)

//? Delete all other grids.

//? 将网格集合x按照refinementLevel关联引用,并删除其它所有网格

??? virtual void referenceRefinementLevels(

????? GenericGridCollection& x,

????? const Integer????????? level = INTEGER_MAX);

//

//? Add a multigrid coarsening of grid k.

//? 对组件网格k增加一个加粗层

??? virtual Integer addMultigridCoarsening(

????? const Integer& level,? // The multigrid level number.

????? const Integer? k = 0); // The index of the corresponding grid

???????????????????????????? // at any finer multigrid level.

//

//? Delete grid k, a multigrid coarsening, and all of its multigrid coarsenings.

//? 删除一个加粗网格和它的所有加粗网格

??? virtual void deleteMultigridCoarsening(const Integer& k);

//

//? Delete all of the grids with multigrid level greater than the given level.

//? 删除高于level层的所有网格

??? virtual void deleteMultigridLevels(const Integer level = 0);

//

//? Set the number of grids.

//? 设置网格数量

??? virtual void setNumberOfGrids(const Integer& numberOfGrids_);

//

//? Initialize the GenericGridCollection with the given number of grids.

//? These grids have their gridNumbers, baseGridNumbers and componentGridNumbers

//? set to [0, ..., numberOfGrids_-1], and their refinementLevelNumbers and

//? multigridLevelNumbers set to zero.

//? 按给定的网格数量初始化,编号gridNumbers, baseGridNumbers and componentGridNumbers

//? 按照[0, ..., numberOfGrids_-1]设置,而refinementLevelNumbers and multigridLevelNumbers

//? 全部设置为0

??? virtual void initialize(

????? const Integer& numberOfGrids_);

//

//? Comparison function.? Returns true if x is the same grid as *this.

//? ==, !=操作符

??? inline Logical operator==(const GenericGridCollection& x) const

????? { return x.rcData == rcData; }

??? inline Logical operator!=(const GenericGridCollection& x) const

????? { return x.rcData != rcData; }

//

//? Return the index of x in *this, or return -1 if x is not in *this.

/**? 返回给定的网格的索引号

*/

??? inline Integer getIndex(const GenericGrid& x) const {

??????? for (Integer i=0; i

??????? return -1;

??? }

??? // Here is the master grid.?

??? // 返回master grid集合

??? GenericGridCollection & masterGridCollection();

//

//? Pointer to reference-counted data.

//? 核心数据指针

??? typedef GenericGridCollectionData RCData;

??? RCData* rcData; Logical isCounted;

// 一些指针操作符???

??? inline GenericGridCollectionData* operator-() { return? rcData; }

??? inline const GenericGridCollectionData* operator-() const

????? { return? rcData; }

??? inline GenericGridCollectionData& operator*() { return *rcData; }

??? inline const GenericGridCollectionData& operator*() const

????? { return *rcData; }

? protected:

????? GenericGridCollection *master;

//

//? Virtual member functions used only through class ReferenceCounting:

//

? private:

??? inline virtual ReferenceCounting& operator=(const ReferenceCounting& x)

????? { return operator=((GenericGridCollection&)x); }

??? inline virtual void reference(const ReferenceCounting& x)

????? { reference((GenericGridCollection&)x); }

??? inline virtual ReferenceCounting* virtualConstructor(

????? const CopyType ct = DEEP) const

????? { return new GenericGridCollection(*this, ct); }

??? aString className;

? public:

??? inline virtual aString getClassName() const { return className; }

};

//

// Stream output operator.

//

ostream& operator

#endif // _GenericGridCollection

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有