ESyS-Particle  2.3.4
frame_vtk.cpp File Reference
#include "frame_vtk.h"
#include "vec3.h"
#include <vector>
#include <string>
#include <fstream>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <sstream>
#include <boost/filesystem.hpp>
Include dependency graph for frame_vtk.cpp:

Classes

struct  nr_part
 
struct  r_part
 
struct  bond
 

Functions

template<typename T >
void write_bonds (ostream &vtkfile, map< int, T > &data_map, vector< bond > &bonds, map< int, int > &id2idx)
 
template<typename T >
void write_bonds_with_mesh (ostream &vtkfile, map< int, T > &data_map, vector< bond > &bonds, vector< bond > &mesh_bonds, map< int, int > &id2idx)
 
void write_vtu_header (ofstream &vtkfile, int np, int nb)
 
void write_vtu_footer (ofstream &vtkfile)
 
void write_vtu_particle_data_end (ofstream &vtkfile)
 
void write_vtu_rot_base_data (ofstream &vtkfile, map< int, r_part > &datamap, bool unwrap)
 
void write_vtu_nr_base_data (ofstream &vtkfile, map< int, nr_part > &datamap, bool unwrap)
 
int get_version (const string &infilename)
 
vector< string > get_filenames (const string &infilename, int version, bool relpath=false)
 
void do_single_frame_vtk (const string &infilename, const string &outfilename, int iframe, bool with_list, const string &listfilename, bool remove_xbonds, double bond_remove_dist)
 
void do_single_frame_vtk_r (const string &infilename, const string &outfilename, int iframe, bool with_list, const string &listfilename, bool remove_xbonds, double bond_remove_dist, bool with_brklist, const string &brklistname, bool unwrap, bool relpath)
 
void do_single_frame_vtk_single_r (const string &infilename, const string &outfilename, int iframe, int ptag, bool unwrap, bool remove_xbonds, double bond_remove_dist)
 
void do_single_frame_sliced_vtk (const string &, const string &, int, bool, const string &, double, double)
 
void do_single_frame_sliced_vtk_r (const string &infilename, const string &outfilename, int iframe, bool with_list, const string &listfilename, double slz_min, double slz_max)
 
void writeMeshFile (const string &infilename, const string &outfilename, int snapNum)
 

Function Documentation

◆ do_single_frame_sliced_vtk()

void do_single_frame_sliced_vtk ( const string &  ,
const string &  ,
int  ,
bool  ,
const string &  ,
double  ,
double   
)

◆ do_single_frame_sliced_vtk_r()

void do_single_frame_sliced_vtk_r ( const string &  infilename,
const string &  outfilename,
int  iframe,
bool  with_list,
const string &  listfilename,
double  slz_min,
double  slz_max 
)

write a slice , doesn't write bonds

References r_part::angvel, r_part::force, get_filenames(), get_version(), esys::lsm::bpu::iter(), r_part::mass, r_part::pos, r_part::q1, r_part::q2, r_part::q3, r_part::q4, r_part::rad, r_part::tag, r_part::vel, and Vec3::Z().

Referenced by main().

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

◆ do_single_frame_vtk()

void do_single_frame_vtk ( const string &  infilename,
const string &  outfilename,
int  iframe,
bool  with_list,
const string &  listfilename,
bool  remove_xbonds,
double  bond_remove_dist 
)

Read snapshot with non-rotational particles and write it to vtk unstructured grid (.vtu) file

Parameters
infilenamethe name of the header file
outfilenamethe "base" name of the output file
iframethe frame number
with_list
listfilename

References nr_part::circ_shift, nr_part::force, get_filenames(), get_version(), nr_part::init_pos, esys::lsm::bpu::iter(), nr_part::mass, nr_part::pos, nr_part::proc_id, nr_part::rad, nr_part::tag, nr_part::vel, write_bonds(), write_vtu_footer(), write_vtu_header(), write_vtu_nr_base_data(), and write_vtu_particle_data_end().

Referenced by main().

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

◆ do_single_frame_vtk_r()

void do_single_frame_vtk_r ( const string &  infilename,
const string &  outfilename,
int  iframe,
bool  with_list,
const string &  listfilename,
bool  remove_xbonds,
double  bond_remove_dist,
bool  with_brklist,
const string &  brklistname,
bool  unwrap,
bool  relpath 
)

Read snapshot with rotational particles and write it to vtk unstructured grid (.vtu) file

Parameters
infilenamethe name of the header file
outfilenamethe "base" name of the output file
iframethe frame number
with_list
listfilename
remove_xbondsif "true", bonds crossing a circular boundary are not written to the file
bond_remove_distdistance threshold to detect if a bond is crossing a circular boundary
with_brklist
brklistname
unwrapif "true", the model is unwrapped, i.e. movements across a circular boundary are taken into account
relpathif "true" the filenames in the header file are taken to be relative to the path of the header

References r_part::angvel, r_part::circ_shift, r_part::force, get_filenames(), get_version(), r_part::init_pos, esys::lsm::bpu::iter(), r_part::mass, r_part::pos, r_part::proc_id, r_part::q1, r_part::q2, r_part::q3, r_part::q4, r_part::rad, r_part::tag, r_part::vel, write_bonds(), write_bonds_with_mesh(), write_vtu_footer(), write_vtu_header(), write_vtu_particle_data_end(), and write_vtu_rot_base_data().

