[MOAB-dev] r5913 - in MOAB/trunk/src: . moab
tautges at mcs.anl.gov
tautges at mcs.anl.gov
Fri Dec 14 12:31:35 CST 2012
Author: tautges
Date: 2012-12-14 12:31:35 -0600 (Fri, 14 Dec 2012)
New Revision: 5913
Modified:
MOAB/trunk/src/Core.cpp
MOAB/trunk/src/moab/Core.hpp
MOAB/trunk/src/moab/Interface.hpp
Log:
Adding an optional argument to
virtual ErrorCode get_connectivity(const EntityHandle *entity_handles,
const int num_handles,
std::vector<EntityHandle> &connectivity,
bool topological_connectivity = false,
std::vector<int> *offsets = NULL) const;
for returning offsets into connectivity array; this allows applications to call
this function for higher-order entities and polyhedra/gons. Resolves ticket 170.
Passes make check, serial and parallel.
Modified: MOAB/trunk/src/Core.cpp
===================================================================
--- MOAB/trunk/src/Core.cpp 2012-12-14 16:28:51 UTC (rev 5912)
+++ MOAB/trunk/src/Core.cpp 2012-12-14 18:31:35 UTC (rev 5913)
@@ -1228,9 +1228,10 @@
//! get the connectivity for element /handles. For non-element handles, return an error
ErrorCode Core::get_connectivity(const EntityHandle *entity_handles,
- const int num_handles,
- std::vector<EntityHandle> &connectivity,
- bool topological_connectivity) const
+ const int num_handles,
+ std::vector<EntityHandle> &connectivity,
+ bool topological_connectivity,
+ std::vector<int> *offsets) const
{
connectivity.clear(); // this seems wrong as compared to other API functions,
// but changing it breaks lost of code, so I'm leaving
@@ -1240,11 +1241,13 @@
std::vector<EntityHandle> tmp_storage; // used only for structured mesh
const EntityHandle* conn;
int len;
+ if (offsets) offsets->push_back(0);
for (int i = 0; i < num_handles; ++i) {
rval = get_connectivity( entity_handles[i], conn, len, topological_connectivity, &tmp_storage );
if (MB_SUCCESS != rval)
return rval;
connectivity.insert( connectivity.end(), conn, conn + len );
+ if (offsets) offsets->push_back(connectivity.size());
}
return MB_SUCCESS;
}
Modified: MOAB/trunk/src/moab/Core.hpp
===================================================================
--- MOAB/trunk/src/moab/Core.hpp 2012-12-14 16:28:51 UTC (rev 5912)
+++ MOAB/trunk/src/moab/Core.hpp 2012-12-14 18:31:35 UTC (rev 5913)
@@ -233,9 +233,10 @@
std::vector<EntityHandle> conn;
get_connectivity( entity_handle, conn ); \endcode */
virtual ErrorCode get_connectivity(const EntityHandle *entity_handles,
- const int num_handles,
- std::vector<EntityHandle> &connectivity,
- bool topological_connectivity = false) const;
+ const int num_handles,
+ std::vector<EntityHandle> &connectivity,
+ bool topological_connectivity = false,
+ std::vector<int> *offsets = NULL) const;
//! Gets the connectivity for a vector of elements
/** Same as vector-based version except range is returned (unordered!)
More information about the moab-dev
mailing list