GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
gmNodeSet.h
Go to the documentation of this file.
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
24#ifndef _GEMA_NODE_SET_H_
25#define _GEMA_NODE_SET_H_
26
27#include "gmMesh.h"
28#include "gmCellGroupSet.h"
29
34{
35public:
37 virtual ~GmNodeSet() {}
38
40 virtual QString id() const = 0;
41
43 virtual GmMesh* mesh() const = 0;
44
46 virtual int numNodes() const = 0;
47
52 virtual int node(int i) const = 0;
53
61 virtual bool setNodeData(int numNodes, int* nodeList)
62 {
63 Q_UNUSED(numNodes); Q_UNUSED(nodeList);
64 return false;
65 }
66
68 virtual size_t usedMemory() const = 0;
69};
70
71
74{
75public:
77 GmMeshNodeSet(GmMesh* mesh) : _mesh(mesh) {}
78
79 // Comments on the base class
80 virtual QString id() const { return "mesh wrapper"; }
81
82 // Comments on the base class
83 virtual GmMesh* mesh() const { return _mesh; }
84
85 // Comments on the base class
86 virtual int numNodes() const { return _mesh->numNodes(); }
87
88 // Comments on the base class
89 virtual int node(int i) const { return i; }
90
91 // Comments on the base class
92 virtual size_t usedMemory() const { return 0; }
93
94private:
96};
97
98
100{
101public:
104 {
105 _nodeList = nullptr;
106 _mesh = subset->mesh();
107 _numNodes = subset->numNodes();
108 if (_numNodes > 0)
109 {
110 _nodeList = new int[_numNodes];
111 for (int i = 0; i < _numNodes; i++)
112 _nodeList[i] = subset->node(i);
113 }
114 }
115
116 // Comments on the base class
117 virtual QString id() const { return "generic node set"; }
118
119 // Comments on the base class
120 virtual GmMesh* mesh() const { return _mesh; }
121
122 // Comments on the base class
123 virtual int numNodes() const { return _numNodes; }
124
125 // Comments on the base class
126 virtual int node(int i) const { assert(i >= 0 && i < _numNodes); return _nodeList[i]; }
127
128 // Comments on the base class
129 virtual size_t usedMemory() const { return _numNodes*sizeof(int); }
130
131 ~GmGenericNodeSet() override { delete[] _nodeList; }
132
133private:
137};
138
139
140#endif
141
Interface for helping managing mesh cell groups and returning the elements in their union.
Definition gmCellGroupSet.h:35
virtual GmCellMesh * mesh() const =0
Returns the mesh owning the cell groups.
virtual int node(int setIndex) const =0
Given an index in the range [0..numNodes()-1], returns the respective mesh node index.
virtual int numNodes() const =0
Returns the number of geometric nodes shared by the group elements.
Definition gmNodeSet.h:100
virtual GmMesh * mesh() const
Returns the mesh that this set is tied to.
Definition gmNodeSet.h:120
int _numNodes
The number of nodes in the subset.
Definition gmNodeSet.h:135
GmMesh * _mesh
The wrapped mesh.
Definition gmNodeSet.h:134
GmGenericNodeSet(const GmCellGroupSet *subset)
Constructor from cell group set.
Definition gmNodeSet.h:103
virtual size_t usedMemory() const
Returns an estimative of the memory used by the node set in bytes.
Definition gmNodeSet.h:129
virtual int node(int i) const
Returns the node id of the i'th entry stored in this set.
Definition gmNodeSet.h:126
virtual int numNodes() const
Returns the number of nodes stored in this set.
Definition gmNodeSet.h:123
int * _nodeList
The list of node ids in the subset.
Definition gmNodeSet.h:136
virtual QString id() const
Returns the set name.
Definition gmNodeSet.h:117
Base interface class for Mesh type plugins.
Definition gmMesh.h:48
A node set wrapper over a common mesh. Constant (no support for setNodeData())
Definition gmNodeSet.h:74
virtual GmMesh * mesh() const
Returns the mesh that this set is tied to.
Definition gmNodeSet.h:83
virtual QString id() const
Returns the set name.
Definition gmNodeSet.h:80
virtual int node(int i) const
Returns the node id of the i'th entry stored in this set.
Definition gmNodeSet.h:89
virtual int numNodes() const
Returns the number of nodes stored in this set.
Definition gmNodeSet.h:86
GmMesh * _mesh
The wrapped mesh.
Definition gmNodeSet.h:95
GmMeshNodeSet(GmMesh *mesh)
Simple constructor.
Definition gmNodeSet.h:77
virtual size_t usedMemory() const
Returns an estimative of the memory used by the node set in bytes.
Definition gmNodeSet.h:92
This class stores a set of nodes belonging to a mesh. The nodes can belong to the mesh boundary but t...
Definition gmNodeSet.h:34
virtual QString id() const =0
Returns the set name.
virtual size_t usedMemory() const =0
Returns an estimative of the memory used by the node set in bytes.
virtual int node(int i) const =0
Returns the node id of the i'th entry stored in this set.
virtual int numNodes() const =0
Returns the number of nodes stored in this set.
virtual bool setNodeData(int numNodes, int *nodeList)
Updates the node list in the set object.
Definition gmNodeSet.h:61
virtual ~GmNodeSet()
Virtual destructor.
Definition gmNodeSet.h:37
virtual GmMesh * mesh() const =0
Returns the mesh that this set is tied to.
Declaration of the GmCellGroupSet class family.
#define GMC_API_EXPORT
Macro for controlling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_L...
Definition gmCoreConfig.h:35
Declaration of the GmMesh interface class.