using namespace INTERP_KERNEL;
-const double GaussInfo::SEG2_REF[2]={-1.0, 1.0};
+const double GaussInfo::SEG2A_REF[2]={-1.0, 1.0};
+
+const double GaussInfo::SEG2B_REF[2]={0., 1.0};
const double GaussInfo::SEG3_REF[3]={-1.0, 1.0, 0.0};
std::vector<double> a(SEG3_REF,SEG3_REF+3);
if(IsSatisfy(a,_my_reference_coord))
{
- std::vector<double> c(SEG2_REF,SEG2_REF+2);
+ std::vector<double> c(SEG2A_REF,SEG2A_REF+2);
return GaussInfo(NORM_SEG2,_my_gauss_coord,getNbGauss(),c,2);
}
throw INTERP_KERNEL::Exception("GaussInfo::convertToLinear : not recognized pattern for SEG3 !");
case NORM_SEG2:
_my_local_ref_dim = 1;
_my_local_nb_ref = 2;
- seg2Init();
+ seg2aInit();
aSatify = isSatisfy();
- CHECK_MACRO;
+ if(!aSatify)
+ {
+ seg2bInit();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ }
break;
case NORM_SEG3:
/*!
* Init Segment 2 Reference coordinates ans Shape function.
*/
-void GaussInfo::seg2Init()
+void GaussInfo::seg2aInit()
{
LOCAL_COORD_MACRO_BEGIN;
case 0:
- coords[0] = SEG2_REF[0];
+ coords[0] = SEG2A_REF[0];
break;
case 1:
- coords[0] = SEG2_REF[1];
+ coords[0] = SEG2A_REF[1];
break;
LOCAL_COORD_MACRO_END;
SHAPE_FUN_MACRO_END;
}
+void GaussInfo::seg2bInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = SEG2B_REF[0];
+ break;
+ case 1:
+ coords[0] = SEG2B_REF[1];
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 1.0 - gc[0];
+ funValue[1] = gc[0];
+ SHAPE_FUN_MACRO_END;
+}
+
/*!
* Init Segment 3 Reference coordinates ans Shape function.
*/
}
/*!
- * This shapefunc map is same as degenerated seg2Init
+ * This shapefunc map is same as degenerated seg2aInit
*/
void GaussInfo::quad4DegSeg2Init()
{
INTERPKERNEL_EXPORT static std::vector<double> NormalizeCoordinatesIfNecessary(NormalizedCellType ct, int inputDim, const std::vector<double>& inputArray);
public:
- static const double SEG2_REF[2];
+ static const double SEG2A_REF[2];
+ static const double SEG2B_REF[2];
static const double SEG3_REF[3];
static const double TRIA3A_REF[6];
static const double TRIA3B_REF[6];
void point1Init();
//1D
- void seg2Init();
+ void seg2aInit();
+ void seg2bInit();
void seg3Init();
//2D
pass
def testRenumberNodesInConnOpt(self):
+ """ Test of MEDCouplingPointSet.renumberNodesInConn with map as input coming from DataArrayInt.invertArrayN2O2O2NOptimized
+ """
m=MEDCouplingUMesh("mesh",2)
m.allocateCells()
m.insertNextCell(NORM_QUAD4,[10000,10002,10001,10003])
self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([0,2,1,3])))
self.assertTrue(m.getNodalConnectivityIndex().isEqual(DataArrayInt([0,4])))
pass
+
+ def testSeg2bGP(self):
+ """Test of Gauss points on SEG2 using SEG2B style as ref coords
+ """
+ coo=DataArrayDouble([[0.,0.,0.],[1.,1.,1.]])
+ m=MEDCouplingUMesh("mesh",1) ; m.setCoords(coo)
+ m.allocateCells()
+ # the cell description is exactly those described in the description of HEXA27 in MED file 3.0.7 documentation
+ m.insertNextCell(NORM_SEG2,[0,1])
+ refCoo=[0.,1.]
+ weights=[0.8,0.1,0.1]
+ gCoords=[0.2,0.5,0.9]
+ fGauss=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fGauss.setName("fGauss")
+ fGauss.setMesh(m)
+ fGauss.setGaussLocalizationOnType(NORM_SEG2,refCoo,gCoords,weights)
+ arr=DataArrayDouble(fGauss.getNumberOfTuplesExpected()) ; arr.iota()
+ fGauss.setArray(arr)
+ fGauss.checkConsistencyLight()
+ arrOfDisc=fGauss.getLocalizationOfDiscr()
+ self.assertTrue(arrOfDisc.isEqual(DataArrayDouble([0.2,0.2,0.2,0.5,0.5,0.5,0.9,0.9,0.9],3,3),1e-12))
+ pass
pass