File: MNTable3D.h

package info (click to toggle)
python-demgengeo 1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,004 kB
  • ctags: 2,158
  • sloc: cpp: 12,532; python: 1,260; makefile: 281; sh: 92
file content (137 lines) | stat: -rw-r--r-- 4,782 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/////////////////////////////////////////////////////////////
//                                                         //
// Copyright (c) 2007-2014 by The University of Queensland //
// Centre for Geoscience Computing                         //
// http://earth.uq.edu.au/centre-geoscience-computing      //
//                                                         //
// Primary Business: Brisbane, Queensland, Australia       //
// Licensed under the Open Software License version 3.0    //
// http://www.opensource.org/licenses/osl-3.0.php          //
//                                                         //
/////////////////////////////////////////////////////////////

#ifndef __MNTABLE3D_H
#define __MNTABLE3D_H

// --- STL includes ---
#include <boost/python.hpp>
#include <vector>
#include <map>
#include <string>
#include <set>

using std::vector;
using std::map;
using std::multimap;
using std::string;
using std::set;


// --- IO includes ---
#include <iostream>

using std::ostream;

// --- Project includes ---
#include "MNTCell.h"
#include "AVolume3D.h"
#include "AVolume.h"
#include "../geometry/Sphere.h"
#include "../util/vector3.h"
#include "../geometry/Plane.h"
#include "JointSet.h"
#include "TriPatchSet.h"

// --- STL includes ---
#include <vector>
#include <map>
#include <utility>

using std::vector;
using std::map;
using std::pair;


/*!
  \class MNTable3D
  \brief Multi-group Neighbour table

  Neighbour table supporting multiple tagged groups of particles
*/
class MNTable3D
{
 public: // types
  typedef pair<int,int> bond;

 protected:
  MNTCell* m_data;
  map<int,set<bond> > m_bonds; 
  Vector3 m_origin; //!< origin
  Vector3 m_min_pt, m_max_pt; // original min/max point
  double m_celldim; //!< cell size
  int m_nx,m_ny,m_nz; //!< number of cells in x-, y- and z-direction
  unsigned int m_ngroups;
  static int s_output_style; 
  static double s_small_value;
  int m_x_periodic,m_y_periodic,m_z_periodic;

  virtual int getIndex(const Vector3&) const;
  inline int idx(int i,int j, int k) const{return i*m_ny*m_nz+j*m_nz+k;};
  void WriteAsVtkXml(ostream&) const;
  virtual void set_x_circ();
  virtual void set_y_circ();
  virtual void set_z_circ();
  int m_write_prec; //!< precision (nr. of significant digits) for file output

 public:
  MNTable3D();
  MNTable3D(const Vector3&,const Vector3&,double,unsigned int);
  virtual ~MNTable3D();

  bool insertFromRawFile(const string&,double,double);
  virtual bool insert(const Sphere&,unsigned int);
  virtual bool insertChecked(const Sphere&,unsigned int,double=s_small_value);
  virtual bool checkInsertable(const Sphere&,unsigned int);
  void GrowNGroups(unsigned int);
  const multimap<double,const Sphere*> getSpheresClosestTo(const Vector3&,unsigned int) const;
  const multimap<double,const Sphere*> getSpheresFromGroupNear(const Vector3&,double,int) const;
  const vector<const Sphere*> getAllSpheresFromGroup(int) const;
  const Sphere* getClosestSphereFromGroup(const Sphere&,int) const;
  int getTagOfClosestSphereFromGroup(const Sphere&,int) const;
  const Sphere* getClosestSphereFromGroup(const Sphere&,int,double,double,double) const;
  int getTagOfClosestSphereFromGroup(const Sphere&,int,double,double,double) const;
  void tagParticlesAlongPlane(const Plane&,double,int,unsigned int);
  void tagParticlesAlongPlaneWithMask(const Plane&,double,int,int,unsigned int);
  void tagParticlesInSphere(const Sphere&,int,unsigned int);
  void tagParticlesInGroupNT(int tag,int gid){tagParticlesInGroup(tag,gid,-1);};
  void tagParticlesInGroup(int,int,int);
  void tagParticlesToClosest(int,int);
  void tagParticlesToClosestAnisotropic(int,int,double,double,double);
  void removeParticlesWithTag(int,unsigned int);
  void removeParticlesWithTagMask(unsigned int,int,int);
  void removeParticlesInVolume(AVolume3D*, int, bool);
  void removeParticlesInGroup(unsigned int);
  void tagParticlesAlongJoints(const  TriPatchSet&,double,int, int, unsigned int);
  void tagParticlesInVolume(const AVolume&,int,unsigned int);
  void renumberParticlesContinuous();

  boost::python::list getSphereListFromGroup(int) const;
  boost::python::list getSphereListDist(const Vector3&, double, int) const;
  virtual void generateBonds(int,double,int);
  virtual void generateClusterBonds(int,double,int,int);
  virtual void generateBondsWithJointSet(const TriPatchSet&,int,double,int);
  virtual void generateBondsTagged(int,double,int,int,int);
  virtual void generateRandomBonds(int,double,double,int,int,int);

  void insertBond(int,int,int);

  

  // output 
  double getSumVolume(int);
  friend ostream& operator << (ostream&,const MNTable3D&);
  static void SetOutputStyle(int);
  void SetOutputPrecision(int);
  void write(char *filename, int outputStyle);
};
#endif // __MNTABLE_H