VTK_CREATE

本文介绍了VTK库中常用的VTK_CREATE宏定义及其使用方法。该宏用于智能指针的初始化,简化了vtkSmartPointer对象的创建过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在VTK的例程中存在众多的VTK_CREATE(),可以明显看出这是个宏定义,作用也明了,google了下没要找到,便没有深究。

偶尔看到其定义如下,mark一下吧:

#define VTK_CREATE(type, name) vtkSmartPointer<type> name =vtkSmartPointer<type>::New()


见:http://www.vtk.org/pipermail/vtkusers/2011-April/116046.html

(base) rock@rock-Precision-5530:~/PyGRDECL$ python convert_grdecl_to_vtk.py [Input] Reading ECLIPSE/PETREL file "./ExampleData/dome.grdecl" .... Grid Type=CornerPoint Grid Dimension(NX,NY,NZ): (20 x 20 x 4) NumOfGrids=1600 NumOfKeywords=11 Reading Keywords [SPECGRID] [PORO] [PERMX] [PERMY] [PERMZ] .....Done! [Geometry] Converting GRDECL to Paraview Hexahedron mesh data.... NumOfPoints 12800 NumOfCells 1600 Traceback (most recent call last): File "/home/rock/PyGRDECL/convert_grdecl_to_vtk.py", line 7, in <module> Model.GRDECL2VTK() File "/home/rock/PyGRDECL/GRDECL2VTK.py", line 161, in GRDECL2VTK self.Update() File "/home/rock/PyGRDECL/GRDECL2VTK.py", line 168, in Update self.AppendScalarData2VTK(keyword,data) #VTK will automatically overwrite the data with the same keyword ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rock/PyGRDECL/GRDECL2VTK.py", line 381, in AppendScalarData2VTK data = ns.numpy_to_vtk(numpy_array.ravel(order='F'),deep=True, array_type=vtk.VTK_FLOAT) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rock/anaconda3/lib/python3.12/site-packages/vtkmodules/util/numpy_support.py", line 164, in numpy_to_vtk arr_dtype = get_numpy_array_type(vtk_typecode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rock/anaconda3/lib/python3.12/site-packages/vtkmodules/util/numpy_support.py", line 94, in get_numpy_array_type return get_vtk_to_numpy_typemap()[vtk_array_type] ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rock/anaconda3/lib/python3.12/site-packages/vtkmodules/util/numpy_support.py", line 74, in get_vtk_to_numpy_typemap _vtk_np = {vtkConstants.VTK_BIT:numpy.bool, ^^^^^^^^^^ File "/home/rock/anaconda3/lib/python3.12/site-packages/numpy/__init__.py", line 324, in __getattr__ raise AttributeError(__former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'bool'. `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
最新发布
03-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值