VMTK
Loading...
Searching...
No Matches
vtkvmtkNeighborhood.cxx
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: VMTK
4 Module: $RCSfile: vtkvmtkNeighborhood.cxx,v $
5 Language: C++
6 Date: $Date: 2005/03/04 11:07:29 $
7 Version: $Revision: 1.2 $
8
9 Copyright (c) Luca Antiga, David Steinman. All rights reserved.
10 See LICENSE file for details.
11
12 Portions of this code are covered under the VTK copyright.
13 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm
14 for details.
15
16 This software is distributed WITHOUT ANY WARRANTY; without even
17 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18 PURPOSE. See the above copyright notices for more information.
19
20=========================================================================*/
21
22#include "vtkvmtkNeighborhood.h"
23#include "vtkObjectFactory.h"
24
25
26
28 {
29 this->NPoints = 0;
30 this->PointIds = NULL;
31 this->IsBoundary = false;
32 }
33
35 {
36 if (this->PointIds != NULL)
37 {
38 delete [] this->PointIds;
39 this->PointIds = NULL;
40 }
41 }
42
43void vtkvmtkNeighborhood::ResizePointList(vtkIdType ptId, int size)
44 {
45 int newSize;
46 vtkIdType *pointIds;
47
48 newSize = this->NPoints + size;
49 pointIds = new vtkIdType[newSize];
50 memcpy(pointIds, this->PointIds,this->NPoints*sizeof(vtkIdType));
51 delete [] this->PointIds;
52 this->PointIds = NULL;
53
54 this->PointIds = pointIds;
55
56 this->NPoints = newSize;
57 }
58
60 {
61 this->Superclass::DeepCopy(src);
62
64
65 if (neighborhoodSrc==NULL)
66 {
67 vtkErrorMacro(<<"Trying to deep copy a non-stencil item");
68 }
69
70 this->NPoints = neighborhoodSrc->NPoints;
71
72 if (this->PointIds != NULL)
73 {
74 delete [] this->PointIds;
75 this->PointIds = NULL;
76 }
77
78 if (neighborhoodSrc->NPoints>0)
79 {
80 this->PointIds = new vtkIdType[neighborhoodSrc->NPoints];
81 memcpy(this->PointIds, neighborhoodSrc->PointIds, this->NPoints * sizeof(vtkIdType));
82 }
83
84 this->IsBoundary = neighborhoodSrc->IsBoundary;
85 }
86
virtual void DeepCopy(vtkvmtkItem *src) override
static vtkvmtkNeighborhood * SafeDownCast(vtkObjectBase *o)
virtual void DeepCopy(vtkvmtkItem *src) override
void ResizePointList(vtkIdType ptId, int size)