-// Copyright (C) 2007-2015 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
void MEDLoaderTest::testMesh1DRW()
{
MEDCouplingUMesh *mesh=build1DMesh_1();
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
WriteUMesh("file1.med",mesh,true);
MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file1.med",mesh->getName().c_str(),0);
CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12));
void MEDLoaderTest::testMesh2DCurveRW()
{
MEDCouplingUMesh *mesh=build2DCurveMesh_1();
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
WriteUMesh("file2.med",mesh,true);
MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file2.med",mesh->getName().c_str(),0);
CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12));
void MEDLoaderTest::testMesh2DRW()
{
MEDCouplingUMesh *mesh=build2DMesh_1();
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
WriteUMesh("file3.med",mesh,true);
MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file3.med",mesh->getName().c_str(),0);
CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12));
void MEDLoaderTest::testMesh3DSurfRW()
{
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
WriteUMesh("file4.med",mesh,true);
MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file4.med",mesh->getName().c_str(),0);
CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12));
void MEDLoaderTest::testMesh3DRW()
{
MEDCouplingUMesh *mesh=build3DMesh_1();
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
WriteUMesh("file5.med",mesh,true);
MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file5.med",mesh->getName().c_str(),0);
CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12));
const double arr1[10]={71.,171.,10.,110.,20.,120.,30.,130.,40.,140.};
std::copy(arr1,arr1+10,tmp);
f1->setTime(3.14,2,7);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
WriteField(fileName,f1,false);//<- false important for the test
//
std::vector<MEDCoupling::TypeOfField> types=GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str());
CPPUNIT_ASSERT_EQUAL(1,(int)types.size());
CPPUNIT_ASSERT(types[0]==ON_CELLS);
- f2->checkCoherency();
+ f2->checkConsistencyLight();
CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12));
//
f2->decrRef();
array->setInfoOnComponent(1,"uiop [MW]");
array->decrRef();
f1->setTime(3.14,2,7);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
const int arr2[2]={1,4};//node ids are 2,4,5,3,6,7
MEDCouplingFieldDouble *f2=f1->buildSubPart(arr2,arr2+2);
(const_cast<MEDCouplingMesh *>(f2->getMesh()))->setName(f1->getMesh()->getName().c_str());
WriteField(fileName,f2,false);//<- false important for the test
//
MEDCouplingFieldDouble *f3=ReadFieldNode(fileName,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7);
- f3->checkCoherency();
+ f3->checkConsistencyLight();
CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12));
f3->decrRef();
//
WriteUMesh(fileName2,m,true);
WriteField(fileName2,f2,false);//<- false important for the test
f3=ReadFieldNode(fileName2,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7);
- f3->checkCoherency();
+ f3->checkConsistencyLight();
CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12));
f3->decrRef();
f2->decrRef();
//
const int renumArr[12]={3,7,2,1,5,11,10,0,9,6,8,4};
f1->renumberNodes(renumArr);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
WriteField(fileName,f1,false);//<- false important for the test
MEDCouplingFieldDouble *f2=ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7);
CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12));
const char fileName[]="file13.med";
MEDCouplingFieldDouble *f1=buildVecFieldOnGauss_1();
WriteField(fileName,f1,true);
- MEDCouplingFieldDouble *f2=ReadField(ON_GAUSS_PT,fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),1,5);
+ MCAuto<MEDCouplingFieldDouble> f2(ReadField(ON_GAUSS_PT,fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),1,5));
CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12));
- f2->decrRef();
f1->decrRef();
}
std::vector<MEDCoupling::TypeOfField> tof(GetTypesOfField(fileName,"2DMesh_2","MyFieldOnGaussNE"));
CPPUNIT_ASSERT_EQUAL(1,(int)tof.size());
CPPUNIT_ASSERT(ON_GAUSS_NE==tof[0]);
- MEDCouplingFieldDouble *f2=ReadField(ON_GAUSS_NE,fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),1,5);
+ MCAuto<MEDCouplingFieldDouble> f2(ReadField(ON_GAUSS_NE,fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),1,5));
CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12));
- f2->decrRef();
f1->decrRef();
}
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
const int renumber1[6]={2,5,1,0,3,4};
mesh->renumberCells(renumber1,false);
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
WriteUMesh(fileName,mesh,true);
MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile(fileName,mesh->getName().c_str(),0);
CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12));
const double arr1[12]={71.,171.,10.,110.,20.,120.,30.,130.,40.,140.,50.,150.};
std::copy(arr1,arr1+12,tmp);
f1->setTime(3.14,2,7);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
const int renumber1[6]={2,1,5,0,3,4};
f1->renumberCells(renumber1,false);
const double arr1[10]={71.,171.,10.,110.,20.,120.,30.,130.,40.,140.};
std::copy(arr1,arr1+10,tmp);
f1->setTime(3.14,2,7);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
MEDCouplingFieldDouble *f2=ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),-1,f1->getName().c_str(),2,7);
CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12));
const double arr1[12]={71.,171.,10.,110.,20.,120.,30.,130.,40.,140.,50.,150.};
std::copy(arr1,arr1+12,tmp);
f1->setTime(3.14,2,7);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
//
MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
f2->setName("FieldMix");
};
std::copy(arr2,arr2+24,tmp);
f2->setTime(3.14,2,7);
- f2->checkCoherency();
+ f2->checkConsistencyLight();
//
WriteField(fileName,f1,true);
std::vector<MEDCoupling::TypeOfField> ts=GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str());
CPPUNIT_ASSERT_EQUAL(-1,its1[0].second);
//
MEDCouplingFieldDouble *field0=ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second);
- field0->checkCoherency();
+ field0->checkConsistencyLight();
CPPUNIT_ASSERT(field0->getName()==fieldsName[0]);
- CPPUNIT_ASSERT_EQUAL(1,field0->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(16,field0->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)field0->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(16,(int)field0->getNumberOfTuples());
const double expectedValues[16]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,2.,3.,3.,2.};
double diffValue[16];
std::transform(field0->getArray()->getPointer(),field0->getArray()->getPointer()+16,expectedValues,diffValue,std::minus<double>());
field0->decrRef();
//
MEDCouplingFieldDouble *field1=ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[1].c_str(),its1[0].first,its1[0].second);
- field1->checkCoherency();
+ field1->checkConsistencyLight();
CPPUNIT_ASSERT(field1->getName()==fieldsName[1]);
- CPPUNIT_ASSERT_EQUAL(3,field1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(16,field1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,(int)field1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(16,(int)field1->getNumberOfTuples());
const double expectedValues2[48]={1.,0.,1.,1.,0.,1.,1.,0.,1.,2.,1.,0.,2.,1.,0.,2.,1.,0.,3.,0.,1.,3.,0.,1.,3.,0.,1.,4.,1.,0.,4.,1.,0.,4.,1.,0.,5.,0.,0.,6.,1.,1.,6.,0.,0.,5.,1.,1.};
double diffValue2[48];
std::transform(field1->getArray()->getPointer(),field1->getArray()->getPointer()+48,expectedValues2,diffValue2,std::minus<double>());
CPPUNIT_ASSERT_EQUAL(2,its0Node[2].first);
CPPUNIT_ASSERT_EQUAL(-1,its0Node[2].second);
MEDCouplingFieldDouble *field0Nodes=ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[0].first,its0Node[0].second);
- field0Nodes->checkCoherency();
+ field0Nodes->checkConsistencyLight();
CPPUNIT_ASSERT(field0Nodes->getName()==fieldsNameNode[0]);
- CPPUNIT_ASSERT_EQUAL(1,field0Nodes->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(19,field0Nodes->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)field0Nodes->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(19,(int)field0Nodes->getNumberOfTuples());
const double expectedValues3[19]={1.,1.,1.,2.,2.,2.,3.,3.,3.,4.,4.,4.,5.,5.,5.,6.,6.,6.,7.};
double diffValue3[19];
std::transform(field0Nodes->getArray()->getPointer(),field0Nodes->getArray()->getPointer()+19,expectedValues3,diffValue3,std::minus<double>());
field0Nodes->decrRef();
//
field0Nodes=ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[2].first,its0Node[2].second);
- field0Nodes->checkCoherency();
+ field0Nodes->checkConsistencyLight();
CPPUNIT_ASSERT(field0Nodes->getName()==fieldsNameNode[0]);
- CPPUNIT_ASSERT_EQUAL(1,field0Nodes->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(19,field0Nodes->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)field0Nodes->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(19,(int)field0Nodes->getNumberOfTuples());
const double expectedValues4[19]={1.,2.,2.,2.,3.,3.,3.,4.,4.,4.,5.,5.,5.,6.,6.,6.,7.,7.,7.};
std::transform(field0Nodes->getArray()->getPointer(),field0Nodes->getArray()->getPointer()+19,expectedValues4,diffValue3,std::minus<double>());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::max_element(diffValue3,diffValue3+19),1e-12);
field0Nodes->decrRef();
//
field0Nodes=ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[0].first,its0Node[0].second);
- field0Nodes->checkCoherency();
+ field0Nodes->checkConsistencyLight();
CPPUNIT_ASSERT(field0Nodes->getName()==fieldsNameNode[0]);
- CPPUNIT_ASSERT_EQUAL(1,field0Nodes->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(19,field0Nodes->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)field0Nodes->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(19,(int)field0Nodes->getNumberOfTuples());
const double expectedValues5[19]={1.,1.,1.,2.,2.,2.,3.,3.,3.,4.,4.,4.,5.,5.,5.,6.,6.,6.,7.};
std::transform(field0Nodes->getArray()->getPointer(),field0Nodes->getArray()->getPointer()+19,expectedValues5,diffValue3,std::minus<double>());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::max_element(diffValue3,diffValue3+19),1e-12);
CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size());
CPPUNIT_ASSERT(meshNames[0]=="Bord");
MEDCouplingUMesh *mesh=ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0);
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(538,mesh->getNumberOfCells());
std::vector<std::pair<int,int> > its0=GetCellFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsName[0].c_str());
CPPUNIT_ASSERT_EQUAL(1,(int)its0.size());
MEDCouplingFieldDouble *field=ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second);
- field->checkCoherency();
+ field->checkConsistencyLight();
CPPUNIT_ASSERT(field->getName()==fieldsName[0]);
- CPPUNIT_ASSERT_EQUAL(1,field->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(538,field->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,(int)field->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(538,(int)field->getNumberOfTuples());
const MEDCouplingUMesh *constMesh=dynamic_cast<const MEDCouplingUMesh *>(field->getMesh());
CPPUNIT_ASSERT(constMesh);
CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size());
CPPUNIT_ASSERT(meshNames[0]=="poly3D");
MEDCouplingUMesh *mesh=ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0);
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,mesh->getNumberOfCells());
mesh->decrRef();
//
mesh=ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),-1);
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(17,mesh->getNumberOfCells());
vector<string> families2;
families2.push_back(families[0]);
mesh=ReadUMeshFromFamilies(fileName.c_str(),meshNames[0].c_str(),-1,families2);
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,mesh->getNumberOfCells());
const double arr1[18]={0.,10.,20.,1.,11.,21.,2.,12.,22.,3.,13.,23.,4.,14.,24.,5.,15.,25.};
std::copy(arr1,arr1+18,tmp);
f1->setTime(2.,0,1);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
mesh->decrRef();
return f1;
}
};
std::copy(arr1,arr1+36,tmp);
f1->setTime(2.12,2,3);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
mesh->decrRef();
return f1;
}
array->setInfoOnComponent(0,"power [MW/m^3]");
array->setInfoOnComponent(1,"density");
array->decrRef();
- f->checkCoherency();
+ f->checkConsistencyLight();
m->decrRef();
return f;
}
array->setInfoOnComponent(1,"temperature");
f->setName("MyFieldOnGaussNE");
array->decrRef();
- f->checkCoherency();
+ f->checkConsistencyLight();
m->decrRef();
return f;
}