ESyS-Particle  2.3.4
Graph Class Reference

Graph class, partially based on Sedgewick, "Alg. in C++", progs. 17.1, 17.9 and 17.10. More...

#include <graph.h>

Collaboration diagram for Graph:

Classes

struct  Edge
 
struct  Node
 

Public Types

typedef list< int >::iterator adjIterator
 

Public Member Functions

 Graph ()
 
 ~Graph ()
 
int numV () const
 
int numE () const
 
int getGrainID (int) const
 
double getParticleMass (int) const
 
void insert (const Edge &)
 
void insert (const pair< int, int > &)
 
void setVertexData (int, const pdata &)
 
pdata getVertexData (int i) const
 
void remove (const Edge &)
 
bool isEdge (int, int)
 
void removeDoubles ()
 
adjIterator IterBegin (int)
 
adjIterator IterEnd (int)
 
map< int, int >::const_iterator cid_begin () const
 
map< int, int >::const_iterator cid_end () const
 
void makeConnComp ()
 
void printGrainPCount (ostream &)
 
void printGrainMass (ostream &)
 
void printIdList (const string &)
 
void printRotList (const string &)
 
void printGrainCountDist (const string &)
 
void printGrainDiamDist (const string &, double, int)
 
void printGrainMassDist (const string &, double, int)
 
void printSieveDist (const string &, double)
 
double getPercentile (double)
 
void writeAvgGrainSizeProfile (const string &, double, double, int)
 
void writeAvgGrainSizeGrid (const string &, double, double, double, double, double, double, double)
 
void writeMatrixFractionProfile (const string &, double, double, int, double)
 
void writeMatrixFractionGrid (const string &, double, double, double, double, double, double, double, double)
 
void printGrainsAsVtk (const string &, double)
 
void printAllAsVtk (const string &)
 
void printCrossSection (const Vec3 &, const Vec3 &, const Vec3 &, const string &, int, int, double, double, double, double, bool, bool)
 
void printGrainCenterPosition (const string &)
 

Private Member Functions

void ccR (int)
 
void dfsIter (int)
 

Private Attributes

map< int, list< int > > m_data
 
map< int, int > cid
 
map< int, pdatam_vertex_data
 
map< int, double > m_grain_mass
 
map< int, Vec3m_grain_rot
 
int ccnt
 

Detailed Description

Graph class, partially based on Sedgewick, "Alg. in C++", progs. 17.1, 17.9 and 17.10.

Member Typedef Documentation

◆ adjIterator

typedef list<int>::iterator Graph::adjIterator

Constructor & Destructor Documentation

◆ Graph()

Graph::Graph ( )

◆ ~Graph()

Graph::~Graph ( )

Member Function Documentation

◆ ccR()

void Graph::ccR ( int  i)
private

References ccnt, cid, esys::lsm::bpu::iter(), and m_data.

Here is the call graph for this function:

◆ cid_begin()

map<int,int>::const_iterator Graph::cid_begin ( ) const
inline

References cid.

Referenced by Frac::Frac(), and printRotList().

Here is the caller graph for this function:

◆ cid_end()

map<int,int>::const_iterator Graph::cid_end ( ) const
inline

References cid.

Referenced by Frac::Frac(), and printRotList().

Here is the caller graph for this function:

◆ dfsIter()

void Graph::dfsIter ( int  u)
private

Iterative depth first search. Avoids possible issues with recursion depth in very large components

Parameters
ustarting node

References ccnt, cid, esys::lsm::bpu::iter(), and m_data.

Referenced by makeConnComp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGrainID()

int Graph::getGrainID ( int  i) const

References cid.

◆ getParticleMass()

double Graph::getParticleMass ( int  i) const

References m_vertex_data.

Referenced by Frac::Frac().

Here is the caller graph for this function:

◆ getPercentile()

double Graph::getPercentile ( double  p)

get the sieving size of the x-th percentile

Parameters
pthe percentile (in percent!)

References ccnt, cid, esys::lsm::bpu::iter(), m_vertex_data, and pdata::mass.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVertexData()

pdata Graph::getVertexData ( int  i) const

References esys::lsm::bpu::iter(), and m_vertex_data.

Referenced by Frac::Frac(), Frac::get_grain_mass(), Frac::get_move_vectors(), Frac::getSplitAbrasion(), and Frac::writeAsVtk().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert() [1/2]

void Graph::insert ( const Edge E)

insert a new edge

