Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
moab::VertexSequence Class Reference

#include <VertexSequence.hpp>

+ Inheritance diagram for moab::VertexSequence:
+ Collaboration diagram for moab::VertexSequence:

Public Member Functions

 VertexSequence (EntityHandle start, EntityID count, SequenceData *dat)
 
 VertexSequence (EntityHandle start, EntityID count, EntityID data_size)
 
virtual ~VertexSequence ()
 
ErrorCode get_coordinates (EntityHandle handle, double &x, double &y, double &z) const
 
ErrorCode get_coordinates (EntityHandle handle, double coords[3]) const
 
ErrorCode get_coordinates_ref (EntityHandle handle, const double *&x, const double *&y, const double *&z) const
 
ErrorCode set_coordinates (EntityHandle entity, double x, double y, double z)
 
ErrorCode set_coordinates (EntityHandle entity, const double xyz[3])
 
ErrorCode get_coordinate_arrays (double *&x, double *&y, double *&z)
 
ErrorCode get_coordinate_arrays (const double *&x, const double *&y, const double *&z) const
 
EntitySequencesplit (EntityHandle here)
 Split this sequence into two consecutive sequences. More...
 
SequenceDatacreate_data_subset (EntityHandle start, EntityHandle end) const
 Create a new SequenceData that is a copy of a subset of the one referenced by this sequence. More...
 
ErrorCode push_front (EntityID count)
 
ErrorCode push_back (EntityID count)
 
void get_const_memory_use (unsigned long &bytes_per_entity, unsigned long &size_of_sequence) const
 Get memory characteristcs that are the same for all entities. More...
 
- Public Member Functions inherited from moab::EntitySequence
 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. More...
 
virtual int values_per_entity () const
 Integer value used in finding appropriate SequenceData. More...
 
virtual ErrorCode merge (EntitySequence &other)
 Merge this sequence with another. More...
 
virtual ErrorCode pop_back (EntityID count)
 Erase entities in range: (end_handle()-count, end_handle()]. More...
 
virtual ErrorCode pop_front (EntityID count)
 Erase entities in range: [start_handle(), start_handle()+count) More...
 
virtual unsigned long get_per_entity_memory_use (EntityHandle first, EntityHandle last) const
 Get portion of memory use that varies per entity. More...
 

Private Types

enum  Coord { X = 0 , Y = 1 , Z = 2 }
 

Private Member Functions

double * array (Coord coord)
 
const double * array (Coord coord) const
 
double * x_array ()
 
double * y_array ()
 
double * z_array ()
 
const double * x_array () const
 
const double * y_array () const
 
const double * z_array () const
 
 VertexSequence (VertexSequence &split_from, EntityHandle here)
 

Additional Inherited Members

- Protected Member Functions inherited from moab::EntitySequence
 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)
 

Detailed Description

Definition at line 10 of file VertexSequence.hpp.

Member Enumeration Documentation

◆ Coord

Enumerator

Definition at line 52 of file VertexSequence.hpp.

53  {
54  X = 0,
55  Y = 1,
56  Z = 2
57  };

Constructor & Destructor Documentation

◆ VertexSequence() [1/3]

moab::VertexSequence::VertexSequence ( EntityHandle  start,
EntityID  count,
SequenceData dat 
)
inline

Definition at line 13 of file VertexSequence.hpp.

13 : EntitySequence( start, count, dat ) {}

Referenced by split().

◆ VertexSequence() [2/3]

moab::VertexSequence::VertexSequence ( EntityHandle  start,
EntityID  count,
EntityID  data_size 
)
inline

Definition at line 15 of file VertexSequence.hpp.

16  : EntitySequence( start, count, new SequenceData( 3, start, start + data_size - 1 ) )
17  {
18  data()->create_sequence_data( X, sizeof( double ) );
19  data()->create_sequence_data( Y, sizeof( double ) );
20  data()->create_sequence_data( Z, sizeof( double ) );
21  }

References moab::SequenceData::create_sequence_data(), moab::EntitySequence::data(), X, Y, and Z.

◆ ~VertexSequence()

moab::VertexSequence::~VertexSequence ( )
virtual

Definition at line 6 of file VertexSequence.cpp.

6 {}

