std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingExtrudedMesh::getAllGeoTypes() const
{
- const std::set<INTERP_KERNEL::NormalizedCellType>& ret2D=_mesh2D->getAllTypes();
+ std::set<INTERP_KERNEL::NormalizedCellType> ret2D(_mesh2D->getAllGeoTypes());
std::set<INTERP_KERNEL::NormalizedCellType> ret;
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=ret2D.begin();it!=ret2D.end();it++)
ret.insert(INTERP_KERNEL::CellModel::GetCellModel(*it).getExtrudedType());
* describing the cell types.
* \throw If the coordinates array is not set.
* \throw If the nodal connectivity of cells is not defined.
- * \sa getAllTypes()
+ * \sa getAllGeoTypes()
*/
std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingUMesh::getTypesOfPart(const int *begin, const int *end) const
{
const int *connI=_nodal_connec_index->getConstPointer();
const int *work=connI;
int nbOfCells=getNumberOfCells();
- std::size_t n=getAllTypes().size();
+ std::size_t n=getAllGeoTypes().size();
std::vector<int> ret(3*n,-1); //ret[3*k+2]==-1 because it has no sense here
std::set<INTERP_KERNEL::NormalizedCellType> types;
for(std::size_t i=0;work!=connI+nbOfCells;i++)
const int *conn=_nodal_connec->getConstPointer();
const int *connI=_nodal_connec_index->getConstPointer();
int nbOfCells=getNumberOfCells();
- std::set<INTERP_KERNEL::NormalizedCellType> types=getAllTypes();
+ std::set<INTERP_KERNEL::NormalizedCellType> types(getAllGeoTypes());
int *tmp=new int[nbOfCells];
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=types.begin();iter!=types.end();iter++)
{
MEDCOUPLING_EXPORT void finishInsertingCells();
MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator *cellIterator();
MEDCOUPLING_EXPORT MEDCouplingUMeshCellByTypeEntry *cellsByType();
- MEDCOUPLING_EXPORT const std::set<INTERP_KERNEL::NormalizedCellType>& getAllTypes() const { return _types; }
MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getTypesOfPart(const int *begin, const int *end) const;
MEDCOUPLING_EXPORT void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true);
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());
{
MEDCouplingUMesh *mesh=build2DTargetMesh_3();
mesh->checkCoherency();
- const std::set<INTERP_KERNEL::NormalizedCellType>& types=mesh->getAllTypes();
+ 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);
MEDCouplingFieldDouble *f2=mesh->getMeasureField(false);
CPPUNIT_ASSERT(f1->getArray()->isEqual(*f2->getArray(),1e-12));
CPPUNIT_ASSERT_EQUAL(48,mesh->getMeshLength());
- const std::set<INTERP_KERNEL::NormalizedCellType>& types2=mesh->getAllTypes();
- CPPUNIT_ASSERT_EQUAL(3,(int)types.size());
+ 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};
std::set<INTERP_KERNEL::NormalizedCellType> expected2Bis(expected2,expected2+3);
CPPUNIT_ASSERT(expected2Bis==types2);
MEDCouplingFieldDouble *f=m->getMeasureField(false);
for(int i=0;i<7;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i]*sqrt(2.),f->getIJ(i,0),1e-10);
- std::set<INTERP_KERNEL::NormalizedCellType> types=m->getAllTypes();
+ std::set<INTERP_KERNEL::NormalizedCellType> types=m->getAllGeoTypes();
CPPUNIT_ASSERT_EQUAL(2,(int)types.size());
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*(types.begin()));
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POLYGON,*(++(types.begin())));
for(int i=0;i<7;i++)
CPPUNIT_ASSERT_EQUAL(expected2[i],da->getIJ(i,0));
m->checkCoherency();
- types=m->getAllTypes();
+ types=m->getAllGeoTypes();
CPPUNIT_ASSERT_EQUAL(2,(int)types.size());
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*(types.begin()));
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POLYGON,*(++(types.begin())));
CPPUNIT_ASSERT_EQUAL(4,m->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(3,m->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(0,m->getMeshDimension());
- const std::set<INTERP_KERNEL::NormalizedCellType>& types=m->getAllTypes();
+ std::set<INTERP_KERNEL::NormalizedCellType> types=m->getAllGeoTypes();
CPPUNIT_ASSERT_EQUAL(1,(int)types.size());
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POINT1,*types.begin());
for(int i=0;i<4;i++)
// resize with explicit ids list
MEDCouplingUMesh *m=build2DTargetMesh_1();
std::set<INTERP_KERNEL::NormalizedCellType> s; s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4);
- CPPUNIT_ASSERT(s==m->getAllTypes());
+ CPPUNIT_ASSERT(s==m->getAllGeoTypes());
const int ids1[3]={0,3,4};
MEDCouplingUMesh *part=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf(ids1,ids1+3,true));
part->simplexize(0)->decrRef();
CPPUNIT_ASSERT(std::equal(expected2,expected2+6,m->getNodalConnectivityIndex()->getConstPointer()));
CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3);
- CPPUNIT_ASSERT(s==m->getAllTypes());
+ CPPUNIT_ASSERT(s==m->getAllGeoTypes());
m->decrRef(); part->decrRef(); part2->decrRef();
// no resize with explicit ids list
m=build2DTargetMesh_1();
CPPUNIT_ASSERT(std::equal(expected4,expected4+6,m->getNodalConnectivityIndex()->getConstPointer()));
CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); s.insert(INTERP_KERNEL::NORM_POLYGON);
- CPPUNIT_ASSERT(s==m->getAllTypes());
+ CPPUNIT_ASSERT(s==m->getAllGeoTypes());
m->decrRef(); part->decrRef();
// resize with range ids
m=build2DTargetMesh_1();
CPPUNIT_ASSERT(std::equal(expected6,expected6+6,m->getNodalConnectivityIndex()->getConstPointer()));
CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_QUAD4);
- CPPUNIT_ASSERT(s==m->getAllTypes());
+ CPPUNIT_ASSERT(s==m->getAllGeoTypes());
m->decrRef(); part->decrRef();
// no resize with range ids
m=build2DTargetMesh_1();
CPPUNIT_ASSERT(std::equal(expected8,expected8+6,m->getNodalConnectivityIndex()->getConstPointer()));
CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); s.insert(INTERP_KERNEL::NORM_POLYGON);
- CPPUNIT_ASSERT(s==m->getAllTypes());
+ CPPUNIT_ASSERT(s==m->getAllGeoTypes());
m->decrRef(); part->decrRef();
// no resize with range ids negative direction
m=build2DTargetMesh_1();
CPPUNIT_ASSERT(std::equal(expected10,expected10+6,m->getNodalConnectivityIndex()->getConstPointer()));
CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); s.insert(INTERP_KERNEL::NORM_POLYGON);
- CPPUNIT_ASSERT(s==m->getAllTypes());
+ CPPUNIT_ASSERT(s==m->getAllGeoTypes());
part->decrRef();
m->decrRef();
}
m->unPolyze();
CPPUNIT_ASSERT_EQUAL(1,m->getNumberOfCells());
std::set<INTERP_KERNEL::NormalizedCellType> s; s.insert(INTERP_KERNEL::NORM_PENTA6);
- CPPUNIT_ASSERT(s==m->getAllTypes());
+ CPPUNIT_ASSERT(s==m->getAllGeoTypes());
//
const int expected1[2]={0,7};
const int expected2[7]={16,0,2,1,3,5,4};
self.assertTrue(myCoords.getIJ(3,2)==-0.305)
mesh.setCoords(myCoords);
mesh.checkCoherency();
- self.assertTrue(mesh.getAllTypes()==[4])
+ self.assertTrue(mesh.getAllGeoTypes()==[4])
myFalseConn=DataArrayInt.New()
myFalseConn.setValues(tab4,6,4)
self.assertTrue(myFalseConn.getIJ(1,1)==3)
subMesh=mesh.buildPartOfMySelf(tab1,True);
self.assertTrue(isinstance(subMesh,MEDCouplingUMesh))
name=subMesh.getName();
- self.assertEqual(2,len(mesh.getAllTypes()));
- self.assertEqual(NORM_TRI3,mesh.getAllTypes()[0]);
- self.assertEqual(NORM_QUAD4,mesh.getAllTypes()[1]);
- self.assertEqual(1,len(subMesh.getAllTypes()));
- self.assertEqual(NORM_QUAD4,subMesh.getAllTypes()[0]);
+ self.assertEqual(2,len(mesh.getAllGeoTypes()));
+ self.assertEqual(NORM_TRI3,mesh.getAllGeoTypes()[0]);
+ self.assertEqual(NORM_QUAD4,mesh.getAllGeoTypes()[1]);
+ self.assertEqual(1,len(subMesh.getAllGeoTypes()));
+ self.assertEqual(NORM_QUAD4,subMesh.getAllGeoTypes()[0]);
self.assertEqual(name,"Toto");
self.assertEqual(2,subMesh.getNumberOfCells());
subConn=[4,0,3,4,1,4,7,8,5,4];
subMesh=mesh.buildPartOfMySelf(tab2[0:3],True);
self.assertTrue(isinstance(subMesh,MEDCouplingUMesh));
name=subMesh.getName();
- self.assertEqual(2,len(subMesh.getAllTypes()));
- self.assertEqual(NORM_TRI3,subMesh.getAllTypes()[0]);
- self.assertEqual(NORM_QUAD4,subMesh.getAllTypes()[1]);
+ self.assertEqual(2,len(subMesh.getAllGeoTypes()));
+ self.assertEqual(NORM_TRI3,subMesh.getAllGeoTypes()[0]);
+ self.assertEqual(NORM_QUAD4,subMesh.getAllGeoTypes()[1]);
self.assertEqual(name,"Toto");
self.assertEqual(3,subMesh.getNumberOfCells());
subConn2=[4,0,3,4,1,3,4,5,2,4,6,7,4,3]
tab1=[5,7,8,4]
subMesh=mesh.buildPartOfMySelfNode(tab1[0:4],True);
self.assertTrue(isinstance(subMesh,MEDCouplingUMesh))
- self.assertEqual(1,len(subMesh.getAllTypes()));
- self.assertEqual(NORM_QUAD4,subMesh.getAllTypes()[0]);
+ self.assertEqual(1,len(subMesh.getAllGeoTypes()));
+ self.assertEqual(NORM_QUAD4,subMesh.getAllGeoTypes()[0]);
self.assertEqual(1,subMesh.getNumberOfCells());
self.assertEqual(5,subMesh.getNodalConnectivity().getNbOfElems());
self.assertEqual(2,subMesh.getNodalConnectivityIndex().getNbOfElems());
subMesh=mesh.buildPartOfMySelfNode(ddd,False);
self.assertEqual("ddd",subMesh.getName())
self.assertTrue(isinstance(subMesh,MEDCouplingUMesh))
- self.assertEqual(2,len(subMesh.getAllTypes()));
- self.assertEqual(NORM_TRI3,subMesh.getAllTypes()[0]);
- self.assertEqual(NORM_QUAD4,subMesh.getAllTypes()[1]);
+ self.assertEqual(2,len(subMesh.getAllGeoTypes()));
+ self.assertEqual(NORM_TRI3,subMesh.getAllGeoTypes()[0]);
+ self.assertEqual(NORM_QUAD4,subMesh.getAllGeoTypes()[1]);
self.assertEqual(3,subMesh.getNumberOfCells());
self.assertEqual(14,subMesh.getNodalConnectivity().getNbOfElems());
self.assertEqual(4,subMesh.getNodalConnectivityIndex().getNbOfElems());
tab2=[0,3,2,1,4,5,6]
subMesh=mesh.buildPartOfMySelfNode(tab2[0:7],True);
self.assertTrue(isinstance(subMesh,MEDCouplingUMesh))
- self.assertEqual(2,len(subMesh.getAllTypes()));
- self.assertEqual(NORM_TRI3,subMesh.getAllTypes()[0]);
- self.assertEqual(NORM_QUAD4,subMesh.getAllTypes()[1]);
+ self.assertEqual(2,len(subMesh.getAllGeoTypes()));
+ self.assertEqual(NORM_TRI3,subMesh.getAllGeoTypes()[0]);
+ self.assertEqual(NORM_QUAD4,subMesh.getAllGeoTypes()[1]);
self.assertEqual(3,subMesh.getNumberOfCells());
pass
def testZipCoords(self):
mesh=MEDCouplingDataForTest.build2DTargetMesh_1();
- self.assertEqual(2,len(mesh.getAllTypes()));
+ self.assertEqual(2,len(mesh.getAllGeoTypes()));
self.assertEqual(2,mesh.getSpaceDimension());
self.assertEqual(9,mesh.getNumberOfNodes());
self.assertEqual(5,mesh.getNumberOfCells());
oldConnIndex=mesh.getNodalConnectivityIndex().getValues()[0:mesh.getNumberOfCells()+1]
oldCoords=mesh.getCoords();
mesh.zipCoords();
- self.assertEqual(2,len(mesh.getAllTypes()));
+ self.assertEqual(2,len(mesh.getAllGeoTypes()));
self.assertEqual(2,mesh.getSpaceDimension());
self.assertEqual(9,mesh.getNumberOfNodes());
self.assertEqual(5,mesh.getNumberOfCells());
traducer=subMesh.zipCoordsTraducer();
expectedTraducer=[0, 1, -1, 2, 3, 4, -1, 5, 6]
self.assertEqual(expectedTraducer,list(traducer.getValues()));
- self.assertEqual(NORM_QUAD4,subMesh.getAllTypes()[0]);
+ self.assertEqual(NORM_QUAD4,subMesh.getAllGeoTypes()[0]);
self.assertEqual(2,subMesh.getNumberOfCells());
subConn=[4,0,2,3,1,4,5,6,4,3]
subConnIndex=[0,5,10]
#
subMesh=mesh.buildPartOfMySelf(tab1,False);
self.assertTrue(isinstance(subMesh,MEDCouplingUMesh))
- self.assertEqual(NORM_QUAD4,subMesh.getAllTypes()[0]);
+ self.assertEqual(NORM_QUAD4,subMesh.getAllGeoTypes()[0]);
self.assertEqual(2,subMesh.getNumberOfCells());
self.assertEqual(7,subMesh.getNumberOfNodes());
self.assertEqual(10,subMesh.getNodalConnectivity().getNbOfElems());
def testConvertQuadraticCellsToLinear(self):
mesh=MEDCouplingDataForTest.build2DTargetMesh_3();
mesh.checkCoherency();
- types=mesh.getAllTypes();
+ types=mesh.getAllGeoTypes();
types.sort()
self.assertEqual(5,len(types));
expected1=[NORM_POLYGON, NORM_TRI3, NORM_QUAD4, NORM_TRI6, NORM_QUAD8]
f2=mesh.getMeasureField(False);
self.assertTrue(f1.getArray().isEqual(f2.getArray(),1e-12));
self.assertEqual(48,mesh.getMeshLength());
- types2=mesh.getAllTypes();
+ types2=mesh.getAllGeoTypes();
types2.sort()
self.assertEqual(3,len(types2));
expected2=[NORM_POLYGON, NORM_TRI3, NORM_QUAD4]
for i in xrange(7):
self.assertAlmostEqual(expected1[i]*sqrt(2.),f.getIJ(i,0),10);
pass
- types=m.getAllTypes();
+ types=m.getAllGeoTypes();
self.assertEqual([NORM_TRI3,NORM_POLYGON],types);
#
m=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
self.assertEqual(expected2[i],da.getIJ(i,0));
pass
m.checkCoherency();
- types=m.getAllTypes();
+ types=m.getAllGeoTypes();
self.assertEqual([NORM_TRI3,NORM_POLYGON],types);
self.assertEqual(7,m.getNumberOfCells());
self.assertEqual(NORM_TRI3,m.getTypeOfCell(0));
self.assertEqual(4,m.getNumberOfCells());
self.assertEqual(3,m.getSpaceDimension());
self.assertEqual(0,m.getMeshDimension());
- types1=m.getAllTypes();
+ types1=m.getAllGeoTypes();
self.assertEqual([NORM_POINT1],types1);
for i in xrange(4):
conn=m.getNodeIdsOfCell(i);
def testUMeshSetPartOfMySelf2(self):
# resize with explicit ids list
m=MEDCouplingDataForTest.build2DTargetMesh_1()
- self.assertEqual([3,4],m.getAllTypes())
+ self.assertEqual([3,4],m.getAllGeoTypes())
part=m[[0,3,4]]
part.simplexize(0)
part2=part[[1,2,5]]
m[[0,3,4]]=part2
self.assertEqual([3,0,4,1,3,1,4,2,3,4,5,2,3,6,7,4,3,7,5,4],m.getNodalConnectivity().getValues())
self.assertEqual([0,4,8,12,16,20],m.getNodalConnectivityIndex().getValues())
- self.assertEqual([3],m.getAllTypes())
+ self.assertEqual([3],m.getAllGeoTypes())
# no resize with explicit ids list
m=MEDCouplingDataForTest.build2DTargetMesh_1()
part=m[[0,3]]
m[[3,4]]=part
self.assertEqual([4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3],m.getNodalConnectivity().getValues())
self.assertEqual([0,5,9,13,18,23],m.getNodalConnectivityIndex().getValues())
- self.assertEqual([3,4,5],m.getAllTypes())
+ self.assertEqual([3,4,5],m.getAllGeoTypes())
# resize with range ids
m=MEDCouplingDataForTest.build2DTargetMesh_1()
part=m[3:]
m[1:3]=part
self.assertEqual([4,0,3,4,1,4,6,7,4,3,4,7,8,5,4,4,6,7,4,3,4,7,8,5,4],m.getNodalConnectivity().getValues())
self.assertEqual([0,5,10,15,20,25],m.getNodalConnectivityIndex().getValues())
- self.assertEqual([4],m.getAllTypes())
+ self.assertEqual([4],m.getAllGeoTypes())
# no resize with range ids
m=MEDCouplingDataForTest.build2DTargetMesh_1()
part=m[0::3]
m[3:]=part
self.assertEqual([4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3],m.getNodalConnectivity().getValues())
self.assertEqual([0,5,9,13,18,23],m.getNodalConnectivityIndex().getValues())
- self.assertEqual([3,4,5],m.getAllTypes())
+ self.assertEqual([3,4,5],m.getAllGeoTypes())
# no resize with range ids negative direction
m=MEDCouplingDataForTest.build2DTargetMesh_1()
part=m[3::-3]
m[:-3:-1]=part
self.assertEqual([4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3],m.getNodalConnectivity().getValues())
self.assertEqual([0,5,9,13,18,23],m.getNodalConnectivityIndex().getValues())
- self.assertEqual([3,4,5],m.getAllTypes())
+ self.assertEqual([3,4,5],m.getAllGeoTypes())
pass
def testUnPolyze3(self):
#
m.unPolyze();
#
- self.assertEqual([NORM_PENTA6],m.getAllTypes())
+ self.assertEqual([NORM_PENTA6],m.getAllGeoTypes())
self.assertTrue(DataArrayInt([0,7]).isEqual(m.getNodalConnectivityIndex()))
self.assertTrue(DataArrayInt([16,0,2,1,3,5,4]).isEqual(m.getNodalConnectivity()))
#
m.getNodalConnectivity().setIJ(87,0,21)# put again 21 as at the beginning
#
self.assertTrue(m.unPolyze())
- self.assertEqual([NORM_HEXGP12],m.getAllTypes())
+ self.assertEqual([NORM_HEXGP12],m.getAllGeoTypes())
self.assertTrue(m.computeIsoBarycenterOfNodesPerCell().isEqual(dReference,1e-12))
m.getNodalConnectivity().setIJ(25,0,24)
self.assertRaises(InterpKernelException,m.computeIsoBarycenterOfNodesPerCell)
self.assertTrue(isinstance(mcpy0,MEDCouplingUMesh))
self.assertTrue(mcpy0.getNodalConnectivity().isEqual(DataArrayInt([31,3,2,8,9,31,1,0,6,7,-1,7,6,1,31,2,1,7,8,-1,2,1,-1,8,-1,7,31,5,4,10,11,-1,11,10,-1,5,31,4,3,9,10,-1,5,3,9])))
self.assertTrue(mcpy0.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,14,26,36,45])))
- self.assertEqual(mcpy0.getAllTypes(),[NORM_POLYHED])
+ self.assertEqual(mcpy0.getAllGeoTypes(),[NORM_POLYHED])
mcpy0.checkCoherency()
mcpy0.checkCoherency2()
mcpy1=mcpy0.convertIntoSingleGeoTypeMesh()
ret->incrRef();
return ret;
}
- PyObject *getAllTypes() const throw(INTERP_KERNEL::Exception)
- {
- std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllTypes();
- std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
- PyObject *res = PyList_New(result.size());
- for (int i=0;iL!=result.end(); i++, iL++)
- PyList_SetItem(res,i,PyInt_FromLong(*iL));
- return res;
- }
static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
{
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,mesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(12));
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(2,mesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(0));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(1));
CPPUNIT_ASSERT_EQUAL((std::size_t)11,mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(7,mesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
for(int i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(6));
CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,constMesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(12));
CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,constMesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(12));
CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,constMesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(12));
CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,constMesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(12));
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(538,mesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(579,mesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
for(int i=0;i<514;i++)
CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(i));
for(int i=514;i<538;i++)
CPPUNIT_ASSERT_EQUAL(2,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(538,constMesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(579,constMesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(2,(int)constMesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(2,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<514;i++)
CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,constMesh->getTypeOfCell(i));
for(int i=514;i<538;i++)
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,mesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(0));
CPPUNIT_ASSERT_EQUAL(NORM_POLYHED,mesh->getTypeOfCell(1));
CPPUNIT_ASSERT_EQUAL(NORM_POLYHED,mesh->getTypeOfCell(2));
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(17,mesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(NORM_POLYGON,mesh->getTypeOfCell(0));
CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(1));
CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(2));
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,mesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(1,(int)mesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(1,(int)mesh->getAllGeoTypes().size());
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_EQUAL(NORM_POLYGON,mesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL((std::size_t)19,mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(0,mesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
- CPPUNIT_ASSERT_EQUAL(0,(int)mesh->getAllTypes().size());
+ CPPUNIT_ASSERT_EQUAL(0,(int)mesh->getAllGeoTypes().size());
mesh->decrRef();
}