v0.8.15
Public Member Functions | Public Attributes | List of all members
MoFEM::RefElement_PRISM Struct Reference

keeps data about abstract PRISM finite element More...

#include <src/multi_indices/FEMultiIndices.hpp>

Inheritance diagram for MoFEM::RefElement_PRISM:
[legend]
Collaboration diagram for MoFEM::RefElement_PRISM:
[legend]

Public Member Functions

 RefElement_PRISM (const boost::shared_ptr< RefEntity > &ref_ent_ptr)
 
const boost::shared_ptr< SideNumber > & getSideNumberPtr (const EntityHandle ent) const
 
const BitRefEdgesgetBitRefEdges () const
 
int getBitRefEdgesUlong () const
 
- Public Member Functions inherited from MoFEM::RefElement
 RefElement (const boost::shared_ptr< RefEntity > &ref_ent_ptr)
 
SideNumber_multiIndexgetSideNumberTable () const
 
boost::shared_ptr< RefEntity > & getRefEntityPtr () const
 Get pointer to RefEntity. More...
 
- Public Member Functions inherited from MoFEM::interface_RefEntity< RefEntity >
 interface_RefEntity (const boost::shared_ptr< RefEntity > &sptr)
 
 interface_RefEntity (const interface_RefEntity< RefEntity > &interface)
 
virtual ~interface_RefEntity ()
 
boost::shared_ptr< BasicEntityData > & getBasicDataPtr ()
 
const boost::shared_ptr< BasicEntityData > & getBasicDataPtr () const
 
EntityHandle getRefEnt () const
 
EntityType getParentEntType () const
 
EntityHandle getParentEnt () const
 
BitRefLevelgetBitRefLevelPtr () const
 
const BitRefLevelgetBitRefLevel () const
 
unsigned long int getBitRefLevelULong () const
 
EntityType getEntType () const
 
EntityID getEntId () const
 
EntityHandle getOwnerEnt () const
 
EntityHandlegetOwnerEnt ()
 
int getOwnerProc () const
 
intgetOwnerProc ()
 
int getPartProc () const
 
intgetPartProc ()
 
unsigned char getPStatus () const
 
intgetSharingProcsPtr () const
 
EntityHandlegetSharingHandlersPtr () const
 
boost::shared_ptr< RefEntity > & getRefEntityPtr () const
 

Public Attributes

BitRefEdgestag_BitRefEdges
 
- Public Attributes inherited from MoFEM::RefElement
SideNumber_multiIndex side_number_table
 
- Public Attributes inherited from MoFEM::interface_RefEntity< RefEntity >
boost::shared_ptr< RefEntitysPtr
 

Additional Inherited Members

- Public Types inherited from MoFEM::RefElement
typedef interface_RefEntity< RefEntityinterface_type_RefEntity
 
- Static Public Attributes inherited from MoFEM::RefElement
static BitRefEdges DummyBitRefEdges = BitRefEdges(0)
 
static const boost::shared_ptr< SideNumber > nullSideNumber
 

Detailed Description

keeps data about abstract PRISM finite element

Definition at line 92 of file FEMultiIndices.hpp.

Constructor & Destructor Documentation

◆ RefElement_PRISM()

MoFEM::RefElement_PRISM::RefElement_PRISM ( const boost::shared_ptr< RefEntity > &  ref_ent_ptr)

Definition at line 68 of file FEMultiIndices.cpp.

