test lapack before running test

This commit is contained in:
Marc Pouget 2007-03-24 15:31:25 +00:00
parent 4b20777898
commit f1d6bef159
3 changed files with 36 additions and 28 deletions

View File

@ -1,4 +1,13 @@
#include <CGAL/Cartesian.h> #include <CGAL/Cartesian.h>
#ifndef CGAL_USE_LAPACK
int main()
{
std::cerr << "Skip since LAPACK is not installed" << std::endl;
std::cerr << std::endl;
return 0;
}
#else
#include <CGAL/Monge_via_jet_fitting.h> #include <CGAL/Monge_via_jet_fitting.h>
#include <CGAL/Lapack/Linear_algebra_lapack.h> #include <CGAL/Lapack/Linear_algebra_lapack.h>
@ -123,7 +132,6 @@ int main(int argc, char *argv[])
int main() int main()
#endif #endif
{ {
#ifdef CGAL_USE_LAPACK
string if_name_string; string if_name_string;
const char *if_name = NULL; //input file name const char *if_name = NULL; //input file name
char *w_if_name = NULL; //as above, but / replaced by _ char *w_if_name = NULL; //as above, but / replaced by _
@ -306,11 +314,6 @@ int main()
out_verbose->close(); out_verbose->close();
delete out_verbose; delete out_verbose;
} }
#else
std::cerr << "Skip since LAPACK is not installed" << std::endl;
std::cerr << std::endl;
#endif // CGAL_USE_LAPACK
return 0; return 0;
} }
#endif // CGAL_USE_LAPACK

View File

@ -1,10 +1,18 @@
#include <CGAL/Cartesian.h> #include <CGAL/Cartesian.h>
#include <CGAL/Monge_via_jet_fitting.h>
#ifndef CGAL_USE_LAPACK
int main()
{
std::cerr << "Skip since LAPACK is not installed" << std::endl;
std::cerr << std::endl;
return 0;
}
#else
#include <fstream> #include <fstream>
#include <stdlib.h>
#include <vector> #include <vector>
#include <CGAL/Monge_via_jet_fitting.h>
typedef double DFT; typedef double DFT;
typedef CGAL::Cartesian<DFT> Data_Kernel; typedef CGAL::Cartesian<DFT> Data_Kernel;
typedef Data_Kernel::Point_3 DPoint; typedef Data_Kernel::Point_3 DPoint;
@ -20,8 +28,7 @@ int main(int argc, char *argv[])
<< " <inputPoints.txt> <d_fitting> <d_monge>" << std::endl; << " <inputPoints.txt> <d_fitting> <d_monge>" << std::endl;
return 0; return 0;
} }
#ifdef CGAL_USE_LAPACK //open the input file
//open the input file
std::ifstream inFile( argv[1]); std::ifstream inFile( argv[1]);
if ( !inFile ) if ( !inFile )
{ {
@ -55,11 +62,6 @@ int main(int argc, char *argv[])
for (int i=0; i<3; i++) for (int i=0; i<3; i++)
std::cout << monge_fit.pca_basis(i).first << std::endl std::cout << monge_fit.pca_basis(i).first << std::endl
<< monge_fit.pca_basis(i).second << std::endl; << monge_fit.pca_basis(i).second << std::endl;
#else
std::cerr << "Skip since LAPACK is not installed" << std::endl;
std::cerr << std::endl;
#endif // CGAL_USE_LAPACK
return 0; return 0;
} }
#endif //CGAL_USE_LAPACK

View File

@ -1,9 +1,16 @@
#include <CGAL/Cartesian.h> #include <CGAL/Cartesian.h>
#include <CGAL/Monge_via_jet_fitting.h> #ifndef CGAL_USE_LAPACK
int main()
{
std::cerr << "Skip since LAPACK is not installed" << std::endl;
std::cerr << std::endl;
return 0;
}
#else
#include <fstream> #include <fstream>
#include <stdlib.h>
#include <vector> #include <vector>
#include <CGAL/Monge_via_jet_fitting.h>
typedef double DFT; typedef double DFT;
typedef CGAL::Cartesian<DFT> Data_Kernel; typedef CGAL::Cartesian<DFT> Data_Kernel;
@ -20,7 +27,6 @@ int main()
std::cerr << "cannot open file for input\n"; std::cerr << "cannot open file for input\n";
exit(-1); exit(-1);
} }
#ifdef CGAL_USE_LAPACK
//initalize the in_points container //initalize the in_points container
double x, y, z; double x, y, z;
std::vector<DPoint> in_points; std::vector<DPoint> in_points;
@ -66,11 +72,8 @@ int main()
assert(monge_form.coefficients()[1] >= -0.4 - precision); assert(monge_form.coefficients()[1] >= -0.4 - precision);
assert(monge_form.coefficients()[1] <= -0.4 + precision); assert(monge_form.coefficients()[1] <= -0.4 + precision);
std::cout << "success\n"; std::cout << "success\n";
return 0;
#else }
std::cerr << "Skip since LAPACK is not installed" << std::endl;
std::cerr << std::endl;
#endif // CGAL_USE_LAPACK #endif // CGAL_USE_LAPACK
return 0;
}