Parameters
Ethe edge

References Graph::Edge::i, Graph::Edge::j, and m_data.

Referenced by readGeo(), and readSnap().

Here is the caller graph for this function:

◆ insert() [2/2]

void Graph::insert ( const pair< int, int > &  p)

insert a new edge as pair<int,int>

Parameters
pthe edge

References m_data.

◆ isEdge()

bool Graph::isEdge ( int  i,
int  j 
)

References esys::lsm::bpu::iter(), and m_data.

Referenced by Frac::getSplitAbrasion(), and printCrossSection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IterBegin()

Graph::adjIterator Graph::IterBegin ( int  i)

References m_data.

◆ IterEnd()

Graph::adjIterator Graph::IterEnd ( int  i)

References m_data.

◆ makeConnComp()

void Graph::makeConnComp ( )

References ccnt, cid, dfsIter(), esys::lsm::bpu::iter(), and m_data.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ numE()

int Graph::numE ( ) const

get number of egdes

References esys::lsm::bpu::iter(), and m_data.

Referenced by readGeo(), and readSnap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ numV()

int Graph::numV ( ) const

get number of vertices

References m_data.

Referenced by printAllAsVtk(), readGeo(), and readSnap().

Here is the caller graph for this function:

◆ printAllAsVtk()

void Graph::printAllAsVtk ( const string &  filename)

write out all grains larger than a certain size as VTK-XML files

Parameters
filenameile name

References ccnt, cid, esys::lsm::bpu::iter(), m_vertex_data, pdata::mass, and numV().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printCrossSection()

void Graph::printCrossSection ( const Vec3 Pos,
const Vec3 W,
const Vec3 V,
const string &  filename,
int  xdim,
int  ydim,
double  xmin,
double  xmax,
double  ymin,
double  ymax,
bool  write_ppm,
bool  filter_singles 
)

generate cross section

Parameters
Posthe position of the plane
Wspanning vector in-plane
Vspanning vector in-plane
filenamethe filename
xdimimage width
ydimimage height
write_ppmif true, output PPM file
filter_singlesif true, filter out single particle grains

References ccnt, cid, cross(), pdata2d::gid, Matrix3::invert(), isEdge(), Triangle2D::isIn(), esys::lsm::bpu::iter(), m_data, m_vertex_data, pdata::pos, pdata2d::pos2d, pdata::rad, pdata2d::rad, Vec3::unit(), and Vec3::Z().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printGrainCenterPosition()

void Graph::printGrainCenterPosition ( const string &  filename)

Write a list of grain id / grain center position (x,y,z) pairs to a file

Parameters
filenamethe name of the output file

References ccnt, cid, esys::lsm::bpu::iter(), m_vertex_data, pdata::mass, and pdata::pos.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printGrainCountDist()

void Graph::printGrainCountDist ( const string &  filename)

References ProbDist::AddSample(), ccnt, cid, esys::lsm::bpu::iter(), and ProbDist::Write().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printGrainDiamDist()

void Graph::printGrainDiamDist ( const string &  filename,
double  base,
int  cum 
)

print grain size distribution - cumulative mass over diameter

Parameters
filenamethe output filename
basethe base for the exponential bin size
cumcumulative or not

References ProbDist::AddSample(), ccnt, cid, esys::lsm::bpu::iter(), m_vertex_data, pdata::mass, and ProbDist::Write().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printGrainMass()

void Graph::printGrainMass ( ostream &  ost)

References ccnt, cid, esys::lsm::bpu::iter(), m_vertex_data, and pdata::mass.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printGrainMassDist()

void Graph::printGrainMassDist ( const string &  filename,
double  base,
int  cum 
)

output grain mass distribution

Parameters
filenamethe output filename
basethe base for the exponential bin size
cumcumulative or not

References ProbDist::AddSample(), ccnt, cid, esys::lsm::bpu::iter(), m_vertex_data, pdata::mass, and ProbDist::Write().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printGrainPCount()

void Graph::printGrainPCount ( ostream &  ost)

References ccnt, cid, and esys::lsm::bpu::iter().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printGrainsAsVtk()

void Graph::printGrainsAsVtk ( const string &  basefilename,
double  min_mass 
)

write out all grains larger than a certain size as VTK-XML files

Parameters
basefilenamebase file name, files written are basefilename.N.xml
min_massminimum mass above which grains are saved

