%feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
%feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
%feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
+%feature("unref") MEDCouplingFieldFloat "$this->decrRef();"
+%feature("unref") MEDCouplingFieldInt "$this->decrRef();"
%feature("unref") MEDCouplingMultiFields "$this->decrRef();"
%feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
%feature("unref") MEDCouplingMultiFields "$this->decrRef();"
}
}
};
+
+ template<class T>
+ class MEDCouplingFieldT : public MEDCoupling::MEDCouplingField
+ {
+ public:
+ TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
+ protected:
+ MEDCouplingFieldT();
+ ~MEDCouplingFieldT();
+ };
+
+ %template(DTC3) MEDCoupling::MEDCouplingFieldT<double>;
+ %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT<float>;
+ %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT<int>;
class MEDCouplingFieldInt;
class MEDCouplingFieldFloat;
- class MEDCouplingFieldDouble : public MEDCoupling::MEDCouplingField
+ class MEDCouplingFieldDouble : public MEDCouplingFieldT<double>
{
public:
static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
- TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
}
};
- class MEDCouplingFieldInt : public MEDCouplingField
+ class MEDCouplingFieldInt : public MEDCouplingFieldT<int>
{
public:
static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
}
};
- class MEDCouplingFieldFloat : public MEDCouplingField
+ class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
{
public:
static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
return MEDCouplingStdReduceFunct,(MEDCoupling1DGTUMesh,((),(self.__getstate__()),))
def MEDCouplingFieldDoubleReduce(self):
self.checkConsistencyLight()
- d={0:(self.getTypeOfField(),self.getTimeDiscretization())}
- return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,((d,),(self.__getstate__()),))
+ d=(self.getTypeOfField(),self.getTimeDiscretization())
+ return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),))
def MEDCouplingFieldIntReduce(self):
self.checkConsistencyLight()
- d={0:(self.getTypeOfField(),self.getTimeDiscretization())}
- return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt,((d,),(self.__getstate__()),))
+ d=(self.getTypeOfField(),self.getTimeDiscretization())
+ return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt,(d,(self.__getstate__()),))
def MEDCouplingFieldFloatReduce(self):
self.checkConsistencyLight()
- d={0:(self.getTypeOfField(),self.getTimeDiscretization())}
- return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,((d,),(self.__getstate__()),))
+ d=(self.getTypeOfField(),self.getTimeDiscretization())
+ return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
%}
%pythoncode %{
exp_coo = [9.48750000000001, 9.48750000000001, 10.75249999999975, 9.48749999999955, 10.80629999999976, 9.48749999999955, 9.48749999999961, 10.75249999999971, 10.75249999999338, 10.75249999999338, 10.32506096654411, 10.32506096654411, 9.91493903345591, 10.32506096654411, 9.91493903345591, 9.91493903345591, 10.32506096654411, 9.91493903345591, 10.38162950903903, 10.38162950903903, 9.85837049096099, 10.38162950903903, 9.85837049096099, 9.85837049096099, 10.38162950903903, 9.85837049096099, 10.80629999999339, 10.75249999999338, 9.48749999999961, 10.80629999999971, 10.75249999999338, 10.80629999999339, 10.80629999999339, 10.80629999999339, 9.830000000000023, 10.120000000000008, 10.120000000000008, 10.410000000000004, 10.41000000000001, 10.120000000000008, 10.120000000000008, 9.830000000000013, 9.886654762208451, 10.353345237791569, 9.830000000000023, 10.120000000000008, 9.886654762208451, 9.886654762208451, 9.750000000000005, 10.12000000000001, 9.487499999999809, 10.11999999999986, 9.6729352454803, 10.56706475451937, 9.750000000000005, 10.12000000000001, 9.672935245480499, 9.672935245480499, 9.886654762208451, 9.886654762208451, 10.120000000000008, 9.830000000000013, 10.41000000000001, 10.120000000000008, 10.120000000000008, 10.410000000000004, 9.886654762208451, 10.353345237791569, 10.120000000000013, 10.490000000000004, 10.489999999999988, 10.120000000000013, 10.120000000000017, 9.750000000000021, 10.119999999996494, 10.752499999996544, 10.752499999996566, 10.119999999996466, 10.11999999999988, 9.48749999999978, 9.672935245480499, 9.672935245480499, 10.120000000000017, 9.750000000000021, 10.489999999999988, 10.120000000000013, 10.120000000000013, 10.490000000000004, 9.6729352454803, 10.56706475451937]
e1 = [0, 0, 0, 0, 0, 1, 2, 3]
e2 = [3, 4, 5, 6, 7, 8, 1, 2]
- valuesExpected=DataArrayDouble(exp_coo, len(exp_coo)/2, 2)
+ valuesExpected=DataArrayDouble(exp_coo, len(exp_coo)//2, 2)
self.assertTrue(result.getCoords().isEqual(valuesExpected,1e-12))
self.assertEqual(e1, mapResToInit.getValues())
self.assertEqual(e2, mapResToRef.getValues())
exp_coo = [9.48749999999998, -10.75249999999999, 9.48750000000018, -10.80629999999998, 10.75250000000047, -10.75250000000063, 10.75249999999318, -10.80629999999318, 10.80630000000048, -10.75250000000063, 10.80629999999318, -10.80629999999318, 9.48750000000001, -9.48750000000001, 10.75249999999975, -9.48750000000004, 10.32506096654408, -9.91493903345589, 9.91493903345589, -9.91493903345589, 9.91493903345589, -10.32506096654409, 10.32506096654408, -10.32506096654409, 10.80629999999976, -9.48750000000004, 10.119999999999989, -10.409999999999961, 9.829999999999997, -10.11999999999999, 10.119999999999983, -9.830000000000005, 10.409999999999968, -10.119999999999987, 9.487499999999994, -10.120000000000001, 9.70121951672795, -9.70121951672795, 9.829999999999997, -10.11999999999999, 9.701219516727935, -10.53878048327204, 10.11999999999988, -9.487500000000026, 10.752500000000111, -10.120000000000335, 10.120000000000225, -10.75250000000031, 9.701219516727935, -10.53878048327204, 10.119999999999989, -10.409999999999961, 10.409999999999968, -10.119999999999987, 10.119999999999983, -9.830000000000005, 9.70121951672795, -9.70121951672795]
e1 = [0, 1, 2, 2, 2, 3]
e2 = [0, 1, 2, 3, 4, 5]
- valuesExpected=DataArrayDouble(exp_coo, len(exp_coo)/2, 2)
+ valuesExpected=DataArrayDouble(exp_coo, len(exp_coo)//2, 2)
self.assertTrue(result.getCoords().isEqual(valuesExpected,1e-10))
self.assertEqual(e1, mapResToInit.getValues())
self.assertEqual(e2, mapResToRef.getValues())
connI_tgt = [0, 9, 22]
res1_tgt = [0, 0]
res2_tgt = [0, -1]
- self.assert_(coo_tgt.isEqualWithoutConsideringStr(m_intersec.getCoords(), 1e-12))
+ self.assertTrue(coo_tgt.isEqualWithoutConsideringStr(m_intersec.getCoords(), 1e-12))
self.assertEqual(conn_tgt, m_intersec.getNodalConnectivity().getValues())
self.assertEqual(connI_tgt, m_intersec.getNodalConnectivityIndex().getValues())
self.assertEqual(res1_tgt, resToM1.getValues())