Skip to content

Commit

Permalink
[kernel] Change the interafce of computeJachqT from
Browse files Browse the repository at this point in the history
	 virtual void computeJachqT(Interaction& inter, SP::DynamicalSystem ds1, SP::DynamicalSystem ds2);

	 to

	 virtual void computeJachqT(Interaction& inter, VectorOfBlockVectors& DSlink );

	 The interface is now coherent with
	 virtual void computeJachqT(Interaction& inter, VectorOfBlockVectors& DSlink );
	 and allows a single call to
	 virtual void computeJach(double time, Interaction& inter, InteractionProperties& interProp);
	 throughout the code. The other calls with test on the type of relation are removed

	 This change asks for the deeper question of the evaluation of of the relation. This is done
	 mainly through computeOutput and computeInput. The new interface ensures that the value of q
	 is the same for all the invocation in the computation of computeJacqT. For a given q, we compute

	 JachqT(q) = Jach(q)T(q)
	 Before we had something as

	 JachqT(q) = Jach(d->q()) d->T()
	 end the values of  Jach(d->q()) d->T() was not coherent.

	 Now it is coherent but it might raise the convergence problem in the Newton loop since the gradient of T
	 are not computed. We need to think  in a more "functional" way all these calls
  • Loading branch information
vacary committed Apr 15, 2016
1 parent aaf9f80 commit 13531b7
Show file tree
Hide file tree
Showing 14 changed files with 280 additions and 221 deletions.
18 changes: 5 additions & 13 deletions kernel/src/modelingTools/NewtonEulerFrom1DLocalFrameR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ void NewtonEulerFrom1DLocalFrameR::initComponents(Interaction& inter, VectorOfBl
//proj_with_q _jachqProj.reset(new SimpleMatrix(_jachq->size(0),_jachq->size(1)));
unsigned int qSize = 7 * (inter.getSizeOfDS() / 6);
_jachq.reset(new SimpleMatrix(1, qSize));



/* VA 12/04/2016 All of what follows should be put in WorkM*/
_Mabs_C.reset(new SimpleMatrix(1, 3));
_MObjToAbs.reset(new SimpleMatrix(3, 3));
_AUX1.reset(new SimpleMatrix(3, 3));
Expand Down Expand Up @@ -255,19 +259,7 @@ void NewtonEulerFrom1DLocalFrameR::computeJachq(double time, Interaction& inter,
DEBUG_END("NewtonEulerFrom1DLocalFrameR::computeJachq(double time, Interaction& inter, ...) \n");

}
void NewtonEulerFrom1DLocalFrameR::computeJachqT(Interaction& inter, SP::DynamicalSystem ds1, SP::DynamicalSystem ds2)
{
SP::NewtonEulerDS d1 = std11::static_pointer_cast<NewtonEulerDS> (ds1);
SP::NewtonEulerDS d2 = std11::static_pointer_cast<NewtonEulerDS> (ds2);
if(d1 != d2)
{
NIcomputeJachqTFromContacts(d1->q(), d2->q());
}
else
{
NIcomputeJachqTFromContacts(d1->q());
}
}


void NewtonEulerFrom1DLocalFrameR::computeJachqT(Interaction& inter, VectorOfBlockVectors& DSlink)
{
Expand Down
12 changes: 9 additions & 3 deletions kernel/src/modelingTools/NewtonEulerFrom1DLocalFrameR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class NewtonEulerFrom1DLocalFrameR : public NewtonEulerR

/*Matrix converting the absolute coordinate to the contact coordinate.*/
SP::SimpleMatrix _Mabs_C;
/*Matrix converting .*/
/* Matrix converting */
SP::SimpleMatrix _MObjToAbs;
/*cross product matrices*/
SP::SimpleMatrix _NPG1;
Expand Down Expand Up @@ -96,9 +96,15 @@ class NewtonEulerFrom1DLocalFrameR : public NewtonEulerR
virtual ~NewtonEulerFrom1DLocalFrameR() {};

virtual void computeJachq(double time, Interaction& inter, VectorOfBlockVectors& DSlink);
virtual void computeJachqT(Interaction& inter, SP::DynamicalSystem ds1, SP::DynamicalSystem ds2);

/* Default implementation consists in multiplying jachq and T (see NewtonEulerR::computeJachqT)
* but here we compute the operator from the the contact point locations
* and the local frame at contact
* \param inter interaction that owns the relation
* \param DSlink the container of the link to DynamicalSystem attributes
*/
virtual void computeJachqT(Interaction& inter, VectorOfBlockVectors& DSlink );

inline SP::SiconosVector pc1() const
{
return _Pc1;
Expand Down
24 changes: 1 addition & 23 deletions kernel/src/modelingTools/NewtonEulerFrom3DLocalFrameR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ void NewtonEulerFrom3DLocalFrameR::initComponents(Interaction& inter, VectorOfBl
_jachq.reset(new SimpleMatrix(3, qSize));


/* VA 12/04/2016 All of what follows shoudl be put in WorkM*/
_Mabs_C.reset(new SimpleMatrix(3, 3));
_MObjToAbs.reset(new SimpleMatrix(3, 3));

_AUX2.reset(new SimpleMatrix(3, 3));
// _isContact=1;
}
Expand Down Expand Up @@ -264,26 +262,6 @@ void NewtonEulerFrom3DLocalFrameR::FC3DcomputeJachqTFromContacts(SP::SiconosVect

}

void NewtonEulerFrom3DLocalFrameR::computeJachqT(Interaction& inter, SP::DynamicalSystem ds1, SP::DynamicalSystem ds2)
{

DEBUG_BEGIN("NewtonEulerFrom3DLocalFrameR::computeJachqT(Interaction& inter, SP::DynamicalSystem ds1, SP::DynamicalSystem ds2)\n");
SP::NewtonEulerDS d1 = std11::static_pointer_cast<NewtonEulerDS> (ds1);
SP::NewtonEulerDS d2 = std11::static_pointer_cast<NewtonEulerDS> (ds2);


if(d1 != d2)
FC3DcomputeJachqTFromContacts(d1->q(), d2->q());

else
{
FC3DcomputeJachqTFromContacts(d1->q());
}
DEBUG_END("NewtonEulerFrom3DLocalFrameR::computeJachqT(Interaction& inter, SP::DynamicalSystem ds1, SP::DynamicalSystem ds2)\n");

}


void NewtonEulerFrom3DLocalFrameR::computeJachqT(Interaction& inter, VectorOfBlockVectors& DSlink)
{
DEBUG_BEGIN("NewtonEulerFrom3DLocalFrameR::computeJachqT(Interaction& inter, VectorOfBlockVectors& DSlink) \n")
Expand Down
14 changes: 8 additions & 6 deletions kernel/src/modelingTools/NewtonEulerFrom3DLocalFrameR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,16 @@ class NewtonEulerFrom3DLocalFrameR : public NewtonEulerFrom1DLocalFrameR
/** destructor
*/
virtual ~NewtonEulerFrom3DLocalFrameR() {};
/* Default implementation consists in multiplying jachq and T
* \param inter
* \param ds1
* \param ds2


/* Default implementation consists in multiplying jachq and T (see NewtonEulerR::computeJachqT)
* but here we compute the operator from the the contact point locations
* and the local frame at contact
* \param inter interaction that owns the relation
* \param DSlink the container of the link to DynamicalSystem attributes
*/
virtual void computeJachqT(Interaction& inter, SP::DynamicalSystem ds1, SP::DynamicalSystem ds2);
virtual void computeJachqT(Interaction& inter, VectorOfBlockVectors& DSlink);

ACCEPT_STD_VISITORS();
};
#endif // NEWTONEULERRELATIONFC3D_H

0 comments on commit 13531b7

Please sign in to comment.