-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "VectorUtils.hxx"
-// levels :
+// levels :
// 1 - titles and volume results
// 2 - symmetry / diagonal results and intersection matrix output
// 3 - empty
//#define VOL_PREC 1.0e-6
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
using namespace INTERP_KERNEL;
double Interpolation3DTest::sumRow(const IntersectionMatrix& m, int i) const
}
-void Interpolation3DTest::getVolumes(ParaMEDMEM::MEDCouplingUMesh& mesh, double *tab) const
+void Interpolation3DTest::getVolumes(MEDCoupling::MEDCouplingUMesh& mesh, double *tab) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=mesh->getMeasureField(true);
+ MCAuto<MEDCouplingFieldDouble> vol=mesh->getMeasureField(true);
std::copy(vol->getArray()->begin(),vol->getArray()->end(),tab);
}
double Interpolation3DTest::sumVolume(const IntersectionMatrix& m) const
{
-
+
std::vector<double> volumes;
for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
{
// vol += std::abs(iter2->second);
}
}
-
+
// sum in ascending order to avoid rounding errors
sort(volumes.begin(), volumes.end());
}
return compatitable;
}
-
+
bool Interpolation3DTest::testSymmetric(const IntersectionMatrix& m1, const IntersectionMatrix& m2) const
{
{
for(std::map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
-
+
std::cout << "V(" << i << ", " << iter2->first << ") = " << iter2->second << std::endl;
-
+
}
++i;
}
void Interpolation3DTest::tearDown()
{
delete interpolator;
-}
+}
void Interpolation3DTest::calcIntersectionMatrix(const char* mesh1path, const char* mesh1, const char* mesh2path, const char* mesh2, IntersectionMatrix& m) const
{
- const string dataBaseDir = getenv("MED_ROOT_DIR");
- const string dataDir = dataBaseDir + "/share/salome/resources/med/";
+ string dataDir = "";
+ if ( getenv("MEDCOUPLING_ROOT_DIR") ) {
+ dataDir = getenv("MEDCOUPLING_ROOT_DIR");
+ dataDir += "/share/resources/med/";
+ }
+ else {
+ dataDir = get_current_dir_name();
+ dataDir += "/../../resources/";
+ }
LOG(1, std::endl << "=== -> intersecting src = " << mesh1 << ", target = " << mesh2 );
LOG(5, "Loading " << mesh1 << " from " << mesh1path);
MESH sMesh(MED_DRIVER, dataDir+mesh1path, mesh1);
-
+
LOG(5, "Loading " << mesh2 << " from " << mesh2path);
MESH tMesh(MED_DRIVER, dataDir+mesh2path, mesh2);
}
LOG(1, "Intersection calculation done. " << std::endl );
-
+
}
void Interpolation3DTest::intersectMeshes(const char* mesh1path, const char* mesh1, const char* mesh2path, const char* mesh2, const double correctVol, const double prec, bool doubleTest) const
IntersectionMatrix matrix1;
calcIntersectionMatrix(mesh1path, mesh1, mesh2path, mesh2, matrix1);
-#if LOG_LEVEL >= 2
+#if LOG_LEVEL >= 2
dumpIntersectionMatrix(matrix1);
#endif
}
else
{
-
+
IntersectionMatrix matrix2;
- calcIntersectionMatrix(mesh2path, mesh2, mesh1path, mesh1, matrix2);
+ calcIntersectionMatrix(mesh2path, mesh2, mesh1path, mesh1, matrix2);
#if LOG_LEVEL >= 2
dumpIntersectionMatrix(matrix2);
#endif
-
+
const double vol2 = sumVolume(matrix2);
LOG(1, "vol1 = " << vol1 << ", vol2 = " << vol2 << ", correctVol = " << correctVol );