v0.8.19
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 76 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  Tag th_RefBitEdge;
72  moab::Interface &moab = getRefEntityPtr()->basicDataPtr->moab;
73  rval = moab.tag_get_handle("_RefBitEdge", th_RefBitEdge);
75  rval = moab.tag_get_by_ptr(th_RefBitEdge, &ref_ent_ptr->ent, 1,
76  (const void **)&tag_BitRefEdges);
78  switch (ref_ent_ptr->getEntType()) {
79  case MBPRISM:
80  break;
81  default:
82  THROW_MESSAGE("this work only for PRISMs");
83  }
84  EntityHandle prism = getRefEnt();
85  int num_nodes;
86  const EntityHandle *conn;
87  rval = moab.get_connectivity(prism, conn, num_nodes, true);
89  assert(num_nodes == 6);
90  for (int nn = 0; nn != 6; ++nn) {
92  .insert(
93  boost::shared_ptr<SideNumber>(new SideNumber(conn[nn], nn, 0, -1)));
94  }
95  // Range face_side3, face_side4;
96  // CHKERR moab.get_adjacencies(conn, 3, 2, true, face_side3);
97  // CHKERR moab.get_adjacencies(&conn[3], 3, 2, true, face_side4);
98  // if (face_side3.size() != 1)
99  // THROW_MESSAGE("prism don't have side face 3");
100  // if (face_side4.size() != 1)
101  // THROW_MESSAGE("prims don't have side face 4");
102  // getSideNumberPtr(*face_side3.begin());
103  // getSideNumberPtr(*face_side4.begin());
104 }
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:618
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:600
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 81 of file FEMultiIndices.hpp.

81 { return *tag_BitRefEdges; }
BitRefEdges * tag_BitRefEdges

◆ getBitRefEdgesUlong()

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

Reimplemented from MoFEM::RefElement.

Definition at line 82 of file FEMultiIndices.hpp.

82 { 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 106 of file FEMultiIndices.cpp.

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


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