[MOAB-dev] r1349 - MOAB/trunk
tautges at mcs.anl.gov
tautges at mcs.anl.gov
Wed Oct 31 12:43:34 CDT 2007
Author: tautges
Date: 2007-10-31 12:43:34 -0500 (Wed, 31 Oct 2007)
New Revision: 1349
Modified:
MOAB/trunk/EntitySequence.cpp
MOAB/trunk/EntitySequence.hpp
MOAB/trunk/EntitySequenceManager.cpp
MOAB/trunk/EntitySequenceManager.hpp
MOAB/trunk/MBCore.cpp
MOAB/trunk/MeshSetSequence.cpp
MOAB/trunk/MeshSetSequence.hpp
Log:
Saving some work on changing entity handles, will pick up again after
Jason's dense tag modification work gets committed. Shouldn't affect
any working apps.
Modified: MOAB/trunk/EntitySequence.cpp
===================================================================
--- MOAB/trunk/EntitySequence.cpp 2007-10-30 19:14:57 UTC (rev 1348)
+++ MOAB/trunk/EntitySequence.cpp 2007-10-31 17:43:34 UTC (rev 1349)
@@ -53,7 +53,6 @@
mLastDeletedIndex = -1;
}
-
MBEntitySequence::~MBEntitySequence()
{ }
@@ -129,6 +128,11 @@
return new_handle;
}
+MBErrorCode VertexEntitySequence::allocate_handle(MBEntityHandle handle)
+{
+ return MB_FAILURE;
+}
+
void VertexEntitySequence::free_handle(MBEntityHandle handle)
{
@@ -302,6 +306,11 @@
return new_handle;
}
+MBErrorCode ElementEntitySequence::allocate_handle(MBEntityHandle handle)
+{
+ return MB_FAILURE;
+}
+
void ElementEntitySequence::free_handle(MBEntityHandle handle)
{
if(!is_valid_entity(handle))
Modified: MOAB/trunk/EntitySequence.hpp
===================================================================
--- MOAB/trunk/EntitySequence.hpp 2007-10-30 19:14:57 UTC (rev 1348)
+++ MOAB/trunk/EntitySequence.hpp 2007-10-31 17:43:34 UTC (rev 1349)
@@ -103,6 +103,9 @@
protected:
+ //! allocate the handle passed in, effectively creating the entity
+ virtual MBErrorCode allocate_handle(MBEntityHandle handle) = 0;
+
EntitySequenceManager* mSequenceManager;
//!id to 1st element in EntitySequence
@@ -162,6 +165,11 @@
virtual void get_memory_use( unsigned long& used, unsigned long& allocated ) const;
virtual unsigned long get_memory_use( MBEntityHandle handle ) const;
+
+protected:
+ //! allocate the handle passed in, effectively creating the entity
+ virtual MBErrorCode allocate_handle(MBEntityHandle handle);
+
private:
// coordinate arrays x,y,z
@@ -218,6 +226,9 @@
protected:
+ //! allocate the handle passed in, effectively creating the entity
+ virtual MBErrorCode allocate_handle(MBEntityHandle handle);
+
unsigned short mNodesPerElement;
MBEntityHandle* mElements;
Modified: MOAB/trunk/EntitySequenceManager.cpp
===================================================================
--- MOAB/trunk/EntitySequenceManager.cpp 2007-10-30 19:14:57 UTC (rev 1348)
+++ MOAB/trunk/EntitySequenceManager.cpp 2007-10-31 17:43:34 UTC (rev 1349)
@@ -382,6 +382,11 @@
return MB_SUCCESS;
}
+//MBErrorCode EntitySequenceManager::allocate_handle( MBEntityHandle handle, unsigned flags )
+//{
+// return MB_FAILURE;
+//}
+
MBErrorCode EntitySequenceManager::allocate_mesh_set( MBEntityHandle handle, unsigned flags )
{
std::map<MBEntityHandle, MBEntitySequence*>::iterator seq_itr;
Modified: MOAB/trunk/EntitySequenceManager.hpp
===================================================================
--- MOAB/trunk/EntitySequenceManager.hpp 2007-10-30 19:14:57 UTC (rev 1348)
+++ MOAB/trunk/EntitySequenceManager.hpp 2007-10-31 17:43:34 UTC (rev 1349)
@@ -108,6 +108,12 @@
const double coords[3],
MBEntityHandle& vertex );
+ //! creates a vertex in the database with specified id
+ MBErrorCode create_vertex( const unsigned processor_id,
+ const unsigned entity_id,
+ const double coords[3],
+ MBEntityHandle& vertex ) {return MB_FAILURE;}
+
//! creates an element in the database
MBErrorCode create_element( MBEntityType type,
const unsigned processor_id,
@@ -115,6 +121,14 @@
const unsigned num_vertices,
MBEntityHandle& element);
+ //! creates an element in the database with specified id
+ MBErrorCode create_element( MBEntityType type,
+ const unsigned processor_id,
+ const unsigned entity_id,
+ const MBEntityHandle *conn_array,
+ const unsigned num_vertices,
+ MBEntityHandle& element) {return MB_FAILURE;}
+
MBErrorCode create_mesh_set( unsigned proc_id,
unsigned flags,
MBEntityHandle& h );
Modified: MOAB/trunk/MBCore.cpp
===================================================================
--- MOAB/trunk/MBCore.cpp 2007-10-30 19:14:57 UTC (rev 1348)
+++ MOAB/trunk/MBCore.cpp 2007-10-31 17:43:34 UTC (rev 1349)
@@ -2324,13 +2324,32 @@
MBEntityHandle *entities,
int num_entities)
{
- if (0 == meshset) return false;
+ return false;
+ /*
+ // if a regular entity set, we're simply changing contents of this set
+ if (0 != meshset) {
- MBMeshSet* set = get_mesh_set( sequence_manager(), meshset );
- if (set)
- return set->replace_entities( meshset, entities, num_entities, a_entity_factory() );
- else
- return false;
+ MBMeshSet* set = get_mesh_set( sequence_manager(), meshset );
+ if (set)
+ return set->replace_entities( meshset, entities, num_entities, a_entity_factory() );
+ else
+ return false;
+ }
+
+ // otherwise, we're actually changing an entity's handle
+ // in preparation, get all the non-tracking sets
+ MBRange tmp_sets, all_sets;
+ MBErrorCode result = get_entities_by_type(0, MBENTITYSET, tmp_sets);
+ if (MB_SUCCESS != result) return result;
+ unsigned int option;
+ for (MBRange::iterator rit = tmp_sets.begin(); rit != tmp_sets.end(); rit++)
+ if (MB_SUCCESS == get_meshset_options(*rit, option) &&
+ !(option & MESHSET_TRACK_OWNER))
+ all_sets.insert(*rit);
+
+ // now replace each entity
+ double coords[3];
+ */
}
MBErrorCode MBCore::get_parent_meshsets(const MBEntityHandle meshset,
Modified: MOAB/trunk/MeshSetSequence.cpp
===================================================================
--- MOAB/trunk/MeshSetSequence.cpp 2007-10-30 19:14:57 UTC (rev 1348)
+++ MOAB/trunk/MeshSetSequence.cpp 2007-10-31 17:43:34 UTC (rev 1349)
@@ -83,8 +83,7 @@
return 0;
}
-
-MBErrorCode MeshSetSequence::add_meshset( MBEntityHandle handle, unsigned flags )
+MBErrorCode MeshSetSequence::add_meshset(MBEntityHandle handle, unsigned flags)
{
if (handle < get_start_handle() || handle > get_end_handle())
return MB_INDEX_OUT_OF_RANGE;
@@ -115,17 +114,22 @@
// initialze entity set
allocate_set( flags, index );
+
mNumEntities++;
if (mNumEntities == mNumAllocated) {
mSequenceManager->notify_full(this);
std::vector<bool> empty;
mFreeEntities.swap( empty);
}
-
+
return MB_SUCCESS;
}
-
+MBErrorCode MeshSetSequence::allocate_handle(MBEntityHandle handle)
+{
+ return MB_FAILURE;
+}
+
MBEntityHandle MeshSetSequence::add_meshset( unsigned flags )
{
if (mFirstFreeIndex == -1)
Modified: MOAB/trunk/MeshSetSequence.hpp
===================================================================
--- MOAB/trunk/MeshSetSequence.hpp 2007-10-30 19:14:57 UTC (rev 1348)
+++ MOAB/trunk/MeshSetSequence.hpp 2007-10-31 17:43:34 UTC (rev 1349)
@@ -67,6 +67,10 @@
MBErrorCode is_valid() const;
+protected:
+ //! allocate the handle passed in, effectively creating the entity
+ virtual MBErrorCode allocate_handle(MBEntityHandle handle);
+
private:
void initialize( EntitySequenceManager* seq_man,
More information about the moab-dev
mailing list