mesh_base.h

来自「一个用来实现偏微分方程中网格的计算库」· C头文件 代码 · 共 849 行 · 第 1/2 页

H
849
字号
  { return libMesh::processor_id(); }  /**   * @returns a string containing relevant information   * about the mesh.   */  std::string get_info () const;  /**   * Prints relevant information about the mesh.   */  void print_info (std::ostream& os=std::cout) const;  /**   * Equivalent to calling print_info() above, but now you can write:   * Mesh mesh;   * std::cout << mesh << std::endl;   */  friend std::ostream& operator << (std::ostream& os, const MeshBase& m);  /**   * Interfaces for reading/writing a mesh to/from a file.  Must be   * implemented in derived classes.   */  virtual void read  (const std::string& name, MeshData* mesh_data=NULL) = 0;  virtual void write (const std::string& name, MeshData* mesh_data=NULL) = 0;  /**   * Converts a mesh with higher-order   * elements into a mesh with linear elements.  For    * example, a mesh consisting of \p Tet10 will be converted   * to a mesh with \p Tet4 etc.   */  virtual void all_first_order () = 0;  /**   * Converts a (conforming, non-refined) mesh with linear    * elements into a mesh with second-order elements.  For    * example, a mesh consisting of \p Tet4 will be converted   * to a mesh with \p Tet10 etc.  Note that for some elements   * like \p Hex8 there exist @e two higher order equivalents,   * \p Hex20 and \p Hex27.  When \p full_ordered is \p true   * (default), then \p Hex27 is built.  Otherwise, \p Hex20   * is built.  The same holds obviously for \p Quad4, \p Prism6   * ...   */  virtual void all_second_order (const bool full_ordered=true) = 0;  /**   * We need an empty, generic class to act as a predicate for this   * and derived mesh classes.   */  typedef Predicates::multi_predicate Predicate;  /**   * structs for the element_iterator's.   * Note that these iterators were designed so that derived mesh classes could use the   * _same_ base class iterators interchangeably.  Their definition comes later in the   * header file.   */  struct element_iterator;  struct const_element_iterator;  /**   * structs for the node_iterator's.   * Note that these iterators were designed so that derived mesh classes could use the   * _same_ base class iterators interchangeably.  Their definition comes later in the   * header file.   */  struct node_iterator;  struct const_node_iterator;  /**   * In a few (very rare) cases, the user may have manually tagged the   * elements with specific processor IDs by hand, without using a   * partitioner.  In this case, the Mesh will not know that the total   * number of partitions, _n_parts, has changed, unless you call this   * function.  This is an O(N active elements) calculation.  The return   * value is the number of partitions, and _n_parts is also set by   * this function.     */  unsigned int recalculate_n_partitions();  /**   * \p returns a reference to a \p PointLocatorBase object for this mesh.   *    */  const PointLocatorBase & point_locator () const;  /**   * Releases the current \p PointLocator object.   */  void clear_point_locator ();public:    /**   * Elem iterator accessor functions.  These must be defined in   * Concrete base classes.   */  virtual element_iterator elements_begin                   () = 0;  virtual element_iterator elements_end                     () = 0;  virtual element_iterator active_elements_begin            () = 0;  virtual element_iterator active_elements_end              () = 0;  virtual element_iterator ancestor_elements_begin          () = 0;  virtual element_iterator ancestor_elements_end            () = 0;  virtual element_iterator subactive_elements_begin         () = 0;  virtual element_iterator subactive_elements_end           () = 0;  virtual element_iterator not_active_elements_begin        () = 0;  virtual element_iterator not_active_elements_end          () = 0;  virtual element_iterator not_ancestor_elements_begin      () = 0;  virtual element_iterator not_ancestor_elements_end        () = 0;  virtual element_iterator not_subactive_elements_begin     () = 0;  virtual element_iterator not_subactive_elements_end       () = 0;  virtual element_iterator local_elements_begin             () = 0;  virtual element_iterator local_elements_end               () = 0;  virtual element_iterator not_local_elements_begin         () = 0;  virtual element_iterator not_local_elements_end           () = 0;  virtual element_iterator active_local_elements_begin      () = 0;  virtual element_iterator active_local_elements_end        () = 0;  virtual element_iterator active_not_local_elements_begin  () = 0;  virtual element_iterator active_not_local_elements_end    () = 0;  virtual element_iterator level_elements_begin             (const unsigned int level  ) = 0;  virtual element_iterator level_elements_end               (const unsigned int level  ) = 0;  virtual element_iterator not_level_elements_begin         (const unsigned int level  ) = 0;  virtual element_iterator not_level_elements_end           (const unsigned int level  ) = 0;  virtual element_iterator local_level_elements_begin       (const unsigned int level  ) = 0;  virtual element_iterator local_level_elements_end         (const unsigned int level  ) = 0;  virtual element_iterator local_not_level_elements_begin   (const unsigned int level  ) = 0;  virtual element_iterator local_not_level_elements_end     (const unsigned int level  ) = 0;  virtual element_iterator pid_elements_begin               (const unsigned int proc_id) = 0;  virtual element_iterator pid_elements_end                 (const unsigned int proc_id) = 0;  virtual element_iterator type_elements_begin              (const ElemType type       ) = 0;  virtual element_iterator type_elements_end                (const ElemType type       ) = 0;  virtual element_iterator active_type_elements_begin       (const ElemType type       ) = 0;  virtual element_iterator active_type_elements_end         (const ElemType type       ) = 0;  virtual element_iterator active_pid_elements_begin        (const unsigned int proc_id) = 0;  virtual element_iterator active_pid_elements_end          (const unsigned int proc_id) = 0;  virtual element_iterator unpartitioned_elements_begin     () = 0;  virtual element_iterator unpartitioned_elements_end       () = 0;      /**   * const Elem iterator accessor functions.   */  virtual const_element_iterator elements_begin                   () const = 0;  virtual const_element_iterator elements_end                     () const = 0;  virtual const_element_iterator active_elements_begin            () const = 0;  virtual const_element_iterator active_elements_end              () const = 0;  virtual const_element_iterator ancestor_elements_begin          () const = 0;  virtual const_element_iterator ancestor_elements_end            () const = 0;  virtual const_element_iterator subactive_elements_begin         () const = 0;  virtual const_element_iterator subactive_elements_end           () const = 0;  virtual const_element_iterator not_active_elements_begin        () const = 0;  virtual const_element_iterator not_active_elements_end          () const = 0;  virtual const_element_iterator not_ancestor_elements_begin      () const = 0;  virtual const_element_iterator not_ancestor_elements_end        () const = 0;  virtual const_element_iterator not_subactive_elements_begin     () const = 0;  virtual const_element_iterator not_subactive_elements_end       () const = 0;  virtual const_element_iterator local_elements_begin             () const = 0;  virtual const_element_iterator local_elements_end               () const = 0;  virtual const_element_iterator not_local_elements_begin         () const = 0;  virtual const_element_iterator not_local_elements_end           () const = 0;  virtual const_element_iterator active_local_elements_begin      () const = 0;  virtual const_element_iterator active_local_elements_end        () const = 0;  virtual const_element_iterator active_not_local_elements_begin  () const = 0;  virtual const_element_iterator active_not_local_elements_end    () const = 0;  virtual const_element_iterator level_elements_begin             (const unsigned int level)   const = 0;  virtual const_element_iterator level_elements_end               (const unsigned int level)   const = 0;  virtual const_element_iterator not_level_elements_begin         (const unsigned int level)   const = 0;  virtual const_element_iterator not_level_elements_end           (const unsigned int level)   const = 0;  virtual const_element_iterator local_level_elements_begin       (const unsigned int level)   const = 0;  virtual const_element_iterator local_level_elements_end         (const unsigned int level)   const = 0;  virtual const_element_iterator local_not_level_elements_begin   (const unsigned int level)   const = 0;  virtual const_element_iterator local_not_level_elements_end     (const unsigned int level)   const = 0;  virtual const_element_iterator pid_elements_begin               (const unsigned int proc_id) const = 0;  virtual const_element_iterator pid_elements_end                 (const unsigned int proc_id) const = 0;  virtual const_element_iterator type_elements_begin              (const ElemType type)        const = 0;  virtual const_element_iterator type_elements_end                (const ElemType type)        const = 0;  virtual const_element_iterator active_type_elements_begin       (const ElemType type)        const = 0;  virtual const_element_iterator active_type_elements_end         (const ElemType type)        const = 0;  virtual const_element_iterator active_pid_elements_begin        (const unsigned int proc_id) const = 0;  virtual const_element_iterator active_pid_elements_end          (const unsigned int proc_id) const = 0;  virtual const_element_iterator unpartitioned_elements_begin     () const = 0;  virtual const_element_iterator unpartitioned_elements_end       () const = 0;    /**   * non-const Node iterator accessor functions.   */  virtual node_iterator nodes_begin        () = 0;  virtual node_iterator nodes_end          () = 0;  virtual node_iterator active_nodes_begin () = 0;  virtual node_iterator active_nodes_end   () = 0;  virtual node_iterator local_nodes_begin  () = 0;  virtual node_iterator local_nodes_end    () = 0;  virtual node_iterator pid_nodes_begin    (const unsigned int proc_id) = 0;  virtual node_iterator pid_nodes_end      (const unsigned int proc_id) = 0;  /**   * const Node iterator accessor functions.   */  virtual const_node_iterator nodes_begin        () const = 0;  virtual const_node_iterator nodes_end          () const = 0;  virtual const_node_iterator active_nodes_begin () const = 0;  virtual const_node_iterator active_nodes_end   () const = 0;  virtual const_node_iterator local_nodes_begin  () const = 0;  virtual const_node_iterator local_nodes_end    () const = 0;  virtual const_node_iterator pid_nodes_begin    (const unsigned int proc_id) const = 0;  virtual const_node_iterator pid_nodes_end      (const unsigned int proc_id) const = 0;          protected:      /**   * Returns a writeable reference to the number of subdomains.   */  unsigned int& set_n_subdomains ()  { return _n_sbd; }  /**   * Returns a writeable reference to the number of partitions.   */  unsigned int& set_n_partitions ()  { return _n_parts; }    /**   * The number of subdomains the mesh has.   * **NOTE** Not to be confused with the number of paritions!   * The definition of subdomain can be anything the user wants,   * e.g. a solid region bounded by a liquid region could be   * referred to as subdomains 1 and 2, but those subdomains   * could be partitioned over many processors.   */  unsigned int _n_sbd;  /**   * The number of partitions the mesh has.  This is set by   * the partitioners, and may not be changed directly by   * the user.   * **NOTE** The number of partitions *need not* equal   * libMesh::n_processors(), consider for example the case   * where you simply want to partition a mesh on one   * processor and view the result in GMV.   */  unsigned int _n_parts;    /**   * The logical dimension of the mesh.   */       const unsigned int _dim;  /**   * Flag indicating if the mesh has been prepared for use.   */  bool _is_prepared;    /**   * A \p PointLocator class for this mesh.    * This will not actually be built unless needed. Further, since we want    * our \p point_locator() method to be \p const (yet do the dynamic allocating)   * this needs to be mutable.  Since the PointLocatorBase::build() member is used,    * and it operates on a constant reference to the mesh, this is OK.   */  mutable AutoPtr<PointLocatorBase> _point_locator;  /**   * The partitioner class is a friend so that it can set   * the number of partitions.   */  friend class Partitioner;  /**   * Make the \p BoundaryInfo class a friend so that   * it can create and interact with \p BoundaryMesh.   */  friend class BoundaryInfo;};/** * The definition of the element_iterator struct. */structMeshBase::element_iterator :variant_filter_iterator<MeshBase::Predicate,			Elem*>{  // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor  template <typename PredType, typename IterType>  element_iterator (const IterType& d,		    const IterType& e,		    const PredType& p ) :    variant_filter_iterator<MeshBase::Predicate,			    Elem*>(d,e,p) {}};/** * The definition of the const_element_iterator struct.  It is similar to the regular * iterator above, but also provides an additional conversion-to-const ctor. */structMeshBase::const_element_iterator :variant_filter_iterator<MeshBase::Predicate,			Elem* const,			Elem* const&,			Elem* const*>{  // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor  template <typename PredType, typename IterType>  const_element_iterator (const IterType& d,			  const IterType& e,			  const PredType& p ) :    variant_filter_iterator<MeshBase::Predicate,			    Elem* const,			    Elem* const&,			    Elem* const*>(d,e,p)  {}  // The conversion-to-const ctor.  Takes a regular iterator and calls the appropriate  // variant_filter_iterator copy constructor.  Note that this one is *not* templated!  const_element_iterator (const MeshBase::element_iterator& rhs) :    variant_filter_iterator<Predicate,			    Elem* const,			    Elem* const&,			    Elem* const*>(rhs)  {    // std::cout << "Called element_iterator conversion-to-const ctor." << std::endl;  }};/** * The definition of the node_iterator struct. */structMeshBase::node_iterator :variant_filter_iterator<MeshBase::Predicate,			Node*>{  // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor  template <typename PredType, typename IterType>  node_iterator (const IterType& d,		 const IterType& e,		 const PredType& p ) :    variant_filter_iterator<MeshBase::Predicate,			    Node*>(d,e,p) {}};/** * The definition of the const_node_iterator struct.  It is similar to the regular * iterator above, but also provides an additional conversion-to-const ctor. */structMeshBase::const_node_iterator :variant_filter_iterator<MeshBase::Predicate,			Node* const,			Node* const &,			Node* const *>{  // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor  template <typename PredType, typename IterType>  const_node_iterator (const IterType& d,		       const IterType& e,		       const PredType& p ) :    variant_filter_iterator<MeshBase::Predicate,			    Node* const,			    Node* const &,			    Node* const *>(d,e,p)  {}  // The conversion-to-const ctor.  Takes a regular iterator and calls the appropriate  // variant_filter_iterator copy constructor.  Note that this one is *not* templated!  const_node_iterator (const MeshBase::node_iterator& rhs) :    variant_filter_iterator<Predicate,			    Node* const,			    Node* const &,			    Node* const *>(rhs)  {    // std::cout << "Called node_iterator conversion-to-const ctor." << std::endl;  }};#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?