70  : RefElement(ref_ent_ptr) {
71  ErrorCode rval;
72  Tag th_RefBitEdge;
73  moab::Interface &moab = getRefEntityPtr()->basicDataPtr->moab;
74  rval = moab.tag_get_handle("_RefBitEdge", th_RefBitEdge);
76  rval = moab.tag_get_by_ptr(th_RefBitEdge, &ref_ent_ptr->ent, 1,
77  (const void **)&tag_BitRefEdges);
79  switch (ref_ent_ptr->getEntType()) {
80  case MBPRISM:
81  break;
82  default:
83  THROW_MESSAGE("this work only for PRISMs");
84  }
85  EntityHandle prism = getRefEnt();
86  int num_nodes;
87  const EntityHandle *conn;
88  rval = moab.get_connectivity(prism, conn, num_nodes, true);
90  assert(num_nodes == 6);
91  for (int nn = 0; nn != 6; ++nn) {
93  .insert(
94  boost::shared_ptr<SideNumber>(new SideNumber(conn[nn], nn, 0, -1)));
95  }
96  // Range face_side3, face_side4;
97  // CHKERR moab.get_adjacencies(conn, 3, 2, true, face_side3);
98  // CHKERR moab.get_adjacencies(&conn[3], 3, 2, true, face_side4);
99  // if (face_side3.size() != 1)
100  // THROW_MESSAGE("prism don't have side face 3");
101  // if (face_side4.size() != 1)
102  // THROW_MESSAGE("prims don't have side face 4");
103  // getSideNumberPtr(*face_side3.begin());
104  // getSideNumberPtr(*face_side4.begin());
105 }
SideNumber_multiIndex side_number_table
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_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 > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:602
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:584
RefElement(const boost::shared_ptr< RefEntity > &ref_ent_ptr)
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
boost::shared_ptr< RefEntity > & getRefEntityPtr() const
Get pointer to RefEntity.
BitRefEdges * tag_BitRefEdges

Member Function Documentation

◆ getBitRefEdges()

const BitRefEdges& MoFEM::RefElement_PRISM::getBitRefEdges ( ) const
virtual

Reimplemented from MoFEM::RefElement.

Definition at line 97 of file FEMultiIndices.hpp.

97 { return *tag_BitRefEdges; }
BitRefEdges * tag_BitRefEdges

◆ getBitRefEdgesUlong()

int MoFEM::RefElement_PRISM::getBitRefEdgesUlong ( ) const
virtual

Reimplemented from MoFEM::RefElement.

Definition at line 98 of file FEMultiIndices.hpp.

98 { return getBitRefEdges().to_ulong(); }
const BitRefEdges & getBitRefEdges() const

◆ getSideNumberPtr()

const boost::shared_ptr< SideNumber > & MoFEM::RefElement_PRISM::getSideNumberPtr ( const EntityHandle  ent) const
virtual

Reimplemented from MoFEM::RefElement.

Definition at line 107 of file FEMultiIndices.cpp.

