meshQuery.h
Go to the documentation of this file.
1 // File: $Id$
2 // Author: John Wu <John.Wu at ACM.org>
3 // Lawrence Berkeley National Laboratory
4 // Copyright (c) 2000-2016 the Regents of the University of California
5 #ifndef IBIS_MESHQUERY_H
6 #define IBIS_MESHQUERY_H
7 #include "query.h"
11 
12 namespace ibis { // extend ibis name space
13  class meshQuery;
14 } // namespace
15 
19 class FASTBIT_CXX_DLLSPEC ibis::meshQuery : public ibis::query {
20  public:
21  virtual ~meshQuery();
23  meshQuery(const char* uid, const part* et, const char* pref=0);
25  meshQuery(const char* dir, const ibis::partList& tl) : query(dir, tl) {};
26 
27  int getHitsAsLines(std::vector<uint32_t>& lines) const {
28  return getHitsAsLines(lines, partition()->getMeshShape());}
29  int getHitsAsLines(std::vector<uint32_t>& lines,
30  const std::vector<uint32_t>& dim) const;
31  static int labelLines(uint32_t nd,
32  const std::vector<uint32_t>& lines,
33  std::vector<uint32_t>& labels);
34 
35  int getHitsAsBlocks(std::vector< std::vector<uint32_t> >& reg,
36  const bool merge=false) const;
37  int getHitsAsBlocks(std::vector< std::vector<uint32_t> >& reg,
38  const std::vector<uint32_t>& dim,
39  const bool merge=false) const;
40 
41  int getPointsOnBoundary(std::vector< std::vector<uint32_t> >& bdy,
42  const std::vector<uint32_t>& dim) const;
43  int getPointsOnBoundary(std::vector< std::vector<uint32_t> >& bdy) const;
44 
45  static int bitvectorToCoordinates(const ibis::bitvector& bv,
46  const std::vector<uint32_t>& dim,
47  std::vector<uint32_t>& coords);
48  static int labelBlocks
49  (const std::vector< std::vector<uint32_t> >& blocks,
50  std::vector<uint32_t>& labels);
51 
52  protected:
53  int linesIn1D(std::vector<uint32_t>& lines) const;
54  int linesIn2D(std::vector<uint32_t>& lines,
55  const std::vector<uint32_t>& dim) const;
56  int linesIn3D(std::vector<uint32_t>& lines,
57  const std::vector<uint32_t>& dim) const;
58  int linesIn4D(std::vector<uint32_t>& lines,
59  const std::vector<uint32_t>& dim) const;
60  int linesInND(std::vector<uint32_t>& lines,
61  const std::vector<uint32_t>& dim) const;
62 
63  static int labelLines1(const std::vector<uint32_t>& lines,
64  std::vector<uint32_t>& labels);
65  static int labelLines2(const std::vector<uint32_t>& lines,
66  std::vector<uint32_t>& labels);
67  static int labelLines3(const std::vector<uint32_t>& lines,
68  std::vector<uint32_t>& labels);
69  static int labelLines4(const std::vector<uint32_t>& lines,
70  std::vector<uint32_t>& labels);
71  static int labelLinesN(uint32_t nd,
72  const std::vector<uint32_t>& lines,
73  std::vector<uint32_t>& labels);
74 
75  int toBlocks1(const ibis::bitvector& bv,
76  std::vector< std::vector<uint32_t> >& reg) const;
77  int toBlocks2(const ibis::bitvector& bv,
78  const std::vector<uint32_t>& dim,
79  std::vector< std::vector<uint32_t> >& reg) const;
80  int toBlocks3(const ibis::bitvector& bv,
81  const std::vector<uint32_t>& dim,
82  std::vector< std::vector<uint32_t> >& reg) const;
83  int toBlocksN(const ibis::bitvector& bv,
84  const std::vector<uint32_t>& dim,
85  std::vector< std::vector<uint32_t> >& reg) const;
86  void block2d(uint32_t last, const std::vector<uint32_t>& dim,
87  std::vector<uint32_t>& block,
88  std::vector< std::vector<uint32_t> >& reg) const;
89  void block3d(uint32_t last, const uint32_t n2, const uint32_t n3,
90  const std::vector<uint32_t>& dim,
91  std::vector<uint32_t>& block,
92  std::vector< std::vector<uint32_t> >& reg) const;
93  void blocknd(uint32_t last,
94  const std::vector<uint32_t>& scl,
95  const std::vector<uint32_t>& dim,
96  std::vector<uint32_t>& block,
97  std::vector< std::vector<uint32_t> >& reg) const;
98  void merge2DBlocks(std::vector< std::vector<uint32_t> >& reg) const;
99  void merge3DBlocks(std::vector< std::vector<uint32_t> >& reg) const;
100  void mergeNDBlocks(std::vector< std::vector<uint32_t> >& reg) const;
101 
102  int findPointsOnBoundary(const ibis::bitvector& bv,
103  const std::vector<uint32_t>& dim,
104  std::vector< std::vector<uint32_t> >& bdy) const;
105  void boundary2d(const std::vector<uint32_t>& dim,
106  const std::vector< std::vector<uint32_t> >& rang,
107  std::vector< std::vector<uint32_t> >& bdy) const;
108  void boundary2d1(const std::vector<uint32_t>& dim,
109  const std::vector< std::vector<uint32_t> >& rang,
110  std::vector< std::vector<uint32_t> >& bdy) const;
111  void boundary3d(const std::vector<uint32_t>& dim,
112  const std::vector< std::vector<uint32_t> >& rang,
113  std::vector< std::vector<uint32_t> >& bdy) const;
114  void boundarynd(const std::vector<uint32_t>& dim,
115  const std::vector< std::vector<uint32_t> >& rang,
116  std::vector< std::vector<uint32_t> >& bdy) const;
117 
118  static uint32_t afind(ibis::array_t<uint32_t>& rep, uint32_t s);
119  static void aset(ibis::array_t<uint32_t>& rep,
120  uint32_t s, uint32_t r);
121  static uint32_t aflatten(ibis::array_t<uint32_t>& rep);
122  static int label1DBlocks
123  (const std::vector< std::vector<uint32_t> >& blocks,
124  std::vector<uint32_t>& labels);
125  static int label2DBlocks
126  (const std::vector< std::vector<uint32_t> >& blocks,
127  std::vector<uint32_t>& labels);
128  static int label3DBlocks
129  (const std::vector< std::vector<uint32_t> >& blocks,
130  std::vector<uint32_t>& labels);
131  static int label4DBlocks
132  (const std::vector< std::vector<uint32_t> >& blocks,
133  std::vector<uint32_t>& labels);
134 
135  private:
136  meshQuery();
137  meshQuery(const meshQuery&);
138  meshQuery& operator=(const meshQuery&);
139 }; // class ibis::meshQuery
140 #endif // IBIS_MESHQUERY_H
static int labelLines(uint32_t nd, const std::vector< uint32_t > &lines, std::vector< uint32_t > &labels)
Assign each connected component a unique label.
Definition: meshQuery.cpp:6970
void merge3DBlocks(std::vector< std::vector< uint32_t > > &reg) const
Merge 3D blocks.
Definition: meshQuery.cpp:1094
int getHitsAsBlocks(std::vector< std::vector< uint32_t > > &reg, const bool merge=false) const
Translate hit vector into bounding boxes.
Definition: meshQuery.cpp:209
int getPointsOnBoundary(std::vector< std::vector< uint32_t > > &bdy, const std::vector< uint32_t > &dim) const
Determine points with neighbors that are not hits.
Definition: meshQuery.cpp:1480
static int label3DBlocks(const std::vector< std::vector< uint32_t > > &blocks, std::vector< uint32_t > &labels)
Assign a unique labels to each connected set of blocks.
Definition: meshQuery.cpp:5556
int toBlocks3(const ibis::bitvector &bv, const std::vector< uint32_t > &dim, std::vector< std::vector< uint32_t > > &reg) const
Convert a bitvector to a list of 3-D blocks.
Definition: meshQuery.cpp:457
int linesInND(std::vector< uint32_t > &lines, const std::vector< uint32_t > &dim) const
Convert hits into line segments in a regular mesh of any dimension.
Definition: meshQuery.cpp:6825
int linesIn2D(std::vector< uint32_t > &lines, const std::vector< uint32_t > &dim) const
Convert the hits into line segments on a 2-D mesh.
Definition: meshQuery.cpp:6404
static int bitvectorToCoordinates(const ibis::bitvector &bv, const std::vector< uint32_t > &dim, std::vector< uint32_t > &coords)
Convert positions in a bit vector to mesh coordinates.
Definition: meshQuery.cpp:5143
static int label2DBlocks(const std::vector< std::vector< uint32_t > > &blocks, std::vector< uint32_t > &labels)
Assign labels to blocks on 2D regular mesh.
Definition: meshQuery.cpp:5431
The current implementation of FastBit is code named IBIS; most data structures and functions are in t...
Definition: bord.h:16
static void aset(ibis::array_t< uint32_t > &rep, uint32_t s, uint32_t r)
Reset all nodes from s to the root to directly point to node r.
Definition: meshQuery.cpp:5356
const part * partition() const
Return the pointer to the data partition used to process the query.
Definition: query.h:77
The header file defining the individual query objects.
int linesIn1D(std::vector< uint32_t > &lines) const
Convert the hits into line segements on a 1-D mesh.
Definition: meshQuery.cpp:6357
static uint32_t afind(ibis::array_t< uint32_t > &rep, uint32_t s)
The array-based find operation.
Definition: meshQuery.cpp:5325
void block2d(uint32_t last, const std::vector< uint32_t > &dim, std::vector< uint32_t > &block, std::vector< std::vector< uint32_t > > &reg) const
Deal with one (single) 2D block.
Definition: meshQuery.cpp:683
A data structure for representing user queries.
Definition: query.h:48
The class adds more functionality to ibis::query to handle data from regular meshes.
Definition: meshQuery.h:19
static int label4DBlocks(const std::vector< std::vector< uint32_t > > &blocks, std::vector< uint32_t > &labels)
Assign a unique labels to each connected set of blocks.
Definition: meshQuery.cpp:5811
int toBlocksN(const ibis::bitvector &bv, const std::vector< uint32_t > &dim, std::vector< std::vector< uint32_t > > &reg) const
Convert a bitvector to a list of n-D blocks.
Definition: meshQuery.cpp:557
void merge2DBlocks(std::vector< std::vector< uint32_t > > &reg) const
Merge 2D blocks.
Definition: meshQuery.cpp:1016
The class ibis::part represents a partition of a relational table.
Definition: part.h:27
void mergeNDBlocks(std::vector< std::vector< uint32_t > > &reg) const
Merge n-D blocks.
Definition: meshQuery.cpp:1234
int linesIn3D(std::vector< uint32_t > &lines, const std::vector< uint32_t > &dim) const
Convert hits into line segments in 3-D.
Definition: meshQuery.cpp:6484
int linesIn4D(std::vector< uint32_t > &lines, const std::vector< uint32_t > &dim) const
Convert hits into line segments in 4-D.
Definition: meshQuery.cpp:6613
int toBlocks2(const ibis::bitvector &bv, const std::vector< uint32_t > &dim, std::vector< std::vector< uint32_t > > &reg) const
Convert a bitvector to a list of 2-D blocks.
Definition: meshQuery.cpp:365
int toBlocks1(const ibis::bitvector &bv, std::vector< std::vector< uint32_t > > &reg) const
Convert a bitvector into 1-D blocks.
Definition: meshQuery.cpp:283
A data structure to represent a sequence of bits.
Definition: bitvector.h:62
static int labelLines1(const std::vector< uint32_t > &lines, std::vector< uint32_t > &labels)
Label line segements on a 1D mesh.
Definition: meshQuery.cpp:7049
void block3d(uint32_t last, const uint32_t n2, const uint32_t n3, const std::vector< uint32_t > &dim, std::vector< uint32_t > &block, std::vector< std::vector< uint32_t > > &reg) const
Deal with one (single) 3D block.
Definition: meshQuery.cpp:729
meshQuery(const char *dir, const ibis::partList &tl)
Constructor for recoverying from crash.
Definition: meshQuery.h:25
static int labelBlocks(const std::vector< std::vector< uint32_t > > &blocks, std::vector< uint32_t > &labels)
Assign a unique labels to each connected set of blocks.
Definition: meshQuery.cpp:6063
static int label1DBlocks(const std::vector< std::vector< uint32_t > > &blocks, std::vector< uint32_t > &labels)
Assign labels to blocks on a 1D mesh.
Definition: meshQuery.cpp:5396
static uint32_t aflatten(ibis::array_t< uint32_t > &rep)
Flatten the array-based union-find data strucutre.
Definition: meshQuery.cpp:5373
void blocknd(uint32_t last, const std::vector< uint32_t > &scl, const std::vector< uint32_t > &dim, std::vector< uint32_t > &block, std::vector< std::vector< uint32_t > > &reg) const
Deal with one (single) N-Dimensional block.
Definition: meshQuery.cpp:885

Make It A Bit Faster
Contact us
Disclaimers
FastBit source code
FastBit mailing list archive