GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
gmElementDof.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_ELEMENT_DOF_H_
25#define _GEMA_ELEMENT_DOF_H_
26
27#include "gmCell.h"
28
35typedef quint64 GmElementDofMap;
36
40#define GM_MAX_DOF (8*sizeof(GmElementDofMap))
41
42
47{
48public:
50 virtual int numDof() const = 0;
51
53 virtual int dof(int columnIndex) const = 0;
54};
55
56
61{
62public:
63 GmElementDof(GmCellType type, const QVector<int>& dofList = QVector<int>());
64 GmElementDof(int numNodes, const QVector<int>& dofList = QVector<int>());
65
67
69 virtual int numDof() const { return _ndof; }
70
72 int numNodes() const { return _nodeMaps.size(); }
73
80 int node(int columnIndex) const { return _columnNodeList.at(columnIndex); }
81
88 virtual int dof(int columnIndex) const { return _columnDofList.at(columnIndex); }
89
92 {
93 assert(node >= 0 && node < numNodes());
94 return _nodeMaps[node];
95 }
96
97 QVector<int> nodeDofList(int node) const;
98
99 GmElementDofMap elementDofMap() const;
100
101 void setNodeDofUnsafe(int node, const QVector<int>& dofList);
102 void setNodeDof(int node, const QVector<int>& dofList);
103 void addNode(const QVector<int>& dofList);
104 void addNodeUnsafe(const QVector<int>& dofList);
105
106private:
107 Q_DISABLE_COPY(GmElementDof)
108
109 void init(int numNodes, const QVector<int>& dofList);
110 GmElementDofMap dofMapFromList(const QVector<int>& dofList) const;
111
112 int _ndof;
116};
117
133{
134public:
137
139 void clear() { _dofList.clear(); _nodeList.clear(); _globalDofMap.clear(); }
140
142 void setDofList(const QVector<int>& dofList) { _dofList = dofList; }
143
145 void addNode(int node) { _nodeList.append(node); }
146
148 virtual int numDof() const { return _nodeList.size() * _dofList.size(); }
149
153 int node(int columnIndex) const
154 {
155 assert(columnIndex >= 0 && columnIndex < numDof());
156 return _nodeList[columnIndex / _dofList.size()];
157 }
158
162 virtual int dof(int columnIndex) const
163 {
164 assert(columnIndex >= 0 && columnIndex < numDof());
165 return _dofList[columnIndex % _dofList.size()];
166 }
167
173 QVector<int>& globalDofMap() { return _globalDofMap; }
174
175private:
176 Q_DISABLE_COPY(GmMatrixDof)
177
178 QVector<int> _nodeList;
179 QVector<int> _dofList;
180
181 QVector<int> _globalDofMap;
182};
183
184
185#endif
186
An interface for a simple class returning the dof number associated to a local matrix column.
Definition gmElementDof.h:47
virtual int numDof() const =0
Returns the total number of dfs (matrix columns)
virtual int dof(int columnIndex) const =0
Given a 'matrix column' index, returns the associated dof.
A class to represent the degrees of freedom associated with each node of an element as seen by a phys...
Definition gmElementDof.h:61
QVector< int > _columnDofList
Vector indexed by 'matrix column' storing the column respective dof number. Size equal to numDof().
Definition gmElementDof.h:115
GmElementDofMap nodeDofMap(int node) const
Returns the dof map for the requested element local node.
Definition gmElementDof.h:91
virtual int dof(int columnIndex) const
Given a 'matrix column' index, returns the associated dof.
Definition gmElementDof.h:88
QVector< int > _columnNodeList
Vector indexed by 'matrix column' storing the column respective node number. Size equal to numDof().
Definition gmElementDof.h:114
int node(int columnIndex) const
Given a 'matrix column' index, returns the associated node.
Definition gmElementDof.h:80
int _ndof
The total number of dof for this element type.
Definition gmElementDof.h:112
virtual int numDof() const
Returns the total number of dofs for this element.
Definition gmElementDof.h:69
int numNodes() const
Returns the number of nodes in the element (which can contain ghost nodes)
Definition gmElementDof.h:72
QVector< GmElementDofMap > _nodeMaps
Vector storing the dof map for each element node.
Definition gmElementDof.h:113
A class to represent the degrees of freedom associated with the set of matrix columns,...
Definition gmElementDof.h:133
void setDofList(const QVector< int > &dofList)
Sets the list with dof numbers associated with each node.
Definition gmElementDof.h:142
void addNode(int node)
Adds a new node to the matrix. Each node is associated with the dofs given by setDofList()
Definition gmElementDof.h:145
virtual int dof(int columnIndex) const
Given a 'matrix column' index, returns the associated dof. columnIndex must be a value less than numD...
Definition gmElementDof.h:162
GmMatrixDof()
Default connstructor.
Definition gmElementDof.h:136
virtual int numDof() const
Returns the total number of dofs (the number of matrix columns)
Definition gmElementDof.h:148
QVector< int > & globalDofMap()
Returns the global map used to translate local column indices into global dof numbers (indices on a g...
Definition gmElementDof.h:173
void clear()
Clears the information stored in the object.
Definition gmElementDof.h:139
int node(int columnIndex) const
Given a 'matrix column' index, returns the associated node. columnIndex must be a value less than num...
Definition gmElementDof.h:153
Declaration of the GmCell class.
GmCellType
Mesh Cell types. Don't change type orders or add types without reading comments below.
Definition gmCellType.h:31
#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
quint64 GmElementDofMap
An integer type representing the degrees of freedom associated to an element node....
Definition gmElementDof.h:35