12 boost::shared_ptr<SideNumber>();
20 os <<
" " << *(e.
sPtr);
25 const boost::shared_ptr<RefEntity> &ref_ents_ptr)
27 switch (ref_ents_ptr->getEntType()) {
34 const boost::shared_ptr<SideNumber> &
37 SideNumber_multiIndex::iterator miit;
40 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, 0, 0, 0)))
45 const boost::shared_ptr<RefEntity> &ref_ents_ptr)
49 rval = moab.tag_get_handle(
"_RefBitEdge", th_RefBitEdge);
51 rval = moab.tag_get_by_ptr(th_RefBitEdge, &ref_ents_ptr->ent, 1,
54 switch (ref_ents_ptr->getEntType()) {
63 rval = moab.get_connectivity(prism, conn, num_nodes,
true);
65 assert(num_nodes == 6);
66 for (
int nn = 0; nn != 6; ++nn) {
69 boost::shared_ptr<SideNumber>(
new SideNumber(conn[nn], nn, 0, -1)));
81 const boost::shared_ptr<SideNumber> &
92 if (
sPtr->ent == ent) {
95 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, 0, 0, 0)))
104 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, 0, 0, 0)))
111 int side_number, sense, offset;
112 rval = moab.side_number(
sPtr->ent, ent, side_number, sense, offset);
115 if (side_number == -1 ||
rval != MB_SUCCESS) {
118 THROW_MESSAGE(
"Huston we have problem, vertex (specified by ent) is not "
119 "part of prism, that is impossible (top tip: check your "
126 rval = moab.get_connectivity(
sPtr->ent, conn, num_nodes,
true);
128 assert(num_nodes == 6);
131 rval = moab.get_connectivity(ent, conn_ent, num_nodes,
true);
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]) {
157 .insert(boost::shared_ptr<SideNumber>(
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]) {
165 .insert(boost::shared_ptr<SideNumber>(
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]) {
178 .insert(boost::shared_ptr<SideNumber>(
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]) {
186 .insert(boost::shared_ptr<SideNumber>(
191 std::cerr << conn_ent[0] <<
" " << conn_ent[1] <<
" " << conn_ent[2]
193 std::cerr << face3[0] <<
" " << face3[1] <<
" " << face3[2]
195 std::cerr << face4[0] <<
" " << face4[1] <<
" " << face4[2]
197 std::cerr << offset << std::endl;
204 if (num_nodes == 2) {
208 {conn[0], conn[1]} , {conn[1], conn[2]} ,
209 {conn[2], conn[0]} , {conn[3], conn[4]} ,
210 {conn[4], conn[5]} , {conn[5], conn[3]}
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]))) {
221 std::find(face4, &face4[3], conn_ent[0]);
222 offset = std::distance(face4, conn0_4_ptr) + 3;
225 std::find(face3, &face3[3], conn_ent[0]);
226 offset = std::distance(face3, conn0_3_ptr);
229 if ((conn_ent[0] == edges[ee][1]) && (conn_ent[1] == edges[ee][0]))
232 .insert(boost::shared_ptr<SideNumber>(
233 new SideNumber(ent, side_number, sense, offset)))
268 std::ostringstream sss;
270 <<
" " << MBEDGE <<
" " << MBTRI << std::endl;
274 .insert(boost::shared_ptr<SideNumber>(
275 new SideNumber(ent, side_number, sense, offset)))
283 :
RefElement(ref_ents_ptr), tag_BitRefEdges(NULL) {
286 rval = moab.tag_get_handle(
"_RefBitEdge", th_RefBitEdge);
288 rval = moab.tag_get_by_ptr(th_RefBitEdge, &ref_ents_ptr->ent, 1,
291 switch (ref_ents_ptr->getEntType()) {
299 .insert(boost::make_shared<SideNumber>(
sPtr->ent, 0, 0, 0));
302 const boost::shared_ptr<SideNumber> &
308 if (
sPtr->ent == ent) {
310 .insert(boost::make_shared<SideNumber>(ent, 0, 0, 0))
316 .insert(boost::make_shared<SideNumber>(ent, 0, 0, 0))
320 int side_number, sense, offset;
321 rval = moab.side_number(
sPtr->ent, ent, side_number, sense, offset);
324 .insert(boost::make_shared<SideNumber>(ent, side_number,
327 if (miit->get()->ent != ent)
334 os <<
" " << *e.
sPtr;
343 switch (ref_ents_ptr->getEntType()) {
345 nb_nodes = nb_edges = 3;
348 nb_nodes = nb_edges = 4;
353 int side_number, sense, offset;
358 rval = moab.get_connectivity(tri, conn, num_nodes,
true);
360 for (
int nn = 0; nn < nb_nodes; nn++) {
363 boost::shared_ptr<SideNumber>(
new SideNumber(conn[nn], nn, 0, 0)));
365 for (
int ee = 0; ee < nb_edges; ee++) {
367 rval = moab.side_element(tri, 1, ee, edge);
369 rval = moab.side_number(tri, edge, side_number, sense, offset);
372 .insert(boost::shared_ptr<SideNumber>(
376 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(tri, 0, 0, 0)));
378 const boost::shared_ptr<SideNumber> &
384 if (
sPtr->ent == ent) {
387 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, 0, 0, 0)))
394 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, 0, 0, 0)))
398 int side_number, sense, offset;
399 rval = moab.side_number(
sPtr->ent, ent, side_number, sense, offset);
402 .insert(boost::shared_ptr<SideNumber>(
403 new SideNumber(ent, side_number, sense, offset)))
413 const boost::shared_ptr<RefEntity> &ref_ents_ptr)
415 switch (ref_ents_ptr->getEntType()) {
422 const boost::shared_ptr<SideNumber> &
428 if (
sPtr->ent == ent) {
431 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, 0, 0, 0)))
438 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, 0, 0, 0)))
442 int side_number, sense, offset;
443 rval = moab.side_number(
sPtr->ent, ent, side_number, sense, offset);
446 .insert(boost::shared_ptr<SideNumber>(
447 new SideNumber(ent, side_number, sense, offset)))
457 const boost::shared_ptr<RefEntity> &ref_ents_ptr)
459 switch (ref_ents_ptr->getEntType()) {
466 const boost::shared_ptr<SideNumber> &
471 if (
sPtr->ent == ent) {
474 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, 0, 0, 0)))
481 .insert(boost::shared_ptr<SideNumber>(
new SideNumber(ent, 0, 0, 0)))
485 THROW_MESSAGE(
"no side entity for vertex if its is not an vertex itself");