]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Revert "clean: unused hxx and txx VTK files"
authorSONOLET Aymeric <aymeric.sonolet@cea.fr>
Thu, 12 Sep 2024 19:26:39 +0000 (21:26 +0200)
committerSONOLET Aymeric <aymeric.sonolet@cea.fr>
Thu, 12 Sep 2024 19:26:39 +0000 (21:26 +0200)
This reverts commit 41f71ed94dbf55c45ff2d37212cf59de883775fa.

src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.hxx [new file with mode: 0644]
src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.txx [new file with mode: 0644]

diff --git a/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.hxx b/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.hxx
new file mode 100644 (file)
index 0000000..1bf5b78
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright (C) 2007-2024  CEA, EDF
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (CEA/DEN)
+
+#ifndef __VTKNORMALIZEDUNSTRUCTUREDMESH_HXX__
+#define __VTKNORMALIZEDUNSTRUCTUREDMESH_HXX__
+
+
+#include "vtkType.h"
+
+class vtkUnstructuredGrid;
+
+template<int MESHDIM>
+class INTERPKERNEL_EXPORT VTKNormalizedUnstructuredMesh
+{
+public:
+  static const int MY_SPACEDIM=3;
+  static const int MY_MESHDIM=MESHDIM;
+  typedef vtkIdType MyConnType;
+  static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
+public:
+  VTKNormalizedUnstructuredMesh(vtkUnstructuredGrid *mesh);
+  ~VTKNormalizedUnstructuredMesh();
+  void getBoundingBox(double *boundingBox) const;
+  NormalizedCellType getTypeOfElement(vtkIdType eltId) const;
+  unsigned long getNumberOfElements() const;
+  unsigned long getNumberOfNodes() const;
+  const vtkIdType *getConnectivityPtr() const;
+  const double *getCoordinatesPtr() const;
+  const vtkIdType *getConnectivityIndexPtr() const;
+  void releaseTempArrays();
+protected:
+  void putinMEDFormat() const;
+protected:
+  vtkUnstructuredGrid *_mesh_in_vtk_mode;
+  mutable vtkIdType *_tmp_index_array;
+};
+
+#endif
diff --git a/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.txx b/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.txx
new file mode 100644 (file)
index 0000000..571680a
--- /dev/null
@@ -0,0 +1,132 @@
+// Copyright (C) 2007-2024  CEA, EDF
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (CEA/DEN)
+#ifndef __VTKNORMALIZEDUNSTRUCTUREDMESH_TXX__
+#define __VTKNORMALIZEDUNSTRUCTUREDMESH_TXX__
+
+
+#include "vtkUnstructuredGrid.h"
+#include "vtkCellArray.h"
+#include "vtkPoints.h"
+
+template<int MESHDIM>
+VTKNormalizedUnstructuredMesh<MESHDIM>::VTKNormalizedUnstructuredMesh(vtkUnstructuredGrid *mesh):_mesh_in_vtk_mode(mesh),
+                                                                                                 _tmp_index_array(0)
+{
+}
+
+template<int MESHDIM>
+VTKNormalizedUnstructuredMesh<MESHDIM>::~VTKNormalizedUnstructuredMesh()
+{
+  _mesh_in_vtk_mode->Delete();
+  releaseTempArrays();
+}
+
+template<int MESHDIM>
+void VTKNormalizedUnstructuredMesh<MESHDIM>::getBoundingBox(double *boundingBox) const
+{
+  double tmp[6];
+  _mesh_in_vtk_mode->GetBounds(tmp);
+  for(unsigned i=0;i<3;i++)
+    {
+      boundingBox[i]=tmp[2*i];
+      boundingBox[3+i]=tmp[2*i+1];
+    }
+}
+
+template<int MESHDIM>
+NormalizedCellType VTKNormalizedUnstructuredMesh<MESHDIM>::getTypeOfElement(vtkIdType eltId) const
+{
+  int cellType=_mesh_in_vtk_mode->GetCellType(eltId);
+  int convTab[30]={0,0,0,0,0,(int)NORM_TRI3,0,(int)NORM_POLYGON,0,(int)NORM_QUAD4,(int)NORM_TETRA4,0,(int)NORM_HEXA8
+                   0,(int)NORM_PYRA5,0,0,0,(int)NORM_TRI6,(int)NORM_QUAD8,};
+}
+
+template<int MESHDIM>
+unsigned long VTKNormalizedUnstructuredMesh<MESHDIM>::getNumberOfElements() const
+{
+  return _mesh_in_vtk_mode->GetNumberOfCells();
+}
+
+template<int MESHDIM>
+unsigned long VTKNormalizedUnstructuredMesh<MESHDIM>::getNumberOfNodes() const
+{
+  return _mesh_in_vtk_mode->GetNumberOfPoints();
+}
+
+template<int MESHDIM>
+const vtkIdType *VTKNormalizedUnstructuredMesh<MESHDIM>::getConnectivityPtr() const
+{
+  vtkIdType *ret=_mesh_in_vtk_mode->GetCells()->GetPointer();
+  if(_tmp_index_array)
+    return ret;
+  else
+    {
+      putinMEDFormat();
+      return ret;
+    }
+}
+
+template<int MESHDIM>
+const double *VTKNormalizedUnstructuredMesh<MESHDIM>::getCoordinatesPtr() const
+{
+  return (const double *)_mesh_in_vtk_mode->GetPoints()->GetVoidPointer(0);
+}
+
+template<int MESHDIM>
+const vtkIdType *VTKNormalizedUnstructuredMesh<MESHDIM>::getConnectivityIndexPtr() const
+{
+  if(_tmp_index_array)
+    return _tmp_index_array;
+  else
+    {
+      putinMEDFormat();
+      return _tmp_index_array;
+    }
+}
+
+template<int MESHDIM>
+void VTKNormalizedUnstructuredMesh<MESHDIM>::putinMEDFormat() const
+{
+  long nbOfElem=getNumberOfElements();
+  _tmp_index_array=new vtkIdType[nbOfElem+1];
+  _tmp_index_array[0]=0;
+  vtkIdType *coarseConn=_mesh_in_vtk_mode->GetCells()->GetPointer();
+  long ptInCC=0;
+  vtkIdType *finalConn=coarseConn;
+  for(long i=0;i<nbOfElem;i++)
+    {
+      vtkIdType cellLgth=coarseConn[ptInCC];
+      for(vtkIdType j=0;j<cellLgth;j++)
+        *finalConn++=coarseConn[ptInCC+j+1];
+      _tmp_index_array[i+1]=_tmp_index_array[i]+cellLgth;
+      ptInCC+=cellLgth+1;
+    }
+  int gh=0;
+  gh++;
+}
+
+template<int MESHDIM>
+void VTKNormalizedUnstructuredMesh<MESHDIM>::releaseTempArrays()
+{
+  delete [] _tmp_index_array;
+  _tmp_index_array=0;
+}
+
+#endif