23 #ifndef _GEMA_GAUSSINDEX_H_ 24 #define _GEMA_GAUSSINDEX_H_ 28 #include <QVarLengthArray> 48 virtual int numPoints()
const = 0;
51 virtual int numCells()
const = 0;
54 virtual int numPoints(
int cellId)
const = 0;
61 virtual int pointIndex(
int cellId,
int ip)
const = 0;
66 virtual int cellIp(
int gpIndex,
int* ip)
const = 0;
87 virtual int pointIndex(
int cellId,
int ip)
const {
return _proxy->pointIndex(cellId, ip); }
88 virtual int cellIp(
int gpIndex,
int* ip)
const {
return _proxy->cellIp(gpIndex, ip); }
110 int numPoints()
const {
return _numIp ? _numCells * _numIp : _cellOffset.last(); }
118 assert(cellId >= 0 && cellId < _numCells);
119 return _numIp ? _numIp : _cellOffset[cellId + 1] - _cellOffset[cellId];
127 assert(cellId >= 0 && cellId < _numCells);
128 assert(ip >= 0 && ip < numPoints(cellId));
129 return ip + (_numIp ? cellId * _numIp : _cellOffset[cellId]);
137 assert(gpIndex >= 0 && gpIndex < numPoints());
142 *ip = gpIndex % _numIp;
143 return gpIndex / _numIp;
146 int pos = qUpperBound(_cellOffset, gpIndex) - _cellOffset.data();
147 assert(pos >= 0 && pos < _cellOffset.size());
149 if(gpIndex < _cellOffset[pos])
152 *ip = gpIndex - _cellOffset[pos];
157 void clear() { _numIp = _numCells = 0; _cellOffset.clear(); _cellOffset.append(0); }
160 size_t usedMemory()
const {
return _numIp ? 0 : _cellOffset.capacity() *
sizeof(int); }
162 #if defined ENABLE_TESTS || defined ENABLE_VALUESET_TESTS 163 void validateInternalStructure()
const;
196 virtual int numPoints()
const {
return _cellOffset.last(); }
204 assert(cellId >= 0 && cellId < _cellOffset.size()-1);
205 return _cellOffset[cellId + 1] - _cellOffset[cellId];
215 assert(cellId >= 0 && cellId < _cellOffset.size()-1);
216 assert((ip >= 0 && ip <
numPoints(cellId)) || (_cellOffset[cellId + 1] == _cellOffset[cellId]));
217 return (_cellOffset[cellId + 1] != _cellOffset[cellId]) ? ip + _cellOffset[cellId] : -1;
224 virtual int cellIp(
int gpIndex,
int* ip)
const 226 assert(gpIndex >= 0 && gpIndex <
numPoints());
229 int pos = qUpperBound(_cellOffset, gpIndex) - _cellOffset.data();
230 assert(pos >= 0 && pos < _cellOffset.size());
232 if(gpIndex < _cellOffset[pos])
235 *ip = gpIndex - _cellOffset[pos];
240 void clear() { _numCells = 0; _cellOffset.clear(); _cellOffset.append(0); }
243 size_t usedMemory()
const {
return _cellOffset.capacity() *
sizeof(int); }
245 #if defined ENABLE_TESTS || defined ENABLE_VALUESET_TESTS 246 void validateInternalStructure()
const;
281 bool addValues(
const int* numAddedValues);
282 bool addValues(
int firstAddedElement);
284 void restoreSize(
int oldNumCells);
290 bool addValuesWorker(
const int* numAddedValues,
int firstAddedElement);
292 int numAddedGaussPoints(
const int* numTypes,
int* pointsPerCell,
int* numElem);
293 int numAddedGaussPoints(
int firstElement,
int* pointsPerCell,
int* numElem);
295 int fixedAddedElements(
const int* numTypes,
int firstElement,
int* numElem)
const;
297 void fillOffsetVectorFromMesh (
int firstCell = 0);
298 void fillOffsetVectorFromTypes(
int firstCell,
const int* numTypes,
int newFixed);
virtual int numPoints(int cellId) const
Returns the number of Gauss points for the given Cell. Returns 0 if the cell does not belongs to the ...
Definition: gmGaussIndex.h:202
virtual int pointIndex(int cellId, int ip) const
Given a mesh cell index and an integration point index, returns the Gauss point "linear" index,...
Definition: gmGaussIndex.h:87
virtual int numPoints() const =0
Returns the number of Gauss points in the index.
int numCells() const
Returns the number of cells in the index.
Definition: gmGaussIndex.h:113
virtual int numPoints() const
Returns the number of Gauss points in the index.
Definition: gmGaussIndex.h:196
Interface for helping managing mesh cell groups and returning the elements in their union.
Definition: gmCellGroupSet.h:34
const GmCellGroupSet * _group
The group set object listing the set of mesh cells.
Definition: gmGaussIndex.h:333
A helper class that implements a GaussIndex like interface for the basic case where the ENTIRE mesh i...
Definition: gmGaussIndex.h:106
virtual ~GmGaussIndexProxy()
Destructor. Deletes the proxy if we have its ownership.
Definition: gmGaussIndex.h:81
int numPoints(int cellId) const
Returns the number of Gauss points for the given Cell.
Definition: gmGaussIndex.h:116
Declaration of usefull configuration definitions for the Core library.
virtual int numCells() const
Returns the number of cells in the index.
Definition: gmGaussIndex.h:199
virtual int numPoints(int cellId) const
Returns the number of Gauss points for the given Cell. Returns 0 if the cell does not belongs to the ...
Definition: gmGaussIndex.h:86
int _numCells
The number of cells in the index set (might be less than the number of cells in the offset vector)
Definition: gmGaussIndex.h:254
int _numCells
The number of cells in the index set.
Definition: gmGaussIndex.h:171
A Gauss index interface always indexing ALL the elements in either the full mesh or in the given mesh...
Definition: gmGaussIndex.h:311
virtual int cellIp(int gpIndex, int *ip) const
Given a Gauss point "linear" index (a value from 0 to numPoints()-1), returns the mesh cell index + i...
Definition: gmGaussIndex.h:88
const int * _cells
The cell subset. If NULL the whole mesh will be used.
Definition: gmGaussIndex.h:320
A Gauss index interface always indexing ALL the elements of a mesh, with support for mesh growing.
Definition: gmGaussIndex.h:274
size_t usedMemory() const
Returns the size of the used memory.
Definition: gmGaussIndex.h:160
size_t usedMemory() const
Returns the size of the used memory.
Definition: gmGaussIndex.h:243
A Gauss index interface indexing a filtered set of mesh elements.
Definition: gmGaussIndex.h:325
const GmElementMesh * _mesh
The mesh object to which this index is tied to.
Definition: gmGaussIndex.h:300
int numPoints() const
Returns the number of Gauss points in the index.
Definition: gmGaussIndex.h:110
int pointIndex(int cellId, int ip) const
Given a mesh cell index and an integration point index, returns the Gauss point "linear" index,...
Definition: gmGaussIndex.h:125
int _rule
The indexed rule set.
Definition: gmGaussIndex.h:321
void clear()
Clears the index.
Definition: gmGaussIndex.h:157
bool _ownsProxy
Do we own the proxy object?
Definition: gmGaussIndex.h:92
void clear()
Clears the index.
Definition: gmGaussIndex.h:240
T * _proxy
The proxy object.
Definition: gmGaussIndex.h:91
int _numIp
The fixed number of integartion points per cell or 0 if index based.
Definition: gmGaussIndex.h:170
GmGaussIndexProxy(T *proxy, bool ownership)
Constructor. Takes ownership of the received object if ownership is true.
Definition: gmGaussIndex.h:78
int _rule
The indexed rule set.
Definition: gmGaussIndex.h:301
A helper class that implements a GmGaussIndex interface from a proxy object that includes all the nee...
Definition: gmGaussIndex.h:74
virtual int numPoints() const
Returns the number of Gauss points in the index.
Definition: gmGaussIndex.h:84
virtual int numCells() const
Returns the number of cells in the index.
Definition: gmGaussIndex.h:85
bool _activeOnly
Should we index active cells only?
Definition: gmGaussIndex.h:334
#define GMC_API_EXPORT
Macro for controling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_LI...
Definition: gmCoreConfig.h:35
GmUnfilteredGaussIndexBase()
Default empty index constructor.
Definition: gmGaussIndex.h:168
const GmElementMesh * _mesh
The mesh object to which this index is tied to.
Definition: gmGaussIndex.h:319
virtual int pointIndex(int cellId, int ip) const
Given a mesh cell index and an integration point index, returns the Gauss point "linear" index,...
Definition: gmGaussIndex.h:213
const GmElementMesh * mesh() const
Returns the associated mesh.
Definition: gmGaussIndex.h:287
QVarLengthArray< int, 2 > _cellOffset
Definition: gmGaussIndex.h:177
Base interface for FEM (finite element) meshes.
Definition: gmElementMesh.h:40
int _rule
The indexed rule set.
Definition: gmGaussIndex.h:335
int cellIp(int gpIndex, int *ip) const
Given a Gauss point "linear" index (a value from 0 to numPoints()-1), returns the mesh cell index + i...
Definition: gmGaussIndex.h:135
virtual ~GmGaussIndex()
Virtual destructor.
Definition: gmGaussIndex.h:45
GmFilteredGaussIndexBase()
Default empty index constructor.
Definition: gmGaussIndex.h:251
QVarLengthArray< int, 2 > _cellOffset
Definition: gmGaussIndex.h:266
A helper class that implements a GaussIndex like interface for the case where the index can filter ce...
Definition: gmGaussIndex.h:192
virtual int cellIp(int gpIndex, int *ip) const
Given a Gauss point "linear" index (a value from 0 to numPoints()-1), returns the mesh cell index + i...
Definition: gmGaussIndex.h:224
A class storing an index capable of determining the number of integration points belonging to a mesh,...
Definition: gmGaussIndex.h:41