-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016 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
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "MEDCouplingBasicsTest1.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include <algorithm>
#include <functional>
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
void MEDCouplingBasicsTest1::testArray()
{
CPPUNIT_ASSERT_EQUAL(7,arr1->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,arr1->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(arr1Ref,arr1Ref+14,arr1->getConstPointer()));
- DataArrayInt *arr2=arr1->substr(3);
+ DataArrayInt *arr2=arr1->subArray(3);
CPPUNIT_ASSERT_EQUAL(4,arr2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,arr2->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(arr1Ref+6,arr1Ref+14,arr2->getConstPointer()));
arr2->decrRef();
- DataArrayInt *arr3=arr1->substr(2,5);
+ DataArrayInt *arr3=arr1->subArray(2,5);
CPPUNIT_ASSERT_EQUAL(3,arr3->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,arr3->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(arr1Ref+4,arr1Ref+10,arr3->getConstPointer()));
CPPUNIT_ASSERT_EQUAL(7,arr4->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,arr4->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(arr4Ref,arr4Ref+14,arr4->getConstPointer()));
- DataArrayDouble *arr5=arr4->substr(3);
+ DataArrayDouble *arr5=arr4->subArray(3);
CPPUNIT_ASSERT_EQUAL(4,arr5->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,arr5->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(arr4Ref+6,arr4Ref+14,arr5->getConstPointer()));
arr5->decrRef();
- DataArrayDouble *arr6=arr4->substr(2,5);
+ DataArrayDouble *arr6=arr4->subArray(2,5);
CPPUNIT_ASSERT_EQUAL(3,arr6->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,arr6->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(arr4Ref+4,arr4Ref+10,arr6->getConstPointer()));
mesh->setCoords(myCoords);
myCoords->decrRef();
CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh->getNumberOfCells());
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
//test 1 - no copy ownership C++
myCoords=DataArrayDouble::New();
double *tmp=new double[3*nbOfNodes];
mesh->setCoords(myCoords);
myCoords->decrRef();
CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh->getNumberOfCells());
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
//test 2 - no copy ownership C
myCoords=DataArrayDouble::New();
tmp=(double *)malloc(3*nbOfNodes*sizeof(double));
mesh->setCoords(myCoords);
myCoords->decrRef();
CPPUNIT_ASSERT_EQUAL(nbOfNodes,mesh->getNumberOfNodes());
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
//test 3 - copy.
myCoords=DataArrayDouble::New();
myCoords->alloc(nbOfNodes,3);
mesh->setCoords(myCoords);
myCoords->decrRef();
CPPUNIT_ASSERT_EQUAL(nbOfNodes,mesh->getNumberOfNodes());
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
// test clone not recursively
MEDCouplingUMesh *mesh2=mesh->clone(false);
CPPUNIT_ASSERT(mesh2!=mesh);
- mesh2->checkCoherency();
+ mesh2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh2->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(nbOfNodes,mesh2->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,mesh2->getSpaceDimension());
// test clone not recursively
MEDCouplingUMesh *mesh3=mesh->clone(true);
CPPUNIT_ASSERT(mesh3!=mesh);
- mesh3->checkCoherency();
+ mesh3->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh3->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(nbOfNodes,mesh3->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,mesh3->getSpaceDimension());
std::fill(tmp,tmp+9*nbOfCells,7.);
//content of field changed -> declare it.
fieldOnCells->declareAsNew();
- fieldOnCells->checkCoherency();
+ fieldOnCells->checkConsistencyLight();
// testing clone of fields - no recursive
MEDCouplingFieldDouble *fieldOnCells2=fieldOnCells->clone(false);
CPPUNIT_ASSERT(fieldOnCells2!=fieldOnCells);
- fieldOnCells2->checkCoherency();
+ fieldOnCells2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(nbOfCells,fieldOnCells2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(9,fieldOnCells2->getNumberOfComponents());
CPPUNIT_ASSERT(fieldOnCells2->getArray()==fieldOnCells->getArray());
// testing clone of fields - recursive
MEDCouplingFieldDouble *fieldOnCells3=fieldOnCells->clone(true);
CPPUNIT_ASSERT(fieldOnCells3!=fieldOnCells);
- fieldOnCells3->checkCoherency();
+ fieldOnCells3->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(nbOfCells,fieldOnCells3->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(9,fieldOnCells3->getNumberOfComponents());
CPPUNIT_ASSERT(fieldOnCells3->getArray()!=fieldOnCells->getArray());
targetMesh->insertNextCell(INTERP_KERNEL::NORM_POINT1,1,targetConn+6);
targetMesh->insertNextCell(INTERP_KERNEL::NORM_POINT1,1,targetConn+7);
targetMesh->finishInsertingCells();
- CPPUNIT_ASSERT_THROW(targetMesh->checkCoherency(),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(targetMesh->checkConsistencyLight(),INTERP_KERNEL::Exception);
DataArrayDouble *myCoords=DataArrayDouble::New();
myCoords->alloc(9,3);
std::copy(targetCoords,targetCoords+27,myCoords->getPointer());
targetMesh->setCoords(myCoords);
myCoords->decrRef();
//
- targetMesh->checkCoherency();
+ targetMesh->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(3,targetMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(8,targetMesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(9,targetMesh->getNumberOfNodes());
CPPUNIT_ASSERT_THROW(meshM1D->getNumberOfCells(),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(meshM1D->setMeshDimension(-2),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT_THROW(meshM1D->setMeshDimension(-10),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_THROW(meshM1D->checkCoherency(),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(meshM1D->checkConsistencyLight(),INTERP_KERNEL::Exception);
meshM1D->setMeshDimension(-1);
- meshM1D->checkCoherency();
+ meshM1D->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(-1,meshM1D->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(1,meshM1D->getNumberOfCells());
CPPUNIT_ASSERT_THROW(meshM1D->getNumberOfNodes(),INTERP_KERNEL::Exception);
double *tmp=array->getPointer();
array->decrRef();
std::fill(tmp,tmp+6,7.);
- fieldOnCells->checkCoherency();
+ fieldOnCells->checkConsistencyLight();
//
fieldOnCells->decrRef();
meshM1D->decrRef();
std::fill(array->getPointer(),array->getPointer()+5*3,7.);
CPPUNIT_ASSERT_DOUBLES_EQUAL(7.,array->getIJ(3,2),1e-14);
double *tmp1=array->getPointer();
- DataArrayDouble *array2=array->deepCpy();
+ DataArrayDouble *array2=array->deepCopy();
double *tmp2=array2->getPointer();
CPPUNIT_ASSERT(tmp1!=tmp2);
array->decrRef();
std::fill(array3->getPointer(),array3->getPointer()+5*3,17);
CPPUNIT_ASSERT_EQUAL(17,array3->getIJ(3,2));
int *tmp3=array3->getPointer();
- DataArrayInt *array4=array3->deepCpy();
+ DataArrayInt *array4=array3->deepCopy();
int *tmp4=array4->getPointer();
CPPUNIT_ASSERT(tmp3!=tmp4);
array3->decrRef();
const int elts[2]={1,3};
std::vector<int> eltsV(elts,elts+2);
mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size());
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(5,mesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(23,mesh->getNodalConnectivity()->getNumberOfTuples());
const int *pt=mesh->getNodalConnectivity()->getConstPointer();
////// 3D
mesh=build3DTargetMesh_1();
mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size());
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(8,mesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(114,mesh->getNodalConnectivity()->getNumberOfTuples());
mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size());
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(8,mesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(114,mesh->getNodalConnectivity()->getNumberOfTuples());
//
DataArrayInt *revDescIndx=DataArrayInt::New();
//
MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
- mesh2->checkCoherency();
+ mesh2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(13,mesh2->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples());
const int elts[2]={1,3};
std::vector<int> eltsV(elts,elts+2);
mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size());
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
//
desc=DataArrayInt::New();
descIndx=DataArrayInt::New();
revDescIndx=DataArrayInt::New();
//
mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
- mesh2->checkCoherency();
+ mesh2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(13,mesh2->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples());
DataArrayInt *revDescIndx=DataArrayInt::New();
//
MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
- mesh2->checkCoherency();
+ mesh2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(36,mesh2->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL((std::size_t)37,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,revDescIndx->getNumberOfTuples());
const int elts[2]={1,3};
std::vector<int> eltsV(elts,elts+2);
mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size());
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
desc=DataArrayInt::New();
descIndx=DataArrayInt::New();
revDesc=DataArrayInt::New();
revDescIndx=DataArrayInt::New();
mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
- mesh2->checkCoherency();
+ mesh2->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(36,mesh2->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL((std::size_t)37,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,revDescIndx->getNumberOfTuples());
MEDCouplingUMesh *subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
CPPUNIT_ASSERT(subMesh);
std::string name(subMesh->getName());
- CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllTypes().size());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*mesh->getAllTypes().begin());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++(mesh->getAllTypes().begin())));
- CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getAllTypes().size());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllTypes().begin());
+ CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*mesh->getAllGeoTypes().begin());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++(mesh->getAllGeoTypes().begin())));
+ CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getAllGeoTypes().size());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin());
CPPUNIT_ASSERT(name=="Toto");
CPPUNIT_ASSERT(mesh->getCoords()==subMesh->getCoords());
CPPUNIT_ASSERT_EQUAL(2,subMesh->getNumberOfCells());
subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
CPPUNIT_ASSERT(subMesh);
name=subMesh->getName();
- CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getAllTypes().size());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllTypes().begin());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++(subMesh->getAllTypes().begin())));
+ CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getAllGeoTypes().size());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllGeoTypes().begin());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++(subMesh->getAllGeoTypes().begin())));
CPPUNIT_ASSERT(name=="Toto");
CPPUNIT_ASSERT(mesh->getCoords()==subMesh->getCoords());
CPPUNIT_ASSERT_EQUAL(3,subMesh->getNumberOfCells());
MEDCouplingPointSet *subMeshSimple=mesh->buildPartOfMySelfNode(tab1,tab1+4,true);
MEDCouplingUMesh *subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
CPPUNIT_ASSERT(subMesh);
- CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getAllTypes().size());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllTypes().begin());
+ CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getAllGeoTypes().size());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin());
CPPUNIT_ASSERT_EQUAL(1,subMesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL((std::size_t)5,subMesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL((std::size_t)2,subMesh->getNodalConnectivityIndex()->getNbOfElems());
subMeshSimple=mesh->buildPartOfMySelfNode(tab1,tab1+2,false);
subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
CPPUNIT_ASSERT(subMesh);
- CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getAllTypes().size());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllTypes().begin());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++subMesh->getAllTypes().begin()));
+ CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getAllGeoTypes().size());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllGeoTypes().begin());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++subMesh->getAllGeoTypes().begin()));
CPPUNIT_ASSERT_EQUAL(3,subMesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL((std::size_t)14,subMesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL((std::size_t)4,subMesh->getNodalConnectivityIndex()->getNbOfElems());
subMeshSimple=mesh->buildPartOfMySelfNode(tab2,tab2+7,true);
subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshSimple);
CPPUNIT_ASSERT(subMesh);
- CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getAllTypes().size());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllTypes().begin());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++subMesh->getAllTypes().begin()));
+ CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getAllGeoTypes().size());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllGeoTypes().begin());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++subMesh->getAllGeoTypes().begin()));
CPPUNIT_ASSERT_EQUAL(3,subMesh->getNumberOfCells());
subMeshSimple->decrRef();
//
void MEDCouplingBasicsTest1::testZipCoords()
{
MEDCouplingUMesh *mesh=build2DTargetMesh_1();
- CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(9,mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(5,mesh->getNumberOfCells());
DataArrayDouble *oldCoords=mesh->getCoords();
oldCoords->incrRef();
mesh->zipCoords();
- CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(9,mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(5,mesh->getNumberOfCells());
const int expectedTraducer[9]={0,1,-1,2,3,4,-1,5,6};
CPPUNIT_ASSERT(std::equal(expectedTraducer,expectedTraducer+9,traducer->getPointer()));
traducer->decrRef();
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllTypes().begin());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin());
CPPUNIT_ASSERT_EQUAL(2,subMesh->getNumberOfCells());
const int subConn[10]={4,0,2,3,1,4,5,6,4,3};
const int subConnIndex[3]={0,5,10};
subMeshPtSet=mesh->buildPartOfMySelf(tab1,tab1+2,false);
subMesh=dynamic_cast<MEDCouplingUMesh *>(subMeshPtSet);
CPPUNIT_ASSERT(subMesh);
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllTypes().begin());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin());
CPPUNIT_ASSERT_EQUAL(2,subMesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(7,subMesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL((std::size_t)10,subMesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT(fieldOnCells1->isEqual(fieldOnCells2,1e-12,1e-15));
CPPUNIT_ASSERT(fieldOnCells2->isEqual(fieldOnCells1,1e-12,1e-15));
//
- DataArrayDouble *arr2=arr->deepCpy();
+ DataArrayDouble *arr2=arr->deepCopy();
fieldOnCells2->setArray(arr2);
arr2->decrRef();
CPPUNIT_ASSERT(fieldOnCells1->isEqual(fieldOnCells2,1e-12,1e-15));
void MEDCouplingBasicsTest1::testNatureChecking()
{
MEDCouplingFieldDouble *field=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
- field->setNature(Integral);
- field->setNature(ConservativeVolumic);
- field->setNature(IntegralGlobConstraint);
+ field->setNature(ExtensiveMaximum);
+ field->setNature(IntensiveMaximum);
+ field->setNature(ExtensiveConservation);
field->decrRef();
field=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME);
- field->setNature(ConservativeVolumic);
- CPPUNIT_ASSERT_THROW(field->setNature(Integral),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_THROW(field->setNature(IntegralGlobConstraint),INTERP_KERNEL::Exception);
+ field->setNature(IntensiveMaximum);
+ CPPUNIT_ASSERT_THROW(field->setNature(ExtensiveMaximum),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(field->setNature(ExtensiveConservation),INTERP_KERNEL::Exception);
field->decrRef();
}
{
MEDCouplingUMesh *mesh2D=0;
MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D);
- MEDCouplingExtrudedMesh *ext=MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,1);
+ MEDCouplingMappedExtrudedMesh *ext=MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,1);
CPPUNIT_ASSERT_EQUAL(18,ext->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(60,ext->getNumberOfNodes());
DataArrayInt *ids3D=ext->getMesh3DIds();
mTT->findNodesOnPlane(pt,v,1e-12,n);
CPPUNIT_ASSERT_EQUAL(43,(int)n.size());
MEDCouplingUMesh *mTT3dSurf=(MEDCouplingUMesh *)mTT->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
- MEDCouplingExtrudedMesh *meTT=MEDCouplingExtrudedMesh::New(mTT,mTT3dSurf,0);
+ MEDCouplingMappedExtrudedMesh *meTT=MEDCouplingMappedExtrudedMesh::New(mTT,mTT3dSurf,0);
CPPUNIT_ASSERT_EQUAL(200,meTT->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(10,meTT->getMesh2D()->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(20,meTT->getMesh1D()->getNumberOfCells());
mN->findNodesOnPlane(pt,v,1e-12,n);
CPPUNIT_ASSERT_EQUAL(30,(int)n.size());
MEDCouplingUMesh *mN3dSurf=(MEDCouplingUMesh *)mN->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
- MEDCouplingExtrudedMesh *meN=MEDCouplingExtrudedMesh::New(mN,mN3dSurf,0);
+ MEDCouplingMappedExtrudedMesh *meN=MEDCouplingMappedExtrudedMesh::New(mN,mN3dSurf,0);
CPPUNIT_ASSERT_EQUAL(40,meN->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(20,meN->getMesh2D()->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(2,meN->getMesh1D()->getNumberOfCells());
mTF->findNodesOnPlane(pt,v,1e-12,n);
CPPUNIT_ASSERT_EQUAL(27,(int)n.size());
MEDCouplingUMesh *mTF3dSurf=(MEDCouplingUMesh *)mTF->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
- MEDCouplingExtrudedMesh *meTF=MEDCouplingExtrudedMesh::New(mTF,mTF3dSurf,0);
+ MEDCouplingMappedExtrudedMesh *meTF=MEDCouplingMappedExtrudedMesh::New(mTF,mTF3dSurf,0);
CPPUNIT_ASSERT_EQUAL(340,meTF->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(17,meTF->getMesh2D()->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(20,meTF->getMesh1D()->getNumberOfCells());
m2->rotate(center,vector,-M_PI/2.);
MEDCouplingUMesh *m3=m1->buildExtrudedMesh(m2,0);
//
- MEDCouplingExtrudedMesh *m4=MEDCouplingExtrudedMesh::New(m3,m1,0);
+ MEDCouplingMappedExtrudedMesh *m4=MEDCouplingMappedExtrudedMesh::New(m3,m1,0);
CPPUNIT_ASSERT_EQUAL(15,m4->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(5,m4->getMesh2D()->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(3,m4->getMesh1D()->getNumberOfCells());
//some random in cells to check that extrusion alg find it correctly
const int expected1[15]={1,3,2,0,6,5,7,10,11,8,12,9,14,13,4};
m3->renumberCells(expected1,false);
- m4=MEDCouplingExtrudedMesh::New(m3,m1,0);
+ m4=MEDCouplingMappedExtrudedMesh::New(m3,m1,0);
CPPUNIT_ASSERT_EQUAL(15,m4->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(5,m4->getMesh2D()->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(3,m4->getMesh1D()->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL((int)INTERP_KERNEL::NORM_POLYHED,(int)m3->getTypeOfCell(3));
CPPUNIT_ASSERT_EQUAL((int)INTERP_KERNEL::NORM_HEXA8,(int)m3->getTypeOfCell(4));
m3->renumberCells(expected1,false);
- m4=MEDCouplingExtrudedMesh::New(m3,m1,0);
+ m4=MEDCouplingMappedExtrudedMesh::New(m3,m1,0);
CPPUNIT_ASSERT_EQUAL(15,m4->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(5,m4->getMesh2D()->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(3,m4->getMesh1D()->getNumberOfCells());
}
/*!
- * This test check MEDCouplingUMesh::buildExtrudedMesh method, but also, MEDCouplingExtrudedMesh following methods :
+ * This test check MEDCouplingUMesh::buildExtrudedMesh method, but also, MEDCouplingMappedExtrudedMesh following methods :
* getCellContainingPoint getMeasureField getNodeIdsOfCell getCoordinateOfNode getTypeOfCell build3DUnstructuredMesh.
*/
void MEDCouplingBasicsTest1::testExtrudedMesh4()
double center[3]={0.,0.,0.};
double vector[3]={0.,1.,0.};
m2->rotate(center,vector,-M_PI/2.);
+ m1->zipCoords();
MEDCouplingUMesh *m3=m1->buildExtrudedMesh(m2,0);
const int expected1[15]= {1,3,2,0,6,5,7,10,11,8,12,9,14,13,4};
const int rexpected1[15]={3, 0, 2, 1, 14, 5, 4, 6, 9, 11, 7, 8, 10, 13, 12};
m3->renumberCells(expected1,false);
- MEDCouplingExtrudedMesh *m4=MEDCouplingExtrudedMesh::New(m3,m1,0);
+ MEDCouplingMappedExtrudedMesh *m4=MEDCouplingMappedExtrudedMesh::New(m3,m1,0);
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,m4->getTypeOfCell(0));
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,m4->getTypeOfCell(1));
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POLYHED,m4->getTypeOfCell(2));
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[rexpected1[i]],arrPtr[i],1e-16);
f->decrRef();
MEDCouplingUMesh *m5=m4->build3DUnstructuredMesh();
+ m5->zipCoords();
CPPUNIT_ASSERT(m5->isEqual(m3,1e-12));
f=m5->getMeasureField(true);
arr=f->getArray();
MEDCouplingMesh *m3=m1->mergeMyselfWith(m2);
MEDCouplingUMesh *m3C=dynamic_cast<MEDCouplingUMesh *>(m3);
CPPUNIT_ASSERT(m3C);
- m3->checkCoherency();
+ m3->checkConsistencyLight();
MEDCouplingUMesh *m4=build2DTargetMeshMerged_1();
CPPUNIT_ASSERT(m3->isEqual(m4,1.e-12));
m4->decrRef();
std::vector<const MEDCouplingUMesh *> meshes;
meshes.push_back(m1); meshes.push_back(m2); meshes.push_back(m3);
MEDCouplingUMesh *m4=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
- m4->checkCoherency();
+ m4->checkConsistencyLight();
CPPUNIT_ASSERT(m4->getCoords()==m1->getCoords());
CPPUNIT_ASSERT_EQUAL(15,m4->getNumberOfCells());
const int cells1[5]={0,1,2,3,4};
MEDCouplingPointSet *m1_1=m4->buildPartOfMySelf(cells1,cells1+5,true);
- m1_1->setName(m1->getName());
+ m1_1->setName(m1->getName().c_str());
CPPUNIT_ASSERT(m1->isEqual(m1_1,1e-12));
const int cells2[5]={5,6,7,8,9};
MEDCouplingPointSet *m2_1=m4->buildPartOfMySelf(cells2,cells2+5,true);
- m2_1->setName(m2->getName());
+ m2_1->setName(m2->getName().c_str());
CPPUNIT_ASSERT(m2->isEqual(m2_1,1e-12));
const int cells3[5]={10,11,12,13,14};
MEDCouplingPointSet *m3_1=m4->buildPartOfMySelf(cells3,cells3+5,true);
- m3_1->setName(m3->getName());
+ m3_1->setName(m3->getName().c_str());
CPPUNIT_ASSERT(m3->isEqual(m3_1,1e-12));
m1_1->decrRef(); m2_1->decrRef(); m3_1->decrRef();
//
MEDCouplingFieldDouble *f1=m1->getMeasureField(true);
MEDCouplingFieldDouble *f2=m2->getMeasureField(true);
MEDCouplingFieldDouble *f3=MEDCouplingFieldDouble::MergeFields(f1,f2);
- f3->checkCoherency();
+ f3->checkConsistencyLight();
MEDCouplingUMesh *m4=build2DTargetMeshMerged_1();
CPPUNIT_ASSERT(f3->getMesh()->isEqual(m4,1.e-12));
std::string name=f3->getName();
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"));
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_CELLS);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME);
CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
f1->decrRef();
//
f1=m->fillFromAnalytic(ON_NODES,1,func1);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME);
CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
f1->decrRef();
//
f1=m->fillFromAnalytic(ON_NODES,2,func2);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME);
CPPUNIT_ASSERT_EQUAL(2,f1->getNumberOfComponents());
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
MEDCouplingFieldDouble *f1=m->fillFromAnalytic(ON_CELLS,1,"y+x");
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_CELLS);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME);
CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
f1->decrRef();
//
f1=m->fillFromAnalytic(ON_NODES,1,"y+2*x");
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME);
CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12);
f1->decrRef();
f1=m->fillFromAnalytic(ON_NODES,1,"2.*x+y");
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME);
CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
f1->decrRef();
//
f1=m->fillFromAnalytic(ON_NODES,2,"(x+y)*IVec+2*(x+y)*JVec");
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME);
CPPUNIT_ASSERT_EQUAL(2,f1->getNumberOfComponents());
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
MEDCouplingFieldDouble *f1=m->fillFromAnalytic(ON_NODES,2,func2);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME);
CPPUNIT_ASSERT_EQUAL(2,f1->getNumberOfComponents());
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
MEDCouplingFieldDouble *f1=m->fillFromAnalytic(ON_NODES,2,func2);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME);
CPPUNIT_ASSERT_EQUAL(2,f1->getNumberOfComponents());
MEDCouplingUMesh *m=build2DTargetMesh_1();
MEDCouplingFieldDouble *f1=m->fillFromAnalytic(ON_NODES,1,func1);
MEDCouplingFieldDouble *f2=m->fillFromAnalytic(ON_NODES,1,func1);
- f1->checkCoherency();
- f2->checkCoherency();
+ f1->checkConsistencyLight();
+ f2->checkConsistencyLight();
MEDCouplingFieldDouble *f3=(*f1)+(*f2);
- f3->checkCoherency();
+ f3->checkConsistencyLight();
CPPUNIT_ASSERT(f3->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f3->getTimeDiscretization()==ONE_TIME);
double values1[9]={-1.2,-0.2,0.8,-0.2,0.8,1.8,0.8,1.8,2.8};
f3->decrRef();
//
f3=(*f1)*(*f2);
- f3->checkCoherency();
+ f3->checkConsistencyLight();
CPPUNIT_ASSERT(f3->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f3->getTimeDiscretization()==ONE_TIME);
double values2[9]={0.36,0.01,0.16,0.01,0.16,0.81,0.16,0.81,1.96};
//
f3=(*f1)+(*f2);
MEDCouplingFieldDouble *f4=(*f1)-(*f3);
- f4->checkCoherency();
+ f4->checkConsistencyLight();
CPPUNIT_ASSERT(f4->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f4->getTimeDiscretization()==ONE_TIME);
double values3[9]={0.6,0.1,-0.4,0.1,-0.4,-0.9,-0.4,-0.9,-1.4};
//
f3=(*f1)+(*f2);
f4=(*f3)/(*f2);
- f4->checkCoherency();
+ f4->checkConsistencyLight();
CPPUNIT_ASSERT(f4->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f4->getTimeDiscretization()==ONE_TIME);
tmp=f4->getArray()->getConstPointer();
f4->decrRef();
//
f4=f2->buildNewTimeReprFromThis(NO_TIME,false);
- f4->checkCoherency();
+ f4->checkConsistencyLight();
CPPUNIT_ASSERT(f4->getArray()==f2->getArray());
CPPUNIT_ASSERT(f4->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f4->getTimeDiscretization()==NO_TIME);
f3->decrRef();
//
f4=f2->buildNewTimeReprFromThis(NO_TIME,true);
- f4->checkCoherency();
+ f4->checkConsistencyLight();
CPPUNIT_ASSERT(f4->getArray()!=f2->getArray());
CPPUNIT_ASSERT(f4->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f4->getTimeDiscretization()==NO_TIME);
MEDCouplingFieldDouble *f1=m->fillFromAnalytic(ON_NODES,1,"x+y+z");
MEDCouplingFieldDouble *f2=m->fillFromAnalytic(ON_NODES,1,"a*a+b+c*c");
MEDCouplingFieldDouble *f3=(*f1)/(*f2);
- f3->checkCoherency();
+ f3->checkConsistencyLight();
CPPUNIT_ASSERT(f3->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f3->getTimeDiscretization()==ONE_TIME);
const double expected1[9]={-2.4999999999999991, 1.2162162162162162, 0.77868852459016391,
MEDCouplingFieldDouble *f1=m->fillFromAnalytic(ON_NODES,1,"x+y+z");
MEDCouplingFieldDouble *f2=m->fillFromAnalytic(ON_NODES,1,"a*a+b+c*c");
(*f1)/=(*f2);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES);
CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME);
const double expected1[9]={-2.4999999999999991, 1.2162162162162162, 0.77868852459016391,
std::copy(arr1,arr1+15,tmp);
f1->setStartTime(2.,0,0);
f1->setEndTime(3.,0,0);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
double res[3];
const double pos[2]={0.3,-0.2};
f1->getValueOn(pos,res);
f2->setArray(f1->getArray());
f2->setStartTime(2.,3,0);
f2->setEndTime(4.,13,0);
- CPPUNIT_ASSERT_THROW(f2->checkCoherency(),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(f2->checkConsistencyLight(),INTERP_KERNEL::Exception);
DataArrayDouble *array2=DataArrayDouble::New();
array2->alloc(nbOfCells,3);
tmp=array2->getPointer();
std::copy(arr2,arr2+15,tmp);
f2->setEndArray(array2);
array2->decrRef();
- f2->checkCoherency();
+ f2->checkConsistencyLight();
//
std::fill(res,res+3,0.);
f2->getValueOn(pos,3.21,res);
CPPUNIT_ASSERT_EQUAL(3,(int)v.size());
std::vector<const MEDCouplingUMesh *> v2(v.begin(),v.end());
MEDCouplingUMesh *m2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(v2);
- m2->setName(m1->getName());
+ m2->setName(m1->getName().c_str());
CPPUNIT_ASSERT(m1->isEqual(m2,1.e-12));
for(std::vector<MEDCouplingUMesh *>::const_iterator iter=v.begin();iter!=v.end();iter++)
(*iter)->decrRef();
{
MEDCouplingUMesh *targetMesh=build2DTargetMesh_1();
double pos[12]={0.,0.,0.4,0.4,0.,0.4,0.1,0.1,0.25,0.,0.65,0.};
- std::vector<int> t1,t2;
+ MCAuto<DataArrayInt> t1,t2;
//2D basic
targetMesh->getCellsContainingPoints(pos,6,1e-12,t1,t2);
- CPPUNIT_ASSERT_EQUAL(6,(int)t1.size());
- CPPUNIT_ASSERT_EQUAL(7,(int)t2.size());
+ CPPUNIT_ASSERT_EQUAL(6,(int)t1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(7,(int)t2->getNbOfElems());
const int expectedValues1[6]={0,4,3,0,1,2};
const int expectedValues2[7]={0,1,2,3,4,5,6};
- CPPUNIT_ASSERT(std::equal(t1.begin(),t1.end(),expectedValues1));
- CPPUNIT_ASSERT(std::equal(t2.begin(),t2.end(),expectedValues2));
+ CPPUNIT_ASSERT(std::equal(t1->begin(),t1->end(),expectedValues1));
+ CPPUNIT_ASSERT(std::equal(t2->begin(),t2->end(),expectedValues2));
//2D with no help of bounding box.
double center[2]={0.2,0.2};
- MEDCouplingPointSet::Rotate2DAlg(center,0.78539816339744830962,6,pos);
+ DataArrayDouble::Rotate2DAlg(center,0.78539816339744830962,6,pos,pos);
targetMesh->rotate(center,0,0.78539816339744830962);
- t1.clear(); t2.clear();
targetMesh->getCellsContainingPoints(pos,6,1e-12,t1,t2);
- CPPUNIT_ASSERT_EQUAL(6,(int)t1.size());
- CPPUNIT_ASSERT_EQUAL(7,(int)t2.size());
- CPPUNIT_ASSERT(std::equal(t1.begin(),t1.end(),expectedValues1));
- CPPUNIT_ASSERT(std::equal(t2.begin(),t2.end(),expectedValues2));
+ CPPUNIT_ASSERT_EQUAL(6,(int)t1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(7,(int)t2->getNbOfElems());
+ CPPUNIT_ASSERT(std::equal(t1->begin(),t1->end(),expectedValues1));
+ CPPUNIT_ASSERT(std::equal(t2->begin(),t2->end(),expectedValues2));
//2D outside
const double pos1bis[2]={-0.3303300858899107,-0.11819805153394641};
CPPUNIT_ASSERT_EQUAL(-1,targetMesh->getCellContainingPoint(pos1bis,1e-12));
//test limits 2D
targetMesh=build2DTargetMesh_1();
const double pos2[2]={0.2,-0.05};
- t1.clear();
- targetMesh->getCellsContainingPoint(pos2,1e-12,t1);
- CPPUNIT_ASSERT_EQUAL(2,(int)t1.size());
+ std::vector<int> t11;
+ t11.clear();
+ targetMesh->getCellsContainingPoint(pos2,1e-12,t11);
+ CPPUNIT_ASSERT_EQUAL(2,(int)t11.size());
const int expectedValues3[2]={0,1};
- CPPUNIT_ASSERT(std::equal(t1.begin(),t1.end(),expectedValues3));
+ CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues3));
const double pos3[2]={0.2,0.2};
- t1.clear();
- targetMesh->getCellsContainingPoint(pos3,1e-12,t1);
- CPPUNIT_ASSERT_EQUAL(5,(int)t1.size());
+ t11.clear();
+ targetMesh->getCellsContainingPoint(pos3,1e-12,t11);
+ CPPUNIT_ASSERT_EQUAL(5,(int)t11.size());
const int expectedValues4[5]={0,1,2,3,4};
- CPPUNIT_ASSERT(std::equal(t1.begin(),t1.end(),expectedValues4));
+ CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues4));
CPPUNIT_ASSERT_EQUAL(0,targetMesh->getCellContainingPoint(pos3,1e-12));
targetMesh->decrRef();
//3D
const double pos4[3]={25.,25.,25.};
CPPUNIT_ASSERT_EQUAL(0,targetMesh->getCellContainingPoint(pos4,1e-12));
const double pos5[3]={50.,50.,50.};
- t1.clear();
- targetMesh->getCellsContainingPoint(pos5,1e-12,t1);
- CPPUNIT_ASSERT_EQUAL(8,(int)t1.size());
+ t11.clear();
+ targetMesh->getCellsContainingPoint(pos5,1e-12,t11);
+ CPPUNIT_ASSERT_EQUAL(8,(int)t11.size());
const int expectedValues5[8]={0,1,2,3,4,5,6,7};
- CPPUNIT_ASSERT(std::equal(t1.begin(),t1.end(),expectedValues5));
+ CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues5));
const double pos6[3]={0., 50., 0.};
- t1.clear();
- targetMesh->getCellsContainingPoint(pos6,1e-12,t1);
- CPPUNIT_ASSERT_EQUAL(2,(int)t1.size());
+ t11.clear();
+ targetMesh->getCellsContainingPoint(pos6,1e-12,t11);
+ CPPUNIT_ASSERT_EQUAL(2,(int)t11.size());
const int expectedValues6[2]={0,2};
- CPPUNIT_ASSERT(std::equal(t1.begin(),t1.end(),expectedValues6));
+ CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues6));
//3D outside
const double pos7[3]={-1.0,-1.0,0.};
CPPUNIT_ASSERT_EQUAL(-1,targetMesh->getCellContainingPoint(pos7,1e-12));
CPPUNIT_ASSERT_DOUBLES_EQUAL(6.,res[0],1e-12);
fieldOnCells->decrRef();
//
- MEDCouplingMesh* meshDeepCopy=mesh->deepCpy();
+ MEDCouplingMesh* meshDeepCopy=mesh->deepCopy();
MEDCouplingCMesh* meshClone=mesh->clone(false);
CPPUNIT_ASSERT_THROW(meshEmpty->copyTinyStringsFrom(0),INTERP_KERNEL::Exception);
CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-5));
CPPUNIT_ASSERT(!mesh1->isEqual(mesh2,1e-7));
- CPPUNIT_ASSERT_THROW(mesh3->checkCoherency1(1e-12),INTERP_KERNEL::Exception);
- mesh1->checkCoherency2(1e-12);
+ CPPUNIT_ASSERT_THROW(mesh3->checkConsistency(1e-12),INTERP_KERNEL::Exception);
+ mesh1->checkConsistency(1e-12);
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh1->getTypeOfCell(1));
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,*((mesh1->getAllGeoTypes()).begin()));
CPPUNIT_ASSERT_EQUAL(3,(int) dis.size());
CPPUNIT_ASSERT_EQUAL((int) INTERP_KERNEL::NORM_HEXA8,dis[0]);
CPPUNIT_ASSERT_EQUAL(27,dis[1]);
- CPPUNIT_ASSERT_EQUAL(0,dis[2]);
+ CPPUNIT_ASSERT_EQUAL(-1,dis[2]);
std::vector<const DataArrayInt *> idsPerType;
- CPPUNIT_ASSERT_THROW(mesh1->checkTypeConsistencyAndContig(dis, idsPerType),INTERP_KERNEL::Exception);
- dis[2]=-1;
CPPUNIT_ASSERT(!(mesh1->checkTypeConsistencyAndContig(dis, idsPerType)));
dis[0]=(int) INTERP_KERNEL::NORM_QUAD4;
CPPUNIT_ASSERT_THROW(mesh1->checkTypeConsistencyAndContig(dis, idsPerType),INTERP_KERNEL::Exception);
mesh1->splitProfilePerType(ids,code,idsInPflPerType,pfls);
CPPUNIT_ASSERT_EQUAL(3,(int)code.size());
CPPUNIT_ASSERT_EQUAL((int) INTERP_KERNEL::NORM_HEXA8,code[0]);
- CPPUNIT_ASSERT_EQUAL(27,code[1]);
+ CPPUNIT_ASSERT_EQUAL(10,code[1]);
CPPUNIT_ASSERT_EQUAL(0,code[2]);
CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType.size());
CPPUNIT_ASSERT_EQUAL(1,(int)pfls.size());
int cells2[2]={25,26};
DataArrayInt* arr1;
- MEDCouplingUMesh *partMesh2=
- dynamic_cast<MEDCouplingUMesh *>(mesh1->buildPartAndReduceNodes(cells2,cells2+2,arr1));
+ MEDCouplingCMesh *partMesh2=
+ dynamic_cast<MEDCouplingCMesh *>(mesh1->buildPartAndReduceNodes(cells2,cells2+2,arr1));
CPPUNIT_ASSERT(partMesh2);
CPPUNIT_ASSERT_EQUAL(2,partMesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8));
CPPUNIT_ASSERT_EQUAL(12,partMesh2->getNumberOfNodes());
mesh->findNodesOnPlane(pt,v,1e-12,n);
CPPUNIT_ASSERT_EQUAL(9,(int)n.size());
MEDCouplingUMesh *m3dSurf=(MEDCouplingUMesh *)mesh->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true);
- MEDCouplingExtrudedMesh *me=MEDCouplingExtrudedMesh::New(mesh,m3dSurf,0);
+ MEDCouplingMappedExtrudedMesh *me=MEDCouplingMappedExtrudedMesh::New(mesh,m3dSurf,0);
const DataArrayInt *da=me->getMesh3DIds();
CPPUNIT_ASSERT_EQUAL(8,me->getNumberOfCells());
const int expected[8]={0,1,2,3,4,5,6,7};
CPPUNIT_ASSERT_EQUAL(3,m1->getSpaceDimension());
m1->changeSpaceDimension(2);
CPPUNIT_ASSERT_EQUAL(2,m1->getSpaceDimension());
- m1->setName(m2->getName());
+ m1->setName(m2->getName().c_str());
CPPUNIT_ASSERT(m1->isEqual(m2,1e-12));
m1->changeSpaceDimension(3);
CPPUNIT_ASSERT_EQUAL(3,m1->getSpaceDimension());