Salome HOME
Some factorization before integration of ParaMEDMEM into medcoupling python module
[tools/medcoupling.git] / src / MEDCoupling / MEDCoupling1GTUMesh.cxx
index 83871ddad78461f8b39a421d4d53e3adbb12bbba..b4862d76e2af37e09a01ef099afcc5377d0b8f9a 100644 (file)
@@ -121,7 +121,7 @@ std::size_t MEDCoupling1GTUMesh::getNumberOfCellsWithType(INTERP_KERNEL::Normali
  */
 INTERP_KERNEL::NormalizedCellType MEDCoupling1GTUMesh::getTypeOfCell(std::size_t cellId) const
 {
-  if(cellId>=0 && cellId<getNumberOfCells())
+  if(cellId<getNumberOfCells())
     return getCellModelEnum();
   std::ostringstream oss; oss << "MEDCoupling1GTUMesh::getTypeOfCell : Requesting type of cell #" << cellId << " but it should be in [0," << getNumberOfCells() << ") !";
   throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -145,7 +145,7 @@ std::set<INTERP_KERNEL::NormalizedCellType> MEDCoupling1GTUMesh::getAllGeoTypes(
  * \a this is composed in cell types.
  * The returned array is of size 3*n where n is the number of different types present in \a this. 
  * For every k in [0,n] ret[3*k+2]==-1 because it has no sense here. 
- * This parameter is kept only for compatibility with other methode listed above.
+ * This parameter is kept only for compatibility with other method listed above.
  */
 std::vector<int> MEDCoupling1GTUMesh::getDistributionOfTypes() const
 {
@@ -758,11 +758,11 @@ DataArrayInt *MEDCoupling1SGTUMesh::computeEffectiveNbOfNodesPerCell() const
   return ret.retn();
 }
 
-void MEDCoupling1SGTUMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
+void MEDCoupling1SGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const
 {
   int sz=getNumberOfNodesPerCell();
   conn.resize(sz);
-  if(cellId>=0 && cellId<getNumberOfCells())
+  if(cellId<getNumberOfCells())
     std::copy(_conn->begin()+cellId*sz,_conn->begin()+(cellId+1)*sz,conn.begin());
   else
     {
@@ -1635,7 +1635,7 @@ void MEDCoupling1SGTUMesh::setNodalConnectivity(DataArrayInt *nodalConn)
 }
 
 /*!
- * \return DataArrayInt * - the internal reference to the nodal connectivity. The caller is not reponsible to deallocate it.
+ * \return DataArrayInt * - the internal reference to the nodal connectivity. The caller is not responsible to deallocate it.
  */
 DataArrayInt *MEDCoupling1SGTUMesh::getNodalConnectivity() const
 {
@@ -1646,7 +1646,7 @@ DataArrayInt *MEDCoupling1SGTUMesh::getNodalConnectivity() const
 /*!
  * Allocates memory to store an estimation of the given number of cells. Closer is the estimation to the number of cells effectively inserted,
  * less will be the needs to realloc. If the number of cells to be inserted is not known simply put 0 to this parameter.
- * If a nodal connectivity previouly existed before the call of this method, it will be reset.
+ * If a nodal connectivity previously existed before the call of this method, it will be reset.
  *
  *  \param [in] nbOfCells - estimation of the number of cell \a this mesh will contain.
  */
@@ -1666,7 +1666,7 @@ void MEDCoupling1SGTUMesh::allocateCells(int nbOfCells)
  * \param [in] nodalConnOfCellEnd - the end (excluded) of nodal connectivity of the cell to add.
  * \throw If the length of the input nodal connectivity array of the cell to add is not equal to number of nodes per cell relative to the unique geometric type
  *        attached to \a this.
- * \thow If the nodal connectivity array in \a this is null (call MEDCoupling1SGTUMesh::allocateCells before).
+ * \throw If the nodal connectivity array in \a this is null (call MEDCoupling1SGTUMesh::allocateCells before).
  */
 void MEDCoupling1SGTUMesh::insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd)
 {
@@ -2536,10 +2536,10 @@ DataArrayInt *MEDCoupling1DGTUMesh::computeEffectiveNbOfNodesPerCell() const
   return ret.retn();
 }
 
-void MEDCoupling1DGTUMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
+void MEDCoupling1DGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const
 {
-  int nbOfCells(getNumberOfCells());//performs checks
-  if(cellId>=0 && cellId<nbOfCells)
+  std::size_t nbOfCells(getNumberOfCells());//performs checks
+  if(cellId<nbOfCells)
     {
       int strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0);
       int nbOfNodes=stp-strt;
@@ -3302,16 +3302,16 @@ void MEDCoupling1DGTUMesh::allocateCells(int nbOfCells)
  * \param [in] nodalConnOfCellEnd - the end (excluded) of nodal connectivity of the cell to add.
  * \throw If the length of the input nodal connectivity array of the cell to add is not equal to number of nodes per cell relative to the unique geometric type
  *        attached to \a this.
- * \thow If the nodal connectivity array in \a this is null (call MEDCoupling1SGTUMesh::allocateCells before).
+ * \throw If the nodal connectivity array in \a this is null (call MEDCoupling1SGTUMesh::allocateCells before).
  */
 void MEDCoupling1DGTUMesh::insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd)
 {
-  int sz=(int)std::distance(nodalConnOfCellBg,nodalConnOfCellEnd);
+  std::size_t sz(std::distance(nodalConnOfCellBg,nodalConnOfCellEnd));
   DataArrayInt *c(_conn),*c2(_conn_indx);
   if(c && c2)
     {
       int pos=c2->back();
-      if(pos==c->getNumberOfTuples())
+      if(pos==(int)c->getNumberOfTuples())
         {
           c->pushBackValsSilent(nodalConnOfCellBg,nodalConnOfCellEnd);
           c2->pushBackSilent(pos+sz);
@@ -3338,7 +3338,7 @@ void MEDCoupling1DGTUMesh::setNodalConnectivity(DataArrayInt *nodalConn, DataArr
 }
 
 /*!
- * \return DataArrayInt * - the internal reference to the nodal connectivity. The caller is not reponsible to deallocate it.
+ * \return DataArrayInt * - the internal reference to the nodal connectivity. The caller is not responsible to deallocate it.
  */
 DataArrayInt *MEDCoupling1DGTUMesh::getNodalConnectivity() const
 {
@@ -3347,7 +3347,7 @@ DataArrayInt *MEDCoupling1DGTUMesh::getNodalConnectivity() const
 }
 
 /*!
- * \return DataArrayInt * - the internal reference to the nodal connectivity index. The caller is not reponsible to deallocate it.
+ * \return DataArrayInt * - the internal reference to the nodal connectivity index. The caller is not responsible to deallocate it.
  */
 DataArrayInt *MEDCoupling1DGTUMesh::getNodalConnectivityIndex() const
 {
@@ -3428,7 +3428,7 @@ bool MEDCoupling1DGTUMesh::retrievePackedNodalConnectivity(DataArrayInt *&nodalC
 bool MEDCoupling1DGTUMesh::isPacked() const
 {
   checkConsistencyLight();
-  return _conn_indx->front()==0 && _conn_indx->back()==_conn->getNumberOfTuples();
+  return _conn_indx->front()==0 && _conn_indx->back()==(int)_conn->getNumberOfTuples();
 }
 
 MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshes(const MEDCoupling1DGTUMesh *mesh1, const MEDCoupling1DGTUMesh *mesh2)