24#ifndef _GEMA_CELL_GROUP_SET_H_
25#define _GEMA_CELL_GROUP_SET_H_
61 virtual int node(
int setIndex)
const = 0;
99 virtual int numCells()
const {
return _mesh->numCells(); }
102 virtual GmCell*
cell(
int setIndex)
const {
return _mesh->cell(setIndex); }
108 virtual int numNodes()
const {
return _mesh->numNodes(); }
111 virtual int node(
int setIndex)
const {
return setIndex; }
151 virtual int numNodes()
const {
return nodeData()->first; }
154 virtual int node(
int setIndex)
const
158 assert(setIndex >= 0 && setIndex < d->first);
159 return d->second[setIndex];
162 virtual void clear();
170 virtual size_t usedMemory()
const;
176 NodeData* buildNodeList()
const;
177 NodeData* nodeData()
const;
207 virtual int numCells()
const;
209 virtual GmCell* cell(
int setIndex)
const;
212 virtual bool ordered()
const {
return false; }
214 virtual void clear();
242 virtual GmCell*
cell(
int setIndex)
const { assert(setIndex >= 0 && setIndex < _ncells);
return _mesh->cell(_cells[setIndex]); }
247 virtual void clear();
252 virtual void applyTransform(std::function<
int(
int)>& t);
271 assert(first <= last && first >= 0 && last < mesh->numCells());
275 virtual int numCells()
const {
return _last - _first + 1; }
278 virtual GmCell*
cell(
int setIndex)
const {
return _mesh->cell(_first + setIndex); }
296#define GmForeachActiveGroupCell(variable, gs) GmForeachCellHelper(variable, gs, GmCellGroupSet, GmCell, true)
299#define GmForeachGroupCell(variable, gs, activeOnly) GmForeachCellHelper(variable, gs, GmCellGroupSet, GmCell, activeOnly)
302#define GmForeachActiveGroupElement(variable, gs) GmForeachCellHelper(variable, gs, GmCellGroupSet, GmElement, true)
305#define GmForeachGroupElement(variable, gs, activeOnly) GmForeachCellHelper(variable, gs, GmCellGroupSet, GmElement, activeOnly)
A helper class implementing common code for handling group sets, specially handling group nodes....
Definition gmCellGroupSet.h:142
virtual GmCellMesh * mesh() const
Returns the mesh owning the cell groups.
Definition gmCellGroupSet.h:168
virtual void clear()
Clear the group set in response to a mesh clear() operation. It will not clear the list of cellGroups...
Definition gmCellGroupSet.cpp:128
QAtomicPointer< NodeData > _nodeData
Atomic pointer to the node data. Contains the number of nodes shared by the group cells and a vector ...
Definition gmCellGroupSet.h:187
GmCellMesh * _mesh
The associated mesh.
Definition gmCellGroupSet.h:179
virtual int numNodes() const
Returns the number of geometric nodes shared by the group elements.
Definition gmCellGroupSet.h:151
virtual size_t usedMemory() const
Returns the approximate amount of memory used to store node data, if any.
Definition gmCellGroupSet.cpp:217
virtual int node(int setIndex) const
Given an index in the range [0..numNodes()-1], returns the respective mesh node index.
Definition gmCellGroupSet.h:154
QList< int > _groupList
The list of mesh cell groups included in this set.
Definition gmCellGroupSet.h:180
virtual const QList< int > & cellGroups() const
Returns a list with the cell groups belonging to this group set. Values are the group index in the me...
Definition gmCellGroupSet.h:165
QPair< int, int * > NodeData
Type for storing node data information: Number of nodes + vector pointer.
Definition gmCellGroupSet.h:145
QMutex _nodeDataMutex
Mutex protecting the creation of _nodeData.
Definition gmCellGroupSet.h:190
Cell group set consisting of a set of disjoint mesh cell groups.
Definition gmCellGroupSet.h:202
QMap< int, int > _groupMap
A map associating the first cell index in a group with the group number.
Definition gmCellGroupSet.h:220
virtual void applyTransform(std::function< int(int)> &t)
See comments on the base class. Does nothing. No stored cell ids.
Definition gmCellGroupSet.h:217
virtual bool ordered() const
Returns true if the the set returned by calls to cell(0) through cell(numCells()-1) is ordered by cel...
Definition gmCellGroupSet.h:212
Cell group set consisting of a set of mesh cell groups.
Definition gmCellGroupSet.h:228
int _ncells
The number of unique cells in the group.
Definition gmCellGroupSet.h:257
virtual bool ordered() const
Returns true if the the set returned by calls to cell(0) through cell(numCells()-1) is ordered by cel...
Definition gmCellGroupSet.h:245
virtual int numCells() const
Returns the number of unique elements in the cell group set.
Definition gmCellGroupSet.h:239
int * _cells
A vector with the ids of all unique cells in the group with size _ncells.
Definition gmCellGroupSet.h:258
virtual GmCell * cell(int setIndex) const
Given an index in the range [0..numCells()-1], returns the respective cell.
Definition gmCellGroupSet.h:242
virtual size_t usedMemory() const
Returns the approximate amount of memory used to store node data, if any.
Definition gmCellGroupSet.h:250
Interface for helping managing mesh cell groups and returning the elements in their union.
Definition gmCellGroupSet.h:35
virtual const QList< int > & cellGroups() const =0
Returns a list with the cell groups belonging to this group set. Values are the group index in the me...
virtual int numCells() const =0
Returns the number of unique elements in the cell group set.
virtual GmCell * cell(int setIndex) const =0
Given an index in the range [0..numCells()-1], returns the respective cell.
virtual void clear()=0
Clear the group set in response to a mesh clear() operation. It will not clear the list of cellGroups...
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 size_t usedMemory() const =0
Returns the approximate memory used internally by the group set object for storing its data....
virtual void applyTransform(std::function< int(int)> &t)=0
This is a very specialized function. Use only if you know what you are doing. For sets storing intern...
virtual bool ordered() const =0
Returns true if the the set returned by calls to cell(0) through cell(numCells()-1) is ordered by cel...
virtual int numNodes() const =0
Returns the number of geometric nodes shared by the group elements.
virtual ~GmCellGroupSet()
Virtual destructor.
Definition gmCellGroupSet.h:38
Base interface for mesh cells.
Definition gmCell.h:88
Cell group set consisting of all the mesh cells.
Definition gmCellGroupSet.h:93
virtual size_t usedMemory() const
Returns the approximate memory used internally by the group set object for storing its data....
Definition gmCellGroupSet.h:123
virtual bool ordered() const
Returns true if the the set returned by calls to cell(0) through cell(numCells()-1) is ordered by cel...
Definition gmCellGroupSet.h:105
GmCellMeshGroupSet(GmCellMesh *mesh)
Constructor.
Definition gmCellGroupSet.h:96
virtual int node(int setIndex) const
Given an index in the range [0..numNodes()-1], returns the respective mesh node index.
Definition gmCellGroupSet.h:111
virtual GmCell * cell(int setIndex) const
Given an index in the range [0..numCells()-1], returns the respective cell.
Definition gmCellGroupSet.h:102
virtual int numNodes() const
Returns the number of geometric nodes shared by the group elements.
Definition gmCellGroupSet.h:108
virtual int numCells() const
Returns the number of unique elements in the cell group set.
Definition gmCellGroupSet.h:99
virtual GmCellMesh * mesh() const
Returns the mesh owning the cell groups.
Definition gmCellGroupSet.h:120
virtual void clear()
Clear the group set in response to a mesh clear() operation. It will not clear the list of cellGroups...
Definition gmCellGroupSet.h:114
virtual void applyTransform(std::function< int(int)> &t)
See comments on the base class. Does nothing. No stored cell ids.
Definition gmCellGroupSet.h:126
virtual const QList< int > & cellGroups() const
Returns a list with the cell groups belonging to this group set. Values are the group index in the me...
Definition gmCellGroupSet.h:117
Base interface class for CellMesh type plugins.
Definition gmCellMesh.h:40
Cell group set consisting of a sequential set of mesh cells with no cell group association.
Definition gmCellGroupSet.h:265
virtual void clear()
Clear the group set in response to a mesh clear() operation. It will not clear the list of cellGroups...
Definition gmCellGroupSet.h:284
virtual int numCells() const
Returns the number of unique elements in the cell group set.
Definition gmCellGroupSet.h:275
int _last
The index in _mesh of the last set cell.
Definition gmCellGroupSet.h:291
GmCellSequentialGroupSet(GmCellMesh *mesh, int first, int last)
Constructor.
Definition gmCellGroupSet.h:268
virtual void applyTransform(std::function< int(int)> &t)
See comments on the base class. Does nothing. No stored cell ids.
Definition gmCellGroupSet.h:287
virtual GmCell * cell(int setIndex) const
Given an index in the range [0..numCells()-1], returns the respective cell.
Definition gmCellGroupSet.h:278
virtual bool ordered() const
Returns true if the the set returned by calls to cell(0) through cell(numCells()-1) is ordered by cel...
Definition gmCellGroupSet.h:281
int _first
The index in _mesh of the first set cell.
Definition gmCellGroupSet.h:290
Declaration of the GmCell class.
Declaration of the GmCellMesh interface class.
#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