------------------------------------------------------------ revno: 4093 committer: Anton Gladky <[email protected]> timestamp: Sat 2014-07-19 21:52:41 +0200 message: Join all Bo1_* into Bo1_Aabb removed: pkg/common/Bo1_Box_Aabb.cpp pkg/common/Bo1_Box_Aabb.hpp pkg/common/Bo1_Facet_Aabb.cpp pkg/common/Bo1_Facet_Aabb.hpp pkg/common/Bo1_Sphere_Aabb.cpp pkg/common/Bo1_Sphere_Aabb.hpp added: pkg/common/Bo1_Aabb.cpp pkg/common/Bo1_Aabb.hpp modified: pkg/dem/CapillaryTriaxialTest.cpp pkg/dem/CohesiveTriaxialTest.cpp pkg/dem/Shop_01.cpp pkg/dem/Shop_02.cpp pkg/dem/SimpleShear.cpp pkg/dem/TriaxialTest.cpp
-- lp:yade https://code.launchpad.net/~yade-pkg/yade/git-trunk Your team Yade developers is subscribed to branch lp:yade. To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== added file 'pkg/common/Bo1_Aabb.cpp' --- pkg/common/Bo1_Aabb.cpp 1970-01-01 00:00:00 +0000 +++ pkg/common/Bo1_Aabb.cpp 2014-07-19 19:52:41 +0000 @@ -0,0 +1,87 @@ +/************************************************************************* +* Copyright (C) 2004 by Olivier Galizzi * +* [email protected] * +* * +* This program is free software; it is licensed under the terms of the * +* GNU General Public License v2 or later. See file LICENSE for details. * +*************************************************************************/ + +#include <yade/pkg/common/Bo1_Aabb.hpp> + +YADE_PLUGIN((Bo1_Sphere_Aabb)(Bo1_Facet_Aabb)(Bo1_Box_Aabb)); + +void Bo1_Sphere_Aabb::go(const shared_ptr<Shape>& cm, shared_ptr<Bound>& bv, const Se3r& se3, const Body* b){ + Sphere* sphere = static_cast<Sphere*>(cm.get()); + if(!bv){ bv=shared_ptr<Bound>(new Aabb); } + Aabb* aabb=static_cast<Aabb*>(bv.get()); + Vector3r halfSize = (aabbEnlargeFactor>0?aabbEnlargeFactor:1.)*Vector3r(sphere->radius,sphere->radius,sphere->radius); + if(!scene->isPeriodic){ + aabb->min=se3.position-halfSize; aabb->max=se3.position+halfSize; + return; + } + // adjust box size along axes so that sphere doesn't stick out of the box even if sheared (i.e. parallelepiped) + if(scene->cell->hasShear()) { + Vector3r refHalfSize(halfSize); + const Vector3r& cos=scene->cell->getCos(); + for(int i=0; i<3; i++){ + //cerr<<"cos["<<i<<"]"<<cos[i]<<" "; + int i1=(i+1)%3,i2=(i+2)%3; + halfSize[i1]+=.5*refHalfSize[i1]*(1/cos[i]-1); + halfSize[i2]+=.5*refHalfSize[i2]*(1/cos[i]-1); + } + } + //cerr<<" || "<<halfSize<<endl; + aabb->min = scene->cell->unshearPt(se3.position)-halfSize; + aabb->max = scene->cell->unshearPt(se3.position)+halfSize; +} + +void Bo1_Facet_Aabb::go( const shared_ptr<Shape>& cm + , shared_ptr<Bound>& bv + , const Se3r& se3 + , const Body* b) +{ + if(!bv){ bv=shared_ptr<Bound>(new Aabb); } + Aabb* aabb=static_cast<Aabb*>(bv.get()); + Facet* facet = static_cast<Facet*>(cm.get()); + const Vector3r& O = se3.position; + Matrix3r facetAxisT=se3.orientation.toRotationMatrix(); + const vector<Vector3r>& vertices=facet->vertices; + if(!scene->isPeriodic){ + aabb->min=aabb->max = O + facetAxisT * vertices[0]; + for (int i=1;i<3;++i) + { + Vector3r v = O + facetAxisT * vertices[i]; + aabb->min = aabb->min.cwiseMin(v); + aabb->max = aabb->max.cwiseMax(v); + } + } else { + Real inf=std::numeric_limits<Real>::infinity(); + aabb->min=Vector3r(inf,inf,inf); aabb->max=Vector3r(-inf,-inf,-inf); + for(int i=0; i<3; i++){ + Vector3r v=scene->cell->unshearPt(O+facetAxisT*vertices[i]); + aabb->min=aabb->min.cwiseMin(v); + aabb->max=aabb->max.cwiseMax(v); + } + } +} + +void Bo1_Box_Aabb::go( const shared_ptr<Shape>& cm, + shared_ptr<Bound>& bv, + const Se3r& se3, + const Body* b) +{ + Box* box = static_cast<Box*>(cm.get()); + if(!bv){ bv=shared_ptr<Bound>(new Aabb); } + Aabb* aabb=static_cast<Aabb*>(bv.get()); + + if(scene->isPeriodic && scene->cell->hasShear()) throw logic_error(__FILE__ "Boxes not (yet?) supported in sheared cell."); + + Matrix3r r=se3.orientation.toRotationMatrix(); + Vector3r halfSize(Vector3r::Zero()); + for( int i=0; i<3; ++i ) + for( int j=0; j<3; ++j ) + halfSize[i] += std::abs( r(i,j) * box->extents[j] ); + + aabb->min = se3.position-halfSize; + aabb->max = se3.position+halfSize; +} === added file 'pkg/common/Bo1_Aabb.hpp' --- pkg/common/Bo1_Aabb.hpp 1970-01-01 00:00:00 +0000 +++ pkg/common/Bo1_Aabb.hpp 2014-07-19 19:52:41 +0000 @@ -0,0 +1,66 @@ +/************************************************************************* +* Copyright (C) 2004 by Olivier Galizzi * +* [email protected] * +* * +* This program is free software; it is licensed under the terms of the * +* GNU General Public License v2 or later. See file LICENSE for details. * +*************************************************************************/ + +#pragma once + +#include <yade/pkg/common/Dispatching.hpp> +#include <yade/pkg/common/Aabb.hpp> +#include <yade/pkg/common/Sphere.hpp> +#include <yade/pkg/common/Facet.hpp> +#include <yade/pkg/common/Box.hpp> + +class Bo1_Sphere_Aabb : public BoundFunctor +{ + public : + void go(const shared_ptr<Shape>& cm, shared_ptr<Bound>& bv, const Se3r&, const Body*); + FUNCTOR1D(Sphere); + YADE_CLASS_BASE_DOC_ATTRS(Bo1_Sphere_Aabb,BoundFunctor,"Functor creating :yref:`Aabb` from :yref:`Sphere`.", + ((Real,aabbEnlargeFactor,((void)"deactivated",-1),,"Relative enlargement of the bounding box; deactivated if negative.\n\n.. note::\n\tThis attribute is used to create distant interaction, but is only meaningful with an :yref:`IGeomFunctor` which will not simply discard such interactions: :yref:`Ig2_Sphere_Sphere_ScGeom::interactionDetectionFactor` should have the same value as :yref:`aabbEnlargeFactor<Bo1_Sphere_Aabb::aabbEnlargeFactor>`.")) + ); +}; + +REGISTER_SERIALIZABLE(Bo1_Sphere_Aabb); + + +/************************************************************************* +* Copyright (C) 2008 by Sergei Dorofeenko * +* [email protected] * +* * +* This program is free software; it is licensed under the terms of the * +* GNU General Public License v2 or later. See file LICENSE for details. * +*************************************************************************/ + +class Bo1_Facet_Aabb : public BoundFunctor{ + public: + void go(const shared_ptr<Shape>& cm, shared_ptr<Bound>& bv, const Se3r& se3, const Body*); + FUNCTOR1D(Facet); + YADE_CLASS_BASE_DOC(Bo1_Facet_Aabb,BoundFunctor,"Creates/updates an :yref:`Aabb` of a :yref:`Facet`."); +}; +REGISTER_SERIALIZABLE(Bo1_Facet_Aabb); + + +/************************************************************************* +* Copyright (C) 2004 by Janek Kozicki * +* [email protected] * +* * +* This program is free software; it is licensed under the terms of the * +* GNU General Public License v2 or later. See file LICENSE for details. * +*************************************************************************/ + +class Box; +class Bo1_Box_Aabb : public BoundFunctor{ + public: + void go(const shared_ptr<Shape>& cm, shared_ptr<Bound>& bv, const Se3r& se3, const Body*); + FUNCTOR1D(Box); + YADE_CLASS_BASE_DOC(Bo1_Box_Aabb,BoundFunctor,"Create/update an :yref:`Aabb` of a :yref:`Box`."); +}; + +REGISTER_SERIALIZABLE(Bo1_Box_Aabb); + + + === removed file 'pkg/common/Bo1_Box_Aabb.cpp' --- pkg/common/Bo1_Box_Aabb.cpp 2014-07-03 07:16:58 +0000 +++ pkg/common/Bo1_Box_Aabb.cpp 1970-01-01 00:00:00 +0000 @@ -1,35 +0,0 @@ -/************************************************************************* -* Copyright (C) 2004 by Olivier Galizzi * -* [email protected] * -* * -* This program is free software; it is licensed under the terms of the * -* GNU General Public License v2 or later. See file LICENSE for details. * -*************************************************************************/ - -#include "Bo1_Box_Aabb.hpp" -#include<yade/pkg/common/Box.hpp> -#include<yade/pkg/common/Aabb.hpp> - - -void Bo1_Box_Aabb::go( const shared_ptr<Shape>& cm, - shared_ptr<Bound>& bv, - const Se3r& se3, - const Body* b) -{ - Box* box = static_cast<Box*>(cm.get()); - if(!bv){ bv=shared_ptr<Bound>(new Aabb); } - Aabb* aabb=static_cast<Aabb*>(bv.get()); - - if(scene->isPeriodic && scene->cell->hasShear()) throw logic_error(__FILE__ "Boxes not (yet?) supported in sheared cell."); - - Matrix3r r=se3.orientation.toRotationMatrix(); - Vector3r halfSize(Vector3r::Zero()); - for( int i=0; i<3; ++i ) - for( int j=0; j<3; ++j ) - halfSize[i] += std::abs( r(i,j) * box->extents[j] ); - - aabb->min = se3.position-halfSize; - aabb->max = se3.position+halfSize; -} - -YADE_PLUGIN((Bo1_Box_Aabb)); === removed file 'pkg/common/Bo1_Box_Aabb.hpp' --- pkg/common/Bo1_Box_Aabb.hpp 2011-01-09 16:34:50 +0000 +++ pkg/common/Bo1_Box_Aabb.hpp 1970-01-01 00:00:00 +0000 @@ -1,24 +0,0 @@ -/************************************************************************* -* Copyright (C) 2004 by Janek Kozicki * -* [email protected] * -* * -* This program is free software; it is licensed under the terms of the * -* GNU General Public License v2 or later. See file LICENSE for details. * -*************************************************************************/ - -#pragma once - - -#include<yade/pkg/common/Dispatching.hpp> - -class Box; -class Bo1_Box_Aabb : public BoundFunctor{ - public: - void go(const shared_ptr<Shape>& cm, shared_ptr<Bound>& bv, const Se3r& se3, const Body*); - FUNCTOR1D(Box); - YADE_CLASS_BASE_DOC(Bo1_Box_Aabb,BoundFunctor,"Create/update an :yref:`Aabb` of a :yref:`Box`."); -}; - -REGISTER_SERIALIZABLE(Bo1_Box_Aabb); - - === removed file 'pkg/common/Bo1_Facet_Aabb.cpp' --- pkg/common/Bo1_Facet_Aabb.cpp 2013-03-07 18:28:01 +0000 +++ pkg/common/Bo1_Facet_Aabb.cpp 1970-01-01 00:00:00 +0000 @@ -1,43 +0,0 @@ -/************************************************************************* -* Copyright (C) 2008 by Sergei Dorofeenko * -* [email protected] * -* * -* This program is free software; it is licensed under the terms of the * -* GNU General Public License v2 or later. See file LICENSE for details. * -*************************************************************************/ - -#include <yade/pkg/common/Facet.hpp> -#include <yade/pkg/common/Bo1_Facet_Aabb.hpp> -#include <yade/pkg/common/Aabb.hpp> - -void Bo1_Facet_Aabb::go( const shared_ptr<Shape>& cm - , shared_ptr<Bound>& bv - , const Se3r& se3 - , const Body* b) -{ - if(!bv){ bv=shared_ptr<Bound>(new Aabb); } - Aabb* aabb=static_cast<Aabb*>(bv.get()); - Facet* facet = static_cast<Facet*>(cm.get()); - const Vector3r& O = se3.position; - Matrix3r facetAxisT=se3.orientation.toRotationMatrix(); - const vector<Vector3r>& vertices=facet->vertices; - if(!scene->isPeriodic){ - aabb->min=aabb->max = O + facetAxisT * vertices[0]; - for (int i=1;i<3;++i) - { - Vector3r v = O + facetAxisT * vertices[i]; - aabb->min = aabb->min.cwiseMin(v); - aabb->max = aabb->max.cwiseMax(v); - } - } else { - Real inf=std::numeric_limits<Real>::infinity(); - aabb->min=Vector3r(inf,inf,inf); aabb->max=Vector3r(-inf,-inf,-inf); - for(int i=0; i<3; i++){ - Vector3r v=scene->cell->unshearPt(O+facetAxisT*vertices[i]); - aabb->min=aabb->min.cwiseMin(v); - aabb->max=aabb->max.cwiseMax(v); - } - } -} - -YADE_PLUGIN((Bo1_Facet_Aabb)); === removed file 'pkg/common/Bo1_Facet_Aabb.hpp' --- pkg/common/Bo1_Facet_Aabb.hpp 2010-11-12 08:03:16 +0000 +++ pkg/common/Bo1_Facet_Aabb.hpp 1970-01-01 00:00:00 +0000 @@ -1,21 +0,0 @@ -/************************************************************************* -* Copyright (C) 2008 by Sergei Dorofeenko * -* [email protected] * -* * -* This program is free software; it is licensed under the terms of the * -* GNU General Public License v2 or later. See file LICENSE for details. * -*************************************************************************/ - -#pragma once - -#include <yade/pkg/common/Dispatching.hpp> - -class Bo1_Facet_Aabb : public BoundFunctor{ - public: - void go(const shared_ptr<Shape>& cm, shared_ptr<Bound>& bv, const Se3r& se3, const Body*); - FUNCTOR1D(Facet); - YADE_CLASS_BASE_DOC(Bo1_Facet_Aabb,BoundFunctor,"Creates/updates an :yref:`Aabb` of a :yref:`Facet`."); -}; -REGISTER_SERIALIZABLE(Bo1_Facet_Aabb); - - === removed file 'pkg/common/Bo1_Sphere_Aabb.cpp' --- pkg/common/Bo1_Sphere_Aabb.cpp 2010-11-07 11:46:20 +0000 +++ pkg/common/Bo1_Sphere_Aabb.cpp 1970-01-01 00:00:00 +0000 @@ -1,38 +0,0 @@ -/************************************************************************* -* Copyright (C) 2004 by Olivier Galizzi * -* [email protected] * -* * -* This program is free software; it is licensed under the terms of the * -* GNU General Public License v2 or later. See file LICENSE for details. * -*************************************************************************/ - -#include "Bo1_Sphere_Aabb.hpp" -#include<yade/pkg/common/Sphere.hpp> -#include<yade/pkg/common/Aabb.hpp> - -void Bo1_Sphere_Aabb::go(const shared_ptr<Shape>& cm, shared_ptr<Bound>& bv, const Se3r& se3, const Body* b){ - Sphere* sphere = static_cast<Sphere*>(cm.get()); - if(!bv){ bv=shared_ptr<Bound>(new Aabb); } - Aabb* aabb=static_cast<Aabb*>(bv.get()); - Vector3r halfSize = (aabbEnlargeFactor>0?aabbEnlargeFactor:1.)*Vector3r(sphere->radius,sphere->radius,sphere->radius); - if(!scene->isPeriodic){ - aabb->min=se3.position-halfSize; aabb->max=se3.position+halfSize; - return; - } - // adjust box size along axes so that sphere doesn't stick out of the box even if sheared (i.e. parallelepiped) - if(scene->cell->hasShear()) { - Vector3r refHalfSize(halfSize); - const Vector3r& cos=scene->cell->getCos(); - for(int i=0; i<3; i++){ - //cerr<<"cos["<<i<<"]"<<cos[i]<<" "; - int i1=(i+1)%3,i2=(i+2)%3; - halfSize[i1]+=.5*refHalfSize[i1]*(1/cos[i]-1); - halfSize[i2]+=.5*refHalfSize[i2]*(1/cos[i]-1); - } - } - //cerr<<" || "<<halfSize<<endl; - aabb->min = scene->cell->unshearPt(se3.position)-halfSize; - aabb->max = scene->cell->unshearPt(se3.position)+halfSize; -} - -YADE_PLUGIN((Bo1_Sphere_Aabb)); === removed file 'pkg/common/Bo1_Sphere_Aabb.hpp' --- pkg/common/Bo1_Sphere_Aabb.hpp 2012-06-28 19:34:29 +0000 +++ pkg/common/Bo1_Sphere_Aabb.hpp 1970-01-01 00:00:00 +0000 @@ -1,26 +0,0 @@ -/************************************************************************* -* Copyright (C) 2004 by Olivier Galizzi * -* [email protected] * -* * -* This program is free software; it is licensed under the terms of the * -* GNU General Public License v2 or later. See file LICENSE for details. * -*************************************************************************/ - -#pragma once - -#include<yade/pkg/common/Dispatching.hpp> -#include<yade/pkg/common/Sphere.hpp> - -class Bo1_Sphere_Aabb : public BoundFunctor -{ - public : - void go(const shared_ptr<Shape>& cm, shared_ptr<Bound>& bv, const Se3r&, const Body*); - FUNCTOR1D(Sphere); - YADE_CLASS_BASE_DOC_ATTRS(Bo1_Sphere_Aabb,BoundFunctor,"Functor creating :yref:`Aabb` from :yref:`Sphere`.", - ((Real,aabbEnlargeFactor,((void)"deactivated",-1),,"Relative enlargement of the bounding box; deactivated if negative.\n\n.. note::\n\tThis attribute is used to create distant interaction, but is only meaningful with an :yref:`IGeomFunctor` which will not simply discard such interactions: :yref:`Ig2_Sphere_Sphere_ScGeom::interactionDetectionFactor` should have the same value as :yref:`aabbEnlargeFactor<Bo1_Sphere_Aabb::aabbEnlargeFactor>`.")) - ); -}; - -REGISTER_SERIALIZABLE(Bo1_Sphere_Aabb); - - === modified file 'pkg/dem/CapillaryTriaxialTest.cpp' --- pkg/dem/CapillaryTriaxialTest.cpp 2014-07-14 20:08:34 +0000 +++ pkg/dem/CapillaryTriaxialTest.cpp 2014-07-19 19:52:41 +0000 @@ -25,8 +25,7 @@ #include<yade/pkg/common/InsertionSortCollider.hpp> #include<yade/core/Interaction.hpp> #include<yade/pkg/common/Dispatching.hpp> -#include<yade/pkg/common/Bo1_Sphere_Aabb.hpp> -#include<yade/pkg/common/Bo1_Box_Aabb.hpp> +#include<yade/pkg/common/Bo1_Aabb.hpp> #include<yade/pkg/common/GravityEngines.hpp> #include<yade/pkg/dem/NewtonIntegrator.hpp> === modified file 'pkg/dem/CohesiveTriaxialTest.cpp' --- pkg/dem/CohesiveTriaxialTest.cpp 2014-07-14 20:08:34 +0000 +++ pkg/dem/CohesiveTriaxialTest.cpp 2014-07-19 19:52:41 +0000 @@ -29,8 +29,7 @@ #include<yade/core/Body.hpp> #include<yade/pkg/common/Box.hpp> #include<yade/pkg/common/Sphere.hpp> -#include<yade/pkg/common/Bo1_Sphere_Aabb.hpp> -#include<yade/pkg/common/Bo1_Box_Aabb.hpp> +#include<yade/pkg/common/Bo1_Aabb.hpp> #include<yade/pkg/common/ForceResetter.hpp> === modified file 'pkg/dem/Shop_01.cpp' --- pkg/dem/Shop_01.cpp 2014-07-14 20:08:34 +0000 +++ pkg/dem/Shop_01.cpp 2014-07-19 19:52:41 +0000 @@ -16,8 +16,7 @@ #include"yade/pkg/dem/ViscoelasticPM.hpp" #include"yade/pkg/dem/CapillaryPhys.hpp" -#include"yade/pkg/common/Bo1_Sphere_Aabb.hpp" -#include"yade/pkg/common/Bo1_Box_Aabb.hpp" +#include"yade/pkg/common/Bo1_Aabb.hpp" #include"yade/pkg/dem/NewtonIntegrator.hpp" #include"yade/pkg/dem/Ig2_Sphere_Sphere_ScGeom.hpp" #include"yade/pkg/dem/Ig2_Box_Sphere_ScGeom.hpp" === modified file 'pkg/dem/Shop_02.cpp' --- pkg/dem/Shop_02.cpp 2014-07-14 20:08:34 +0000 +++ pkg/dem/Shop_02.cpp 2014-07-19 19:52:41 +0000 @@ -15,8 +15,7 @@ #include<yade/pkg/dem/ViscoelasticPM.hpp> #include<yade/pkg/dem/CapillaryPhys.hpp> -#include<yade/pkg/common/Bo1_Sphere_Aabb.hpp> -#include<yade/pkg/common/Bo1_Box_Aabb.hpp> +#include<yade/pkg/common/Bo1_Aabb.hpp> #include<yade/pkg/dem/NewtonIntegrator.hpp> #include<yade/pkg/dem/Ig2_Sphere_Sphere_ScGeom.hpp> #include<yade/pkg/dem/Ig2_Box_Sphere_ScGeom.hpp> === modified file 'pkg/dem/SimpleShear.cpp' --- pkg/dem/SimpleShear.cpp 2014-07-14 20:08:34 +0000 +++ pkg/dem/SimpleShear.cpp 2014-07-19 19:52:41 +0000 @@ -29,8 +29,8 @@ #include<yade/pkg/dem/Ig2_Sphere_Sphere_ScGeom.hpp> #include<yade/pkg/dem/Ig2_Box_Sphere_ScGeom.hpp> -#include<yade/pkg/common/Bo1_Sphere_Aabb.hpp> -#include<yade/pkg/common/Bo1_Box_Aabb.hpp> +#include<yade/pkg/common/Bo1_Aabb.hpp> +#include<yade/pkg/common/Bo1_Aabb.hpp> #include<yade/core/Body.hpp> #include<yade/pkg/common/Box.hpp> === modified file 'pkg/dem/TriaxialTest.cpp' --- pkg/dem/TriaxialTest.cpp 2014-07-14 20:08:34 +0000 +++ pkg/dem/TriaxialTest.cpp 2014-07-19 19:52:41 +0000 @@ -34,9 +34,7 @@ #include<yade/pkg/dem/Ig2_Sphere_Sphere_ScGeom.hpp> #include<yade/pkg/dem/Ig2_Box_Sphere_ScGeom.hpp> #include<yade/pkg/dem/Ig2_Facet_Sphere_ScGeom.hpp> -#include<yade/pkg/common/Bo1_Sphere_Aabb.hpp> -#include<yade/pkg/common/Bo1_Box_Aabb.hpp> -#include<yade/pkg/common/Bo1_Facet_Aabb.hpp> +#include<yade/pkg/common/Bo1_Aabb.hpp> #include<yade/pkg/common/Wall.hpp> #include <boost/numeric/conversion/bounds.hpp>
_______________________________________________ Mailing list: https://launchpad.net/~yade-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp

