X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMDS%2FSMDS_BallElement.cxx;h=e4629bbb1c5abf402492463a5263361572537d5a;hp=52569229b0b913e2865e1d9f1c6b9c3579b61a42;hb=499f29d24922cec66e41b41a0039a954993bc6df;hpb=bd8f1aee7c78f7d2eb82bd4fec5e08c9e3d280ce diff --git a/src/SMDS/SMDS_BallElement.cxx b/src/SMDS/SMDS_BallElement.cxx index 52569229b..e4629bbb1 100644 --- a/src/SMDS/SMDS_BallElement.cxx +++ b/src/SMDS/SMDS_BallElement.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2010-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2010-2022 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,86 +17,31 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// SMESH SMDS : implementaion of Salome mesh data structure +// SMESH SMDS : implementation of Salome mesh data structure // Module : SMESH // File : SMDS_BallElement.cxx // Author : Edward AGAPOV (eap) #include "SMDS_BallElement.hxx" -#include "SMDS_ElemIterator.hxx" #include "SMDS_Mesh.hxx" #include "SMDS_MeshNode.hxx" -#include "SMDS_VtkCellIterator.hxx" -SMDS_BallElement::SMDS_BallElement() +void SMDS_BallElement::init(const SMDS_MeshNode * node, double diameter ) { - SMDS_MeshCell::init(); -} - -SMDS_BallElement::SMDS_BallElement (const SMDS_MeshNode * node, double diameter) -{ - init( node->getVtkId(), diameter, SMDS_Mesh::_meshList[ node->getMeshId() ] ); -} - -SMDS_BallElement::SMDS_BallElement(vtkIdType nodeId, double diameter, SMDS_Mesh* mesh) -{ - init( nodeId, diameter, mesh ); -} - -void SMDS_BallElement::init(vtkIdType nodeId, double diameter, SMDS_Mesh* mesh) -{ - SMDS_MeshCell::init(); - SMDS_UnstructuredGrid* grid = mesh->getGrid(); - myVtkID = grid->InsertNextLinkedCell( GetVtkType(), 1, &nodeId ); - myMeshId = mesh->getMeshId(); - grid->SetBallDiameter( myVtkID, diameter ); - mesh->setMyModified(); + vtkIdType nodeVtkID = node->GetVtkID(); + vtkIdType vtkID = getGrid()->InsertNextLinkedCell( toVtkType( SMDSEntity_Ball ), 1, &nodeVtkID ); + setVtkID( vtkID ); + getGrid()->SetBallDiameter( GetVtkID(), diameter ); } double SMDS_BallElement::GetDiameter() const { - return SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetBallDiameter( myVtkID ); + return getGrid()->GetBallDiameter( GetVtkID() ); } void SMDS_BallElement::SetDiameter(double diameter) { - SMDS_Mesh::_meshList[myMeshId]->getGrid()->SetBallDiameter( myVtkID, diameter ); -} - -bool SMDS_BallElement::ChangeNode (const SMDS_MeshNode * node) -{ - vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); - vtkIdType npts = 0; - vtkIdType* pts = 0; - grid->GetCellPoints(myVtkID, npts, pts); - pts[0] = node->getVtkId(); - SMDS_Mesh::_meshList[myMeshId]->setMyModified(); - return true; -} - -void SMDS_BallElement::Print (std::ostream & OS) const -{ - OS << "ball<" << GetID() << "> : "; + getGrid()->SetBallDiameter( GetVtkID(), diameter ); + GetMesh()->setMyModified(); } - -const SMDS_MeshNode* SMDS_BallElement::GetNode (const int ind) const -{ - vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); - vtkIdType npts, *pts; - grid->GetCellPoints( myVtkID, npts, pts ); - return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ 0 ]); -} - -SMDS_ElemIteratorPtr SMDS_BallElement::elementsIterator (SMDSAbs_ElementType type) const -{ - switch (type) - { - case SMDSAbs_Node: - return SMDS_ElemIteratorPtr(new SMDS_VtkCellIterator(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType())); - default: - ; - return SMDS_ElemIteratorPtr((SMDS_ElemIterator*) NULL); - } -} -