Chris helped to eliminate all compiling errors

This commit is contained in:
Samuel Li 2016-07-27 15:42:29 -07:00
parent b2d15bbbde
commit ab021ce6f0
7 changed files with 28 additions and 64 deletions

@ -54,7 +54,7 @@ public:
this->portal2.GetNumberOfValues() ;
}
VTKM_EXEC_CONT_EXPORT
VTKM_CONT_EXPORT
ValueType Get( vtkm::Id index) const
{
if( index < this->portal1.GetNumberOfValues() )
@ -63,7 +63,7 @@ public:
return this->portal2.Get( index - this->portal1.GetNumberOfValues() );
}
VTKM_EXEC_CONT_EXPORT
VTKM_CONT_EXPORT
void Set( vtkm::Id index, const ValueType &value ) const
{
if( index < this->portal1.GetNumberOfValues() )

@ -23,8 +23,6 @@
#include <vtkm/worklet/wavelets/WaveletDWT.h>
//#include <vtkm/worklet/WaveletTransforms.h>
#include <vtkm/cont/ArrayHandleConcatenate.h>
#include <vtkm/cont/ArrayHandleCounting.h>
#include <vtkm/cont/ArrayHandlePermutation.h>
@ -34,7 +32,6 @@
namespace vtkm {
namespace worklet {
//template< typename DeviceAdapter >
class WaveletCompressor : public vtkm::worklet::wavelets::WaveletDWT
{
public:
@ -44,17 +41,18 @@ public:
// Multi-level 1D wavelet decomposition
template< typename SignalArrayType, typename CoeffArrayType>
VTKM_EXEC_CONT_EXPORT
VTKM_CONT_EXPORT
vtkm::Id WaveDecompose( const SignalArrayType &sigIn, // Input
vtkm::Id nLevels, // n levels of DWT
CoeffArrayType &coeffOut,
vtkm::Id* L )
{
vtkm::Id sigInLen = sigIn.GetNumberOfValues();
if( nLevels < 1 || nLevels > WaveletBase::GetWaveletMaxLevel( sigInLen ) )
{
std::cerr << "nLevel is not supported: " << nLevels << std::endl;
// throw an error
// TODO: throw an error
}
/* 0 levels means no transform
if( nLevels == 0 )
@ -62,8 +60,7 @@ public:
vtkm::cont::DeviceAdapterAlgorithm< VTKM_DEFAULT_DEVICE_ADAPTER_TAG>::Copy
(sigIn, C );
return 0;
}
*/
} */
this->ComputeL( sigInLen, nLevels, L );
vtkm::Id CLength = this->ComputeCoeffLength( L, nLevels );
@ -126,7 +123,7 @@ public:
// Multi-level 1D wavelet reconstruction
template< typename CoeffArrayType, typename SignalArrayType >
VTKM_EXEC_CONT_EXPORT
VTKM_CONT_EXPORT
vtkm::Id WaveReconstruct( const CoeffArrayType &coeffIn, // Input
vtkm::Id nLevels, // n levels of DWT
vtkm::Id* L,
@ -180,7 +177,6 @@ public:
#undef VAL
return 0;
}

@ -43,12 +43,6 @@ void TestExtend1D()
ArrayType outputArray;
vtkm::worklet::wavelets::WaveletDWT w("CDF9/7");
/*
typedef vtkm::cont::ArrayHandleConcatenate< ArrayType, ArrayType>
ArrayConcat;
typedef vtkm::cont::ArrayHandleConcatenate< ArrayConcat, ArrayType > ArrayConcat2;
ArrayConcat2 outputArray;
*/
w.Extend1D( inputArray, outputArray, 4,
vtkm::worklet::wavelets::SYMW, vtkm::worklet::wavelets::SYMW );
@ -58,7 +52,7 @@ void TestExtend1D()
std::cout << "\nFinish testing Extend1D" << std::endl;
}
VTKM_EXEC_CONT_EXPORT
VTKM_CONT_EXPORT
void TestDWTIDWT1D()
{
vtkm::Id sigLen = 20;
@ -88,9 +82,7 @@ void TestDWTIDWT1D()
std::cout << "Forward Wavelet Transform: result coeff length = " <<
coeffOut.GetNumberOfValues() << std::endl;
/*
printf("L[0] = %lld, L[1] = %lld, L[2] = %lld\n", L[0], L[1], L[2] );
*/
for( vtkm::Id i; i < coeffOut.GetNumberOfValues(); i++ )
{
if( i == 0 )
@ -111,7 +103,7 @@ void TestDWTIDWT1D()
}
}
VTKM_EXEC_CONT_EXPORT
VTKM_CONT_EXPORT
void TestWaveDecomposeReconstruct()
{
vtkm::Id sigLen = 20;
@ -151,22 +143,16 @@ void TestWaveDecomposeReconstruct()
std::cerr << "not valid levels of transforms" << std::endl;
exit(1);
}
vtkm::Id L[ nLevels + 2 ];
vtkm::Id* L = new vtkm::Id[ nLevels + 2 ];
// Use a timer and decompose
vtkm::cont::Timer<> timer;
compressor.WaveDecompose( inputArray, nLevels, outputArray, L );
vtkm::Float64 elapsedTime = timer.GetElapsedTime();
std::cout << "Decompose takes time: " << elapsedTime << std::endl;
#if 0
std::cout << "Output coefficients has length = " <<
outputArray.GetNumberOfValues() << std::endl;
for( vtkm::Id i = 0; i < outputArray.GetNumberOfValues(); i++ )
{
std::cout << outputArray.GetPortalConstControl().Get(i) << std::endl;
}
#endif
// Sort all coefficients
@ -175,16 +161,13 @@ void TestWaveDecomposeReconstruct()
vtkm::cont::ArrayHandle<vtkm::Float64> reconstructArray;
timer.Reset();
compressor.WaveReconstruct( outputArray, nLevels, L, reconstructArray );
elapsedTime = timer.GetElapsedTime();
std::cout << "Reconstruction takes time: " << elapsedTime << std::endl;
//std::cout << "Reconstruct array has length = " <<
// reconstructArray.GetNumberOfValues() << std::endl;
timer.Reset();
for( vtkm::Id i = 0; i < reconstructArray.GetNumberOfValues(); i++ )
{
//std::cout << reconstructArray.GetPortalConstControl().Get(i) << std::endl;
VTKM_TEST_ASSERT( test_equal( reconstructArray.GetPortalConstControl().Get(i),
vtkm::Sin( static_cast<vtkm::Float64>(i) )),
"output value not the same..." );
@ -192,6 +175,8 @@ void TestWaveDecomposeReconstruct()
elapsedTime = timer.GetElapsedTime();
std::cout << "Verification takes time: " << elapsedTime << std::endl;
delete[] L;
}
void TestWaveletCompressor()

@ -63,7 +63,7 @@ public:
else
{
std::cerr << "This wavelet kernel is not supported: " << wname << std::endl;
// throw an error
// TODO: throw an error
}
}
@ -80,7 +80,7 @@ public:
{
if( this->filter == NULL )
{
// throw an error
// TODO: throw an error
}
return filter;
}

@ -45,6 +45,7 @@ public:
// Func: Extend 1D signal
template< typename SigInArrayType, typename SigExtendedArrayType >
VTKM_CONT_EXPORT
vtkm::Id Extend1D( const SigInArrayType &sigIn, // Input
SigExtendedArrayType &sigOut, // Output
vtkm::Id addLen,
@ -86,7 +87,7 @@ public:
}
default:
{
// throw out an error
// TODO: throw an error
return 1;
}
}
@ -107,7 +108,7 @@ public:
}
default:
{
// throw out an error
// TODO: throw an error
return 1;
}
}
@ -126,7 +127,7 @@ public:
// Performs one level of 1D discrete wavelet transform
// It takes care of boundary conditions, etc.
template< typename SignalArrayType, typename CoeffArrayType>
VTKM_EXEC_CONT_EXPORT
VTKM_CONT_EXPORT
vtkm::Id DWT1D( const SignalArrayType &sigIn, // Input
CoeffArrayType &coeffOut, // Output: cA followed by cD
vtkm::Id L[3] ) // Output: how many cA and cD.
@ -135,7 +136,7 @@ public:
vtkm::Id sigInLen = sigIn.GetNumberOfValues();
if( GetWaveletMaxLevel( sigInLen ) < 1 )
{
// throw an error
// TODO: throw an error
std::cerr << "Cannot transform signal of length " << sigInLen << std::endl;
return -1;
}
@ -226,16 +227,11 @@ public:
// Performs one level of inverse wavelet transform
// It takes care of boundary conditions, etc.
template< typename CoeffArrayType, typename SignalArrayType>
VTKM_EXEC_CONT_EXPORT
VTKM_CONT_EXPORT
vtkm::Id IDWT1D( const CoeffArrayType &coeffIn, // Input, cA followed by cD
const vtkm::Id L[3], // Input, how many cA and cD
SignalArrayType &sigOut ) // Output
{
#if 0
std::cerr << "coeffIn len = " << coeffIn.GetNumberOfValues() << std::endl;
std::cerr << L[0] << ", " << L[1] << ", " << L[2] << std::endl;
#endif
VTKM_ASSERT( coeffIn.GetNumberOfValues() == L[2] );
vtkm::Id filterLen = WaveletBase::filter->GetFilterLength();
@ -313,7 +309,6 @@ public:
CoeffArrayBasic cATemp, cDTemp;
if( doSymConv ) // Actually extend cA and cD
{
this->Extend1D( cA, cATemp, addLen, cALeftMode, cARightMode );
@ -347,7 +342,7 @@ public:
cDTemp = cDStorage;
}
}
} // end if( doSymConv )
} // end if( doSymConv )
else // Make cATemp and cDTemp from cA and cD
{
vtkm::cont::DeviceAdapterAlgorithm< VTKM_DEFAULT_DEVICE_ADAPTER_TAG >::Copy
@ -356,14 +351,6 @@ public:
(cD, cDTemp );
}
#if 0
std::cerr << "cATemp has length: " << cATemp.GetNumberOfValues() << std::endl;
for( vtkm::Id i = 0; i < cATemp.GetNumberOfValues(); i++ )
std::cout << cATemp.GetPortalConstControl().Get(i) << std::endl;
std::cerr << "cDTemp has length: " << cDTemp.GetNumberOfValues() << std::endl;
for( vtkm::Id i = 0; i < cDTemp.GetNumberOfValues(); i++ )
std::cout << cDTemp.GetPortalConstControl().Get(i) << std::endl;
#endif
if( filterLen % 2 != 0 )
{
@ -380,17 +367,13 @@ public:
WaveletBase::filter->GetLowReconstructFilter(),
WaveletBase::filter->GetHighReconstructFilter(),
sigOut );
#if 0
std::cerr << "coeffInExtended len = " << coeffInExtended.GetNumberOfValues() << std::endl;
std::cerr << sigOut.GetNumberOfValues() << ", " << L[2] << std::endl;
#endif
VTKM_ASSERT( sigOut.GetNumberOfValues() >= L[2] );
sigOut.Shrink( L[2] );
}
else
{
// need to implement the even filter length worklet first
// TODO: need to implement the even filter length worklet first
}
return 0;

@ -66,7 +66,7 @@ public:
else
{
std::cerr << "Not supported wavelet kernel: " << wname << std::endl;
// throw an error here
// TODO: throw an error here
}
}

@ -158,7 +158,7 @@ public:
VTKM_CONT_EXPORT
void SetFilterLength( vtkm::Id len )
{
VTKM_ASSERT( len % 2 == 1 );
//VTKM_ASSERT( len % 2 == 1 );
this->filterLen = len;
}