Free Electron
ProxSweep.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __spatial_ProxSweep_h__
8 #define __spatial_ProxSweep_h__
9 
10 #include "signal/signal.h"
11 #include "Proximity.h"
12 
13 namespace fe
14 {
15 namespace ext
16 {
17 
18 /** Proximity detection.
19 
20  Sweep sort in one dimension.
21 
22  Currently does not support wrap around borders.
23 
24  @b particle attributes
25  @li AsParticle::location
26  @li AsBounded::radius
27 
28  @b pair attributes
29  @li AsProximity::left
30  @li AsProximity::right
31  */
32 class ProxSweep :
33  virtual public ProxI,
34  public Initialize<ProxSweep>
35 {
36  public:
37  ProxSweep(void);
38 virtual ~ProxSweep(void);
39  void initialize(void);
40 
41  // AS ProxI
42 virtual unsigned int detect( sp<Layout> l_pair,
43  sp<RecordGroup> rg_in,
44  sp<RecordGroup> rg_out);
45 
46 
47  void setAxis(unsigned int a_d);
48 
49  private:
50  class LocalRecord
51  {
52  public:
53  unsigned int m_index;
54  RecordArray *m_pRA;
55  SpatialVector m_location;
56  Real m_radius;
57  Real m_hi;
58  };
59  typedef std::vector<LocalRecord> t_lrecords;
60  class MinVal
61  {
62  public:
63  float m_key;
64  int m_index;
65  bool operator<(const MinVal &a_other) const
66  {
67  return (m_key < a_other.m_key);
68  }
69  };
70  typedef std::vector<MinVal> t_minvals;
71 
72  void setup(sp<Scope> spScope);
73  bool check(LocalRecord &r_a, LocalRecord &r_b);
74 
75  sp<Scope> m_spScope;
76  AsBounded m_asBounded;
77  AsParticle m_asParticle;
78  AsProximity m_asProximity;
79 
80  Array<BaseAccessor> m_filters;
81 
82  sp<RecordArray> m_spPool;
83  FE_UWORD m_poolIndex;
84 
85  hp<Layout> m_hpPairLayout;
86 
87  unsigned int m_sweepAxis;
88 };
89 
90 
91 } /* namespace ext */
92 } /* namespace fe */
93 
94 #endif /* __spatial_ProxSweep_h__ */
95 
kernel
Definition: namespace.dox:3
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
proximity detection interface
Definition: Proximity.h:21
particle in physical space
Definition: shapeAS.h:58
possible bounding area/volume attributes
Definition: shapeAS.h:148
Wrapper for std::vector.
Definition: Array.h:21
Proximity detection.
Definition: ProxSweep.h:32
Homogeneous collection of Records.
Definition: RecordArraySB.h:40