[MOAB-dev] r1575 - MOAB/trunk
kraftche at mcs.anl.gov
kraftche at mcs.anl.gov
Fri Feb 1 16:53:46 CST 2008
Author: kraftche
Date: 2008-02-01 16:53:46 -0600 (Fri, 01 Feb 2008)
New Revision: 1575
Modified:
MOAB/trunk/MBBits.hpp
MOAB/trunk/MBCore.cpp
MOAB/trunk/TagServer.cpp
Log:
fix MBInterface::tag_delete_data for MB_TAG_SPARSE and MB_TAG_BIT tags
Modified: MOAB/trunk/MBBits.hpp
===================================================================
--- MOAB/trunk/MBBits.hpp 2008-02-01 20:09:22 UTC (rev 1574)
+++ MOAB/trunk/MBBits.hpp 2008-02-01 22:53:46 UTC (rev 1575)
@@ -511,6 +511,10 @@
//! set the bits associated with an entity handle, only if memory has been allocated
MBErrorCode weak_set_bits(MBTagId tag_id, MBEntityHandle handle, unsigned char bits);
+ //! clear bits
+ MBErrorCode clear_bits( MBTagId tag_id, MBEntityHandle handle, const unsigned char* defval )
+ { return weak_set_bits( tag_id, handle, defval ? *defval : '\0' ); }
+
MBErrorCode get_entities(MBTagId tag_id, MBRange& entities);
MBErrorCode get_entities(MBTagId tag_id, MBEntityType type, MBRange& entities);
Modified: MOAB/trunk/MBCore.cpp
===================================================================
--- MOAB/trunk/MBCore.cpp 2008-02-01 20:09:22 UTC (rev 1574)
+++ MOAB/trunk/MBCore.cpp 2008-02-01 22:53:46 UTC (rev 1575)
@@ -1442,9 +1442,6 @@
const MBEntityHandle *entity_handles,
const int num_handles)
{
- if (PROP_FROM_TAG_HANDLE(tag_handle) == MB_TAG_DENSE)
- return MB_FAILURE;
-
MBErrorCode status = MB_SUCCESS, temp_status;
for (int i = 0; i < num_handles; i++) {
if (0 == entity_handles[i])
@@ -1461,9 +1458,6 @@
MBErrorCode MBCore::tag_delete_data(const MBTag tag_handle,
const MBRange &entity_handles)
{
- if (PROP_FROM_TAG_HANDLE(tag_handle) == MB_TAG_DENSE)
- return MB_FAILURE;
-
MBErrorCode status = MB_SUCCESS, temp_status;
for (MBRange::const_iterator it = entity_handles.begin(); it != entity_handles.end(); it++) {
temp_status = tagServer->remove_data(tag_handle, *it);
Modified: MOAB/trunk/TagServer.cpp
===================================================================
--- MOAB/trunk/TagServer.cpp 2008-02-01 20:09:22 UTC (rev 1574)
+++ MOAB/trunk/TagServer.cpp 2008-02-01 22:53:46 UTC (rev 1575)
@@ -696,15 +696,20 @@
MBErrorCode TagServer::remove_data( const MBTag tag_handle, const MBEntityHandle entity_handle )
{
MBTagId tag_id = ID_FROM_TAG_HANDLE(tag_handle);
+ MBTagType storage = PROP_FROM_TAG_HANDLE(tag_handle);
+ if (tag_id > mTagTable[storage].size())
+ return MB_TAG_NOT_FOUND;
+ const void* defval = mTagTable[storage][tag_id-1].default_value();
+
switch (PROP_FROM_TAG_HANDLE(tag_handle)) {
case MB_TAG_DENSE:
- sequenceManager->remove_tag_data( tag_id, entity_handle,
- mTagTable[MB_TAG_DENSE][tag_id-1].default_value() );
+ sequenceManager->remove_tag_data( tag_id, entity_handle, defval );
return MB_SUCCESS;
case MB_TAG_SPARSE:
return mSparseData->remove_data(tag_id, entity_handle);
case MB_TAG_BIT:
- return MB_FAILURE;
+ return mBitServer->clear_bits( tag_id, entity_handle,
+ static_cast<const unsigned char*>(defval) );
case MB_TAG_MESH:
return MB_FAILURE;
}
More information about the moab-dev
mailing list