moab
moab::EntitySequence Class Reference

#include <EntitySequence.hpp>

Inheritance diagram for moab::EntitySequence:
moab::ElementSequence moab::MeshSetSequence moab::TypeSequenceManager::DummySequence moab::VertexSequence moab::StructuredElementSeq moab::SweptElementSeq moab::UnstructuredElemSeq moab::PolyElementSeq

List of all members.

Public Member Functions

 EntitySequence (EntityHandle start, EntityID count, SequenceData *dat)
virtual ~EntitySequence ()
EntityType type () const
EntityHandle start_handle () const
EntityHandle end_handle () const
SequenceDatadata () const
void data (SequenceData *ptr)
EntityID size () const
bool using_entire_data () const
 True if SequenceData has no holes and is used only by this EntitySequence.
virtual int values_per_entity () const
 Integer value used in finding appropriate SequenceData.
virtual EntitySequencesplit (EntityHandle here)=0
 Split this sequence into two consecutive sequences.
virtual ErrorCode merge (EntitySequence &other)
 Merge this sequence with another.
virtual ErrorCode pop_back (EntityID count)
 Erase entities in range: (end_handle()-count, end_handle()].
virtual ErrorCode pop_front (EntityID count)
 Erase entities in range: [start_handle(), start_handle()+count)
virtual SequenceDatacreate_data_subset (EntityHandle start_handle, EntityHandle end_handle) const =0
 Create a new SequenceData that is a copy of a subset of the one referenced by this sequence.
virtual void get_const_memory_use (unsigned long &bytes_per_entity, unsigned long &size_of_sequence) const =0
 Get memory characteristcs that are the same for all entities.
virtual unsigned long get_per_entity_memory_use (EntityHandle first, EntityHandle last) const
 Get portion of memory use that varies per entity.

Protected Member Functions

 EntitySequence (EntityHandle h)
 EntitySequence (EntitySequence &split_from, EntityHandle here)
SequenceDatacreate_data_subset (EntityHandle start_handle, EntityHandle end_handle, int num_sequence_arrays, unsigned const *bytes_per_element) const
ErrorCode prepend_entities (EntityID count)
ErrorCode append_entities (EntityID count)

Private Attributes

EntityHandle startHandle
EntityHandle endHandle
SequenceDatasequenceData

Detailed Description

Definition at line 11 of file EntitySequence.hpp.


Constructor & Destructor Documentation

Definition at line 18 of file EntitySequence.hpp.

    : startHandle(h), endHandle(h) {}
moab::EntitySequence::EntitySequence ( EntitySequence split_from,
EntityHandle  here 
) [inline, protected]

Definition at line 21 of file EntitySequence.hpp.

    : startHandle( here ),
      endHandle( split_from.endHandle ),
      sequenceData( split_from.sequenceData )
  {
    split_from.endHandle = here - 1;
  }
moab::EntitySequence::EntitySequence ( EntityHandle  start,
EntityID  count,
SequenceData dat 
) [inline]

Definition at line 39 of file EntitySequence.hpp.

    : startHandle(start), endHandle( start + count - 1 ), sequenceData( dat )
    {}
virtual moab::EntitySequence::~EntitySequence ( ) [inline, virtual]

Definition at line 43 of file EntitySequence.hpp.

{}

Member Function Documentation

Definition at line 46 of file EntitySequence.cpp.

{
  EntityHandle new_end = endHandle + count;
  if (new_end > data()->end_handle())
    return MB_FAILURE;
  
  endHandle = new_end;
  return MB_SUCCESS;
}
SequenceData* moab::EntitySequence::create_data_subset ( EntityHandle  start_handle,
EntityHandle  end_handle,
int  num_sequence_arrays,
unsigned const *  bytes_per_element 
) const [protected]
virtual SequenceData* moab::EntitySequence::create_data_subset ( EntityHandle  start_handle,
EntityHandle  end_handle 
) const [pure virtual]

Create a new SequenceData that is a copy of a subset of the one referenced by this sequence.

Create a new SequenceData that is a copy of a subset of the SequenceData referenced by this EntitySequence. Do not make any changes to this EntitySequence or the current SequenceData.

Implemented in moab::StructuredElementSeq, moab::SweptElementSeq, moab::VertexSequence, moab::MeshSetSequence, moab::TypeSequenceManager::DummySequence, and moab::UnstructuredElemSeq.

Definition at line 54 of file EntitySequence.hpp.

    { return sequenceData; }
void moab::EntitySequence::data ( SequenceData ptr) [inline]

Definition at line 57 of file EntitySequence.hpp.

    { sequenceData = ptr; }

Definition at line 51 of file EntitySequence.hpp.

    { return endHandle; }
virtual void moab::EntitySequence::get_const_memory_use ( unsigned long &  bytes_per_entity,
unsigned long &  size_of_sequence 
) const [pure virtual]

Get memory characteristcs that are the same for all entities.

Get charactersitic constant memory use for all entities in sequence.

Parameters:
bytes_per_entityThe total bytes consumed for each entity in the underlying SequenceData. It is assumed that the same amount of memory is consumed for unused portions of the SequenceData.
size_of_sequenceThe size of the leaf subclass of this class

Implemented in moab::StructuredElementSeq, moab::SweptElementSeq, moab::MeshSetSequence, moab::VertexSequence, moab::UnstructuredElemSeq, and moab::TypeSequenceManager::DummySequence.

unsigned long moab::EntitySequence::get_per_entity_memory_use ( EntityHandle  first,
EntityHandle  last 
) const [virtual]

Get portion of memory use that varies per entity.

Returns:
Any per-entity memory use not accounted for in the results of get_const_memory_use.

Reimplemented in moab::MeshSetSequence, and moab::TypeSequenceManager::DummySequence.

Definition at line 73 of file EntitySequence.cpp.

  { return 0; }

Merge this sequence with another.

Combine two adjacent sequences. Sequence handle blocks must be consective and sequences must share a common SequenceData.

Definition at line 56 of file EntitySequence.cpp.

{
  if (sequenceData != other.sequenceData)
    return MB_FAILURE;
  if (end_handle() + 1 == other.start_handle()) {
    endHandle = other.end_handle();
    other.startHandle = other.end_handle()+1;
  }
  else if (start_handle() == other.end_handle() + 1) {
    startHandle = other.start_handle();
    other.endHandle = other.start_handle()-1;
  }
  else
    return MB_FAILURE;
  return MB_SUCCESS;
}

Erase entities in range: (end_handle()-count, end_handle()].

Reimplemented in moab::MeshSetSequence.

Definition at line 15 of file EntitySequence.cpp.

{
  EntityHandle new_end = endHandle - count;
  if (new_end < startHandle)
    return MB_FAILURE;
  
  endHandle = new_end;
  return MB_SUCCESS;
}

Erase entities in range: [start_handle(), start_handle()+count)

Reimplemented in moab::MeshSetSequence.

Definition at line 25 of file EntitySequence.cpp.

{
  EntityHandle new_start = startHandle + count;
  if (new_start > endHandle)
    return MB_FAILURE;
  
  startHandle = new_start;
  return MB_SUCCESS;
}

Definition at line 36 of file EntitySequence.cpp.

{
  EntityHandle new_start = startHandle - count;
  if (new_start < data()->start_handle())
    return MB_FAILURE;
  
  startHandle = new_start;
  return MB_SUCCESS;
}

Definition at line 60 of file EntitySequence.hpp.

    { return endHandle - startHandle + 1; }
virtual EntitySequence* moab::EntitySequence::split ( EntityHandle  here) [pure virtual]

Split this sequence into two consecutive sequences.

Split this sequence into two sequences.

Parameters:
hereNew sequences should be [start_handle(),here) & [here,end_handle()]
Returns:
New sequence containing [here,end_handle()]

Implemented in moab::StructuredElementSeq, moab::SweptElementSeq, moab::VertexSequence, moab::MeshSetSequence, moab::TypeSequenceManager::DummySequence, moab::PolyElementSeq, and moab::UnstructuredElemSeq.

Definition at line 48 of file EntitySequence.hpp.

    { return startHandle; }
EntityType moab::EntitySequence::type ( ) const [inline]

Definition at line 45 of file EntitySequence.hpp.

True if SequenceData has no holes and is used only by this EntitySequence.

Definition at line 6 of file EntitySequence.cpp.

{
  return start_handle() == data()->start_handle()
        && end_handle() == data()->  end_handle();
}
int moab::EntitySequence::values_per_entity ( ) const [virtual]

Integer value used in finding appropriate SequenceData.

This value is matched to input values by TypeSequenceManager to determine if an available, unused portino of a SequenceData can be used for a specific entity allocation. For example, it is used to find a SequenceData with the appropriate number of vertices per element when allocating elements. The default value is zero.

Reimplemented in moab::StructuredElementSeq, moab::SweptElementSeq, and moab::UnstructuredElemSeq.

Definition at line 12 of file EntitySequence.cpp.

  { return 0; }

Member Data Documentation

Definition at line 13 of file EntitySequence.hpp.

Definition at line 14 of file EntitySequence.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines