DataArrayInt::checkAndPreparePermutation() const;
DataArrayInt::changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, DataArrayInt *&arrI) const;
DataArrayInt::buildPermArrPerLevel() const;
-DataArrayInt::isIdentity() const;
+DataArrayInt::isIdentity2(int sizeExpected) const;
DataArrayInt::isUniform(int val) const;
DataArrayInt::substr(int tupleIdBg, int tupleIdEnd=-1) const;
DataArrayInt::rearrange(int newNbOfCompo);
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::splitProfilePerType : input profile is NULL !");
if(profile->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::splitProfilePerType : input profile should have exactly one component !");
- int nbTuples=profile->getNumberOfTuples();
- int nbOfCells=getNumberOfCells();
+ int nbTuples(profile->getNumberOfTuples()),nbOfCells(getNumberOfCells());
code.resize(3); idsInPflPerType.resize(1);
code[0]=(int)getCellModelEnum(); code[1]=nbTuples;
idsInPflPerType.resize(1);
- if(profile->isIdentity() && nbTuples==nbOfCells)
+ if(profile->isIdentity2(nbOfCells))
{
code[2]=-1;
idsInPflPerType[0]=const_cast<DataArrayInt *>(profile); idsInPflPerType[0]->incrRef();
* \throw If any value of \a this can't be used as a valid index for
* [\a indArrBg, \a indArrEnd).
*
- * \sa replaceOneValByInThis
+ * \sa changeValue
*/
void DataArrayInt::transformWithIndArr(const int *indArrBg, const int *indArrEnd)
{
declareAsNew();
}
-/*!
- * Modifies in place \a this one-dimensional array like this : each id in \a this so that this[id] equal to \a valToBeReplaced will be replaced at the same place by \a replacedBy.
- *
- * \param [in] valToBeReplaced - the value in \a this to be replaced.
- * \param [in] replacedBy - the value taken by each tuple previously equal to \a valToBeReplaced.
- *
- * \sa DataArrayInt::transformWithIndArr
- */
-void DataArrayInt::replaceOneValByInThis(int valToBeReplaced, int replacedBy)
-{
- checkAllocated();
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("Call replaceOneValByInThis method on DataArrayInt with only one component, you can call 'rearrange' method before !");
- if(valToBeReplaced==replacedBy)
- return ;
- int nbOfTuples(getNumberOfTuples()),*pt(getPointer());
- for(int i=0;i<nbOfTuples;i++,pt++)
- {
- if(*pt==valToBeReplaced)
- *pt=replacedBy;
- }
-}
-
/*!
* Computes distribution of values of \a this one-dimensional array between given value
* ranges (casts). This method is typically useful for entity number spliting by types,
/*!
* Checks if contents of \a this array are equal to that of an array filled with
* iota(). This method is particularly useful for DataArrayInt instances that represent
- * a renumbering array to check the real need in renumbering. In this case it is better to use isIdentity2
- * method of isIdentity method.
+ * a renumbering array to check the real need in renumbering. This method checks than \a this can be considered as an identity function
+ * of a set having \a sizeExpected elements into itself.
*
+ * \param [in] sizeExpected - The number of elements expected.
* \return bool - \a true if \a this array contents == \a range( \a this->getNumberOfTuples())
* \throw If \a this is not allocated.
* \throw If \a this->getNumberOfComponents() != 1.
- * \sa isIdentity2
*/
-bool DataArrayInt::isIdentity() const
+bool DataArrayInt::isIdentity2(int sizeExpected) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
return false;
int nbOfTuples(getNumberOfTuples());
+ if(nbOfTuples!=sizeExpected)
+ return false;
const int *pt=getConstPointer();
for(int i=0;i<nbOfTuples;i++,pt++)
if(*pt!=i)
return true;
}
-/*!
- * This method is stronger than isIdentity method. This method checks than \a this can be considered as an identity function
- * of a set having \a sizeExpected elements into itself.
- *
- * \param [in] sizeExpected - The number of elements
- * \return bool - \a true if \a this array contents == \a range( \a this->getNumberOfTuples()) and if \a this has \a sizeExpected tuples in it.
- *
- * \throw If \a this is not allocated.
- * \throw If \a this->getNumberOfComponents() != 1.
- * \sa isIdentity
- */
-bool DataArrayInt::isIdentity2(int sizeExpected) const
-{
- bool ret0(isIdentity());
- if(!ret0)
- return false;
- return getNumberOfTuples()==sizeExpected;
-}
-
/*!
* Checks if all values in \a this array are equal to \a val.
* \param [in] val - value to check equality of array values to.
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::changeValue : the array must have only one component, you can call 'rearrange' method before !");
- int *start=getPointer();
- int *end2=start+getNbOfElems();
- int ret=0;
+ if(oldValue==newValue)
+ return 0;
+ int *start(getPointer()),*end2(start+getNbOfElems());
+ int ret(0);
for(int *val=start;val!=end2;val++)
{
if(*val==oldValue)
ret++;
}
}
+ if(ret>0)
+ declareAsNew();
return ret;
}
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : the array must have only one component, you can call 'rearrange' method before !");
std::set<int> vals2(valsBg,valsEnd);
- const int *cptr=getConstPointer();
+ const int *cptr(getConstPointer());
std::vector<int> res;
- int nbOfTuples=getNumberOfTuples();
+ int nbOfTuples(getNumberOfTuples());
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
for(int i=0;i<nbOfTuples;i++,cptr++)
if(vals2.find(*cptr)!=vals2.end())
MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
MEDCOUPLING_EXPORT void transformWithIndArr(const int *indArrBg, const int *indArrEnd);
- MEDCOUPLING_EXPORT void replaceOneValByInThis(int valToBeReplaced, int replacedBy);
MEDCOUPLING_EXPORT DataArrayInt *transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const;
MEDCOUPLING_EXPORT void splitByValueRange(const int *arrBg, const int *arrEnd,
DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const;
MEDCOUPLING_EXPORT void changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, DataArrayInt *&arrI) const;
MEDCOUPLING_EXPORT static DataArrayInt *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, const int *arr, const int *arrIBg, const int *arrIEnd, int &newNbOfTuples);
MEDCOUPLING_EXPORT DataArrayInt *buildPermArrPerLevel() const;
- MEDCOUPLING_EXPORT bool isIdentity() const;
MEDCOUPLING_EXPORT bool isIdentity2(int sizeExpected) const;
MEDCOUPLING_EXPORT bool isUniform(int val) const;
MEDCOUPLING_EXPORT DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const;
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !");
}
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellCor2=da->selectByTupleId2(nbCells,da->getNbOfElems(),1);
- nodeCor=nodeCor2->isIdentity()?0:nodeCor2.retn();
- cellCor=cellCor2->isIdentity()?0:cellCor2.retn();
+ nodeCor=nodeCor2->isIdentity2(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn();
+ cellCor=cellCor2->isIdentity2(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
}
/*!
throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !");
}
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellCor2=da->selectByTupleId2(getNumberOfCells(),da->getNbOfElems(),1);
- cellCor=cellCor2->isIdentity()?0:cellCor2.retn();
+ cellCor=cellCor2->isIdentity2(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
}
void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const
code[3*i]=(int)types[castId];
code[3*i+1]=tmp3->getNumberOfTuples();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp4=rankInsideCast->selectByTupleId(tmp3->getConstPointer(),tmp3->getConstPointer()+tmp3->getNumberOfTuples());
- if(tmp4->getNumberOfTuples()!=typeRangeVals[castId+1]-typeRangeVals[castId] || !tmp4->isIdentity())
+ if(!tmp4->isIdentity2(typeRangeVals[castId+1]-typeRangeVals[castId]))
{
tmp4->copyStringInfoFrom(*profile);
idsPerType2.push_back(tmp4);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> candidates(ret2->getIdsEqual(old2DCellId));
ret3->setIJ(*it,0,FindRightCandidateAmong(ret2D,candidates->begin(),candidates->end(),ret1,*it%2==0?-((*it)/2+1):(*it)/2+1,eps));// div by 2 because 2 components natively in ret3
}
- ret3->replaceOneValByInThis(std::numeric_limits<int>::max(),-1);
+ ret3->changeValue(std::numeric_limits<int>::max(),-1);
ret3->rearrange(2);
//
splitMesh1D=ret1.retn();
da->alloc(8,1);
da->iota(0);
da2=da->checkAndPreparePermutation();
- CPPUNIT_ASSERT_EQUAL(8,da2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
- CPPUNIT_ASSERT(da2->isIdentity());
+ CPPUNIT_ASSERT(da2->isIdentity2(8));
da2->decrRef();
da->decrRef();
//
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
DataArrayInt *da5=m->findCellIdsOnBoundary();
- CPPUNIT_ASSERT_EQUAL(5,da5->getNumberOfTuples());
- CPPUNIT_ASSERT(da5->isIdentity());
+ CPPUNIT_ASSERT(da5->isIdentity2(5));
//
da5->decrRef();
m->decrRef();
ref2->decrRef();
vals->abs();
DataArrayInt *theTest=vals->getIdsInRange(-1.,1e-7);
- CPPUNIT_ASSERT(theTest->isIdentity());
- CPPUNIT_ASSERT_EQUAL(331,theTest->getNumberOfTuples());
+ CPPUNIT_ASSERT(theTest->isIdentity2(331));
theTest->decrRef();
valsF->decrRef();
//
da.alloc(8,1);
da.iota(0);
da2=da.checkAndPreparePermutation();
- self.assertEqual(8,da2.getNumberOfTuples());
self.assertEqual(1,da2.getNumberOfComponents());
- self.assertTrue(da2.isIdentity());
+ self.assertTrue(da2.isIdentity2(8));
#
da=DataArrayInt.New();
da.alloc(8,1);
def testUMeshFindCellIdsOnBoundary1(self):
m=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
da5=m.findCellIdsOnBoundary();
- self.assertEqual(5,da5.getNumberOfTuples());
- self.assertTrue(da5.isIdentity());
+ self.assertTrue(da5.isIdentity2(5));
pass
def testMeshSetTime1(self):
vals-=DataArrayDouble.New(ref)
vals.abs()
theTest=vals.getIdsInRange(-1.,1e-7)
- self.assertTrue(theTest.isIdentity())
- self.assertEqual(331,len(theTest))
+ self.assertTrue(theTest.isIdentity2(331))
pass
def testSwigDAIOp8(self):
#
n,ni=m.computeNeighborsOfCells()
a,b=MEDCouplingUMesh.ComputeSpreadZoneGraduallyFromSeed(0,n,ni)
- self.assertEqual(13,b) ; self.assertEqual(125,len(a)) ; self.assertTrue(a.isIdentity())
+ self.assertEqual(13,b) ; self.assertTrue(a.isIdentity2(125))
a,b=MEDCouplingUMesh.ComputeSpreadZoneGraduallyFromSeed([1],n,ni)
- self.assertEqual(12,b) ; self.assertEqual(125,len(a)) ; self.assertTrue(a.isIdentity())
+ self.assertEqual(12,b) ; self.assertTrue(a.isIdentity2(125))
a,b=MEDCouplingUMesh.ComputeSpreadZoneGraduallyFromSeed((2,),n,ni)
- self.assertEqual(11,b) ; self.assertEqual(125,len(a)) ; self.assertTrue(a.isIdentity())
+ self.assertEqual(11,b) ; self.assertTrue(a.isIdentity2(125))
a,b=MEDCouplingUMesh.ComputeSpreadZoneGraduallyFromSeed(DataArrayInt([3]),n,ni)
- self.assertEqual(12,b) ; self.assertEqual(125,len(a)) ; self.assertTrue(a.isIdentity())
+ self.assertEqual(12,b) ; self.assertTrue(a.isIdentity2(125))
pass
def testSwigUMeshInsertNextCell1(self):
def testSwig2ConvertLinearCellsToQuadratic2(self):
m2D=MEDCouplingDataForTest.build2DTargetMesh_1()
ret=m2D.convertLinearCellsToQuadratic(1)
- self.assertTrue(ret.isIdentity())
- self.assertEqual(5,len(ret))
+ self.assertTrue(ret.isIdentity2(5))
m2D.checkCoherency1()
coordsExp=DataArrayDouble([-0.3,-0.3,0.2,-0.3,0.7,-0.3,-0.3,0.2,0.2,0.2,0.7,0.2,-0.3,0.7,0.2,0.7,0.7,0.7,-0.3,-0.05,-0.05,0.2,0.2,-0.05,-0.05,-0.3,0.45,-0.05,0.45,-0.3,0.45,0.2,0.7,-0.05,-0.05,0.7,0.2,0.45,-0.3,0.45,0.45,0.7,0.7,0.45,-0.05,-0.05,0.3666666666666667,-0.1333333333333333,0.5333333333333332,0.03333333333333334,-0.05,0.45,0.45,0.45],27,2)
self.assertTrue(m2D.getCoords().isEqual(coordsExp,1e-14))
cooTmp=m2D.getCoords()[:]
m3D=m2D.buildExtrudedMesh(m1D,0)
ret=m3D.convertLinearCellsToQuadratic(1)
- self.assertTrue(ret.isIdentity())
- self.assertEqual(4,len(ret))
+ self.assertTrue(ret.isIdentity2(4))
m3D.checkCoherency1()
coordsExp2=DataArrayDouble([-0.3,-0.3,0.0,0.2,-0.3,0.0,-0.3,0.2,0.0,0.2,0.2,0.0,-0.3,0.7,0.0,0.2,0.7,0.0,-0.3,-0.3,1.0,0.2,-0.3,1.0,-0.3,0.2,1.0,0.2,0.2,1.0,-0.3,0.7,1.0,0.2,0.7,1.0,-0.3,-0.3,2.0,0.2,-0.3,2.0,-0.3,0.2,2.0,0.2,0.2,2.0,-0.3,0.7,2.0,0.2,0.7,2.0,-0.3,-0.05,0.0,-0.05,0.2,0.0,0.2,-0.05,0.0,-0.05,-0.3,0.0,-0.3,-0.05,1.0,-0.05,0.2,1.0,0.2,-0.05,1.0,-0.05,-0.3,1.0,-0.3,-0.3,0.5,-0.3,0.2,0.5,0.2,0.2,0.5,0.2,-0.3,0.5,-0.05,0.7,0.0,0.2,0.45,0.0,-0.3,0.45,0.0,-0.05,0.7,1.0,0.2,0.45,1.0,-0.3,0.45,1.0,-0.3,0.7,0.5,0.2,0.7,0.5,-0.3,-0.05,2.0,-0.05,0.2,2.0,0.2,-0.05,2.0,-0.05,-0.3,2.0,-0.3,-0.3,1.5,-0.3,0.2,1.5,0.2,0.2,1.5,0.2,-0.3,1.5,-0.05,0.7,2.0,0.2,0.45,2.0,-0.3,0.45,2.0,-0.3,0.7,1.5,0.2,0.7,1.5,-0.05,-0.05,0.0,-0.3,-0.05,0.5,-0.05,0.2,0.5,0.2,-0.05,0.5,-0.05,-0.3,0.5,-0.05,-0.05,1.0,-0.05,0.45,0.0,-0.05,0.7,0.5,0.2,0.45,0.5,-0.3,0.45,0.5,-0.05,0.45,1.0,-0.3,-0.05,1.5,-0.05,0.2,1.5,0.2,-0.05,1.5,-0.05,-0.3,1.5,-0.05,-0.05,2.0,-0.05,0.7,1.5,0.2,0.45,1.5,-0.3,0.45,1.5,-0.05,0.45,2.0,-0.05,-0.05,0.5,-0.05,0.45,0.5,-0.05,-0.05,1.5,-0.05,0.45,1.5],75,3)
self.assertTrue(m3D.getCoords().isEqual(coordsExp2,1e-14))
if __name__ == '__main__':
unittest.main()
-
\ No newline at end of file
+
def testSwig2DAIReplaceOneValByInThis1(self):
d=DataArrayInt([4,-5,-1,0,-5,99,-7,5])
- d.replaceOneValByInThis(-5,900)
+ d.changeValue(-5,900)
self.assertTrue(d.isEqual(DataArrayInt([4,900,-1,0,900,99,-7,5])))
pass
void fillWithZero() throw(INTERP_KERNEL::Exception);
void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
void iota(int init=0) throw(INTERP_KERNEL::Exception);
- void replaceOneValByInThis(int valToBeReplaced, int replacedBy) throw(INTERP_KERNEL::Exception);
std::string repr() const throw(INTERP_KERNEL::Exception);
std::string reprZip() const throw(INTERP_KERNEL::Exception);
std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
- bool isIdentity() const throw(INTERP_KERNEL::Exception);
bool isIdentity2(int sizeExpected) const throw(INTERP_KERNEL::Exception);
bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
d=DataArrayInt(a)
self.assertEqual(weakref.getweakrefcount(a),1)
self.assertTrue(not a.flags["OWNDATA"])
- self.assertTrue(d.isIdentity())
- self.assertEqual(len(d),20)
+ self.assertTrue(d.isIdentity2(20))
a[:]=2 # modifying a and d because a and d share the same chunk of data
self.assertTrue(d.isUniform(2))
del d # d is destroyed, a retrieves its ownership of its initial chunk of data
a=arange(20,dtype=int32)
d=DataArrayInt(a) # d owns data of a
e=DataArrayInt(a) # a not owned -> e only an access to chunk of a
- self.assertTrue(d.isIdentity())
- self.assertTrue(e.isIdentity())
+ self.assertTrue(d.isIdentity2(d.getNumberOfTuples()))
+ self.assertTrue(e.isIdentity2(e.getNumberOfTuples()))
a[:]=6
self.assertTrue(d.isUniform(6))
self.assertTrue(e.isUniform(6))
del b # no impact on e and f because a is the base of a.
##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
gc.collect()
- self.assertTrue(f.isIdentity())
- self.assertTrue(e.isIdentity())
+ self.assertTrue(f.isIdentity2(f.getNumberOfTuples()))
+ self.assertTrue(e.isIdentity2(e.getNumberOfTuples()))
del a # a destroyed, but as c has its base set to a, a exists -> e and f not allocated
##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
gc.collect()
- self.assertTrue(f.isIdentity())
- self.assertTrue(e.isIdentity())
+ self.assertTrue(f.isIdentity2(f.getNumberOfTuples()))
+ self.assertTrue(e.isIdentity2(e.getNumberOfTuples()))
del c # c killed -> a killed -> e and d are put into not allocated state
##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
gc.collect()
b=DataArrayInt(a)
c=DataArrayInt(a)
d=DataArrayInt(a)
- self.assertTrue(b.isIdentity()) ; self.assertEqual(len(b),10)
- self.assertTrue(c.isIdentity()) ; self.assertEqual(len(c),10)
- self.assertTrue(d.isIdentity()) ; self.assertEqual(len(d),10)
+ self.assertTrue(b.isIdentity2(10))
+ self.assertTrue(c.isIdentity2(10))
+ self.assertTrue(d.isIdentity2(10))
c.pushBackSilent(10) # c and a,b are dissociated
- self.assertTrue(b.isIdentity()) ; self.assertEqual(len(b),10)
- self.assertTrue(c.isIdentity()) ; self.assertEqual(len(c),11)
- self.assertTrue(d.isIdentity()) ; self.assertEqual(len(d),10)
+ self.assertTrue(b.isIdentity2(10))
+ self.assertTrue(c.isIdentity2(11))
+ self.assertTrue(d.isIdentity2(10))
del a
gc.collect()
- self.assertTrue(b.isIdentity()) ; self.assertEqual(len(b),10)
- self.assertTrue(c.isIdentity()) ; self.assertEqual(len(c),11)
+ self.assertTrue(b.isIdentity2(10))
+ self.assertTrue(c.isIdentity2(11))
self.assertTrue(not d.isAllocated())
del b
gc.collect()
- self.assertTrue(c.isIdentity()) ; self.assertEqual(len(c),11)
+ self.assertTrue(c.isIdentity2(11))
#
a=arange(10,dtype=int32)
b=DataArrayInt(a)
c=DataArrayInt(a)
- self.assertTrue(b.isIdentity()) ; self.assertEqual(len(b),10)
- self.assertTrue(c.isIdentity()) ; self.assertEqual(len(c),10)
+ self.assertTrue(b.isIdentity2(10))
+ self.assertTrue(c.isIdentity2(10))
b.pushBackSilent(10) # c and a,b are dissociated
- self.assertTrue(b.isIdentity()) ; self.assertEqual(len(b),11)
- self.assertTrue(c.isIdentity()) ; self.assertEqual(len(c),10)
+ self.assertTrue(b.isIdentity2(11))
+ self.assertTrue(c.isIdentity2(10))
del a
gc.collect()
- self.assertTrue(b.isIdentity()) ; self.assertEqual(len(b),11)
+ self.assertTrue(b.isIdentity2(11))
self.assertTrue(not c.isAllocated())
del b
gc.collect()
}
else
{
- if(da3->getNumberOfTuples()!=nbOfEltsInWholeMesh || !da3->isIdentity())
+ if(!da3->isIdentity2(nbOfEltsInWholeMesh))
{
da3->setName(oss.str().c_str());
glob.appendProfile(da3);
int nbEntityElts=subIds->getNumberOfTuples();
bool ret2;
MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> eltToAdd=MEDFileFieldPerMeshPerTypePerDisc::
- NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIdentity() || nbEntityElts!=newCode[3*(*idIt)+1],nbi,
+ NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIdentity2(newCode[3*(*idIt)+1]),nbi,
offset+offset2,
li,glob,ret2);
ret=ret || ret2;
const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
- if(da->isIdentity())
- {
- int nbOfTuples=da->getNumberOfTuples();
- if(nbOfTuples==mesh->getNumberOfCells())
- return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc);
- }
+ if(da->isIdentity2(mesh->getNumberOfCells()))
+ return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc);
MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m2=mesh->buildPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
m2->setName(mesh->getName().c_str());
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(type,glob,dads,locs,m2,isPfl,arrOut,nasc);
const std::vector<std::pair<int,int> >& dads, const std::vector<int>& locs,
const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
- if(da->isIdentity())
- {
- int nbOfTuples=da->getNumberOfTuples();
- if(nbOfTuples==mesh->getNumberOfNodes())//No problem for NORM_ERROR because it is in context of node
- return finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc);
- }
+ if(da->isIdentity2(mesh->getNumberOfNodes()))
+ return finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc);
// Treatment of particular case where nodal field on pfl is requested with a meshDimRelToMax=1.
const MEDCouplingUMesh *meshu=dynamic_cast<const MEDCouplingUMesh *>(mesh);
if(meshu)
{
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p1(globs->getProfile(pflName.c_str())->deepCpy());
p1->sort(true);
- if(!p1->isIdentity() || p1->getNumberOfTuples()!=getNumberOfNodes())
+ if(!p1->isIdentity2(getNumberOfNodes()))
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 4 !");
MEDCouplingAutoRefCountObjectPtr<DataArray> ret(vals->deepCpy());
ret->renumberInPlace(globs->getProfile(pflName.c_str())->begin());
arr=arr->buildUnique();
if(oldNbTuples!=arr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : some entities are present several times !");
- if(arr->isIdentity() && oldNbTuples==nbEntityRef)
+ if(arr->isIdentity2(nbEntityRef))
{
std::pair<int,int> p(0,nbEntityRef);
std::string a,b;
const DataArrayInt *pfl=globs->getProfile(otherNodeIt.getPflName().c_str());
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cpyPfl(pfl->deepCpy());
cpyPfl->sort();
- if(cpyPfl->isIdentity() && cpyPfl->getNumberOfTuples()==nbOfNodes)
+ if(cpyPfl->isIdentity2(nbOfNodes))
{//on all nodes also !
if(!ret0)
return false;
end=PutInThirdComponentOfCodeOffset(code2,start);
newCode.insert(newCode.end(),code2.begin(),code2.end());
//
- if(o2nCellsPart2->isIdentity())
+ if(o2nCellsPart2->isIdentity2(o2nCellsPart2->getNumberOfTuples()))
continue;
if(famField)
{
_m=m;
_m_by_types.assignUMesh(dynamic_cast<MEDCouplingUMesh *>(m->deepCpy()));
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=_m_by_types.getUmesh()->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
- if(!da->isIdentity())
+ if(!da->isIdentity2(m->getNumberOfCells()))
{
_num=da->invertArrayO2N2N2O(m->getNumberOfCells());
_m.updateTime();
}
MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> f1ts(MEDFileField1TS::New());
AssignStaticWritePropertiesTo(*f1ts);
- if(part->isIdentity() && part->getNumberOfTuples()==mread->getNumberOfCells())
+ if(part->isIdentity2(mread->getNumberOfCells()))
f1ts->setFieldNoProfileSBT(f2);
else
{
}
MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> f1ts(MEDFileField1TS::New());
AssignStaticWritePropertiesTo(*f1ts);
- if(part->isIdentity() && part->getNumberOfTuples()==mread->getNumberOfNodes())
+ if(part->isIdentity2(mread->getNumberOfNodes()))
f1ts->setFieldNoProfileSBT(f2);
else
{
ff1.write(fname,0)
f1=ff1.getFieldOnMeshAtLevel(ON_GAUSS_NE,m1,0)
f2,p1=ff1.getFieldWithProfile(ON_GAUSS_NE,0,mm1) ; f2.setName("")
- self.assertTrue(p1.isIdentity())
- self.assertEqual(5,p1.getNumberOfTuples())
+ self.assertTrue(p1.isIdentity2(5))
self.assertTrue(f1.getArray().isEqual(f2,1e-12))
pass
# Test for getFieldAtTopLevel method
+ remove isIdentity2
+ remove replaceOneValByInThis (changeValue fait le meme boulot) - Attention repercuter if(oldValue==newValue) return 0
+ tessellate2D et tessellate2DCurve: à merger en un seul tessellate2D
+ + remove checkCoherency2
Inheritance fix (OK but at the end of process)
===============