Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mathieu Westphal (Kitware)
VTK
Commits
3206aa37
Commit
3206aa37
authored
12 years ago
by
Marcus D. Hanwell
Committed by
Code Review
12 years ago
Browse files
Options
Downloads
Plain Diff
Merge topic 'delete-duplicate-tests' into master
958fe0cf
Deleting duplicate test.
parents
ef41e283
958fe0cf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Graphics/Testing/Cxx/TestSortDataArray.cxx
+0
-160
0 additions, 160 deletions
Graphics/Testing/Cxx/TestSortDataArray.cxx
with
0 additions
and
160 deletions
Graphics/Testing/Cxx/TestSortDataArray.cxx
deleted
100644 → 0
+
0
−
160
View file @
ef41e283
/*=========================================================================
Program: Visualization Toolkit
Module: TestSortDataArray.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
// -*- c++ -*- *******************************************************
#include
"vtkSortDataArray.h"
#include
"vtkIntArray.h"
#include
"vtkMath.h"
#include
"vtkTimerLog.h"
#define ARRAY_SIZE (2*1024*1024)
// #define ARRAY_SIZE 128
int
TestSortDataArray
(
int
,
char
*
[])
{
vtkIdType
i
;
vtkTimerLog
*
timer
=
vtkTimerLog
::
New
();
cout
<<
"Building array"
<<
endl
;
vtkIntArray
*
keys
=
vtkIntArray
::
New
();
keys
->
SetNumberOfComponents
(
1
);
keys
->
SetNumberOfTuples
(
ARRAY_SIZE
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
;
i
++
)
{
keys
->
SetComponent
(
i
,
0
,
(
int
)
vtkMath
::
Random
(
0
,
ARRAY_SIZE
*
4
));
}
cout
<<
"Sorting array"
<<
endl
;
timer
->
StartTimer
();
vtkSortDataArray
::
Sort
(
keys
);
timer
->
StopTimer
();
cout
<<
"Time to sort array: "
<<
timer
->
GetElapsedTime
()
<<
" sec"
<<
endl
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
-
1
;
i
++
)
{
if
(
keys
->
GetComponent
(
i
,
0
)
>
keys
->
GetComponent
(
i
+
1
,
0
))
{
cout
<<
"Array not properly sorted!"
<<
endl
;
break
;
}
}
cout
<<
"Array consistency check finished
\n
"
<<
endl
;
cout
<<
"Sorting sorted array"
<<
endl
;
timer
->
StartTimer
();
vtkSortDataArray
::
Sort
(
keys
);
timer
->
StopTimer
();
cout
<<
"Time to sort array: "
<<
timer
->
GetElapsedTime
()
<<
" sec"
<<
endl
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
-
1
;
i
++
)
{
if
(
keys
->
GetComponent
(
i
,
0
)
>
keys
->
GetComponent
(
i
+
1
,
0
))
{
cout
<<
"Array not properly sorted!"
<<
endl
;
break
;
}
}
cout
<<
"Array consistency check finished
\n
"
<<
endl
;
cout
<<
"Building key/value arrays
\n
"
<<
endl
;
vtkIntArray
*
values
=
vtkIntArray
::
New
();
values
->
SetNumberOfComponents
(
2
);
values
->
SetNumberOfTuples
(
ARRAY_SIZE
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
;
i
++
)
{
keys
->
SetComponent
(
i
,
0
,
(
int
)
vtkMath
::
Random
(
0
,
ARRAY_SIZE
*
4
));
values
->
SetComponent
(
i
,
0
,
i
);
values
->
SetComponent
(
i
,
1
,
(
int
)
vtkMath
::
Random
(
0
,
ARRAY_SIZE
*
4
));
}
vtkIntArray
*
saveKeys
=
vtkIntArray
::
New
();
saveKeys
->
DeepCopy
(
keys
);
vtkIntArray
*
saveValues
=
vtkIntArray
::
New
();
saveValues
->
DeepCopy
(
values
);
cout
<<
"Sorting arrays"
<<
endl
;
timer
->
StartTimer
();
vtkSortDataArray
::
Sort
(
keys
,
values
);
timer
->
StopTimer
();
cout
<<
"Time to sort array: "
<<
timer
->
GetElapsedTime
()
<<
" sec"
<<
endl
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
-
1
;
i
++
)
{
int
lookup
=
(
int
)
values
->
GetComponent
(
i
,
0
);
if
(
keys
->
GetComponent
(
i
,
0
)
>
keys
->
GetComponent
(
i
+
1
,
0
))
{
cout
<<
"Array not properly sorted!"
<<
endl
;
break
;
}
if
(
keys
->
GetComponent
(
i
,
0
)
!=
saveKeys
->
GetComponent
(
lookup
,
0
))
{
cout
<<
"Values array not consistent with keys array!"
<<
endl
;
break
;
}
if
(
values
->
GetComponent
(
i
,
1
)
!=
saveValues
->
GetComponent
(
lookup
,
1
))
{
cout
<<
"Values array not consistent with keys array!"
<<
endl
;
break
;
}
}
cout
<<
"Array consistency check finished
\n
"
<<
endl
;
cout
<<
"Sorting sorted arrays"
<<
endl
;
timer
->
StartTimer
();
vtkSortDataArray
::
Sort
(
keys
,
values
);
timer
->
StopTimer
();
cout
<<
"Time to sort array: "
<<
timer
->
GetElapsedTime
()
<<
" sec"
<<
endl
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
-
1
;
i
++
)
{
int
lookup
=
(
int
)
values
->
GetComponent
(
i
,
0
);
if
(
keys
->
GetComponent
(
i
,
0
)
>
keys
->
GetComponent
(
i
+
1
,
0
))
{
cout
<<
"Array not properly sorted!"
<<
endl
;
break
;
}
if
(
keys
->
GetComponent
(
i
,
0
)
!=
saveKeys
->
GetComponent
(
lookup
,
0
))
{
cout
<<
"Values array not consistent with keys array!"
<<
endl
;
break
;
}
if
(
values
->
GetComponent
(
i
,
1
)
!=
saveValues
->
GetComponent
(
lookup
,
1
))
{
cout
<<
"Values array not consistent with keys array!"
<<
endl
;
break
;
}
}
cout
<<
"Array consistency check finished
\n
"
<<
endl
;
timer
->
Delete
();
keys
->
Delete
();
values
->
Delete
();
saveKeys
->
Delete
();
saveValues
->
Delete
();
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment