Debian Codegraph @

src/MNTable2D.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 __MNTABLE_H
14 #define __MNTABLE_H
15
16 // --- STL includes ---
17 #include <boost/python.hpp>
18 #include <vector>
19 #include <map>
20 #include <set>
21
22 using std::vector;
23 using std::map;
24 using std::multimap;
25 using std::set;
26
27 // --- IO includes ---
28 #include <iostream>
29
30 using std::ostream;
31
32 // --- Project includes ---
33 #include "MNTCell.h"
34 #include "geometry/Sphere.h"
35 #include "geometry/Line2D.h"
36 #include "geometry/LineSegment2D.h"
37
38 /*!
39 \class MNTable2D
40 \brief Multi-group Neighbour table
41
42 Neighbour table supporting multiple tagged groups of particles
43 */
44 class MNTable2D
45 {
46 public: // types
47 typedef pair<int,int> bond;
48
49 protected:
50 MNTCell* m_data;
51 map<int,set<pair<int,int> > > m_bonds;
52 double m_x0,m_y0; //!< origin
53 double m_celldim; //!< cell size
54 int m_nx,m_ny; //!< number of cells in x- and y-direction
55 unsigned int m_ngroups;
56 static int s_output_style;
57 static double s_small_value;
58 int m_x_periodic;
59 int m_y_periodic;
60 int m_write_prec; //!< precision (nr. of significant digits) for file output
61
62 virtual int getIndex(const Vector3&) const;
63 inline int idx(int i,int j) const {return i*m_ny+j;};
64 void WriteAsVtkXml(ostream&) const;
65
66 public:
67 MNTable2D();
68 MNTable2D(const Vector3&,const Vector3&,double,unsigned int);
69 virtual ~MNTable2D();
70
71 virtual bool insert(const Sphere&,unsigned int);
72 virtual bool insertChecked(const Sphere&,unsigned int,double tol=s_small_value);
73 virtual bool checkInsertable(const Sphere&,unsigned int);
74 void GrowNGroups(unsigned int);
75 const multimap<double,const Sphere*> getSpheresClosestTo(const Vector3&,unsigned int) const;
76 const multimap<double,const Sphere*> getSpheresFromGroupNear(const Vector3&,double,int) const;
77 const vector<const Sphere*> getAllSpheresFromGroup(int) const;
78 const Sphere* getClosestSphereFromGroup(const Sphere&,int) const;
79 Sphere* getClosestSphereFromGroup(const Vector3&,int) const;
80 int getTagOfClosestSphereFromGroup(const Sphere&,int) const;
81 void tagParticlesAlongLine(const Line2D&,double,int,unsigned int);
82 void tagParticlesAlongLineWithMask(const Line2D&,double,int,int, unsigned int);
83 void tagParticlesAlongLineSegment(const LineSegment2D&,double,int,int, unsigned int);
84 void tagParticlesNear(const Vector3&,double,int,int);
85 void tagClosestParticle(const Vector3&,int,int);
86 void tagParticlesToClosest(int,int);
87 void tagParticlesInVolume(const AVolume&,int,unsigned int);
88
89 boost::python::list getSphereListFromGroup(int) const;
90 boost::python::list getBondList(int);
91
92 virtual void generateBonds(int,double,int);
93 virtual void generateBondsWithMask(int,double,int,int,int);
94 virtual void generateRandomBonds(int,double,double,int,int,int);
95 virtual void generateClusterBonds(int,double,int,int);
96 virtual void generateBondsTaggedMasked(int,double,int,int,int,int,int);
97 void insertBond(int,int,int);
98 void breakBondsAlongLineSegment(const LineSegment2D&,double,int, unsigned int);
99
100 void removeTagged(int,int,int);
101
102 // output
103 double getSumVolume(int);
104 int getNrParticles(int);
105 friend ostream& operator << (ostream&,const MNTable2D&);
106 static void SetOutputStyle(int);
107 void SetOutputPrecision(int);
108 void write(char *filename, int outputStyle);
109 };
110 #endif // __MNTABLE_H