[MOAB-dev] r3370 - MOAB/trunk
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Wed Nov 18 15:09:38 CST 2009
Author: kraftche
Date: 2009-11-18 15:09:38 -0600 (Wed, 18 Nov 2009)
New Revision: 3370
Modified:
MOAB/trunk/MBCore.cpp
MOAB/trunk/MBCore.hpp
MOAB/trunk/MBInterface.hpp
Log:
change private MBCore::get_vertices into public range-range version of get_connectivity
Modified: MOAB/trunk/MBCore.cpp
===================================================================
--- MOAB/trunk/MBCore.cpp 2009-11-18 02:31:34 UTC (rev 3369)
+++ MOAB/trunk/MBCore.cpp 2009-11-18 21:09:38 UTC (rev 3370)
@@ -1242,8 +1242,9 @@
return MB_FAILURE;
}
-MBErrorCode MBCore::get_vertices( const MBRange& from_entities,
- MBRange& adj_entities )
+MBErrorCode MBCore::get_connectivity( const MBRange& from_entities,
+ MBRange& adj_entities,
+ bool corners_only ) const
{
const size_t DEFAULT_MAX_BLOCKS_SIZE = 4000;
const size_t MAX_OUTER_ITERATIONS = 100;
@@ -1271,23 +1272,12 @@
remaining -= count;
temp_vec.clear();
for (size_t j = 0; j < count; ++i, ++j) {
- tmp_result = get_connectivity( *i, conn, conn_len, false, &storage );
+ tmp_result = get_connectivity( *i, conn, conn_len, corners_only, &storage );
if (MB_SUCCESS != tmp_result) {
result = tmp_result;
continue;
}
- if (TYPE_FROM_HANDLE(*i) == MBPOLYHEDRON) {
- storage.clear();
- tmp_result = get_connectivity( conn, conn_len, storage );
- if (MB_SUCCESS != tmp_result) {
- result = tmp_result;
- continue;
- }
- conn_len = storage.size();
- conn = &storage[0];
- }
-
const size_t oldsize = temp_vec.size();
temp_vec.resize( oldsize + conn_len );
memcpy( &temp_vec[oldsize], conn, sizeof(MBEntityHandle)*conn_len );
@@ -1307,6 +1297,32 @@
return result;
}
+MBErrorCode MBCore::get_vertices( const MBRange& from_entities,
+ MBRange& vertices )
+{
+ MBRange range;
+ MBErrorCode rval = get_connectivity( from_entities, range );
+
+ // If input contained polyhedra, connectivity will contain faces.
+ // Get vertices from faces.
+ if (MB_SUCCESS == rval && !range.all_of_dimension(0)) {
+ MBRange::iterator it = range.upper_bound(MBVERTEX);
+ MBRange polygons;
+ polygons.merge( it, range.end() );
+ range.erase( it, range.end() );
+ rval = get_connectivity( polygons, range );
+ }
+
+ if (MB_SUCCESS != rval)
+ return rval;
+
+ if (vertices.empty())
+ vertices.swap( range );
+ else
+ vertices.merge( range );
+ return MB_SUCCESS;
+}
+
MBErrorCode MBCore::get_adjacencies(const MBRange &from_entities,
const int to_dimension,
const bool create_if_missing,
Modified: MOAB/trunk/MBCore.hpp
===================================================================
--- MOAB/trunk/MBCore.hpp 2009-11-18 02:31:34 UTC (rev 3369)
+++ MOAB/trunk/MBCore.hpp 2009-11-18 21:09:38 UTC (rev 3370)
@@ -212,6 +212,13 @@
const int num_handles,
MBRange &connectivity,
bool topological_connectivity = false) const;
+
+ //! Gets the connectivity for elements
+ /** Same as vector-based version except range is returned (unordered!)
+ */
+ virtual MBErrorCode get_connectivity( const MBRange& entity_handles,
+ MBRange &connectivity,
+ bool topological_connectivity = false) const;
//! Gets a pointer to constant connectivity data of <em>entity_handle</em>
/** Sets <em>number_nodes</em> equal to the number of nodes of the <em>
Modified: MOAB/trunk/MBInterface.hpp
===================================================================
--- MOAB/trunk/MBInterface.hpp 2009-11-18 02:31:34 UTC (rev 3369)
+++ MOAB/trunk/MBInterface.hpp 2009-11-18 21:09:38 UTC (rev 3370)
@@ -426,6 +426,13 @@
const int num_handles,
MBRange &connectivity,
bool topological_connectivity = false) const =0;
+
+ //! Gets the connectivity for elements
+ /** Same as vector-based version except range is returned (unordered!)
+ */
+ virtual MBErrorCode get_connectivity( const MBRange& entity_handles,
+ MBRange &connectivity,
+ bool topological_connectivity = false) const =0;
//! Gets the connectivity for a vector of elements
/** Corner vertices or all vertices (including higher-order nodes, if any) are returned.
More information about the moab-dev
mailing list