107  {
108 
109  moab::Interface &moab = getRefEntityPtr()->basicDataPtr->moab;
110 
111  SideNumber_multiIndex::iterator miit = side_number_table.find(ent);
112  // this int is in table then return pointer
113  if (miit != side_number_table.end())
114  return *miit;
115 
116  // if ent is a this prism
117  if (sPtr->ent == ent) {
118  miit =
120  .insert(boost::shared_ptr<SideNumber>(new SideNumber(ent, 0, 0, 0)))
121  .first;
122  return *miit;
123  }
124 
125  // if ent is meshset
126  if (moab.type_from_handle(ent) == MBENTITYSET) {
127  miit =
129  .insert(boost::shared_ptr<SideNumber>(new SideNumber(ent, 0, 0, 0)))
130  .first;
131  return *miit;
132  }
133 
134  // use moab to get sense, side and offset
135 
136  int side_number, sense, offset;
137  rval = moab.side_number(sPtr->ent, ent, side_number, sense, offset);
138 
139  // it has to be degenerated prism, get sense from nodes topology
140  if (side_number == -1 || rval != MB_SUCCESS) {
141 
142  if (moab.type_from_handle(ent) == MBVERTEX) {
143  THROW_MESSAGE("Huston we have problem, vertex (specified by ent) is not "
144  "part of prism, that is impossible (top tip: check your "
145  "prisms)");
146  }
147 
148  // get prism connectivity
149  int num_nodes;
150  const EntityHandle *conn;
151  rval = moab.get_connectivity(sPtr->ent, conn, num_nodes, true);
152  MOAB_THROW(rval);
153  assert(num_nodes == 6);
154  // get ent connectivity
155  const EntityHandle *conn_ent;
156  rval = moab.get_connectivity(ent, conn_ent, num_nodes, true);
157  MOAB_THROW(rval);
158 
159  // for(int nn = 0; nn<6;nn++) {
160  // std::cerr << conn[nn] << " ";
161  // };
162  // std::cerr << std::endl;
163  // for(int nn = 0; nn<num_nodes;nn++) {
164  // std::cerr << conn_ent[nn] << " ";
165  // }
166  // std::cerr << std::endl;
167 
168  // bottom face
169  EntityHandle face3[3] = {conn[0], conn[1], conn[2]};
170  // top face
171  EntityHandle face4[3] = {conn[3], conn[4], conn[5]};
172  if (num_nodes == 3) {
173  int sense_p1_map[3][3] = {{0, 1, 2}, {1, 2, 0}, {2, 0, 1}};
174  int sense_m1_map[3][3] = {{0, 2, 1}, {1, 0, 2}, {2, 1, 0}};
175  EntityHandle *conn0_3_ptr = std::find(face3, &face3[3], conn_ent[0]);
176  if (conn0_3_ptr != &face3[3]) {
177  offset = std::distance(face3, conn0_3_ptr);
178  if (face3[sense_p1_map[offset][0]] == conn_ent[0] &&
179  face3[sense_p1_map[offset][1]] == conn_ent[1] &&
180  face3[sense_p1_map[offset][2]] == conn_ent[2]) {
181  miit = const_cast<SideNumber_multiIndex &>(side_number_table)
182  .insert(boost::shared_ptr<SideNumber>(
183  new SideNumber(ent, 3, 1, offset)))
184  .first;
185  return *miit;
186  } else if (face3[sense_m1_map[offset][0]] == conn_ent[0] &&
187  face3[sense_m1_map[offset][1]] == conn_ent[1] &&
188  face3[sense_m1_map[offset][2]] == conn_ent[2]) {
189  miit = const_cast<SideNumber_multiIndex &>(side_number_table)
190  .insert(boost::shared_ptr<SideNumber>(
191  new SideNumber(ent, 3, -1, offset)))
192  .first;
193  return *miit;
194  }
195  }
196  EntityHandle *conn0_4_ptr = std::find(face4, &face4[3], conn_ent[0]);
197  if (conn0_4_ptr != &face4[3]) {
198  offset = std::distance(face4, conn0_4_ptr);
199  if (face4[sense_p1_map[offset][0]] == conn_ent[0] &&
200  face4[sense_p1_map[offset][1]] == conn_ent[1] &&
201  face4[sense_p1_map[offset][2]] == conn_ent[2]) {
202  miit = const_cast<SideNumber_multiIndex &>(side_number_table)
203  .insert(boost::shared_ptr<SideNumber>(
204  new SideNumber(ent, 4, 1, 3 + offset)))
205  .first;
206  return *miit;
207  } else if (face4[sense_m1_map[offset][0]] == conn_ent[0] &&
208  face4[sense_m1_map[offset][1]] == conn_ent[1] &&
209  face4[sense_m1_map[offset][2]] == conn_ent[2]) {
210  miit = const_cast<SideNumber_multiIndex &>(side_number_table)
211  .insert(boost::shared_ptr<SideNumber>(
212  new SideNumber(ent, 4, -1, 3 + offset)))
213  .first;
214  return *miit;
215  } else {
216  std::cerr << conn_ent[0] << " " << conn_ent[1] << " " << conn_ent[2]
217  << std::endl;
218  std::cerr << face3[0] << " " << face3[1] << " " << face3[2]
219  << std::endl;
220  std::cerr << face4[0] << " " << face4[1] << " " << face4[2]
221  << std::endl;
222  std::cerr << offset << std::endl;
223  THROW_MESSAGE("Huston we have problem");
224  }
225  }
226  THROW_MESSAGE("Huston we have problem");
227  }
228 
229  if (num_nodes == 2) {
230  {
231  // Triangle edges
232  EntityHandle edges[6][2] = {
233  {conn[0], conn[1]} /*0*/, {conn[1], conn[2]} /*1*/,
234  {conn[2], conn[0]} /*2*/, {conn[3], conn[4]} /*3+3*/,
235  {conn[4], conn[5]} /*3+4*/, {conn[5], conn[3]} /*3+5*/
236  };
237  for (int ee = 0; ee < 6; ee++) {
238  if (((conn_ent[0] == edges[ee][0]) &&
239  (conn_ent[1] == edges[ee][1])) ||
240  ((conn_ent[0] == edges[ee][1]) &&
241  (conn_ent[1] == edges[ee][0]))) {
242  side_number = ee;
243  if (ee >= 3) {
244  side_number += 3;
245  EntityHandle *conn0_4_ptr =
246  std::find(face4, &face4[3], conn_ent[0]);
247  offset = std::distance(face4, conn0_4_ptr) + 3;
248  } else {
249  EntityHandle *conn0_3_ptr =
250  std::find(face3, &face3[3], conn_ent[0]);
251  offset = std::distance(face3, conn0_3_ptr);
252  }
253  sense = 1;
254  if ((conn_ent[0] == edges[ee][1]) && (conn_ent[1] == edges[ee][0]))
255  sense = -1;
256  miit = const_cast<SideNumber_multiIndex &>(side_number_table)
257  .insert(boost::shared_ptr<SideNumber>(
258  new SideNumber(ent, side_number, sense, offset)))
259  .first;
260  return *miit;
261  }
262  }
263  }
264  // {
265  // // Edges through thickness
266  // EntityHandle edges[3][2] = {
267  // { conn[0], conn[3] }, { conn[1], conn[4] }, { conn[2], conn[5] }
268  // };
269  // for(int ee = 0;ee<3;ee++) {
270  // if(
271  // (( conn_ent[0] == edges[ee][0] )&&( conn_ent[1] == edges[ee][1]
272  // ))||
273  // (( conn_ent[0] == edges[ee][1] )&&( conn_ent[1] == edges[ee][0]
274  // ))
275  // ) {
276  // side_number = 3+ee;
277  // offset = std::distance(conn,find(conn,&conn[6],conn_ent[0]));
278  // sense = 1;
279  // if(( conn_ent[0] == edges[ee][1] )&&( conn_ent[1] == edges[ee][0]
280  // )) sense = -1; miit =
281  // const_cast<SideNumber_multiIndex&>(side_number_table).insert(SideNumber(ent,side_number,sense,offset)).first;
282  // return const_cast<SideNumber*>(&*miit);
283  // }
284  // }
285  // }
286  // for(int nn = 0; nn<6;nn++) {
287  // std::cerr << conn[nn] << " ";
288  // };
289  // std::cerr << std::endl;
290  // std::cerr << conn_ent[0] << " " << conn_ent[1] << std::endl;
291  THROW_MESSAGE("Huston we have problem");
292  }
293  std::ostringstream sss;
294  sss << "this not working: " << ent
295  << " type: " << moab.type_from_handle(ent) << " " << MBEDGE << " "
296  << MBTRI << std::endl;
297  THROW_MESSAGE(sss.str().c_str());
298  }
299  miit = const_cast<SideNumber_multiIndex &>(side_number_table)
300  .insert(boost::shared_ptr<SideNumber>(
301  new SideNumber(ent, side_number, sense, offset)))
302  .first;
303  return *miit;
304  THROW_MESSAGE("not implemented");
305  return nullSideNumber;
306 }
boost::shared_ptr< RefEntity > sPtr
SideNumber_multiIndex side_number_table
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_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 > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:602
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:584
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
boost::shared_ptr< RefEntity > & getRefEntityPtr() const
Get pointer to RefEntity.
static const boost::shared_ptr< SideNumber > nullSideNumber

Member Data Documentation

◆ tag_BitRefEdges

BitRefEdges* MoFEM::RefElement_PRISM::tag_BitRefEdges

Definition at line 93 of file FEMultiIndices.hpp.


The documentation for this struct was generated from the following files: