Debian Codegraph @

src/MNTCell.h

raw
1 /////////////////////////////////////////////////////////////
2 // //
3 // Copyright (c) 2007-2017 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.apache.org/licenses/LICENSE-2.0 //
10 // //
11 /////////////////////////////////////////////////////////////
12
13 #ifndef __MNTCELL_H
14 #define __MNTCELL_H
15
16 // --- STL includes ---
17 #include <vector>
18 #include <map>
19 #include <utility>
20
21 using std::vector;
22 using std::map;
23 using std::multimap;
24 using std::pair;
25
26 // --- IO includes ---
27 #include <iostream>
28
29 using std::ostream;
30
31 // --- Project includes ---
32 #include "geometry/Sphere.h"
33 #include "AVolume.h"
34
35
36 struct BondWithPos
37 {
38 int first;
39 int second;
40 Vector3 firstPos;
41 Vector3 secondPos;
42 };
43
44 /*!
45 \class MNTCell
46 \brief class for a cell in a neighbor table (MNTable2D or MNTable3D)
47 */
48 class MNTCell
49 {
50 private:
51 vector<vector<Sphere> > m_data;
52 static int s_output_style;
53
54 public:
55 MNTCell(unsigned int ngroups=1);
56
57 void SetNGroups(unsigned int);
58
59 void insert(const Sphere&,int);
60 int NParts() const;
61
62 const multimap<double,const Sphere*> getSpheresNear(const Vector3&,double) const;
63 const multimap<double,const Sphere*> getSpheresFromGroupNear(const Vector3&,double,int) const;
64 multimap<double,Sphere*> getSpheresFromGroupNearNC(const Vector3&,double,int);
65 const multimap<double,const Sphere*> getSpheresClosestTo(const Vector3&,unsigned int) const;
66 const Sphere* getClosestSphereFromGroup(const Sphere&,int,double) const;
67 const Sphere* getClosestSphereFromGroup(const Sphere&,int,double,double,double,double) const;
68 Sphere* getClosestSphereFromGroup(const Vector3&,int,double);
69 const vector<const Sphere*> getAllSpheresFromGroup(int) const;
70 vector<Sphere*> getAllSpheresFromGroupNC(int);
71 const vector<Sphere*> getSpheresNearObject(const AGeometricObject*,double,unsigned int);
72 const vector<Sphere*> getSpheresInVolume(const AVolume*,unsigned int);
73
74 vector<int> getIdList();
75 void remove(int,int);
76 void removeTagged(int,int,int);
77 void removeInVolume(const AVolume*,int,bool);
78 void tagSpheresNear(const Vector3&,double,int,int);
79 void tagClosestParticle(const Vector3&,int,int);
80 void tagSpheresInGroup(int,int,int);
81 int renumberParticlesContinuous(int);
82
83
84 // get bonds
85 vector<pair<int,int> > getBonds(int,double);
86 vector<pair<int,int> > getBonds(int,double,const MNTCell&);
87 vector<BondWithPos> getBondsWithPos(int,double);
88 vector<BondWithPos> getBondsWithPos(int,double,const MNTCell&);
89 vector<pair<int,int> > getBonds(int,double,int,int);
90 vector<pair<int,int> > getBonds(int,double,const MNTCell&,int,int);
91 vector<pair<int,int> > getBondsSame(int,double);
92 vector<pair<int,int> > getBondsSame(int,double,const MNTCell&);
93 vector<pair<int,int> > getBondsDiff(int,double);
94 vector<pair<int,int> > getBondsDiff(int,double,const MNTCell&);
95 vector<pair<int,int> > getBondsTagged(int,double,int,int);
96 vector<pair<int,int> > getBondsTagged(int,double,const MNTCell&,int,int);
97 vector<pair<int,int> > getBondsTaggedMasked(int,double,int,int,int,int);
98 vector<pair<int,int> > getBondsTaggedMasked(int,double,const MNTCell&,int,int,int,int);
99
100 // output
101 double getSumVolume2D(unsigned int);
102 double getSumVolume3D(unsigned int);
103 int getNrParticles(int);
104 static void SetOutputStyle(int);
105 friend ostream& operator << (ostream&,const MNTCell&);
106 void writePositions(ostream&);
107 void writeRadii(ostream&);
108 void writeIDs(ostream&);
109 void writeTags(ostream&);
110 // for block writing
111 unsigned int writeParticlesInBlock(ostream&, const Vector3&, const Vector3&);
112 };
113
114 #endif // MNTCELL_H