GemaMesh
The GeMA Mesh Plugin
uibhmQuery.h
Go to the documentation of this file.
1 /************************************************************************
2 **
3 ** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
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 _UIBHM_QUERY_H_
25 #define _UIBHM_QUERY_H_
26 
27 #include "uibhmTopology.h"
28 
29 #include <gmCellMeshTopology.h>
30 
35 template <class Geometry>
36 class GMP_GEMAMESH_API_EXPORT UibhmQuery : public GmCellMeshTopology
37 {
38 public:
39 
40  // An alias for the topology structure to simplify the call to static functions
42 
43  // 'Import' the half side type from the topology object
44  using HalfSide = typename Topology::HalfSide;
45 
47  UibhmQuery(UibhmTopology<Geometry>* topology) : _t(topology)
48  {
49  assert(topology);
50  }
51 
52  virtual GmCell* adjacentCell(const GmCell* cell, int sideIndex, int* adjSideIndex = NULL) const;
53 
54  virtual bool isBorderNode(int nodeIndex) const;
55 
56  // See comments on the base class
57  virtual void printParameters(const GmLogCategory& logger, GmLogLevel level) const { _t->printParameters(logger, level); }
58 
59  // See comments on the base class
60  virtual void print(const GmLogCategory& logger, GmLogLevel level) const { _t->print(logger, level); }
61 
62  // See comments on the base class
63  virtual size_t printMemoryStatistics(const GmLogCategory& logger, GmLogLevel level) const { return _t->printMemoryStatistics(logger, level); }
64 
65  // See comments on the base class
66  virtual size_t usedMemory() const { return _t->usedMemory(); }
67 
68 protected:
70 };
71 
73 template <class Geometry>
74 class GMP_GEMAMESH_API_EXPORT UibhmSurfaceQuery : public UibhmQuery<Geometry>
75 {
76 public:
78  UibhmSurfaceQuery(UibhmTopology<Geometry>* topology) : UibhmQuery<Geometry>(topology) {}
79 
80  virtual void nodeAdjacentNodes(int nodeIndex, QueryOptions options, QVector<int>& list) const;
81  virtual void nodeAdjacentCells(int nodeIndex, QVector<GmCell*>& list) const;
82 
83  // See comments on the base class
84  virtual void nodeAdjacentCells(int nodeIndex, QVector<const GmCell*>& list) const
85  {
86  // to avoid copying, lets just call the non-const version of this function
87  return nodeAdjacentCells(nodeIndex, (QVector<GmCell*>&)list);
88  }
89 
90  virtual void edgeAdjacentCells(const GmCell* cell, int edgeIndex, QVector<GmCell*>& list) const;
91 
92  // See comments on the base class
93  virtual void edgeAdjacentCells(const GmCell* cell, int edgeIndex, QVector<const GmCell*>& list) const
94  {
95  // to avoid copying, lets just call the non-const version of this function
96  return edgeAdjacentCells(cell, edgeIndex, (QVector<GmCell*>&)list);
97  }
98 
99 private:
100  template <class VertexF, class QuadF>
101  void heStar(int node, VertexF vf, QuadF qf, bool addBorder) const;
102 };
103 
105 template <class Geometry>
106 class GMP_GEMAMESH_API_EXPORT UibhmSolidQuery : public UibhmQuery<Geometry>
107 {
108 public:
110  UibhmSolidQuery(UibhmTopology<Geometry>* topology) : UibhmQuery<Geometry>(topology) {}
111 
112  virtual void nodeAdjacentNodes(int nodeIndex, QueryOptions options, QVector<int>& list) const;
113  virtual void nodeAdjacentCells(int nodeIndex, QVector<GmCell*>& list) const;
114 
115  // See comments on the base class
116  virtual void nodeAdjacentCells(int nodeIndex, QVector<const GmCell*>& list) const
117  {
118  // to avoid copying, lets just call the non-const version of this function
119  nodeAdjacentCells(nodeIndex, (QVector<GmCell*>&)list);
120  }
121 
122  virtual void edgeAdjacentCells(const GmCell* cell, int edgeIndex, QVector<GmCell*>& list) const;
123 
124  // See comments on the base class
125  virtual void edgeAdjacentCells(const GmCell* cell, int edgeIndex, QVector<const GmCell*>& list) const
126  {
127  // to avoid copying, lets just call the non-const version of this function
128  edgeAdjacentCells(cell, edgeIndex, (QVector<GmCell*>&)list);
129  }
130 
131  // See comments on the base class.
132  virtual void edgeAdjacentCells(size_t encodedEdge, QVector<GmCell*>& list) const;
133 
134  // See comments on the base class
135  virtual void edgeAdjacentCells(size_t encodedEdge, QVector<const GmCell*>& list) const
136  {
137  // to avoid copying, lets just call the non-const version of this function
138  edgeAdjacentCells(encodedEdge, (QVector<GmCell*>&)list);
139  }
140 
141 private:
142  template <class QueryF>
143  void traverseCells(int nodeIndex, int cellId, QueryF f) const;
144 
145  void edgeAdjacentCells(HalfSide hf, int v1, int v2, QVector<GmCell*>& list) const;
146 };
147 
148 #endif
virtual void printParameters(const GmLogCategory &logger, GmLogLevel level) const=0
Declaration of the UibhmTopology familiy of classes.
virtual size_t printMemoryStatistics(const GmLogCategory &logger, GmLogLevel level) const=0
virtual void nodeAdjacentCells(int nodeIndex, QVector< GmCell * > &list) const=0
virtual size_t usedMemory() const=0
UibhmQuery(UibhmTopology< Geometry > *topology)
Constructor.
Definition: uibhmQuery.h:47
The basic class for topological queries using the UibhmTopology structure. Implements the GmCellMeshT...
Definition: uibhmQuery.h:36
virtual GmCell * adjacentCell(const GmCell *cell, int sideIndex, int *adjSideIndex=NULL) const=0
The UibhmQuery especialization for solid meshes.
Definition: uibhmQuery.h:106
quint32 HalfSide
The integer type used to represent a half-side index.
Definition: uibhmTopology.h:143
virtual void edgeAdjacentCells(const GmCell *cell, int edgeIndex, QVector< GmCell * > &list) const=0
virtual bool isBorderNode(int nodeIndex) const=0
GmLogLevel
UibhmSurfaceQuery(UibhmTopology< Geometry > *topology)
Constructor.
Definition: uibhmQuery.h:78
UibhmSolidQuery(UibhmTopology< Geometry > *topology)
Constructor.
Definition: uibhmQuery.h:110
virtual void nodeAdjacentNodes(int nodeIndex, QueryOptions options, QVector< int > &list) const=0
Definition: uibhmTopology.h:138
virtual void print(const GmLogCategory &logger, GmLogLevel level) const=0
The UibhmQuery especialization for surface meshes.
Definition: uibhmQuery.h:74