LibMesh 数据结构类

LibMesh 数据结构类

212人阅读 评论(0) 收藏 举报
分类:


   SparseMatrix<T>模版类

   

 可见, SparseMatrix类的继承关系和linearsolver类很一致, SparseMatrix类的方法主要是矩阵操作,类似petsc里面的过程了。到稀疏矩阵,问题基本落到解线性方程组了。所以,支持各类稀疏矩阵solver中的矩阵操作方法。


  同理,NumericVector<T>模版类

  

 


  FEGenericBase<T>模版类

   


  工厂模式生产 build

  

  1{

  2        switch (dim)

  3        {

  4                //0D

  5                case 0:

  6                {

  7                  switch (fet.family)

  8                  {

  9                  case CLOUGH:

 10                        {

 11                          AutoPtr<FEBase> ap(new FE<0, CLOUGH>(fet));

 12                          return ap;

 13                        }

 14                  case HERMITE:

 15                        {

 16                          AutoPtr<FEBase> ap(new FE<0, HERMITE>(fet));

 17                          return ap;

 18                        }

 19 

 20                  case LAGRANGE:

 21                        {

 22                          AutoPtr<FEBase> ap(new FE<0, LAGRANGE>(fet));

 23                          return ap;

 24                        }

 25 

 26                  case L2_LAGRANGE:

 27                        {

 28                          AutoPtr<FEBase> ap(new FE<0, L2_LAGRANGE>(fet));

 29                          return ap;

 30 

 31                //      ...

 32 

 33                   default:

 34                        libmesh_error_msg("ERROR:Bad FEType.family = " << fet.family);

 35                  }

 36                }

 37 

 38                // 1D ...

 39                // 2D ...

 40                // 3D ...

 41        }

 42        AutoPtr<FEBase> ap(NULL);

 43        return ap;

 44}


    get_phi() 返回积分点处phi

    get_dphi(), get_dphidx(), get_d2phidx2(), get_d2phidxi2() 返回phi的一阶,二阶(global坐标,local坐标)在积分点上的偏导

    get_xyz(), 返回积分点处坐标

         get_JxW(), get_dxyzdeta(), get_d2xyzdeta2(), get_dxidx(), 返回jacobian,global对local坐标的一阶,二阶偏导

         get_type(), return element type that the current shape functions have been calculated for.

         get_fe_type(),

         get_fe_map(),  return the mapping object

        This class forms the foundation from which generic finite elements may be derived. All calls to static members of the FE classes should be requested through FEInterface, this interface class offers sort-of runtime polymorphism for the templates FE classes. Even internal library classes, such as DoFMap, request the number of DoF's through this interface class. This class is well " at the heart " of the library, so things here should better remain unchanged.


     QBase 模版类

     


        工厂生产build : 通过string_name生成各类具体的积分方法,运行时多态设计。

        type(), 返回具体积分方法

        get_elem_type(), 返回单元类型

        get_p_level(), 返回 p_level refinement

       get_dim()

       get_points(),  返回一个vector,存master单元上的积分点位置

       get_weights(),

       qp(const unsigned int i) const, 返回参考单元(master element)上第i个积分点

        w(const unsigned int i) const,

        init(const ElemType, unsigned int p_level) 

 58 switch(_dim)

 59 {

 60        case 0:

 61                this->init_0D(_type, _p_level);

 62                return ;

 63        case 1:

 64                this->init_1D(_type, _p_level);

 65                return ;

 66        case 2:

 67                this->init_2D(_type, _p_level);

 68                return ;

 69        case 3:

 70                this->init_3D(_type, _p_level);

 71                return ;

 72         default:

 73                libmesh_error_msg("Invalid dimension _dim = " << _dim);

 74 }

       get_order(), 返回积分规则的阶数


       继承类如 QGauss, 重写QBase所有方法,QGauss::build()返回父类smart指针

 

       QBase class provides basic functionality from which various quadrature rules can be derived, the class contains "dim" dimensional points describing the quadrature locations ( referenced to a master object) and associated weights.


      

      DofMap类 

     



     This class handles the numbering of DoF on a mesh. For system of equations, the class supports  a fixed number of variables. DoF are numbered such that sequential, contiguous blocks belong to distinct processors, so that the resulting data structures will work well with parallel linear algebra packages.

     attach_matrix()

     distribute_dofs() 

     compute_sparsity()

     attach_extra_sparsity_object()

     get_n_nz()

     get_n_oz()

     variable() , return variable 

     variable_type(), 

      n_variables(), returns the number of variables in global solution vector. Defaults to 1, should be 1 for a scalar equation, 3 for 2D incompressible NS(u, v, p) ...

     has_blocked_representation(), returns true if variables are capable of being stored in a blocked form. 

     block_size(),

     n_dofs(), return the total number of DoF in the problem

     n_local_dofs(), return number of DoF on current processor

     first_dof(), first_old_dof(), last_dof(), end_dof(), end_old_dof()

    dof_indices()  fills the vector "di" with global DoF indices for the element

  2libMesh::DofMap::dof_indices(const Elem*const elem, std::vector<dof_id_type>& di) const

  3 {

  4        libmesh_assert( !elem || elem->active());

  5        di.clear();

  6 

  7        const unsigned int n_vars = this->n_variables();

  8 

  9        std::vector<Node*> elem_nodes;

 10        if(elem)

 11        {

 12                elem_nodes.resize(elem->n_nodes(),NULL);

 13                for(unsignedint i=0; i<elem->n_nodes(); i++)

 14                        elem_nodes[i] = elem->get_node(i);

 15        }

 16 

 17         //get DoF numbers

 18        for(unsignedint v=0; v<n_vars; v++)

 19        {

 20                if(this->variable(v).type().family == SCALAR &&

 21                    (!elem ||this->variable(v).active_on_subdomain(elem->subdomain_id())))

 22                {

 23                        std::vector<dof_id_type> di_new;

 24                        this->SCALAR_dof_indices(di_new, v);

 25                        di_insert(di.end(), di_new.begin(), di_new.end());

 26                }

 27                else if(elem)

 28                        dof_indices(elem, di, v, elem_nodes);

 29        }

 30 }

  extract_local_vector()  ??, 类似petsc里面从 global 到 local映射,会将local vector的边界给填充上。

 local_variable_indices() 

 n_constrained_dofs()

 n_local_constrained_dofs() 

 create_dof_constraints(), ??? lots of constraints dealings ???

 get_periodic_boundaries(), 

add_dirichlet_boundary(const DirichletBoundary& dirichlet_boundary),  adds a copy of the specified Dirichlet boundary to the system

delete_dirichlet_boundary()

get_dirichlet_boundaries() 

 note: 处理稀疏性排列和约束条件的方法

 

DofObjectElem模版类       


 共有函数:包括DoF, 节点,边界,邻接,拓扑关系,refine-level的操作。

                  has_neighbor(const Elem* elem) const,  return true if the element "elem" is a neighbor of current element

                  on_boundary() , return true if this element has a side coincident with a boundary

                  length(const unsigned int n1, const unsigned int n2), return the magnitude of the distance between nodes "n1" and "n2"

  DofObject defines an abstract base class for objects that have DoF associated with them, including Elem and Node

  Elem is the base class from which all geometric entities(elements) are derived  


   MeshBase类:

     共有变量:  AutoPtr<BoundaryInfo> 

                  

 this class provides all the data necessary to describe a geometric entity. it allows for description of a "dim" dimensional object that lives in LIBMESH_DIM space.

A mesh is made of nodes and elements, and this class provides data structures to store and access both. A mesh may be partitioned into a number of subdomains, and this class provides that functionality. Furthermore, provides functions for reading and writing a mesh in various formats 


  MeshData 类:

          This class handles actual data and corresponding I/O on entities(nodes, elements) of meshes, MeshData can be used when dealing with files that contain nodal or element oriented data, numbered in the same format as a corresponding mesh file or with a LIBMESH element and node indices.


  DirichletBoundary 类:

         共有方法,就是重载的构造函数。

          the class associates Dirichlet Boundary values with a given set of mesh boundary ids and system variable ids. 

         Dirichlet values must be supplied as the input function "f", or gradient values as "g"

         Dirichlet functions are allowed to return NaN, if this is encountered, DoF values in a patch around NaN will be unconstrained


  BoundaryInfo类:

          静态成员变量  boundary_d_type 

          成员方法:

          添加/删除node, edge, side,

          boundary_ids(Node* ) return the boundary ids associated with Node

          n_boundary_id(Node*)  return the number of boundary ids associated with Node

          edge_boundary_ids(const Elem *const elem, const unsigned short int edge), return list of boundary ids associated with "edge" of "elem"

          has_boundary_id(), returns true iff the given side of the given element is associated with the given id

          get_boundary_ids(),  returns the user specified boundary ids

  The class contains contains information relevant to boundary conditions: it does not hold actual boundary condition data, but can mark element faces and nodes with ids useful for identifying the type of boundary condition. It can also build a mesh that just includes boundary elements/faces

       

 FunctionBase类:zero function
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值