yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #06900
[Branch ~yade-dev/yade/trunk] Rev 2701: As discussed on the list:
------------------------------------------------------------
revno: 2701
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>
branch nick: yade
timestamp: Mon 2011-01-31 16:29:44 +0100
message:
As discussed on the list:
- Don't update refHSize when trsf is defined
- Update it when hSize (like before) or size are assigned
- use current size in PeriEngine
- remove unneccesary cell attributes
- replace setBox by size
- update doc (atributes and header) consistently
modified:
core/Cell.hpp
pkg/dem/PeriIsoCompressor.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 'core/Cell.hpp'
--- core/Cell.hpp 2011-01-30 19:03:48 +0000
+++ core/Cell.hpp 2011-01-31 15:29:44 +0000
@@ -24,7 +24,7 @@
//! Get current size
const Vector3r& getSize() const { return _size; }
- void setSize(const Vector3r& s){for (int k=0;k<3;k++) hSize.col(k)*=s[k]/hSize.col(k).norm(); postLoad(*this);}
+ void setSize(const Vector3r& s){for (int k=0;k<3;k++) hSize.col(k)*=s[k]/hSize.col(k).norm(); refHSize=hSize; postLoad(*this);}
//! Return copy of the current size (used only by the python wrapper)
Vector3r getSize_copy() const { return _size; }
//! return vector of consines of skew angle in yz, xz, xy planes between respective transformed base vectors
@@ -99,7 +99,7 @@
void setHSize(const Matrix3r& m){ hSize=refHSize=m; trsf=Matrix3r::Identity(); postLoad(*this); }
// set current transformation; has no influence on current configuration (hSize); sets display refHSize as side-effect
Matrix3r getTrsf() const { return trsf; }
- void setTrsf(const Matrix3r& m){ refHSize=hSize; trsf=m; postLoad(*this); }
+ void setTrsf(const Matrix3r& m){ trsf=m; postLoad(*this); }
#ifdef CELL_BACKW_COMPAT
// get undeformed shape
Matrix3r getHSize0() const { return _invTrsf*hSize; }
@@ -109,8 +109,8 @@
void setRefSize(const Vector3r& s){
// if refSize is set to the current size and the cell is a box (used in older scripts), say it is not necessary
if(s==_size && hSize==hSize.diagonal().asDiagonal()){ LOG_WARN("Setting O.cell.refSize=O.cell.size is useless, O.trsf=Matrix3.Identity is enough now."); }
- else {LOG_WARN("Setting Cell.refSize is deprecated, use Cell.setBox(...) instead.");}
- setBox(s); postLoad(*this);
+ else {LOG_WARN("Setting Cell.refSize is deprecated, use O.cell.size=... instead.");}
+ setSize(s); postLoad(*this);
}
// set box shape of the cell
void setBox(const Vector3r& size){ setHSize(size.asDiagonal()); postLoad(*this); }
@@ -128,7 +128,7 @@
YADE_CLASS_BASE_DOC_ATTRS_DEPREC_INIT_CTOR_PY(Cell,Serializable,"Parameters of periodic boundary conditions. Only applies if O.isPeriodic==True.",
/* overridden below to be modified by getters/setters because of intended side-effects */
((Matrix3r,trsf,Matrix3r::Identity(),,"[overridden]")) //"Current transformation matrix of the cell, which defines how far is the current cell geometry (:yref:`hSize<Cell.hSize>`) from the reference configuration. Changing trsf will not change :yref:`hSize<Cell.hSize>`, it serves only as accumulator for transformations applied via :yref:`velGrad<Cell.velGrad>`."))
- ((Matrix3r,refHSize,Matrix3r::Identity(),,"Reference cell configuration, only used with :yref:`OpenGLRenderer.dispScale`. Updated automatically when :yref:`hSize<Cell.hSize>` or :yref:`trsf<Cell.trsf>` is assigned directly; also modified by :yref:`yade.utils.setRefSe3` (called e.g. by the :gui:`Reference` button in the UI)."))
+ ((Matrix3r,refHSize,Matrix3r::Identity(),,"Reference cell configuration, only used with :yref:`OpenGLRenderer.dispScale`. Updated automatically when :yref:`hSize<Cell.hSize>` or :yref:`hSize<Cell.size>` are assigned directly; also modified by :yref:`yade.utils.setRefSe3` (called e.g. by the :gui:`Reference` button in the UI)."))
((Matrix3r,hSize,Matrix3r::Identity(),,"[overridden below]"))
/* normal attributes */
((Matrix3r,velGrad,Matrix3r::Zero(),,"Velocity gradient of the transformation; used in :yref:`NewtonIntegrator`. Values of :yref:`velGrad<Cell.velGrad>` accumulate in :yref:`trsf<Cell.trsf>` at every step."))
@@ -141,10 +141,7 @@
// override some attributes above
.add_property("hSize",&Cell::getHSize,&Cell::setHSize,"Base cell vectors (columns of the matrix), updated at every step from :yref:`velGrad<Cell.velGrad>` (:yref:`trsf<Cell.trsf>` accumulates applied :yref:`velGrad<Cell.velGrad>` transformations). Setting *hSize* directly results in :yref:`trsf<Cell.trsf>` being set to identity.")
#ifdef CELL_BACKW_COMPAT
- .add_property("refSize",&Cell::getRefSize,&Cell::setRefSize,"Reference size of the cell (lengths of initial cell vectors, i.e. column norms of :yref:`hSize<Cell.hSize>`).\n\n.. note:: Modifying this value is deprecated, use :yref:`setBox<Cell.setBox>` instead.\n\n")
- .add_property("hSize0",&Cell::getHSize0,"Value of untransformed hSize, with respect to current :yref:`trsf<Cell.trsf>` (computed as :yref:`invTrsf<Cell.invTrsf>` Ã :yref:`hSize<Cell.hSize>`.")
- .def("setBox",&Cell::setBox,"Set :yref:`Cell` shape to be rectangular, with dimensions along axes specified by given argument. Shorthand for assigning diagonal matrix with respective entries to :yref:`hSize<Cell.hSize>`.")
- .def("setBox",&Cell::setBox3,"Set :yref:`Cell` shape to be rectangular, with dimensions along $x$, $y$, $z$ specified by arguments. Shorthand for assigning diagonal matrix with the respective entries to :yref:`hSize<Cell.hSize>`.")
+ .add_property("refSize",&Cell::getRefSize,&Cell::setRefSize,"Reference size of the cell (lengths of initial cell vectors, i.e. column norms of :yref:`hSize<Cell.hSize>`).\n\n.. note:: Modifying this value is deprecated, use :yref:`size<Cell.size>` instead.\n\n")
#endif
.add_property("trsf",&Cell::getTrsf,&Cell::setTrsf,"Current transformation matrix of the cell with regards to the initial configuration.")
// useful properties
=== modified file 'pkg/dem/PeriIsoCompressor.cpp'
--- pkg/dem/PeriIsoCompressor.cpp 2011-01-30 19:03:48 +0000
+++ pkg/dem/PeriIsoCompressor.cpp 2011-01-31 15:29:44 +0000
@@ -144,11 +144,6 @@
//FIXME : this is wrong I think (almost sure, B.)
Vector3r cellArea=Vector3r(cellSize[1]*cellSize[2],cellSize[0]*cellSize[2],cellSize[0]*cellSize[1]);
// initial updates
-#ifdef CELL_BACKW_COMPAT
- const Vector3r refSize=scene->cell->getRefSize();
-#else
- const Vector3r refSize=cellSize;
-#endif
if (maxBodySpan[0]<=0){
FOREACH(const shared_ptr<Body>& b,*scene->bodies){
if(!b || !b->bound) continue;
@@ -216,7 +211,7 @@
// take in account something like poisson's effect hereâ¦
//Real bogusPoisson=0.25; int ax1=(axis+1)%3,ax2=(axis+2)%3;
//don't modify stress if dynCell, testing only stiff[axis]>0 would not allow switching the control mode in simulations,
- if (stiff[axis]>0) stress[axis]+=(scene->cell->velGrad(axis,axis)*scene->dt/refSize[axis])*(stiff[axis]/cellArea[axis]);
+ if (stiff[axis]>0) stress[axis]+=(scene->cell->velGrad(axis,axis)*scene->dt/cellSize[axis])*(stiff[axis]/cellArea[axis]);
//-bogusPoisson*(cellGrow[ax1]/refSize[ax1])*(stiff[ax1]/cellArea[ax1])-bogusPoisson*(cellGrow[ax2]/refSize[ax2])*(stiff[ax2]/cellArea[ax2]);
}
for (int k=0;k<3;k++) strainRate[k]=scene->cell->velGrad(k,k);