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

[all] Remove SOFA_FLOAT (all steps) #853

Merged
merged 64 commits into from
Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
89b82c6
[SofaGeneralEngine] Prepare SOFA_FLOAT removal.
damienmarchal Dec 4, 2018
56247f9
[modules] Remove SOFA_FLOAT
damienmarchal Dec 4, 2018
01bd5fb
[plugins/] Remove SOFA_FLOAT in SceneCreator & SofaTest
damienmarchal Dec 4, 2018
02aecb8
[plugins] Remove SOFA_FLOAT in SofaSphFuild, VolumetricRendering & Mu…
damienmarchal Dec 4, 2018
9bef950
Merge remote-tracking branch 'upstream/master' into sofaStc7
damienmarchal Dec 5, 2018
47bf236
[SofaSPHFluid] Fix missing typedef.
damienmarchal Dec 5, 2018
be532de
Merge remote-tracking branch 'upstream/master' into sofaStc7
damienmarchal Dec 10, 2018
1b174f7
[Compliant] Minimal change to prepare SOFA_FLOAT removal.
damienmarchal Dec 10, 2018
68e1ada
[ExternalBehaviorModel] Minimal update to make it compile without SOF…
damienmarchal Dec 10, 2018
96c833a
[runSofa] REMOVE SOFA_FLOAT.
damienmarchal Dec 11, 2018
38742c8
[SofaMiscMapping] FIX duplicated CenterOfMassMapping registration in …
damienmarchal Dec 11, 2018
cdd0eed
[SofaBaseLinearSolver] Fix test to remove SOFA_FLOAT specific cases.
damienmarchal Dec 11, 2018
99fd7ea
[SofaRigid] Fix QuaternionIntergration_test to handle SOFA_FLOAT remo…
damienmarchal Dec 11, 2018
af43698
VecTypes, unify
damienmarchal Dec 12, 2018
3797483
Vec.h, unify
damienmarchal Dec 12, 2018
8fb4ac4
RigidTypes, unify
damienmarchal Dec 12, 2018
4e9c51e
RigidTypes, unify
damienmarchal Dec 12, 2018
0e06fdb
[YEAH] Caduceus works, no more shitty float :)
damienmarchal Dec 12, 2018
bfc4198
[SceneColladaLoader] replace ExtVec3f to ExtVec3
damienmarchal Dec 13, 2018
5f4169c
Merge remote-tracking branch 'upstream/master' into sofaStc7
damienmarchal Dec 13, 2018
3a5b3d2
[Flexible] Prepare for SOFA_FLOAT removal.
damienmarchal Dec 13, 2018
3580566
[image] Prepare for SOFA_FLOAT removal.
damienmarchal Dec 13, 2018
decdcdd
[tutorials] oneTetraheddron SOFA_FLOAT removal.
damienmarchal Dec 13, 2018
368b4ee
[SofaKernel] Dirty Fix for TemplateAliases.
damienmarchal Dec 13, 2018
70ea684
[Flexible] Remove SOFA_FLOAT.
damienmarchal Dec 13, 2018
eb948ec
[SofaKernel] Make Rigid3 StiffSpringForceField + Update AttachBodyPer…
damienmarchal Dec 14, 2018
2f5b4ab
[all] Remove //SOFA_FLOAT and // SOFA_FLOAT
damienmarchal Dec 14, 2018
d57bcbf
[SofaKernel] Remove SOFA_FLOAT Mat.h, Quat.h RigidTypes.h
damienmarchal Dec 14, 2018
9255495
[Compliant] Remove last SOFA_FLOAT
damienmarchal Dec 14, 2018
5431c29
[MultiThreading] Remove SOFA_FLOAT
damienmarchal Dec 14, 2018
db1c9d0
[ManifoldTopoloies] Remove SOFA_FLOAT
damienmarchal Dec 14, 2018
577f838
[images] Remove SOFA_FLOAT
damienmarchal Dec 14, 2018
d85889e
[modules] Remove SOFA_FLOAT
damienmarchal Dec 14, 2018
3128083
[runSofa] Remove SOFA_FLOAT in TableDataWidget.cpp
damienmarchal Dec 14, 2018
86c16af
[SofaMiscTopology] Replace Real with SReal because of SOFA_FLOAT
damienmarchal Dec 14, 2018
4e6a88f
[SofaKernel] Mapping Remove duplicated code.
damienmarchal Dec 14, 2018
cf956a9
[SofaGeneralEngine] Remove commented code about SOFA_FLOAT.
damienmarchal Dec 14, 2018
ac8e35d
[all] Remove commented ///SOFA_WITH_DOUBLE
damienmarchal Dec 14, 2018
e77f1af
[SofaKernel] Add join & split string in stringUtils.h
damienmarchal Dec 17, 2018
5769b03
[SofaKernel] Add way to report the use of template aliases in ObjectF…
damienmarchal Dec 17, 2018
841c22d
[SofaKernel] Refactor a bit TemplateAlias & add tests.
damienmarchal Dec 17, 2018
345b68f
[Flexible] Use TemplateAlias to handle the SOFA_FLOAT.
damienmarchal Dec 17, 2018
0772cf6
[SofaKernel] Fix invalid printing of error messages and remove commen…
damienmarchal Dec 18, 2018
aa00e5e
[SofaKernel] Add ExtVec3f&ExtVec3d template aliases.
damienmarchal Dec 18, 2018
5082082
[SofaKernel@ Update TemplateAliase_test.cpp so it match the API.
damienmarchal Dec 18, 2018
b4b247b
[Flexible] Fix bug & unify the types because of SOFA_FLOAT removal.
damienmarchal Dec 18, 2018
daeb40b
[Flexible] Remove a lot of commented code.
damienmarchal Dec 18, 2018
b4bbdb9
[Flexible] Fix invalid name introduced when removing SOFA_FLOAT
damienmarchal Dec 18, 2018
f2cfb3a
[Flexible] Remove commented code.
damienmarchal Dec 18, 2018
00d683b
[SofaPython] Update TODO
damienmarchal Dec 18, 2018
03a5660
[Compliant] Set a default template for RigidMass.
damienmarchal Dec 18, 2018
e31b4f0
[SofaKernel] Add more info in ObjectFactory's message when unable to …
damienmarchal Dec 18, 2018
ad1c2bc
[Compliant] Remove SOFA_EXTERN_TEMPLATE in compliant.
damienmarchal Dec 18, 2018
ba40ece
[SofaKernel] Replace serr with msg_warning.
damienmarchal Dec 18, 2018
26ff507
[Compliant] Restore the commented code in StucturalAPI.py (it was rem…
damienmarchal Dec 18, 2018
32906fa
[SofaKernel] Fix bug in ObjectFactory::createObject
damienmarchal Dec 18, 2018
1b962d1
[SofaKernel] Add a compile time mechanisme TemplateAliases precision …
damienmarchal Dec 18, 2018
d4d5272
[Flexible] Remove commented code.
damienmarchal Dec 18, 2018
7bd637a
[Flexible] Proper type implementation and aliasing to unify with the …
damienmarchal Dec 18, 2018
8951b33
[SofaKernel] Unify Mat, Vec & VecTypes.
damienmarchal Dec 18, 2018
d16d691
[SofaTest] Remove ambiguous typedef.
damienmarchal Dec 19, 2018
590d6eb
[SceneCreator] Fix ambiguous Vec3 in SceneCreator.h
damienmarchal Dec 19, 2018
0511a4e
Merge remote-tracking branch 'upstream/master' into sofaStc7
damienmarchal Dec 19, 2018
a8ba013
[SofaKernel] Clean of IdleEvent
damienmarchal Dec 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/** Sparse matrix test suite.
*
* The same suite is instanciated using different parameters: entry types
* (float/double) and BlockMN size in CompressedRowSparse.
* (float/Real) and BlockMN size in CompressedRowSparse.
damienmarchal marked this conversation as resolved.
Show resolved Hide resolved
*/

#include <SofaTest/Sofa_test.h>
Expand All @@ -47,14 +47,14 @@
#if BENCHMARK_MATRIX_PRODUCT
#include <ctime>
using sofa::helper::system::thread::CTime;
double get_time() {
Real get_time() {
CTime * timer;
return (double) timer->getTime();
return (Real) timer->getTime();
}
#endif


namespace sofa {
namespace sofa
{


/** Sparse matrix test suite.
Expand Down Expand Up @@ -244,7 +244,7 @@ struct TestSparseMatrices : public Sofa_test<_Real>
a.beginRow(i);
for( unsigned j=0; j<NCOLS; j++)
{
double valij = i*NCOLS+j;
Real valij = i*NCOLS+j;
a.insertBack(i,j,valij);
if( i==j )
b.add(i,j,valij);
Expand All @@ -253,21 +253,17 @@ struct TestSparseMatrices : public Sofa_test<_Real>
a.compress();
b.compress();

// cerr<<"MatrixTest<Real,RN,CN>::checkEigenMatrixUpdate, a = " << a << endl;
// cerr<<"MatrixTest<Real,RN,CN>::checkEigenMatrixUpdate, b incomplete = " << b << endl;

// second pass for b. Some values are set with the right value, some with the wrong value, some are not set
for( unsigned j=0; j<NCOLS; j++)
{
for( unsigned i=0; i<NROWS; i++)
{
double valij = i*NCOLS+j;
Real valij = i*NCOLS+j;
if( i!=j )
b.add(i,j,valij);
}
}
b.compress();
// cerr<<"MatrixTest<Real,RN,CN>::checkEigenMatrixUpdate, b complete = " << b << endl;
return Sofa_test<_Real>::matrixMaxDiff(a,b) < 100 * Sofa_test<_Real>::epsilon();
}

Expand All @@ -279,11 +275,7 @@ struct TestSparseMatrices : public Sofa_test<_Real>
unsigned br=3, bc=3;
ma.resize(br*BROWS,bc*BCOLS);




// building with unordered blocks

mb.resizeBlocks(br,bc);
for( unsigned i=0; i<br; i++ )
{
Expand All @@ -307,15 +299,8 @@ struct TestSparseMatrices : public Sofa_test<_Real>
}
mb.compress();


// serr()<<"MatrixTest<Real,RN,CN>::checkEigenMatrixBlockRowFilling, ma = " << ma << endl;
// serr()<<"MatrixTest<Real,RN,CN>::checkEigenMatrixBlockRowFilling, mb = " << mb << endl;
ASSERT_TRUE( Sofa_test<_Real>::matrixMaxDiff(ma,mb) < 100*Sofa_test<_Real>::epsilon() );





// building with ordered blocks

mb.resizeBlocks(br,bc);
Expand Down Expand Up @@ -404,10 +389,6 @@ struct TestSparseMatrices : public Sofa_test<_Real>

bool checkEigenMatrixBlockFromCompressedRowSparseMatrix()
{
// if( !matricesAreEqual(crs1,eiBlock3)){
// cout<<"heckEigenMatrixBlockFromCompressedRowSparseMatrix, crs1 = " << crs1 << endl;
// cout<<"heckEigenMatrixBlockFromCompressedRowSparseMatrix, eiBlock3 = " << eiBlock3 << endl;
// }
return Sofa_test<_Real>::matrixMaxDiff(crs1,eiBlock3) < 100*Sofa_test<_Real>::epsilon();
}

Expand All @@ -425,48 +406,47 @@ struct TestSparseMatrices : public Sofa_test<_Real>
}
};

#ifndef SOFA_FLOAT
///////////////////
// double precision
// Real precision
///////////////////
// trivial blocs
typedef TestSparseMatrices<double,4,8,4,8> Ts4848;
typedef TestSparseMatrices<SReal,4,8,4,8> Ts4848;
#define TestMatrix Ts4848
#include "Matrix_test.inl"
#undef TestMatrix

//// semi-trivial blocs
typedef TestSparseMatrices<double,4,8,4,2> Ts4842;
typedef TestSparseMatrices<SReal,4,8,4,2> Ts4842;
#define TestMatrix Ts4842
#include "Matrix_test.inl"
#undef TestMatrix

typedef TestSparseMatrices<double,4,8,1,8> Ts4818;
typedef TestSparseMatrices<SReal,4,8,1,8> Ts4818;
#define TestMatrix Ts4818
#include "Matrix_test.inl"
#undef TestMatrix

// well-fitted blocs
typedef TestSparseMatrices<double,4,8,2,2> Ts4822;
typedef TestSparseMatrices<SReal,4,8,2,2> Ts4822;
#define TestMatrix Ts4822
#include "Matrix_test.inl"
#undef TestMatrix

/// not fitted blocs
//typedef TestSparseMatrices<double,4,8,2,3> Ts4823;
//typedef TestSparseMatrices<Real,4,8,2,3> Ts4823;
//#define TestMatrix Ts4823
//#include "Matrix_test.inl"
//#undef TestMatrix


#if BENCHMARK_MATRIX_PRODUCT
///// product timing
typedef TestSparseMatrices<double,360,300,3,3> TsProductTimings;
typedef TestSparseMatrices<Real,360,300,3,3> TsProductTimings;
TEST_F(TsProductTimings, benchmark )
{
msg_info()<<"=== Matrix-Matrix Products:"<<std::endl;

double start, stop;
Real start, stop;

matMultiplication.clear();
start = get_time();
Expand Down Expand Up @@ -541,13 +521,13 @@ TEST_F(TsProductTimings, benchmark )
}
}

double min=std::numeric_limits<double>::max(), max=0, sum=0;
Real min=std::numeric_limits<Real>::max(), max=0, sum=0;
for( int i=0; i<100 ; ++i )
{
start = get_time();
res.noalias() = A * rhs;
stop = get_time();
double current = stop-start;
Real current = stop-start;
sum+=current;
if( current<min ) min=current;
if( current>max ) max=current;
Expand All @@ -558,15 +538,15 @@ TEST_F(TsProductTimings, benchmark )


#ifdef _OPENMP
min=std::numeric_limits<double>::max(), max=0, sum=0;
min=std::numeric_limits<Real>::max(), max=0, sum=0;
for( int i=0; i<100 ; ++i )
{
start = get_time();
// res.noalias() = typename Eigen::SparseDenseProductReturnType_MT<Eigen::SparseMatrix<SReal,Eigen::RowMajor>,Eigen::Matrix<SReal, Eigen::Dynamic, 1> >::Type( A.derived(), rhs.derived() );
// component::linearsolver::mul_EigenSparseDenseMatrix_MT( res, A, rhs );
res.noalias() = component::linearsolver::mul_EigenSparseDenseMatrix_MT( A, rhs );
stop = get_time();
double current = stop-start;
Real current = stop-start;
sum+=current;
if( current<min ) min=current;
if( current>max ) max=current;
Expand All @@ -582,36 +562,4 @@ TEST_F(TsProductTimings, benchmark )

#endif

#endif

#ifndef SOFA_DOUBLE
///////////////////
// simple precision
// The macro EIGEN_DONT_ALIGN is needed for float on windows
///////////////////
// trivial blocs
typedef TestSparseMatrices<float,4,8,4,8> Ts4848f;
#define TestMatrix Ts4848f
#include "Matrix_test.inl"
#undef TestMatrix

// semi-trivial blocs
typedef TestSparseMatrices<float,4,8,4,2> Ts4842f;
#define TestMatrix Ts4842f
#include "Matrix_test.inl"
#undef TestMatrix

typedef TestSparseMatrices<float,4,8,1,8> Ts4818f;
#define TestMatrix Ts4818f
#include "Matrix_test.inl"
#undef TestMatrix

/// well-fitted blocs
typedef TestSparseMatrices<float,4,8,2,2> Ts4822f;
#define TestMatrix Ts4822f
#include "Matrix_test.inl"
#undef TestMatrix

#endif

}// namespace sofa
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ struct QuaternionIntegrationTest : Sofa_test< typename Rigid3Types::Real > {

const real expected_angle = dt * deriv.getVOrientation().norm();

// std::clog << expected_angle << " " << angle << std::endl;

// child coordinates given directly in parent frame
ASSERT_TRUE(this->isSmall(expected_angle - angle, 10));
}
Expand All @@ -73,19 +71,7 @@ struct QuaternionIntegrationTest : Sofa_test< typename Rigid3Types::Real > {

// Define the list of types to instanciate. We do not necessarily need to test all combinations.
using testing::Types;
typedef Types<
#ifndef SOFA_FLOAT
defaulttype::Rigid3dTypes
#endif
#ifndef SOFA_FLOAT
#ifndef SOFA_DOUBLE
,
#endif
#endif
#ifndef SOFA_DOUBLE
defaulttype::Rigid3fTypes
#endif
> DataTypes; // the types to instanciate.
typedef Types<defaulttype::Rigid3Types> DataTypes; // the types to instanciate.

// Test suite for all the instanciations
TYPED_TEST_CASE(QuaternionIntegrationTest, DataTypes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,70 +32,18 @@ namespace sofa
{
using namespace component::collision;

namespace gui
{
//*******************************************************************************************
//void CompliantAttachOperation::start()
//{
// //Creation
// performer=component::collision::InteractionPerformer::InteractionPerformerFactory::getInstance()->createObject("CompliantAttach", pickHandle->getInteraction()->mouseInteractor.get());
// pickHandle->getInteraction()->mouseInteractor->addInteractionPerformer(performer);
// configurePerformer(performer);
// //Start
// performer->start();
//}

//void CompliantAttachOperation::execution()
//{
// //do nothing
//}

//void CompliantAttachOperation::end()
//{
// pickHandle->getInteraction()->mouseInteractor->removeInteractionPerformer(performer);
// delete performer; performer=0;
//}

//void CompliantAttachOperation::endOperation()
//{
// pickHandle->getInteraction()->mouseInteractor->removeInteractionPerformer(performer);
//}


//void CompliantAttachOperation::configurePerformer(sofa::component::collision::InteractionPerformer* p)
//{
// Operation::configurePerformer(p);
//}


}// gui


namespace component
{

namespace collision
{

#ifndef SOFA_DOUBLE
template class SOFA_Compliant_gui_API CompliantAttachPerformer<defaulttype::Vec3fTypes>;
template class SOFA_Compliant_gui_API CompliantAttachPerformer<defaulttype::Rigid3fTypes>;
#endif
#ifndef SOFA_FLOAT
template class SOFA_Compliant_gui_API CompliantAttachPerformer<defaulttype::Vec3dTypes>;
template class SOFA_Compliant_gui_API CompliantAttachPerformer<defaulttype::Rigid3dTypes>;
#endif
template class SOFA_Compliant_gui_API CompliantAttachPerformer<defaulttype::Vec3Types>;
template class SOFA_Compliant_gui_API CompliantAttachPerformer<defaulttype::Rigid3Types>;

helper::Creator<InteractionPerformer::InteractionPerformerFactory, CompliantAttachPerformer<defaulttype::Vec3Types> > CompliantAttachPerformerVec3dClass("CompliantAttach",true);
helper::Creator<InteractionPerformer::InteractionPerformerFactory, CompliantAttachPerformer<defaulttype::Rigid3Types> > CompliantAttachPerformerRigid3Class("CompliantAttach",true);

#ifndef SOFA_DOUBLE
helper::Creator<InteractionPerformer::InteractionPerformerFactory, CompliantAttachPerformer<defaulttype::Vec3fTypes> > CompliantAttachPerformerVec3fClass("CompliantAttach",true);
helper::Creator<InteractionPerformer::InteractionPerformerFactory, CompliantAttachPerformer<defaulttype::Rigid3fTypes> > CompliantAttachPerformerRigid3fClass("CompliantAttach",true);

#endif
#ifndef SOFA_FLOAT
helper::Creator<InteractionPerformer::InteractionPerformerFactory, CompliantAttachPerformer<defaulttype::Vec3dTypes> > CompliantAttachPerformerVec3dClass("CompliantAttach",true);
helper::Creator<InteractionPerformer::InteractionPerformerFactory, CompliantAttachPerformer<defaulttype::Rigid3dTypes> > CompliantAttachPerformerRigid3dClass("CompliantAttach",true);
#endif
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,14 @@ class SOFA_Compliant_gui_API CompliantAttachPerformer: public TInteractionPerfor
~CompliantAttachPerformer();
virtual void configure(configurationsetting::MouseButtonSetting* setting);


void start();
void execute();

};



#if !defined(SOFA_COMPONENT_COLLISION_CompliantAttachPerformer_CPP)
#ifndef SOFA_DOUBLE
extern template class SOFA_Compliant_gui_API CompliantAttachPerformer<defaulttype::Vec3fTypes>;
extern template class SOFA_Compliant_gui_API CompliantAttachPerformer<defaulttype::Rigid3fTypes>;
#if !defined(SOFA_COMPONENT_COLLISION_CompliantAttachPerformer_CPP)
extern template class SOFA_Compliant_gui_API CompliantAttachPerformer<defaulttype::Vec3Types>;
extern template class SOFA_Compliant_gui_API CompliantAttachPerformer<defaulttype::Rigid3Types>;
#endif
#ifndef SOFA_FLOAT
extern template class SOFA_Compliant_gui_API CompliantAttachPerformer<defaulttype::Vec3dTypes>;
extern template class SOFA_Compliant_gui_API CompliantAttachPerformer<defaulttype::Rigid3dTypes>;
#endif
#endif


}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,9 @@ using namespace sofa::defaulttype;

// Register in the Factory (XML read/write...)
int FEMGridBehaviorModelModelClass = core::RegisterObject("FEMGridBehaviorModel Example")
#ifndef SOFA_FLOAT
.add< FEMGridBehaviorModel<Vec3dTypes> >()
#endif
#ifndef SOFA_DOUBLE
.add< FEMGridBehaviorModel<Vec3fTypes> >()
#endif
;

#ifndef SOFA_FLOAT
template class SOFA_ExternalBehaviorModel_API FEMGridBehaviorModel<Vec3dTypes>;
#endif
#ifndef SOFA_DOUBLE
template class SOFA_ExternalBehaviorModel_API FEMGridBehaviorModel<Vec3fTypes>;
#endif
.add< FEMGridBehaviorModel<Vec3Types> >();

template class SOFA_ExternalBehaviorModel_API FEMGridBehaviorModel<Vec3Types>;


} // namespace externalBehaviorModel
Expand Down
Loading