INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
if(!polyOnly || (type==INTERP_KERNEL::NORM_POLYGON || type==INTERP_KERNEL::NORM_QPOLYG))
{
- bool isQuadratic=INTERP_KERNEL::CellModel::GetCellModel(type).isQuadratic();
+ bool isQuadratic(INTERP_KERNEL::CellModel::GetCellModel(type).isQuadratic());
if(!IsPolygonWellOriented(isQuadratic,vec,conn+connI[i]+1,conn+connI[i+1],coordsPtr))
{
isModified=true;
- std::vector<int> tmp(connI[i+1]-connI[i]-2);
- std::copy(conn+connI[i]+2,conn+connI[i+1],tmp.rbegin());
- std::copy(tmp.begin(),tmp.end(),conn+connI[i]+2);
+ if(!isQuadratic)
+ {
+ std::vector<int> tmp(connI[i+1]-connI[i]-2);
+ std::copy(conn+connI[i]+2,conn+connI[i+1],tmp.rbegin());
+ std::copy(tmp.begin(),tmp.end(),conn+connI[i]+2);
+ }
+ else
+ {
+ int sz(((int)(connI[i+1]-connI[i]-1))/2);
+ std::vector<int> tmp0(sz-1),tmp1(sz);
+ std::copy(conn+connI[i]+2,conn+connI[i]+1+sz,tmp0.rbegin());
+ std::copy(conn+connI[i]+1+sz,conn+connI[i+1],tmp1.rbegin());
+ std::copy(tmp0.begin(),tmp0.end(),conn+connI[i]+2);
+ std::copy(tmp1.begin(),tmp1.end(),conn+connI[i]+1+sz);
+ }
}
}
}
self.assertTrue(c.isEqual(DataArrayInt([0,-1])))
pass
+ def testSwig2MeshOrientCorrectly2DCells1(self):
+ m=MEDCouplingUMesh("mesh",2)
+ coo=DataArrayDouble([1.,0.,0.5,-0.1,0.,1.,0.,0.,0.07,0.5,0.59,0.5],6,2)
+ m.setCoords(coo)
+ m.allocateCells()
+ m.insertNextCell(NORM_TRI6,[3,0,2,1,5,4])
+ m.insertNextCell(NORM_QPOLYG,[3,0,2,1,5,4])
+ self.assertTrue(DataArrayDouble([-0.58093333350930543,-0.58093333350930543]).isEqual(m.getMeasureField(False).getArray(),1e-12))
+ m.changeSpaceDimension(3)
+ m.orientCorrectly2DCells([0.,0.,-1.],False)
+ #
+ m.checkCoherency()
+ self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([6,3,2,0,4,5,1, 32,3,2,0,4,5,1])))
+ self.assertTrue(m.getNodalConnectivityIndex().isEqual(DataArrayInt([0,7,14])))
+ m.changeSpaceDimension(2)
+ self.assertTrue(DataArrayDouble([0.58093333350930543,0.58093333350930543]).isEqual(m.getMeasureField(False).getArray(),1e-12))
+ pass
+
def setUp(self):
pass
pass