mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Replace NULL with nullptr where applicable.
This commit is contained in:
parent
12810165bb
commit
f81c42b9b4
@ -180,7 +180,7 @@ struct HelloVTKMInterop
|
||||
|
||||
//global static so that glut callback can access it
|
||||
typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
|
||||
HelloVTKMInterop< DeviceAdapter, vtkm::Float32 >* helloWorld = NULL;
|
||||
HelloVTKMInterop< DeviceAdapter, vtkm::Float32 >* helloWorld = nullptr;
|
||||
|
||||
// Render the output using simple OpenGL
|
||||
void run()
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <vtkm/rendering/View.h>
|
||||
#include <vtkm/rendering/ColorTable.h>
|
||||
|
||||
vtkm::rendering::View3D *view = NULL;
|
||||
vtkm::rendering::View3D *view = nullptr;
|
||||
|
||||
const vtkm::Int32 W = 512, H = 512;
|
||||
int buttonStates[3] = {GLUT_UP, GLUT_UP, GLUT_UP};
|
||||
|
@ -237,7 +237,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
// Read in the vector data for testing
|
||||
FILE * pFile = fopen(argv[1], "rb");
|
||||
if (pFile == NULL) perror ("Error opening file");
|
||||
if (pFile == nullptr) perror ("Error opening file");
|
||||
|
||||
size_t ret_code = 0;
|
||||
// Size of the dataset
|
||||
|
@ -647,7 +647,7 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
void PrepareForDevice(DeviceAdapterTag) const
|
||||
{
|
||||
if (this->Internals->ExecutionArray != NULL)
|
||||
if (this->Internals->ExecutionArray != nullptr)
|
||||
{
|
||||
if (this->Internals->ExecutionArray->IsDeviceAdapter(DeviceAdapterTag()))
|
||||
{
|
||||
@ -672,7 +672,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
VTKM_ASSERT(this->Internals->ExecutionArray == NULL);
|
||||
VTKM_ASSERT(this->Internals->ExecutionArray == nullptr);
|
||||
VTKM_ASSERT(!this->Internals->ExecutionArrayValid);
|
||||
// Need to change some state that does not change the logical state from
|
||||
// an external point of view.
|
||||
|
@ -513,7 +513,7 @@ public:
|
||||
retval.Microseconds = 1000*currentTime.millitm;
|
||||
#else
|
||||
timeval currentTime;
|
||||
gettimeofday(¤tTime, NULL);
|
||||
gettimeofday(¤tTime, nullptr);
|
||||
retval.Seconds = currentTime.tv_sec;
|
||||
retval.Microseconds = currentTime.tv_usec;
|
||||
#endif
|
||||
|
@ -123,7 +123,7 @@ struct DynamicArrayHandleCopyHelper {
|
||||
|
||||
// A simple function to downcast an ArrayHandle encapsulated in a
|
||||
// PolymorphicArrayHandleContainerBase to the given type of ArrayHandle. If the
|
||||
// conversion cannot be done, NULL is returned.
|
||||
// conversion cannot be done, nullptr is returned.
|
||||
template<typename Type, typename Storage>
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::cont::ArrayHandle<Type,Storage> *
|
||||
@ -134,13 +134,13 @@ DynamicArrayHandleTryCast(
|
||||
downcastContainer = dynamic_cast<
|
||||
vtkm::cont::detail::PolymorphicArrayHandleContainer<Type,Storage> *>(
|
||||
arrayContainer);
|
||||
if (downcastContainer != NULL)
|
||||
if (downcastContainer != nullptr)
|
||||
{
|
||||
return &downcastContainer->Array;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ public:
|
||||
bool IsTypeAndStorage() const {
|
||||
return (
|
||||
detail::DynamicArrayHandleTryCast<Type,Storage>(this->ArrayContainer)
|
||||
!= NULL);
|
||||
!= nullptr);
|
||||
}
|
||||
|
||||
/// Returns true if this array matches the array handle type passed in.
|
||||
@ -271,7 +271,7 @@ public:
|
||||
CastToTypeStorage() const {
|
||||
vtkm::cont::ArrayHandle<Type, Storage> *downcastArray =
|
||||
detail::DynamicArrayHandleTryCast<Type,Storage>(this->ArrayContainer);
|
||||
if (downcastArray == NULL)
|
||||
if (downcastArray == nullptr)
|
||||
{
|
||||
throw vtkm::cont::ErrorControlBadType("Bad cast of dynamic array.");
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ struct DynamicCellSetCopyHelper {
|
||||
|
||||
// A simple function to downcast a CellSet encapsulated in a
|
||||
// SimplePolymorphicContainerBase to the given subclass of CellSet. If the
|
||||
// conversion cannot be done, NULL is returned.
|
||||
// conversion cannot be done, nullptr is returned.
|
||||
template<typename CellSetType>
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetType *
|
||||
@ -69,13 +69,13 @@ DynamicCellSetTryCast(
|
||||
downcastContainer = dynamic_cast<
|
||||
vtkm::cont::internal::SimplePolymorphicContainer<CellSetType> *>(
|
||||
cellSetContainer);
|
||||
if (downcastContainer != NULL)
|
||||
if (downcastContainer != nullptr)
|
||||
{
|
||||
return &downcastContainer->Item;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
bool IsType() const {
|
||||
return (detail::DynamicCellSetTryCast<CellSetType>(this->CellSetContainer)
|
||||
!= NULL);
|
||||
!= nullptr);
|
||||
}
|
||||
|
||||
/// Returns true if this cell set is the same (or equivalent) type as the
|
||||
@ -195,7 +195,7 @@ public:
|
||||
CellSetType &Cast() const {
|
||||
CellSetType *cellSetPointer =
|
||||
detail::DynamicCellSetTryCast<CellSetType>(this->CellSetContainer);
|
||||
if (cellSetPointer == NULL)
|
||||
if (cellSetPointer == nullptr)
|
||||
{
|
||||
throw vtkm::cont::ErrorControlBadType("Bad cast of dynamic cell set.");
|
||||
}
|
||||
@ -323,7 +323,7 @@ struct DynamicCellSetTryCellSet
|
||||
{
|
||||
CellSetType *cellSet =
|
||||
detail::DynamicCellSetTryCast<CellSetType>(this->CellSetContainer);
|
||||
if (cellSet != NULL)
|
||||
if (cellSet != nullptr)
|
||||
{
|
||||
this->Function(*cellSet);
|
||||
this->FoundCast = true;
|
||||
|
@ -61,9 +61,9 @@ namespace internal {
|
||||
|
||||
inline void* alloc_aligned(size_t size, size_t align){
|
||||
#if defined(VTKM_MEMALIGN_POSIX)
|
||||
void *mem = NULL;
|
||||
void *mem = nullptr;
|
||||
if (posix_memalign(&mem, align, size) != 0){
|
||||
mem = NULL;
|
||||
mem = nullptr;
|
||||
}
|
||||
#elif defined(VTKM_MEMALIGN_WIN)
|
||||
void *mem = _aligned_malloc(size, align);
|
||||
@ -72,7 +72,7 @@ inline void* alloc_aligned(size_t size, size_t align){
|
||||
#else
|
||||
void *mem = malloc(size);
|
||||
#endif
|
||||
if (mem == NULL){
|
||||
if (mem == nullptr){
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
return mem;
|
||||
@ -174,12 +174,12 @@ public:
|
||||
public:
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
Storage(const ValueType *array = NULL, vtkm::Id numberOfValues = 0)
|
||||
Storage(const ValueType *array = nullptr, vtkm::Id numberOfValues = 0)
|
||||
: Array(const_cast<ValueType *>(array)),
|
||||
NumberOfValues(numberOfValues),
|
||||
AllocatedSize(numberOfValues),
|
||||
DeallocateOnRelease(false),
|
||||
UserProvidedMemory( array == NULL ? false : true)
|
||||
UserProvidedMemory( array == nullptr ? false : true)
|
||||
{
|
||||
}
|
||||
|
||||
@ -230,20 +230,20 @@ public:
|
||||
{
|
||||
if (this->NumberOfValues > 0)
|
||||
{
|
||||
VTKM_ASSERT(this->Array != NULL);
|
||||
VTKM_ASSERT(this->Array != nullptr);
|
||||
if (this->DeallocateOnRelease)
|
||||
{
|
||||
AllocatorType allocator;
|
||||
allocator.deallocate(this->Array,
|
||||
static_cast<std::size_t>(this->AllocatedSize) );
|
||||
}
|
||||
this->Array = NULL;
|
||||
this->Array = nullptr;
|
||||
this->NumberOfValues = 0;
|
||||
this->AllocatedSize = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
VTKM_ASSERT(this->Array == NULL);
|
||||
VTKM_ASSERT(this->Array == nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ public:
|
||||
catch (std::bad_alloc err)
|
||||
{
|
||||
// Make sureour state is OK.
|
||||
this->Array = NULL;
|
||||
this->Array = nullptr;
|
||||
this->NumberOfValues = 0;
|
||||
this->AllocatedSize = 0;
|
||||
throw vtkm::cont::ErrorControlBadAllocation(
|
||||
@ -342,7 +342,7 @@ public:
|
||||
/// \brief Take the reference away from this object.
|
||||
///
|
||||
/// This method returns the pointer to the array held by this array. It then
|
||||
/// clears the internal array pointer to NULL, thereby ensuring that the
|
||||
/// clears the internal array pointer to nullptr, thereby ensuring that the
|
||||
/// Storage will never deallocate the array. This is helpful for taking a
|
||||
/// reference for an array created internally by VTK-m and not having to keep
|
||||
/// a VTK-m object around. Obviously the caller becomes responsible for
|
||||
@ -352,7 +352,7 @@ public:
|
||||
ValueType *StealArray()
|
||||
{
|
||||
ValueType *saveArray = this->Array;
|
||||
this->Array = NULL;
|
||||
this->Array = nullptr;
|
||||
this->NumberOfValues = 0;
|
||||
this->AllocatedSize = 0;
|
||||
return saveArray;
|
||||
|
@ -1034,8 +1034,8 @@ private:
|
||||
{
|
||||
const vtkm::Id ERROR_ARRAY_SIZE = 1024;
|
||||
static bool errorArrayInit = false;
|
||||
static char* hostPtr = NULL;
|
||||
static char* devicePtr = NULL;
|
||||
static char* hostPtr = nullptr;
|
||||
static char* devicePtr = nullptr;
|
||||
if( !errorArrayInit )
|
||||
{
|
||||
cudaMallocHost( (void**)&hostPtr, ERROR_ARRAY_SIZE, cudaHostAllocMapped );
|
||||
@ -1097,7 +1097,7 @@ public:
|
||||
//since the memory is pinned we can access it safely on the host
|
||||
//without a memcpy
|
||||
vtkm::Id errorArraySize = 0;
|
||||
char* hostErrorPtr = NULL;
|
||||
char* hostErrorPtr = nullptr;
|
||||
char* deviceErrorPtr = GetPinnedErrorArray(errorArraySize, &hostErrorPtr);
|
||||
|
||||
//clear the first character which means that we don't contain an error
|
||||
@ -1156,7 +1156,7 @@ public:
|
||||
//since the memory is pinned we can access it safely on the host
|
||||
//without a memcpy
|
||||
vtkm::Id errorArraySize = 0;
|
||||
char* hostErrorPtr = NULL;
|
||||
char* hostErrorPtr = nullptr;
|
||||
char* deviceErrorPtr = GetPinnedErrorArray(errorArraySize, &hostErrorPtr);
|
||||
|
||||
//clear the first character which means that we don't contain an error
|
||||
|
@ -37,12 +37,12 @@ void TestCudaHandle()
|
||||
{
|
||||
//Verify that we can construct a cuda array handle using the class inside
|
||||
//the vtkm::cont::cuda namespace
|
||||
vtkm::cont::cuda::ArrayHandle<vtkm::Id> handleFoo(NULL,0);
|
||||
vtkm::cont::cuda::ArrayHandle<vtkm::Id> handleFoo(nullptr,0);
|
||||
vtkm::cont::Field foo("foo", vtkm::cont::Field::ASSOC_CELL_SET , "cellset", handleFoo);
|
||||
|
||||
//Verify that we can construct a cuda array handle using the class inside
|
||||
//the vtkm::cont namespace
|
||||
vtkm::cont::ArrayHandleCuda< vtkm::Vec< vtkm::Float32, 3> > handleBar(NULL,0);
|
||||
vtkm::cont::ArrayHandleCuda< vtkm::Vec< vtkm::Float32, 3> > handleBar(nullptr,0);
|
||||
vtkm::cont::Field bar("bar", vtkm::cont::Field::ASSOC_CELL_SET, "cellset", handleBar);
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ public:
|
||||
std::advance(iterator, static_cast<difference_type>(this->NumberOfValues));
|
||||
#else
|
||||
//Visual Studio checked iterators throw exceptions when you try to advance
|
||||
//NULL iterators even if the advancement length is zero. So instead
|
||||
//nullptr iterators even if the advancement length is zero. So instead
|
||||
//don't do the advancement at all
|
||||
if(this->NumberOfValues > 0)
|
||||
{
|
||||
|
@ -195,7 +195,7 @@ RectilinearTests()
|
||||
void
|
||||
TestDataSetBuilderRectilinear()
|
||||
{
|
||||
vtkm::UInt32 seed = static_cast<vtkm::UInt32>(time(NULL));
|
||||
vtkm::UInt32 seed = static_cast<vtkm::UInt32>(time(nullptr));
|
||||
std::cout << "Seed: " << seed << std::endl;
|
||||
g_RandomGenerator.seed(seed);
|
||||
|
||||
|
@ -287,7 +287,7 @@ struct TestPCoordsFunctor
|
||||
|
||||
void TestAllPCoords()
|
||||
{
|
||||
vtkm::UInt32 seed = static_cast<vtkm::UInt32>(time(NULL));
|
||||
vtkm::UInt32 seed = static_cast<vtkm::UInt32>(time(nullptr));
|
||||
std::cout << "Seed: " << seed << std::endl;
|
||||
g_RandomGenerator.seed(seed);
|
||||
|
||||
|
@ -97,7 +97,7 @@ public:
|
||||
{
|
||||
//don't delete this as it points to user memory, or stack allocated
|
||||
//memory inside this object instance
|
||||
this->OpenGLHandle = NULL;
|
||||
this->OpenGLHandle = nullptr;
|
||||
}
|
||||
|
||||
/// \brief get the OpenGL buffer handle
|
||||
|
@ -101,7 +101,7 @@ public:
|
||||
{
|
||||
//get the mapped pointer
|
||||
std::size_t cuda_size;
|
||||
ValueType* pointer = NULL;
|
||||
ValueType* pointer = nullptr;
|
||||
cudaError_t cError = cudaGraphicsResourceGetMappedPointer((void **)&pointer,
|
||||
&cuda_size,
|
||||
this->CudaResource);
|
||||
@ -139,7 +139,7 @@ class TransferToOpenGL<ValueType, vtkm::cont::DeviceAdapterTagCuda>
|
||||
public:
|
||||
VTKM_CONT_EXPORT explicit TransferToOpenGL(BufferState& state):
|
||||
State(state),
|
||||
Resource(NULL)
|
||||
Resource(nullptr)
|
||||
{
|
||||
if( !this->State.HasType() )
|
||||
{
|
||||
|
@ -378,7 +378,7 @@ protected:
|
||||
void TransferDataFile(VTKDataSetReaderBase &reader)
|
||||
{
|
||||
reader.DataFile.swap(this->DataFile);
|
||||
this->DataFile.reset(NULL);
|
||||
this->DataFile.reset(nullptr);
|
||||
}
|
||||
|
||||
virtual void CloseFile()
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
vtkm::Id height=1024)
|
||||
: CanvasGL(width,height)
|
||||
{
|
||||
ctx = NULL;
|
||||
ctx = nullptr;
|
||||
this->ResizeBuffers(width, height);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
vtkm::Id height=1024)
|
||||
: CanvasGL(width,height)
|
||||
{
|
||||
ctx = NULL;
|
||||
ctx = nullptr;
|
||||
this->ResizeBuffers(width, height);
|
||||
}
|
||||
|
||||
|
@ -43,16 +43,16 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
MapperRayTracer()
|
||||
{
|
||||
this->Canvas = NULL;
|
||||
this->Canvas = nullptr;
|
||||
}
|
||||
VTKM_CONT_EXPORT
|
||||
void SetCanvas(vtkm::rendering::Canvas *canvas)
|
||||
{
|
||||
if(canvas != NULL)
|
||||
if(canvas != nullptr)
|
||||
{
|
||||
|
||||
this->Canvas = dynamic_cast<CanvasRayTracer*>(canvas);
|
||||
if(this->Canvas == NULL)
|
||||
if(this->Canvas == nullptr)
|
||||
{
|
||||
throw vtkm::cont::ErrorControlBadValue(
|
||||
"Ray Tracer: bad canvas type. Must be CanvasRayTracer");
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
MapperVolume()
|
||||
{
|
||||
this->Canvas = NULL;
|
||||
this->Canvas = nullptr;
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
@ -54,11 +54,11 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
void SetCanvas(vtkm::rendering::Canvas *canvas)
|
||||
{
|
||||
if(canvas != NULL)
|
||||
if(canvas != nullptr)
|
||||
{
|
||||
|
||||
this->Canvas = dynamic_cast<CanvasRayTracer*>(canvas);
|
||||
if(this->Canvas == NULL)
|
||||
if(this->Canvas == nullptr)
|
||||
{
|
||||
throw vtkm::cont::ErrorControlBadValue(
|
||||
"Volume Render: bad canvas type. Must be CanvasRayTracer");
|
||||
|
@ -419,10 +419,10 @@ public:
|
||||
void WriteToSurface(CanvasRayTracer *canvas,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Float32> &distances)
|
||||
{
|
||||
if(canvas == NULL)
|
||||
if(canvas == nullptr)
|
||||
{
|
||||
throw vtkm::cont::ErrorControlBadValue(
|
||||
"Camera can not write to NULL canvas");
|
||||
"Camera can not write to nullptr canvas");
|
||||
}
|
||||
if(this->Height != vtkm::Int32(canvas->GetHeight()) ||
|
||||
this->Width != vtkm::Int32(canvas->GetWidth()))
|
||||
|
@ -199,7 +199,7 @@ struct TryTransformsFunctor
|
||||
|
||||
void TestTransforms()
|
||||
{
|
||||
vtkm::UInt32 seed = static_cast<vtkm::UInt32>(time(NULL));
|
||||
vtkm::UInt32 seed = static_cast<vtkm::UInt32>(time(nullptr));
|
||||
std::cout << "Seed: " << seed << std::endl;
|
||||
g_RandomGenerator.seed(seed);
|
||||
|
||||
|
@ -37,7 +37,7 @@ static const vtkm::Id ARRAY_SIZE = 10;
|
||||
struct TestExecObject
|
||||
{
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
TestExecObject() : Array(NULL) { }
|
||||
TestExecObject() : Array(nullptr) { }
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
TestExecObject(vtkm::Id *array) : Array(array) { }
|
||||
@ -315,7 +315,7 @@ void TestInvokeWithDynamicAndBadTypes()
|
||||
try
|
||||
{
|
||||
std::cout << " First argument bad." << std::endl;
|
||||
dispatcher.Invoke(NULL, execObject, array);
|
||||
dispatcher.Invoke(nullptr, execObject, array);
|
||||
VTKM_TEST_FAIL("Dispatcher did not throw expected error.");
|
||||
}
|
||||
catch (vtkm::cont::ErrorControlBadType error)
|
||||
@ -329,7 +329,7 @@ void TestInvokeWithDynamicAndBadTypes()
|
||||
try
|
||||
{
|
||||
std::cout << " Third argument bad." << std::endl;
|
||||
dispatcher.Invoke(array, execObject, NULL);
|
||||
dispatcher.Invoke(array, execObject, nullptr);
|
||||
VTKM_TEST_FAIL("Dispatcher did not throw expected error.");
|
||||
}
|
||||
catch (vtkm::cont::ErrorControlBadType error)
|
||||
|
@ -51,10 +51,10 @@ public:
|
||||
// constructor
|
||||
WaveletFilter( WaveletName wtype ) : symmetricity(true),
|
||||
filterLength(0),
|
||||
lowDecomposeFilter(NULL),
|
||||
highDecomposeFilter(NULL),
|
||||
lowReconstructFilter(NULL),
|
||||
highReconstructFilter(NULL)
|
||||
lowDecomposeFilter(nullptr),
|
||||
highDecomposeFilter(nullptr),
|
||||
lowReconstructFilter(nullptr),
|
||||
highReconstructFilter(nullptr)
|
||||
{
|
||||
if( wtype == CDF9_7 || wtype == BIOR4_4 )
|
||||
{
|
||||
@ -101,7 +101,7 @@ public:
|
||||
{
|
||||
delete[] lowDecomposeFilter;
|
||||
lowDecomposeFilter = highDecomposeFilter =
|
||||
lowReconstructFilter = highReconstructFilter = NULL ;
|
||||
lowReconstructFilter = highReconstructFilter = nullptr ;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user