v0.8.23
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 54 of file FEMultiIndices.cpp.

56  : RefElement(ref_ent_ptr) {
57  Tag th_RefBitEdge;
58  moab::Interface &moab = getRefEntityPtr()->basicDataPtr->moab;
59  rval = moab.tag_get_handle("_RefBitEdge", th_RefBitEdge);
61  rval = moab.tag_get_by_ptr(th_RefBitEdge, &ref_ent_ptr->ent, 1,
62  (const void **)&tag_BitRefEdges);
64  switch (ref_ent_ptr->getEntType()) {
65  case MBPRISM:
66  break;
67  default:
68  THROW_MESSAGE("this work only for PRISMs");
69  }
70  EntityHandle prism = getRefEnt();
71  int num_nodes;
72  const EntityHandle *conn;
73  rval = moab.get_connectivity(prism, conn, num_nodes, true);
75  assert(num_nodes == 6);
76  for (int nn = 0; nn != 6; ++nn) {
77  const_cast<SideNumber_multiIndex &>(side_number_table)
78  .insert(
79  boost::shared_ptr<SideNumber>(new SideNumber(conn[nn], nn, 0, -1)));
80  }
81  // Range face_side3, face_side4;
82  // CHKERR moab.get_adjacencies(conn, 3, 2, true, face_side3);
83  // CHKERR moab.get_adjacencies(&conn[3], 3, 2, true, face_side4);
84  // if (face_side3.size() != 1)
85  // THROW_MESSAGE("prism don't have side face 3");
86  // if (face_side4.size() != 1)
87  // THROW_MESSAGE("prims don't have side face 4");
88  // getSideNumberPtr(*face_side3.begin());
89  // getSideNumberPtr(*face_side4.begin());
90 }
SideNumber_multiIndex side_number_table
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:620
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:602
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:84
RefElement(const boost::shared_ptr< RefEntity > &ref_ent_ptr)
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 92 of file FEMultiIndices.cpp.

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