v0.13.0
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/RefElementMultiIndices.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_ents_ptr)
 
virtual ~RefElement_PRISM ()=default
 
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_ents_ptr)
 
virtual ~RefElement ()=default
 
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 ()=default
 
int getSideNumber () const
 
boost::shared_ptr< SideNumbergetSideNumberPtr () const
 Get the Side number. More...
 
const boost::shared_ptr< BasicEntityDatagetBasicDataPtr () const
 Get pointer to basic data struture. More...
 
EntityHandle getEnt () const
 Get the entity handle. More...
 
EntityType getParentEntType () const
 Get patent entity. More...
 
EntityHandle getParentEnt () const
 
BitRefLevelgetBitRefLevelPtr () const
 Get pointer to bit ref level tag. More...
 
const BitRefLevelgetBitRefLevel () const
 
unsigned long int getBitRefLevelULong () const
 Get entity ref bit refinement as ulong. More...
 
EntityType getEntType () const
 Get entity type. More...
 
int getEntDimension () const
 Get the Ent Dimension. More...
 
const char * getEntTypeName () const
 Get the Ent Type Name. More...
 
EntityID getEntId () const
 get entity id More...
 
EntityHandle getOwnerEnt () const
 
EntityHandlegetOwnerEnt ()
 
int getOwnerProc () const
 
int getPartProc () const
 
int * getPartProcPtr () const
 Get pointer to partition tag. More...
 
unsigned char getPStatus () const
 
int * getSharingProcsPtr () const
 get shared processors More...
 
EntityHandlegetSharingHandlersPtr () const
 get sharid entity handlers More...
 
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< SideNumbernullSideNumber
 

Detailed Description

keeps data about abstract PRISM finite element

Definition at line 79 of file RefElementMultiIndices.hpp.

Constructor & Destructor Documentation

◆ RefElement_PRISM()

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

Definition at line 57 of file RefElementMultiIndices.cpp.

59  : RefElement(ref_ents_ptr) {
60  Tag th_RefBitEdge;
61  moab::Interface &moab = getRefEntityPtr()->getBasicDataPtr()->moab;
62  rval = moab.tag_get_handle("_RefBitEdge", th_RefBitEdge);
64  rval = moab.tag_get_by_ptr(th_RefBitEdge, &ref_ents_ptr->ent, 1,
65  (const void **)&tag_BitRefEdges);
67  switch (ref_ents_ptr->getEntType()) {
68  case MBPRISM:
69  break;
70  default:
71  THROW_MESSAGE("this work only for PRISMs");
72  }
73  EntityHandle prism = getEnt();
74  int num_nodes;
75  const EntityHandle *conn;
76  rval = moab.get_connectivity(prism, conn, num_nodes, true);
78  assert(num_nodes == 6);
79  for (int nn = 0; nn != 6; ++nn) {
81  .insert(
82  boost::shared_ptr<SideNumber>(new SideNumber(conn[nn], nn, 0, -1)));
83  }
84  // Range face_side3, face_side4;
85  // CHKERR moab.get_adjacencies(conn, 3, 2, true, face_side3);
86  // CHKERR moab.get_adjacencies(&conn[3], 3, 2, true, face_side4);
87  // if (face_side3.size() != 1)
88  // THROW_MESSAGE("prism don't have side face 3");
89  // if (face_side4.size() != 1)
90  // THROW_MESSAGE("prims don't have side face 4");
91  // getSideNumberPtr(*face_side3.begin());
92  // getSideNumberPtr(*face_side4.begin());
93 }
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:554
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
Definition: definitions.h:574
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.
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:85
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1965
RefElement(const boost::shared_ptr< RefEntity > &ref_ents_ptr)
boost::shared_ptr< RefEntity > & getRefEntityPtr() const
Get pointer to RefEntity.
SideNumber_multiIndex side_number_table
EntityHandle getEnt() const
Get the entity handle.

◆ ~RefElement_PRISM()

virtual MoFEM::RefElement_PRISM::~RefElement_PRISM ( )
virtualdefault

Member Function Documentation

◆ getBitRefEdges()

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

Reimplemented from MoFEM::RefElement.

Definition at line 86 of file RefElementMultiIndices.hpp.

86 { return *tag_BitRefEdges; }

◆ getBitRefEdgesUlong()

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

Reimplemented from MoFEM::RefElement.

Definition at line 87 of file RefElementMultiIndices.hpp.

87 { 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 95 of file RefElementMultiIndices.cpp.

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

Member Data Documentation

◆ tag_BitRefEdges

BitRefEdges* MoFEM::RefElement_PRISM::tag_BitRefEdges

Definition at line 80 of file RefElementMultiIndices.hpp.


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