// Copyright (C) 2007-2013 CEA/DEN, EDF R&D // // 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. // // 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 __MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_TXX__ #define __MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_TXX__ #include "MEDCouplingNormalizedUnstructuredMesh.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingMemArray.hxx" #include template MEDCouplingNormalizedUnstructuredMesh::MEDCouplingNormalizedUnstructuredMesh(const ParaMEDMEM::MEDCouplingUMesh *mesh):_mesh(mesh) { if(_mesh) _mesh->incrRef(); prepare(); } template void MEDCouplingNormalizedUnstructuredMesh::getBoundingBox(double *boundingBox) const { for(int i=0;i::max(); boundingBox[SPACEDIM+i]=-std::numeric_limits::max(); } const ParaMEDMEM::DataArrayDouble *array=_mesh->getCoords(); const double *ptr=array->getConstPointer(); int nbOfPts=array->getNbOfElems()/SPACEDIM; for(int j=0;j*work) boundingBox[j]=*work; if(boundingBox[j+SPACEDIM]<*work) boundingBox[j+SPACEDIM]=*work; } } } template INTERP_KERNEL::NormalizedCellType MEDCouplingNormalizedUnstructuredMesh::getTypeOfElement(int eltId) const { return _mesh->getTypeOfCell(eltId); } template unsigned char MEDCouplingNormalizedUnstructuredMesh::getNumberOfNodesOfElement(int eltId) const { return _mesh->getNumberOfNodesInCell(eltId); } template unsigned long MEDCouplingNormalizedUnstructuredMesh::getNumberOfElements() const { return _mesh->getNumberOfCells(); } template unsigned long MEDCouplingNormalizedUnstructuredMesh::getNumberOfNodes() const { return _mesh->getNumberOfNodes(); } template const int *MEDCouplingNormalizedUnstructuredMesh::getConnectivityPtr() const { return _conn_for_interp; } template const double *MEDCouplingNormalizedUnstructuredMesh::getCoordinatesPtr() const { const ParaMEDMEM::DataArrayDouble *array=_mesh->getCoords(); return array->getConstPointer(); } template const int *MEDCouplingNormalizedUnstructuredMesh::getConnectivityIndexPtr() const { return _conn_index_for_interp; } template void MEDCouplingNormalizedUnstructuredMesh::releaseTempArrays() { delete [] _conn_for_interp; delete [] _conn_index_for_interp; _conn_for_interp=0; _conn_index_for_interp=0; } template MEDCouplingNormalizedUnstructuredMesh::~MEDCouplingNormalizedUnstructuredMesh() { if(_mesh) _mesh->decrRef(); releaseTempArrays(); } template void MEDCouplingNormalizedUnstructuredMesh::prepare() { int nbOfCell=_mesh->getNumberOfCells(); int initialConnSize=_mesh->getNodalConnectivity()->getNbOfElems(); _conn_for_interp=new int[initialConnSize-nbOfCell]; _conn_index_for_interp=new int[nbOfCell+1]; _conn_index_for_interp[0]=0; const int *work_conn=_mesh->getNodalConnectivity()->getConstPointer()+1; const int *work_conn_index=_mesh->getNodalConnectivityIndex()->getConstPointer(); int *work_conn_for_interp=_conn_for_interp; int *work_conn_index_for_interp=_conn_index_for_interp; for(int i=0;i