Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SofaBoundaryCondition] ADD flag PROJECTVELOCITY #288

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,6 @@ struct EulerImplicit_test_2_particles_in_different_nodes_to_equilibrium : publi
mass->d_mass.setValue( 1. );


// FixedConstraint3::SPtr fixed = modeling::addNew<FixedConstraint3>(root,"fixedConstraint");
// fixed->addConstraint(0); // attach first particle

// create a child node with its own DOF
simulation::Node::SPtr child = root->createChild("childNode");
MechanicalObject<Vec3Types>::SPtr childDof = addNew<MechanicalObject<Vec3Types> >(child);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ bool SceneColladaLoader::readDAE (std::ifstream &/*file*/, const char* /*filenam
nameStream << componentIndex++;
currentFixedConstraint->setName(nameStream.str());

currentFixedConstraint->f_fixAll.setValue(true);
currentFixedConstraint->d_fixAll.setValue(true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,18 @@ void FEMGridBehaviorModel<DataTypes>::init()
m_internalNode->setGravity(this->getContext()->getGravity());
m_internalNode->setDt(this->getContext()->getDt());

constraint->f_indices.beginEdit()->clear();
constraint->d_indices.beginEdit()->clear();

for( unsigned x=0 ; x<2 ; ++x )
for( unsigned y=0 ; y<2 ; ++y )
for( unsigned z=0 ; z<2 ; ++z )
{
mapExposedInternalIndices[x+y*2+z*4] = x*(_subdivisions.getValue())+y*_subdivisions.getValue()*(_subdivisions.getValue()+1)+z*_subdivisions.getValue()*(_subdivisions.getValue()+1)*(_subdivisions.getValue()+1);
// std::cerr<<x+y*2+z*4<<" "<<mapExposedInternalIndices[x+y*2+z*4]<<std::endl;
constraint->f_indices.beginEdit()->push_back(mapExposedInternalIndices[x+y*2+z*4]);
constraint->d_indices.beginEdit()->push_back(mapExposedInternalIndices[x+y*2+z*4]);
}

constraint->f_indices.endEdit();
constraint->d_indices.endEdit();


/////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ void FixedConstraint< TYPEABSTRACTNAME3dTypes >::draw(const core::visual::Visual
{
if (!vparams->displayFlags().getShowBehaviorModels()) return;

const SetIndexArray & indices = f_indices.getValue();
const SetIndexArray & indices = d_indices.getValue();
const VecCoord& x = mstate->read(core::ConstVecCoordId::position())->getValue();

if( f_drawSize.getValue() == 0) // old classical drawing by points
if( d_drawSize.getValue() == 0) // old classical drawing by points
{
std::vector< Vector3 > points;

if( f_fixAll.getValue()==true )
if( d_fixAll.getValue()==true )
for (unsigned i=0; i<x.size(); i++ )
points.push_back(x[i].getCenter());
else
Expand All @@ -136,16 +136,16 @@ void FixedConstraint< TYPEABSTRACTNAME3dTypes >::draw(const core::visual::Visual
vparams->drawTool()->drawPoints(points, 10, Vec<4,float>(1,0.5,0.5,1));
}
else
// vparams->drawTool()->drawSpheres(points, (float)f_drawSize.getValue(), Vec<4,float>(0.2f,0.1f,0.9f,1.0f));
// vparams->drawTool()->drawSpheres(points, (float)d_drawSize.getValue(), Vec<4,float>(0.2f,0.1f,0.9f,1.0f));
{
if( f_fixAll.getValue()==true )
if( d_fixAll.getValue()==true )
for (unsigned i=0; i<x.size(); i++ )
{
vparams->drawTool()->pushMatrix();
float glTransform[16];
x[i].writeOpenGlMatrix ( glTransform );
vparams->drawTool()->multMatrix( glTransform );
vparams->drawTool()->scale ( f_drawSize.getValue() );
vparams->drawTool()->scale ( d_drawSize.getValue() );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,0,1,1) );
vparams->drawTool()->popMatrix();
}
Expand All @@ -158,7 +158,7 @@ void FixedConstraint< TYPEABSTRACTNAME3dTypes >::draw(const core::visual::Visual
float glTransform[16];
x[indices[i]].writeOpenGlMatrix ( glTransform );
vparams->drawTool()->multMatrix( glTransform );
vparams->drawTool()->scale ( f_drawSize.getValue() );
vparams->drawTool()->scale ( d_drawSize.getValue() );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,0,1,1) );
vparams->drawTool()->popMatrix();
}
Expand All @@ -168,7 +168,7 @@ void FixedConstraint< TYPEABSTRACTNAME3dTypes >::draw(const core::visual::Visual
float glTransform[16];
x[*it].writeOpenGlMatrix ( glTransform );
vparams->drawTool()->multMatrix( glTransform );
vparams->drawTool()->scale ( f_drawSize.getValue() );
vparams->drawTool()->scale ( d_drawSize.getValue() );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,0,1,1) );
vparams->drawTool()->popMatrix();
}
Expand All @@ -182,14 +182,14 @@ void FixedConstraint< TYPEABSTRACTNAME3fTypes >::draw(const core::visual::Visual
{
if (!vparams->displayFlags().getShowBehaviorModels()) return;

const SetIndexArray & indices = f_indices.getValue();
const SetIndexArray & indices = d_indices.getValue();
const VecCoord& x = mstate->read(core::ConstVecCoordId::position())->getValue();

if( f_drawSize.getValue() == 0) // old classical drawing by points
if( d_drawSize.getValue() == 0) // old classical drawing by points
{
std::vector< Vector3 > points;

if( f_fixAll.getValue()==true )
if( d_fixAll.getValue()==true )
for (unsigned i=0; i<x.size(); i++ )
points.push_back(x[i].getCenter());
else
Expand All @@ -201,16 +201,16 @@ void FixedConstraint< TYPEABSTRACTNAME3fTypes >::draw(const core::visual::Visual
vparams->drawTool()->drawPoints(points, 10, Vec<4,float>(1,0.5,0.5,1));
}
else
// vparams->drawTool()->drawSpheres(points, (float)f_drawSize.getValue(), Vec<4,float>(0.2f,0.1f,0.9f,1.0f));
// vparams->drawTool()->drawSpheres(points, (float)d_drawSize.getValue(), Vec<4,float>(0.2f,0.1f,0.9f,1.0f));
{
if( f_fixAll.getValue()==true )
if( d_fixAll.getValue()==true )
for (unsigned i=0; i<x.size(); i++ )
{
vparams->drawTool()->pushMatrix();
float glTransform[16];
x[i].writeOpenGlMatrix ( glTransform );
vparams->drawTool()->multMatrix( glTransform );
vparams->drawTool()->scale ( f_drawSize.getValue() );
vparams->drawTool()->scale ( d_drawSize.getValue() );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,0,1,1) );
vparams->drawTool()->popMatrix();
}
Expand All @@ -223,7 +223,7 @@ void FixedConstraint< TYPEABSTRACTNAME3fTypes >::draw(const core::visual::Visual
float glTransform[16];
x[indices[i]].writeOpenGlMatrix ( glTransform );
vparams->drawTool()->multMatrix( glTransform );
vparams->drawTool()->scale ( f_drawSize.getValue() );
vparams->drawTool()->scale ( d_drawSize.getValue() );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,0,1,1) );
vparams->drawTool()->popMatrix();
}
Expand All @@ -233,7 +233,7 @@ void FixedConstraint< TYPEABSTRACTNAME3fTypes >::draw(const core::visual::Visual
float glTransform[16];
x[*it].writeOpenGlMatrix ( glTransform );
vparams->drawTool()->multMatrix( glTransform );
vparams->drawTool()->scale ( f_drawSize.getValue() );
vparams->drawTool()->scale ( d_drawSize.getValue() );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,0,1,1) );
vparams->drawTool()->popMatrix();
}
Expand Down Expand Up @@ -275,14 +275,14 @@ void PartialFixedConstraint<TYPEABSTRACTNAME3dTypes>::draw(const core::visual::V
{
if (!vparams->displayFlags().getShowBehaviorModels()) return;

const SetIndexArray & indices = f_indices.getValue();
const SetIndexArray & indices = d_indices.getValue();
const VecCoord& x = mstate->read(core::ConstVecCoordId::position())->getValue();

if( _drawSize.getValue() == 0) // old classical drawing by points
if( d_drawSize.getValue() == 0) // old classical drawing by points
{
std::vector< Vector3 > points;

if( f_fixAll.getValue()==true )
if( d_fixAll.getValue()==true )
for (unsigned i=0; i<x.size(); i++ )
points.push_back(x[i].getCenter());
else
Expand All @@ -294,16 +294,16 @@ void PartialFixedConstraint<TYPEABSTRACTNAME3dTypes>::draw(const core::visual::V
vparams->drawTool()->drawPoints(points, 10, Vec<4,float>(1,0.5,0.5,1));
}
else
// vparams->drawTool()->drawSpheres(points, (float)f_drawSize.getValue(), Vec<4,float>(0.2f,0.1f,0.9f,1.0f));
// vparams->drawTool()->drawSpheres(points, (float)d_drawSize.getValue(), Vec<4,float>(0.2f,0.1f,0.9f,1.0f));
{
if( f_fixAll.getValue()==true )
if( d_fixAll.getValue()==true )
for (unsigned i=0; i<x.size(); i++ )
{
vparams->drawTool()->pushMatrix();
float glTransform[16];
x[i].writeOpenGlMatrix ( glTransform );
vparams->drawTool()->multMatrix( glTransform );
vparams->drawTool()->scale ( _drawSize.getValue() );
vparams->drawTool()->scale ( d_drawSize.getValue() );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,0,1,1) );
vparams->drawTool()->popMatrix();
}
Expand All @@ -316,7 +316,7 @@ void PartialFixedConstraint<TYPEABSTRACTNAME3dTypes>::draw(const core::visual::V
float glTransform[16];
x[indices[i]].writeOpenGlMatrix ( glTransform );
vparams->drawTool()->multMatrix( glTransform );
vparams->drawTool()->scale ( _drawSize.getValue() );
vparams->drawTool()->scale ( d_drawSize.getValue() );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,0,1,1) );
vparams->drawTool()->popMatrix();
}
Expand All @@ -326,7 +326,7 @@ void PartialFixedConstraint<TYPEABSTRACTNAME3dTypes>::draw(const core::visual::V
float glTransform[16];
x[*it].writeOpenGlMatrix ( glTransform );
vparams->drawTool()->multMatrix( glTransform );
vparams->drawTool()->scale ( _drawSize.getValue() );
vparams->drawTool()->scale ( d_drawSize.getValue() );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,0,1,1) );
vparams->drawTool()->popMatrix();
}
Expand All @@ -340,14 +340,14 @@ void PartialFixedConstraint<TYPEABSTRACTNAME3fTypes>::draw(const core::visual::V
{
if (!vparams->displayFlags().getShowBehaviorModels()) return;

const SetIndexArray & indices = f_indices.getValue();
const SetIndexArray & indices = d_indices.getValue();
const VecCoord& x = mstate->read(core::ConstVecCoordId::position())->getValue();

if( _drawSize.getValue() == 0) // old classical drawing by points
if( d_drawSize.getValue() == 0) // old classical drawing by points
{
std::vector< Vector3 > points;

if( f_fixAll.getValue()==true )
if( d_fixAll.getValue()==true )
for (unsigned i=0; i<x.size(); i++ )
points.push_back(x[i].getCenter());
else
Expand All @@ -359,16 +359,16 @@ void PartialFixedConstraint<TYPEABSTRACTNAME3fTypes>::draw(const core::visual::V
vparams->drawTool()->drawPoints(points, 10, Vec<4,float>(1,0.5,0.5,1));
}
else
// vparams->drawTool()->drawSpheres(points, (float)f_drawSize.getValue(), Vec<4,float>(0.2f,0.1f,0.9f,1.0f));
// vparams->drawTool()->drawSpheres(points, (float)d_drawSize.getValue(), Vec<4,float>(0.2f,0.1f,0.9f,1.0f));
{
if( f_fixAll.getValue()==true )
if( d_fixAll.getValue()==true )
for (unsigned i=0; i<x.size(); i++ )
{
vparams->drawTool()->pushMatrix();
float glTransform[16];
x[i].writeOpenGlMatrix ( glTransform );
vparams->drawTool()->multMatrix( glTransform );
vparams->drawTool()->scale ( _drawSize.getValue() );
vparams->drawTool()->scale ( d_drawSize.getValue() );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,0,1,1) );
vparams->drawTool()->popMatrix();
}
Expand All @@ -381,7 +381,7 @@ void PartialFixedConstraint<TYPEABSTRACTNAME3fTypes>::draw(const core::visual::V
float glTransform[16];
x[indices[i]].writeOpenGlMatrix ( glTransform );
vparams->drawTool()->multMatrix( glTransform );
vparams->drawTool()->scale ( _drawSize.getValue() );
vparams->drawTool()->scale ( d_drawSize.getValue() );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,0,1,1) );
vparams->drawTool()->popMatrix();
}
Expand All @@ -391,7 +391,7 @@ void PartialFixedConstraint<TYPEABSTRACTNAME3fTypes>::draw(const core::visual::V
float glTransform[16];
x[*it].writeOpenGlMatrix ( glTransform );
vparams->drawTool()->multMatrix( glTransform );
vparams->drawTool()->scale ( _drawSize.getValue() );
vparams->drawTool()->scale ( d_drawSize.getValue() );
vparams->drawTool()->drawFrame ( Vector3(), Quat(), Vector3 ( 1,1,1 ), Vec4f(0,0,1,1) );
vparams->drawTool()->popMatrix();
}
Expand Down
Loading