Referenced by main().

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

◆ do_single_frame_vtk_single_r()

void do_single_frame_vtk_single_r ( const string &  infilename,
const string &  outfilename,
int  iframe,
int  ptag,
bool  unwrap,
bool  remove_xbonds,
double  bond_remove_dist 
)

write particles of single tag from frame

Parameters
infilenamethe input file name
outfilenamethe output file name base
iframeframe nr.
ptagparticle tag to write out
unwrapunwrap x-circular boundaries

References r_part::angvel, r_part::force, get_filenames(), get_version(), esys::lsm::bpu::iter(), r_part::mass, r_part::pos, r_part::q1, r_part::q2, r_part::q3, r_part::q4, r_part::rad, r_part::tag, r_part::vel, write_bonds(), write_vtu_footer(), write_vtu_header(), write_vtu_particle_data_end(), and write_vtu_rot_base_data().

Referenced by main().

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

◆ get_filenames()

vector<string> get_filenames ( const string &  infilename,
int  version,
bool  relpath = false 
)

Get data file names from the header file

Parameters
infilenamethe file name of the header file (incl. the _0.txt part)
thesnapshot version
relpath

References esys::lsm::bpu::iter().

Referenced by do_single_frame_sliced_vtk_r(), do_single_frame_vtk(), do_single_frame_vtk_r(), and do_single_frame_vtk_single_r().

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

◆ get_version()

int get_version ( const string &  infilename)

Get snapshot version.

Parameters
infilenamethe file name of the header file (incl. the _0.txt part)

Referenced by do_single_frame_sliced_vtk_r(), do_single_frame_vtk(), do_single_frame_vtk_r(), and do_single_frame_vtk_single_r().

Here is the caller graph for this function:

◆ write_bonds()

template<typename T >
void write_bonds ( ostream &  vtkfile,
map< int, T > &  data_map,
vector< bond > &  bonds,
map< int, int > &  id2idx 
)

Write bonds to vtk file.

Parameters
vtkfilethe output file stream
data_mapSTL map containing particle data, particle ID as key. Used for bond strains.
bondsbond data: particle ids and bond tag
id2idxmapping between particle ID and index

References esys::lsm::bpu::iter().

Referenced by do_single_frame_vtk(), do_single_frame_vtk_r(), and do_single_frame_vtk_single_r().

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

◆ write_bonds_with_mesh()

template<typename T >
void write_bonds_with_mesh ( ostream &  vtkfile,
map< int, T > &  data_map,
vector< bond > &  bonds,
vector< bond > &  mesh_bonds,
map< int, int > &  id2idx 
)

Write bonds to vtk file. Version with bonded mesh IG.

Parameters
vtkfilethe output file stream
data_mapSTL map containing particle data, particle ID as key. Used for bond strains.
bondsbond data: particle ids and bond tag
mesh_bondsmesh bond data: particle ids and triangle id -> bond tag
id2idxmapping between particle ID and index

References esys::lsm::bpu::iter().

Referenced by do_single_frame_vtk_r().

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

◆ write_vtu_footer()

void write_vtu_footer ( ofstream &  vtkfile)

write base vtu file footer

Parameters
vtkfilethe ofstream connected to the output file

Referenced by do_single_frame_vtk(), do_single_frame_vtk_r(), and do_single_frame_vtk_single_r().

Here is the caller graph for this function:

◆ write_vtu_header()

void write_vtu_header ( ofstream &  vtkfile,
int  np,
int  nb 
)

write vtu file header

Parameters
vtkfilethe ofstream connected to the output file
npnr. of particles
nbnr. of bonds

Referenced by do_single_frame_vtk(), do_single_frame_vtk_r(), and do_single_frame_vtk_single_r().

Here is the caller graph for this function:

◆ write_vtu_nr_base_data()

void write_vtu_nr_base_data ( ofstream &  vtkfile,
map< int, nr_part > &  datamap,
bool  unwrap 
)

write base particle data to vtu file

Parameters
vtkfilethe ofstream connected to the output file
datamap
unwrap

References esys::lsm::bpu::iter().

Referenced by do_single_frame_vtk().

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

◆ write_vtu_particle_data_end()

void write_vtu_particle_data_end ( ofstream &  vtkfile)

finalize particle data section in vtu file

Parameters
vtkfilethe ofstream connected to the output file

Referenced by do_single_frame_vtk(), do_single_frame_vtk_r(), and do_single_frame_vtk_single_r().

Here is the caller graph for this function:

◆ write_vtu_rot_base_data()

void write_vtu_rot_base_data ( ofstream &  vtkfile,
map< int, r_part > &  datamap,
bool  unwrap 
)

write base particle data to vtu file

Parameters
vtkfilethe ofstream connected to the output file
datamap
unwrap

References esys::lsm::bpu::iter().

Referenced by do_single_frame_vtk_r(), and do_single_frame_vtk_single_r().

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

◆ writeMeshFile()

void writeMeshFile ( const string &  infilename,
const string &  outfilename,
int  snapNum 
)

Referenced by main().

Here is the caller graph for this function: