[MOAB-dev] r3970 - in MOAB/trunk: src src/moab test
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Thu May 27 16:17:54 CDT 2010
Author: kraftche
Date: 2010-05-27 16:17:53 -0500 (Thu, 27 May 2010)
New Revision: 3970
Modified:
MOAB/trunk/src/BitTagServer.cpp
MOAB/trunk/src/BitTagServer.hpp
MOAB/trunk/src/Core.cpp
MOAB/trunk/src/SequenceManager.cpp
MOAB/trunk/src/SequenceManager.hpp
MOAB/trunk/src/SparseTagSuperCollection.cpp
MOAB/trunk/src/SparseTagSuperCollection.hpp
MOAB/trunk/src/TagServer.cpp
MOAB/trunk/src/TagServer.hpp
MOAB/trunk/src/moab/Core.hpp
MOAB/trunk/src/moab/Interface.hpp
MOAB/trunk/test/TagTest.cpp
Log:
Add new function Interface::tag_clear_data which can be used to set
the tag value every entity in a list/range to the same value.
Modified: MOAB/trunk/src/BitTagServer.cpp
===================================================================
--- MOAB/trunk/src/BitTagServer.cpp 2010-05-27 18:42:21 UTC (rev 3969)
+++ MOAB/trunk/src/BitTagServer.cpp 2010-05-27 21:17:53 UTC (rev 3970)
@@ -147,6 +147,26 @@
return MB_SUCCESS;
}
+ErrorCode BitTag::set_bits( const EntityHandle* handles,
+ int num_handles,
+ unsigned char value,
+ const unsigned char* default_value )
+{
+ EntityType type;
+ size_t page;
+ int offset;
+ for (int i = 0; i < num_handles; ++i) {
+ unpack( handles[i], type, page, offset );
+ if (pageList[type].size() <= page)
+ pageList[type].resize(page+1, 0);
+ if (!pageList[type][page])
+ pageList[type][page] = new BitPage( storedBitsPerEntity,
+ default_value ? *default_value : 0 );
+ pageList[type][page]->set_bits( offset, storedBitsPerEntity, value );
+ }
+ return MB_SUCCESS;
+}
+
ErrorCode BitTag::clear_bits( const EntityHandle* handles,
int num_handles,
const unsigned char* default_value )
@@ -230,6 +250,37 @@
return MB_SUCCESS;
}
+ErrorCode BitTag::set_bits( const Range& handles,
+ unsigned char value,
+ const unsigned char* default_value )
+{
+ EntityType type;
+ EntityID count;
+ size_t page;
+ int offset, per_page = ents_per_page();
+ unsigned char def = default_value ? *default_value : 0;
+ Range::const_pair_iterator i;
+ for (i = handles.const_pair_begin(); i != handles.const_pair_end(); ++i) {
+ unpack( i->first, type, page, offset );
+ assert(TYPE_FROM_HANDLE(i->second) == type); // should be true because id of zero is never used
+ count = i->second - i->first + 1;
+
+ while (count) {
More information about the moab-dev
mailing list