| | 1123 | |
| | 1124 | if (begin == end) { |
| | 1125 | adj_entities.clear(); // intersection |
| | 1126 | return MB_SUCCESS; |
| | 1127 | } |
| | 1128 | |
| | 1129 | // First iteration is a special case if input list is empty. |
| | 1130 | // Rather than returning nothing (intersecting with empty |
| | 1131 | // input list), we begin with the adjacencies for the first entity. |
| | 1132 | if (adj_entities.empty()) { |
| | 1133 | MBEntityType type = TYPE_FROM_HANDLE(*begin); |
| | 1134 | if (to_dimension == MBCN::Dimension(type)) |
| | 1135 | adj_entities.push_back(*begin); |
| | 1136 | else if(to_dimension == 0 && type != MBPOLYHEDRON) |
| | 1137 | result = mb->get_connectivity(&(*begin), 1, adj_entities); |
| | 1138 | else |
| | 1139 | result = mb->a_entity_factory()->get_adjacencies(*begin, to_dimension, |
| | 1140 | create_if_missing, adj_entities); |
| | 1141 | if (MB_SUCCESS != result) |
| | 1142 | return result; |
| | 1143 | ++begin; |
| | 1144 | } |
| 1205 | | MBErrorCode result; |
| 1206 | | if (num_entities == 1 && adj_entities.empty()) { |
| 1207 | | if(to_dimension == 0 && TYPE_FROM_HANDLE(from_entities[0]) != MBPOLYHEDRON) |
| 1208 | | result = get_connectivity(&from_entities[0], 1, adj_entities); |
| 1209 | | else |
| 1210 | | result = aEntityFactory->get_adjacencies(from_entities[0], to_dimension, |
| 1211 | | create_if_missing, adj_entities); |
| 1212 | | |
| 1213 | | //adj_entities.erase( std::remove( adj_entities.begin(), adj_entities.end(), 0 ), adj_entities.end() ); |
| 1214 | | return result; |
| 1215 | | } |
| 1216 | | else if (operation_type == MBInterface::INTERSECT) |
| | 1221 | if (operation_type == MBInterface::INTERSECT) |