◆ VertexSequence() [3/3]

moab::VertexSequence::VertexSequence ( VertexSequence split_from,
EntityHandle  here 
)
inlineprivate

Definition at line 95 of file VertexSequence.hpp.

95 : EntitySequence( split_from, here ) {}

Member Function Documentation

◆ array() [1/2]

double* moab::VertexSequence::array ( Coord  coord)
inlineprivate

Definition at line 59 of file VertexSequence.hpp.

60  {
61  return reinterpret_cast< double* >( data()->get_sequence_data( coord ) );
62  }

References moab::EntitySequence::data(), and moab::SequenceData::get_sequence_data().

Referenced by x_array(), y_array(), and z_array().

◆ array() [2/2]

const double* moab::VertexSequence::array ( Coord  coord) const
inlineprivate

Definition at line 64 of file VertexSequence.hpp.

65  {
66  return reinterpret_cast< const double* >( data()->get_sequence_data( coord ) );
67  }

References moab::EntitySequence::data(), and moab::SequenceData::get_sequence_data().

◆ create_data_subset()

SequenceData * moab::VertexSequence::create_data_subset ( EntityHandle  start_handle,
EntityHandle  end_handle 
) const
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.

Implements moab::EntitySequence.

Definition at line 13 of file VertexSequence.cpp.

14 {
15  const int sizes[] = { sizeof( double ), sizeof( double ), sizeof( double ) };
16  return data()->subset( start, end, sizes );
17 }

References moab::EntitySequence::data(), sizes, and moab::SequenceData::subset().

◆ get_const_memory_use()

void moab::VertexSequence::get_const_memory_use ( unsigned long &  bytes_per_entity,
unsigned long &  size_of_sequence 
) const
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

Implements moab::EntitySequence.

Definition at line 29 of file VertexSequence.cpp.

30 {
31  per_ent = 3 * sizeof( double );
32  seq = sizeof( *this );
33 }

◆ get_coordinate_arrays() [1/2]

ErrorCode moab::VertexSequence::get_coordinate_arrays ( const double *&  x,
const double *&  y,
const double *&  z 
) const
inline

Definition at line 155 of file VertexSequence.hpp.

156 {
157  return get_coordinates_ref( start_handle(), x, y, z );
158 }

References get_coordinates_ref(), and moab::EntitySequence::start_handle().

◆ get_coordinate_arrays() [2/2]

ErrorCode moab::VertexSequence::get_coordinate_arrays ( double *&  x,
double *&  y,
double *&  z 
)
inline

Definition at line 146 of file VertexSequence.hpp.

147 {
148  EntityID offset = start_handle() - data()->start_handle();
149  x = x_array() + offset;
150  y = y_array() + offset;
151  z = z_array() + offset;
152  return MB_SUCCESS;
153 }

References moab::EntitySequence::data(), MB_SUCCESS, moab::EntitySequence::start_handle(), moab::SequenceData::start_handle(), x_array(), y_array(), and z_array().

Referenced by moab::Core::get_coords(), and moab::WriteUtil::get_node_coords().

◆ get_coordinates() [1/2]

ErrorCode moab::VertexSequence::get_coordinates ( EntityHandle  handle,
double &  x,
double &  y,
double &  z 
) const
inline

Definition at line 98 of file VertexSequence.hpp.

99 {
100  EntityID offset = handle - data()->start_handle();
101  x = x_array()[offset];
102  y = y_array()[offset];
103  z = z_array()[offset];
104  return MB_SUCCESS;
105 }

References moab::EntitySequence::data(), MB_SUCCESS, moab::SequenceData::start_handle(), x_array(), y_array(), and z_array().

Referenced by moab::Core::get_coords(), and moab::Core::print_database().

◆ get_coordinates() [2/2]

ErrorCode moab::VertexSequence::get_coordinates ( EntityHandle  handle,
double  coords[3] 
) const
inline

Definition at line 107 of file VertexSequence.hpp.

108 {
109  EntityID offset = handle - data()->start_handle();
110  coords[X] = x_array()[offset];
111  coords[Y] = y_array()[offset];
112  coords[Z] = z_array()[offset];
113  return MB_SUCCESS;
114 }

