#include "InterpKernelMeshQuality.hxx"
#include "InterpKernelCellSimplify.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
#include "InterpKernelAutoPtr.hxx"
#include "InterpKernelGeo2DNode.hxx"
#include "InterpKernelGeo2DEdgeLin.hxx"
setConnectivity(otherC2->getNodalConnectivity(),otherC2->getNodalConnectivityIndex(),true);
}
-std::size_t MEDCouplingUMesh::getHeapMemorySize() const
+std::size_t MEDCouplingUMesh::getHeapMemorySizeWithoutChildren() const
{
- std::size_t ret=0;
+ std::size_t ret(MEDCouplingPointSet::getHeapMemorySizeWithoutChildren());
+ return ret;
+}
+
+std::vector<const BigMemoryObject *> MEDCouplingUMesh::getDirectChildren() const
+{
+ std::vector<const BigMemoryObject *> ret(MEDCouplingPointSet::getDirectChildren());
if(_nodal_connec)
- ret+=_nodal_connec->getHeapMemorySize();
+ ret.push_back(_nodal_connec);
if(_nodal_connec_index)
- ret+=_nodal_connec_index->getHeapMemorySize();
- return MEDCouplingPointSet::getHeapMemorySize()+ret;
+ ret.push_back(_nodal_connec_index);
+ return ret;
}
void MEDCouplingUMesh::updateTime() const
* faster.
* \param [in] pos - array of coordinates of the ball central point.
* \param [in] eps - ball radius.
- * \param [in,out] elts - vector returning ids of the found cells. It is cleared
+ * \param [out] elts - vector returning ids of the found cells. It is cleared
* before inserting ids.
* \throw If the coordinates array is not set.
* \throw If \a this->getMeshDimension() != \a this->getSpaceDimension().
*/
void MEDCouplingUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const
{
- std::vector<int> eltsIndex;
- getCellsContainingPoints(pos,1,eps,elts,eltsIndex);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> eltsUg,eltsIndexUg;
+ getCellsContainingPoints(pos,1,eps,eltsUg,eltsIndexUg);
+ elts.clear(); elts.insert(elts.end(),eltsUg->begin(),eltsUg->end());
}
/// @cond INTERNAL
template<int SPACEDIM>
void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints,
- double eps, std::vector<int>& elts, std::vector<int>& eltsIndex) const
+ double eps, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& elts, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& eltsIndex) const
{
- eltsIndex.resize(nbOfPoints+1);
- eltsIndex[0]=0;
- elts.clear();
+ elts=DataArrayInt::New(); eltsIndex=DataArrayInt::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1);
+ int *eltsIndexPtr(eltsIndex->getPointer());
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bboxArr(getBoundingBoxForBBTree());
const double *bbox(bboxArr->begin());
int nbOfCells=getNumberOfCells();
BBTree<SPACEDIM,int> myTree(&bbox[0],0,0,nbOfCells,-eps);
for(int i=0;i<nbOfPoints;i++)
{
- eltsIndex[i+1]=eltsIndex[i];
+ eltsIndexPtr[i+1]=eltsIndexPtr[i];
for(int j=0;j<SPACEDIM;j++)
{
bb[2*j]=pos[SPACEDIM*i+j];
(INTERP_KERNEL::NormalizedCellType)conn[connI[*iter]],
coords,conn+connI[*iter]+1,sz,eps))
{
- eltsIndex[i+1]++;
- elts.push_back(*iter);
+ eltsIndexPtr[i+1]++;
+ elts->pushBackSilent(*iter);
}
}
}
* this->getSpaceDimension() * \a nbOfPoints
* \param [in] nbOfPoints - number of points to locate within \a this mesh.
* \param [in] eps - radius of balls (i.e. the precision).
- * \param [in,out] elts - vector returning ids of found cells.
- * \param [in,out] eltsIndex - an array, of length \a nbOfPoints + 1,
+ * \param [out] elts - vector returning ids of found cells.
+ * \param [out] eltsIndex - an array, of length \a nbOfPoints + 1,
* dividing cell ids in \a elts into groups each referring to one
* point. Its every element (except the last one) is an index pointing to the
* first id of a group of cells. For example cells in contact with the *i*-th
* \ref py_mcumesh_getCellsContainingPoints "Here is a Python example".
*/
void MEDCouplingUMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps,
- std::vector<int>& elts, std::vector<int>& eltsIndex) const
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& elts, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& eltsIndex) const
{
int spaceDim=getSpaceDimension();
int mDim=getMeshDimension();
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::FillInCompact3DMode : Invalid spaceDim specified : must be 2 or 3 !");
}
-void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const throw(INTERP_KERNEL::Exception)
{
int nbOfCells=getNumberOfCells();
if(nbOfCells<=0)
ofs << " </CellData>\n";
ofs << " <Points>\n";
if(getSpaceDimension()==3)
- _coords->writeVTK(ofs,8,"Points");
+ _coords->writeVTK(ofs,8,"Points",byteData);
else
{
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo=_coords->changeNbOfComponents(3,0.);
- coo->writeVTK(ofs,8,"Points");
+ coo->writeVTK(ofs,8,"Points",byteData);
}
ofs << " </Points>\n";
ofs << " <Cells>\n";
}
}
types->transformWithIndArr(PARAMEDMEM2VTKTYPETRADUCER,PARAMEDMEM2VTKTYPETRADUCER+INTERP_KERNEL::NORM_MAXTYPE);
- types->writeVTK(ofs,8,"UInt8","types");
- offsets->writeVTK(ofs,8,"Int32","offsets");
+ types->writeVTK(ofs,8,"UInt8","types",byteData);
+ offsets->writeVTK(ofs,8,"Int32","offsets",byteData);
if(szFaceOffsets!=0)
{//presence of Polyhedra
connectivity->reAlloc(szConn);
- faceoffsets->writeVTK(ofs,8,"Int32","faceoffsets");
+ faceoffsets->writeVTK(ofs,8,"Int32","faceoffsets",byteData);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> faces=DataArrayInt::New(); faces->alloc(szFaceOffsets,1);
w1=faces->getPointer();
for(int i=0;i<nbOfCells;i++)
w6=w5+1;
}
}
- faces->writeVTK(ofs,8,"Int32","faces");
+ faces->writeVTK(ofs,8,"Int32","faces",byteData);
}
- connectivity->writeVTK(ofs,8,"Int32","connectivity");
+ connectivity->writeVTK(ofs,8,"Int32","connectivity",byteData);
ofs << " </Cells>\n";
ofs << " </Piece>\n";
ofs << " </" << getVTKDataSetType() << ">\n";
int *work=arrIo->getPointer();
*work++=0;
int lgth=0;
- for(std::size_t i=0;i<sz;i++,work++,idsIt+=idsOfSelectStep)
+ for(int i=0;i<sz;i++,work++,idsIt+=idsOfSelectStep)
{
if(idsIt>=0 && idsIt<nbOfGrps)
lgth+=arrIndxPtr[idsIt+1]-arrIndxPtr[idsIt];
arro->alloc(lgth,1);
work=arro->getPointer();
idsIt=idsOfSelectStart;
- for(std::size_t i=0;i<sz;i++,idsIt+=idsOfSelectStep)
+ for(int i=0;i<sz;i++,idsIt+=idsOfSelectStep)
{
if(arrIndxPtr[idsIt]>=0 && arrIndxPtr[idsIt+1]<=maxSizeOfArr)
work=std::copy(arrInPtr+arrIndxPtr[idsIt],arrInPtr+arrIndxPtr[idsIt+1],work);