v0.13.0
RefElementMultiIndices.hpp
Go to the documentation of this file.
1 /** \file RefElementMultiIndices.hpp
2  * \brief Multi-index contains, data structures for mofem finite elements and
3  * other low-level functions
4  */
5 
6 /* MoFEM is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
18  */
19 
20 #ifndef __REF_ELEMENT_MULTIINDICES_HPP__
21 #define __REF_ELEMENT_MULTIINDICES_HPP__
22 
23 namespace MoFEM {
24 
25 /**
26  * \brief keeps data about abstract refined finite element
27  * \ingroup fe_multi_indices
28  */
29 struct RefElement : public interface_RefEntity<RefEntity> {
30 
32 
34 
36  RefElement(const boost::shared_ptr<RefEntity> &ref_ents_ptr);
37  virtual ~RefElement() = default;
38 
39  virtual const BitRefEdges &getBitRefEdges() const { return DummyBitRefEdges; }
40 
41  virtual int getBitRefEdgesUlong() const { return 0; }
42 
44  return const_cast<SideNumber_multiIndex &>(side_number_table);
45  }
46 
47  static const boost::shared_ptr<SideNumber> nullSideNumber;
48 
49  virtual const boost::shared_ptr<SideNumber> &
50  getSideNumberPtr(const EntityHandle ent) const {
51  NOT_USED(ent);
52  return nullSideNumber;
53  };
54 
55  /**
56  * \brief Get pointer to RefEntity
57  */
58  inline boost::shared_ptr<RefEntity> &getRefEntityPtr() const {
59  return this->sPtr;
60  }
61 
62  friend std::ostream &operator<<(std::ostream &os, const RefElement &e);
63 };
64 
65 /**
66  * \brief keeps data about abstract MESHSET finite element
67  * \ingroup fe_multi_indices
68  */
69 struct RefElement_MESHSET : public RefElement {
70  RefElement_MESHSET(const boost::shared_ptr<RefEntity> &ref_ents_ptr);
71  virtual ~RefElement_MESHSET() = default;
72  const boost::shared_ptr<SideNumber> &
73  getSideNumberPtr(const EntityHandle ent) const;
74 };
75 /**
76  * \brief keeps data about abstract PRISM finite element
77  * \ingroup fe_multi_indices
78  */
79 struct RefElement_PRISM : public RefElement {
81  RefElement_PRISM(const boost::shared_ptr<RefEntity> &ref_ents_ptr);
82  virtual ~RefElement_PRISM() = default;
83 
84  const boost::shared_ptr<SideNumber> &
85  getSideNumberPtr(const EntityHandle ent) const;
86  const BitRefEdges &getBitRefEdges() const { return *tag_BitRefEdges; }
87  int getBitRefEdgesUlong() const { return getBitRefEdges().to_ulong(); }
88 };
89 
90 /**
91  * \brief keeps data about abstract TET finite element
92  * \ingroup fe_multi_indices
93  */
94 struct RefElementVolume : public RefElement {
96  RefElementVolume(const boost::shared_ptr<RefEntity> &ref_ents_ptr);
97  virtual ~RefElementVolume() = default;
98 
99  const boost::shared_ptr<SideNumber> &
100  getSideNumberPtr(const EntityHandle ent) const;
102  return const_cast<SideNumber_multiIndex &>(side_number_table);
103  };
104  const BitRefEdges &getBitRefEdges() const { return *tag_BitRefEdges; }
105  int getBitRefEdgesUlong() const { return getBitRefEdges().to_ulong(); }
106 };
107 
108 /**
109  * \brief keeps data about abstract TRI finite element
110  * \ingroup fe_multi_indices
111  */
112 struct RefElementFace : public RefElement {
113  RefElementFace(const boost::shared_ptr<RefEntity> &ref_ents_ptr);
114  virtual ~RefElementFace() = default;
115  const boost::shared_ptr<SideNumber> &
116  getSideNumberPtr(const EntityHandle ent) const;
117  friend std::ostream &operator<<(std::ostream &os, const RefElementFace &e);
118 };
119 
120 /**
121  * \brief keeps data about abstract EDGE finite element
122  * \ingroup fe_multi_indices
123  */
124 struct RefElement_EDGE : public RefElement {
125  RefElement_EDGE(const boost::shared_ptr<RefEntity> &ref_ents_ptr);
126  virtual ~RefElement_EDGE() = default;
127  const boost::shared_ptr<SideNumber> &
128  getSideNumberPtr(const EntityHandle ent) const;
129  friend std::ostream &operator<<(std::ostream &os, const RefElement_EDGE &e);
130 };
131 
132 /**
133  * \brief keeps data about abstract VERTEX finite element
134  * \ingroup fe_multi_indices
135  */
136 struct RefElement_VERTEX : public RefElement {
137  RefElement_VERTEX(const boost::shared_ptr<RefEntity> &ref_ents_ptr);
138  virtual ~RefElement_VERTEX() = default;
139  const boost::shared_ptr<SideNumber> &
140  getSideNumberPtr(const EntityHandle ent) const;
141  friend std::ostream &operator<<(std::ostream &os, const RefElement_VERTEX &e);
142 };
143 
144 /**
145  * \brief intrface to RefElement
146  * \ingroup fe_multi_indices
147  */
148 template <typename T> struct interface_RefElement : interface_RefEntity<T> {
149 
152 
153  interface_RefElement(const boost::shared_ptr<T> &sptr)
154  : interface_RefEntity<T>(sptr) {}
155  virtual ~interface_RefElement() = default;
156 
157  inline int getBitRefEdgesUlong() const {
158  return this->sPtr->getBitRefEdgesUlong();
159  }
160 
162  return this->sPtr->getSideNumberTable();
163  }
164 
165  inline const boost::shared_ptr<SideNumber> &
166  getSideNumberPtr(const EntityHandle ent) const {
167  return this->sPtr->getSideNumberPtr(ent);
168  }
169 
170  inline boost::shared_ptr<RefEntity> &getRefEntityPtr() const {
171  return this->sPtr->getRefEntityPtr();
172  }
173 
174  inline boost::shared_ptr<T> &getRefElement() const { return this->sPtr; }
175 };
176 
177 /**
178  * \typedef RefElement_multiIndex
179  * type multiIndex container for RefElement
180  * \ingroup fe_multi_indices
181  *
182  * \param hashed_unique Ent_mi_tag
183  * \param ordered_non_unique Meshset_mi_tag
184  * \param ordered_non_unique Ent_Ent_mi_tag
185  * \param ordered_non_unique Composite_ParentEnt_And_BitsOfRefinedEdges_mi_tag
186  */
187 typedef multi_index_container<
188  boost::shared_ptr<RefElement>,
189  // ptrWrapperRefElement,
190  indexed_by<ordered_unique<
191  tag<Ent_mi_tag>, const_mem_fun<RefElement::interface_type_RefEntity,
194 
195 
196 
197 } // namespace MoFEM
198 
199 #endif // __REF_ELEMENT_MULTIINDICES_HPP__
200 
201 /**
202  * \defgroup fe_multi_indices Finite elements structures and multi-indices
203  * \ingroup mofem
204  **/
#define NOT_USED(x)
Definition: definitions.h:255
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< ordered_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
multi_index_container< boost::shared_ptr< RefElement >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityHandle, &RefElement::getEnt > > > > RefElement_multiIndex
const double T
std::bitset< BITREFEDGES_SIZE > BitRefEdges
Definition: Types.hpp:45
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
keeps data about abstract EDGE finite element
virtual ~RefElement_EDGE()=default
RefElement_EDGE(const boost::shared_ptr< RefEntity > &ref_ents_ptr)
friend std::ostream & operator<<(std::ostream &os, const RefElement_EDGE &e)
keeps data about abstract MESHSET finite element
virtual ~RefElement_MESHSET()=default
RefElement_MESHSET(const boost::shared_ptr< RefEntity > &ref_ents_ptr)
keeps data about abstract PRISM finite element
const BitRefEdges & getBitRefEdges() const
RefElement_PRISM(const boost::shared_ptr< RefEntity > &ref_ents_ptr)
virtual ~RefElement_PRISM()=default
keeps data about abstract VERTEX finite element
virtual ~RefElement_VERTEX()=default
RefElement_VERTEX(const boost::shared_ptr< RefEntity > &ref_ents_ptr)
friend std::ostream & operator<<(std::ostream &os, const RefElement_VERTEX &e)
keeps data about abstract TRI finite element
RefElementFace(const boost::shared_ptr< RefEntity > &ref_ents_ptr)
virtual ~RefElementFace()=default
friend std::ostream & operator<<(std::ostream &os, const RefElementFace &e)
keeps data about abstract refined finite element
SideNumber_multiIndex & getSideNumberTable() const
virtual const boost::shared_ptr< SideNumber > & getSideNumberPtr(const EntityHandle ent) const
RefElement(const boost::shared_ptr< RefEntity > &ref_ents_ptr)
static BitRefEdges DummyBitRefEdges
boost::shared_ptr< RefEntity > & getRefEntityPtr() const
Get pointer to RefEntity.
friend std::ostream & operator<<(std::ostream &os, const RefElement &e)
SideNumber_multiIndex side_number_table
static const boost::shared_ptr< SideNumber > nullSideNumber
interface_RefEntity< RefEntity > interface_type_RefEntity
virtual const BitRefEdges & getBitRefEdges() const
virtual ~RefElement()=default
virtual int getBitRefEdgesUlong() const
keeps data about abstract TET finite element
RefElementVolume(const boost::shared_ptr< RefEntity > &ref_ents_ptr)
SideNumber_multiIndex & getSideNumberTable() const
virtual ~RefElementVolume()=default
const BitRefEdges & getBitRefEdges() const
interface_RefElement(const boost::shared_ptr< T > &sptr)
interface_RefEntity< T > interface_type_RefEntity
boost::shared_ptr< RefEntity > & getRefEntityPtr() const
SideNumber_multiIndex & getSideNumberTable() const
const boost::shared_ptr< SideNumber > & getSideNumberPtr(const EntityHandle ent) const
interface_RefElement< T > interface_type_RefElement
boost::shared_ptr< T > & getRefElement() const
virtual ~interface_RefElement()=default
boost::shared_ptr< SideNumber > getSideNumberPtr() const
Get the Side number.
EntityHandle getEnt() const
Get the entity handle.