References moab::EntitySequence::data(), MB_SUCCESS, moab::SequenceData::start_handle(), X, x_array(), Y, y_array(), Z, and z_array().

◆ get_coordinates_ref()

ErrorCode moab::VertexSequence::get_coordinates_ref ( EntityHandle  handle,
const double *&  x,
const double *&  y,
const double *&  z 
) const
inline

Definition at line 116 of file VertexSequence.hpp.

120 {
121  EntityID offset = handle - data()->start_handle();
122  x = x_array() + offset;
123  y = y_array() + offset;
124  z = z_array() + offset;
125  return MB_SUCCESS;
126 }

References moab::EntitySequence::data(), MB_SUCCESS, moab::SequenceData::start_handle(), x_array(), y_array(), and z_array().

Referenced by get_coordinate_arrays().

◆ push_back()

ErrorCode moab::VertexSequence::push_back ( EntityID  count)

Definition at line 19 of file VertexSequence.cpp.

20 {
21  return EntitySequence::append_entities( count );
22 }

References moab::EntitySequence::append_entities().

Referenced by moab::SequenceManager::create_vertex().

◆ push_front()

ErrorCode moab::VertexSequence::push_front ( EntityID  count)

Definition at line 24 of file VertexSequence.cpp.

25 {
26  return EntitySequence::prepend_entities( count );
27 }

References moab::EntitySequence::prepend_entities().

Referenced by moab::SequenceManager::create_vertex().

◆ set_coordinates() [1/2]

ErrorCode moab::VertexSequence::set_coordinates ( EntityHandle  entity,
const double  xyz[3] 
)
inline

◆ set_coordinates() [2/2]

ErrorCode moab::VertexSequence::set_coordinates ( EntityHandle  entity,
double  x,
double  y,
double  z 
)
inline

Definition at line 128 of file VertexSequence.hpp.

129 {
130  EntityID offset = entity - data()->start_handle();
131  x_array()[offset] = x;
132  y_array()[offset] = y;
133  z_array()[offset] = z;
134  return MB_SUCCESS;
135 }

References moab::EntitySequence::data(), MB_SUCCESS, moab::SequenceData::start_handle(), x_array(), y_array(), and z_array().

Referenced by moab::SequenceManager::create_vertex().

◆ split()

EntitySequence * moab::VertexSequence::split ( EntityHandle  here)
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()]

Implements moab::EntitySequence.

Definition at line 8 of file VertexSequence.cpp.

9 {
10  return new VertexSequence( *this, here );
11 }

References VertexSequence().

◆ x_array() [1/2]

double* moab::VertexSequence::x_array ( )
inlineprivate

Definition at line 69 of file VertexSequence.hpp.

70  {
71  return array( X );
72  }

References array(), and X.

Referenced by get_coordinate_arrays(), get_coordinates(), get_coordinates_ref(), and set_coordinates().

◆ x_array() [2/2]

const double* moab::VertexSequence::x_array ( ) const
inlineprivate

Definition at line 82 of file VertexSequence.hpp.

83  {
84  return array( X );
85  }

References array(), and X.

◆ y_array() [1/2]

double* moab::VertexSequence::y_array ( )
inlineprivate

Definition at line 73 of file VertexSequence.hpp.

74  {
75  return array( Y );
76  }

References array(), and Y.

Referenced by get_coordinate_arrays(), get_coordinates(), get_coordinates_ref(), and set_coordinates().

◆ y_array() [2/2]

const double* moab::VertexSequence::y_array ( ) const
inlineprivate

Definition at line 86 of file VertexSequence.hpp.

87  {
88  return array( Y );
89  }

References array(), and Y.

◆ z_array() [1/2]

double* moab::VertexSequence::z_array ( )
inlineprivate

Definition at line 77 of file VertexSequence.hpp.

78  {
79  return array( Z );
80  }

References array(), and Z.

Referenced by get_coordinate_arrays(), get_coordinates(), get_coordinates_ref(), and set_coordinates().

◆ z_array() [2/2]

const double* moab::VertexSequence::z_array ( ) const
inlineprivate

Definition at line 90 of file VertexSequence.hpp.

91  {
92  return array( Z );
93  }

References array(), and Z.


The documentation for this class was generated from the following files: