Author: richefeu
Date: 2008-11-21 12:07:45 +0100 (Fri, 21 Nov 2008)
New Revision: 1578

Added:
   trunk/pkg/common/DataClass/InteractingGeometry/InteractingNode.cpp
   trunk/pkg/common/DataClass/InteractingGeometry/InteractingNode.hpp
   
trunk/pkg/dem/Engine/EngineUnit/InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry.cpp
   
trunk/pkg/dem/Engine/EngineUnit/InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry.hpp
Log:
- forgotten files



Added: trunk/pkg/common/DataClass/InteractingGeometry/InteractingNode.cpp
===================================================================
--- trunk/pkg/common/DataClass/InteractingGeometry/InteractingNode.cpp  
2008-11-21 11:05:06 UTC (rev 1577)
+++ trunk/pkg/common/DataClass/InteractingGeometry/InteractingNode.cpp  
2008-11-21 11:07:45 UTC (rev 1578)
@@ -0,0 +1,26 @@
+/*************************************************************************
+*  Copyright (C) 2008 by Vincent Richefeu                                *
+*  [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 "InteractingNode.hpp"
+
+InteractingNode::InteractingNode () : InteractingGeometry()
+{
+       createIndex();
+}
+
+InteractingNode::~InteractingNode ()
+{
+}
+
+void InteractingNode::registerAttributes()
+{
+       InteractingGeometry::registerAttributes();
+}
+
+
+YADE_PLUGIN("InteractingNode");

Added: trunk/pkg/common/DataClass/InteractingGeometry/InteractingNode.hpp
===================================================================
--- trunk/pkg/common/DataClass/InteractingGeometry/InteractingNode.hpp  
2008-11-21 11:05:06 UTC (rev 1577)
+++ trunk/pkg/common/DataClass/InteractingGeometry/InteractingNode.hpp  
2008-11-21 11:07:45 UTC (rev 1578)
@@ -0,0 +1,32 @@
+/*************************************************************************
+*  Copyright (C) 2008 by Vincent Richefeu                                *
+*  [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. *
+*************************************************************************/
+
+#ifndef INTERACTING_NODE_HPP
+#define INTERACTING_NODE_HPP
+
+#include<yade/core/InteractingGeometry.hpp>
+
+class InteractingNode : public InteractingGeometry
+{
+       public :
+               InteractingNode ();
+               virtual ~InteractingNode ();
+
+/// Serialization
+       protected :
+               void registerAttributes();
+       REGISTER_CLASS_NAME(InteractingNode);
+       REGISTER_BASE_CLASS_NAME(InteractingGeometry);
+
+/// Indexable
+       REGISTER_CLASS_INDEX(InteractingNode,InteractingGeometry);
+};
+
+REGISTER_SERIALIZABLE(InteractingNode,false);
+
+#endif // INTERACTING_NODE_HPP

Added: 
trunk/pkg/dem/Engine/EngineUnit/InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry.cpp
===================================================================
--- 
trunk/pkg/dem/Engine/EngineUnit/InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry.cpp
      2008-11-21 11:05:06 UTC (rev 1577)
+++ 
trunk/pkg/dem/Engine/EngineUnit/InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry.cpp
      2008-11-21 11:07:45 UTC (rev 1578)
