ESyS-Particle
2.2
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
graph.h
Go to the documentation of this file.
1
2
// //
3
// Copyright (c) 2003-2013 by The University of Queensland //
4
// Earth Systems Science Computational Centre (ESSCC) //
5
// http://www.uq.edu.au/esscc //
6
// //
7
// Primary Business: Brisbane, Queensland, Australia //
8
// Licensed under the Open Software License version 3.0 //
9
// http://www.opensource.org/licenses/osl-3.0.php //
10
// //
12
13
#ifndef __GRAPH_H
14
#define __GRAPH_H
15
16
// --- project includes ---
17
#include "
Foundation/vec3.h
"
18
19
// --- STL includes ---
20
#include <list>
21
#include <vector>
22
#include <utility>
23
#include <map>
24
#include <iostream>
25
#include <string>
26
27
using
std::list;
28
using
std::vector;
29
using
std::pair;
30
using
std::map;
31
using
std::ostream;
32
using
std::endl;
33
using
std::string;
34
35
struct
pdata
{
36
int
tag
;
37
double
mass
;
38
Vec3
pos
;
39
double
rad
;
40
Vec3
vel
;
41
Vec3
angvel
;
42
43
pdata
(
int
t=-1,
44
double
m=0.0,
45
Vec3
p=
Vec3
(0.0,0.0,0.0),
46
double
r=0.0,
47
Vec3
v=
Vec3
(0.0,0.0,0.0),
48
Vec3
av=
Vec3
(0.0,0.0,0.0))
49
:
tag
(t),
mass
(m),
pos
(p),
rad
(r),
vel
(v),
angvel
(av){};
50
};
51
52
struct
pdata2d
{
53
int
gid
;
// grain id
54
Vec3
pos2d
;
// projected position
55
double
rad
;
// radius
56
};
57
63
class
Graph
64
{
65
public
:
// types
66
struct
Edge
{
67
int
i
,
j
;
68
Edge
(
int
v=-1,
int
w=-1):
i
(v),
j
(w){}
69
};
70
71
struct
Node
{
72
int
id
;
73
Node
(
int
i=-1):
id
(i){};
74
};
75
typedef
list<int>::iterator
adjIterator
;
76
77
private
:
78
map<int,list<int> >
m_data
;
79
map<int,int>
cid
;
// component id for conn. component
80
map<int,pdata>
m_vertex_data
;
81
map<int,double>
m_grain_mass
;
82
map<int,Vec3>
m_grain_rot
;
83
int
ccnt
;
84
85
void
ccR
(
int
);
86
void
dfsIter
(
int
);
87
88
public
:
// methods
89
Graph
();
90
~Graph
();
91
int
numV
()
const
;
92
int
numE
()
const
;
93
int
getGrainID
(
int
)
const
;
94
double
getParticleMass
(
int
)
const
;
95
void
insert
(
const
Edge
&);
96
void
insert
(
const
pair<int,int>&);
97
void
setVertexData
(
int
,
const
pdata
&);
98
pdata
getVertexData
(
int
i)
const
;
99
void
remove
(
const
Edge
&);
100
bool
isEdge
(
int
,
int
);
101
void
removeDoubles
();
102
adjIterator
IterBegin
(
int
);
103
adjIterator
IterEnd
(
int
);
104
map<int,int>::const_iterator
cid_begin
()
const
{
return
cid
.begin();};
105
map<int,int>::const_iterator
cid_end
()
const
{
return
cid
.end();};
106
void
makeConnComp
();
107
void
printGrainPCount
(ostream&);
108
void
printGrainMass
(ostream&);
109
void
printIdList
(
const
string
&);
110
void
printRotList
(
const
string
&);
111
void
printGrainCountDist
(
const
string
&);
112
void
printGrainDiamDist
(
const
string
&,
double
,
int
);
113
void
printGrainMassDist
(
const
string
&,
double
,
int
);
114
void
printSieveDist
(
const
string
&,
double
);
115
double
getPercentile
(
double
);
116
void
writeAvgGrainSizeProfile
(
const
string
&,
double
,
double
,
int
) ;
117
void
writeAvgGrainSizeGrid
(
const
string
&,
double
,
double
,
double
,
double
,
double
,
double
,
double
) ;
118
void
writeMatrixFractionProfile
(
const
string
&,
double
,
double
,
int
,
double
) ;
119
void
writeMatrixFractionGrid
(
const
string
&,
double
,
double
,
double
,
double
,
double
,
double
,
double
,
double
) ;
120
void
printGrainsAsVtk
(
const
string
&,
double
);
121
void
printAllAsVtk
(
const
string
&);
122
void
printCrossSection
(
const
Vec3
&,
const
Vec3
&,
const
Vec3
&,
const
string
&,
int
,
int
,
double
,
double
,
double
,
double
,
bool
,
bool
);
123
124
};
125
126
#endif //__GRAPH_H
Tools
ExtractGrains
graph.h
Generated on Mon May 6 2013 23:26:31 for ESyS-Particle by
1.8.3.1