-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2024 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "MEDCouplingBasicsTest2.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingGaussLocalization.hxx"
#include <functional>
#include <iterator>
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
void MEDCouplingBasicsTest2::testGaussPointField1()
{
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_GAUSS_PT,NO_TIME);
CPPUNIT_ASSERT_THROW(f->getNumberOfTuples(), INTERP_KERNEL::Exception); // Sanity check!
f->setMesh(m);
- CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected());
- CPPUNIT_ASSERT_EQUAL(0,f->getNbOfGaussLocalization());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),f->getNumberOfMeshPlacesExpected());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getNbOfGaussLocalization());
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,_refCoo1,_gsCoo1,_wg1);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,_refCoo1,_gsCoo1,_wg1); // not a bug only to check that it works well
CPPUNIT_ASSERT_THROW(f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo1,_gsCoo1,_wg1),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_EQUAL(1,f->getNbOfGaussLocalization());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getNbOfGaussLocalization());
const double refCoo2[8]={ 0.,0., 1.,0., 1.,1., 0.,1. };
std::vector<double> _refCoo2(refCoo2,refCoo2+8);
_gsCoo1.resize(4); _wg1.resize(2);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo2,_gsCoo1,_wg1);
- CPPUNIT_ASSERT_EQUAL(2,f->getNbOfGaussLocalization());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),f->getNbOfGaussLocalization());
DataArrayDouble *array=DataArrayDouble::New();
array->alloc(18,2);
double *ptr=array->getPointer();
f->setArray(array);
f->setName("MyFirstFieldOnGaussPoint");
array->decrRef();
- f->checkCoherency();
+ f->checkConsistencyLight();
CPPUNIT_ASSERT_DOUBLES_EQUAL(27.,f->getIJK(2,5,0),1e-14);
CPPUNIT_ASSERT_DOUBLES_EQUAL(16.,f->getIJK(1,5,1),1e-14);
//
f->clearGaussLocalizations();
- CPPUNIT_ASSERT_EQUAL(0,f->getNbOfGaussLocalization());
- CPPUNIT_ASSERT_THROW(f->checkCoherency(),INTERP_KERNEL::Exception);
- int ids1[4]={0,1,3,4};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getNbOfGaussLocalization());
+ CPPUNIT_ASSERT_THROW(f->checkConsistencyLight(),INTERP_KERNEL::Exception);
+ mcIdType ids1[4]={0,1,3,4};
CPPUNIT_ASSERT_THROW(f->setGaussLocalizationOnCells(ids1,ids1+4,_refCoo2,_gsCoo1,_wg1),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_EQUAL(0,f->getNbOfGaussLocalization());
- int ids2[2]={0,4};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getNbOfGaussLocalization());
+ mcIdType ids2[2]={0,4};
f->setGaussLocalizationOnCells(ids2,ids2+2,_refCoo2,_gsCoo1,_wg1);
- CPPUNIT_ASSERT_EQUAL(1,f->getNbOfGaussLocalization());
- CPPUNIT_ASSERT_EQUAL(0,f->getGaussLocalizationIdOfOneCell(0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getNbOfGaussLocalization());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getGaussLocalizationIdOfOneCell(0));
CPPUNIT_ASSERT_THROW(f->getGaussLocalizationIdOfOneCell(1),INTERP_KERNEL::Exception);
- int ids3[2]={1,2};
+ mcIdType ids3[2]={1,2};
f->setGaussLocalizationOnCells(ids3,ids3+2,_refCoo1,_gsCoo1,_wg1);
- CPPUNIT_ASSERT_EQUAL(2,f->getNbOfGaussLocalization());
- CPPUNIT_ASSERT_EQUAL(0,f->getGaussLocalizationIdOfOneCell(0));
- CPPUNIT_ASSERT_EQUAL(1,f->getGaussLocalizationIdOfOneCell(1));
- CPPUNIT_ASSERT_EQUAL(1,f->getGaussLocalizationIdOfOneCell(2));
- CPPUNIT_ASSERT_THROW(f->checkCoherency(),INTERP_KERNEL::Exception);//<- cell 3 has no localization
- int ids4[1]={3};
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),f->getNbOfGaussLocalization());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getGaussLocalizationIdOfOneCell(0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getGaussLocalizationIdOfOneCell(1));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getGaussLocalizationIdOfOneCell(2));
+ CPPUNIT_ASSERT_THROW(f->checkConsistencyLight(),INTERP_KERNEL::Exception);// <- cell 3 has no localization
+ mcIdType ids4[1]={3};
std::vector<double> _gsCoo2(_gsCoo1);
std::vector<double> _wg2(_wg1);
_gsCoo2[0]=0.8888777776666; _wg2[0]=0.1234567892377;
f->setGaussLocalizationOnCells(ids4,ids4+1,_refCoo2,_gsCoo2,_wg2);
- CPPUNIT_ASSERT_EQUAL(3,f->getNbOfGaussLocalization());
- std::vector<int> tmpIds;
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3),f->getNbOfGaussLocalization());
+ std::vector<mcIdType> tmpIds;
f->getCellIdsHavingGaussLocalization(0,tmpIds);
CPPUNIT_ASSERT_EQUAL(2,(int)tmpIds.size());
CPPUNIT_ASSERT(std::equal(ids2,ids2+2,tmpIds.begin()));
- CPPUNIT_ASSERT_THROW(f->checkCoherency(),INTERP_KERNEL::Exception);//<- it's always not ok because undelying array not with the good size.
- DataArrayDouble *array2=f->getArray()->substr(0,10);
+ CPPUNIT_ASSERT_THROW(f->checkConsistencyLight(),INTERP_KERNEL::Exception);// <- it's always not ok because undelying array not with the good size.
+ DataArrayDouble *array2=f->getArray()->subArray(0,10);
f->setArray(array2);
array2->decrRef();
- f->checkCoherency();//<- here it is OK
+ f->checkConsistencyLight();// <- here it is OK
MEDCouplingFieldDouble *f2=f->clone(true);
CPPUNIT_ASSERT(f->isEqual(f2,1e-14,1e-14));
MEDCouplingGaussLocalization& gl1=f2->getGaussLocalization(0);
gl1.setGaussCoord(1,1,tmp);
CPPUNIT_ASSERT(f->isEqual(f2,1e-14,1e-14));
f->decrRef();
- f2->checkCoherency();
+ f2->checkConsistencyLight();
//
f2->decrRef();
m->decrRef();
MEDCouplingUMesh *m=build2DTargetMesh_1();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_GAUSS_NE,NO_TIME);
f->setMesh(m);
- CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),f->getNumberOfMeshPlacesExpected());
f->setName("MyFirstFieldOnNE");
f->setDescription("MyDescriptionNE");
DataArrayDouble *array=DataArrayDouble::New();
f->setArray(array);
array->decrRef();
//
- f->checkCoherency();
+ f->checkConsistencyLight();
MEDCouplingFieldDouble *f2=f->clone(true);
CPPUNIT_ASSERT(f->isEqual(f2,1e-14,1e-14));
CPPUNIT_ASSERT_DOUBLES_EQUAL(21.,f->getIJK(2,0,0),1e-14);
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
double vec[3]={0.,0.,-1.};
- std::vector<int> res1;
+ std::vector<mcIdType> res1;
CPPUNIT_ASSERT_THROW(m->are2DCellsNotCorrectlyOriented(vec,false,res1),INTERP_KERNEL::Exception);
m->changeSpaceDimension(3);
res1.clear();
//
vec[2]=-1.;
// connectivity inversion
- int *conn=m->getNodalConnectivity()->getPointer();
- int tmp=conn[11];
+ mcIdType *conn=m->getNodalConnectivity()->getPointer();
+ mcIdType tmp=conn[11];
conn[11]=conn[12];
conn[12]=tmp;
m->are2DCellsNotCorrectlyOriented(vec,false,res1);
CPPUNIT_ASSERT_EQUAL(1,(int)res1.size());
- CPPUNIT_ASSERT_EQUAL(2,res1[0]);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2),res1[0]);
res1.clear();
m->orientCorrectly2DCells(vec,false);
m->are2DCellsNotCorrectlyOriented(vec,false,res1);
MEDCouplingUMesh *m1=0;
MEDCouplingUMesh *m2=build3DExtrudedUMesh_1(m1);
m1->decrRef();
- std::vector<int> res1;
+ std::vector<mcIdType> res1;
m2->arePolyhedronsNotCorrectlyOriented(res1);
CPPUNIT_ASSERT_EQUAL(6,(int)res1.size());
m2->orientCorrectlyPolyhedrons();
res1.clear();
m2->arePolyhedronsNotCorrectlyOriented(res1);
CPPUNIT_ASSERT(res1.empty());
- m2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(18,m2->getNumberOfCells());
- int cellIds[3]={0,6,12};
- std::vector<int> cellIds2(cellIds,cellIds+3);
+ m2->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(18,(int)m2->getNumberOfCells());
+ mcIdType cellIds[3]={0,6,12};
+ std::vector<mcIdType> cellIds2(cellIds,cellIds+3);
m2->convertToPolyTypes(&cellIds2[0],&cellIds2[0]+cellIds2.size());
m2->orientCorrectlyPolyhedrons();
res1.clear();
MEDCouplingUMesh *m3=build2DTargetMesh_1();
double vec[3]={0.,0.,1.};
m3->changeSpaceDimension(3);
- const int ids1[5]={0,1,2,3,4};
- std::vector<int> ids2(ids1,ids1+5);
+ const mcIdType ids1[5]={0,1,2,3,4};
+ std::vector<mcIdType> ids2(ids1,ids1+5);
m3->convertToPolyTypes(&ids2[0],&ids2[0]+ids2.size());
m3->orientCorrectly2DCells(vec,false);
MEDCouplingUMesh *m4=buildCU1DMesh_U();
m5->arePolyhedronsNotCorrectlyOriented(res1);
CPPUNIT_ASSERT(res1.empty());
MEDCouplingFieldDouble *f3=m5->getMeasureField(false);
- CPPUNIT_ASSERT_EQUAL(15,f3->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f3->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(15,(int)f3->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f3->getNumberOfComponents());
const double *f3Ptr=f3->getArray()->getConstPointer();
const double expected1[15]={
0.075,0.0375,0.0375,0.075,0.075,
for(int i=0;i<15;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(std::abs(expected1[i]),f3Ptr[i],1e-12);
f3->decrRef();
- DataArrayDouble *f4=m5->getBarycenterAndOwner();
- CPPUNIT_ASSERT_EQUAL(15,f4->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,f4->getNumberOfComponents());
+ DataArrayDouble *f4=m5->computeCellCenterOfMass();
+ CPPUNIT_ASSERT_EQUAL(15,(int)f4->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,(int)f4->getNumberOfComponents());
const double *f4Ptr=f4->getConstPointer();
const double expected2[45]={
-0.05,-0.05,0.15, 0.3666666666666667,-0.13333333333333333,0.15, 0.53333333333333333,0.033333333333333333,0.15, -0.05,0.45,0.15, 0.45,0.45,0.15,
coords[4] = cos(5*M_PI/4.0); coords[5] = sin(5*M_PI/4.0);
coords[6] = cos(M_PI/4.0); coords[7] = sin(M_PI/4.0);
- int conn[4]= { 0,1,2,3 };
+ mcIdType conn[4]= { 0,1,2,3 };
double vec[3]={0.,0.,-1.};
m->allocateCells(1);
m->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,4,conn);
myCoords->decrRef();
m->changeSpaceDimension(3);
- std::vector<int> res1;
+ std::vector<mcIdType> res1;
m->are2DCellsNotCorrectlyOriented(vec,false,res1);
CPPUNIT_ASSERT(res1.empty());
vec[2] = 1.0;
*/
void MEDCouplingBasicsTest2::testPolyhedronBarycenter()
{
- int connN[]={0,3,2,1, -1, 4,5,6,7, -1, 0,4,7,3, -1, 3,7,6,2, -1, 2,6,5,1, -1, 1,5,4,0};
+ mcIdType connN[]={0,3,2,1, -1, 4,5,6,7, -1, 0,4,7,3, -1, 3,7,6,2, -1, 2,6,5,1, -1, 1,5,4,0};
double coords[]={0.,0.,0., 1.,0.,0., 1.,1.,0., 0.,1.,0., 0.,0.,1., 1.,0.,1., 1.,1.,1., 0.,1.,1., 0.5, 0.5, 0.5};
MEDCouplingUMesh *meshN=MEDCouplingUMesh::New();
meshN->setName("ForBary");
std::copy(coords,coords+27,myCoords->getPointer());
meshN->setCoords(myCoords);
myCoords->decrRef();
- meshN->checkCoherency();
+ meshN->checkConsistencyLight();
//
- std::vector<int> res1;
+ std::vector<mcIdType> res1;
meshN->arePolyhedronsNotCorrectlyOriented(res1);
meshN->orientCorrectlyPolyhedrons();
CPPUNIT_ASSERT(res1.empty());
const double *ref,*daPtr;
- DataArrayDouble *da=meshN->getBarycenterAndOwner();
- CPPUNIT_ASSERT_EQUAL(1,da->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,da->getNumberOfComponents());
+ DataArrayDouble *da=meshN->computeCellCenterOfMass();
+ CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,(int)da->getNumberOfComponents());
daPtr=da->getConstPointer();
ref=meshN->getCoords()->getConstPointer()+24;
for(int i=0;i<3;i++)
//
const double center[]={0.,0.,0.};
const double vec[]={0.,2.78,0.};
- da=meshN->getBarycenterAndOwner();
+ da=meshN->computeCellCenterOfMass();
daPtr=da->getConstPointer();
ref=meshN->getCoords()->getConstPointer()+24;
for(int i=0;i<3;i++)
//
meshN->rotate(center,vec,M_PI/7.);
meshN->translate(vec);
- da=meshN->getBarycenterAndOwner();
+ da=meshN->computeCellCenterOfMass();
daPtr=da->getConstPointer();
ref=meshN->getCoords()->getConstPointer()+24;
for(int i=0;i<3;i++)
const double vec2[]={4.5,9.3,2.8};
meshN->rotate(center2,vec2,M_E);
meshN->translate(vec2);
- da=meshN->getBarycenterAndOwner();
+ da=meshN->computeCellCenterOfMass();
daPtr=da->getConstPointer();
ref=meshN->getCoords()->getConstPointer()+24;
for(int i=0;i<3;i++)
array->decrRef();
//
const double *ptr;
- DataArrayDouble *f3=m1->getBarycenterAndOwner();
- CPPUNIT_ASSERT_EQUAL(4,f3->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f3->getNumberOfComponents());
+ DataArrayDouble *f3=m1->computeCellCenterOfMass();
+ CPPUNIT_ASSERT_EQUAL(4,(int)f3->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f3->getNumberOfComponents());
double expected9[4]={0.75,5.105,0.8,5.155};
ptr=f3->getConstPointer();
for(int i=0;i<4;i++)
f3->decrRef();
//
MEDCouplingFieldDouble *f2=m1->getMeasureField(false);
- CPPUNIT_ASSERT_EQUAL(4,f2->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,(int)f2->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents());
double expected1[4]={0.5,0.21,-0.6,-0.31};
ptr=f2->getArray()->getConstPointer();
for(int i=0;i<4;i++)
// Testing with 2D Curve
m1=build2DCurveTargetMesh_3();
f2=m1->getMeasureField(false);
- CPPUNIT_ASSERT_EQUAL(4,f2->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,(int)f2->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents());
ptr=f2->getArray()->getConstPointer();
for(int i=0;i<4;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(sqrt(2.)*expected2[i],ptr[i],1e-12);
f2->decrRef();
f2=m1->getMeasureField(true);
- CPPUNIT_ASSERT_EQUAL(4,f2->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,(int)f2->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents());
ptr=f2->getArray()->getConstPointer();
for(int i=0;i<4;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i]*sqrt(2.),ptr[i],1e-12);
f2->decrRef();
//bary
- f3=m1->getBarycenterAndOwner();
- CPPUNIT_ASSERT_EQUAL(4,f3->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,f3->getNumberOfComponents());
+ f3=m1->computeCellCenterOfMass();
+ CPPUNIT_ASSERT_EQUAL(4,(int)f3->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,(int)f3->getNumberOfComponents());
double expected10[8]={0.75,0.75,5.105,5.105,0.8,0.8,5.155,5.155};
ptr=f3->getConstPointer();
for(int i=0;i<8;i++)
{
MEDCouplingUMesh *m1=build2DTargetMesh_3();
MEDCouplingFieldDouble *f1=m1->getMeasureField(false);
- CPPUNIT_ASSERT_EQUAL(10,f1->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(10,(int)f1->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents());
double expected1[10]={-0.5,-1,-1.5,-0.5,-1, 0.5,1,1.5,0.5,1};
const double *ptr=f1->getArray()->getConstPointer();
for(int i=0;i<10;i++)
for(int i=0;i<10;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(std::abs(expected1[i]),ptr[i],1e-12);
f1->decrRef();
- DataArrayDouble *f2=m1->getBarycenterAndOwner();
- CPPUNIT_ASSERT_EQUAL(10,f2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,f2->getNumberOfComponents());
+ DataArrayDouble *f2=m1->computeCellCenterOfMass();
+ CPPUNIT_ASSERT_EQUAL(10,(int)f2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,(int)f2->getNumberOfComponents());
double expected2[20]={
0.5,0.3333333333333333,0.5,0.5,0.5,0.77777777777777777,0.5,0.3333333333333333,0.5,0.5,
0.5,0.3333333333333333,0.5,0.5,0.5,0.77777777777777777,0.5,0.3333333333333333,0.5,0.5,
f2->decrRef();
m1->changeSpaceDimension(3);
f1=m1->getMeasureField(false);
- CPPUNIT_ASSERT_EQUAL(10,f1->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(10,(int)f1->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents());
ptr=f1->getArray()->getConstPointer();
for(int i=0;i<10;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(std::abs(expected1[i]),ptr[i],1e-12);
f1->decrRef();
- f2=m1->getBarycenterAndOwner();
- CPPUNIT_ASSERT_EQUAL(10,f2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,f2->getNumberOfComponents());
+ f2=m1->computeCellCenterOfMass();
+ CPPUNIT_ASSERT_EQUAL(10,(int)f2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,(int)f2->getNumberOfComponents());
ptr=f2->getConstPointer();
double expected3[30]={
0.5,0.3333333333333333,0.,0.5,0.5,0.,0.5,0.77777777777777777,0.,0.5,0.3333333333333333,0.,0.5,0.5,0.,
0.167803379307 , -0.207851396623 , -0.088802726124 , 0.12868717152 , -0.230920439715 , 0.00760508389036 ,
-0.0372812069535 , -0.286740286332 , 0.00963701291166 };
- int connN [] = { /*polyhedron 0*/
+ mcIdType connN [] = { /*polyhedron 0*/
0 , 1 , 3 , 4 , 2 , -1 , 1 , 5 , 6 , 7 , 0 , -1 , 0 , 7 , 8 , 10 , 11 , 9 , 2 , -1 , 1 , 5 , 12 , 14 , 15 , 13 , 3 , -1 , 16 , 9 , 2 , 4 , 17 , -1
, 4 , 3 , 13 , 18 , 17 , -1 , 5 , 6 , 19 , 21 , 20 , 12 , -1 , 6 , 7 , 8 , 23 , 22 , 19 , -1 , 23 , 24 , 10 , 8 , -1 , 25 , 11 , 9 , 16 , -1
, 24 , 26 , 25 , 11 , 10 , -1 , 12 , 14 , 20 , -1 , 27 , 28 , 29 , 15 , 13 , 18 , -1 , 14 , 15 , 29 , 30 , 21 , 20 , -1 , 26 , 27 , 18 , 17 , 16 , 25 , -1
std::copy(coords,coords+207,myCoords->getPointer());
meshN->setCoords(myCoords);
myCoords->decrRef();
- meshN->checkCoherency();
- std::vector<int> res1;
+ meshN->checkConsistencyLight();
+ std::vector<mcIdType> res1;
meshN->arePolyhedronsNotCorrectlyOriented(res1);
meshN->orientCorrectlyPolyhedrons();
res1.clear();
meshN->arePolyhedronsNotCorrectlyOriented(res1);
CPPUNIT_ASSERT(res1.empty());
//
- DataArrayDouble *da=meshN->getBarycenterAndOwner();
- CPPUNIT_ASSERT_EQUAL(4,da->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,da->getNumberOfComponents());
+ DataArrayDouble *da=meshN->computeCellCenterOfMass();
+ CPPUNIT_ASSERT_EQUAL(4,(int)da->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,(int)da->getNumberOfComponents());
const double *daPtr=da->getConstPointer();
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(barys[i],daPtr[i],1e-12);
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
f->setMesh(m);
DataArrayDouble *arr=DataArrayDouble::New();
- int nbOfCells=m->getNumberOfCells();
- arr->alloc(nbOfCells,3);
+ arr->alloc(m->getNumberOfCells(),3);
f->setArray(arr);
arr->decrRef();
const double values1[15]={7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.};
std::copy(values1,values1+15,arr->getPointer());
- const int renumber1[5]={3,1,0,4,2};
+ const mcIdType renumber1[5]={3,1,0,4,2};
double res[3];
const double loc[]={-0.05,-0.05, 0.55,-0.25, 0.55,0.15, -0.05,0.45, 0.45,0.45};
for(int j=0;j<5;j++)
std::copy(values2,values2+36,arr->getPointer());
f->setArray(arr);
arr->decrRef();
- f->checkCoherency();
+ f->checkConsistencyLight();
MEDCouplingFieldDouble *fCpy=f->clone(true);
CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12));
f->renumberCells(renumber1,false);
ptr=f->getArray()->getConstPointer();
for(int i=0;i<36;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],ptr[i],1e-12);
- const int renumber2[5]={2,1,4,0,3};//reverse renumber1
+ const mcIdType renumber2[5]={2,1,4,0,3};//reverse renumber1
f->renumberCells(renumber2,false);
CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12));
fCpy->decrRef();
std::copy(values3,values3+36,arr->getPointer());
f->setArray(arr);
arr->decrRef();
- f->checkCoherency();
+ f->checkConsistencyLight();
fCpy=f->clone(true);
CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12));
f->renumberCells(renumber1,false);
MEDCouplingUMesh *m=build2DTargetMesh_1();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME);
f->setMesh(m);
- CPPUNIT_ASSERT_EQUAL(9,f->getNumberOfMeshPlacesExpected());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(9),f->getNumberOfMeshPlacesExpected());
DataArrayDouble *arr=DataArrayDouble::New();
- int nbOfNodes=m->getNumberOfNodes();
+ mcIdType nbOfNodes=m->getNumberOfNodes();
arr->alloc(nbOfNodes,3);
f->setArray(arr);
arr->decrRef();
const double values1[27]={7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.,12.,112.,10012.,13.,113.,10013.,14.,114.,10014.,15.,115.,10015.};
std::copy(values1,values1+27,arr->getPointer());
- f->checkCoherency();
- const int renumber1[9]={0,4,1,3,5,2,6,7,8};
+ f->checkConsistencyLight();
+ const mcIdType renumber1[9]={0,4,1,3,5,2,6,7,8};
double res[3];
const double loc[]={0.5432,-0.2432, 0.5478,0.1528};
const double expected1[6]={9.0272, 109.0272, 10009.0272, 11.4124,111.4124,10011.4124};
const double expected2[27]={7.,107.,10007.,9.,109.,10009.,12.,112.,10012.,10.,110.,10010.,8.,108.,10008.,11.,111.,10011.,13.,113.,10013.,14.,114.,10014.,15.,115.,10015.};
for(int i=0;i<27;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f->getArray()->getConstPointer()[i],1e-12);
- const int renumber2[9]={0,2,5,3,1,4,6,7,8};//reverse of renumber2
+ const mcIdType renumber2[9]={0,2,5,3,1,4,6,7,8};//reverse of renumber2
f->renumberNodes(renumber2);
CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12));
fCpy->decrRef();
void MEDCouplingBasicsTest2::testConvertQuadraticCellsToLinear()
{
MEDCouplingUMesh *mesh=build2DTargetMesh_3();
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
std::set<INTERP_KERNEL::NormalizedCellType> types=mesh->getAllGeoTypes();
CPPUNIT_ASSERT_EQUAL(5,(int)types.size());
INTERP_KERNEL::NormalizedCellType expected1[5]={INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_TRI3, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_TRI6, INTERP_KERNEL::NORM_QUAD8};
std::set<INTERP_KERNEL::NormalizedCellType> expected1Bis(expected1,expected1+5);
CPPUNIT_ASSERT(expected1Bis==types);
CPPUNIT_ASSERT(mesh->isPresenceOfQuadratic());
- CPPUNIT_ASSERT_EQUAL(62,mesh->getMeshLength());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(62),mesh->getNodalConnectivityArrayLen());
MEDCouplingFieldDouble *f1=mesh->getMeasureField(false);
//
mesh->convertQuadraticCellsToLinear();
CPPUNIT_ASSERT(!mesh->isPresenceOfQuadratic());
//
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
MEDCouplingFieldDouble *f2=mesh->getMeasureField(false);
CPPUNIT_ASSERT(f1->getArray()->isEqual(*f2->getArray(),1e-12));
- CPPUNIT_ASSERT_EQUAL(48,mesh->getMeshLength());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(48),mesh->getNodalConnectivityArrayLen());
std::set<INTERP_KERNEL::NormalizedCellType> types2=mesh->getAllGeoTypes();
CPPUNIT_ASSERT_EQUAL(3,(int)types2.size());
INTERP_KERNEL::NormalizedCellType expected2[3]={INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_TRI3, INTERP_KERNEL::NORM_QUAD4};
{
MEDCouplingUMesh *mesh1=build2DTargetMesh_3();
MEDCouplingUMesh *mesh2=build2DTargetMesh_3();
- DataArrayInt *cellCor,*nodeCor;
+ DataArrayIdType *cellCor,*nodeCor;
//First test mesh1
mesh1->checkGeoEquivalWith(mesh1,0,1e-12,cellCor,nodeCor);//deepEqual
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(nodeCor==0);
//Third test : cell permutation by keeping the first the middle and the last as it is.
- const int renum[]={0,2,1,3,4,5,6,8,7,9};
+ const mcIdType renum[]={0,2,1,3,4,5,6,8,7,9};
mesh2->renumberCells(renum,false);
CPPUNIT_ASSERT_THROW(mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor),INTERP_KERNEL::Exception);//deepEqual fails
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(nodeCor==0);
mesh1->checkGeoEquivalWith(mesh2,10,1e-12,cellCor,nodeCor);//deepEqual with geo permutations
CPPUNIT_ASSERT(cellCor);
- CPPUNIT_ASSERT_EQUAL(10,cellCor->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,cellCor->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(10,(int)cellCor->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)cellCor->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(renum,renum+10,cellCor->getConstPointer()));
CPPUNIT_ASSERT(nodeCor==0);
cellCor->decrRef();
//4th test : cell and node permutation by keeping the first the middle and the last as it is.
mesh2->decrRef();
mesh2=build2DTargetMesh_3();
- const int renum2[]={0,2,1,3,4,5,6,8,7,9,10};
+ const mcIdType renum2[]={0,2,1,3,4,5,6,8,7,9,10};
mesh2->renumberCells(renum,false);
mesh2->renumberNodes(renum2,11);
CPPUNIT_ASSERT_THROW(mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor),INTERP_KERNEL::Exception);//deepEqual fails
CPPUNIT_ASSERT(nodeCor==0);
mesh1->checkGeoEquivalWith(mesh2,10,1e-12,cellCor,nodeCor);//deepEqual with geo permutations
CPPUNIT_ASSERT(cellCor);
- CPPUNIT_ASSERT_EQUAL(10,cellCor->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,cellCor->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(10,(int)cellCor->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)cellCor->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(renum,renum+10,cellCor->getConstPointer()));
CPPUNIT_ASSERT(nodeCor);
- CPPUNIT_ASSERT_EQUAL(11,nodeCor->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,nodeCor->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(11,(int)nodeCor->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)nodeCor->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(renum2,renum2+11,nodeCor->getConstPointer()));
cellCor->decrRef();
cellCor=0;
//5th test : modification of the last cell to check fastCheck detection.
mesh2->decrRef();
mesh2=build2DTargetMesh_3();
- const int renum3[]={0,2,1,3,4,5,6,8,9,7};
+ const mcIdType renum3[]={0,2,1,3,4,5,6,8,9,7};
mesh2->renumberCells(renum3,false);
mesh2->renumberNodes(renum2,11);
bool isExcep=false;
try { mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor);//deepEqual fails
}
- catch(INTERP_KERNEL::Exception& e) { isExcep=true; }
+ catch(INTERP_KERNEL::Exception&) { isExcep=true; }
CPPUNIT_ASSERT(isExcep); isExcep=false;
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(nodeCor==0);
try { mesh1->checkGeoEquivalWith(mesh2,1,1e-12,cellCor,nodeCor);//fastEqual has detected something
}
- catch(INTERP_KERNEL::Exception& e) { isExcep=true; }
+ catch(INTERP_KERNEL::Exception&) { isExcep=true; }
CPPUNIT_ASSERT(isExcep); isExcep=false;
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(nodeCor==0);
mesh2->checkGeoEquivalWith(mesh1,10,1e-12,cellCor,nodeCor);//deepEqual with geo permutations
CPPUNIT_ASSERT(cellCor);
- CPPUNIT_ASSERT_EQUAL(10,cellCor->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,cellCor->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(10,(int)cellCor->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)cellCor->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(renum3,renum3+10,cellCor->getConstPointer()));
CPPUNIT_ASSERT(nodeCor);
- CPPUNIT_ASSERT_EQUAL(11,nodeCor->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,nodeCor->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(11,(int)nodeCor->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)nodeCor->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(renum2,renum2+11,nodeCor->getConstPointer()));
cellCor->decrRef();
cellCor=0;
{
MEDCouplingUMesh *mesh1=build2DTargetMesh_4();
MEDCouplingUMesh *mesh2=build2DTargetMesh_1();
- DataArrayInt *cellCor,*nodeCor;
+ DataArrayIdType *cellCor,*nodeCor;
mesh1->checkGeoEquivalWith(mesh2,10,1e-12,cellCor,nodeCor);
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(nodeCor!=0);
- const int expected1[9]={0, 1, 3, 4, 5, 6, 7, 8, 9};
+ const mcIdType expected1[9]={0, 1, 3, 4, 5, 6, 7, 8, 9};
for(int i=0;i<9;i++)
CPPUNIT_ASSERT_EQUAL(expected1[i],nodeCor->getIJ(i,0));
nodeCor->decrRef();
void MEDCouplingBasicsTest2::testCopyTinyStringsFromOnFields()
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- int nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME);
f->setMesh(m);
- CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),f->getNumberOfMeshPlacesExpected());
f->setName("a");
f->setDescription("b");
DataArrayDouble *a1=DataArrayDouble::New();
a1->fillWithZero();
a1->setInfoOnComponent(0,"c");
a1->setInfoOnComponent(1,"d");
- DataArrayDouble *a2=a1->deepCpy();
+ DataArrayDouble *a2=a1->deepCopy();
a2->setInfoOnComponent(0,"e");
a2->setInfoOnComponent(1,"f");
f->setArray(a1);
m->getCoords()->setInfoOnComponent(1,"i");
m->getCoords()->setInfoOnComponent(2,"j");
//
- f->checkCoherency();
+ f->checkConsistencyLight();
MEDCouplingFieldDouble *f2=f->clone(true);
CPPUNIT_ASSERT(f2->isEqual(f,1e-12,1e-12));
f2->setName("smth");
m->tryToShareSameCoordsPermute(*m2,1e-12);
CPPUNIT_ASSERT(m->getCoords()==m2->getCoords());
CPPUNIT_ASSERT(m2->isEqual(m,1e-12));
- const int renum1[9]={1,2,0,5,8,7,4,3,6};
+ const mcIdType renum1[9]={1,2,0,5,8,7,4,3,6};
m->renumberNodes(renum1,9);
CPPUNIT_ASSERT(m->getCoords()!=m2->getCoords());
CPPUNIT_ASSERT(!m2->isEqual(m,1e-12));
{
MEDCouplingUMesh *m1=build2DTargetMesh_4();
double targetCoords[8]={-0.3,-0.3, 0.2,-0.3, -0.3,0.2, 0.2,0.2 };
- int targetConn[4]={0,2,3,1};
+ mcIdType targetConn[4]={0,2,3,1};
MEDCouplingUMesh *m2=MEDCouplingUMesh::New();
m2->setMeshDimension(2);
m2->allocateCells(1);
std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
m2->setCoords(myCoords);
myCoords->decrRef();
- m2->checkCoherency();
- m1->checkCoherency();
+ m2->checkConsistencyLight();
+ m1->checkConsistencyLight();
//
const double expected1[5]={0.25,0.125,0.125,0.25,0.25};
MEDCouplingFieldDouble *f1=m1->getMeasureField(false);
MEDCouplingFieldDouble *f2=m2->getMeasureField(false);
- CPPUNIT_ASSERT_EQUAL(5,f1->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f2->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f1->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getArray()->getNumberOfTuples());
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(i,0),1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[0],f2->getIJ(0,0),1e-12);
m2->tryToShareSameCoordsPermute(*m1,1e-12);
f1=m1->getMeasureField(false);
f2=m2->getMeasureField(false);
- CPPUNIT_ASSERT_EQUAL(5,f1->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f2->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f1->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getArray()->getNumberOfTuples());
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(i,0),1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[0],f2->getIJ(0,0),1e-12);
f1->setArray(array);
array->decrRef();
//
- const int renum[]={0,2,1,3,4,5,6,8,7,9};
+ const mcIdType renum[]={0,2,1,3,4,5,6,8,7,9};
mesh2->renumberCells(renum,false);
CPPUNIT_ASSERT(f1->getMesh()==mesh1);
f1->changeUnderlyingMesh(mesh1,10,1e-12);// nothing done only to check that nothing done.
f1->setArray(array);
array->decrRef();
//
- const int renum2[]={0,2,10,3,4,5,6,8,7,9,1};
+ const mcIdType renum2[]={0,2,10,3,4,5,6,8,7,9,1};
mesh2->renumberNodes(renum2,11);
CPPUNIT_ASSERT(f1->getMesh()==mesh1);
f1->changeUnderlyingMesh(mesh2,10,1e-12);
void MEDCouplingBasicsTest2::testGetMaxValue1()
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- int nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME);
f->setMesh(m);
DataArrayDouble *a1=DataArrayDouble::New();
f->setArray(a1);
f->setEndArray(a2);
f->setEndTime(3.,3,4);
- f->checkCoherency();
+ f->checkConsistencyLight();
//
CPPUNIT_ASSERT_DOUBLES_EQUAL(8.,f->getMaxValue(),1e-14);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,f->getMinValue(),1e-14);
f1->setArray(array);
array->decrRef();
//
- CPPUNIT_ASSERT_EQUAL(10,f1->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,f1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(20,f1->getNumberOfValues());
+ CPPUNIT_ASSERT_EQUAL(10,(int)f1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,(int)f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(20,(int)f1->getNumberOfValues());
//
- const int renum[]={0,2,3,1,4,5,6,8,7,9};
+ const mcIdType renum[]={0,2,3,1,4,5,6,8,7,9};
mesh2->renumberCells(renum,false);
//
MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
f1->setArray(array);
array->decrRef();
//
- f1->checkCoherency();
- DataArrayInt *da=f1->getIdsInRange(2.9,7.1);
- CPPUNIT_ASSERT_EQUAL((std::size_t)5,da->getNbOfElems());
- const int expected1[5]={2,3,5,7,9};
+ f1->checkConsistencyLight();
+ DataArrayIdType *da=f1->findIdsInRange(2.9,7.1);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),da->getNbOfElems());
+ const mcIdType expected1[5]={2,3,5,7,9};
CPPUNIT_ASSERT(std::equal(expected1,expected1+5,da->getConstPointer()));
da->decrRef();
- da=f1->getIdsInRange(8.,12.);
- CPPUNIT_ASSERT_EQUAL((std::size_t)4,da->getNbOfElems());
- const int expected2[4]={1,4,6,8};
+ da=f1->findIdsInRange(8.,12.);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(4),da->getNbOfElems());
+ const mcIdType expected2[4]={1,4,6,8};
CPPUNIT_ASSERT(std::equal(expected2,expected2+4,da->getConstPointer()));
da->decrRef();
//
f1->setArray(array);
array->decrRef();
//
- const int part1[3]={2,1,4};
+ const mcIdType part1[3]={2,1,4};
MEDCouplingFieldDouble *f2=f1->buildSubPart(part1,part1+3);
f2->zipCoords();
- CPPUNIT_ASSERT_EQUAL(3,f2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(3,(int)f2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,(int)f2->getNumberOfComponents());
const double expected1[6]={5.,105.,4.,104.,7.,107.};
for(int i=0;i<6;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(f2->getIJ(0,i),expected1[i],1e-12);
- CPPUNIT_ASSERT_EQUAL(3,f2->getMesh()->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(6,f2->getMesh()->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(3,(int)f2->getMesh()->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(6,(int)f2->getMesh()->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
MEDCouplingUMesh *m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
- CPPUNIT_ASSERT_EQUAL(13,m2C->getMeshLength());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(13),m2C->getNodalConnectivityArrayLen());
const double expected2[12]={0.2, -0.3, 0.7, -0.3, 0.2, 0.2, 0.7, 0.2, 0.2, 0.7, 0.7, 0.7};
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12);
std::copy(arr2,arr2+18,array->getPointer());
f1->setArray(array);
array->decrRef();
- const int part2[2]={1,2};
+ const mcIdType part2[2]={1,2};
f2=f1->buildSubPart(part2,part2+2);
- CPPUNIT_ASSERT_EQUAL(4,f2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,(int)f2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,(int)f2->getNumberOfComponents());
const double expected5[8]={4.,104.,5.,105.,7.,107.,8.,108.};
for(int i=0;i<8;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(f2->getIJ(0,i),expected5[i],1e-12);
- CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(4,f2->getMesh()->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(2,(int)f2->getMesh()->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(4,(int)f2->getMesh()->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
- CPPUNIT_ASSERT_EQUAL(8,m2C->getMeshLength());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(8),m2C->getNodalConnectivityArrayLen());
for(int i=0;i<8;i++)//8 is not an error
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12);
CPPUNIT_ASSERT(std::equal(expected3,expected3+4,m2C->getNodalConnectivity()->getConstPointer()+4));
CPPUNIT_ASSERT(std::equal(expected4,expected4+3,m2C->getNodalConnectivityIndex()->getConstPointer()));
f2->decrRef();
//idem previous because nodes of cell#4 are not fully present in part3
- const int part3[2]={1,2};
- DataArrayInt *arrr=DataArrayInt::New();
+ const mcIdType part3[2]={1,2};
+ DataArrayIdType *arrr=DataArrayIdType::New();
arrr->alloc(2,1);
std::copy(part3,part3+2,arrr->getPointer());
f2=f1->buildSubPart(arrr);
arrr->decrRef();
- CPPUNIT_ASSERT_EQUAL(4,f2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,(int)f2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,(int)f2->getNumberOfComponents());
for(int i=0;i<8;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(f2->getIJ(0,i),expected5[i],1e-12);
- CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(4,f2->getMesh()->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(2,(int)f2->getMesh()->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(4,(int)f2->getMesh()->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
- CPPUNIT_ASSERT_EQUAL(8,m2C->getMeshLength());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(8),m2C->getNodalConnectivityArrayLen());
for(int i=0;i<8;i++)//8 is not an error
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12);
CPPUNIT_ASSERT(std::equal(expected3,expected3+4,m2C->getNodalConnectivity()->getConstPointer()+4));
CPPUNIT_ASSERT(std::equal(expected4,expected4+3,m2C->getNodalConnectivityIndex()->getConstPointer()));
f2->decrRef();
//
- const int part4[3]={1,2,4};
+ const mcIdType part4[3]={1,2,4};
f2=f1->buildSubPart(part4,part4+3);
- CPPUNIT_ASSERT_EQUAL(6,f2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(6,(int)f2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,(int)f2->getNumberOfComponents());
const double expected6[12]={4.,104.,5.,105.,7.,107.,8.,108.,10.,110.,11.,111.};
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(f2->getIJ(0,i),expected6[i],1e-12);
- CPPUNIT_ASSERT_EQUAL(3,f2->getMesh()->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(6,f2->getMesh()->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(3,(int)f2->getMesh()->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(6,(int)f2->getMesh()->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
- CPPUNIT_ASSERT_EQUAL(13,m2C->getMeshLength());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(13),m2C->getNodalConnectivityArrayLen());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12);
CPPUNIT_ASSERT(std::equal(expected3,expected3+4,m2C->getNodalConnectivity()->getConstPointer()+4));
std::copy(arr1,arr1+30,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
MEDCouplingFieldDouble *f2=f1->doublyContractedProduct();
- f2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ f2->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(3906.56,f2->getIJ(i,0),1e-9);
f2->decrRef();
f1->setArray(array);
array->decrRef();
//4 components
- f1->checkCoherency();
+ f1->checkConsistencyLight();
MEDCouplingFieldDouble *f2=f1->determinant();
- f2->checkCoherency();
+ f2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(CONST_ON_TIME_INTERVAL,f2->getTimeDiscretization());
- CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfValues());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfValues());
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(-2.42,f2->getIJ(i,0),1e-13);
f2->decrRef();
std::copy(arr2,arr2+54,array->getPointer());
f1->setArray(array);
array->decrRef();
- CPPUNIT_ASSERT_THROW(f1->checkCoherency(),INTERP_KERNEL::Exception);//no end array specified !
+ CPPUNIT_ASSERT_THROW(f1->checkConsistencyLight(),INTERP_KERNEL::Exception);//no end array specified !
//
f2=f1->determinant();
CPPUNIT_ASSERT_EQUAL(LINEAR_TIME,f2->getTimeDiscretization());
- CPPUNIT_ASSERT_EQUAL(1,f2->getArray()->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(9,f2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(9,(int)f2->getNumberOfTuples());
for(int i=0;i<9;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(137.335,f2->getIJ(i,0),1e-10);
f2->decrRef();
std::copy(arr3,arr3+54,array->getPointer());
f1->setEndArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
f2=f1->determinant();
- f2->checkCoherency();
+ f2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(LINEAR_TIME,f2->getTimeDiscretization());
- CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(9,f2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(9,(int)f2->getNumberOfTuples());
int it,order;
CPPUNIT_ASSERT_DOUBLES_EQUAL(2.3,f2->getTime(it,order),1e-12);
CPPUNIT_ASSERT_EQUAL(5,it); CPPUNIT_ASSERT_EQUAL(6,order);
f1->setArray(array);
array->decrRef();
//
- f1->checkCoherency();
+ f1->checkConsistencyLight();
f2=f1->determinant();
- f2->checkCoherency();
+ f2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(ONE_TIME,f2->getTimeDiscretization());
- CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
CPPUNIT_ASSERT_DOUBLES_EQUAL(7.8,f2->getTime(it,order),1e-12);
CPPUNIT_ASSERT_EQUAL(10,it); CPPUNIT_ASSERT_EQUAL(2,order);
for(int i=0;i<5;i++)
std::copy(arr1,arr1+30,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
MEDCouplingFieldDouble *f2=f1->eigenValues();
- f2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(3,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ f2->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(3,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
const double expected1[3]={13.638813677891717,-4.502313844635971,-2.2364998332557486};
for(int i=0;i<5;i++)
{
std::copy(arr1,arr1+30,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
MEDCouplingFieldDouble *f2=f1->eigenVectors();
- f2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(9,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ f2->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(9,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
const double expected1[9]={
0.5424262364180696, 0.5351201064614425, 0.6476266283176001,//eigenvect 0
0.7381111277307373, 0.06458838384003074, -0.6715804522117897,//eigenvect 1
std::copy(arr1,arr1+45,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
MEDCouplingFieldDouble *f2=f1->inverse();
- f2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(9,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ f2->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(9,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
const double expected1[9]={-2.6538108356290113, 2.855831037649208, -1.1111111111111067, 3.461891643709813, -4.775022956841121, 2.2222222222222143, -1.1111111111111054, 2.222222222222214, -1.1111111111111072};
for(int i=0;i<5;i++)
{
std::copy(arr3,arr3+30,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
f2=f1->inverse();
- f2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(6,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ f2->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(6,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
const double expected3[6]={-0.3617705098531818, -0.8678630828458127, -0.026843764174972983, 0.5539957431465833, 0.13133439560823013, -0.05301294502145887};
for(int i=0;i<5;i++)
{
std::copy(arr2,arr2+20,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
f2=f1->inverse();
- f2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(4,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ f2->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(4,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
const double expected2[4]={-1.8595041322314059, 0.9504132231404963, 1.404958677685951, -0.49586776859504156};
for(int i=0;i<5;i++)
{
std::copy(arr1,arr1+45,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
MEDCouplingFieldDouble *f2=f1->trace();
- f2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ f2->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(15.9,f2->getIJ(i,0),1e-13);
f2->decrRef();
std::copy(arr3,arr3+30,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
f2=f1->trace();
- f2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ f2->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(25.8,f2->getIJ(i,0),1e-13);
f2->decrRef();
std::copy(arr2,arr2+20,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
f2=f1->trace();
- f2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ f2->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(5.7,f2->getIJ(i,0),1e-13);
f2->decrRef();
std::copy(arr1,arr1+30,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
MEDCouplingFieldDouble *f2=f1->deviator();
- f2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(6,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ f2->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(6,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
const double expected1[6]={-1.1,0.,1.1,4.5,5.6,6.7};
for(int i=0;i<5;i++)
{
std::copy(arr1,arr1+25,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
MEDCouplingFieldDouble *f2=f1->magnitude();
- f2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ f2->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(8.3606219864313918,f2->getIJ(i,0),1e-13);
f2->decrRef();
std::copy(arr1,arr1+25,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
MEDCouplingFieldDouble *f2=f1->maxPerTuple();
- f2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ f2->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(1,(int)f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f2->getNumberOfTuples());
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(5.6,f2->getIJ(i,0),1e-13);
f2->decrRef();
//
- DataArrayInt *d2I=0;
+ DataArrayIdType *d2I=0;
DataArrayDouble *d2=array->maxPerTupleWithCompoId(d2I);
- CPPUNIT_ASSERT_EQUAL(1,d2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,d2->getNumberOfTuples());
- const int expected2[5]={4,3,2,0,1};
+ CPPUNIT_ASSERT_EQUAL(1,(int)d2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)d2->getNumberOfTuples());
+ const mcIdType expected2[5]={4,3,2,0,1};
for(int i=0;i<5;i++)
{
CPPUNIT_ASSERT_DOUBLES_EQUAL(5.6,d2->getIJ(i,0),1e-13);
std::copy(arr1,arr1+25,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
f1->changeNbOfComponents(3,7.77);
- f1->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(3,f1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples());
+ f1->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(3,(int)f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f1->getNumberOfTuples());
const double expected1[15]={1.2,2.3,3.4, 1.2,3.4,4.5, 3.4,4.5,5.6, 5.6,1.2,2.3, 4.5,5.6,1.2};
for(int i=0;i<15;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(0,i),1e-13);
f1->changeNbOfComponents(4,7.77);
- f1->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(4,f1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples());
+ f1->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(4,(int)f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f1->getNumberOfTuples());
const double expected2[20]={1.2,2.3,3.4,7.77, 1.2,3.4,4.5,7.77, 3.4,4.5,5.6,7.77, 5.6,1.2,2.3,7.77, 4.5,5.6,1.2,7.77};
for(int i=0;i<20;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f1->getIJ(0,i),1e-13);
std::copy(arr1,arr1+25,array->getPointer());
f1->setArray(array);
array->decrRef();
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
f1->sortPerTuple(true);
- f1->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples());
+ f1->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(5,(int)f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f1->getNumberOfTuples());
for(int i=0;i<5;i++)
{
CPPUNIT_ASSERT_DOUBLES_EQUAL(arr1[0],f1->getIJ(i,0),1e-13);
}
//
f1->sortPerTuple(false);
- f1->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples());
+ f1->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(5,(int)f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f1->getNumberOfTuples());
for(int i=0;i<5;i++)
{
CPPUNIT_ASSERT_DOUBLES_EQUAL(arr1[4],f1->getIJ(i,0),1e-13);
{
MEDCouplingUMesh *mesh1=build2DTargetMesh_1();
MEDCouplingUMesh *mesh2=build2DTargetMesh_1();
- DataArrayInt *da1,*da2;
+ DataArrayIdType *da1,*da2;
//
CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(mesh1->isEqualWithoutConsideringStr(mesh2,1e-12));
mesh2->getCoords()->setIJ(0,3,tmp);
CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(mesh1->isEqualWithoutConsideringStr(mesh2,1e-12));
- int tmp2=mesh2->getNodalConnectivity()->getIJ(0,4);
+ mcIdType tmp2=mesh2->getNodalConnectivity()->getIJ(0,4);
mesh2->getNodalConnectivity()->setIJ(0,4,0);
CPPUNIT_ASSERT(!mesh1->isEqual(mesh2,1e-12));
CPPUNIT_ASSERT(!mesh1->isEqualWithoutConsideringStr(mesh2,1e-12));
void MEDCouplingBasicsTest2::testGetNodeIdsOfCell1()
{
MEDCouplingUMesh *mesh1=build2DTargetMesh_1();
- std::vector<int> nodeIds;
+ std::vector<mcIdType> nodeIds;
mesh1->getNodeIdsOfCell(1,nodeIds);
CPPUNIT_ASSERT_EQUAL(3,(int)nodeIds.size());
- CPPUNIT_ASSERT_EQUAL(1,nodeIds[0]);
- CPPUNIT_ASSERT_EQUAL(4,nodeIds[1]);
- CPPUNIT_ASSERT_EQUAL(2,nodeIds[2]);
+ CPPUNIT_ASSERT_EQUAL(1,(int)nodeIds[0]);
+ CPPUNIT_ASSERT_EQUAL(4,(int)nodeIds[1]);
+ CPPUNIT_ASSERT_EQUAL(2,(int)nodeIds[2]);
std::vector<double> coords;
mesh1->getCoordinatesOfNode(4,coords);
CPPUNIT_ASSERT_EQUAL(2,(int)coords.size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(3.4,f1->getTime(a,b),1.e-14);
CPPUNIT_ASSERT_EQUAL(5,a); CPPUNIT_ASSERT_EQUAL(6,b);
CPPUNIT_ASSERT_EQUAL(std::string(f1->getTimeUnit()),std::string("us"));
- CPPUNIT_ASSERT_EQUAL(m1->getNumberOfCells(),f1->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL((int)m1->getNumberOfCells(),(int)f1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents());
const double expected1[5]={1.,1.4142135623730951, 1.4142135623730951,1.,1.};
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(i,0),1e-14);
//
m1=build3DSurfTargetMesh_1();
f1=m1->getEdgeRatioField();
- CPPUNIT_ASSERT_EQUAL(m1->getNumberOfCells(),f1->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL((int)m1->getNumberOfCells(),(int)f1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents());
const double expected2[5]={1.4142135623730951, 1.7320508075688772, 1.7320508075688772, 1.4142135623730951, 1.4142135623730951};
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f1->getIJ(i,0),1e-14);
f1->setMesh(m);
f1->setName("myField");
f1->fillFromAnalytic(1,"y+x");
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(std::string(f1->getName())=="myField");
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_CELLS);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME);
- CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f1->getNumberOfTuples());
double values1[5]={-0.1,0.23333333333333336,0.56666666666666665,0.4,0.9};
const double *tmp=f1->getArray()->getConstPointer();
std::transform(tmp,tmp+5,values1,values1,std::minus<double>());
- std::transform(values1,values1+5,values1,std::ptr_fun<double,double>(fabs));
+ std::transform(values1,values1+5,values1,[](double c){return fabs(c);});
double max=*std::max_element(values1,values1+5);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12);
f1->decrRef();
f1->setMesh(m);
f1->setEndTime(1.2,3,4);
f1->fillFromAnalytic(1,"y+2*x");
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==CONST_ON_TIME_INTERVAL);
- CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(9,f1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(9,(int)f1->getNumberOfTuples());
double values2[9]={-0.9,0.1,1.1,-0.4,0.6,1.6,0.1,1.1,2.1};
tmp=f1->getArray()->getConstPointer();
std::transform(tmp,tmp+9,values2,values2,std::minus<double>());
- std::transform(values2,values2+9,values2,std::ptr_fun<double,double>(fabs));
+ std::transform(values2,values2+9,values2,[](double c){return fabs(c);});
max=*std::max_element(values2,values2+9);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12);
f1->decrRef();
f1->setMesh(m);
f1->setEndTime(1.2,3,4);
f1->fillFromAnalytic(1,"2.*x+y");
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==LINEAR_TIME);
- CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(9,f1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(9,(int)f1->getNumberOfTuples());
tmp=f1->getArray()->getConstPointer();
double values2Bis[9]={-0.9,0.1,1.1,-0.4,0.6,1.6,0.1,1.1,2.1};
double values2BisBis[9];
std::transform(tmp,tmp+9,values2Bis,values2BisBis,std::minus<double>());
- std::transform(values2,values2+9,values2BisBis,std::ptr_fun<double,double>(fabs));
+ std::transform(values2,values2+9,values2BisBis,[](double c){return fabs(c);});
max=*std::max_element(values2BisBis,values2BisBis+9);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12);
tmp=f1->getEndArray()->getConstPointer();
std::transform(tmp,tmp+9,values2Bis,values2BisBis,std::minus<double>());
- std::transform(values2,values2+9,values2BisBis,std::ptr_fun<double,double>(fabs));
+ std::transform(values2,values2+9,values2BisBis,[](double c){return fabs(c);});
max=*std::max_element(values2BisBis,values2BisBis+9);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12);
f1->decrRef();
f1=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME);
f1->setMesh(m);
f1->fillFromAnalytic(2,"(x+y)*IVec+2*(x+y)*JVec");
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==NO_TIME);
- CPPUNIT_ASSERT_EQUAL(2,f1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(9,f1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,(int)f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(9,(int)f1->getNumberOfTuples());
double values3[18]={-0.6,-1.2,-0.1,-0.2,0.4,0.8,-0.1,-0.2,0.4,0.8,0.9,1.8,0.4,0.8,0.9,1.8,1.4,2.8};
tmp=f1->getArray()->getConstPointer();
std::transform(tmp,tmp+18,values3,values3,std::minus<double>());
- std::transform(values3,values3+18,values3,std::ptr_fun<double,double>(fabs));
+ std::transform(values3,values3+18,values3,[](double c){return fabs(c);});
max=*std::max_element(values3,values3+18);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12);
double values4[2];
CPPUNIT_ASSERT_DOUBLES_EQUAL(3.6,values4[0],1.e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(7.2,values4[1],1.e-12);
f1->integral(true,values4);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,values4[0],1.e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,values4[1],1.e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.4,values4[0],1.e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.8,values4[1],1.e-12);
f1->decrRef();
//
f1=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME);
CPPUNIT_ASSERT_THROW((*f1)=0.07,INTERP_KERNEL::Exception);
f1->setMesh(m);
(*f1)=0.07;
- f1->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples());
+ f1->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f1->getNumberOfTuples());
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.07,f1->getIJ(i,0),1e-16);
(*f1)=0.09;
- f1->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples());
+ f1->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)f1->getNumberOfTuples());
for(int i=0;i<5;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.09,f1->getIJ(i,0),1e-16);
f1->decrRef();
f1->setEndTime(4.5,2,3);
f1->setMesh(m);
(*f1)=0.08;
- f1->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(9,f1->getNumberOfTuples());
+ f1->checkConsistencyLight();
+ CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(9,(int)f1->getNumberOfTuples());
for(int i=0;i<9;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.08,f1->getIJ(i,0),1e-16);
- CPPUNIT_ASSERT_EQUAL(1,f1->getEndArray()->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(9,f1->getEndArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)f1->getEndArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(9,(int)f1->getEndArray()->getNumberOfTuples());
for(int i=0;i<9;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.08,f1->getEndArray()->getIJ(i,0),1e-16);
f1->decrRef();
mesh->setCoords(coo);
coo->decrRef();
//
- int tmpConn[8]={0,1,2,3,4,5,6,7};
+ mcIdType tmpConn[8]={0,1,2,3,4,5,6,7};
mesh->allocateCells(3);
mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,tmpConn);
- std::transform(tmpConn,tmpConn+8,tmpConn,std::bind2nd(std::plus<int>(),8));
+ std::transform(tmpConn,tmpConn+8,tmpConn,std::bind(std::plus<int>(),std::placeholders::_1,8));
mesh->insertNextCell(INTERP_KERNEL::NORM_PENTA6,6,tmpConn);
- std::transform(tmpConn,tmpConn+8,tmpConn,std::bind2nd(std::plus<int>(),6));
+ std::transform(tmpConn,tmpConn+8,tmpConn,std::bind(std::plus<int>(),std::placeholders::_1,6));
mesh->insertNextCell(INTERP_KERNEL::NORM_PYRA5,5,tmpConn);
mesh->finishInsertingCells();
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
bool isMerged;
- int newNebOfNodes;
- DataArrayInt *da=mesh->mergeNodes(1e-7,isMerged,newNebOfNodes);
+ mcIdType newNebOfNodes;
+ DataArrayIdType *da=mesh->mergeNodes(1e-7,isMerged,newNebOfNodes);
da->decrRef();
- CPPUNIT_ASSERT_EQUAL(12,newNebOfNodes);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(12),newNebOfNodes);
MEDCouplingFieldDouble *vols=mesh->getMeasureField(true);
- CPPUNIT_ASSERT_EQUAL(3,vols->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,vols->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(3,(int)vols->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)vols->getNumberOfComponents());
CPPUNIT_ASSERT_DOUBLES_EQUAL(volHexa8,vols->getIJ(0,0),1e-6);
CPPUNIT_ASSERT_DOUBLES_EQUAL(volPenta6,vols->getIJ(1,0),1e-7);
CPPUNIT_ASSERT_DOUBLES_EQUAL(volPyra5,vols->getIJ(2,0),1e-7);
vols->decrRef();
- DataArrayDouble *bary=mesh->getBarycenterAndOwner();
- CPPUNIT_ASSERT_EQUAL(3,bary->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,bary->getNumberOfComponents());
+ DataArrayDouble *bary=mesh->computeCellCenterOfMass();
+ CPPUNIT_ASSERT_EQUAL(3,(int)bary->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,(int)bary->getNumberOfComponents());
CPPUNIT_ASSERT_DOUBLES_EQUAL(baryHexa8[0],bary->getIJ(0,0),1e-11);
CPPUNIT_ASSERT_DOUBLES_EQUAL(baryHexa8[1],bary->getIJ(0,1),1e-11);
CPPUNIT_ASSERT_DOUBLES_EQUAL(baryHexa8[2],bary->getIJ(0,2),1e-11);