@@ -0,0 +1,82 @@
+/*************************************************************************
+*  Copyright (C) 2008 by Vincent Richefeu                                *
+*  [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"InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry.hpp"
+#include<yade/pkg-dem/SpheresContactGeometry.hpp>
+#include<yade/pkg-common/InteractingSphere.hpp>
+#include<yade/pkg-common/BssSweptSphereLineSegment.hpp>
+
+#include<yade/lib-base/yadeWm3Extra.hpp>
+
+// BUILDING WORK !!!!
+
+bool InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry::go(
+               const shared_ptr<InteractingGeometry>& cm1,
+               const shared_ptr<InteractingGeometry>& cm2,
+               const Se3r& se31,
+  
+               const Se3r& se32,
+               const shared_ptr<Interaction>& c)
+{
+        InteractingSphere* s            = 
static_cast<InteractingSphere*>(cm1.get());
+        BssSweptSphereLineSegment* ssls = 
static_cast<BssSweptSphereLineSegment*>(cm2.get());
+        
+        Real SquaredHalfLength = 0.25 * ssls->length * ssls->length; // FIXME 
- ssls should store halfLength
+        Vector3r cc = se31.position - se32.position;
+        Vector3r proj = (cc.Dot(ssls->orientation)) * ssls->orientation; 
+     
+       if (proj.SquaredLength() < SquaredHalfLength) // Potential contact with 
the cylindrical part of ssls 
+        {
+                Vector3r ccn = cc - proj;           
+                Real ccn_dist = ccn.Normalize();
+                        
+                Real overlap = ccn_dist - s->radius - ssls->radius;
+                if (overlap <= 0.0)
+                {
+                        shared_ptr<SpheresContactGeometry> scm;
+                        if (c->isNew) scm = 
shared_ptr<SpheresContactGeometry>(new SpheresContactGeometry());
+                        else scm = 
YADE_PTR_CAST<SpheresContactGeometry>(c->interactionGeometry);
+        
+                        scm->contactPoint = se32.position + proj + 
(ssls->radius+0.5*overlap)*ccn;
+                        scm->normal = -ccn;
+                        scm->penetrationDepth = -overlap;
+                        scm->radius1 = s->radius;
+                        scm->radius2 = ssls->radius;
+                        c->interactionGeometry = scm;
+                        return true;
+                }
+                
+                return false;
+        }
+        // else ... TODO
+
+       return false;
+}
+
+
+bool 
InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry::goReverse(  
  const shared_ptr<InteractingGeometry>& cm1,
+                                               const 
shared_ptr<InteractingGeometry>& cm2,
+                                               const Se3r& se31,
+                                               const Se3r& se32,
+                                               const shared_ptr<Interaction>& 
c)
+{
+       bool isInteracting = go(cm2,cm1,se32,se31,c);
+       if (isInteracting)
+       {
+               SpheresContactGeometry* scm = 
static_cast<SpheresContactGeometry*>(c->interactionGeometry.get());
+
+                // Inverse the normal direction and swap the radii
+               scm->normal = -scm->normal;
+                Real tmpR  = scm->radius1;
+               scm->radius1 = scm->radius2;
+               scm->radius2 = tmpR;
+       }
+       return isInteracting;
+}
+
+YADE_PLUGIN("InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry");

Added: 
trunk/pkg/dem/Engine/EngineUnit/InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry.hpp
===================================================================
--- 
trunk/pkg/dem/Engine/EngineUnit/InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry.hpp
      2008-11-21 11:05:06 UTC (rev 1577)
+++ 
trunk/pkg/dem/Engine/EngineUnit/InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry.hpp
      2008-11-21 11:07:45 UTC (rev 1578)
@@ -0,0 +1,40 @@
+/*************************************************************************
+*  Copyright (C) 2008 by Vincent Richefeu                                *
+*  [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. *
+*************************************************************************/
+
+#ifndef EF2_SSLS_SPHERE_MAKE_SDECCONTACTMODEL_HPP
+#define EF2_SSLS_SPHERE_MAKE_SDECCONTACTMODEL_HPP
+
+#include<yade/pkg-common/InteractionGeometryEngineUnit.hpp>
+
+class InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry : 
public InteractionGeometryEngineUnit
+{
+       public :
+               virtual bool go(        const shared_ptr<InteractingGeometry>& 
cm1,
+                                       const shared_ptr<InteractingGeometry>& 
cm2,
+                                       const Se3r& se31,
+                                       const Se3r& se32,
+                                       const shared_ptr<Interaction>& c);
+
+               virtual bool goReverse( const shared_ptr<InteractingGeometry>& 
cm1,
+                                       const shared_ptr<InteractingGeometry>& 
cm2,
+                                       const Se3r& se31,
+                                       const Se3r& se32,
+                                       const shared_ptr<Interaction>& c);
+
+        
REGISTER_CLASS_NAME(InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry);
+       REGISTER_BASE_CLASS_NAME(InteractionGeometryEngineUnit);
+
+        FUNCTOR2D(InteractingSphere,BssSweptSphereLineSegment);
+
+        DEFINE_FUNCTOR_ORDER_2D(InteractingSphere,BssSweptSphereLineSegment);
+};
+
+REGISTER_SERIALIZABLE(InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry,false);
+
+#endif // EF2_SSLS_SPHERE_MAKE_SDECCONTACTMODEL_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

Reply via email to