vtkMultithreader is a class that provides support for multithreaded execution using sproc() on an SGI, or pthread_create on any platform supporting POSIX threads. This class can be used to execute a single method on multiple threads, or to specify a method per thread.

Examples:
vtkMultiThreader (Examples)
Tests:
vtkMultiThreader (Tests)

 #ifndef INITIAL_OPENGL
#define INITIAL_OPENGL
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL)
VTK_MODULE_INIT(vtkInteractionStyle)
#endif
#include <iostream>
using namespace std;
#include "vtkSmartPointer.h" #include "vtkDEMReader.h"
#include "vtkPolyData.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkProperty.h"
#include "vtkCamera.h"
#include "vtkImageDataGeometryFilter.h"
#include "vtkWarpScalar.h"
#include "vtkPolyDataNormals.h"
#include "vtkLODActor.h"
#include "vtkImageData.h"
#include "vtkLookupTable.h"
#include "vtkPoints.h"
#include "vtkCellArray.h"
#include "vtkPolyDataCollection.h"
#include "vtkTriangleFilter.h"
#include "vtkImageResample.h"
#include "vtkHandleWidget.h"
#include "vtkSphereHandleRepresentation.h"
#include "vtkTestUtilities.h"
#include "vtkTesting.h"
#include "vtkAbstractWidget.h"
#include "vtkDataSetWriter.h"
#include "vtkMultiThreader.h"
#include "vtkWarpScalar.h" int main(int argc, char*argv[])
{ //读入海拔高度图.SainteHelens.dem
char* fname = "D:/Qt/VTK6.3.0/vtkExampleModelFiles/SainteHelens.dem";
vtkMultiThreader::SetGlobalMaximumNumberOfThreads(); // Read height field.
//
vtkSmartPointer<vtkDEMReader> demReader = vtkSmartPointer<vtkDEMReader>::New();
demReader->SetFileName(fname);
delete [] fname; vtkSmartPointer<vtkImageResample> resample = vtkSmartPointer<vtkImageResample>::New();
resample->SetInputConnection(demReader->GetOutputPort());
resample->SetDimensionality();
resample->SetAxisMagnificationFactor(,);
resample->SetAxisMagnificationFactor(,); // Extract geometry
vtkSmartPointer<vtkImageDataGeometryFilter> surface = vtkSmartPointer<vtkImageDataGeometryFilter>::New();
surface->SetInputConnection(resample->GetOutputPort()); // The Dijkistra interpolator will not accept cells that aren't triangles
vtkSmartPointer<vtkTriangleFilter> triangleFilter = vtkSmartPointer<vtkTriangleFilter>::New();
triangleFilter->SetInputConnection( surface->GetOutputPort() );
triangleFilter->Update(); vtkSmartPointer<vtkWarpScalar> warp = vtkSmartPointer<vtkWarpScalar>::New();
warp->SetInputConnection(triangleFilter->GetOutputPort());
warp->SetScaleFactor();
warp->UseNormalOn();
warp->SetNormal(, , );
warp->Update(); // cout << warp->GetOutput()->GetNumberOfCells() << endl; // vtkSmartPointer<vtkDataSetWriter> writer = vtkSmartPointer<vtkDataSetWriter>::New();
// writer->SetInputConnection(resample->GetOutputPort());
// writer->SetFileName("foo.vtk");
// writer->Write(); // Define a LUT mapping for the height field double lo = demReader->GetOutput()->GetScalarRange()[];
double hi = demReader->GetOutput()->GetScalarRange()[]; vtkSmartPointer<vtkLookupTable> lut = vtkSmartPointer<vtkLookupTable>::New();
lut->SetHueRange(0.6, );
lut->SetSaturationRange(1.0, );
lut->SetValueRange(0.5, 1.0); vtkSmartPointer<vtkPolyDataNormals> normals = vtkSmartPointer<vtkPolyDataNormals>::New(); vtkSmartPointer<vtkPolyDataMapper> demMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
demMapper->SetInputConnection(warp->GetOutputPort());
demMapper->SetScalarRange(lo, hi);
demMapper->SetLookupTable(lut); vtkSmartPointer<vtkActor> demActor = vtkSmartPointer<vtkActor>::New();
demActor->SetMapper(demMapper); // Create the RenderWindow, Renderer and the DEM + path actors.
vtkSmartPointer<vtkRenderer> ren1 = vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renWin = vtkSmartPointer<vtkRenderWindow>::New();
renWin->AddRenderer(ren1);
vtkSmartPointer<vtkRenderWindowInteractor> iren =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
iren->SetRenderWindow(renWin); // Add the actors to the renderer, set the background and size
ren1->AddActor(demActor);
ren1->GetActiveCamera()->SetViewUp(, , );
ren1->GetActiveCamera()->SetPosition(-, -, );
ren1->GetActiveCamera()->SetFocalPoint(, , );
ren1->ResetCamera();
ren1->ResetCameraClippingRange(); // Here comes the surface constrained handle widget stuff.....
vtkSmartPointer<vtkHandleWidget> widget = vtkSmartPointer<vtkHandleWidget>::New();
widget->SetInteractor(iren);
vtkSmartPointer<vtkSphereHandleRepresentation> rep = vtkSmartPointer<vtkSphereHandleRepresentation>::New();
widget->SetRepresentation( rep ); // Let the surface constrained point-placer be the sole constraint dictating
// the placement of handles. Lets not over-constrain it allowing axis
// constrained interactions.
widget->EnableAxisConstraintOff(); // Set some defaults on the handle widget
double d[] = {, 5.11396e+06, 2618.62};
rep->SetWorldPosition( d );
rep->GetProperty()->SetColor( 1.0, 0.0, 0.0 );
rep->GetProperty()->SetLineWidth(1.0);
rep->GetSelectedProperty()->SetColor( 0.2, 0.0, 1.0 );
renWin->Render();
iren->Initialize();
widget->EnabledOn();
renWin->Render();
ren1->ResetCamera();
ren1->ResetCameraClippingRange();
return vtkTesting::InteractorEventLoop(argc, argv, iren);
return ;
}

