ElementBlock.h
1 //##################################################################################################
2 //
3 // Ceetron Export
4 // Component: VTFx
5 //
6 // --------------------------------------------------------------------------------------------
7 // Copyright (C) 2015, Ceetron AS
8 // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Ceetron AS. The contents of this file may
9 // not be disclosed to third parties, copied or duplicated in any form, in whole or in part,
10 // without the prior written permission of Ceetron AS.
11 //##################################################################################################
12 
13 #pragma once
14 
15 #include "CeeVTFx/Base.h"
16 #include "CeeVTFx/Block.h"
17 
18 #include <vector>
19 
20 class VTFxElementBlock;
21 
22 namespace cee {
23 namespace vtfx {
24 
25 //==================================================================================================
26 //
27 //
28 //
29 //==================================================================================================
30 class CEE_VTFX_EXPORT ElementBlock : public Block
31 {
32 public:
33  // Element types for ElementBlock
34  // -----------------------------------------------------------------------------
35  enum ElementType {
52  POLYHEDRONS,
53  UNKNOWN_ELEMENT
54  };
55 
56 
57 public:
58  ElementBlock(int blockId, bool withElementIds, bool referNodesByIds);
59  virtual ~ElementBlock();
60 
61  size_t elementCount() const;
62  size_t elementNodeCount() const;
63  bool hasElementIds() const;
64  bool referNodesByIds() const;
65 
66  size_t elementGroupCount() const;
67  ElementType elementGroupType(size_t groupIndex) const;
68  size_t elementGroupElementCount(size_t groupIndex) const;
69  size_t elementGroupElementNodeCount(size_t groupIndex) const;
70  bool elementGroup(size_t groupIndex, std::vector<int>* elementNodes, std::vector<int>* elementIds) const;
71  bool elementIndices(size_t groupIndex, std::vector<int>* elementIndices) const;
72 
73  bool polyhedronsFaceCounts(size_t groupIndex, std::vector<int>* faceCounts);
74  bool polyhedronsFaceNodeCounts(size_t groupIndex, std::vector<int>* faceNodeCounts);
75  bool polyhedronsLocalNodes(size_t groupIndex, std::vector<int>* localNodes);
76  bool polyhedronsElementNodeCounts(size_t groupIndex, std::vector<int>* elementNodeCounts);
77 
78  void setElements(const std::vector<ElementType>& elementTypes, const std::vector<int>& elementNodes, const std::vector<int>& elementIds = std::vector<int>());
79 
80  bool addElements(ElementType elementType, const std::vector<int>& elementNodes, const std::vector<int>& elementIds = std::vector<int>());
81  bool addElements(ElementType elementType, const int* elementNodes, size_t elementNodeCount, const int* elementIds = NULL);
82 
83  bool addElement(ElementType elementType, const std::vector<int>& elementNodes, int elementId = -1);
84  bool addElement(ElementType elementType, const int* elementNodes, size_t count, int elementId = -1);
85 
86  int nodeBlockId() const;
87  void setNodeBlockId(int nodeBlockId);
88 
89  bool checkValidity() const;
90 
91  // Static helper functions for the element library
92  static size_t nodesPerElement(ElementType elementType);
93  static bool isVolumeElement(ElementType elementType);
94 
95  static size_t surfacesPerElement(ElementType elementType);
96  static std::vector<unsigned int> elementSurface(ElementType elementType, size_t surfaceIndex);
97 
98 private:
99  ElementBlock(VTFxElementBlock* block, int blockId);
100 
101  VTFxBlock* internal_vtfxBlock() const;
102 
103 private:
104  friend class DatabasePrivate;
105 
106  CEE_PRIVATE_IMPL(ElementBlock);
107  CEE_DISALLOW_COPY_AND_ASSIGN(ElementBlock);
108 };
109 
110 }
111 }
Namespace cee contains all functionality and structures under the Core component. ...
Definition: AppAssert.cpp:18
Triangle shell element, 6 element nodes.
Definition: ElementBlock.h:40
ElementType
Global element type constants used by Ceetron Export. These constants are used for various methods of...
Definition: ElementBlock.h:35
Pyramid volume element, 5 element nodes.
Definition: ElementBlock.h:44
Pyramid volume element, 13 element nodes.
Definition: ElementBlock.h:45
A block for storing finite elements and optional element ids.
Definition: ElementBlock.h:30
Hexahedron volume element, 20 element nodes.
Definition: ElementBlock.h:49
Pentahedron volume element, 6 element nodes, a.k.a. Wedge volume element.
Definition: ElementBlock.h:50
Triangle shell element, 3 element nodes.
Definition: ElementBlock.h:39
Tetrahedron volume element, 10 element nodes.
Definition: ElementBlock.h:47
Tetrahedron volume element, 4 element nodes.
Definition: ElementBlock.h:46
Pentahedron volume element, 15 element nodes, a.k.a. Wedge volume element.
Definition: ElementBlock.h:51
Hexahedron volume element, 8 element nodes.
Definition: ElementBlock.h:48
Quad shell element, 4 element nodes.
Definition: ElementBlock.h:41
Beam element, 3 element nodes.
Definition: ElementBlock.h:38
Quad shell element, 9 element nodes (as QUADS_8 but one extra internal node)
Definition: ElementBlock.h:43
Abstract base class for all VTFx blocks.
Definition: Block.h:29
Point element, 1 element node.
Definition: ElementBlock.h:36
Quad shell element, 8 element nodes.
Definition: ElementBlock.h:42
Beam element, 2 element nodes.
Definition: ElementBlock.h:37