References ccnt, cid, esys::lsm::bpu::iter(), m_vertex_data, pdata::mass, pdata::pos, and pdata::rad.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printIdList()

void Graph::printIdList ( const string &  filename)

References ccnt, cid, esys::lsm::bpu::iter(), m_vertex_data, and pdata::mass.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printRotList()

void Graph::printRotList ( const string &  filename)

print grain list with per-grain rotation vectors

Parameters
filenamethe name of the file written

References ccnt, cid, cid_begin(), cid_end(), cross(), esys::lsm::bpu::iter(), m_vertex_data, pdata::mass, pdata::pos, Vec3::unit(), pdata::vel, and Vec3::Z().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printSieveDist()

void Graph::printSieveDist ( const string &  filename,
double  base 
)

print grain size distribution - cumulative mass over diameter

Parameters
filenamethe output filename
basethe base for the exponential bin size
cumcumulative or not

References ProbDist::AddSample(), ccnt, cid, esys::lsm::bpu::iter(), m_vertex_data, pdata::mass, and ProbDist::Write().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove()

void Graph::remove ( const Edge E)

◆ removeDoubles()

void Graph::removeDoubles ( )

References esys::lsm::bpu::iter(), and m_data.

Referenced by readGeo(), and readSnap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setVertexData()

void Graph::setVertexData ( int  n,
const pdata pd 
)

References cid, m_data, and m_vertex_data.

Referenced by readGeo(), and readSnap().

Here is the caller graph for this function:

◆ writeAvgGrainSizeGrid()

void Graph::writeAvgGrainSizeGrid ( const string &  filename,
double  xmin,
double  xmax,
double  ymin,
double  ymax,
double  zmin,
double  zmax,
double  cellsize 
)

write distribution of average grain size (mass, equiv. diameter) as VTK regular grid file (3D)

Parameters
filenamethe output file name
xminminimum of the x-range
xmaxmaximum of the x-range
yminminimum of the y-range
ymaxmaximum of the y-range
zminminimum of the z-range
zmaxmaximum of the z-range
cellsizethe size of a grid cell (1 dimension, cells are (roughly) cubes)

References ccnt, cid, esys::lsm::bpu::iter(), m_vertex_data, pdata::mass, pdata::pos, write_vtk_header(), Vec3::X(), Vec3::Y(), and Vec3::Z().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeAvgGrainSizeProfile()

void Graph::writeAvgGrainSizeProfile ( const string &  filename,
double  ymin,
double  ymax,
int  nbin 
)

write y-profile of average grain size (mass, equiv. diameter)

Parameters
filename
ymin
ymax
nbin

References ccnt, cid, esys::lsm::bpu::iter(), m_vertex_data, pdata::mass, pdata::pos, and Vec3::Y().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeMatrixFractionGrid()

void Graph::writeMatrixFractionGrid ( const string &  filename,
double  xmin,
double  xmax,
double  ymin,
double  ymax,
double  zmin,
double  zmax,
double  cellsize,
double  size_limit 
)

write spatial distribution of matrix percentage (mass fraction of grains below threshold) as VTK regular grid file (3D)

Parameters
filenamethe output file name
xminminimum of the x-range
xmaxmaximum of the x-range
yminminimum of the y-range
ymaxmaximum of the y-range
zminminimum of the z-range
zmaxmaximum of the z-range
cellsizethe size of a grid cell (1 dimension, cells are (roughly) cubes)
size_limitthe size limit below which a grain counts as "matrix"

References ccnt, cid, esys::lsm::bpu::iter(), m_vertex_data, pdata::mass, pdata::pos, write_vtk_header(), Vec3::X(), Vec3::Y(), and Vec3::Z().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeMatrixFractionProfile()

void Graph::writeMatrixFractionProfile ( const string &  filename,
double  ymin,
double  ymax,
int  nbin,
double  size_limit 
)

write y-profile of average grain size (mass, equiv. diameter)

Parameters
filename
ymin
ymax
nbin
size_limitmatrix cutoff (mass)

References ccnt, cid, esys::lsm::bpu::iter(), m_vertex_data, pdata::mass, pdata::pos, and Vec3::Y().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ ccnt

◆ cid

◆ m_data

map<int,list<int> > Graph::m_data
private

◆ m_grain_mass

map<int,double> Graph::m_grain_mass
private

◆ m_grain_rot

map<int,Vec3> Graph::m_grain_rot
private

◆ m_vertex_data


The documentation for this class was generated from the following files: