[MOAB-dev] r1403 - MOAB/trunk
kraftche at mcs.anl.gov
kraftche at mcs.anl.gov
Fri Nov 16 12:15:25 CST 2007
Author: kraftche
Date: 2007-11-16 12:15:21 -0600 (Fri, 16 Nov 2007)
New Revision: 1403
Removed:
MOAB/trunk/DenseTagCollections.cpp
MOAB/trunk/DenseTagCollections.hpp
Modified:
MOAB/trunk/MBCore.cpp
MOAB/trunk/Makefile.am
MOAB/trunk/SequenceData.cpp
MOAB/trunk/SequenceData.hpp
MOAB/trunk/SequenceManager.cpp
MOAB/trunk/SequenceManager.hpp
MOAB/trunk/TagServer.cpp
MOAB/trunk/TagServer.hpp
MOAB/trunk/TestTypeSequenceManager.cpp
MOAB/trunk/TypeSequenceManager.cpp
MOAB/trunk/UnstructuredElemSeq.cpp
MOAB/trunk/VertexSequence.cpp
Log:
store dense tags on entity sequences
Deleted: MOAB/trunk/DenseTagCollections.cpp
===================================================================
--- MOAB/trunk/DenseTagCollections.cpp 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/DenseTagCollections.cpp 2007-11-16 18:15:21 UTC (rev 1403)
@@ -1,243 +0,0 @@
-/**
- * MOAB, a Mesh-Oriented datABase, is a software component for creating,
- * storing and accessing finite element mesh data.
- *
- * Copyright 2004 Sandia Corporation. Under the terms of Contract
- * DE-AC04-94AL85000 with Sandia Coroporation, the U.S. Government
- * retains certain rights in this software.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- */
-
-
-
-/* Dense tag for MB
- *
- * File : DenseTagCollections.cpp
- * Creator: Clinton Stimpson
- * Date : 10-28-2002
- */
-
-#include "DenseTagCollections.hpp"
-
-#ifdef WIN32
-#ifdef _DEBUG
-// turn off warnings that say they debugging identifier has been truncated
-// this warning comes up when using some STL containers
-#pragma warning(disable : 4786)
-#endif
-#endif
-
-/*! page size of 1024 bytes for storage */
-const int DensePage::mPageSize = 1024;
-
-/*! returns an available tag id to use when getting and setting data */
-MBErrorCode DenseTagSuperCollection::reserve_tag_id(int num_bytes, const void* default_data, MBTagId tag_id)
-{
- // make sure we get a good number of bytes
- if(num_bytes <= 0 )
- return MB_FAILURE;
-
- // make sure we have storage for tag id
- if (mDensePageGroups.size() <= tag_id)
- mDensePageGroups.resize( tag_id+1, 0 );
-
- // make sure tag_id isn't already in use
- if (mDensePageGroups[tag_id])
- return MB_FAILURE;
-
- // allocate tag data
- mDensePageGroups[tag_id] = new DensePageGroup( num_bytes, default_data ) ;
-
- return MB_SUCCESS;
-
-}
-
-
-/*! give back a tag id that was used to set and get data */
-MBErrorCode DenseTagSuperCollection::release_tag_id(MBTagId tag_id)
-{
- std::vector<DensePageGroup*>::iterator group = mDensePageGroups.begin() + tag_id;
- if (group >= mDensePageGroups.end() || !*group)
- return MB_TAG_NOT_FOUND;
-
- delete *group;
- *group = 0;
-
- // clean up a bit if this is the last one
- while (!mDensePageGroups.back())
- mDensePageGroups.pop_back();
-
- return MB_SUCCESS;
-}
-
-void DenseTagSuperCollection::reset_data()
-{
- for (std::vector<DensePageGroup*>::iterator iter = mDensePageGroups.begin();
- iter != mDensePageGroups.end();
- ++iter)
- {
- if(*iter == NULL)
- continue;
- DensePageGroup* newgroup = new DensePageGroup( (*iter)->tag_size(), (*iter)->get_default_value() );
- delete *iter;
- *iter = newgroup;
- }
-}
-
-// get the entities with a tag
-MBErrorCode DenseTagSuperCollection::get_entities(const MBTagId tag_id, const MBEntityType type, MBRange& entities)
-{
- std::vector<DensePageGroup*>::iterator group = mDensePageGroups.begin() + tag_id;
- if (group >= mDensePageGroups.end() || !*group)
- return MB_TAG_NOT_FOUND;
-
- return (*group)->get_entities(type, entities);
-}
-
-// get the entities with a tag
-MBErrorCode DenseTagSuperCollection::get_entities(const MBRange &range,
- const MBTagId tag_id, const MBEntityType type, MBRange& entities)
-{
- std::vector<DensePageGroup*>::iterator group = mDensePageGroups.begin() + tag_id;
- if (group >= mDensePageGroups.end() || !*group)
- return MB_TAG_NOT_FOUND;
-
- MBRange dum_range;
- MBErrorCode result = (*group)->get_entities(type, dum_range);
- if (MB_SUCCESS != result) return result;
-
- std::set_intersection(dum_range.begin(), dum_range.end(),
- range.begin(), range.end(),
- mb_range_inserter(entities));
-
- return result;
-}
-
-// get number of entities with a tag
-MBErrorCode DenseTagSuperCollection::get_number_entities(const MBTagId tag_id, const MBEntityType type, int& entities)
-{
- std::vector<DensePageGroup*>::iterator group = mDensePageGroups.begin() + tag_id;
- if (group >= mDensePageGroups.end() || !*group)
- return MB_TAG_NOT_FOUND;
-
- return (*group)->get_number_entities(type, entities);
-}
-
-// get number of entities with a tag
-MBErrorCode DenseTagSuperCollection::get_number_entities(const MBRange &range,
- const MBTagId tag_id, const MBEntityType type, int& entities)
-{
- MBRange dum_range;
- MBErrorCode result = get_entities(range, tag_id, type, dum_range);
- if (MB_SUCCESS != result) return result;
- entities = dum_range.size();
-
- return result;
-}
-
-//! get the entities with a value
-MBErrorCode DenseTagSuperCollection::get_entities_with_tag_value(const MBTagId tag_id, const MBEntityType type,
- MBRange &entities, const void* value)
-{
- std::vector<DensePageGroup*>::iterator group = mDensePageGroups.begin() + tag_id;
- if (group >= mDensePageGroups.end() || !*group)
- return MB_TAG_NOT_FOUND;
-
- return (*group)->get_entities_with_tag_value(type, value, entities);
-}
-
-
-//! get the entities with a value
-MBErrorCode DenseTagSuperCollection::get_entities_with_tag_value(const MBRange &range,
- const MBTagId tag_id,
- const MBEntityType type,
- MBRange &entities,
- const void* value)
-{
- MBRange dum_range;
- MBErrorCode result = get_entities_with_tag_value(tag_id, type, dum_range, value);
- if (MB_SUCCESS != result) return result;
-
- std::set_intersection(range.begin(), range.end(),
- dum_range.begin(), dum_range.end(),
- mb_range_inserter(entities));
- return result;
-}
-
-MBErrorCode DenseTagSuperCollection::get_memory_use( MBTagId tag_id,
- unsigned long& total,
- unsigned long& per_entity )
-{
- std::vector<DensePageGroup*>::iterator group;
-
- // get memory use by dense page group
- group = mDensePageGroups.begin() + tag_id;
- if (group >= mDensePageGroups.end() || !*group)
- return MB_TAG_NOT_FOUND;
- (*group)->get_memory_use( total, per_entity );
-
- // count number of occupied slots in mDensePageGroups
- unsigned num_used = 0;
- for (group = mDensePageGroups.begin(); group != mDensePageGroups.end(); ++group)
- if (*group)
- ++num_used;
-
- // add in amortized storage in mDensePageGroups vector
- total += sizeof(DensePageGroup*) * mDensePageGroups.capacity() / num_used;
-
- return MB_SUCCESS;
-}
-
-MBErrorCode DensePageGroup::get_entities_with_tag_value(const MBEntityType type,
- const void* value,
- MBRange &entities) const
-{
- // for now, return if default value is requested
- if (mDefaultValue && !memcmp(value,mDefaultValue,mBytesPerFlag))
- return MB_FAILURE;
-
- // iterate over dense pages
- std::vector<DensePage>::const_iterator page_it;
- const std::vector<DensePage>::const_iterator end = mDensePages[type].end();
- int dum =0;
- MBEntityHandle handle = CREATE_HANDLE(type, 0, dum);
- MBRange::iterator insert_iter = entities.begin();
- int first_i = MB_START_ID;
- for(page_it = mDensePages[type].begin(); page_it != end;
- ++page_it, handle += DensePage::mPageSize)
- {
- if (page_it->has_data()) {
- for (int i = first_i; i < DensePage::mPageSize; i++) {
- if (!page_it->memcmp(i, mBytesPerFlag, value))
- entities.insert(handle+i);
- }
- first_i = 0;
- }
- }
-
- return MB_SUCCESS;
-}
-
-MBErrorCode DensePageGroup::get_memory_use( unsigned long& total,
- unsigned long& per_entity ) const
-{
- per_entity = tag_size();
-
- total = sizeof(*this);
- if (mDefaultValue)
- total += tag_size();
-
- for (unsigned i = 0; i < MBMAXTYPE; ++i) {
- total += mDensePages[i].capacity() * sizeof(DensePage);
- for (unsigned long j = 0; j < mDensePages[i].size(); ++j)
- if (mDensePages[i][j].has_data())
- total += DensePage::mPageSize * tag_size();
- }
-
- return MB_SUCCESS;
-}
Deleted: MOAB/trunk/DenseTagCollections.hpp
===================================================================
--- MOAB/trunk/DenseTagCollections.hpp 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/DenseTagCollections.hpp 2007-11-16 18:15:21 UTC (rev 1403)
@@ -1,532 +0,0 @@
-/**
- * MOAB, a Mesh-Oriented datABase, is a software component for creating,
- * storing and accessing finite element mesh data.
- *
- * Copyright 2004 Sandia Corporation. Under the terms of Contract
- * DE-AC04-94AL85000 with Sandia Coroporation, the U.S. Government
- * retains certain rights in this software.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- */
-
-
-/* Dense tag storage for MB
- *
- * File : DenseTagCollections.hpp
- * Creator: Clinton Stimpson
- * Date : 10-28-2002
- *
- * DenseTagSuperCollection: contains a vector of DensePageGroup objects
- * DensePageGroup: vector of vectors of DensePage objects, one vector per
- * entity type, blocking possible handles in the type
- * DensePage: block of values corresponding to a block of handles of a given
- * type; may or may not have data allocated
- */
-
-#ifndef DENSE_TAG_COLLECTIONS_HPP
-#define DENSE_TAG_COLLECTIONS_HPP
-
-#ifndef IS_BUILDING_MB
-#error "DenseTagCollections.hpp isn't supposed to be included into an application"
-#endif
-
-#include "MBInternals.hpp"
-#include "MBTypes.h"
-#include "MBRange.hpp"
-
-#include <vector>
-#include <assert.h>
-
-
-
-//! dense page class
-/*! This class stores a page of memory for storing dense data
-*/
-class DensePage
-{
-
-public:
-
- //! the page size
- static const int mPageSize;
-
- // default constructor
- DensePage() : mByteArray(0) {}
-
- // default destructor
- ~DensePage() { delete [] mByteArray; }
-
- //! get the bytes from a page
- MBErrorCode get_bytes(int offset, int num_bytes_per_flag,
- void* data) const;
-
- //! set the bytes in a page
- MBErrorCode set_bytes(int offset, int num_bytes_per_flag,
- const void* default_data, const void* data);
-
- //! remove the bytes in page only if space has been allocated
- MBErrorCode remove_data(int offset, int num_bytes_per_flag,
- const void* default_data);
-
- //! return whether has data or not
- bool has_data() const { return mByteArray != 0; }
-
- //! do a memcmp on one of the values in this page
- bool memcmp(int offset, int num_bytes_per_flag, const void *data) const;
-
- //!std::auto_ptr-style behavior
- DensePage( const DensePage& other )
- : mByteArray(other.mByteArray)
- { const_cast<DensePage&>(other).mByteArray = 0; }
- DensePage& operator=( const DensePage& other )
- {
- assert(!mByteArray);
- delete [] mByteArray;
- mByteArray = other.mByteArray;
- const_cast<DensePage&>(other).mByteArray = 0;
- return *this;
- }
-
-private:
-
- //! byte array, uses lazy allocation
- unsigned char* mByteArray;
-};
-
-/*! get the bytes from a page
- takes offset into the page
- takes how many bytes to get
- return data
-*/
-inline MBErrorCode DensePage::get_bytes(int offset, int num_bytes_per_flag, void* data) const
-{
- // if no memory has been allocated, get the default value
- if(!mByteArray)
- {
- return MB_TAG_NOT_FOUND;
- }
-
- unsigned char* data_to_copy = mByteArray + offset*num_bytes_per_flag;
- memcpy(data, data_to_copy, num_bytes_per_flag);
-
- return MB_SUCCESS;
-}
-
-//! do a memcmp on one of the values in this page
-inline bool DensePage::memcmp(int offset, int num_bytes_per_flag, const void *data) const
-{
- // if no memory has been allocated, get the default value
- assert(mByteArray);
-
- return ::memcmp(mByteArray + offset*num_bytes_per_flag, data, num_bytes_per_flag);
-}
-
-/*! set the bytes in a page
- takes byte offset into the page
- takes how many bytes to set
- takes the data to set
-*/
-inline MBErrorCode DensePage::set_bytes(int offset,
- int num_bytes_per_flag, const void* default_data, const void* data)
-{
- // if memory hasn't been allocated, allocate it and zero the memory
- if(!mByteArray)
- {
- mByteArray = new unsigned char [mPageSize*num_bytes_per_flag];
- if (!mByteArray)
- return MB_MEMORY_ALLOCATION_FAILED;
-
- if(!default_data)
- {
- memset(mByteArray, 0, mPageSize*num_bytes_per_flag);
- }
- else
- {
- unsigned char* byte_array = mByteArray;
- unsigned char* byte_array_end = byte_array + mPageSize*num_bytes_per_flag;
- for(; byte_array < byte_array_end; byte_array += num_bytes_per_flag)
- {
- memcpy(byte_array, default_data, num_bytes_per_flag);
- }
- }
- }
-
- unsigned char* data_to_copy = mByteArray + offset*num_bytes_per_flag;
- memcpy(data_to_copy, data, num_bytes_per_flag);
- return MB_SUCCESS;
-
-}
-
-/*! remove data if memory has been allocated
- takes byte offset
- takes number of bytes to set
- takes the data to set
-*/
-inline MBErrorCode DensePage::remove_data(int offset,
- int num_bytes_per_flag, const void* default_data)
-{
- if(mByteArray)
- {
- unsigned char* data_to_copy = mByteArray + offset*num_bytes_per_flag;
- if(default_data)
- memcpy(data_to_copy, default_data, num_bytes_per_flag);
- else
- memset(data_to_copy, 0, num_bytes_per_flag);
- }
- return MB_SUCCESS;
-}
-
-//! class which is a collection of byte pages
-class DensePageGroup
-{
-public:
- // default constructor
- DensePageGroup(int bytes_per_flag, const void* default_value)
- : mBytesPerFlag(bytes_per_flag),
- mDefaultValue(0)
- {
- if (default_value) {
- mDefaultValue = malloc(bytes_per_flag);
- memcpy( mDefaultValue, default_value, bytes_per_flag );
- }
- }
-
- // default destructor
- ~DensePageGroup() { free(mDefaultValue); }
-
- //! get data from byte pages
- MBErrorCode get_data(MBEntityHandle handle, void* data) const;
-
- //! set data in byte pages
- MBErrorCode set_data(MBEntityHandle handle, const void* data);
-
- //! remove data associated to an entity
- MBErrorCode remove_data(MBEntityHandle handle);
-
- //! get number of entities of type
- MBErrorCode get_number_entities(MBEntityType type, int& num_entities) const;
-
- //! get the entities
- MBErrorCode get_entities(MBEntityType type, MBRange& entities) const;
-
- //! get the entities
- MBErrorCode get_entities(MBRange& entities) const;
-
- //! get the entities with a value
- MBErrorCode get_entities_with_tag_value(const MBEntityType type, const void* value,
- MBRange &entities) const;
-
- //! return true if this page group contains this entity, false otherwise
- bool contains(const MBEntityHandle entity) const;
-
-
- int tag_size() const { return mBytesPerFlag; }
-
- const void* get_default_value() const { return mDefaultValue; }
-
- MBErrorCode get_memory_use( unsigned long& total,
- unsigned long& per_entity ) const;
-
-private:
-
- //! number of bytes for each entity
- unsigned short mBytesPerFlag;
-
- //! default value for tag
- void* mDefaultValue;
-
- //! vectors of dense byte pages
- //! allocate more than MBMAXTYPE vectors - instead allocate for all possible
- //! values of the type bits within a handle so we don't need to check the
- //! size of the type all the time - just let in index an empty list and just
- //! return not-found if it is out of bounds.
- std::vector<DensePage> mDensePages[1<<MB_TYPE_WIDTH];
-
- //! don't allow copy of this class
- DensePageGroup& operator=(const DensePageGroup&);
-
- //! don't allow copy of this class
- DensePageGroup(const DensePageGroup&);
-};
-
-/*! get the data from pages
- takes entity handle
- return the data
-*/
-inline MBErrorCode DensePageGroup::get_data(MBEntityHandle handle, void* data) const
-{
- // strip off the entity type
- const MBEntityType type = TYPE_FROM_HANDLE( handle );
- const MBEntityID entity_id = ID_FROM_HANDLE(handle);
- // figure out which page to jump to
- const MBEntityID which_page = entity_id / DensePage::mPageSize;
- const unsigned int offset = entity_id % DensePage::mPageSize;
-
- std::vector<DensePage>::const_iterator page = mDensePages[type].begin() + which_page;
- if (page >= mDensePages[type].end())
- return MB_TAG_NOT_FOUND;
-
- return page->get_bytes( offset, mBytesPerFlag, data);
-}
-
-inline bool DensePageGroup::contains(const MBEntityHandle handle) const
-{
- // strip off the entity type
- const MBEntityType type = TYPE_FROM_HANDLE( handle );
- const MBEntityID entity_id = ID_FROM_HANDLE(handle);
- // figure out which page to jump to
- const MBEntityID which_page = entity_id / DensePage::mPageSize;
-
- std::vector<DensePage>::const_iterator page = mDensePages[type].begin() + which_page;
- return page < mDensePages[type].end() && page->has_data();
-}
-
-/*! set the data in pages
- takes entity handle
- takes the data to set
-*/
-inline MBErrorCode DensePageGroup::set_data(MBEntityHandle handle, const void* data)
-{
- // strip off the entity type
- const MBEntityType type = TYPE_FROM_HANDLE( handle );
- const MBEntityID entity_id = ID_FROM_HANDLE(handle);
- // figure out which page to jump to
- const MBEntityID which_page = entity_id / DensePage::mPageSize;
- const unsigned int offset = entity_id % DensePage::mPageSize;
-
- std::vector<DensePage>::iterator page = mDensePages[type].begin() + which_page;
- if (page >= mDensePages[type].end()) {
- mDensePages[type].resize(mDensePages[type].size() + which_page + 1);
- page = mDensePages[type].begin() + which_page;
- }
-
- // return data in page
- return page->set_bytes( offset, mBytesPerFlag, mDefaultValue, data);
-}
-
-
-/*! set the data in pages
- takes entity handle
- takes the default data to set
-*/
-inline MBErrorCode DensePageGroup::remove_data(MBEntityHandle handle)
-{
- // strip off the entity type
- const MBEntityType type = TYPE_FROM_HANDLE( handle );
- const MBEntityID entity_id = ID_FROM_HANDLE(handle);
- // figure out which page to jump to
- const MBEntityID which_page = entity_id / DensePage::mPageSize;
- const unsigned int offset = entity_id % DensePage::mPageSize;
-
- std::vector<DensePage>::iterator page = mDensePages[type].begin() + which_page;
- // if the page doesn't exist, return
- // Return value changed from MB_SUCCESS to MB_FAILURE - j.k. 2006-8-23
- if (page >= mDensePages[type].end())
- return MB_FAILURE;
-
- // try to clean out data
- return page->remove_data( offset, mBytesPerFlag, mDefaultValue );
-}
-
-//! get the entities
-inline MBErrorCode DensePageGroup::get_entities(MBEntityType type, MBRange& entities) const
-{
- std::vector<DensePage>::const_iterator iter;
- const std::vector<DensePage>::const_iterator end = mDensePages[type].end();
- int dum =0;
- MBEntityHandle handle = CREATE_HANDLE(type, 0, dum);
- MBEntityID first_time = MB_START_ID; // Don't want zero-ID handle at start of range.
- MBRange::iterator insert_pos = entities.begin();
- for(iter = mDensePages[type].begin(); iter != end; ++iter, handle += DensePage::mPageSize)
- {
- if (iter->has_data())
- insert_pos = entities.insert( insert_pos, handle + first_time, handle + DensePage::mPageSize - 1 );
- first_time = 0;
- }
- return MB_SUCCESS;
-}
-
-//! get the entities
-inline MBErrorCode DensePageGroup::get_entities(MBRange& entities) const
-{
- std::vector<DensePage>::const_iterator iter;
- int dum =0;
- for (MBEntityType type = MBENTITYSET; type >= MBVERTEX; type--) {
- const std::vector<DensePage>::const_iterator end = mDensePages[type].end();
- MBEntityHandle handle = CREATE_HANDLE(type, 0, dum);
- MBEntityID first_time = MB_START_ID; // Don't want zero-ID handle at start of range.
- MBRange::iterator insert_pos = entities.begin();
- for(iter = mDensePages[type].begin(); iter != end; ++iter, handle += DensePage::mPageSize)
- {
- if (iter->has_data())
- insert_pos = entities.insert( insert_pos, handle + first_time, handle + DensePage::mPageSize - 1 );
- first_time = 0;
- }
- }
-
- return MB_SUCCESS;
-}
-
-//! get number of entities of type
-inline MBErrorCode DensePageGroup::get_number_entities(MBEntityType type, int& entities) const
-{
- entities = 0;
- std::vector<DensePage>::const_iterator iter;
- const std::vector<DensePage>::const_iterator end = mDensePages[type].end();
- MBEntityID first_time = MB_START_ID;
- for(iter = mDensePages[type].begin(); iter != end; ++iter) {
- if(iter->has_data())
- entities += DensePage::mPageSize - first_time;
- first_time = 0;
- }
- return MB_SUCCESS;
-}
-
-//! DenseTagSuperCollection class provides constant time
-//! lookup for data tagged on entities
-class DenseTagSuperCollection
-{
-public:
- //! default constructor
- DenseTagSuperCollection() {}
-
- //! default destructor
- ~DenseTagSuperCollection()
- {
- // clean things out
- clear();
- }
-
- void reset_data();
-
- //! allocate new tag id
- MBErrorCode reserve_tag_id(int data_size, const void* default_data, MBTagId tag_id);
- //! release a tag id for reuse
- MBErrorCode release_tag_id(MBTagId tag_id);
- //! get the tag size
- int tag_size(const MBTagId tag_id) const;
- //! set the data associated with an entity handle
- MBErrorCode set_data(MBTagId tag_id, MBEntityHandle handle, const void* data);
- //! get the data associated with an entity handle
- MBErrorCode get_data(const MBTagId tag_id, const MBEntityHandle handle, void* data);
- //! remove/clean out data associated with an entity handle, only if memory has been allocated
- MBErrorCode remove_data(MBTagId tag_id, MBEntityHandle handle);
-
- //! get the entities with a tag
- MBErrorCode get_number_entities(const MBTagId tag_id, const MBEntityType type, int& num_entities);
-
- //! get the entities with a tag
- MBErrorCode get_number_entities(const MBRange &range,
- const MBTagId tag_id, const MBEntityType type, int& num_entities);
-
- //! get the entities with a tag
- MBErrorCode get_entities(const MBTagId tag_id, const MBEntityType type, MBRange& entities);
-
- //! get the entities with a tag
- MBErrorCode get_entities(const MBTagId tag_id, MBRange& entities);
-
- //! get the entities with a tag
- MBErrorCode get_entities(const MBRange &range,
- const MBTagId tag_id, const MBEntityType type, MBRange& entities);
-
- //! get the entities with a value
- MBErrorCode get_entities_with_tag_value(const MBTagId tag_id, const MBEntityType type,
- MBRange &entities, const void* value);
-
- //! get the entities with a value
- MBErrorCode get_entities_with_tag_value(const MBRange &range,
- const MBTagId tag_id, const MBEntityType type,
- MBRange &entities, const void* value);
-
- //! get all tags defined on an entity
- MBErrorCode get_tags(const MBEntityHandle entity,
- std::vector<MBTag> &tags);
-
- MBErrorCode get_memory_use( MBTagId tag_id,
- unsigned long& total,
- unsigned long& per_entity );
-private:
-
- //! clean things out
- void clear()
- {
- for (std::vector<DensePageGroup*>::iterator i = mDensePageGroups.begin();
- i != mDensePageGroups.end(); ++i)
- delete *i;
- mDensePageGroups.clear();
- }
-
-
- //! dense pages are indexed by tag id
- std::vector< DensePageGroup* > mDensePageGroups;
-};
-
-/*! get some data based on a tag id and handle */
-inline MBErrorCode DenseTagSuperCollection::get_data(const MBTagId tag_id,
- const MBEntityHandle handle, void* data)
-{
- std::vector<DensePageGroup*>::iterator group = mDensePageGroups.begin() + tag_id;
- if (group >= mDensePageGroups.end() || !*group)
- return MB_TAG_NOT_FOUND;
-
- return (*group)->get_data( handle, data );
-}
-
-/*! set some data based on a tag id and handle */
-inline MBErrorCode DenseTagSuperCollection::set_data(MBTagId tag_id,
- MBEntityHandle handle, const void* data)
-{
- std::vector<DensePageGroup*>::iterator group = mDensePageGroups.begin() + tag_id;
- if (group >= mDensePageGroups.end() || !*group)
- return MB_TAG_NOT_FOUND;
-
- return (*group)->set_data(handle, data);
-}
-
-/*! set some data based on a tag id and handle only if memory has been allocated*/
-inline MBErrorCode DenseTagSuperCollection::remove_data(MBTagId tag_id, MBEntityHandle handle )
-{
- std::vector<DensePageGroup*>::iterator group = mDensePageGroups.begin() + tag_id;
- if (group >= mDensePageGroups.end() || !*group)
- return MB_TAG_NOT_FOUND;
-
- return (*group)->remove_data(handle);
-}
-
-inline int DenseTagSuperCollection::tag_size(const MBTagId tag_id) const
-{
- std::vector<DensePageGroup*>::const_iterator group = mDensePageGroups.begin() + tag_id;
- if (group >= mDensePageGroups.end() || !*group)
- return MB_TAG_NOT_FOUND;
-
- return (*group)->tag_size();
-}
-
- //! get all tags defined on an entity
-inline MBErrorCode DenseTagSuperCollection::get_tags(const MBEntityHandle entity,
- std::vector<MBTag> &tags)
-{
- for (unsigned tagid = 0; tagid < mDensePageGroups.size(); ++tagid)
- if (mDensePageGroups[tagid] && mDensePageGroups[tagid]->contains(entity))
- tags.push_back( TAG_HANDLE_FROM_ID( tagid, MB_TAG_DENSE ) );
- return MB_SUCCESS;
-}
-
-// get the entities with a tag
-inline MBErrorCode DenseTagSuperCollection::get_entities(const MBTagId tag_id,
- MBRange& entities)
-{
- std::vector<DensePageGroup*>::iterator group = mDensePageGroups.begin() + tag_id;
- if (group >= mDensePageGroups.end() || !*group)
- return MB_TAG_NOT_FOUND;
-
- return (*group)->get_entities(entities);
-}
-
-#endif
-
-
Modified: MOAB/trunk/MBCore.cpp
===================================================================
--- MOAB/trunk/MBCore.cpp 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/MBCore.cpp 2007-11-16 18:15:21 UTC (rev 1403)
@@ -146,15 +146,15 @@
dirichletBCTag = 0;
geomDimensionTag = 0;
globalIdTag = 0;
-
- tagServer = new TagServer();
- if (!tagServer)
- return MB_MEMORY_ALLOCATION_FAILED;
sequenceManager = new SequenceManager( handleUtils );
if (!sequenceManager)
return MB_MEMORY_ALLOCATION_FAILED;
+ tagServer = new TagServer( sequenceManager );
+ if (!tagServer)
+ return MB_MEMORY_ALLOCATION_FAILED;
+
aEntityFactory = new AEntityFactory(this);
if (!aEntityFactory)
return MB_MEMORY_ALLOCATION_FAILED;
@@ -494,9 +494,7 @@
tagServer->reset_all_data();
- if (sequenceManager)
- delete sequenceManager;
- sequenceManager = new SequenceManager( handleUtils );
+ sequenceManager->clear();
return result;
}
Modified: MOAB/trunk/Makefile.am
===================================================================
--- MOAB/trunk/Makefile.am 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/Makefile.am 2007-11-16 18:15:21 UTC (rev 1403)
@@ -91,8 +91,6 @@
libMOAB_la_SOURCES = \
AEntityFactory.cpp \
AEntityFactory.hpp \
- DenseTagCollections.cpp \
- DenseTagCollections.hpp \
DualTool.cpp \
ElementSequence.hpp \
EntitySequence.cpp \
Modified: MOAB/trunk/SequenceData.cpp
===================================================================
--- MOAB/trunk/SequenceData.cpp 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/SequenceData.cpp 2007-11-16 18:15:21 UTC (rev 1403)
@@ -1,9 +1,10 @@
#include "SequenceData.hpp"
+#include "TagServer.hpp"
#include <assert.h>
SequenceData::~SequenceData()
{
- for (int i = -numSequenceData; i <= numTagData; ++i)
+ for (int i = -numSequenceData; i <= (int)numTagData; ++i)
free( arraySet[i] );
free( arraySet - numSequenceData );
}
@@ -59,36 +60,38 @@
return reinterpret_cast<AdjacencyDataType*>(arraySet[0]);
}
-void* SequenceData::create_tag_data( int tag_num,
+void SequenceData::increase_tag_count( unsigned amount )
+{
+ void** list = arraySet - numSequenceData;
+ const size_t size = sizeof(void*) * (numSequenceData + numTagData + amount + 1);
+ list = (void**)realloc( list, size );
+ arraySet = list + numSequenceData;
+ memset( arraySet + numTagData + 1, 0, sizeof(void*) * amount );
+ numTagData += amount;
+}
+
+void* SequenceData::create_tag_data( MBTagId tag_num,
int bytes_per_ent,
const void* initial_val )
{
- const int index = tag_num + 1;
- if (tag_num >= numTagData) {
- void** list = arraySet - numSequenceData;
- const size_t size = sizeof(void*) * (numSequenceData + tag_num + 1);
- list = (void**)realloc( list, size );
- arraySet = list + numSequenceData;
- memset( arraySet + numTagData, 0, sizeof(void*) * (tag_num + 1 - numTagData) );
- }
+ if (tag_num >= numTagData)
+ increase_tag_count( tag_num - numTagData + 1 );
- assert( !arraySet[index] );
- return create_data( index, bytes_per_ent, initial_val );
+ assert( !arraySet[tag_num + 1] );
+ return create_data( tag_num + 1, bytes_per_ent, initial_val );
}
SequenceData* SequenceData::subset( MBEntityHandle start,
MBEntityHandle end,
- const int* sequence_data_sizes,
- const int* tag_data_sizes ) const
+ const int* sequence_data_sizes ) const
{
- return new SequenceData( this, start, end, sequence_data_sizes, tag_data_sizes );
+ return new SequenceData( this, start, end, sequence_data_sizes );
}
SequenceData::SequenceData( const SequenceData* from,
MBEntityHandle start,
MBEntityHandle end,
- const int* sequence_data_sizes,
- const int* tag_data_sizes )
+ const int* sequence_data_sizes )
: numSequenceData( from->numSequenceData ),
numTagData( from->numTagData ),
startHandle( start ),
@@ -107,8 +110,8 @@
for (int i = 0; i < numSequenceData; ++i)
copy_data_subset( -1 - i, sequence_data_sizes[i], from->get_sequence_data(i), offset, count );
copy_data_subset( 0, sizeof(AdjacencyDataType*), from->get_adjacency_data(), offset, count );
- for (int i = 0; i< numTagData; ++i)
- copy_data_subset( 1 + i, tag_data_sizes[i], from->get_tag_data(i), offset, count );
+ for (unsigned i = 1; i <= numTagData; ++i)
+ arraySet[i] = 0;
}
void SequenceData::copy_data_subset( int index,
@@ -127,3 +130,43 @@
}
}
+void SequenceData::move_tag_data( SequenceData* destination, TagServer* tag_server )
+{
+ assert( destination->start_handle() >= start_handle() );
+ assert( destination->end_handle() <= end_handle() );
+ const size_t offset = destination->start_handle() - start_handle();
+ const size_t count = destination->size();
+ if (destination->numTagData < numTagData)
+ destination->increase_tag_count( numTagData - destination->numTagData );
+
+ for (unsigned i = 1; i <= numTagData; ++i) {
+ if (!arraySet[i])
+ continue;
+
+ const TagInfo* info = tag_server->get_tag_info( TAG_HANDLE_FROM_ID( i-1, MB_TAG_DENSE ) );
+ if (!info)
+ continue;
+
+ const int tag_size = info->get_size();
+ if (!destination->arraySet[i])
+ destination->arraySet[i] = malloc( count * tag_size );
+ memcpy( destination->arraySet[i],
+ reinterpret_cast<char*>(arraySet[i]) + offset * tag_size,
+ count * tag_size );
+ }
+}
+
+void SequenceData::release_tag_data()
+{
+ for (unsigned i = 1; i <= numTagData; ++i)
+ release_tag_data( i );
+}
+
+void SequenceData::release_tag_data( MBTagId tag_num )
+{
+ if (tag_num < numTagData) {
+ free( arraySet[tag_num+1] );
+ arraySet[tag_num+1] = 0;
+ }
+}
+
Modified: MOAB/trunk/SequenceData.hpp
===================================================================
--- MOAB/trunk/SequenceData.hpp 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/SequenceData.hpp 2007-11-16 18:15:21 UTC (rev 1403)
@@ -14,65 +14,128 @@
typedef std::vector<MBEntityHandle>* AdjacencyDataType;
+ /**\param num_sequence_arrays Number of data arrays needed by the EntitySequence
+ * \param start First handle in this SequenceData
+ * \param end Last handle in this SequenceData
+ */
inline SequenceData( int num_sequence_arrays,
MBEntityHandle start,
MBEntityHandle end );
virtual ~SequenceData();
+ /**\return first handle in this sequence data */
MBEntityHandle start_handle() const
{ return startHandle; }
+ /**\return last handle in this sequence data */
MBEntityHandle end_handle() const
{ return endHandle; }
MBEntityID size() const
{ return endHandle + 1 - startHandle; }
-
+
+ /**\return ith array of EnitySequence-specific data */
void* get_sequence_data( int array_num )
{ return arraySet[-1-array_num]; }
+ /**\return ith array of EnitySequence-specific data */
void const* get_sequence_data( int array_num ) const
{ return arraySet[-1-array_num]; }
+ /**\return array of adjacency data, or NULL if none. */
AdjacencyDataType* get_adjacency_data( )
{ return reinterpret_cast<AdjacencyDataType*>(arraySet[0]); }
+ /**\return array of adjacency data, or NULL if none. */
AdjacencyDataType const* get_adjacency_data( ) const
{ return reinterpret_cast<AdjacencyDataType const*>(arraySet[0]); }
- void* get_tag_data( int tag_num )
+ /**\return array of dense tag data, or NULL if none. */
+ void* get_tag_data( MBTagId tag_num )
{ return tag_num < numTagData ? arraySet[tag_num+1] : 0; }
- void const* get_tag_data( int tag_num ) const
+ /**\return array of dense tag data, or NULL if none. */
+ void const* get_tag_data( MBTagId tag_num ) const
{ return tag_num < numTagData ? arraySet[tag_num+1] : 0; }
+ /**\brief Allocate array of sequence-specific data
+ *
+ * Allocate an array of EntitySequence-specific data.
+ *\param array_num Index for which to allocate array.
+ * Must be in [0,num_sequence_arrays], where
+ * num_sequence_arrays is constructor argument.
+ *\param bytes_per_ent Bytes to allocate for each entity.
+ *\param initial_val Value to initialize array with. If non-null, must
+ * be bytes_per_ent long. If NULL, array will be zeroed.
+ *\return The newly allocated array, or NULL if error.
+ */
void* create_sequence_data( int array_num,
int bytes_per_ent,
const void* initial_val = 0 );
+ /**\brief Allocate array of sequence-specific data
+ *
+ * Allocate an array of EntitySequence-specific data.
+ *\param array_num Index for which to allocate array.
+ * Must be in [0,num_sequence_arrays], where
+ * num_sequence_arrays is constructor argument.
+ *\return The newly allocated array, or NULL if error.
+ */
void* create_custom_data( int array_num, size_t total_bytes );
+ /**\brief Allocate array for storing adjacency data.
+ *
+ * Allocate array for storing adjacency data.
+ *\return The newly allocated array, or NULL if already allocated.
+ */
AdjacencyDataType* allocate_adjacency_data();
- void* create_tag_data( int tag_num, int bytes_per_ent, const void* initial_val = 0 );
+ /**\brief Allocate array of dense tag data
+ *
+ * Allocate an array of dense tag data.
+ *\param tag_num Dense tag ID for which to allocate array.
+ *\param bytes_per_ent Bytes to allocate for each entity.
+ *\param initial_val Value to initialize array with. If non-null, must
+ * be bytes_per_ent long. If NULL, array will be zeroed.
+ *\return The newly allocated array, or NULL if error.
+ */
+ void* create_tag_data( MBTagId tag_num, int bytes_per_ent, const void* initial_val = 0 );
+ /**\brief Create new SequenceData that is a copy of a subset of this one
+ *
+ * Create a new SequenceData that is a copy of a subset of this one.
+ * This function is intended for use in subdividing a SequenceData
+ * for operations such as changing the number of nodes in a block of
+ * elements.
+ *\param start First handle for resulting subset
+ *\param end Last handle for resulting subset
+ *\param sequence_data_sizes Bytes-per-entity for sequence-specific data.
+ *\NOTE Does not copy tag data.
+ */
SequenceData* subset( MBEntityHandle start,
MBEntityHandle end,
- const int* sequence_data_sizes,
- const int* tag_data_sizes ) const;
+ const int* sequence_data_sizes ) const;
+ /**\brief SequenceManager data */
TypeSequenceManager::SequenceDataPtr seqManData;
- void move_tag_data( SequenceData* destination, TagServer* tag_server ) {}
+ /**\brief Move tag data for a subset of this sequences to specified sequence */
+ void move_tag_data( SequenceData* destination, TagServer* tag_server );
+ /**\brief Free all tag data arrays */
+ void release_tag_data();
+ /**\brief Free specified tag data array */
+ void release_tag_data( MBTagId tag_num );
+
protected:
SequenceData( const SequenceData* subset_from,
MBEntityHandle start,
MBEntityHandle end,
- const int* sequence_data_sizes,
- const int* tag_data_sizes );
+ const int* sequence_data_sizes );
private:
+ void increase_tag_count( unsigned by_this_many );
+
void* create_data( int index, int bytes_per_ent, const void* initial_val = 0 );
void copy_data_subset( int index,
int size_per_ent,
@@ -81,7 +144,7 @@
size_t count );
const int numSequenceData;
- int numTagData;
+ unsigned numTagData;
void** arraySet;
MBEntityHandle startHandle, endHandle;
};
Modified: MOAB/trunk/SequenceManager.cpp
===================================================================
--- MOAB/trunk/SequenceManager.cpp 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/SequenceManager.cpp 2007-11-16 18:15:21 UTC (rev 1403)
@@ -8,12 +8,24 @@
#include "PolyElementSeq.hpp"
#include <assert.h>
+#include <new>
const int DEFAULT_VERTEX_SEQUENCE_SIZE = 4096;
const int DEFAULT_ELEMENT_SEQUENCE_SIZE = DEFAULT_VERTEX_SEQUENCE_SIZE;
const int DEFAULT_POLY_SEQUENCE_SIZE = 4 * DEFAULT_ELEMENT_SEQUENCE_SIZE;
const int DEFAULT_MESHSET_SEQUENCE_SIZE = DEFAULT_VERTEX_SEQUENCE_SIZE;
+void SequenceManager::clear()
+{
+ // destroy all TypeSequenceManager instances
+ for (MBEntityType t = MBVERTEX; t < MBMAXTYPE; ++t)
+ typeData[t].~TypeSequenceManager();
+
+ // now re-create TypeSequenceManager instances
+ for (MBEntityType t = MBVERTEX; t < MBMAXTYPE; ++t)
+ new (typeData+t) TypeSequenceManager();
+}
+
MBErrorCode SequenceManager::check_valid_entities( const MBRange& entities ) const
{
MBErrorCode rval;
@@ -630,6 +642,344 @@
}
}
+void SequenceManager::reset_tag_data() {
+ for (MBEntityType t = MBVERTEX; t <= MBENTITYSET; ++t) {
+ TypeSequenceManager& seqs = entity_map(t);
+ for (TypeSequenceManager::iterator i = seqs.begin(); i != seqs.end(); ++i)
+ (*i)->data()->release_tag_data();
+ }
+}
+
+MBErrorCode SequenceManager::reserve_tag_id( unsigned size, MBTagId tag_id )
+{
+ if (!size)
+ return MB_FAILURE;
+ if (tag_id >= tagSizes.size())
+ tagSizes.resize( tag_id+1, 0 );
+ if (tagSizes[tag_id])
+ return MB_ALREADY_ALLOCATED;
+ tagSizes[tag_id] = size;
+ return MB_SUCCESS;
+}
+
+MBErrorCode SequenceManager::release_tag( MBTagId tag_id )
+{
+ if (tag_id >= tagSizes.size() || !tagSizes[tag_id])
+ return MB_TAG_NOT_FOUND;
+ tagSizes[tag_id] = 0;
+
+ for (MBEntityType t = MBVERTEX; t <= MBENTITYSET; ++t) {
+ TypeSequenceManager& seqs = entity_map(t);
+ for (TypeSequenceManager::iterator i = seqs.begin(); i != seqs.end(); ++i)
+ (*i)->data()->release_tag_data(tag_id);
+ }
+ return MB_SUCCESS;
+}
+
+MBErrorCode SequenceManager::remove_tag_data( MBTagId tag_id,
+ MBEntityHandle handle,
+ const void* default_tag_value )
+{
+ if (tag_id >= tagSizes.size() || !tagSizes[tag_id])
+ return MB_TAG_NOT_FOUND;
+
+ EntitySequence* seq = 0;
+ MBErrorCode rval = find( handle, seq );
+ if (MB_SUCCESS != rval)
+ return rval;
+
+ void* tag_array = seq->data()->get_tag_data( tag_id );
+ if (!tag_array)
+ return MB_TAG_NOT_FOUND;
+
+ char* tag_data = reinterpret_cast<char*>(tag_array) +
+ tagSizes[tag_id] * (handle - seq->data()->start_handle());
+ if (default_tag_value)
+ memcpy( tag_data, default_tag_value, tagSizes[tag_id] );
+ else
+ memset( tag_data, 0, tagSizes[tag_id] );
+
+ return MB_SUCCESS;
+}
+
+MBErrorCode SequenceManager::set_tag_data( MBTagId tag_id,
+ MBEntityHandle handle,
+ const void* value,
+ const void* default_value )
+{
+ if (tag_id >= tagSizes.size() || !tagSizes[tag_id])
+ return MB_TAG_NOT_FOUND;
+
+ EntitySequence* seq = 0;
+ MBErrorCode rval = find( handle, seq );
+ if (MB_SUCCESS != rval)
+ return rval;
+
+ void* tag_array = seq->data()->get_tag_data( tag_id );
+ if (!tag_array)
+ tag_array = seq->data()->create_tag_data( tag_id, tagSizes[tag_id], default_value );
+
+ char* tag_data = reinterpret_cast<char*>(tag_array) +
+ tagSizes[tag_id] * (handle - seq->data()->start_handle());
+ memcpy( tag_data, value, tagSizes[tag_id] );
+ return MB_SUCCESS;
+}
+
+MBErrorCode SequenceManager::set_tag_data( MBTagId tag_id,
+ const MBRange& handles,
+ const void* values,
+ const void* default_value )
+{
+ MBErrorCode rval, result = MB_SUCCESS;
+ if (tag_id >= tagSizes.size() || !tagSizes[tag_id])
+ return MB_TAG_NOT_FOUND;
+
+ const char* data = reinterpret_cast<const char*>(values);
+
+ MBRange::const_pair_iterator p = handles.begin();
+ for (MBRange::const_pair_iterator p = handles.const_pair_begin();
+ p != handles.const_pair_end(); ++p) {
+
+ MBEntityHandle start = p->first;
+ while (start <= p->second) {
+
+ EntitySequence* seq = 0;
+ rval = find( start, seq );
+ if (MB_SUCCESS != rval) {
+ result = rval;
+ ++start;
+ data += tagSizes[tag_id];
+ continue;
+ }
+
+ const MBEntityHandle finish = std::min( p->second, seq->end_handle() );
+ const MBEntityID count = finish - start + 1;
+
+ void* tag_array = seq->data()->get_tag_data( tag_id );
+ if (!tag_array)
+ tag_array = seq->data()->create_tag_data( tag_id, tagSizes[tag_id], default_value );
+
+ char* tag_data = reinterpret_cast<char*>(tag_array) +
+ tagSizes[tag_id] * (start - seq->data()->start_handle());
+ memcpy( tag_data, data, tagSizes[tag_id] * count );
+ data += tagSizes[tag_id] * count;
+
+ start = finish + 1;
+ }
+ }
+
+ return result;
+}
+
+
+MBErrorCode SequenceManager::get_tag_data( MBTagId tag_id,
+ MBEntityHandle handle,
+ void* value ) const
+{
+ if (tag_id >= tagSizes.size() || !tagSizes[tag_id])
+ return MB_TAG_NOT_FOUND;
+
+ const EntitySequence* seq = 0;
+ MBErrorCode rval = find( handle, seq );
+ if (MB_SUCCESS != rval)
+ return rval;
+
+ const void* tag_array = seq->data()->get_tag_data( tag_id );
+ if (!tag_array)
+ return MB_TAG_NOT_FOUND;
+
+ const char* tag_data = reinterpret_cast<const char*>(tag_array) +
+ tagSizes[tag_id] * (handle - seq->data()->start_handle());
+ memcpy( value, tag_data, tagSizes[tag_id] );
+ return MB_SUCCESS;
+}
+
+MBErrorCode SequenceManager::get_tag_data( MBTagId tag_id,
+ const MBRange& handles,
+ void* values,
+ const void* default_value ) const
+{
+ MBErrorCode rval, result = MB_SUCCESS;;
+ if (tag_id >= tagSizes.size() || !tagSizes[tag_id])
+ return MB_TAG_NOT_FOUND;
+
+ char* data = reinterpret_cast<char*>(values);
+
+ MBRange::const_pair_iterator p = handles.begin();
+ for (MBRange::const_pair_iterator p = handles.const_pair_begin();
+ p != handles.const_pair_end(); ++p) {
+
+ MBEntityHandle start = p->first;
+ while (start <= p->second) {
+
+ const EntitySequence* seq = 0;
+ rval = find( start, seq );
+ // keep MOAB 3.0 behavior : return default value for invalid handles
+ if (MB_ENTITY_NOT_FOUND == rval) {
+ if (default_value)
+ memcpy( data, default_value, tagSizes[tag_id] );
+ else
+ memset( data, 0, tagSizes[tag_id] );
+ result = MB_ENTITY_NOT_FOUND;
+ data += tagSizes[tag_id];
+ ++start;
+ continue;
+ }
+ else if (MB_SUCCESS != rval)
+ return rval;
+
+ const MBEntityHandle finish = std::min( p->second, seq->end_handle() );
+ const MBEntityID count = finish - start + 1;
+
+ const void* tag_array = seq->data()->get_tag_data( tag_id );
+ if (!tag_array)
+ return MB_TAG_NOT_FOUND;
+
+ const char* tag_data = reinterpret_cast<const char*>(tag_array) +
+ tagSizes[tag_id] * (start - seq->data()->start_handle());
+ memcpy( data, tag_data, tagSizes[tag_id] * count );
+
+ data += tagSizes[tag_id] * count;
+ start = finish + 1;
+ }
+ }
+
+ return MB_SUCCESS;
+}
+
+MBErrorCode SequenceManager::get_entity_tags( MBEntityHandle entity,
+ std::vector<MBTag>& tags_out ) const
+{
+ const EntitySequence* seq = 0;
+ MBErrorCode rval = find( entity, seq );
+ if (MB_SUCCESS != rval)
+ return rval;
+
+ for (MBTagId i = 0; i < tagSizes.size(); ++i)
+ if (seq->data()->get_tag_data(i))
+ tags_out.push_back( TAG_HANDLE_FROM_ID( i, MB_TAG_DENSE ) );
+
+ return MB_SUCCESS;
+}
+
+MBErrorCode SequenceManager::get_tagged_entities( MBTagId tag_id,
+ MBEntityType type,
+ MBRange& entities_out ) const
+{
+ if (tag_id >= tagSizes.size() || !tagSizes[tag_id])
+ return MB_TAG_NOT_FOUND;
+
+ MBRange::iterator insert = entities_out.begin();
+ const TypeSequenceManager& map = entity_map( type );
+ for (TypeSequenceManager::const_iterator i = map.begin(); i != map.end(); ++i)
+ if ((*i)->data()->get_tag_data(tag_id))
+ insert = entities_out.insert( insert, (*i)->start_handle(), (*i)->end_handle() );
+
+ return MB_SUCCESS;
+}
+
+MBErrorCode SequenceManager::count_tagged_entities( MBTagId tag_id,
+ MBEntityType type,
+ int& count ) const
+{
+ if (tag_id >= tagSizes.size() || !tagSizes[tag_id])
+ return MB_TAG_NOT_FOUND;
+
+ count = 0;
+ const TypeSequenceManager& map = entity_map( type );
+ for (TypeSequenceManager::const_iterator i = map.begin(); i != map.end(); ++i)
+ if ((*i)->data()->get_tag_data(tag_id))
+ count += (*i)->size();
+
+ return MB_SUCCESS;
+}
+
+MBErrorCode SequenceManager::get_entities_with_tag_value( MBTagId id,
+ MBEntityType type,
+ MBRange& entities_out,
+ const void* value ) const
+{
+ if (id >= tagSizes.size() || !tagSizes[id])
+ return MB_TAG_NOT_FOUND;
+
+ MBRange::iterator insert = entities_out.begin();
+ const TypeSequenceManager& map = entity_map( type );
+ for (TypeSequenceManager::const_iterator i = map.begin(); i != map.end(); ++i) {
+ if (const void* data = (*i)->data()->get_tag_data(id)) {
+ const char* bytes = reinterpret_cast<const char*>(data);
+ for (MBEntityHandle h = (*i)->start_handle(); h <= (*i)->end_handle(); ++h)
+ if (!memcmp( bytes + tagSizes[id] * (h - (*i)->data()->start_handle()), value, tagSizes[id] ))
+ insert = entities_out.insert( insert, h, h );
+ }
+ }
+
+ return MB_SUCCESS;
+}
+
+MBErrorCode SequenceManager::get_entities_with_tag_value( const MBRange& range,
+ MBTagId id,
+ MBEntityType type,
+ MBRange& entities_out,
+ const void* value ) const
+{
+ MBErrorCode rval;
+ if (id >= tagSizes.size() || !tagSizes[id])
+ return MB_TAG_NOT_FOUND;
+
+ MBRange::iterator insert = entities_out.begin();
+ MBRange::const_pair_iterator p = range.lower_bound(type);
+ for (MBRange::const_pair_iterator p = range.const_pair_begin();
+ p != range.const_pair_end() && TYPE_FROM_HANDLE(p->first) == type;
+ ++p) {
+
+ MBEntityHandle start = p->first;
+ while (start <= p->second) {
+
+ const EntitySequence* seq = 0;
+ rval = find( start, seq );
+ if (MB_SUCCESS != rval)
+ return rval;
+
+ const MBEntityHandle finish = std::min( p->second, seq->end_handle() );
+ const void* tag_array = seq->data()->get_tag_data( id );
+ if (tag_array) {
+ const char* tag_data = reinterpret_cast<const char*>(tag_array);
+ for (MBEntityHandle h = start; h <= finish; ++h) {
+ if (!memcmp( tag_data + tagSizes[id] * (h - seq->data()->start_handle()), value, tagSizes[id] ))
+ insert = entities_out.insert( insert, h, h );
+ }
+ }
+ start = finish + 1;
+ }
+ }
+
+ return MB_SUCCESS;
+}
+
+MBErrorCode SequenceManager::get_tag_memory_use( MBTagId id,
+ unsigned long& total,
+ unsigned long& per_entity ) const
+{
+ if (id >= tagSizes.size() || !tagSizes[id])
+ return MB_TAG_NOT_FOUND;
+
+ per_entity = tagSizes[id];
+ total = 0;
+ for (MBEntityType t = MBVERTEX; t <= MBENTITYSET; ++t) {
+ const TypeSequenceManager& map = entity_map(t);
+ const SequenceData* prev_data = 0;
+ for (TypeSequenceManager::const_iterator i = map.begin(); i != map.end(); ++i) {
+ if ((*i)->data() != prev_data && (*i)->data()->get_tag_data(id)) {
+ prev_data = (*i)->data();
+ total += tagSizes[id] * (*i)->data()->size();
+ }
+ }
+ }
+
+ return MB_SUCCESS;
+}
+
+
// These are meant to be called from the debugger (not declared in any header)
// so leave them out of release builds (-DNDEBUG).
#ifndef NDEBUG
Modified: MOAB/trunk/SequenceManager.hpp
===================================================================
--- MOAB/trunk/SequenceManager.hpp 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/SequenceManager.hpp 2007-11-16 18:15:21 UTC (rev 1403)
@@ -14,6 +14,9 @@
SequenceManager( const MBHandleUtils& handle_utils )
: handleUtils(handle_utils)
{}
+
+ /** Delete all contained data */
+ void clear();
MBErrorCode find( MBEntityHandle handle, EntitySequence*& sequence_out )
{
@@ -113,6 +116,58 @@
unsigned long& total_amortized_storage ) const;
+
+ /* Dense Tag Functions */
+
+ void reset_tag_data();
+
+ MBErrorCode reserve_tag_id( unsigned tag_size, MBTagId tag_id );
+ MBErrorCode release_tag( MBTagId tag_id );
+
+ MBErrorCode remove_tag_data( MBTagId tag_id,
+ MBEntityHandle handle,
+ const void* default_tag_value );
+ MBErrorCode set_tag_data( MBTagId tag_id,
+ MBEntityHandle handle,
+ const void* value,
+ const void* default_value );
+ MBErrorCode set_tag_data( MBTagId tag_id,
+ const MBRange& handles,
+ const void* values,
+ const void* default_value );
+ MBErrorCode get_tag_data( MBTagId tag_id,
+ MBEntityHandle handle,
+ void* value ) const;
+ MBErrorCode get_tag_data( MBTagId tag_id,
+ const MBRange& handles,
+ void* values,
+ const void* default_value ) const;
+
+ MBErrorCode get_entity_tags( MBEntityHandle entity,
+ std::vector<MBTag>& tags_out ) const;
+
+ MBErrorCode get_tagged_entities( MBTagId tag_id,
+ MBEntityType type,
+ MBRange& entities_out ) const;
+ MBErrorCode count_tagged_entities( MBTagId tag,
+ MBEntityType type,
+ int& result ) const;
+
+ MBErrorCode get_entities_with_tag_value( MBTagId id,
+ MBEntityType type,
+ MBRange& entities_out,
+ const void* value ) const;
+ MBErrorCode get_entities_with_tag_value( const MBRange& range,
+ MBTagId id,
+ MBEntityType type,
+ MBRange& entities_out,
+ const void* value ) const;
+
+ MBErrorCode get_tag_memory_use( MBTagId id,
+ unsigned long& total,
+ unsigned long& per_entity ) const;
+
+
private:
/**\brief Utility function for allocate_mesh_set (and similar)
@@ -147,6 +202,8 @@
const MBHandleUtils handleUtils;
TypeSequenceManager typeData[MBMAXTYPE];
+
+ std::vector<unsigned> tagSizes;
};
#endif
Modified: MOAB/trunk/TagServer.cpp
===================================================================
--- MOAB/trunk/TagServer.cpp 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/TagServer.cpp 2007-11-16 18:15:21 UTC (rev 1403)
@@ -42,8 +42,8 @@
#include "MBRange.hpp"
#include "SparseTagCollections.hpp"
#include "MBBits.hpp"
-#include "DenseTagCollections.hpp"
#include "MBInterface.hpp"
+#include "SequenceManager.hpp"
using namespace std;
@@ -74,17 +74,17 @@
TagServer functions ----------------------------------
*/
-TagServer::TagServer()
+TagServer::TagServer( SequenceManager* seqman )
+ : sequenceManager(seqman)
{
mSparseData = new SparseTagSuperCollection;
- mDenseData = new DenseTagSuperCollection;
mBitServer = new MBBitServer;
}
TagServer::~TagServer()
{
+ sequenceManager->reset_tag_data();
delete mSparseData;
- delete mDenseData;
delete mBitServer;
}
@@ -92,8 +92,8 @@
MBErrorCode TagServer::reset_all_data()
{
mSparseData->reset_data();
- mDenseData->reset_data();
mBitServer->reset_data();
+ sequenceManager->reset_tag_data();
return MB_SUCCESS;
}
@@ -150,7 +150,7 @@
result = mSparseData->reserve_tag_id(data_size, tag_id);
break;
case MB_TAG_DENSE:
- result = mDenseData->reserve_tag_id(data_size, default_value, tag_id);
+ result = sequenceManager->reserve_tag_id( data_size, tag_id );
break;
case MB_TAG_MESH:
result = MB_SUCCESS;
@@ -181,7 +181,7 @@
status = mSparseData->release_tag_id(tag_id);
break;
case MB_TAG_DENSE:
- status = mDenseData->release_tag_id(tag_id);
+ status = sequenceManager->release_tag(tag_id);
break;
case MB_TAG_MESH:
status = MB_SUCCESS;
@@ -212,7 +212,8 @@
for (tag_id = 1; tag_id <= mTagTable[MB_TAG_DENSE].size(); ++tag_id)
if (mTagTable[MB_TAG_DENSE][tag_id-1].is_valid())
- mDenseData->remove_data( tag_id, entity_handle );
+ sequenceManager->remove_tag_data( tag_id, entity_handle,
+ mTagTable[MB_TAG_DENSE][tag_id-1].default_value() );
return MB_SUCCESS;
}
@@ -263,7 +264,8 @@
case MB_TAG_SPARSE:
return mSparseData->set_data(id, entity_handle, data);
case MB_TAG_DENSE:
- return mDenseData->set_data(id, entity_handle, data);
+ return sequenceManager->set_tag_data(id, entity_handle, data,
+ mTagTable[MB_TAG_DENSE][id-1].default_value());
case MB_TAG_MESH:
return MB_FAILURE;
}
@@ -289,12 +291,13 @@
if( PROP_FROM_TAG_HANDLE(tag_handle) == MB_TAG_DENSE)
{
- const int data_size = mDenseData->tag_size(tag_id);
+ const int data_size = mTagTable[MB_TAG_DENSE][tag_id-1].get_size();
for(const MBEntityHandle* iter = entity_handles; iter != end; ++iter)
{
if(TYPE_FROM_HANDLE(*iter) >= MBMAXTYPE)
return MB_TYPE_OUT_OF_RANGE;
- result = mDenseData->set_data(tag_id, *iter, mydata);
+ result = sequenceManager->set_tag_data(tag_id, *iter, mydata,
+ mTagTable[MB_TAG_DENSE][tag_id-1].default_value());
if(result != MB_SUCCESS)
return result;
mydata += data_size;
@@ -346,16 +349,8 @@
if( PROP_FROM_TAG_HANDLE(tag_handle) == MB_TAG_DENSE)
{
- const int data_size = mDenseData->tag_size(tag_id);
- for(MBRange::const_iterator iter = entity_handles.begin(); iter != end; ++iter)
- {
- if(TYPE_FROM_HANDLE(*iter) >= MBMAXTYPE)
- return MB_TYPE_OUT_OF_RANGE;
- result = mDenseData->set_data(tag_id, *iter, mydata);
- if(result != MB_SUCCESS)
- return result;
- mydata += data_size;
- }
+ result = sequenceManager->set_tag_data( tag_id, entity_handles, data,
+ mTagTable[MB_TAG_DENSE][tag_id-1].default_value() );
}
else if(PROP_FROM_TAG_HANDLE(tag_handle) == MB_TAG_SPARSE)
{
@@ -411,7 +406,18 @@
switch (PROP_FROM_TAG_HANDLE(tag_handle)) {
case MB_TAG_DENSE:
- result = mDenseData->get_data(ID_FROM_TAG_HANDLE(tag_handle), entity_handle, data);
+ result = sequenceManager->get_tag_data(ID_FROM_TAG_HANDLE(tag_handle), entity_handle, data);
+ // preserve MOAB 3.0 behavior for dense tags:
+ // return default value for invalid handles.
+ if (result == MB_ENTITY_NOT_FOUND) {
+ const TagInfo* info = get_tag_info(tag_handle);
+ if (!info)
+ return MB_TAG_NOT_FOUND;
+ if (info->default_value())
+ memcpy( data, info->default_value(), info->get_size() );
+ else
+ memset( data, 0, info->get_size() );
+ }
break;
case MB_TAG_SPARSE:
result = mSparseData->get_data(ID_FROM_TAG_HANDLE(tag_handle), entity_handle, data);
@@ -443,7 +449,7 @@
void* data)
{
- MBErrorCode result = MB_SUCCESS;
+ MBErrorCode result = MB_SUCCESS, rval;
const MBTagId tag_id = ID_FROM_TAG_HANDLE(tag_handle);
unsigned char* mydata = static_cast<unsigned char*>(data);
@@ -451,19 +457,27 @@
if(PROP_FROM_TAG_HANDLE(tag_handle) == MB_TAG_DENSE)
{
- const int data_size = mDenseData->tag_size(tag_id);
+ const int data_size = mTagTable[MB_TAG_DENSE][tag_id-1].get_size();
for(const MBEntityHandle* iter = entity_handles; iter != end; ++iter)
{
- result = mDenseData->get_data(tag_id, *iter, mydata);
- if(result == MB_TAG_NOT_FOUND)
+ rval = sequenceManager->get_tag_data(tag_id, *iter, mydata);
+ // preserve MOAB 3.0 behavior for dense tags:
+ // return default value for invalid handles.
+ if(rval == MB_TAG_NOT_FOUND || rval == MB_ENTITY_NOT_FOUND)
{
- result = get_default_data(tag_handle, mydata);
- // if failure is returned, change it back to tag not found, since it's
- // ok to look for data and not find any
- if (result == MB_FAILURE) result = MB_TAG_NOT_FOUND;
+ const TagInfo* info = get_tag_info(tag_handle);
+ if (!info)
+ return MB_TAG_NOT_FOUND;
+ if (info->default_value()) {
+ memcpy( data, info->default_value(), info->get_size() );
+ if (rval == MB_ENTITY_NOT_FOUND)
+ result = MB_ENTITY_NOT_FOUND;
+ }
+ else {
+ memset( data, 0, info->get_size() );
+ result = rval;
+ }
}
- if(result != MB_SUCCESS)
- return result;
mydata += data_size;
}
}
@@ -515,23 +529,8 @@
if(PROP_FROM_TAG_HANDLE(tag_handle) == MB_TAG_DENSE)
{
- const int data_size = mDenseData->tag_size(tag_id);
- for(MBRange::const_iterator iter = entity_handles.begin(); iter != end; ++iter)
- {
- if(TYPE_FROM_HANDLE(*iter) >= MBMAXTYPE)
- return MB_TYPE_OUT_OF_RANGE;
- result = mDenseData->get_data(tag_id, *iter, mydata);
- if(result == MB_TAG_NOT_FOUND)
- {
- result = get_default_data(tag_handle, mydata);
- // if failure is returned, change it back to tag not found, since it's
- // ok to look for data and not find any
- if (result == MB_FAILURE) result = MB_TAG_NOT_FOUND;
- }
- if(result != MB_SUCCESS)
- return result;
- mydata += data_size;
- }
+ result = sequenceManager->get_tag_data( tag_id, entity_handles, mydata,
+ mTagTable[MB_TAG_DENSE][tag_id-1].default_value() );
}
else if(PROP_FROM_TAG_HANDLE(tag_handle) == MB_TAG_SPARSE)
{
@@ -598,7 +597,7 @@
MBErrorCode tmp_result = mSparseData->get_tags(entity, all_tags);
if (MB_SUCCESS != tmp_result) result = tmp_result;
- tmp_result = mDenseData->get_tags(entity, all_tags);
+ tmp_result = sequenceManager->get_entity_tags(entity, all_tags);
if (MB_SUCCESS != tmp_result) result = tmp_result;
tmp_result = mBitServer->get_tags(entity, all_tags);
@@ -670,11 +669,14 @@
MBErrorCode TagServer::remove_data( const MBTag tag_handle, const MBEntityHandle entity_handle )
{
+ MBTagId tag_id = ID_FROM_TAG_HANDLE(tag_handle);
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() );
return MB_SUCCESS;
case MB_TAG_SPARSE:
- return mSparseData->remove_data(ID_FROM_TAG_HANDLE(tag_handle), entity_handle);
+ return mSparseData->remove_data(tag_id, entity_handle);
case MB_TAG_BIT:
return MB_FAILURE;
case MB_TAG_MESH:
@@ -713,7 +715,7 @@
result = mSparseData->get_entities(id, type, entities);
break;
case MB_TAG_DENSE:
- result = mDenseData->get_entities(id, type, entities);
+ result = sequenceManager->get_tagged_entities(id, type, entities);
break;
case MB_TAG_BIT:
result = mBitServer->get_entities(id, type, entities);
@@ -736,7 +738,8 @@
result = mSparseData->get_entities(id, entities);
break;
case MB_TAG_DENSE:
- result = mDenseData->get_entities(id, entities);
+ for (MBEntityType t = MBENTITYSET; t >= MBVERTEX; --t)
+ result = sequenceManager->get_tagged_entities(id, t, entities);
break;
case MB_TAG_BIT:
result = mBitServer->get_entities(id, entities);
@@ -760,8 +763,11 @@
case MB_TAG_SPARSE:
result = mSparseData->get_entities(range, id, type, entities);
break;
- case MB_TAG_DENSE:
- result = mDenseData->get_entities(range, id, type, entities);
+ case MB_TAG_DENSE: {
+ MBRange temp;
+ result = sequenceManager->get_tagged_entities(id, type, temp);
+ entities.merge( range.intersect(temp) );
+ }
break;
case MB_TAG_BIT:
result = mBitServer->get_entities(range, id, type, entities);
@@ -787,7 +793,7 @@
result = mSparseData->get_entities_with_tag_value(id, type, entities, value);
break;
case MB_TAG_DENSE:
- result = mDenseData->get_entities_with_tag_value(id, type, entities, value);
+ result = sequenceManager->get_entities_with_tag_value(id, type, entities, value);
break;
case MB_TAG_BIT:
result = mBitServer->get_entities_with_tag_value(id, type,
@@ -816,7 +822,7 @@
result = mSparseData->get_entities_with_tag_value(range, id, type, entities, value);
break;
case MB_TAG_DENSE:
- result = mDenseData->get_entities_with_tag_value(range, id, type, entities, value);
+ result = sequenceManager->get_entities_with_tag_value(range, id, type, entities, value);
break;
case MB_TAG_BIT:
result = mBitServer->get_entities_with_tag_value(range, id, type,
@@ -915,7 +921,7 @@
case MB_TAG_SPARSE:
return mSparseData->get_number_entities(id, type, num_entities);
case MB_TAG_DENSE:
- return mDenseData->get_number_entities(id, type, num_entities);
+ return sequenceManager->count_tagged_entities(id, type, num_entities);
case MB_TAG_BIT:
return mBitServer->get_number_entities(id, type, num_entities);
case MB_TAG_MESH:
@@ -933,8 +939,12 @@
switch (PROP_FROM_TAG_HANDLE(tag_handle)) {
case MB_TAG_SPARSE:
return mSparseData->get_number_entities(range, id, type, num_entities);
- case MB_TAG_DENSE:
- return mDenseData->get_number_entities(range, id, type, num_entities);
+ case MB_TAG_DENSE: {
+ MBRange temp;
+ MBErrorCode rval = get_entities( range, tag_handle, type, temp );
+ num_entities = temp.size();
+ return rval;
+ }
case MB_TAG_BIT:
return mBitServer->get_number_entities(range, id, type, num_entities);
case MB_TAG_MESH:
@@ -955,7 +965,7 @@
mSparseData->get_memory_use( id, result, tmp );
break;
case MB_TAG_DENSE:
- mDenseData->get_memory_use( id, result, tmp );
+ sequenceManager->get_tag_memory_use( id, result, tmp );
break;
case MB_TAG_BIT:
mBitServer->get_memory_use( id, result, tmp );
@@ -982,7 +992,7 @@
mSparseData->get_memory_use( id, total, per_entity );
break;
case MB_TAG_DENSE:
- mDenseData->get_memory_use( id, total, per_entity );
+ sequenceManager->get_tag_memory_use( id, total, per_entity );
break;
case MB_TAG_BIT:
mBitServer->get_memory_use( id, total, per_entity );
Modified: MOAB/trunk/TagServer.hpp
===================================================================
--- MOAB/trunk/TagServer.hpp 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/TagServer.hpp 2007-11-16 18:15:21 UTC (rev 1403)
@@ -42,8 +42,8 @@
#include "MBInternals.hpp"
class MBRange;
-class DenseTagSuperCollection;
class SparseTagSuperCollection;
+class SequenceManager;
class MBBitServer;
// ! stores information about a tag
@@ -135,7 +135,7 @@
{
public:
//! constructor
- TagServer();
+ TagServer( SequenceManager* seqman );
//! destructor
virtual ~TagServer();
@@ -285,14 +285,10 @@
//! container for storing the sparse data and tag ids
SparseTagSuperCollection* mSparseData;
+
+ //! SequenceManager required to access dense tag data
+ SequenceManager* sequenceManager;
- //! container for storing the static sparse data and tag ids
- //StaticSparseTagCollection* mStaticSparseData;
- // static tags currently don't fit in OOA
-
- //! manager for dense data
- DenseTagSuperCollection* mDenseData;
-
//! manager for the bit data
MBBitServer* mBitServer;
Modified: MOAB/trunk/TestTypeSequenceManager.cpp
===================================================================
--- MOAB/trunk/TestTypeSequenceManager.cpp 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/TestTypeSequenceManager.cpp 2007-11-16 18:15:21 UTC (rev 1403)
@@ -92,7 +92,7 @@
{ return new DumSeq(*this, here); }
SequenceData* create_data_subset( MBEntityHandle a, MBEntityHandle b ) const
- { return data()->subset( a, b, 0, 0 ); }
+ { return data()->subset( a, b, 0 ); }
void get_const_memory_use( unsigned long& a, unsigned long& b) const
{ a = b = 0; }
Modified: MOAB/trunk/TypeSequenceManager.cpp
===================================================================
--- MOAB/trunk/TypeSequenceManager.cpp 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/TypeSequenceManager.cpp 2007-11-16 18:15:21 UTC (rev 1403)
@@ -229,7 +229,7 @@
iterator s = j;
for (++s; p != s; ++p)
(*p)->data( new_data );
- dead_data->move_tag_data( new_data, tag_server );
+ dead_data->move_tag_data( new_data, tag_server );
}
if (j != n) {
SequenceData* new_data = (*n)->create_data_subset( (*i)->start_handle(), (*n)->end_handle() );
Modified: MOAB/trunk/UnstructuredElemSeq.cpp
===================================================================
--- MOAB/trunk/UnstructuredElemSeq.cpp 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/UnstructuredElemSeq.cpp 2007-11-16 18:15:21 UTC (rev 1403)
@@ -43,7 +43,7 @@
UnstructuredElemSeq::create_data_subset( MBEntityHandle start, MBEntityHandle end ) const
{
int esize = nodes_per_element() * sizeof(MBEntityHandle);
- return data()->subset(start, end, &esize, 0 );
+ return data()->subset(start, end, &esize );
}
Modified: MOAB/trunk/VertexSequence.cpp
===================================================================
--- MOAB/trunk/VertexSequence.cpp 2007-11-16 16:49:13 UTC (rev 1402)
+++ MOAB/trunk/VertexSequence.cpp 2007-11-16 18:15:21 UTC (rev 1403)
@@ -9,7 +9,7 @@
MBEntityHandle end ) const
{
const int sizes[] = { sizeof(double), sizeof(double), sizeof(double) };
- return data()->subset(start, end, sizes, 0 );
+ return data()->subset(start, end, sizes );
}
MBErrorCode VertexSequence::push_back( MBEntityID count )
More information about the moab-dev
mailing list