24 #ifndef _GEMA_PLUGIN_FEM_LOCKER_H_ 25 #define _GEMA_PLUGIN_FEM_LOCKER_H_ 50 assert(npart && numdof);
53 if(npart + 1 > _lockList.size())
55 _lockList.resize(npart + 1);
56 for(
int i = _npart; i < npart + 1; i++)
60 _psize = (numdof+npart-1) / npart;
67 void lockDof(
int dofIndex) { _lockList[dofToLockIndex(dofIndex)]->lock(); }
70 void unlockDof(
int dofIndex) { _lockList[dofToLockIndex(dofIndex)]->unlock(); }
76 int dofToLockIndex(
int dofIndex)
78 assert(_psize && _npart);
79 assert(_npart <= _lockList.size());
80 int r = (dofIndex < 0) ? 0 : (dofIndex / _psize) + 1;
81 assert(r >= 0 && r < _npart);
int _npart
The number of partitions (including the extra partition for negative numbers)
Definition: gmpFemLocker.h:86
int numPartitions() const
Returns the number of configured partitions.
Definition: gmpFemLocker.h:64
void lockDof(int dofIndex)
Aquires the lock protecting the given dof index.
Definition: gmpFemLocker.h:67
A lock manager to be used by GmpFemAssemblerMatrixAdder and GmpFemAssemblerVectorAdder objects when w...
Definition: gmpFemLocker.h:38
void setNumPartitions(int numdof, int npart)
Adjusts the number of locks according to the number of degrees of freedom and partitions.
Definition: gmpFemLocker.h:48
QVector< GmSpinLock * > _lockList
The set of available locks.
Definition: gmpFemLocker.h:87
static bool inMainThread()
int _psize
The number of dofs in each partition.
Definition: gmpFemLocker.h:85
GmpFemLocker()
Constructor.
Definition: gmpFemLocker.h:42
Declaration of usefull configuration definitions for the plugin library.
~GmpFemLocker()
Destructor.
Definition: gmpFemLocker.h:45
void unlockDof(int dofIndex)
Releases the lock protecting the given dof index.
Definition: gmpFemLocker.h:70