MmProcess
The GeMA Mesh Mapping Process Plugin
Loading...
Searching...
No Matches
gmpMmBucketIndex.h
Go to the documentation of this file.
1/************************************************************************
2**
3** Copyright (C) 2015 by Erwan Yann Renaut
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_PLUGIN_MM_BUCKET_INDEX_H_
25#define _GEMA_PLUGIN_MM_BUCKET_INDEX_H_
26
27#include <gmLog.h>
28#include <gmSpatialIndex.h>
30
31#include "gmpMmProcessConfig.h"
32
33#include <QVector>
34#include <cassert>
35#include <functional>
36#include "unordered_map.hpp"
37
38class GmMesh;
39class GmCellMesh;
40class GmElementMesh;
41class GmCell;
42class GmCellGroupSet;
43class GmNodeSet;
44class GmValueAccessor;
45
46//We will used this set instead of QSet to have a deterministic behavior
47//without messing qt's global seed
48using ISet = ska::unordered_set<int>;
49
52template<class T>
53class GMP_MM_PROCESS_API_EXPORT GmpMmBIReference
54{
55public:
56 GmpMmBIReference() { _value = T(); }
57 GmpMmBIReference(const T& value) { _value = value; }
58// GmpMmBIReference(int val1, int val2) { _values << val1 << val2; }
59
60 const T& value() const { return _value; }
61// int value(int i) const { assert(i >= 0 && i < _values.size()); return _values.at(i); }
62
63 const GmpMmBIReference& operator=(const GmpMmBIReference& other) { _value = other.value(); return *this; }
64 bool operator==(const GmpMmBIReference& other) const { return _value == other.value(); }
65
66private:
67 T _value;
68};
69
70
73template<class T>
74class GMP_MM_PROCESS_API_EXPORT GmpMmBIBucket
75{
76public:
77 GmpMmBIBucket() {}
78 GmpMmBIBucket(int id, int gridId, int size);
79
80 int id() const { return _id; }
81 int size() const { return _size; }
82 QVector< GmpMmBIReference<T> > getReferenceList() const { return _referenceList.mid(0, _nextReferenceId); }
83 int getNumberOfStoredReferences() const { return _nextReferenceId; }
84 const GmpMmBIReference<T>& getReference(int index) const { assert(index >= 0 && index < _nextReferenceId); return _referenceList.at(index); }
85
86 bool isEmpty() const { return _nextReferenceId == 0; }
87 bool isFull() const { return _nextReferenceId == _size; }
88 bool isShared() const { return _gridIdList.size() > 1; }
89
90 void empty();
91 void detachToAllGridCells() { _gridIdList.clear(); }
92 bool detachToCellGrid(int gridCellId) { return _gridIdList.removeOne(gridCellId); }
93 void attachToCellGrid(int gridCellId) { _gridIdList.append(gridCellId); }
94 bool addReference(const GmpMmBIReference<T>& ref, bool expandIfFull = false);
95
96private:
97 int _id;
98 int _size;
99 QVector< GmpMmBIReference<T> > _referenceList;
100 int _nextReferenceId;
101 QVector<int> _gridIdList;
102};
103
104
109class GMP_MM_PROCESS_API_EXPORT GmpMmBucketIndex : public GmSpatialIndex
110{
111public:
113 {
117 //-------- NO INSERTION BELOW THIS LINE ----------
119 };
120
121 GmpMmBucketIndex(GmSimulationData* simulation, QString id, QString description, GSBIType type, const GmLogCategory& logger);
122 GmpMmBucketIndex(GmSimulationData* simulation, GmMesh* mesh, GSBIType type, const GmLogCategory& logger);
123
124 virtual ~GmpMmBucketIndex();
125
126 virtual GmMesh* mesh() const { return _mesh; }
127 virtual const GmValueAccessor* coordAccessor() const { return _crdAcc; }
128 virtual int ndim() const { return _nDim; }
129 GSBIType type() const { return _type; }
130
131
133 virtual int numReferences() const = 0;
134
135#ifdef ENABLE_TESTS
136 virtual bool testUniqueness() const = 0;
137 virtual bool testReciprocity() const = 0;
138#endif
139
140 static QString bucketTypeToStr(GSBIType type);
141 static int strToBucketType(QString str);
142
143protected:
148 int _nDim;
149 GSBIType _type;
150};
151
152
155template<class T>
156class GMP_MM_PROCESS_API_EXPORT GmpMmBucketIndexBase : public GmpMmBucketIndex
157{
158public:
159
160 GmpMmBucketIndexBase(GmSimulationData* simulation, QString id, QString description,
161 GSBIType type, const GmLogCategory& logger);
162
163 GmpMmBucketIndexBase(GmSimulationData* simulation, GmMesh* mesh, GSBIType type,
164 const GmLogCategory& logger, const QVariantMap& options = QVariantMap());
165
166 virtual const char* pluginName() const { return "MmProcess"; }
167
168 void init(const QVariantMap& options);
169 virtual bool loadPrivateData(LuaTable& table);
170
171 const QVector< GmpMmBIBucket<T> >& bucketList() const { return _bucketList; }
172
173 virtual bool activeOnly() const { return _activeOnly; }
174 virtual int ruleSet() const { return _ruleSet; }
175
176 virtual bool isOutsideOfDomain(const GmVector& crd) const;
177 virtual const GmpMmBIBucket<T>& getBucket(const GmVector& crd, bool& ok) const;
178
179 bool getClosestReference(const GmVector& crd, GmpRefDist<T>& closestRef, const PointValidator& pv = defaultPointValidator) const;
180 void getClosestReferences(const GmVector& crd, int n, QVector<GmpRefDist<T> >& refList, bool sort, const PointValidator& pv = defaultPointValidator) const;
181 void getClosestReferences(const GmVector& crd, double radius, QVector<GmpRefDist<T> >& refList, bool sort, const PointValidator& pv = defaultPointValidator) const;
182
183 void printInfo();
184 virtual void printParameters(const GmLogCategory& logger);
185
186#ifdef ENABLE_TESTS
187 virtual bool testUniqueness() const;
188#endif
189
190 virtual int numReferences() const { return _numRefs; }
191
192protected:
193 bool meshHasChanged() const { return false; } // TODO when the GmMesh will have a modification control process
194
195 void insertValue(const T& val, int gridId);
196 bool getGridCrd(const GmVector& crd, int gridCrd[GMP_MAX_INDEX_DIM]) const;
197 int getGridId(const GmVector& crd) const;
198 int getBucketId(int gridId) const;
199 void getBoxBucketIds(const int minGrid[GMP_MAX_INDEX_DIM], const int maxGrid[GMP_MAX_INDEX_DIM], ISet& bucketIds) const;
200 void getBoxBucketIds1D(int x0, int x1, ISet& buecketIds) const;
201 void getBoxBucketIds2D(int x0, int x1, int y0, int y1, ISet& bucketIds) const;
202 void getBoxBucketIds3D(int x0, int x1, int y0, int y1, int z0, int z1, ISet& bucketIds) const;
203 void computeStep();
204
205 void processRadiusLayerBucketIds(const GmVector& crd, double radius, std::function<void(int[])>& proc,
206 int curMin[GMP_MAX_INDEX_DIM], int curMax[GMP_MAX_INDEX_DIM]) const;
207
208 void processLayerBuckets1D(const int curMin[GMP_MAX_INDEX_DIM], const int curMax[GMP_MAX_INDEX_DIM],
209 const int newMin[GMP_MAX_INDEX_DIM], const int newMax[GMP_MAX_INDEX_DIM], std::function<void(int[])>& proc) const;
210 void processLayerBuckets2D(const int curMin[GMP_MAX_INDEX_DIM], const int curMax[GMP_MAX_INDEX_DIM],
211 const int newMin[GMP_MAX_INDEX_DIM], const int newMax[GMP_MAX_INDEX_DIM], std::function<void(int[])>& proc) const;
212 void processLayerBuckets3D(const int curMin[GMP_MAX_INDEX_DIM], const int curMax[GMP_MAX_INDEX_DIM],
213 const int newMin[GMP_MAX_INDEX_DIM], const int newMax[GMP_MAX_INDEX_DIM], std::function<void(int[])>& proc) const;
214
215 void getLayerBucketIds(const int gridCrd[GMP_MAX_INDEX_DIM], int layer, ISet& bucketIds,
216 int min[GMP_MAX_INDEX_DIM], int max[GMP_MAX_INDEX_DIM],
217 const int minBound[GMP_MAX_INDEX_DIM], const int maxBound[GMP_MAX_INDEX_DIM]) const;
218
219 bool _activeOnly;
220 bool _info;
221 bool _maxRefineReached;
222 int _ruleSet;
223
224 double _step[GMP_MAX_INDEX_DIM];
225 double _maxStep;
226
227 QVector< GmpMmBIBucket<T> > _bucketList;
228 QVector<int> _gridIdList;
229
230private:
231 void computeInitGridSize(const GmVector& bboxSize, int* initialSize, int* finalSize);
232
233 virtual void insertValues() = 0;
234
235 int computeGridSize(int dim) const;
236 int getGridSize(int dim) const;
237
238 double getGridLength(int dim) const;
239 double getCellLength(int dim) const;
240
241 bool getGridDimCrd(int dim, double dimCrd, int& gridDimCrd) const;
242
243 int getMaxCellLengthDim() const;
244 int getMinCellLengthDim() const;
245
247 virtual int getCrdFromRef(const GmpMmBIReference<T>& ref, GmCRVector& crd) const = 0;
248
249 void recBoxBucketIds(const int minGrid[GMP_MAX_INDEX_DIM], const int maxGrid[GMP_MAX_INDEX_DIM],
250 int gridCrd[GMP_MAX_INDEX_DIM], int dim, ISet& bucketIds) const;
251 void recLayerBucketIds(const int minGrid[GMP_MAX_INDEX_DIM], const int maxGrid[GMP_MAX_INDEX_DIM],
252 const int minBound[GMP_MAX_INDEX_DIM], const int maxBound[GMP_MAX_INDEX_DIM],
253 int gridCrd[GMP_MAX_INDEX_DIM], int dim, ISet& bucketIds) const;
254
255 int gridLinearizeCrd(const int gridCrd[GMP_MAX_INDEX_DIM]) const;
256 int gridLinearizeCrd(const int gridCrd[GMP_MAX_INDEX_DIM], const int gridSizes[GMP_MAX_INDEX_DIM]) const;
257 void gridExtractId(int gridId, const int gridSizes[GMP_MAX_INDEX_DIM], int crd[GMP_MAX_INDEX_DIM]) const;
258
259 int splitGrid();
260 bool redistributeBucket(int fullBucketId);
261 int createBucket(int gridId);
262 void splitSharedBucket(int fullBucketId, int gridId, const GmpMmBIReference<T>& ref);
263 bool refineGrid(int fullBucketId, const GmpMmBIReference<T>& ref);
264 bool recRefineGrid(int fullBucketId, const GmpMmBIReference<T>& ref);
265
266 int _bucketCapacity;
267 int _gridStartingSize;
268 int _gridIdMaxSize;
269 int _nRefineMax;
270 int _numRefs;
271
272 int _nSplit[GMP_MAX_INDEX_DIM];
273 int _gridSize[GMP_MAX_INDEX_DIM];
274 double _min[GMP_MAX_INDEX_DIM];
275 double _max[GMP_MAX_INDEX_DIM];
276};
277
280class GMP_MM_PROCESS_API_EXPORT GmpMmNodeBucketIndex : public GmpMmBucketIndexBase<int>
281{
282public:
283 GmpMmNodeBucketIndex(GmSimulationData* simulation, QString id, QString description,
284 const GmLogCategory& logger);
285
286 GmpMmNodeBucketIndex(GmSimulationData* simulation, GmMesh* mesh, const GmLogCategory& logger,
287 const QVariantMap& options = QVariantMap());
288
289 virtual ~GmpMmNodeBucketIndex() {}
290
291 virtual const char* pluginType() const { return "node"; }
292 virtual bool hasCapability(QString capabilityName) const { return capabilityName == "nearestNode"; }
293
294 virtual bool getClosestNode(const GmVector& crd, double& sqrDist, int& outNodeId, const PointValidator& pv = defaultPointValidator) const;
295 virtual void getClosestNodes(const GmVector& crd, int n, QVector<int>& nodeList, bool ordered, const PointValidator& pv = defaultPointValidator) const;
296 virtual void getClosestNodes(const GmVector& crd, int n, QVector<GmpRefDist<int>>& nodeList, bool ordered, const PointValidator& pv = defaultPointValidator) const;
297 virtual void getClosestNodes(const GmVector& crd, double r, QVector<int>& nodeList, bool ordered, const PointValidator& pv = defaultPointValidator) const;
298 virtual void getClosestNodes(const GmVector& crd, double r, QVector<GmpRefDist<int>>& nodeList, bool ordered, const PointValidator& pv = defaultPointValidator) const;
299
300
301 // See comments on the base class
302 virtual GmCell* getContainingCell(const GmVector& crd) const
303 {
304 Q_UNUSED(crd);
305 gmWarnMsg(logger(), QObject::tr("getContainingCell() method is not supported for this bucket type."));
306 return NULL;
307 }
308 // See comments on the base class
309 virtual bool getClosestGaussPoint(const GmVector& crd, double& sqrDist, GmpMmGaussData& outRef, const PointValidator& pv = defaultPointValidator) const
310 {
311 Q_UNUSED(crd); Q_UNUSED(sqrDist); Q_UNUSED(outRef); Q_UNUSED(pv);
312 gmWarnMsg(logger(), QObject::tr("getClosestGaussPoints() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
313 return false;
314 }
315 // See comments on the base class
316 virtual void getClosestGaussPoints(const GmVector& crd, int n, QVector<GmpMmGaussData>& gpList, bool ordered, const PointValidator& pv = defaultPointValidator) const
317 {
318 Q_UNUSED(crd); Q_UNUSED(n); Q_UNUSED(gpList); Q_UNUSED(ordered); Q_UNUSED(pv);
319 gmWarnMsg(logger(), QObject::tr("getClosestGaussPoints() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
320 }
321 // See comments on the base class
322 virtual void getClosestGaussPoints(const GmVector& crd, int n, QVector<GmpRefDist<GmpMmGaussData>>& gpList, bool ordered, const PointValidator& pv = defaultPointValidator) const
323 {
324 Q_UNUSED(crd); Q_UNUSED(n); Q_UNUSED(gpList); Q_UNUSED(ordered); Q_UNUSED(pv);
325 gmWarnMsg(logger(), QObject::tr("getClosestGaussPoints() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
326 }
327 // See comments on the base class
328 virtual void getClosestGaussPoints(const GmVector& crd, double r, QVector<GmpMmGaussData>& gpList, bool ordered, const PointValidator& pv = defaultPointValidator) const
329 {
330 Q_UNUSED(crd); Q_UNUSED(r); Q_UNUSED(gpList); Q_UNUSED(ordered); Q_UNUSED(pv);
331 gmWarnMsg(logger(), QObject::tr("getClosestGaussPoints() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
332 }
333 virtual void getClosestGaussPoints(const GmVector& crd, double r, QVector<GmpRefDist<GmpMmGaussData>>& gpList, bool ordered, const PointValidator& pv = defaultPointValidator) const
334 {
335 Q_UNUSED(crd); Q_UNUSED(r); Q_UNUSED(gpList); Q_UNUSED(ordered); Q_UNUSED(pv);
336 gmWarnMsg(logger(), QObject::tr("getClosestGaussPoints() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
337 }
338
339#ifdef ENABLE_TESTS
340 virtual bool testReciprocity() const;
341 bool testClosestNode() const;
342#endif
343
344private:
345 virtual int getCrdFromRef(const GmpMmBIReference<int>& ref, GmCRVector& crd) const;
346 virtual void insertValues();
347};
348
351class GMP_MM_PROCESS_API_EXPORT GmpMmCellBucketIndex : public GmpMmBucketIndexBase< QPair<int, int> >
352{
353public:
354 GmpMmCellBucketIndex(GmSimulationData* simulation, QString id, QString description,
355 const GmLogCategory& logger);
356
357 GmpMmCellBucketIndex(GmSimulationData* simulation, GmCellMesh* mesh, const GmLogCategory& logger,
358 const QVariantMap& options = QVariantMap());
359
360 virtual ~GmpMmCellBucketIndex() {}
361
362 virtual const char* pluginType() const { return "cell"; }
363 virtual bool hasCapability(QString capabilityName) const { return capabilityName == "containingCell"; }
364
365 virtual bool getClosestNode(const GmVector& crd, double& sqrDist, int& outNodeId, const PointValidator& pv = defaultPointValidator) const;
366
367 // See comments on the base class
368 virtual void getClosestNodes(const GmVector& crd, int n, QVector<int>& nodeList, bool ordered, const PointValidator& pv = defaultPointValidator) const
369 {
370 Q_UNUSED(crd); Q_UNUSED(n); Q_UNUSED(nodeList); Q_UNUSED(ordered); Q_UNUSED(pv);
371 gmWarnMsg(logger(), QObject::tr("getClosestNodes() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
372 }
373 // See comments on the base class
374 virtual void getClosestNodes(const GmVector& crd, int n, QVector<GmpRefDist<int>>& nodeList, bool ordered, const PointValidator& pv = defaultPointValidator) const
375 {
376 Q_UNUSED(crd); Q_UNUSED(n); Q_UNUSED(nodeList); Q_UNUSED(ordered); Q_UNUSED(pv);
377 gmWarnMsg(logger(), QObject::tr("getClosestNodes() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
378 }
379 // See comments on the base class
380 virtual void getClosestNodes(const GmVector& crd, double r, QVector<int>& nodeList, bool ordered, const PointValidator& pv = defaultPointValidator) const
381 {
382 Q_UNUSED(crd); Q_UNUSED(r); Q_UNUSED(nodeList); Q_UNUSED(ordered); Q_UNUSED(pv);
383 gmWarnMsg(logger(), QObject::tr("getClosestNodes() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
384 }
385 virtual void getClosestNodes(const GmVector& crd, double r, QVector<GmpRefDist<int>>& nodeList, bool ordered, const PointValidator& pv = defaultPointValidator) const
386 {
387 Q_UNUSED(crd); Q_UNUSED(r); Q_UNUSED(nodeList); Q_UNUSED(ordered); Q_UNUSED(pv);
388 gmWarnMsg(logger(), QObject::tr("getClosestNodes() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
389 }
390
391 virtual GmCell* getContainingCell(const GmVector& crd) const;
392
393 // See comments on the base class
394 virtual bool getClosestGaussPoint(const GmVector& crd, double& sqrDist, GmpMmGaussData& outRef, const PointValidator& pv = defaultPointValidator) const
395 {
396 Q_UNUSED(crd); Q_UNUSED(sqrDist); Q_UNUSED(outRef); Q_UNUSED(pv);
397 gmWarnMsg(logger(), QObject::tr("getClosestGaussPoints() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
398 return false;
399 }
400 // See comments on the base class
401 virtual void getClosestGaussPoints(const GmVector& crd, int n, QVector<GmpMmGaussData>& gpList, bool ordered, const PointValidator& pv = defaultPointValidator) const
402 {
403 Q_UNUSED(crd); Q_UNUSED(n); Q_UNUSED(gpList); Q_UNUSED(ordered); Q_UNUSED(pv);
404 gmWarnMsg(logger(), QObject::tr("getClosestGaussPoints() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
405 }
406 // See comments on the base class
407 virtual void getClosestGaussPoints(const GmVector& crd, int n, QVector<GmpRefDist<GmpMmGaussData>>& gpList, bool ordered, const PointValidator& pv = defaultPointValidator) const
408 {
409 Q_UNUSED(crd); Q_UNUSED(n); Q_UNUSED(gpList); Q_UNUSED(ordered); Q_UNUSED(pv);
410 gmWarnMsg(logger(), QObject::tr("getClosestGaussPoints() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
411 }
412 // See comments on the base class
413 virtual void getClosestGaussPoints(const GmVector& crd, double r, QVector<GmpMmGaussData>& gpList, bool ordered, const PointValidator& pv = defaultPointValidator) const
414 {
415 Q_UNUSED(crd); Q_UNUSED(r); Q_UNUSED(gpList); Q_UNUSED(ordered); Q_UNUSED(pv);
416 gmWarnMsg(logger(), QObject::tr("getClosestGaussPoints() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
417 }
418 virtual void getClosestGaussPoints(const GmVector& crd, double r, QVector<GmpRefDist<GmpMmGaussData>>& gpList, bool ordered, const PointValidator& pv = defaultPointValidator) const
419 {
420 Q_UNUSED(crd); Q_UNUSED(r); Q_UNUSED(gpList); Q_UNUSED(ordered); Q_UNUSED(pv);
421 gmWarnMsg(logger(), QObject::tr("getClosestGaussPoints() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
422 }
423
424#ifdef ENABLE_TESTS
425 virtual bool testReciprocity() const;
426 bool testContainingCell() const;
427#endif
428
429private:
430 int getNodeId(const QPair<int, int>& ref) const;
431
432 virtual int getCrdFromRef(const GmpMmBIReference<QPair<int, int> >& ref, GmCRVector& crd) const;
433 virtual void insertValues();
434
435 void setContainsFunction();
436
437 std::function<bool(const GmCell* c, const GmVector&)> _containsFunc;
438
439 GmCellMesh* _cellMesh;
440 GmElementMesh* _elementMesh;
441};
442
447class GMP_MM_PROCESS_API_EXPORT GmpMmGaussBucketIndex : public GmpMmBucketIndexBase<GmpMmGaussData>
448{
449public:
450 GmpMmGaussBucketIndex(GmSimulationData* simulation, QString id, QString description,
451 const GmLogCategory& logger);
452
453 GmpMmGaussBucketIndex(GmSimulationData* simulation, GmElementMesh* mesh, const GmLogCategory& logger,
454 const QVariantMap& options = QVariantMap());
455
456 virtual ~GmpMmGaussBucketIndex() {}
457
458 virtual const char* pluginType() const { return "gauss"; }
459 virtual bool hasCapability(QString capabilityName) const { return capabilityName == "nearestGauss"; }
460
461 // See comments on the base class
462 virtual bool getClosestNode(const GmVector& crd, double& sqrDist, int& outNodeId, const PointValidator& pv = defaultPointValidator) const
463 {
464 Q_UNUSED(crd); Q_UNUSED(sqrDist); Q_UNUSED(outNodeId); Q_UNUSED(pv);
465 gmWarnMsg(logger(), QObject::tr("getClosestNode() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
466 return false;
467 }
468 // See comments on the base class
469 virtual void getClosestNodes(const GmVector& crd, int n, QVector<int>& nodeList, bool ordered, const PointValidator& pv = defaultPointValidator) const
470 {
471 Q_UNUSED(crd); Q_UNUSED(n); Q_UNUSED(nodeList); Q_UNUSED(ordered); Q_UNUSED(pv);
472 gmWarnMsg(logger(), QObject::tr("getClosestNodes() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
473 }
474 // See comments on the base class
475 virtual void getClosestNodes(const GmVector& crd, int n, QVector<GmpRefDist<int>>& nodeList, bool ordered, const PointValidator& pv = defaultPointValidator) const
476 {
477 Q_UNUSED(crd); Q_UNUSED(n); Q_UNUSED(nodeList); Q_UNUSED(ordered); Q_UNUSED(pv);
478 gmWarnMsg(logger(), QObject::tr("getClosestNodes() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
479 }
480 // See comments on the base class
481 virtual void getClosestNodes(const GmVector& crd, double r, QVector<int>& nodeList, bool ordered, const PointValidator& pv = defaultPointValidator) const
482 {
483 Q_UNUSED(crd); Q_UNUSED(r); Q_UNUSED(nodeList); Q_UNUSED(ordered); Q_UNUSED(pv);
484 gmWarnMsg(logger(), QObject::tr("getClosestNodes() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
485 }
486 // See comments on the base class
487 virtual void getClosestNodes(const GmVector& crd, double r, QVector<GmpRefDist<int>>& nodeList, bool ordered, const PointValidator& pv = defaultPointValidator) const
488 {
489 Q_UNUSED(crd); Q_UNUSED(r); Q_UNUSED(nodeList); Q_UNUSED(ordered); Q_UNUSED(pv);
490 gmWarnMsg(logger(), QObject::tr("getClosestNodes() method is not supported by '%1' bucket type.").arg(bucketTypeToStr(_type)));
491 }
492 // See comments on the base class
493 virtual GmCell* getContainingCell(const GmVector& crd) const
494 {
495 Q_UNUSED(crd);
496 gmWarnMsg(logger(), QObject::tr("getContainingCell() method is not supported for this bucket type."));
497 return NULL;
498 }
499
500 virtual bool getClosestGaussPoint(const GmVector& crd, double& sqrDist, GmpMmGaussData& outRef, const PointValidator& pv = defaultPointValidator) const;
501 virtual void getClosestGaussPoints(const GmVector& crd, int n, QVector<GmpMmGaussData>& gpList, bool ordered, const PointValidator& pv = defaultPointValidator) const;
502 virtual void getClosestGaussPoints(const GmVector& crd, int n, QVector<GmpRefDist<GmpMmGaussData>>& gpList, bool ordered, const PointValidator& pv = defaultPointValidator) const;
503 virtual void getClosestGaussPoints(const GmVector& crd, double r, QVector<GmpMmGaussData>& gpList, bool ordered, const PointValidator& pv = defaultPointValidator) const;
504 virtual void getClosestGaussPoints(const GmVector& crd, double r, QVector<GmpRefDist<GmpMmGaussData> >& gpList, bool ordered, const PointValidator& pv = defaultPointValidator) const;
505
506#ifdef ENABLE_TESTS
507 virtual bool testReciprocity() const;
508#endif
509
510private:
511 virtual int getCrdFromRef(const GmpMmBIReference<GmpMmGaussData>& ref, GmCRVector& crd) const;
512 virtual void insertValues();
513
514 GmElementMesh* _elemMesh;
515 };
516
517#endif // _GEMA_PLUGIN_MM_BUCKET_INDEX_H_
Class GmpMmBIBucket.
Definition gmpMmBucketIndex.h:75
Class GmpMmBIReference.
Definition gmpMmBucketIndex.h:54
Class GmpMmBucketIndexBase.
Definition gmpMmBucketIndex.h:157
virtual int getCrdFromRef(const GmpMmBIReference< T > &ref, GmCRVector &crd) const =0
Get the coordinates of the point associated to the given reference.
virtual int numReferences() const
Number of stored references.
Definition gmpMmBucketIndex.h:190
A base class used by the process to treat all the GmpMmBucketIndexBase<T> derivatives in a generic co...
Definition gmpMmBucketIndex.h:110
const GmNodeSet * _nodeGroup
The node group filter or NULL if there is none.
Definition gmpMmBucketIndex.h:146
GmMesh * _mesh
The mesh.
Definition gmpMmBucketIndex.h:144
GSBIType
Definition gmpMmBucketIndex.h:113
@ GSBIT_NUM_BUCKETYPES
The number of available bucket index types.
Definition gmpMmBucketIndex.h:118
@ GSBIT_NODE
Bucket index stores global ids of the mesh nodes.
Definition gmpMmBucketIndex.h:114
@ GSBIT_CELL
Bucket index stores local ids of the mesh nodes in the cell.
Definition gmpMmBucketIndex.h:115
@ GSBIT_GAUSS
Bucket index stores local ids of the mesh gauss points in the element.
Definition gmpMmBucketIndex.h:116
const GmValueAccessor * _crdAcc
The mesh accessor used for retrieving point coordinates.
Definition gmpMmBucketIndex.h:147
virtual int numReferences() const =0
Number of stored references.
const GmCellGroupSet * _cellGroup
The cell group filter or NULL if there is none.
Definition gmpMmBucketIndex.h:145
Class GmpMmCellBucketIndex.
Definition gmpMmBucketIndex.h:352
Class GmpMmGaussBucketIndex.
Definition gmpMmBucketIndex.h:448
Class GmpMmNodeBucketIndex.
Definition gmpMmBucketIndex.h:281
arma::vec GmVector
Declaration of useful configuration definitions for the plugin library.
QString tr(const char *sourceText, const char *disambiguation, int n)
QVector< T > mid(int pos, int length) const const