1 #ifndef ELEMENT_SEQUENCE_HPP
2 #define ELEMENT_SEQUENCE_HPP
3
4 #include "EntitySequence.hpp"
5 #include "SequenceData.hpp"
6 #include "moab/CN.hpp"
7
8 namespace moab {
9
10 class ElementSequence : public EntitySequence
11 {
12 public:
13
ElementSequence(EntityHandle start,EntityID count,unsigned int nodes_per_elem,SequenceData * dat)14 ElementSequence( EntityHandle start,
15 EntityID count,
16 unsigned int nodes_per_elem,
17 SequenceData* dat )
18 : EntitySequence( start, count, dat ),
19 nodesPerElement(nodes_per_elem)
20 {}
21
~ElementSequence()22 virtual ~ElementSequence() {}
23
nodes_per_element() const24 inline unsigned int nodes_per_element() const { return nodesPerElement; }
25
26 virtual ErrorCode get_connectivity( EntityHandle handle,
27 std::vector<EntityHandle>& connect,
28 bool topological = false ) const = 0;
29
30 virtual ErrorCode get_connectivity( EntityHandle handle,
31 EntityHandle const*& connect,
32 int &connect_length,
33 bool topological = false,
34 std::vector<EntityHandle>* storage = 0
35 ) const = 0;
36
37 virtual ErrorCode set_connectivity( EntityHandle handle,
38 EntityHandle const* connect,
39 int connect_length ) = 0;
40
41 inline EntityHandle const* get_connectivity_array() const;
42
43 virtual EntityHandle* get_connectivity_array() = 0;
44
45 inline bool has_mid_edge_nodes() const;
46 inline bool has_mid_face_nodes() const;
47 inline bool has_mid_volume_nodes() const;
48
49 protected:
50
ElementSequence(ElementSequence & split_from,EntityHandle here)51 ElementSequence( ElementSequence& split_from, EntityHandle here )
52 : EntitySequence( split_from, here ),
53 nodesPerElement( split_from.nodesPerElement )
54 {}
55
56 private:
57
58 unsigned nodesPerElement;
59 };
60
61 inline EntityHandle const*
get_connectivity_array() const62 ElementSequence::get_connectivity_array() const
63 { return const_cast<ElementSequence*>(this)->get_connectivity_array(); }
64
65 inline bool
has_mid_edge_nodes() const66 ElementSequence::has_mid_edge_nodes() const
67 { return CN::HasMidEdgeNodes( type(), nodes_per_element() ); }
68
69 inline bool
has_mid_face_nodes() const70 ElementSequence::has_mid_face_nodes() const
71 { return CN::HasMidFaceNodes( type(), nodes_per_element() ); }
72
73 inline bool
has_mid_volume_nodes() const74 ElementSequence::has_mid_volume_nodes() const
75 { return CN::HasMidRegionNodes( type(), nodes_per_element() ); }
76
77 } // namespace moab
78
79 #endif
80