yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #06075
[Branch ~yade-dev/yade/trunk] Rev 2530: - TW : really check if body geometry is sphere in the insertion loop (instead of isDynamic).
------------------------------------------------------------
revno: 2530
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>
branch nick: yade
timestamp: Wed 2010-11-03 19:11:46 +0100
message:
- TW : really check if body geometry is sphere in the insertion loop (instead of isDynamic).
- FE : use the faster insert(begin,end) from TW for triangulation, and move area/volume definition to addBoundary().
modified:
pkg/dem/FlowEngine.cpp
pkg/dem/TesselationWrapper.cpp
--
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 'pkg/dem/FlowEngine.cpp'
--- pkg/dem/FlowEngine.cpp 2010-10-20 11:28:25 +0000
+++ pkg/dem/FlowEngine.cpp 2010-11-03 18:11:46 +0000
@@ -49,17 +49,17 @@
if ( current_state==3 )
{
- if ( first ) { Build_Triangulation( P_zero );}
+ if ( first ) Build_Triangulation( P_zero );
- timingDeltas->checkpoint("Triangulating");
+ timingDeltas->checkpoint("Triangulating");
- UpdateVolumes ( );
+ UpdateVolumes ( );
- timingDeltas->checkpoint("Update_Volumes");
+ timingDeltas->checkpoint("Update_Volumes");
///Compute flow and and forces here
- if (!first) flow->GaussSeidel ( );
+ if (!first) flow->GaussSeidel ( );
timingDeltas->checkpoint("Gauss-Seidel");
if (save_mplot){int j = scene->iter;
@@ -242,6 +242,18 @@
contator+=1;
}
}
+ flow->SectionArea = ( flow->x_max - flow->x_min ) * ( flow->z_max-flow->z_min );
+ flow->Vtotale = (flow->x_max-flow->x_min) * (flow->y_max-flow->y_min) * (flow->z_max-flow->z_min);
+
+ if (flow->DEBUG_OUT) {cout << "Section area = " << flow->SectionArea << endl;
+ cout << "Vtotale = " << flow->Vtotale << endl;
+// cout << "Rmoy " << Rmoy << endl;
+ cout << "x_min = " << flow->x_min << endl;
+ cout << "x_max = " << flow->x_max << endl;
+ cout << "y_max = " << flow->y_max << endl;
+ cout << "y_min = " << flow->y_min << endl;
+ cout << "z_min = " << flow->z_min << endl;
+ cout << "z_max = " << flow->z_max << endl;}
if (flow->DEBUG_OUT) cout << "Adding Boundary------" << endl;
@@ -277,40 +289,32 @@
void FlowEngine::Triangulate ()
{
- shared_ptr<Sphere> sph ( new Sphere );
-
- int Sph_Index = sph->getClassIndexStatic();
- int contator = 0;
-
- FOREACH ( const shared_ptr<Body>& b, *scene->bodies )
- {
- if ( !b ) continue;
- if ( b->shape->getClassIndex() == Sph_Index )
- {
- Sphere* s=YADE_CAST<Sphere*> ( b->shape.get() );
- const Body::id_t& id = b->getId();
- Real rad = s->radius;
- Real x = b->state->pos[0];
- Real y = b->state->pos[1];
- Real z = b->state->pos[2];
-
- flow->T[flow->currentTes].insert(x, y, z, rad, id);
-
- contator+=1;
- }
- }
- flow->SectionArea = ( flow->x_max - flow->x_min ) * ( flow->z_max-flow->z_min );
- flow->Vtotale = (flow->x_max-flow->x_min) * (flow->y_max-flow->y_min) * (flow->z_max-flow->z_min);
-
- if (flow->DEBUG_OUT) {cout << "Section area = " << flow->SectionArea << endl;
- cout << "Vtotale = " << flow->Vtotale << endl;
-// cout << "Rmoy " << Rmoy << endl;
- cout << "x_min = " << flow->x_min << endl;
- cout << "x_max = " << flow->x_max << endl;
- cout << "y_max = " << flow->y_max << endl;
- cout << "y_min = " << flow->y_min << endl;
- cout << "z_min = " << flow->z_min << endl;
- cout << "z_max = " << flow->z_max << endl;}
+///Using Tesselation wrapper (faster)
+ TesselationWrapper TW;
+ if (TW.Tes) delete TW.Tes;
+ TW.Tes = &(flow->T[flow->currentTes]);//point to the current Tes we have in Flowengine
+ TW.insertSceneSpheres();//TW is now really inserting in FlowEngine, using the faster insert(begin,end)
+ TW.Tes = NULL;//otherwise, Tes would be deleted by ~TesselationWrapper() at the end of the function.
+///Using one-by-one insertion
+// shared_ptr<Sphere> sph ( new Sphere );
+// int Sph_Index = sph->getClassIndexStatic();
+// FOREACH ( const shared_ptr<Body>& b, *scene->bodies )
+// {
+// if ( !b ) continue;
+// if ( b->shape->getClassIndex() == Sph_Index )
+// {
+// Sphere* s=YADE_CAST<Sphere*> ( b->shape.get() );
+// const Body::id_t& id = b->getId();
+// Real rad = s->radius;
+// Real x = b->state->pos[0];
+// Real y = b->state->pos[1];
+// Real z = b->state->pos[2];
+//
+// flow->T[flow->currentTes].insert(x, y, z, rad, id);
+//
+// contator+=1;
+// }
+// }
}
void FlowEngine::Initialize_volumes ()
=== modified file 'pkg/dem/TesselationWrapper.cpp'
--- pkg/dem/TesselationWrapper.cpp 2010-11-03 16:18:49 +0000
+++ pkg/dem/TesselationWrapper.cpp 2010-11-03 18:11:46 +0000
@@ -66,8 +66,12 @@
Body::id_t Ng = 0;
Body::id_t MaxId=0;
TW.mean_radius = 0;
+
+ shared_ptr<Sphere> sph (new Sphere);
+ int Sph_Index = sph->getClassIndexStatic();
for (; bi!=biEnd ; ++bi) {
- if ((*bi)->isDynamic()) { //then it is a sphere (not a wall) FIXME : need test if isSphere
+ if ( (*bi)->shape->getClassIndex() == Sph_Index ) {
+// if ((*bi)->isDynamic()) { //then it is a sphere (not a wall) FIXME : need test if isSphere
const Sphere* s = YADE_CAST<Sphere*> ((*bi)->shape.get());
const Vector3r& pos = (*bi)->state->pos;
const Real rad = s->radius;
@@ -128,7 +132,7 @@
-TesselationWrapper::~TesselationWrapper() { delete Tes;}
+TesselationWrapper::~TesselationWrapper() { if (Tes) delete Tes;}
void TesselationWrapper::clear(void)
{