v0.13.1
Loading...
Searching...
No Matches
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
 
virtual const BitRefEdgesgetBitRefEdges () const
 
virtual int getBitRefEdgesUlong () const
 
SideNumber_multiIndexgetSideNumberTable () const
 
virtual const boost::shared_ptr< SideNumber > & getSideNumberPtr (const EntityHandle ent) 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
 
const boost::shared_ptr< BasicEntityDatagetBasicDataPtr () const
 
EntityHandle getEnt () const
 
EntityType getParentEntType () const
 
EntityHandle getParentEnt () const
 
BitRefLevelgetBitRefLevelPtr () const
 
const BitRefLevelgetBitRefLevel () const
 
unsigned long int getBitRefLevelULong () const
 
EntityType getEntType () const
 
int getEntDimension () const
 
const char * getEntTypeName () const
 
EntityID getEntId () const
 
EntityHandle getOwnerEnt () const
 
EntityHandlegetOwnerEnt ()
 
int getOwnerProc () const
 
int getPartProc () const
 
int * getPartProcPtr () const
 
unsigned char getPStatus () const
 
int * getSharingProcsPtr () 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< SideNumbernullSideNumber
 

Detailed Description

keeps data about abstract PRISM finite element

Definition at line 66 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 44 of file RefElementMultiIndices.cpp.

46 : RefElement(ref_ents_ptr) {
47 Tag th_RefBitEdge;
48 moab::Interface &moab = getRefEntityPtr()->getBasicDataPtr()->moab;
49 rval = moab.tag_get_handle("_RefBitEdge", th_RefBitEdge);
51 rval = moab.tag_get_by_ptr(th_RefBitEdge, &ref_ents_ptr->ent, 1,
52 (const void **)&tag_BitRefEdges);
54 switch (ref_ents_ptr->getEntType()) {
55 case MBPRISM:
56 break;
57 default:
58 THROW_MESSAGE("this work only for PRISMs");
59 }
60 EntityHandle prism = getEnt();
61 int num_nodes;
62 const EntityHandle *conn;
63 rval = moab.get_connectivity(prism, conn, num_nodes, true);
65 assert(num_nodes == 6);
66 for (int nn = 0; nn != 6; ++nn) {
68 .insert(
69 boost::shared_ptr<SideNumber>(new SideNumber(conn[nn], nn, 0, -1)));
70 }
71 // Range face_side3, face_side4;
72 // CHKERR moab.get_adjacencies(conn, 3, 2, true, face_side3);
73 // CHKERR moab.get_adjacencies(&conn[3], 3, 2, true, face_side4);
74 // if (face_side3.size() != 1)
75 // THROW_MESSAGE("prism don't have side face 3");
76 // if (face_side4.size() != 1)
77 // THROW_MESSAGE("prims don't have side face 4");
78 // getSideNumberPtr(*face_side3.begin());
79 // getSideNumberPtr(*face_side4.begin());
80}
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:541
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
Definition: definitions.h:561
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, signed char, &SideNumber::side_number > > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:74
RefElement(const boost::shared_ptr< RefEntity > &ref_ents_ptr)
boost::shared_ptr< RefEntity > & getRefEntityPtr() const
Get pointer to RefEntity.
SideNumber_multiIndex side_number_table

◆ ~RefElement_PRISM()

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

Member Function Documentation

◆ getBitRefEdges()

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

Reimplemented from MoFEM::RefElement.

Definition at line 73 of file RefElementMultiIndices.hpp.

73{ return *tag_BitRefEdges; }

◆ getBitRefEdgesUlong()

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

Reimplemented from MoFEM::RefElement.

Definition at line 74 of file RefElementMultiIndices.hpp.

74{ 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 82 of file RefElementMultiIndices.cpp.

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

Member Data Documentation

◆ tag_BitRefEdges

BitRefEdges* MoFEM::RefElement_PRISM::tag_BitRefEdges

Definition at line 67 of file RefElementMultiIndices.hpp.


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