vtk多线程简单测试的更多相关文章

  1. testng多线程并行执行测试

    testng多线程并行执行测试 testng多线程并行执行测试 并行(多线程)技术在软件术语里被定义为软件.操作系统或者程序可以并行地执行另外一段程序中多个部分或者子组件的能力.TestNG允许我们以 ...

  2. TODO:Golang UDP连接简单测试慎用Deadline

    TODO:Golang UDP连接简单测试慎用Deadline UDP 是User Datagram Protocol的简称, 中文名是用户数据报协议,是OSI(Open System Interco ...

  3. iOS开发多线程篇—多线程简单介绍

    iOS开发多线程篇—多线程简单介绍 一.进程和线程 1.什么是进程 进程是指在系统中正在运行的一个应用程序 每个进程之间是独立的,每个进程均运行在其专用且受保护的内存空间内 比如同时打开QQ.Xcod ...

  4. .net orm比较之dapper和Entity Framework6的简单测试比较

    .net orm比较之dapper和Entity Framework6的简单测试比较

  5. 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(37)-文章发布系统④-百万级数据和千万级数据简单测试

    原文:构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(37)-文章发布系统④-百万级数据和千万级数据简单测试 系列目录 我想测试EF在一百万条数据下的显示时间! ...

  6. ORACLE 数据库简单测试

    ORACLE 数据库简单测试 操作系统:Windows 7 – ORACLE:oracle database 10.2.0.4 一.目的 测试 启动监听程序.数据库  非同一个用户的情况,用户是否可以 ...

  7. python多线程简单例子

    python多线程简单例子 作者:vpoet mail:vpoet_sir@163.com import thread def childthread(threadid): print "I ...

  8. Javascript的简单测试环境

    在<JavaScript忍者秘籍>2.4测试条件基础知识中,作者给出了一个精简版的assert和assert组的实现,对于初学者而言,这无疑是一个很好的例子,既让我们得到了一个好用的小工具 ...

  9. struts2+hibernate+spring注解版框架搭建以及简单测试(方便脑补)

    为了之后学习的日子里加深对框架的理解和使用,这里将搭建步奏简单写一下,目的主要是方便以后自己回来脑补: 1:File--->New--->Other--->Maven--->M ...

随机推荐

  1. mongo 查询总结

    db.users.find() select * from users db.users.find({"age" : 27}) select * from users where ...

  2. mysql的缓冲查询和非缓冲查询

    最近在开发一个PHP程序时遇到了下面的错误: PHP Fatal error: Allowed memory size of 268 435 456 bytes exhausted 错误信息显示允许的 ...

  3. 什么时候用IntentService

    IntentService是继承自Service类的,在执行耗时操作时,其实,只需要在service中的onStartCommand(主线程)新启一个线程即可,那IntentService什么时候用来 ...

  4. webgl动画小测试

    // MultiPoint.js (c) 2012 matsuda // Vertex shader program var VSHADER_SOURCE = 'attribute vec4 a_Po ...

  5. [LeetCode] Search in Rotated Sorted Array II 在旋转有序数组中搜索之二

    Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this ...

  6. [LeetCode] Median of Two Sorted Arrays 两个有序数组的中位数

    There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two ...

  7. Spark MLlib - LFW

    val path = "/usr/data/lfw-a/*" val rdd = sc.wholeTextFiles(path) val first = rdd.first pri ...

  8. C# 提交网页请求时出现如下错误: System.Net.WebException: 操作超时

    原因一: 连接超时时间 Timeout 以及写入Post数据超时时间 ReadWriteTimeout 设置得太短,一般要设置大于6000ms. 原因二: Expect100Continue 属性的值 ...

  9. list,tuple,dict,set常用方法

    Python中list,tuple,dict,set常用方法 collections模块提供的其它有用扩展类型 from collections import Counter from collect ...

  10. sed awk grep三剑客常用

    sed的常用用法: awk的常用用法: grep的常用用法: 除了列出符合行之外,并且列出后10行. grep -A 10 Exception kzfinance-front.log 除了列出符合行之 ...