yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #03024
[Branch ~yade-dev/yade/trunk] Rev 1960: - Fix read/write details in TriaxialState and few other small fixes
------------------------------------------------------------
revno: 1960
committer: Bruno Chareyre <bchareyre@r1arduina>
branch nick: trunk
timestamp: Mon 2010-01-11 20:45:52 +0100
message:
- Fix read/write details in TriaxialState and few other small fixes
- MMA is now fully operational for strain maps
modified:
lib/triangulation/KinematicLocalisationAnalyser.cpp
lib/triangulation/TriaxialState.cpp
pkg/dem/Engine/GlobalEngine/MicroMacroAnalyser.cpp
pkg/dem/Engine/GlobalEngine/MicroMacroAnalyser.hpp
--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'lib/triangulation/KinematicLocalisationAnalyser.cpp'
--- lib/triangulation/KinematicLocalisationAnalyser.cpp 2010-01-11 17:18:22 +0000
+++ lib/triangulation/KinematicLocalisationAnalyser.cpp 2010-01-11 19:45:52 +0000
@@ -76,7 +76,30 @@
Delta_epsilon(2,2) = TS1->eps2 - TS0->eps2;
}
-
+KinematicLocalisationAnalyser::KinematicLocalisationAnalyser(const char* base_name, int n0, int n1)
+{
+ file_number_1 = n1;
+ file_number_0 = n0;
+ base_file_name = string(base_name);
+
+ consecutive = ((n1-n0)==1);
+ sphere_discretisation = SPHERE_DISCRETISATION;
+ linear_discretisation = LINEAR_DISCRETISATION;
+ TS1 = new(TriaxialState);
+ TS0 = new(TriaxialState);
+
+// char buffer [50];
+ std::ostringstream file_name1, file_name0;
+ file_name1 << (string) (base_file_name) << n1;
+ file_name0 << (string) (base_file_name) << n0;
+ cout << "file names : " << file_name0.str().c_str() << ", " << file_name1.str().c_str() << endl;
+ TS1->from_file( file_name1.str().c_str() );
+ TS0->from_file( file_name0.str().c_str() );
+
+ Delta_epsilon(3,3) = TS1->eps3 - TS0->eps3;
+ Delta_epsilon(1,1) = TS1->eps1 - TS0->eps1;
+ Delta_epsilon(2,2) = TS1->eps2 - TS0->eps2;
+}
void KinematicLocalisationAnalyser::SetBaseFileName (string name)
{
@@ -177,12 +200,12 @@
Tesselation& Tes = TS1->tesselation();
RTriangulation& Tri = Tes.Triangulation();
- output_file << Tri.number_of_vertices();
+ output_file << Tri.number_of_vertices()<<endl;
for (RTriangulation::Finite_vertices_iterator V_it =
Tri.finite_vertices_begin(); V_it != Tri.finite_vertices_end(); V_it++)
output_file<<V_it->info().id()<<" "<<V_it->point()<<endl;
- output_file << Tri.number_of_finite_cells();
+ output_file << Tri.number_of_finite_cells()<<endl;
Finite_cells_iterator cell = Tri.finite_cells_begin();
Finite_cells_iterator cell0 = Tri.finite_cells_end();
for (; cell != cell0; cell++) {
=== modified file 'lib/triangulation/TriaxialState.cpp'
--- lib/triangulation/TriaxialState.cpp 2009-12-13 19:58:33 +0000
+++ lib/triangulation/TriaxialState.cpp 2010-01-11 19:45:52 +0000
@@ -18,7 +18,7 @@
namespace CGT {
-TriaxialState::TriaxialState(void) : NO_ZERO_ID(true), filter_distance(-0.1), tesselated(false) {}
+TriaxialState::TriaxialState(void) : NO_ZERO_ID(false), filter_distance(-0.1), tesselated(false) {}
TriaxialState::~TriaxialState(void)
{
@@ -44,7 +44,7 @@
Real value;
file >> buffer;
bool test = (buffer == string(parameter_name));
- //cout << "buffer0 " << buffer << " test0: "<< test << endl;
+ cout << "buffer0 " << buffer << " test0: "<< test << endl;
while (!test)
{
buffer.clear();
@@ -161,20 +161,19 @@
bool TriaxialState::from_file(const char* filename)
{
reset();
-
-
- ifstream Statefile (filename);
+ ifstream Statefile(filename);
cout << filename << endl;
- if (!Statefile.is_open()) {
+ if (!Statefile.is_open()) {
cout << "Error opening files";
- return false; }
+ return false;
+ }
//int a=0;
- #ifdef USE_OGL_VIEW
+#ifdef USE_OGL_VIEW
Vue3D Vue1;
- #endif
-
-
+#endif
+
+
long Idg;
Statefile >> Ng;
//Real x, y, z, rad; //coordonn�es/rayon
@@ -184,8 +183,8 @@
Vecteur trans, rot;
Real rad; //coordonn�es/rayon
bool isSphere;
-
-
+
+
grains.resize(Ng+1);
//cout << "Ngrains =" << Ng << endl;
if (NO_ZERO_ID) {
@@ -196,10 +195,9 @@
git->rotation = CGAL::NULL_VECTOR;
}
- long i= NO_ZERO_ID ? 1 : 0;
-
- for (; i <= Ng ; ++i)
- {
+ long i= NO_ZERO_ID ? 1 : 0;
+
+ for (; i <= Ng ; ++i) {
Statefile >> Idg >> pos >> rad >> trans >> rot >> isSphere;
grains[Idg].id = Idg;
grains[Idg].sphere = Sphere(pos, rad);
@@ -207,17 +205,17 @@
grains[Idg].rotation = rot;
grains[Idg].isSphere = isSphere;
- box.base = Point( min(box.base.x(), pos.x()-rad),
- min(box.base.y(), pos.y()-rad),
- min(box.base.z(), pos.z()-rad) );
- box.sommet = Point( max(box.sommet.x(), pos.x()+rad),
- max(box.sommet.y(), pos.y()+rad),
- max(box.sommet.z(), pos.z()+rad) );
+ box.base = Point(min(box.base.x(), pos.x()-rad),
+ min(box.base.y(), pos.y()-rad),
+ min(box.base.z(), pos.z()-rad));
+ box.sommet = Point(max(box.sommet.x(), pos.x()+rad),
+ max(box.sommet.y(), pos.y()+rad),
+ max(box.sommet.z(), pos.z()+rad));
mean_radius += grains[Idg].sphere.weight();
//cout << "Idg: "<< Idg << " sphere: " << grains[Idg].sphere << " trans: " << grains[Idg].translation << endl;
}
mean_radius /= Ng;//rayon moyen
- cout << filename << " loaded : " << Ng << " grains with mean radius = " << mean_radius << endl;
+ //cout << filename << " loaded : " << Ng << " grains with mean radius = " << mean_radius << endl;
long id1, id2;
int stat;
@@ -225,10 +223,12 @@
Real old_fn, fn, frictional_work;
Statefile >> Nc;
contacts.resize(Nc);
- for (long i=0 ; i < Nc ; ++i)
- {
+
+ for (long i=0 ; i < Nc ; ++i) {
+ cout << "hereNc"<<Nc<<"/"<<i<<endl;
Contact* c = new Contact;
- Statefile >> id1 >> id2 >> c_pos >> old_fn >> old_fs >> fn >> fs >> frictional_work >> stat;
+ Statefile >> id1 >> id2 >> normal >> c_pos >> old_fn >> old_fs >> fn >> fs >> frictional_work >> stat;
+
normal = (grains[id2].sphere.point()-grains[id1].sphere.point());
normal = normal/sqrt(pow(normal.x(),2)+pow(normal.y(),2)+pow(normal.z(),2));
c->grain1 = &(grains[id1]);
@@ -248,31 +248,31 @@
}
//cout << "c_pos=" << contacts[10]->position << " old_fn=" << contacts[10]->old_fn << " normal=" << contacts[10]->normal << endl;
-
+ cout << "here0"<<endl;
//rfric = find_parameter("rfric=", Statefile);// � remettre quand les fichiers n'auront plus l'espace de trop...
- Eyn = find_parameter("Eyn=", Statefile);
- Eys = find_parameter("Eys=", Statefile);
- wszzh = find_parameter("wszzh=", Statefile);
- wsxxd = find_parameter("wsxxd=", Statefile);
- wsyyfa = find_parameter("wsyyfa=", Statefile);
- eps3 = find_parameter("eps3=", Statefile);
- eps1 = find_parameter("eps1=", Statefile);
- eps2 = find_parameter("eps2=", Statefile);
- porom = find_parameter("porom=", Statefile);
- haut = find_parameter("haut=", Statefile);
- larg = find_parameter("larg=", Statefile);
- prof = find_parameter("prof=", Statefile);
- ratio_f = find_parameter("ratio_f=", Statefile);
- vit = find_parameter("vit=", Statefile);
-
+ Eyn = find_parameter("Eyn", Statefile);
+ Eys = find_parameter("Eys", Statefile);
+ wszzh = find_parameter("wszzh", Statefile);
+ wsxxd = find_parameter("wsxxd", Statefile);
+ wsyyfa = find_parameter("wsyyfa", Statefile);
+ eps3 = find_parameter("eps3", Statefile);
+ eps1 = find_parameter("eps1", Statefile);
+ eps2 = find_parameter("eps2", Statefile);
+ porom = find_parameter("porom", Statefile);
+ haut = find_parameter("haut", Statefile);
+ larg = find_parameter("larg", Statefile);
+ prof = find_parameter("prof", Statefile);
+ ratio_f = find_parameter("ratio_f", Statefile);
+ vit = find_parameter("vit", Statefile);
Statefile.close();
- //cout << endl << "wszzh= " << wszzh << endl;
+ cout << "here1"<<endl;
+ //cout << endl << "wszzh= " << wszzh << endl;
/*GrainIterator grains_end = grains.end();
for (GrainIterator it=grains.begin(); it!=grains_end; ++it)
{
- if (it==grains.begin()) ++it;
- Vue1.Dessine_Sphere(it->sphere.x(), it->sphere.y(), it->sphere.z(), it->sphere.weight(), 10);
+ if (it==grains.begin()) ++it;
+ Vue1.Dessine_Sphere(it->sphere.x(), it->sphere.y(), it->sphere.z(), it->sphere.weight(), 10);
}*/
//Vue1.Affiche();
=== modified file 'pkg/dem/Engine/GlobalEngine/MicroMacroAnalyser.cpp'
--- pkg/dem/Engine/GlobalEngine/MicroMacroAnalyser.cpp 2010-01-11 17:18:22 +0000
+++ pkg/dem/Engine/GlobalEngine/MicroMacroAnalyser.cpp 2010-01-11 19:45:52 +0000
@@ -30,6 +30,7 @@
interval = 100;
outputFile = "MicroMacroAnalysis";
stateFileName = "./snapshots/state";
+ initialized = false;
}
void MicroMacroAnalyser::postProcessAttributes(bool deserializing)
@@ -44,7 +45,7 @@
void MicroMacroAnalyser::action(Scene* ncb)
{
//cerr << "MicroMacroAnalyser::action(Scene* ncb) (interval="<< interval <<", iteration="<< Omega::instance().getCurrentIteration()<<")" << endl;
- if (Omega::instance().getCurrentIteration() == 0) setState(ncb, 1);
+ if (!initialized) {setState(ncb, 1); initialized=true;}
else if (Omega::instance().getCurrentIteration() % interval == 0) {
setState(ncb, 2, true, true);
analyser->ComputeParticlesDeformation();
=== modified file 'pkg/dem/Engine/GlobalEngine/MicroMacroAnalyser.hpp'
--- pkg/dem/Engine/GlobalEngine/MicroMacroAnalyser.hpp 2009-12-13 19:58:33 +0000
+++ pkg/dem/Engine/GlobalEngine/MicroMacroAnalyser.hpp 2010-01-11 19:45:52 +0000
@@ -33,6 +33,7 @@
shared_ptr<CGT::KinematicLocalisationAnalyser> analyser;
std::string outputFile;
std::string stateFileName;
+ bool initialized;
public :
MicroMacroAnalyser();