1
/*************************************************************************
2
* Copyright (C) 2006 by Bruno Chareyre *
3
* bruno.chareyre@hmg.inpg.fr *
5
* This program is free software; it is licensed under the terms of the *
6
* GNU General Public License v2 or later. See file LICENSE for details. *
7
*************************************************************************/
9
/*! \brief Computes statistics of micro-variables assuming axi-symetry.
15
#include "TriaxialState.h"
19
#define SPHERE_DISCRETISATION 20; //number of "teta" intervals on the unit sphere
20
#define LINEAR_DISCRETISATION 200; //number of intervals on segments like [UNmin,UNmax]
22
// l_vertices : defines vertices for each facet
23
// for facet k, the vertices indices are in column k
24
const int l_vertices [4][3] = { {1, 2, 3}, {0, 3, 2}, {3, 0, 1}, {2, 1, 0} };
28
class KinematicLocalisationAnalyser
31
typedef TriaxialState::Tesselation Tesselation;
32
typedef TriaxialState::RTriangulation RTriangulation;
33
typedef RTriangulation::Vertex_handle Vertex_handle;
34
typedef RTriangulation::Finite_cells_iterator Finite_cells_iterator;
35
typedef RTriangulation::Cell_handle Cell_handle;
36
typedef RTriangulation::Edge_iterator Edge_iterator;
37
typedef vector< pair<Real,Real> > RGrid1D;
38
typedef vector<vector <Real> > RGrid2D;
39
typedef vector<vector<vector<Real> > > RGrid3D;
41
KinematicLocalisationAnalyser();
42
KinematicLocalisationAnalyser ( const char* state_file1, bool usebz2 = true );
43
KinematicLocalisationAnalyser ( const char* state_file1, const char* state_file0, bool consecutive_files = true, bool usebz2 = true);
44
KinematicLocalisationAnalyser ( const char* base_name, int file_number0, int file_number1, bool usebz2 = true);
46
~KinematicLocalisationAnalyser();
48
void SetBaseFileName (string name);
49
bool SetFileNumbers (int n0, int n1);
50
void SetConsecutive (bool);
51
void SetNO_ZERO_ID (bool);
52
void SwitchStates (void);
55
bool DistribsToFile (const char* output_file_name);
56
///Write the averaged deformation on each grain in a file (vertices and cells lists included in the file), no need to call ComputeParticlesDeformation()
57
bool DefToFile (const char* output_file_name = "deformations");
58
bool DefToFile (const char* state_file1, const char* state_file0, const char* output_file_name="deformation.vtk", bool usebz2=false);
59
///Save/Load states using bz2 compression
61
ofstream& ContactDistributionToFile ( ofstream& output_file );
62
ofstream& AllNeighborDistributionToFile ( ofstream& output_file );
63
ofstream& StrictNeighborDistributionToFile ( ofstream& output_file );
64
ofstream& NormalDisplacementDistributionToFile ( vector<Edge_iterator>& edges, ofstream& output_file );
66
long Filtered_contacts ( TriaxialState& state );
67
long Filtered_neighbors ( TriaxialState& state );
68
long Filtered_grains ( TriaxialState& state );
69
Real Filtered_volume ( TriaxialState& state );
70
Real Contact_coordination ( TriaxialState& state );
71
Real Neighbor_coordination ( TriaxialState& state );
72
Tenseur_sym3 Neighbor_fabric ( TriaxialState& state );
73
Tenseur_sym3 Contact_fabric ( TriaxialState& state );
74
Real Contact_anisotropy ( TriaxialState& state );
75
Real Neighbor_anisotropy ( TriaxialState& state );
77
void SetForceIncrements (void);
78
void SetDisplacementIncrements (void);
80
///Add surface*displacement to T
81
void Grad_u ( Finite_cells_iterator cell, int facet, Vecteur &V, Tenseur3& T );
82
///Compute grad_u in cell (by default, T= average grad_u in cell, if !vol_divide, T=grad_u*volume
83
void Grad_u ( Finite_cells_iterator cell, Tenseur3& T, bool vol_divide=true );
84
/// Compute grad_u for all particles, by summing grad_u of all adjaent cells using current states
85
const vector<Tenseur3>& ComputeParticlesDeformation (void);
86
/// Do everything in one step by giving some final (file1) and initial (file0) positions
87
const vector<Tenseur3>& ComputeParticlesDeformation(const char* state_file1, const char* state_file0, bool usebz2 = true);
88
///Compute porisity from cumulated spheres volumes and positions of boxes
89
Real ComputeMacroPorosity (void );
91
Vecteur Deplacement ( Cell_handle cell ); //donne le d�placement d'un sommet de voronoi
92
Vecteur Deplacement ( Finite_cells_iterator cell, int facet ); //mean displacement on a facet
94
// Calcul du tenseur d'orientation des voisins
95
//Tenseur_sym3 Orientation_voisins (Tesselation& Tes);
97
//Set the list of edges of a given orientation (orientation defined via the z-coordinate of the normal)
98
vector<Edge_iterator>& Oriented_Filtered_edges (Real Nymin, Real Nymax, vector<Edge_iterator>& filteredList);
100
vector<pair<Real,Real> >& NormalDisplacementDistribution ( vector<Edge_iterator>& edges, vector<pair<Real,Real> >& row );
103
int sphere_discretisation;
104
int linear_discretisation;
105
Tenseur_sym3 Delta_epsilon;
106
Tenseur3 grad_u_total;
107
vector<Tenseur3> ParticleDeformation;
108
Tenseur3 grad_u_total_g;//grad_u averaged on extended grain cells
109
TriaxialState *TS1, *TS0;
112
int file_number_1, file_number_0;
113
string base_file_name; //Base name of state-files, complete name is (base_name+state_number).
114
bool consecutive; //Are the two triax states consecutive? if "false" displacements are re-computed from the two source files; if "true" one file is enough.
115
Real v_solid_total;//solid volume in the box
116
Real v_total;//volume of the box
117
Real v_total_g;//summed volumes of extended grain cells
118
long n_persistent, n_new, n_lost, n_real_cells, n_real_vertices, n_fictious_vertices;