分享
 
 
 

MappedGrid.h 注释

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

#ifndef _MappedGrid

#define _MappedGrid

//

// Who to blame: Geoff Chesshire

//

#include "GenericGrid.h"

#include "MappedGridFunction.h"

#include "MappingRC.h"

#include "Box.H"

#include "GCMath.h"

// #include "DataBaseAccessFunctions.h" // Cannot include this here.

int initializeMappingList();

int destructMappingList();

class AMR_ParentChildSiblingInfo;

//

// Class for reference-counted data.

// MappedGrid类的核心数据,被单独的作为一个类管理

class MappedGridData:

public GenericGridData {

public:

// 作为数据更新操作的计算选项的枚举变量及其一些bit组合

enum {

THEmask = ENDtheGenericGridData, // bit 0

THEinverseVertexDerivative = THEmask << 1, // bit 1

THEinverseCenterDerivative = THEinverseVertexDerivative << 1, // bit 2

THEvertex = THEinverseCenterDerivative << 1, // bit 3

THEcenter = THEvertex << 1, // bit 4

THEcorner = THEcenter << 1, // bit 5

THEvertexDerivative = THEcorner << 1, // bit 6

THEcenterDerivative = THEvertexDerivative << 1, // bit 7

THEvertexJacobian = THEcenterDerivative << 1, // bit 8

THEcenterJacobian = THEvertexJacobian << 1, // bit 9

THEcellVolume = THEcenterJacobian << 1, // bit 10

THEcenterNormal = THEcellVolume << 1, // bit 11

THEcenterArea = THEcenterNormal << 1, // bit 12

THEfaceNormal = THEcenterArea << 1, // bit 13

THEfaceArea = THEfaceNormal << 1, // bit 14

THEvertexBoundaryNormal = THEfaceArea << 1, // bit 15

THEcenterBoundaryNormal = THEvertexBoundaryNormal << 1, // bit 16

THEcenterBoundaryTangent = THEcenterBoundaryNormal << 1, // bit 17

THEminMaxEdgeLength = THEcenterBoundaryTangent << 1, // bit 18

THEboundingBox = THEminMaxEdgeLength << 1, // bit 19

ENDtheMappedGridData = THEboundingBox << 1, // bit 20

THEusualSuspects = GenericGridData::THEusualSuspects

| THEmask

| THEvertex

| THEcenter

| THEvertexDerivative,

EVERYTHING = GenericGridData::EVERYTHING

| THEmask

| THEinverseVertexDerivative

| THEinverseCenterDerivative

| THEvertex

| THEcenter

| THEcorner

| THEvertexDerivative

| THEcenterDerivative

| THEvertexJacobian

| THEcenterJacobian

| THEcellVolume

| THEcenterNormal

| THEcenterArea

| THEfaceNormal

| THEfaceArea

| THEvertexBoundaryNormal

| THEcenterBoundaryNormal

| THEcenterBoundaryTangent

| THEminMaxEdgeLength

| THEboundingBox,

USEdifferenceApproximation = 1, // bit 0

COMPUTEgeometry = USEdifferenceApproximation << 1, // bit 1

COMPUTEgeometryAsNeeded = COMPUTEgeometry << 1, // bit 2

COMPUTEtheUsual = GenericGridData::COMPUTEtheUsual

| COMPUTEgeometryAsNeeded,

ISinterpolationPoint = INT_MIN, // (sign bit) bit 31

ISdiscretizationPoint = 1 << 30, // bit 30

ISghostPoint = ISdiscretizationPoint >> 1, // bit 29

ISinteriorBoundaryPoint = ISghostPoint >> 1, // bit 28

USESbackupRules = ISinteriorBoundaryPoint >> 1, // bit 27

IShiddenByRefinement = USESbackupRules >> 1, // bit 26

ISreservedBit2 = IShiddenByRefinement >> 1, // bit 25

ISreservedBit1 = ISreservedBit2 >> 1, // bit 24

ISreservedBit0 = ISreservedBit1 >> 1, // bit 23

GRIDnumberBits = ISreservedBit0 - 1, // bits 0-22

ISusedPoint = ISinterpolationPoint

| ISdiscretizationPoint

| ISghostPoint

};

Integer numberOfDimensions; // 网格维数

IntegerArray boundaryCondition; // ****** todo : clean up all these arrays**** // 边界条件类型

IntegerArray boundaryDiscretizationWidth; //边界节点离散宽度

RealArray boundingBox; // 包围盒矩形

RealArray gridSpacing; // 网格间距

Logical isAllCellCentered; // 离散类型,全部节点式,还是全部体积中心式

Logical isAllVertexCentered;

LogicalArray isCellCentered; // 某个维的离散类型

IntegerArray discretizationWidth; // ??

IntegerArray indexRange; // 索引范围

IntegerArray extendedIndexRange; // ??

int extendedRange[2][3]; // include interp pts outside mixed bndry's

IntegerArray gridIndexRange; //

IntegerArray dimension;

IntegerArray numberOfGhostPoints;

Logical useGhostPoints;

IntegerArray isPeriodic;

IntegerArray sharedBoundaryFlag;

RealArray sharedBoundaryTolerance;

RealArray minimumEdgeLength;

RealArray maximumEdgeLength;

IntegerArray I1array, I2array, I3array;

Integer *I1, *I2, *I3;

Partitioning_Type partition;

bool partitionInitialized; // true when the partition has been specified.

GenericGrid::GridTypeEnum gridType;

bool refinementGrid; // true if this is a refinement grid. 是否是加密的网格

enum BoundaryFlagEnum // 边界条件类型枚举

{

branchCutPeriodicBoundary,

periodicBoundary,

interpolationBoundary,

mixedPhysicalInterpolationBoundary,

physicalBoundary

};

// 各个边界的类型

BoundaryFlagEnum boundaryFlag[2][3];

// 网格点MASK数组

IntegerMappedGridFunction* mask;

// 网格点的逆雅格比??

RealMappedGridFunction* inverseVertexDerivative;

// RealMappedGridFunction* inverseVertexDerivative2D;

// RealMappedGridFunction* inverseVertexDerivative1D;

RealMappedGridFunction* inverseCenterDerivative;

// RealMappedGridFunction* inverseCenterDerivative2D;

// RealMappedGridFunction* inverseCenterDerivative1D;

// 网格点坐标数组

RealMappedGridFunction* vertex;

// RealMappedGridFunction* vertex2D;

// RealMappedGridFunction* vertex1D;

// 网格单元中心坐标数组

RealMappedGridFunction* center;

// RealMappedGridFunction* center2D;

// RealMappedGridFunction* center1D;

// 网格单元角点坐标

RealMappedGridFunction* corner;

// RealMappedGridFunction* corner2D;

// RealMappedGridFunction* corner1D;

// 网格点导数 ??

RealMappedGridFunction* vertexDerivative;

// RealMappedGridFunction* vertexDerivative2D;

// RealMappedGridFunction* vertexDerivative1D;

// 网格单元中心导数 ??

RealMappedGridFunction* centerDerivative;

// RealMappedGridFunction* centerDerivative2D;

// RealMappedGridFunction* centerDerivative1D;

// 网格点雅格比矩阵

RealMappedGridFunction* vertexJacobian;

// 网格中心雅格比矩阵

RealMappedGridFunction* centerJacobian;

// 网格单元体积

RealMappedGridFunction* cellVolume;

// 网格单元centerNormal

RealMappedGridFunction* centerNormal;

// RealMappedGridFunction* centerNormal2D;

// RealMappedGridFunction* centerNormal1D;

// 网格单元centerArea

RealMappedGridFunction* centerArea;

// RealMappedGridFunction* centerArea2D;

// RealMappedGridFunction* centerArea1D;

RealMappedGridFunction* faceNormal;

// RealMappedGridFunction* faceNormal2D;

// RealMappedGridFunction* faceNormal1D;

RealMappedGridFunction* faceArea;

// RealMappedGridFunction* faceArea2D;

// RealMappedGridFunction* faceArea1D;

RealMappedGridFunction* vertexBoundaryNormal[3][2];

RealMappedGridFunction* centerBoundaryNormal[3][2];

RealMappedGridFunction* centerBoundaryTangent[3][2];

MappingRC mapping;

Box box;

// 构造函数

MappedGridData(const Integer numberOfDimensions_ = 0);

// 拷贝构造函数

MappedGridData(

const MappedGridData& x,

const CopyType ct = DEEP);

// 解构函数

virtual ~MappedGridData();

MappedGridData& operator=(const MappedGridData& x);

void reference(const MappedGridData& x);

virtual void breakReference();

virtual void consistencyCheck() const;

// HDF数据文件的读取和写入

virtual Integer get(const GenericDataBase& db,

const aString& name,

bool getMapping=true ); // for AMR grids we may not get the mapping.

virtual Integer put(GenericDataBase& db,

const aString& name,

bool putMapping = true // for AMR grids we may not save the mapping.

) const;

// 更新

inline Integer update(

const Integer what = THEusualSuspects,

const Integer how = COMPUTEtheUsual)

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

inline Integer update(

MappedGridData& x,

const Integer what = THEusualSuspects,

const Integer how = COMPUTEtheUsual)

{ return update((GenericGridData&)x, what, how); }

virtual void destroy(const Integer what = NOTHING);

void specifyProcesses(const Range& range);

void initialize(const Integer& numberOfDimensions_);

// remove items from what that are not appropriate for the gridType:

// 根据网格类型删除不必要的数据

virtual int getWhatForGrid(const int what) const;

void initializePartition(); // initialize the partition object

//

// The number of dimensions of the domain.

// Domain(计算域)的维数

inline const Integer domainDimension() const

{

if ( mapping.mapPointer->getClassName()!="Mapping" )

return mapping.mapPointer->getDomainDimension();

else

return numberOfDimensions;

}

//

// The number of dimensions of the range.

// range(物理域)维数

inline const Integer rangeDimension() const

{

if ( mapping.mapPointer->getClassName()!="Mapping" )

return mapping.mapPointer->getRangeDimension();

else

return numberOfDimensions;

}

protected:

virtual Integer update(

GenericGridData& x,

const Integer what = THEusualSuspects,

const Integer how = COMPUTEtheUsual);

private:

Integer update1(

MappedGridData& y,

const Integer& what,

const Integer& how,

Integer& computeNeeded);

Integer update2(

MappedGridData& y,

const Integer& what,

const Integer& how,

Integer& computeNeeded);

Integer updateUnstructuredGrid(

MappedGridData& y,

const Integer& what,

const Integer& how,

Integer& computeNeeded);

// 网格几何数据计算,这是MappedGrid的一个关键操作

Integer computeGeometry(

const Integer& what,

const Integer& how);

// 由差分方法计算网格几何数据计算,在大多数情况下采用这种方法,

// 除非几何映射和逆映射有解析表达,就用以下的omputeGeometryFromMapping由

// Mapping成员调用其映射函数来计算

Integer computeGeometryWithDifferences(

const Integer& what,

const Integer& how);

Integer computeGeometryFromMapping(

const Integer& what,

const Integer& how);

// 非结构网格的几何数据计算,这个方法实际上还没实现

Integer computeUnstructuredGeometry(

const Integer& what,

const Integer& how);

//

// Virtual member functions used only through class ReferenceCounting:

// 有关引用操作的虚成员函数

private:

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

{ return operator=((MappedGridData&)x); }

inline virtual void reference(const ReferenceCounting& x)

{ reference((MappedGridData&)x); }

inline virtual ReferenceCounting* virtualConstructor(

const CopyType ct = DEEP) const

{ return new MappedGridData(*this, ct); }

aString className;

public:

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

};

// OK, 真正的MappedGrid类

class MappedGrid:

public GenericGrid {

public:

// Public constants:

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

// update() and destroy()函数的第一参数列表

enum {

THEmask = MappedGridData::THEmask,

THEinverseVertexDerivative = MappedGridData::THEinverseVertexDerivative,

THEinverseCenterDerivative = MappedGridData::THEinverseCenterDerivative,

THEvertex = MappedGridData::THEvertex,

THEcenter = MappedGridData::THEcenter,

THEcorner = MappedGridData::THEcorner,

THEvertexDerivative = MappedGridData::THEvertexDerivative,

THEcenterDerivative = MappedGridData::THEcenterDerivative,

THEvertexJacobian = MappedGridData::THEvertexJacobian,

THEcenterJacobian = MappedGridData::THEcenterJacobian,

THEcellVolume = MappedGridData::THEcellVolume,

THEcenterNormal = MappedGridData::THEcenterNormal,

THEcenterArea = MappedGridData::THEcenterArea,

THEfaceNormal = MappedGridData::THEfaceNormal,

THEfaceArea = MappedGridData::THEfaceArea,

THEvertexBoundaryNormal = MappedGridData::THEvertexBoundaryNormal,

THEcenterBoundaryNormal = MappedGridData::THEcenterBoundaryNormal,

THEcenterBoundaryTangent = MappedGridData::THEcenterBoundaryTangent,

THEminMaxEdgeLength = MappedGridData::THEminMaxEdgeLength,

THEboundingBox = MappedGridData::THEboundingBox,

THEusualSuspects = MappedGridData::THEusualSuspects,

EVERYTHING = MappedGridData::EVERYTHING

};

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

// update() and destroy()函数的第二参数列表

enum {

USEdifferenceApproximation = MappedGridData::USEdifferenceApproximation,

COMPUTEgeometry = MappedGridData::COMPUTEgeometry,

COMPUTEgeometryAsNeeded = MappedGridData::COMPUTEgeometryAsNeeded,

COMPUTEtheUsual = MappedGridData::COMPUTEtheUsual

};

// Mask bits to access data in mask.

// 网格点MASK含义

enum {

ISinterpolationPoint = MappedGridData::ISinterpolationPoint,

ISdiscretizationPoint = MappedGridData::ISdiscretizationPoint,

ISghostPoint = MappedGridData::ISghostPoint,

ISinteriorBoundaryPoint = MappedGridData::ISinteriorBoundaryPoint,

USESbackupRules = MappedGridData::USESbackupRules,

IShiddenByRefinement = MappedGridData::IShiddenByRefinement,

ISreservedBit2 = MappedGridData::ISreservedBit2,

ISreservedBit1 = MappedGridData::ISreservedBit1,

ISreservedBit0 = MappedGridData::ISreservedBit0,

GRIDnumberBits = MappedGridData::GRIDnumberBits,

ISusedPoint = MappedGridData::ISusedPoint

};

// should be the same as in MappedGridData

// 边界类型

enum BoundaryFlagEnum

{

branchCutPeriodicBoundary =MappedGridData::branchCutPeriodicBoundary,

periodicBoundary =MappedGridData::periodicBoundary,

interpolationBoundary =MappedGridData::interpolationBoundary,

mixedPhysicalInterpolationBoundary=MappedGridData::mixedPhysicalInterpolationBoundary,

physicalBoundary =MappedGridData::physicalBoundary

};

// Public data.

// 公共数据区

// 家族树信息指针

AMR_ParentChildSiblingInfo* parentChildSiblingInfo;

//

// Public member functions for access to data.

// 公共成员函数

// 返回家族树信息指针

AMR_ParentChildSiblingInfo* getParentChildSiblingInfo(){return parentChildSiblingInfo;}

void setParentChildSiblingInfo(AMR_ParentChildSiblingInfo *ptr){parentChildSiblingInfo=ptr;}

//

// Boxlib box.

// 返回网格的包围盒

inline const Box& box() const { return rcData->box; }

//

// Boundary condition flags.

// 返回边界条件类型(一个整形数组)

inline const IntegerArray& boundaryCondition() const

{ return rcData->boundaryCondition; }

// 返回指定边界的边界条件类型(一个整形数)

inline const Integer& boundaryCondition(

const Integer& ks,

const Integer& kd) const

{ return rcData->boundaryCondition(ks,kd); }

MappedGrid::BoundaryFlagEnum boundaryFlag(int side,int axis ) const;

//

// Boundary condition stencil.

// 返回边界离散宽度(一个整形数组)

inline const IntegerArray& boundaryDiscretizationWidth() const

{ return rcData->boundaryDiscretizationWidth; }

// 返回指定边界的边界离散宽度(一个整形数)

inline const Integer& boundaryDiscretizationWidth(

const Integer& ks,

const Integer& kd) const

{ return rcData->boundaryDiscretizationWidth(ks,kd); }

//

// Bounding box for all grid vertices.

// 返回所有网格点的包围盒

inline const RealArray& boundingBox() const

{ return rcData->boundingBox; }

// 返回指定边界的包围盒??

inline const Real& boundingBox(

const Integer& ks,

const Integer& kd) const

{ return rcData->boundingBox(ks,kd); }

// Return the partition used in this grid

// 返回当前Grid中用到的分区??

const Partitioning_Type& getPartition(){return rcData->partition;} //

//

// Grid spacing.

// 网格步长(一个浮点数组)?

inline const RealArray& gridSpacing() const

{ return rcData->gridSpacing; }

// 指定坐标方向上的网格步长(一个浮点数)??

inline const Real& gridSpacing(const Integer& kd) const

{ return rcData->gridSpacing(kd); }

//

// Grid type, structured or unstructured.

// 网格类型(结构化?非结构化??)

GenericGrid::GridTypeEnum getGridType() const

{ return rcData->gridType; }

//

// get the name of the grid.

// 返回网格名称

aString getName() const;

//

// Cell-centered in each direction.

// 在每个坐标方向上的离散类型是否为Cell-centered(一个逻辑数组)?

inline const LogicalArray& isCellCentered() const

{ return rcData->isCellCentered; }

// 在指定坐标方向上的离散类型是否为Cell-centered?

inline const Logical& isCellCentered(const Integer& kd) const

{ return rcData->isCellCentered(kd); }

//

// Cell-centered in all directions.

// 在所有坐标方向上的离散类型是否为Cell-centered(一个逻辑值)

inline const Logical& isAllCellCentered() const

{ return rcData->isAllCellCentered; }

//

// Vertex-centered in all directions.

// 在每个坐标方向上的离散类型是否为Vertex-centered(一个逻辑数组)?

inline const Logical& isAllVertexCentered() const

{ return rcData->isAllVertexCentered; }

// is the grid rectangular

// Grid是否为矩形??

bool isRectangular() const;

// is the grid a refinement grid:

// Grid是否为加密网格?

bool isRefinementGrid() const { return rcData->refinementGrid; }

bool& isRefinementGrid(){ return rcData->refinementGrid; }

// show which geometry arrays are built

// 显示创建的几何组???

int displayComputedGeometry(FILE *file=stdout ) const;

// return size of this object

// 返回对象存储空间尺寸

virtual real sizeOf(FILE *file = NULL ) const;

//

// Interior discretization stencil width.

// 内部点离散宽度

inline const IntegerArray& discretizationWidth() const

{ return rcData->discretizationWidth; }

// 指定坐标方向上的内部点离散宽度

inline const Integer& discretizationWidth(const Integer& kd) const

{ return rcData->discretizationWidth(kd); }

//

// Index range, computational points.

// 返回每个方向上需要计算的网格点的索引范围,是一个整形数组

inline const IntegerArray& indexRange() const

{ return rcData->indexRange; }

// 返回指定坐标方向上某一边的索引(一个整数)

inline const Integer& indexRange(

const Integer& ks,

const Integer& kd) const

{ return rcData->indexRange(ks,kd); }

//

// Index range plus interpolation points.

// 同上2个函数,但是包含了插值点的索引

inline const IntegerArray& extendedIndexRange() const

{ return rcData->extendedIndexRange; }

inline const Integer& extendedIndexRange(

const Integer& ks,

const Integer& kd) const

{ return rcData->extendedIndexRange(ks,kd); }

//

// Index range of gridpoints.

// 网格点的索引范围

inline const IntegerArray& gridIndexRange() const

{ return rcData->gridIndexRange; }

inline const Integer& gridIndexRange(

const Integer& ks,

const Integer& kd) const

{ return rcData->gridIndexRange(ks,kd); }

//

// Dimensions of grid arrays.

// 返回网格数组的dimension(尺寸?)

inline const IntegerArray& dimension() const

{ return rcData->dimension; }

inline const Integer& dimension(

const Integer& ks,

const Integer& kd) const

{ return rcData->dimension(ks,kd); }

//

// Range for all discretization, boundary and interpolation points.

//

inline const int& extendedRange( int side, int axis ) const

{ return rcData->extendedRange[side][axis]; }

IntegerArray extendedRange() const;

//

// Number of ghost points.

// 虚点个数

inline const IntegerArray& numberOfGhostPoints() const

{ return rcData->numberOfGhostPoints; }

inline const Integer& numberOfGhostPoints(

const Integer& ks,

const Integer& kd) const

{ return rcData->numberOfGhostPoints(ks,kd); }

//

// Indicate whether ghost points may be used for interpolation.

// 虚点是否可以用作插值?

inline const Logical& useGhostPoints() const

{ return rcData->useGhostPoints; }

//

// Grid periodicity.

// 网格周期性

inline const IntegerArray& isPeriodic() const

{ return rcData->isPeriodic; }

inline const Integer& isPeriodic(const Integer& kd) const

{ return rcData->isPeriodic(kd); }

//

// The number of dimensions of the range.

// Range的维数

inline const Integer& numberOfDimensions() const

{ return rcData->numberOfDimensions; }

//

// The number of dimensions of the domain.

// Domain的维数

inline const Integer domainDimension() const

{ return rcData->domainDimension(); }

//

// The number of dimensions of the range.

// Range的维数?和numberOfDimensions有何区别??

inline const Integer rangeDimension() const

{ return rcData->rangeDimension(); }

//

// Shared boundary flags.

// 共享边界标识??如何共享??

inline const IntegerArray& sharedBoundaryFlag() const

{ return rcData->sharedBoundaryFlag; }

inline const Integer& sharedBoundaryFlag(

const Integer& ks,

const Integer& kd) const

{ return rcData->sharedBoundaryFlag(ks,kd); }

//

// Shared boundary tolerance.

// 共享边界配合公差,看来是边界对接

inline const RealArray& sharedBoundaryTolerance() const

{ return rcData->sharedBoundaryTolerance; }

inline const Real& sharedBoundaryTolerance(

const Integer& ks,

const Integer& kd) const

{ return rcData->sharedBoundaryTolerance(ks,kd); }

//

// Minimum grid cell-edge length.

// 最小网格单元长度

inline const RealArray& minimumEdgeLength() const

{ return rcData->minimumEdgeLength; }

inline const Real& minimumEdgeLength(const Integer& kd) const

{ return rcData->minimumEdgeLength(kd); }

//

// Maximum grid cell-edge length.

// 最大网格单元长度

inline const RealArray& maximumEdgeLength() const

{ return rcData->maximumEdgeLength; }

inline const Real& maximumEdgeLength(const Integer& kd) const

{ return rcData->maximumEdgeLength(kd); }

//

// delta x for rectangular grids

// 设置矩形网格的步长

int getDeltaX( Real dx[3] ) const;

// get delta x and corners of a rectangular grid.

// 取得矩形网格的步长和对角线坐标

int getRectangularGridParameters( Real dx[3], Real xab[2][3] ) const;

//

// Indirect addressing for periodic grids.

// 周期性网格的简介寻址

const Integer* I1() const { return rcData->I1; }

const Integer* I2() const { return rcData->I2; }

const Integer* I3() const { return rcData->I3; }

//

// Public member functions for setting data.

// 设置数据的公共成员函数

void setNumberOfDimensions(const Integer& numberOfDimensions_);

void setBoundaryCondition(const Integer& ks,

const Integer& kd,

const Integer& boundaryCondition_);

void setBoundaryFlag( int side, int axis, MappedGridData::BoundaryFlagEnum bc );

void setBoundaryDiscretizationWidth(const Integer& ks,

const Integer& kd,

const Integer& boundaryDiscretizationWidth_);

void setIsCellCentered(const Integer& kd,

const Logical& isCellCentered_);

void setDiscretizationWidth(const Integer& kd,

const Integer& discretizationWidth_);

void setGridIndexRange(const Integer& ks,

const Integer& kd,

const Integer& gridIndexRange_);

// Use a given mapping.

// 设置此网格的映射对象

void setMapping(Mapping& x);

void setMapping(MappingRC& x);

void setNumberOfGhostPoints(const Integer& ks,

const Integer& kd,

const Integer& numberOfGhostPoints_);

void setUseGhostPoints(const Logical& useGhostPoints_);

void setIsPeriodic(const Integer& kd, const Mapping::periodicType& isPeriodic_);

void setSharedBoundaryFlag(const Integer& ks,

const Integer& kd,

const Integer& sharedBoundaryFlag_);

void setSharedBoundaryTolerance(const Integer& ks,

const Integer& kd,

const Real& sharedBoundaryTolerance_);

//

// Discretization point mask.

// 返回网格点MASK数组

inline IntegerMappedGridFunction& mask()

{ return *rcData->mask; }

inline const IntegerMappedGridFunction& mask() const

{ return ((MappedGrid*)this)->mask(); }

//

// Inverse derivative of the mapping at the vertices.

// 返回网格映射的逆雅格比矩阵

inline RealMappedGridFunction& inverseVertexDerivative()

{ return *rcData->inverseVertexDerivative; }

inline const RealMappedGridFunction& inverseVertexDerivative() const

{ return ((MappedGrid*)this)->inverseVertexDerivative(); }

// //

// // Inverse derivative at the vertices, for a two-dimensional grid.

// //

// inline RealMappedGridFunction& inverseVertexDerivative2D()

// { return *rcData->inverseVertexDerivative2D; }

// inline const RealMappedGridFunction& inverseVertexDerivative2D() const

// { return ((MappedGrid*)this)->inverseVertexDerivative2D(); }

// //

// // Inverse derivative at the vertices, for a one-dimensional grid.

// //

// inline RealMappedGridFunction& inverseVertexDerivative1D()

// { return *rcData->inverseVertexDerivative1D; }

// inline const RealMappedGridFunction& inverseVertexDerivative1D() const

// { return ((MappedGrid*)this)->inverseVertexDerivative1D(); }

//

// Inverse derivative at the discretization centers.

//

inline RealMappedGridFunction& inverseCenterDerivative()

{ return *rcData->inverseCenterDerivative; }

inline const RealMappedGridFunction& inverseCenterDerivative() const

{ return ((MappedGrid*)this)->inverseCenterDerivative(); }

// //

// // Inverse derivative at the discretization centers, for a two-dimensional grid

// //

// inline RealMappedGridFunction& inverseCenterDerivative2D()

// { return *rcData->inverseCenterDerivative2D; }

// inline const RealMappedGridFunction& inverseCenterDerivative2D() const

// { return ((MappedGrid*)this)->inverseCenterDerivative2D(); }

// //

// // Inverse derivative at the discretization centers, for a one-dimensional grid

// //

// inline RealMappedGridFunction& inverseCenterDerivative1D()

// { return *rcData->inverseCenterDerivative1D; }

// inline const RealMappedGridFunction& inverseCenterDerivative1D() const

// { return ((MappedGrid*)this)->inverseCenterDerivative1D(); }

//

// Vertex coordinates.

// 返回网格点坐标

inline RealMappedGridFunction& vertex()

{ return *rcData->vertex; }

inline const RealMappedGridFunction& vertex() const

{ return ((MappedGrid*)this)->vertex(); }

// //

// // Vertex coordinates, for a two-dimensional grid.

// //

// inline RealMappedGridFunction& vertex2D()

// { return *rcData->vertex2D; }

// inline const RealMappedGridFunction& vertex2D() const

// { return ((MappedGrid*)this)->vertex2D(); }

// //

// // Vertex coordinates, for a one-dimensional grid.

// //

// inline RealMappedGridFunction& vertex1D()

// { return *rcData->vertex1D; }

// inline const RealMappedGridFunction& vertex1D() const

// { return ((MappedGrid*)this)->vertex1D(); }

//

// Coordinates of discretization centers.

// 返回中心坐标

inline RealMappedGridFunction& center()

{ return *rcData->center; }

inline const RealMappedGridFunction& center() const

{ return ((MappedGrid*)this)->center(); }

// //

// // Coordinates of discretization centers, for a two-dimensional grid.

// //

// inline RealMappedGridFunction& center2D()

// { return *rcData->center2D; }

// inline const RealMappedGridFunction& center2D() const

// { return ((MappedGrid*)this)->center2D(); }

// //

// // Coordinates of discretization centers, for a one-dimensional grid.

// //

// inline RealMappedGridFunction& center1D()

// { return *rcData->center1D; }

// inline const RealMappedGridFunction& center1D() const

// { return ((MappedGrid*)this)->center1D(); }

//

// Coordinates of control volume corners.

// 返回有限体积元的角点坐标

inline RealMappedGridFunction& corner()

{ return *rcData->corner; }

inline const RealMappedGridFunction& corner() const

{ return ((MappedGrid*)this)->corner(); }

// //

// // Coordinates of control volume corners, for a two-dimensional grid.

// //

// inline RealMappedGridFunction& corner2D()

// { return *rcData->corner2D; }

// inline const RealMappedGridFunction& corner2D() const

// { return ((MappedGrid*)this)->corner2D(); }

// //

// // Coordinates of control volume corners, for a one-dimensional grid.

// //

// inline RealMappedGridFunction& corner1D()

// { return *rcData->corner1D; }

// inline const RealMappedGridFunction& corner1D() const

// { return ((MappedGrid*)this)->corner1D(); }

//

// Derivative of the mapping at the vertices.

// 返回网格映射的雅格比矩阵

inline RealMappedGridFunction& vertexDerivative()

{ return *rcData->vertexDerivative; }

inline const RealMappedGridFunction& vertexDerivative() const

{ return ((MappedGrid*)this)->vertexDerivative(); }

// //

// // Derivative of the mapping at the vertices, for a two-dimensional grid.

// //

// inline RealMappedGridFunction& vertexDerivative2D()

// { return *rcData->vertexDerivative2D; }

// inline const RealMappedGridFunction& vertexDerivative2D() const

// { return ((MappedGrid*)this)->vertexDerivative2D(); }

// //

// // Derivative of the mapping at the vertices, for a one-dimensional grid.

// //

// inline RealMappedGridFunction& vertexDerivative1D()

// { return *rcData->vertexDerivative1D; }

// inline const RealMappedGridFunction& vertexDerivative1D() const

// { return ((MappedGrid*)this)->vertexDerivative1D(); }

//

// Derivative of the mapping at the discretization centers.

//

inline RealMappedGridFunction& centerDerivative()

{ return *rcData->centerDerivative; }

inline const RealMappedGridFunction& centerDerivative() const

{ return ((MappedGrid*)this)->centerDerivative(); }

// //

// // Derivative at the discretization centers, for a two-dimensional grid.

// //

// inline RealMappedGridFunction& centerDerivative2D()

// { return *rcData->centerDerivative2D; }

// inline const RealMappedGridFunction& centerDerivative2D() const

// { return ((MappedGrid*)this)->centerDerivative2D(); }

// //

// // Derivative at the discretization centers, for a one-dimensional grid.

// //

// inline RealMappedGridFunction& centerDerivative1D()

// { return *rcData->centerDerivative1D; }

// inline const RealMappedGridFunction& centerDerivative1D() const

// { return ((MappedGrid*)this)->centerDerivative1D(); }

//

// Determinant of vertexDerivative.

// 返回网格映射的逆雅格比矩阵的行列式

inline RealMappedGridFunction& vertexJacobian()

{ return *rcData->vertexJacobian; }

inline const RealMappedGridFunction& vertexJacobian() const

{ return ((MappedGrid*)this)->vertexJacobian(); }

//

// Determinant of centerDerivative.

//

inline RealMappedGridFunction& centerJacobian()

{ return *rcData->centerJacobian; }

inline const RealMappedGridFunction& centerJacobian() const

{ return ((MappedGrid*)this)->centerJacobian(); }

//

// Cell Volume.

// 返回各有限体积元的体积

inline RealMappedGridFunction& cellVolume()

{ return *rcData->cellVolume; }

inline const RealMappedGridFunction& cellVolume() const

{ return ((MappedGrid*)this)->cellVolume(); }

//

// Cell-center normal vector, normalized to cell-face area.

// 返回有Cell-center法向矢量(垂直于cell表面),

inline RealMappedGridFunction& centerNormal()

{ return *rcData->centerNormal; }

inline const RealMappedGridFunction& centerNormal() const

{ return ((MappedGrid*)this)->centerNormal(); }

// //

// // Cell-center normal vector, for a two-dimensional grid.

// //

// inline RealMappedGridFunction& centerNormal2D()

// { return *rcData->centerNormal2D; }

// inline const RealMappedGridFunction& centerNormal2D() const

// { return ((MappedGrid*)this)->centerNormal2D(); }

// //

// // Cell-center normal vector, for a one-dimensional grid.

// //

// inline RealMappedGridFunction& centerNormal1D()

// { return *rcData->centerNormal1D; }

// inline const RealMappedGridFunction& centerNormal1D() const

// { return ((MappedGrid*)this)->centerNormal1D(); }

//

// Cell-center area (Length of cell-center normal vector).

// 返回Cell-center面积(即Cell-center法向矢量的模)

inline RealMappedGridFunction& centerArea()

{ return *rcData->centerArea; }

inline const RealMappedGridFunction& centerArea() const

{ return ((MappedGrid*)this)->centerArea(); }

// //

// // Cell-center area, for a two-dimensional grid.

// //

// inline RealMappedGridFunction& centerArea2D()

// { return *rcData->centerArea2D; }

// inline const RealMappedGridFunction& centerArea2D() const

// { return ((MappedGrid*)this)->centerArea2D(); }

// //

// // Cell-center area, for a one-dimensional grid.

// //

// inline RealMappedGridFunction& centerArea1D()

// { return *rcData->centerArea1D; }

// inline const RealMappedGridFunction& centerArea1D() const

// { return ((MappedGrid*)this)->centerArea1D(); }

//

// Cell-face normal vector, normalized to cell-face area.

// 这几个东西有些混淆了

inline RealMappedGridFunction& faceNormal()

{ return *rcData->faceNormal; }

inline const RealMappedGridFunction& faceNormal() const

{ return ((MappedGrid*)this)->faceNormal(); }

// //

// // Cell-face normal vector, for a two-dimensional grid.

// //

// inline RealMappedGridFunction& faceNormal2D()

// { return *rcData->faceNormal2D; }

// inline const RealMappedGridFunction& faceNormal2D() const

// { return ((MappedGrid*)this)->faceNormal2D(); }

// //

// // Cell-face normal vector, for a one-dimensional grid.

// //

// inline RealMappedGridFunction& faceNormal1D()

// { return *rcData->faceNormal1D; }

// inline const RealMappedGridFunction& faceNormal1D() const

// { return ((MappedGrid*)this)->faceNormal1D(); }

//

// Cell-face area.

//

inline RealMappedGridFunction& faceArea()

{ return *rcData->faceArea; }

inline const RealMappedGridFunction& faceArea() const

{ return ((MappedGrid*)this)->faceArea(); }

// //

// // Cell-face area, for a two-dimensional grid.

// //

// inline RealMappedGridFunction& faceArea2D()

// { return *rcData->faceArea2D; }

// inline const RealMappedGridFunction& faceArea2D() const

// { return ((MappedGrid*)this)->faceArea2D(); }

// //

// // Cell-face area, for a one-dimensional grid.

// //

// inline RealMappedGridFunction& faceArea1D()

// { return *rcData->faceArea1D; }

// inline const RealMappedGridFunction& faceArea1D() const

// { return ((MappedGrid*)this)->faceArea1D(); }

//

// Outward unit normal vectors at the vertices on each boundary.

//

inline RealMappedGridFunction& vertexBoundaryNormal(

const Integer& ks,

const Integer& kd)

{ return *rcData->vertexBoundaryNormal[kd][ks]; }

inline const RealMappedGridFunction& vertexBoundaryNormal(

const Integer& ks,

const Integer& kd) const

{ return ((MappedGrid*)this)->vertexBoundaryNormal(ks,kd); }

//

// Outward unit normal vectors at the centers on each boundary.

//

inline RealMappedGridFunction& centerBoundaryNormal(

const Integer& ks,

const Integer& kd)

{ return *rcData->centerBoundaryNormal[kd][ks]; }

inline const RealMappedGridFunction& centerBoundaryNormal(

const Integer& ks,

const Integer& kd) const

{ return ((MappedGrid*)this)->centerBoundaryNormal(ks,kd); }

//

// Unit tangent vectors at the centers on each boundary.

//

inline RealMappedGridFunction& centerBoundaryTangent(

const Integer& ks,

const Integer& kd)

{ return *rcData->centerBoundaryTangent[kd][ks]; }

inline const RealMappedGridFunction& centerBoundaryTangent(

const Integer& ks,

const Integer& kd) const

{ return ((MappedGrid*)this)->centerBoundaryTangent(ks,kd); }

//

// Grid mapping.

// 有关网格的映射对象

inline MappingRC& mapping() { return rcData->mapping; }

inline const MappingRC& mapping() const { return rcData->mapping; }

//

// Public member functions.

//

// Default constructor.

//

// If numberOfDimensions_==0 (e.g., by default) then create a null

// MappedGrid. Otherwise, create a MappedGrid with the given

// number of dimensions.

//

MappedGrid(const Integer numberOfDimensions_ = 0);

// initialize a NULL MappedGrid

void init(int numberOfDimensions_);

//

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

//

MappedGrid(

const MappedGrid& x,

const CopyType ct = DEEP);

//

// Constructor from a mapping.

//

MappedGrid(Mapping& mapping);

MappedGrid(MappingRC& mapping);

//

// Destructor.

//

virtual ~MappedGrid();

//

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

//

MappedGrid& operator=(const MappedGrid& x);

//

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

//

void reference(const MappedGrid& x);

void reference(MappedGridData& x);

//

// Use a given mapping.

//

void reference(Mapping& x);

void reference(MappingRC& x);

//

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

//

virtual void breakReference();

//

// Change the grid to be all vertex-centered.

//

virtual void changeToAllVertexCentered();

//

// Change the grid to be all cell-centered.

//

virtual void changeToAllCellCentered();

//

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

//

virtual void consistencyCheck() const;

//

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

//

virtual Integer get(const GenericDataBase& db,

const aString& name,

bool getMapping=true ); // for AMR grids we may not get the mapping.

virtual Integer put(GenericDataBase& db,

const aString& name,

bool putMapping = true // for AMR grids we may not save the mapping.

) 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.

//

inline Integer update(

MappedGrid& x,

const Integer what = THEusualSuspects,

const Integer how = COMPUTEtheUsual)

{ return update((GenericGrid&)x, what, how); }

//

// Destroy optional grid data.

//

virtual void destroy(const Integer what = NOTHING);

#ifdef ADJUST_FOR_PERIODICITY

//

// Adjust the inverted coordinates for periodicity.

//

void adjustForPeriodicity(

const RealArray& r,

const LogicalArray& whereMask);

#endif // ADJUST_FOR_PERIODICITY

//

// Adjust the inverted coordinates of boundary points

// in cases where the points lie on a shared boundary.

//

void adjustBoundary(

MappedGrid& g2,

const Integer& ks1,

const Integer& kd1,

const RealArray& r2,

const LogicalArray& whereMask);

//

// Compute the condition number of the mapping inverse.

// 计算映射逆矩阵的条件数

// The condition number is the max norm (max absolute row sum) of the matrix

//

// [ 1/dr2 0 ] [ rx2 ry2 ] [ xr1 xs1 ] [ dr1 0 ]

// [ 0 1/ds2 ] [ sx2 sy2 ] [ yr1 ys1 ] [ 0 ds1 ]

//

void getInverseCondition(

MappedGrid& g2,

const RealArray& xr1,

const RealArray& rx2,

const RealArray& condition,

const LogicalArray& whereMask);

//

// Specify the set of processes over which MappedGridFunctions are distributed.

// We now support only the specification of a contiguous range of process IDs.

// 设置当前网格在并行计算时可用的处理器编号,目前只支持编号连续的处理器

void specifyProcesses(const Range& range);

//

// Initialize the MappedGrid with the given number of dimensions.

//

virtual void initialize(

const Integer& numberOfDimensions_);

//

// Pointer to reference-counted data.

// ******* 当前MappedGrid对象核心数据

typedef MappedGridData RCData;

MappedGridData* rcData; Logical isCounted;

inline MappedGridData* operator->() { return rcData; }

inline const MappedGridData* operator->() const { return rcData; }

inline MappedGridData& operator*() { return *rcData; }

inline const MappedGridData& operator*() const { return *rcData; }

private:

virtual Integer update(

GenericGrid& x,

const Integer what = THEusualSuspects,

const Integer how = COMPUTEtheUsual);

protected:

//

// The following functions are declared protected here in order to disallow

// access to the corresponding functions in class GenericGrid.

//

inline virtual void initialize() {

cerr << "virtual void MappedGrid::initialize() must not be called!"

<< "It must have been called illegally through the base class GenericGridCollection."

<< endl;

abort();

}

//

// Virtual member functions used only through class ReferenceCounting:

//

private:

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

{ return operator=((MappedGrid&)x); }

inline virtual void reference(const ReferenceCounting& x)

{ reference((MappedGrid&)x); }

inline virtual ReferenceCounting* virtualConstructor(

const CopyType ct = DEEP) const

{ return new MappedGrid(*this, ct); }

aString className;

public:

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

Integer updateMappedGridPointers(const Integer what);

};

//

// Stream output operator.

//

ostream& operator<<(ostream& s, const MappedGrid& g);

#endif // _MappedGrid

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
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- 王朝網路 版權所有