-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2021 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
MEDCouplingFieldDouble *trgfield=remapper.transferField(srcField,4.57);
const double *values=trgfield->getArray()->getConstPointer();
const double valuesExpected[5]={7.5 ,7. ,7.,8.,7.5};
- CPPUNIT_ASSERT_EQUAL(5,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<5;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i0],values[i0],1e-12);
trgfield->decrRef();
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
const double valuesExpected2[5]={3.75 ,1.75 ,1.75,4.,3.75};
- CPPUNIT_ASSERT_EQUAL(5,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<5;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[i0],values[i0],1e-12);
trgfield->decrRef();
srcField->setNature(IntensiveMaximum);
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
- CPPUNIT_ASSERT_EQUAL(5,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<5;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i0],values[i0],1e-12);
trgfield->decrRef();
srcField->setNature(ExtensiveConservation);
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
- CPPUNIT_ASSERT_EQUAL(5,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<5;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[i0],values[i0],1e-12);
trgfield->decrRef();
srcField->setNature(ExtensiveMaximum);
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
- CPPUNIT_ASSERT_EQUAL(5,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<5;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[i0],values[i0],1e-12);
trgfield->decrRef();
srcField->setNature(IntensiveConservation);
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
- CPPUNIT_ASSERT_EQUAL(5,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<5;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i0],values[i0],1e-12);
trgfield->decrRef();
MEDCouplingFieldDouble *srcfield=remapper.reverseTransferField(targetField,4.57);
const double *values=srcfield->getArray()->getConstPointer();
const double valuesExpected[2]={8.75 ,9.5};
- CPPUNIT_ASSERT_EQUAL(2,srcfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,srcfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)srcfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)srcfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i0],values[i0],1e-12);
srcfield->decrRef();
srcfield=remapper.reverseTransferField(targetField,4.57);
values=srcfield->getArray()->getConstPointer();
const double valuesExpected2[2]={26., 19.};
- CPPUNIT_ASSERT_EQUAL(2,srcfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,srcfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)srcfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)srcfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[i0],values[i0],1e-12);
srcfield->decrRef();
MEDCouplingFieldDouble *trgfield=remapper.transferField(srcField,4.57);
const double *values=trgfield->getArray()->getConstPointer();
const double valuesExpected1[2]={9.0540540540540526,7.4};
- CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected1[i0],values[i0],1e-12);
trgfield->decrRef();
srcField->setNature(ExtensiveMaximum);
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
- CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[i0],values[i0],1e-12);
trgfield->decrRef();
srcField->setNature(ExtensiveConservation);
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
- CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected3[i0],values[i0],1e-12);
trgfield->decrRef();
srcField->setNature(IntensiveConservation);
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
- CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected4[i0],values[i0],1e-12);
trgfield->decrRef();
//
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
- CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected1[i0],values[i0],1e-12);
trgfield->decrRef();
srcField->setNature(ExtensiveMaximum);
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
- CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[i0],values[i0],1e-12);
trgfield->decrRef();
srcField->setNature(ExtensiveConservation);
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
- CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected3[i0],values[i0],1e-12);
trgfield->decrRef();
srcField->setNature(IntensiveConservation);
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
- CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected4[i0],values[i0],1e-12);
trgfield->decrRef();
MEDCouplingFieldDouble *trgfield=remapper.transferField(srcField,4.57);
const double *values=trgfield->getArray()->getConstPointer();
const double valuesExpected[5]={7.5 ,7. ,7.,8.,7.5};
- CPPUNIT_ASSERT_EQUAL(5,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<5;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i0],values[i0],1e-12);
trgfield->decrRef();
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
const double valuesExpected2[5]={7.,7.666666666666667,8.6666666666666661,8.8333333333333339,10.};
- CPPUNIT_ASSERT_EQUAL(5,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<5;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[i0],values[i0],1e-12);
trgfield->decrRef();
trgfield=remapper.transferField(srcField,4.57);
values=trgfield->getArray()->getConstPointer();
const double valuesExpected3[4]={7.5,8.5,10.,10.625};
- CPPUNIT_ASSERT_EQUAL(4,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<4;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected3[i0],values[i0],1e-12);
trgfield->decrRef();
values=trgfield->getArray()->getConstPointer();
const double valuesExpected4[9]={ 7.,7.35,8.,7.7,8.2857142857142865,
9.5333333333333332,9.,9.7666666666666657,10.};
- CPPUNIT_ASSERT_EQUAL(9,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(9,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<9;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected4[i0],values[i0],1e-12);
trgfield->decrRef();
MEDCouplingFieldDouble *trgField=remapper.transferField(srcField,4.57);
const double *values=trgField->getArray()->getConstPointer();
const double valuesExpected[5]={7.5 ,7. ,7.,8.,7.5};
- CPPUNIT_ASSERT_EQUAL(5,trgField->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgField->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)trgField->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgField->getArray()->getNumberOfComponents());
for(int i0=0;i0<5;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i0],values[i0],1e-12);
trgField->decrRef();
ptr[i]=(double)(i+8);
array->decrRef();
trgField=remapper.transferField(srcField,4.57);
- CPPUNIT_ASSERT_EQUAL(5,trgField->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgField->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)trgField->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgField->getArray()->getNumberOfComponents());
const double valuesExpected2[5]={8.5,8.,8.,9.,8.5};
values=trgField->getArray()->getConstPointer();
for(int i0=0;i0<5;i0++)
ptr[i]=(double)(i+7);
array->decrRef();
trgField=remapper.transferField(srcField,4.57);
- CPPUNIT_ASSERT_EQUAL(8,trgField->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgField->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(8,(int)trgField->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgField->getArray()->getNumberOfComponents());
const double valuesExpected3[8]={13.166666666666668, 13.888888888888888, 10.722222222222223, 10.870370370370372,
14.555555555555555, 13.888888888888889, 14.444444444444443, 11.72222222222222};
values=trgField->getArray()->getConstPointer();
ptr[i]=(double)(i+7);
array->decrRef();
trgField=remapper.transferField(srcField,4.57);
- CPPUNIT_ASSERT_EQUAL(8,trgField->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgField->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(8,(int)trgField->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgField->getArray()->getNumberOfComponents());
const double valuesExpected4[8]={7.,11.,8.,12.,9.,13.,10.,14.};
values=trgField->getArray()->getConstPointer();
for(int i0=0;i0<8;i0++)
ptr[i]=(double)(i+7);
array->decrRef();
trgField=remapper.transferField(srcField,4.57);
- CPPUNIT_ASSERT_EQUAL(8,trgField->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgField->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(8,(int)trgField->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgField->getArray()->getNumberOfComponents());
const double valuesExpected5[8]={7.,9.,11.,13.,8.,10.,12.,14.};
values=trgField->getArray()->getConstPointer();
for(int i0=0;i0<8;i0++)
CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0"));
trgField=remapper.transferField(srcField,4.57);
values=trgField->getArray()->getConstPointer();
- CPPUNIT_ASSERT_EQUAL(1,trgField->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgField->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgField->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgField->getNumberOfComponents());
CPPUNIT_ASSERT_DOUBLES_EQUAL(9.125,values[0],1e-14);
srcField->decrRef();
srcField=remapper.reverseTransferField(trgField,4.220173);
- CPPUNIT_ASSERT_EQUAL(5,srcField->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,srcField->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)srcField->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)srcField->getNumberOfComponents());
values=srcField->getArray()->getConstPointer();
for(int i0=0;i0<5;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(9.125,values[i0],1e-14);
srcField->decrRef();
trgField->setNature(ExtensiveMaximum);
srcField=remapper.reverseTransferField(trgField,4.220173);
- CPPUNIT_ASSERT_EQUAL(5,srcField->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,srcField->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,(int)srcField->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)srcField->getNumberOfComponents());
values=srcField->getArray()->getConstPointer();
const double valuesExpected6[5]={2.28125,1.140625,1.140625,2.28125,2.28125};
for(int i0=0;i0<5;i0++)
sourceMesh->decrRef();
targetMesh->decrRef();
//------------- 1D -> 2D
- const int conn[8]={0,1,1,2,2,3,3,0};
- const int conn2[12]={6,7,5,4,2,7,6,3,0,4,5,1};
+ const mcIdType conn[8]={0,1,1,2,2,3,3,0};
+ const mcIdType conn2[12]={6,7,5,4,2,7,6,3,0,4,5,1};
const double coords1[]={0.17,0.93,0.56,0.93,0.56,0.25,0.17,0.52};
const double coords2[]={0.,0.,1.,0.,1.,1.,0.,1.,0.,0.5,1.,0.5,0.,0.8,1.,0.8};
sourceMesh=MEDCouplingUMesh::New("src1D",1);
srcField->setArray(array); array->decrRef();
trgField=remapper.transferField(srcField,4.57);
const double valuesExpected10[3]={3.9674868868103834, 2.8, 3.6372633449255796};
- CPPUNIT_ASSERT_EQUAL(3,trgField->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgField->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(3,(int)trgField->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgField->getNumberOfComponents());
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected10[i],trgField->getIJ(i,0),1e-13);
srcField->decrRef();
srcField->setArray(array); array->decrRef();
trgField=remapper.transferField(srcField,4.57);
const double valuesExpected11[4]={3., 2.9264705882352944, 3.8518518518518516, 2.3170731707317076};
- CPPUNIT_ASSERT_EQUAL(4,trgField->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgField->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,(int)trgField->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgField->getNumberOfComponents());
for(int i=0;i<4;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected11[i],trgField->getIJ(i,0),1e-13);
srcField->decrRef();
srcField->setArray(array); array->decrRef();
trgField=remapper.transferField(srcField,4.57);
const double valuesExpected12[3]={5.70909090909091, 6.08362715128042, 6.92857142857143};
- CPPUNIT_ASSERT_EQUAL(3,trgField->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgField->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(3,(int)trgField->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgField->getNumberOfComponents());
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected12[i],trgField->getIJ(i,0),1e-13);
srcField->decrRef();
srcField->setArray(array); array->decrRef();
trgField=remapper.transferField(srcField,4.57);
const double valuesExpected13[7]={3., 4., 2.5, 2.909090909090909, 2., 3.5, 3.3571428571428572};
- CPPUNIT_ASSERT_EQUAL(7,trgField->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgField->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(7,(int)trgField->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgField->getNumberOfComponents());
for(int i=0;i<7;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected13[i],trgField->getIJ(i,0),1e-13);
srcField->decrRef();
MEDCouplingFieldDouble *trgfield=remapper.transferField(srcField,4.220173);
const double *values=trgfield->getArray()->getConstPointer();
const double valuesExpected[4]={7.75, 7.0625, 4.220173,8.0};
- CPPUNIT_ASSERT_EQUAL(4,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<4;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i0],values[i0],1e-12);
trgfield->decrRef();
trgfield=remapper.transferField(srcField,4.220173);
values=trgfield->getArray()->getConstPointer();
const double valuesExpected2[4]={2.8374999999999999, 7.3624999999999998, 4.220173, 4.7999999999999998};
- CPPUNIT_ASSERT_EQUAL(4,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<4;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[i0],values[i0],1e-12);
trgfield->decrRef();
trgfield=remapper.transferField(srcField,4.220173);
values=trgfield->getArray()->getConstPointer();
const double valuesExpected3[4]={1.24, 4.5199999999999996, 4.220173, 1.9199999999999999};
- CPPUNIT_ASSERT_EQUAL(4,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<4;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected3[i0],values[i0],1e-12);
trgfield->decrRef();
trgfield=remapper.transferField(srcField,4.220173);
values=trgfield->getArray()->getConstPointer();
const double valuesExpected9[4]={2.48, 3.766666666666666, 4.220173, 1.9199999999999999};
- CPPUNIT_ASSERT_EQUAL(4,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<4;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected9[i0],values[i0],1e-12);
trgfield->decrRef();
srcField=remapper.reverseTransferField(trgfield,4.220173);
values=srcField->getArray()->getConstPointer();
const double valuesExpected4[2]={7.9375, 8.9};
- CPPUNIT_ASSERT_EQUAL(2,srcField->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,srcField->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)srcField->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)srcField->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected4[i0],values[i0],1e-12);
srcField->decrRef();
trgfield=remapper.transferField(srcField,4.220173);
values=trgfield->getArray()->getConstPointer();
const double valuesExpected5[2]={7.9375, 8.9};
- CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected5[i0],values[i0],1e-12);
trgfield->decrRef();
trgfield=remapper.transferField(srcField,4.220173);
values=trgfield->getArray()->getConstPointer();
const double valuesExpected6[4]={9.25, 15.75};
- CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected6[i0],values[i0],1e-12);
trgfield->decrRef();
trgfield=remapper.transferField(srcField,4.220173);
values=trgfield->getArray()->getConstPointer();
const double valuesExpected7[2]={4.56, 4.3466666666666667};
- CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected7[i0],values[i0],1e-12);
trgfield->decrRef();
trgfield=remapper.transferField(srcField,4.220173);
values=trgfield->getArray()->getConstPointer();
const double valuesExpected10[2]={5.08, 3.56};
- CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<2;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected10[i0],values[i0],1e-12);
trgfield->decrRef();
srcField=remapper.reverseTransferField(trgfield,4.220173);
values=srcField->getArray()->getConstPointer();
const double valuesExpected8[4]={7.75, 7.0625,4.220173, 8.0};
- CPPUNIT_ASSERT_EQUAL(4,srcField->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,srcField->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,(int)srcField->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)srcField->getArray()->getNumberOfComponents());
for(int i0=0;i0<4;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected8[i0],values[i0],1e-12);
srcField->decrRef();
{
MEDCouplingUMesh *meshN,*meshTT,*meshTF;
MEDCouplingBasicsTest::build3DExtrudedUMesh_2(meshN,meshTT,meshTF);
- std::vector<int> n;
+ std::vector<mcIdType> n;
double pt[3]={300.,300.,0.};
double v[3]={0.,0.,2.};
meshN->findNodesOnPlane(pt,v,1e-12,n);
MEDCouplingUMesh *meshN2D=(MEDCouplingUMesh *)meshN->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
n.clear();
bool b=false;
- int newNbOfNodes;
- DataArrayInt *da=meshTT->mergeNodes(1e-12,b,newNbOfNodes);
+ mcIdType newNbOfNodes;
+ DataArrayIdType *da=meshTT->mergeNodes(1e-12,b,newNbOfNodes);
CPPUNIT_ASSERT(b);
da->decrRef();
meshTT->findNodesOnPlane(pt,v,1e-12,n);
1000.,1000.,1020.,1030.,1040.,1000.,1000.,1070.,1080.,1090.,1000.,1000.,1120.,1130.,1140.,1000.,1000.,1170.,1180.,1190.,
2000.,2000.,2020.,2030.,2040.,2000.,2000.,2070.,2080.,2090.,2000.,2000.,2120.,2130.,2140.,2000.,2000.,2170.,2180.,2190.,
};
- CPPUNIT_ASSERT_EQUAL((int)(sizeof(vals1)/sizeof(double)),meshNE->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL((int)(sizeof(vals1)/sizeof(double)),(int)meshNE->getNumberOfCells());
std::copy(vals1,vals1+meshNE->getNumberOfCells(),array->getPointer());
array->decrRef();
MEDCouplingFieldDouble *trgField=remapper.transferField(srcField,4.220173);
MEDCouplingFieldDouble *trgfield=remapper.transferField(srcField,4.220173);
const double *values=trgfield->getArray()->getConstPointer();
const double valuesExpected[4]={7.75, 7.0625, 4.220173,8.0};
- CPPUNIT_ASSERT_EQUAL(4,trgfield->getArray()->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,(int)trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)trgfield->getArray()->getNumberOfComponents());
for(int i0=0;i0<4;i0++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i0],values[i0],1e-12);
trgfield->decrRef();
0.59,0.09, 0.69,0.19, 0.21,-0.29,0.31,-0.19, 0.45,0.25,0.65,0.45,
-0.2,-0.2,0.11,0.11, 0.25,0.25, 0.45,0.45
};
- int targetConn[10]={0,1, 2,3, 4,5, 6,7, 8,9};
+ mcIdType targetConn[10]={0,1, 2,3, 4,5, 6,7, 8,9};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New("my name of mesh 1D 2",1);
targetMesh->allocateCells(5);
double targetCoords[20]={-0.6,-0.4, -0.1,-0.4, 1.1,-0.4, 2.1,-0.4,
-0.6,0.1, -0.1,0.1, 1.1,0.1, 2.1,0.1,
-0.6,1.1, -0.1,1.1};
- int targetConn[16]={0,4,5,1, 1,5,6,2, 2,6,7,3, 4,8,9,5};
+ mcIdType targetConn[16]={0,4,5,1, 1,5,6,2, 2,6,7,3, 4,8,9,5};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(4);
0.,0.,3., 1.,1.,3., 1.,1.25,3., 0.,1.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3.,
3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.};
- int conn[354]={
+ mcIdType conn[354]={
// 0
0,11,1,3,15,26,16,18, 1,2,4,7,13,6,-1,1,16,21,6,-1,6,21,28,13,-1,13,7,22,28,-1,7,4,19,22,-1,4,2,17,19,-1,2,1,16,17,-1,16,21,28,22,19,17,
1,6,5,3,16,21,20,18, 13,10,9,6,28,25,24,21,
41,38,37,34,32,31,-1,41,56,46,31,-1,31,46,47,32,-1,32,47,49,34,-1,34,49,52,37,-1,37,38,53,52,-1,38,41,56,53,-1,56,46,47,49,52,53,
37,42,44,43,52,57,59,58
};
- int conn2[28]={7,12,14,13, 11,8,7,4,2,1, 13,10,9,6, 1,6,5,3, 1,2,4,7,13,6, 0,11,1,3};
+ mcIdType conn2[28]={7,12,14,13, 11,8,7,4,2,1, 13,10,9,6, 1,6,5,3, 1,2,4,7,13,6, 0,11,1,3};
//
MEDCouplingUMesh *ret=MEDCouplingUMesh::New();
ret->setMeshDimension(3);
array->alloc(sourceMesh->getNumberOfCells(),1);
srcField->setArray(array);
double *ptr=array->getPointer();
- for(int i=0;i<sourceMesh->getNumberOfCells();i++)
+ for(mcIdType i=0;i<sourceMesh->getNumberOfCells();i++)
ptr[i]=(double)(i+7);
array->decrRef();
MEDCouplingFieldDouble *trgField=MEDCouplingFieldDouble::New(ON_CELLS);
// source
DataArrayDouble *coordsSrc(DataArrayDouble::New());
const double coordsSrcData[18]={-6.25,3.6084391824351605,264.85199999999998,-6.25,3.6084391824351605,289.05200000000002,-6.2499999999999991,-3.6084391824351618,264.85199999999998,-6.2499999999999991,-3.6084391824351618,289.05200000000002,-1.7763568394002505e-15,4.4408920985006262e-15,264.85199999999998,-1.7763568394002505e-15,4.4408920985006262e-15,289.05200000000002};
- coordsSrc->useArray(coordsSrcData,false,CPP_DEALLOC,6,3);
- DataArrayInt *connSrc(DataArrayInt::New()),*connISrc(DataArrayInt::New());
- const int connSrcData[7]={16,2,0,4,3,1,5};
- connSrc->useArray(connSrcData,false,CPP_DEALLOC,7,1);
- const int connISrcData[2]={0,7};
- connISrc->useArray(connISrcData,false,CPP_DEALLOC,2,1);
+ coordsSrc->useArray(coordsSrcData,false,DeallocType::CPP_DEALLOC,6,3);
+ DataArrayIdType *connSrc(DataArrayIdType::New()),*connISrc(DataArrayIdType::New());
+ const mcIdType connSrcData[7]={16,2,0,4,3,1,5};
+ connSrc->useArray(connSrcData,false,DeallocType::CPP_DEALLOC,7,1);
+ const mcIdType connISrcData[2]={0,7};
+ connISrc->useArray(connISrcData,false,DeallocType::CPP_DEALLOC,2,1);
MEDCouplingUMesh *srcMesh(MEDCouplingUMesh::New("source",3));
srcMesh->setCoords(coordsSrc);
srcMesh->setConnectivity(connSrc,connISrc,true);
coordsSrc->decrRef(); connSrc->decrRef(); connISrc->decrRef();
// target
DataArrayDouble *coordsTrg(DataArrayDouble::New());
-const double coordsTrgData[36]={-2,1.1547005383792521,264.85199999999998,-2,0.57735026918962618,264.85199999999998,-2.5,0.2886751345948132,264.85199999999998,-2.5,1.443375672974065,264.85199999999998,-3.0000000000000004,1.1547005383792526,264.85199999999998,-3.0000000000000004,0.57735026918962662,264.85199999999998,-2,1.1547005383792521,289.05200000000002,-2,0.57735026918962618,289.05200000000002,-2.5,0.2886751345948132,289.05200000000002,-2.5,1.443375672974065,289.05200000000002,-3.0000000000000004,1.1547005383792526,289.05200000000002,-3.0000000000000004,0.57735026918962662,289.05200000000002};
- coordsTrg->useArray(coordsTrgData,false,CPP_DEALLOC,12,3);
- DataArrayInt *connTrg=DataArrayInt::New();
- const int connTrgData[44]={31,0,1,2,5,4,3,-1,7,6,9,10,11,8,-1,3,9,6,0,-1,4,10,9,3,-1,5,11,10,4,-1,2,8,11,5,-1,1,7,8,2,-1,0,6,7,1};
- connTrg->useArray(connTrgData,false,CPP_DEALLOC,44,1);
- DataArrayInt *connITrg=DataArrayInt::New();
- const int connITrgData[2]={0,44};
- connITrg->useArray(connITrgData,false,CPP_DEALLOC,2,1);
- MEDCouplingUMesh *trgMesh=MEDCouplingUMesh::New("target",3);
- trgMesh->setCoords(coordsTrg);
- trgMesh->setConnectivity(connTrg,connITrg,true);
- coordsTrg->decrRef(); connTrg->decrRef(); connITrg->decrRef();
- // Go !
- const double valExpected(20.957814771583468);
- MEDCouplingRemapper remapper;
- remapper.setPrecision(1e-12);
- remapper.setIntersectionType(INTERP_KERNEL::Triangulation);
- CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(srcMesh,trgMesh,"P0P0"));
- std::vector<std::map<int,double> > matrx(remapper.getCrudeMatrix());
- CPPUNIT_ASSERT_EQUAL(1,(int)matrx.size());
- CPPUNIT_ASSERT_EQUAL(1,(int)matrx[0].size());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(valExpected,matrx[0][0],1e-13);
- //
- srcMesh->decrRef(); trgMesh->decrRef();
+ const double coordsTrgData[36]={-2,1.1547005383792521,264.85199999999998,-2,0.57735026918962618,264.85199999999998,-2.5,0.2886751345948132,264.85199999999998,-2.5,1.443375672974065,264.85199999999998,-3.0000000000000004,1.1547005383792526,264.85199999999998,-3.0000000000000004,0.57735026918962662,264.85199999999998,-2,1.1547005383792521,289.05200000000002,-2,0.57735026918962618,289.05200000000002,-2.5,0.2886751345948132,289.05200000000002,-2.5,1.443375672974065,289.05200000000002,-3.0000000000000004,1.1547005383792526,289.05200000000002,-3.0000000000000004,0.57735026918962662,289.05200000000002};
+ coordsTrg->useArray(coordsTrgData,false,DeallocType::CPP_DEALLOC,12,3);
+ DataArrayIdType *connTrg=DataArrayIdType::New();
+ const mcIdType connTrgData[44]={31,0,1,2,5,4,3,-1,7,6,9,10,11,8,-1,3,9,6,0,-1,4,10,9,3,-1,5,11,10,4,-1,2,8,11,5,-1,1,7,8,2,-1,0,6,7,1};
+ connTrg->useArray(connTrgData,false,DeallocType::CPP_DEALLOC,44,1);
+ DataArrayIdType *connITrg=DataArrayIdType::New();
+ const mcIdType connITrgData[2]={0,44};
+ connITrg->useArray(connITrgData,false,DeallocType::CPP_DEALLOC,2,1);
+ MEDCouplingUMesh *trgMesh=MEDCouplingUMesh::New("target",3);
+ trgMesh->setCoords(coordsTrg);
+ trgMesh->setConnectivity(connTrg,connITrg,true);
+ coordsTrg->decrRef(); connTrg->decrRef(); connITrg->decrRef();
+ // Go !
+ const double valExpected(20.957814771583468);
+ MEDCouplingRemapper remapper;
+ remapper.setPrecision(1e-12);
+ remapper.setIntersectionType(INTERP_KERNEL::Triangulation);
+ CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(srcMesh,trgMesh,"P0P0"));
+ std::vector<std::map<mcIdType,double> > matrx(remapper.getCrudeMatrix());
+ CPPUNIT_ASSERT_EQUAL(1,(int)matrx.size());
+ CPPUNIT_ASSERT_EQUAL(1,(int)matrx[0].size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(valExpected,matrx[0][0],1e-13);
+ //
+ srcMesh->decrRef(); trgMesh->decrRef();
}