24#ifndef _GEMA_SPATIAL_INDEX_H_
25#define _GEMA_SPATIAL_INDEX_H_
38#define GMP_MAX_INDEX_DIM 3
43 double ccoord[GMP_MAX_INDEX_DIM];
47 memset(ccoord, 0,
sizeof(
double) * GMP_MAX_INDEX_DIM);
51 bool eq = cellId == other.cellId && ip == other.ip;
53 assert(!eq || !memcmp(ccoord, other.ccoord,
sizeof(
double) * GMP_MAX_INDEX_DIM));
81 using PointValidator = std::function<bool(
const double*,
const double*)>;
82 static bool defaultPointValidator(
const double*,
const double*) {
return true; }
102 virtual int ndim()
const = 0;
126 virtual bool getClosestNode(
const GmVector& crd,
double& sqrDist,
int& outNodeId,
const PointValidator& pv = defaultPointValidator)
const = 0;
Base interface for mesh cells.
Definition gmCell.h:88
Class representing a category with multiple logging levels.
Definition gmLog.h:58
Base interface class for Mesh type plugins.
Definition gmMesh.h:48
Base interface class for all object plugins.
Definition gmPluginObject.h:37
virtual void printParameters(const GmLogCategory &logger)=0
Asks the object to print all of its parameters using the provided logger.
Definition gmPluginObject.cpp:62
Auxiliar class used to store the complete set of simulation data.
Definition gmSimulationData.h:55
Base interface class for Spatial Index type plugins.
Definition gmSpatialIndex.h:66
virtual void getClosestGaussPoints(const GmVector &crd, double r, QVector< GmpMmGaussData > &gpList, bool ordered, const PointValidator &pv=defaultPointValidator) const =0
Returns the ids of the gauss points whose distance to crd are less than radius, unordered.
virtual int ruleSet() const =0
For the nearestGauss capability, returns the rule set of the indexed Gauss points....
virtual bool hasCapability(QString capabilityName) const =0
This function should return true or false to indicate whether the spatial index supports the requeste...
virtual void getClosestGaussPoints(const GmVector &crd, int n, QVector< GmpRefDist< GmpMmGaussData > > &gpList, bool ordered, const PointValidator &pv=defaultPointValidator) const =0
Returns the ids of the n closest gauss points, together with their squared distances,...
virtual bool getClosestGaussPoint(const GmVector &crd, double &sqrDist, GmpMmGaussData &outRef, const PointValidator &pv=defaultPointValidator) const =0
Returns the ids of the closest gauss point, together with its squared distance. MUST be implemented i...
virtual bool activeOnly() const =0
For the nearestGauss and containingCell capabilities, does this index considers only active cells or ...
virtual void getClosestNodes(const GmVector &crd, double r, QVector< int > &nodeList, bool ordered, const PointValidator &pv=defaultPointValidator) const =0
Returns the ids of the nodes whose distances to crd are less than radius, unordered.
virtual void getClosestNodes(const GmVector &crd, int n, QVector< int > &nodeList, bool ordered, const PointValidator &pv=defaultPointValidator) const =0
Returns the ids of the n closest nodes, unordered.
virtual GmMesh * mesh() const =0
Returns the mesh that this index is tied to.
virtual const GmValueAccessor * coordAccessor() const =0
Returns the coordinate accessor stored by the spatial index. Using this accessor ensures that queries...
virtual void getClosestGaussPoints(const GmVector &crd, double r, QVector< GmpRefDist< GmpMmGaussData > > &gpList, bool ordered, const PointValidator &pv=defaultPointValidator) const =0
Returns the ids of the gauss points whose distance to crd are less than radius, together with their s...
virtual int numReferences() const =0
Returns the number of nodes, cells or gauss points stored at the index.
virtual void getClosestGaussPoints(const GmVector &crd, int n, QVector< GmpMmGaussData > &gpList, bool ordered, const PointValidator &pv=defaultPointValidator) const =0
Returns the ids of the n closest gauss points, unordered.
virtual const char * pluginCategory() const
Returns the plugin category.
Definition gmSpatialIndex.h:85
virtual GmCell * getContainingCell(const GmVector &crd) const =0
Returns a pointer to the cell in which the given point falls in. MUST be implemented if the 'containi...
virtual bool getClosestNode(const GmVector &crd, double &sqrDist, int &outNodeId, const PointValidator &pv=defaultPointValidator) const =0
Returns the id of the closest node to the given coordinate, also filling sqrDist with the square of t...
virtual void getClosestNodes(const GmVector &crd, int n, QVector< GmpRefDist< int > > &nodeList, bool ordered, const PointValidator &pv=defaultPointValidator) const =0
Returns the ids of the n closest nodes, together with their squared distances, in distance order.
virtual void getClosestNodes(const GmVector &crd, double r, QVector< GmpRefDist< int > > &nodeList, bool ordered, const PointValidator &pv=defaultPointValidator) const =0
Returns the ids of the nodes whose distances to crd are less than radius, together with their squared...
virtual bool isOutsideOfDomain(const GmVector &crd) const =0
Returns true if the given point is outside of the spatial index domain.
Interface class for accessing and setting values from an "indexable" collection of values.
Definition gmValueAccessor.h:60
#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
Declaration of macros for standard plugin categories.
#define GM_PLUGIN_SPATIALINDEX
Plugin implements spatial indices.
Definition gmPluginCategory.h:32
Declaration of the GmPluginObject base class.
Declaration of the GmVector class.
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition gmVector.h:34
Definition gmSpatialIndex.h:40
Definition gmSpatialIndex.h:59