X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMDS%2FSMDS_UnstructuredGrid.cxx;h=52916ec724c12d491ed92982b26e50e30fae467b;hp=0d9b1e6c3c458775feb84294a542778c70e26bf4;hb=5482b99d07dd144fd5be299e722f39a81de3b5be;hpb=bd4e115a78b52e3fbc016e5e30bb0e19b2a9e7d6 diff --git a/src/SMDS/SMDS_UnstructuredGrid.cxx b/src/SMDS/SMDS_UnstructuredGrid.cxx index 0d9b1e6c3..52916ec72 100644 --- a/src/SMDS/SMDS_UnstructuredGrid.cxx +++ b/src/SMDS/SMDS_UnstructuredGrid.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2010-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2010-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // 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. +// 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 @@ -17,7 +17,6 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#define CHRONODEF #include "SMDS_UnstructuredGrid.hxx" #include "SMDS_Mesh.hxx" #include "SMDS_MeshInfo.hxx" @@ -25,6 +24,7 @@ #include "SMDS_MeshVolume.hxx" #include "utilities.h" +#include "chrono.hxx" #include #include @@ -44,14 +44,14 @@ SMDS_CellLinks* SMDS_CellLinks::New() return new SMDS_CellLinks(); } -vtkCellLinks::Link* SMDS_CellLinks::ResizeL(vtkIdType sz) +void SMDS_CellLinks::ResizeForPoint(vtkIdType vtkID) { - return vtkCellLinks::Resize(sz); -} - -vtkIdType SMDS_CellLinks::GetLinksSize() -{ - return this->Size; + if ( vtkID > this->MaxId ) + { + this->MaxId = vtkID; + if ( vtkID >= this->Size ) + vtkCellLinks::Resize( vtkID+SMDS_Mesh::chunkSize ); + } } SMDS_CellLinks::SMDS_CellLinks() : @@ -88,7 +88,8 @@ unsigned long SMDS_UnstructuredGrid::GetMTime() MESSAGE("vtkUnstructuredGrid::GetMTime: " << mtime); return mtime; } - +// OUV_PORTING_VTK6: seems to be useless +/* void SMDS_UnstructuredGrid::Update() { MESSAGE("SMDS_UnstructuredGrid::Update"); @@ -100,7 +101,7 @@ void SMDS_UnstructuredGrid::UpdateInformation() MESSAGE("SMDS_UnstructuredGrid::UpdateInformation"); return vtkUnstructuredGrid::UpdateInformation(); } - +*/ vtkPoints* SMDS_UnstructuredGrid::GetPoints() { // TODO erreur incomprehensible de la macro vtk GetPoints apparue avec la version paraview de fin aout 2010 @@ -154,7 +155,7 @@ void SMDS_UnstructuredGrid::setSMDS_mesh(SMDS_Mesh *mesh) void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int newNodeSize, std::vector& idCellsOldToNew, int newCellSize) { - MESSAGE("------------------------- SMDS_UnstructuredGrid::compactGrid " << newNodeSize << " " << newCellSize);CHRONO(1); + MESSAGE("------------------------- SMDS_UnstructuredGrid::compactGrid " << newNodeSize << " " << newCellSize);//CHRONO(1); int alreadyCopied = 0; // --- if newNodeSize, create a new compacted vtkPoints @@ -285,8 +286,6 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n } newFaceLocations->Squeeze(); newFaces->Squeeze(); - newFaceLocations->Register(this); - newFaces->Register(this); this->SetCells(newTypes, newLocations, newConnectivity, newFaceLocations, newFaces); newFaceLocations->Delete(); newFaces->Delete(); @@ -328,7 +327,7 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *newTypes, int start, int end) { - MESSAGE("copyBloc " << alreadyCopied << " " << start << " " << end << " size: " << end - start << " total: " << alreadyCopied + end - start); + //MESSAGE("copyBloc " << alreadyCopied << " " << start << " " << end << " size: " << end - start << " total: " << alreadyCopied + end - start); for (int j = start; j < end; j++) { newTypes->SetValue(alreadyCopied, this->Types->GetValue(j)); @@ -355,12 +354,12 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *newTypes, int SMDS_UnstructuredGrid::CellIdToDownId(int vtkCellId) { - if((vtkCellId < 0) || (vtkCellId >= _cellIdToDownId.size())) - { - //MESSAGE("SMDS_UnstructuredGrid::CellIdToDownId structure not up to date: vtkCellId=" - // << vtkCellId << " max="<< _cellIdToDownId.size()); - return -1; - } + if ((vtkCellId < 0) || (vtkCellId >= (int)_cellIdToDownId.size())) + { + //MESSAGE("SMDS_UnstructuredGrid::CellIdToDownId structure not up to date: vtkCellId=" + // << vtkCellId << " max="<< _cellIdToDownId.size()); + return -1; + } return _cellIdToDownId[vtkCellId]; } @@ -372,12 +371,12 @@ void SMDS_UnstructuredGrid::setCellIdToDownId(int vtkCellId, int downId) void SMDS_UnstructuredGrid::CleanDownwardConnectivity() { - for (int i = 0; i < _downArray.size(); i++) - { - if (_downArray[i]) - delete _downArray[i]; - _downArray[i] = 0; - } + for (size_t i = 0; i < _downArray.size(); i++) + { + if (_downArray[i]) + delete _downArray[i]; + _downArray[i] = 0; + } _cellIdToDownId.clear(); } @@ -402,6 +401,7 @@ void SMDS_UnstructuredGrid::BuildDownwardConnectivity(bool withEdges) _downArray[VTK_QUADRATIC_EDGE] = new SMDS_DownQuadEdge(this); _downArray[VTK_TRIANGLE] = new SMDS_DownTriangle(this); _downArray[VTK_QUADRATIC_TRIANGLE] = new SMDS_DownQuadTriangle(this); + _downArray[VTK_BIQUADRATIC_TRIANGLE] = new SMDS_DownQuadTriangle(this); _downArray[VTK_QUAD] = new SMDS_DownQuadrangle(this); _downArray[VTK_QUADRATIC_QUAD] = new SMDS_DownQuadQuadrangle(this); _downArray[VTK_BIQUADRATIC_QUAD] = new SMDS_DownQuadQuadrangle(this); @@ -442,6 +442,7 @@ void SMDS_UnstructuredGrid::BuildDownwardConnectivity(bool withEdges) GuessSize[VTK_QUADRATIC_EDGE] = nbQuadEdgeGuess; GuessSize[VTK_TRIANGLE] = nbLinTriaGuess; GuessSize[VTK_QUADRATIC_TRIANGLE] = nbQuadTriaGuess; + GuessSize[VTK_BIQUADRATIC_TRIANGLE] = nbQuadTriaGuess; GuessSize[VTK_QUAD] = nbLinQuadGuess; GuessSize[VTK_QUADRATIC_QUAD] = nbQuadQuadGuess; GuessSize[VTK_BIQUADRATIC_QUAD] = nbQuadQuadGuess; @@ -460,6 +461,7 @@ void SMDS_UnstructuredGrid::BuildDownwardConnectivity(bool withEdges) _downArray[VTK_QUADRATIC_EDGE] ->allocate(nbQuadEdgeGuess); _downArray[VTK_TRIANGLE] ->allocate(nbLinTriaGuess); _downArray[VTK_QUADRATIC_TRIANGLE] ->allocate(nbQuadTriaGuess); + _downArray[VTK_BIQUADRATIC_TRIANGLE] ->allocate(nbQuadTriaGuess); _downArray[VTK_QUAD] ->allocate(nbLinQuadGuess); _downArray[VTK_QUADRATIC_QUAD] ->allocate(nbQuadQuadGuess); _downArray[VTK_BIQUADRATIC_QUAD] ->allocate(nbQuadQuadGuess); @@ -763,7 +765,7 @@ void SMDS_UnstructuredGrid::BuildDownwardConnectivity(bool withEdges) * @param vtkId the vtk id of the cell * @return number of neighbors */ -int SMDS_UnstructuredGrid::GetNeighbors(int* neighborsVtkIds, int* downIds, unsigned char* downTypes, int vtkId) +int SMDS_UnstructuredGrid::GetNeighbors(int* neighborsVtkIds, int* downIds, unsigned char* downTypes, int vtkId, bool getSkin) { int vtkType = this->GetCellType(vtkId); int cellDim = SMDS_Downward::getCellDimension(vtkType); @@ -798,9 +800,27 @@ int SMDS_UnstructuredGrid::GetNeighbors(int* neighborsVtkIds, int* downIds, unsi downIds[nb] = downId; downTypes[nb] = cellType; nb++; + if (nb >= NBMAXNEIGHBORS) + { + INFOS("SMDS_UnstructuredGrid::GetNeighbors problem: NBMAXNEIGHBORS=" <getVtkCellId(downId); // OK if skin present + downIds[nb] = downId; + downTypes[nb] = cellType; + nb++; + if (nb >= NBMAXNEIGHBORS) + { + INFOS("SMDS_UnstructuredGrid::GetNeighbors problem: NBMAXNEIGHBORS=" <= NBMAXNEIGHBORS) - assert(0); } return nb; } @@ -1062,8 +1082,11 @@ SMDS_MeshCell* SMDS_UnstructuredGrid::extrudeVolumeFromFace(int vtkVolId, double *coords = this->GetPoint(oldId); SMDS_MeshNode *newNode = _mesh->AddNode(coords[0], coords[1], coords[2]); newId = newNode->getVtkId(); - std::map emptyMap; - nodeQuadDomains[oldId] = emptyMap; + if (! nodeQuadDomains.count(oldId)) + { + std::map emptyMap; + nodeQuadDomains[oldId] = emptyMap; + } nodeQuadDomains[oldId][dom1_2] = newId; } orderedNodes.push_back(newId);