Author: eudoxos
Date: 2008-12-14 11:32:09 +0100 (Sun, 14 Dec 2008)
New Revision: 1598

Modified:
   trunk/extra/clump/Shop.cpp
   trunk/gui/py/eudoxos.py
   trunk/gui/py/yadeControl.cpp
Log:
Fix typo (compilation error in debug mode) in Shop::kineticEnergy


Modified: trunk/extra/clump/Shop.cpp
===================================================================
--- trunk/extra/clump/Shop.cpp  2008-12-12 16:04:51 UTC (rev 1597)
+++ trunk/extra/clump/Shop.cpp  2008-12-14 10:32:09 UTC (rev 1598)
@@ -140,7 +140,7 @@
        Real ret=0.;
        FOREACH(const shared_ptr<Body>& b, *rb->bodies){
                if(!b->isDynamic) continue;
-               shared_ptr<RigidBodyParameters> 
rbp=YADE_PTR_CAST<RigidBodyParameters>(b->physicalParameters); assert(pp);
+               shared_ptr<RigidBodyParameters> 
rbp=YADE_PTR_CAST<RigidBodyParameters>(b->physicalParameters); assert(rbp);
                Matrix3r 
inertiaMatrix(rbp->inertia[0],rbp->inertia[1],rbp->inertia[2]);
                // ½(mv²+ωIω)
                
ret+=.5*(rbp->mass*rbp->velocity.SquaredLength()+rbp->angularVelocity.Dot(diagMult(rbp->inertia,rbp->angularVelocity)));

Modified: trunk/gui/py/eudoxos.py
===================================================================
--- trunk/gui/py/eudoxos.py     2008-12-12 16:04:51 UTC (rev 1597)
+++ trunk/gui/py/eudoxos.py     2008-12-14 10:32:09 UTC (rev 1598)
@@ -96,6 +96,41 @@
        f.write('\n'.join(material+["%d 
%d"%(len(bodies),len(interactions))]+bodies+interactions))
        f.close()
 
+def oofemPrescribedDisplacementsExport(fileName):
+       f=open(fileName,'w')
+       f.write(fileName+'.out\n'+'''All Yade displacements prescribed as 
boundary conditions
+NonLinearStatic nsteps 2 contextOutputStep 1 rtolv 1.e-2 stiffMode 2 maxiter 
50 controllmode 1 nmodules 0
+domain 3dshell
+OutputManager tstep_all dofman_all element_all
+''')
+       inters=[i for i in O.interactions if (i.geom and i.phys)]
+       f.write("ndofman %d nelem %d ncrosssect 1 nmat 1 nbc %d nic 0 nltf 1 
nbarrier 0\n"%(len(O.bodies),len(inters),len(O.bodies)*6))
+       bcMax=0; bcMap={}
+       for b in O.bodies:
+               f.write("Particle %d coords 3 %.15e %.15e %.15e rad 
%g"%(b.id+1,b.phys['se3'][0],b.phys['se3'][1],b.phys['se3'][2],b.shape['radius']))
+               bcMap[b.id]=tuple([bcMax+i for i in [1,2,3,4,5,6]])
+               bcMax+=6
+               f.write(' bc '+' '.join([str(i) for i in bcMap[b.id]])+'\n')
+       for j,i in enumerate(inters):
+               f.write('CohSur3d %d nodes 2 %d %d mat 1 crossSect 1 area 
%g\n'%(j+1,i.id1+1,i.id2+1,i.phys['crossSection']))
+       # crosssection
+       f.write("SimpleCS 1 thick 1.0 width 1.0\n")
+       # material
+       ph=inters[0].phys
+       f.write("CohInt 1 kn %g ks %g e0 %g ef %g c 0. ksi %g coh %g tanphi %g 
d 1.0 conf 0.0 maxdist 
0.0\n"%(ph['E'],ph['G'],ph['epsCrackOnset'],ph['epsFracture'],ph['xiShear'],ph['undamagedCohesion'],ph['tanFrictionAngle']))
+       # boundary conditions
+       for b in O.bodies:
+               displ=b.phys.displ; rot=b.phys.rot
+               dofs=[displ[0],displ[1],displ[2],rot[0],rot[1],rot[2]]
+               f.write('# body #%d\n'%b.id)
+               for dof in range(6):
+                       f.write('BoundaryCondition %d loadTimeFunction 1 
prescribedvalue %.15e\n'%(bcMap[b.id][dof],dofs[dof]))
+       #f.write('PiecewiseLinFunction 1 npoints 3 t 3 0. 10. 1000.  f(t) 3 0. 
10. 1000.\n')
+       f.write('ConstantFunction 1 f(t) 1.0\n')
+
+
+
+
 def oofemDirectExport(fileBase,title=None,negIds=[],posIds=[]):
        from yade.wrapper import Omega
        material,bodies,interactions=[],[],[]

Modified: trunk/gui/py/yadeControl.cpp
===================================================================
--- trunk/gui/py/yadeControl.cpp        2008-12-12 16:04:51 UTC (rev 1597)
+++ trunk/gui/py/yadeControl.cpp        2008-12-14 10:32:09 UTC (rev 1598)
@@ -149,6 +149,8 @@
                        throw std::invalid_argument("Invalid  DOF specification 
`"+s+"', must be ∈{x,y,z,rx,ry,rz}.");
                }
        }
+       python::tuple displ_get(){Vector3r 
ret=proxee->se3.position-proxee->refSe3.position; return 
python::make_tuple(ret[0],ret[1],ret[2]);}
+       python::tuple rot_get(){Quaternionr 
relRot=proxee->refSe3.orientation.Conjugate()*proxee->se3.orientation; Vector3r 
axis; Real angle; relRot.ToAxisAngle(axis,angle); axis*=angle; return 
python::make_tuple(axis[0],axis[1],axis[2]); }
        python::tuple pos_get(){const Vector3r& p=proxee->se3.position; return 
python::make_tuple(p[0],p[1],p[2]);}
        python::tuple refPos_get(){const Vector3r& p=proxee->refSe3.position; 
return python::make_tuple(p[0],p[1],p[2]);}
        python::tuple ori_get(){Vector3r axis; Real angle; 
proxee->se3.orientation.ToAxisAngle(axis,angle); return 
python::make_tuple(axis[0],axis[1],axis[2],angle);}
@@ -619,6 +621,8 @@
                
.add_property("pos",&pyPhysicalParameters::pos_get,&pyPhysicalParameters::pos_set)
                
.add_property("ori",&pyPhysicalParameters::ori_get,&pyPhysicalParameters::ori_set)
                
.add_property("refPos",&pyPhysicalParameters::refPos_get,&pyPhysicalParameters::refPos_set)
+               .add_property("displ",&pyPhysicalParameters::displ_get)
+               .add_property("rot",&pyPhysicalParameters::rot_get)
                ;
        BASIC_PY_PROXY_WRAPPER(pyBoundingVolume,"BoundingVolume");
        BASIC_PY_PROXY_WRAPPER(pyInteractionGeometry,"InteractionGeometry");


_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to