throw INTERP_KERNEL::Exception(oss.str().c_str());
}
int nbTuplesFine(fineDA->getNumberOfTuples());
+ if(nbOfTuplesInFineExp==0)
+ return ;
if(nbTuplesFine%nbOfTuplesInFineExp!=0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : Invalid nb of tuples in fine DataArray regarding its structure !");
int fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies<int>()));
int MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(const std::vector< std::pair<int,int> >& partCompactFormat)
{
int ret(1);
- bool isFetched(false);
std::size_t ii(0);
for(std::vector< std::pair<int,int> >::const_iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,ii++)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt : invalid input at dimension " << ii << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- if(b-a>0)
- {
- isFetched=true;
- ret*=(b-a);
- }
+ ret*=(b-a);
}
- return isFetched?ret:0;
+ return ret;
}
int MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(const std::vector<int>& st)
a,b=MEDCouplingStructuredMesh.IsPartStructured(d20,st)
self.assertTrue(a) ; self.assertEqual(b,[(1,5),(0,3)])
self.assertEqual(12,MEDCouplingStructuredMesh.DeduceNumberOfGivenRangeInCompactFrmt(b))
- self.assertEqual(8,MEDCouplingStructuredMesh.DeduceNumberOfGivenRangeInCompactFrmt([(1,5),(1,3),(2,2)]))
+ self.assertEqual(0,MEDCouplingStructuredMesh.DeduceNumberOfGivenRangeInCompactFrmt([(1,5),(1,3),(2,2)]))
self.assertEqual(0,MEDCouplingStructuredMesh.DeduceNumberOfGivenRangeInCompactFrmt([(5,5),(3,3),(2,2)]))
self.assertEqual(36,MEDCouplingStructuredMesh.DeduceNumberOfGivenStructure([3,2,6]))
self.assertEqual(126,MEDCouplingStructuredMesh.DeduceNumberOfGivenStructure((3,7,6)))