From c28037d93b4722ba601ab4c91a198a8e7d53217e Mon Sep 17 00:00:00 2001 From: SONOLET Aymeric Date: Thu, 12 Sep 2024 21:26:39 +0200 Subject: [PATCH] Revert "clean: unused hxx and txx VTK files" This reverts commit 41f71ed94dbf55c45ff2d37212cf59de883775fa. --- .../VTKNormalizedUnstructuredMesh.hxx | 55 ++++++++ .../VTKNormalizedUnstructuredMesh.txx | 132 ++++++++++++++++++ 2 files changed, 187 insertions(+) create mode 100644 src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.hxx create mode 100644 src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.txx diff --git a/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.hxx b/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.hxx new file mode 100644 index 000000000..1bf5b78f6 --- /dev/null +++ b/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.hxx @@ -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 +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 index 000000000..571680a2b --- /dev/null +++ b/src/INTERP_KERNEL/VTKNormalizedUnstructuredMesh.txx @@ -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 +VTKNormalizedUnstructuredMesh::VTKNormalizedUnstructuredMesh(vtkUnstructuredGrid *mesh):_mesh_in_vtk_mode(mesh), + _tmp_index_array(0) +{ +} + +template +VTKNormalizedUnstructuredMesh::~VTKNormalizedUnstructuredMesh() +{ + _mesh_in_vtk_mode->Delete(); + releaseTempArrays(); +} + +template +void VTKNormalizedUnstructuredMesh::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 +NormalizedCellType VTKNormalizedUnstructuredMesh::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 +unsigned long VTKNormalizedUnstructuredMesh::getNumberOfElements() const +{ + return _mesh_in_vtk_mode->GetNumberOfCells(); +} + +template +unsigned long VTKNormalizedUnstructuredMesh::getNumberOfNodes() const +{ + return _mesh_in_vtk_mode->GetNumberOfPoints(); +} + +template +const vtkIdType *VTKNormalizedUnstructuredMesh::getConnectivityPtr() const +{ + vtkIdType *ret=_mesh_in_vtk_mode->GetCells()->GetPointer(); + if(_tmp_index_array) + return ret; + else + { + putinMEDFormat(); + return ret; + } +} + +template +const double *VTKNormalizedUnstructuredMesh::getCoordinatesPtr() const +{ + return (const double *)_mesh_in_vtk_mode->GetPoints()->GetVoidPointer(0); +} + +template +const vtkIdType *VTKNormalizedUnstructuredMesh::getConnectivityIndexPtr() const +{ + if(_tmp_index_array) + return _tmp_index_array; + else + { + putinMEDFormat(); + return _tmp_index_array; + } +} + +template +void VTKNormalizedUnstructuredMesh::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 +void VTKNormalizedUnstructuredMesh::releaseTempArrays() +{ + delete [] _tmp_index_array; + _tmp_index_array=0; +} + +#endif -- 2.39.2