X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNEL%2FCellModel.cxx;h=44523f8bcee5c997a261b315c620adfb2b6ebcf0;hb=be4c3bb042d5426fbbe54378b9d7b35173ab27ef;hp=ed283e18e142929f8d62bafeb44af9d11c020ec9;hpb=f1a947b32a36d8dc8e3079b25305bb50e8cb59a0;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/CellModel.cxx b/src/INTERP_KERNEL/CellModel.cxx index ed283e18e..44523f8bc 100644 --- a/src/INTERP_KERNEL/CellModel.cxx +++ b/src/INTERP_KERNEL/CellModel.cxx @@ -397,7 +397,7 @@ namespace INTERP_KERNEL break; case NORM_POLYGON: { - _nb_of_pts=0; _nb_of_sons=0; _dim=2; _dyn=true; _extruded_type=NORM_POLYHED; _is_simplex=false; + _nb_of_pts=0; _nb_of_sons=0; _dim=2; _dyn=true; _extruded_type=NORM_POLYHED; _is_simplex=false; _quadratic_type=NORM_QPOLYG; } break; case NORM_POLYHED: @@ -407,13 +407,14 @@ namespace INTERP_KERNEL break; case NORM_QPOLYG: { - _nb_of_pts=0; _nb_of_sons=0; _dim=2; _dyn=true; _is_simplex=false; _quadratic=true; + _nb_of_pts=0; _nb_of_sons=0; _dim=2; _dyn=true; _is_simplex=false; _quadratic=true; _linear_type=NORM_POLYGON; } break; case NORM_POLYL: { _nb_of_pts=0; _nb_of_sons=0; _dim=1; _dyn=true; _extruded_type=NORM_POLYGON; _is_simplex=false; } + break; case NORM_ERROR: { _nb_of_pts=std::numeric_limits::max(); _nb_of_sons=std::numeric_limits::max(); _dim=std::numeric_limits::max(); @@ -449,6 +450,36 @@ namespace INTERP_KERNEL else//polyhedron return (lgth-std::count(conn,conn+lgth,-1))/2; } + + NormalizedCellType CellModel::getCorrespondingPolyType() const + { + switch(getDimension()) + { + case 0: + return NORM_POINT1; + case 1: + { + if(!isQuadratic()) + return NORM_POLYL; + throw INTERP_KERNEL::Exception("CellModel::getPolyType : no poly type for quadratic 1D !"); + } + case 2: + { + if(!isQuadratic()) + return NORM_POLYGON; + else + return NORM_QPOLYG; + } + case 3: + { + if(!isQuadratic()) + return NORM_POLYHED; + throw INTERP_KERNEL::Exception("CellModel::getPolyType : no poly type for quadratic 3D !"); + } + default: + throw INTERP_KERNEL::Exception("CellModel::getPolyType : only dimension 0, 1, 2, 3 are supported !"); + } + } /*! * Equivalent to getSonType except that this method deals with dynamic type.