Skip to content

Commit 0eb98b4

Browse files
authored
CUDA: Add reset methods for data holder classes (#4885)
1 parent 46280e3 commit 0eb98b4

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

source/MRCuda/MRCudaPolyline.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ Polyline2Data Polyline2DataHolder::data() const
2929
};
3030
}
3131

32+
void Polyline2DataHolder::reset()
33+
{
34+
nodes_.resize( 0 );
35+
points_.resize( 0 );
36+
orgs_.resize( 0 );
37+
}
38+
3239
size_t Polyline2DataHolder::heapBytes( const Polyline2& polyline )
3340
{
3441
return sizeof( Node2 ) * polyline.getAABBTree().nodes().size()
@@ -58,6 +65,13 @@ Polyline3Data Polyline3DataHolder::data() const
5865
};
5966
}
6067

68+
void Polyline3DataHolder::reset()
69+
{
70+
nodes_.resize( 0 );
71+
points_.resize( 0 );
72+
orgs_.resize( 0 );
73+
}
74+
6175
size_t Polyline3DataHolder::heapBytes( const Polyline3& polyline )
6276
{
6377
return sizeof( Node3 ) * polyline.getAABBTree().nodes().size()

source/MRCuda/MRCudaPolyline.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class Polyline2DataHolder
2424
MRCUDA_API Polyline2Data data() const;
2525
operator Polyline2Data () const { return data(); }
2626

27+
/// Resets data buffers.
28+
MRCUDA_API void reset();
29+
2730
/// Computes the GPU memory amount required to allocate data for the polyline.
2831
MRCUDA_API static size_t heapBytes( const Polyline2& polyline );
2932

@@ -45,6 +48,9 @@ class Polyline3DataHolder
4548
MRCUDA_API Polyline3Data data() const;
4649
operator Polyline3Data () const { return data(); }
4750

51+
/// Resets data buffers.
52+
MRCUDA_API void reset();
53+
4854
/// Computes the GPU memory amount required to allocate data for the polyline.
4955
MRCUDA_API static size_t heapBytes( const Polyline3& polyline );
5056

0 commit comments

Comments
 (0)