{
}
-std::size_t MEDCouplingStructuredMesh::getHeapMemorySize() const
+std::size_t MEDCouplingStructuredMesh::getHeapMemorySizeWithoutChildren() const
{
- return MEDCouplingMesh::getHeapMemorySize();
+ return MEDCouplingMesh::getHeapMemorySizeWithoutChildren();
}
-void MEDCouplingStructuredMesh::copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception)
+void MEDCouplingStructuredMesh::copyTinyStringsFrom(const MEDCouplingMesh *other)
{
MEDCouplingMesh::copyTinyStringsFrom(other);
}
-bool MEDCouplingStructuredMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception)
+bool MEDCouplingStructuredMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const
{
return MEDCouplingMesh::isEqualIfNotWhy(other,prec,reason);
}
return GetGeoTypeGivenMeshDimension(getMeshDimension());
}
-INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception)
+INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(int meshDim)
{
switch(meshDim)
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
-DataArrayInt *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
if(getTypeOfCell(0)==type)
return ret.retn();
}
-DataArrayInt *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const
{
int nbCells=getNumberOfCells();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
return ret.retn();
}
-DataArrayInt *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const
{
int nbCells=getNumberOfCells();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
return ret.retn();
}
+/*!
+ * This method computes effective number of nodes per cell. That is to say nodes appearing several times in nodal connectivity of a cell,
+ * will be counted only once here whereas it will be counted several times in MEDCouplingMesh::computeNbOfNodesPerCell method.
+ * Here for structured mesh it returns exactly as MEDCouplingStructuredMesh::computeNbOfNodesPerCell does.
+ *
+ * \return DataArrayInt * - new object to be deallocated by the caller.
+ */
+DataArrayInt *MEDCouplingStructuredMesh::computeEffectiveNbOfNodesPerCell() const
+{
+ return computeNbOfNodesPerCell();
+}
+
void MEDCouplingStructuredMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
{
int meshDim=getMeshDimension();
conn.push_back(tmp2[0]); conn.push_back(tmp2[0]+1);
break;
case 2:
- conn.push_back(tmp2[1]*tmpCell[1]+tmp2[0]); conn.push_back(tmp2[1]*tmpCell[1]+tmp2[0]+1);
- conn.push_back((tmp2[1]+1)*(tmpCell[1]+1)+tmp2[0]+1); conn.push_back((tmp2[1]+1)*(tmpCell[1]+1)+tmp2[0]);
+ conn.push_back(tmp2[1]*tmpNode[1]+tmp2[0]); conn.push_back(tmp2[1]*tmpNode[1]+tmp2[0]+1);
+ conn.push_back((tmp2[1]+1)*tmpNode[1]+tmp2[0]+1); conn.push_back((tmp2[1]+1)*tmpNode[1]+tmp2[0]);
break;
case 3:
- conn.push_back(tmp2[1]*tmpCell[1]+tmp2[0]+tmp2[2]*tmpNode[2]); conn.push_back(tmp2[1]*tmpCell[1]+tmp2[0]+1+tmp2[2]*tmpNode[2]);
+ conn.push_back(tmp2[1]*tmpNode[1]+tmp2[0]+tmp2[2]*tmpNode[2]); conn.push_back(tmp2[1]*tmpNode[1]+tmp2[0]+1+tmp2[2]*tmpNode[2]);
conn.push_back((tmp2[1]+1)*tmpNode[1]+tmp2[0]+1+tmp2[2]*tmpNode[2]); conn.push_back((tmp2[1]+1)*tmpNode[1]+tmp2[0]+tmp2[2]*tmpNode[2]);
- conn.push_back(tmp2[1]*tmpCell[1]+tmp2[0]+(tmp2[2]+1)*tmpNode[2]); conn.push_back(tmp2[1]*tmpCell[1]+tmp2[0]+1+(tmp2[2]+1)*tmpNode[2]);
+ conn.push_back(tmp2[1]*tmpNode[1]+tmp2[0]+(tmp2[2]+1)*tmpNode[2]); conn.push_back(tmp2[1]*tmpNode[1]+tmp2[0]+1+(tmp2[2]+1)*tmpNode[2]);
conn.push_back((tmp2[1]+1)*tmpNode[1]+tmp2[0]+1+(tmp2[2]+1)*tmpNode[2]); conn.push_back((tmp2[1]+1)*tmpNode[1]+tmp2[0]+(tmp2[2]+1)*tmpNode[2]);
break;
default:
/*!
* See MEDCouplingUMesh::getDistributionOfTypes for more information
*/
-std::vector<int> MEDCouplingStructuredMesh::getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
+std::vector<int> MEDCouplingStructuredMesh::getDistributionOfTypes() const
{
//only one type of cell
std::vector<int> ret(3);
*
* See MEDCouplingUMesh::checkTypeConsistencyAndContig for more information
*/
-DataArrayInt *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
{
int nbOfCells=getNumberOfCells();
if(code.size()!=3)
* - After \a code contains [NORM_...,nbCells,0], \a idsInPflPerType [[0,1]] and \a idsPerType is [[1,2]] <br>
*/
-void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType) const
{
- if(!profile)
- throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile is NULL !");
+ if(!profile || !profile->isAllocated())
+ throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile is NULL or not allocated !");
if(profile->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile should have exactly one component !");
int nbTuples=profile->getNumberOfTuples();
if(profile->isIdentity() && nbTuples==nbOfCells)
{
code[2]=-1;
- idsInPflPerType[0]=const_cast<DataArrayInt *>(profile); idsInPflPerType[0]->incrRef();
- idsPerType.clear();
+ idsInPflPerType[0]=0;
+ idsPerType.clear();
+ return ;
}
+ code[1]=profile->getNumberOfTuples();
code[2]=0;
profile->checkAllIdsInRange(0,nbOfCells);
idsPerType.resize(1);
- idsPerType[0]=const_cast<DataArrayInt *>(profile); idsPerType[0]->incrRef();
+ idsPerType[0]=profile->deepCpy();
idsInPflPerType[0]=DataArrayInt::Range(0,nbTuples,1);
}
* delete this array using decrRef() as it is no more needed.
* \throw If \a this->getMeshDimension() is not among [1,2,3].
*/
-MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTUnstructured() const throw(INTERP_KERNEL::Exception)
+MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTUnstructured() const
{
int meshDim=getMeshDimension();
if(meshDim<0 || meshDim>3)
* delete this array using decrRef() as it is no more needed.
* \throw If \a this->getMeshDimension() is not among [1,2,3].
*/
-MEDCouplingUMesh *MEDCouplingStructuredMesh::buildUnstructured() const throw(INTERP_KERNEL::Exception)
+MEDCouplingUMesh *MEDCouplingStructuredMesh::buildUnstructured() const
{
- return build1SGTUnstructured()->buildUnstructured();
+ MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret0(build1SGTUnstructured());
+ return ret0->buildUnstructured();
}
/*!
}
}
-DataArrayInt *MEDCouplingStructuredMesh::simplexize(int policy) throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingStructuredMesh::simplexize(int policy)
{
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::simplexize : not available for Cartesian mesh !");
}
/*!
* \return DataArrayInt * - newly allocated instance of nodal connectivity compatible for MEDCoupling1SGTMesh instance
*/
-DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity(const int *nodeStBg, const int *nodeStEnd) throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity(const int *nodeStBg, const int *nodeStEnd)
{
std::size_t dim=std::distance(nodeStBg,nodeStEnd);
switch(dim)
}
}
-DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const int *nodeStBg) throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const int *nodeStBg)
{
int nbOfCells(*nodeStBg-1);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New());
return conn.retn();
}
-DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity2D(const int *nodeStBg) throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity2D(const int *nodeStBg)
{
int n1=nodeStBg[0]-1;
int n2=nodeStBg[1]-1;
return conn.retn();
}
-DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity3D(const int *nodeStBg) throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity3D(const int *nodeStBg)
{
int n1=nodeStBg[0]-1;
int n2=nodeStBg[1]-1;
}
}
-std::vector<int> MEDCouplingStructuredMesh::getCellGridStructure() const throw(INTERP_KERNEL::Exception)
+std::vector<int> MEDCouplingStructuredMesh::getCellGridStructure() const
{
std::vector<int> ret(getNodeGridStructure());
std::transform(ret.begin(),ret.end(),ret.begin(),std::bind2nd(std::plus<int>(),-1));
*
* \sa MEDCouplingStructuredMesh::BuildExplicitIdsFrom
*/
-bool MEDCouplingStructuredMesh::IsPartStructured(const int *startIds, const int *stopIds, const std::vector<int>& st, std::vector< std::pair<int,int> >& partCompactFormat) throw(INTERP_KERNEL::Exception)
+bool MEDCouplingStructuredMesh::IsPartStructured(const int *startIds, const int *stopIds, const std::vector<int>& st, std::vector< std::pair<int,int> >& partCompactFormat)
{
int dim((int)st.size());
partCompactFormat.resize(dim);
return true;
}
GetPosFromId(startIds[sz-1],dim,&tmp2[0],&tmp3[0]);
+ int szExp(1);
for(int i=0;i<dim;i++)
{
if(tmp3[i]<0 || tmp3[i]>=st[i])
tmp4[i]=partCompactFormat[i].second-partCompactFormat[i].first;
if(tmp4[i]<=0)
return false;
+ szExp*=tmp4[i];
}
+ if(szExp!=(int)sz)
+ return false;
const int *w(startIds);
switch(dim)
{
* \return DataArrayInt * - a new object.
* \sa MEDCouplingStructuredMesh::IsPartStructured
*/
-DataArrayInt *MEDCouplingStructuredMesh::BuildExplicitIdsFrom(const std::vector<int>& st, const std::vector< std::pair<int,int> >& partCompactFormat) throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingStructuredMesh::BuildExplicitIdsFrom(const std::vector<int>& st, const std::vector< std::pair<int,int> >& partCompactFormat)
{
if(st.size()!=partCompactFormat.size())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::BuildExplicitIdsFrom : input arrays must have the same size !");