亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? para.cpp

?? 本程序完成流水線并行提取等值面功能
?? CPP
字號:

// This program demonstrates the use ports by setting up a simple 
// pipeline. All processes create an identical pipeline:
// vtkImageReader -> vtkContourFilter -> vtkElevationFilter
// In addition, the first (root) process creates n input ports
// (where n=nProcs-1), each attached to an output port on the other 
// processes. It then appends the polygonal output from all input 
// ports and it's own pipeline and renders the result ISO_NUM times,
// each time setting a different scalar value to be contoured.
#include "vtkActor.h"
#include "vtkAppendPolyData.h"
#include "vtkCamera.h"
#include "vtkContourFilter.h"
#include "vtkDataSet.h"
#include "vtkElevationFilter.h"
#include "vtkImageData.h"
#include "vtkImageReader.h"
#include "vtkInputPort.h"
#include "vtkMath.h"
#include "vtkMultiProcessController.h"
#include "vtkOutputPort.h"
#include "vtkPolyData.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
#include "vtkTestUtilities.h"
#include "vtkTimerLog.h"
#include "vtkVolume16Reader.h"

static const float ISO_START=4250.0;
static const float ISO_STEP=-250.0;
static const int ISO_NUM=17;
// Just pick a tag which is available
static const int ISO_VALUE_RMI_TAG=300; 
static const int PORT_TAG=999;

// call back to set the iso surface value.
void SetIsoValueRMI(void *localArg, void* vtkNotUsed(remoteArg), 
                    int vtkNotUsed(remoteArgLen), int vtkNotUsed(id))
{ 
  float val;
  vtkContourFilter *iso;
  iso = (vtkContourFilter *)localArg;
  val = iso->GetValue(0);//4250
  iso->SetValue(0, val + ISO_STEP);
}


// This will be called by all processes
void MyMain( vtkMultiProcessController *controller, void *arg )
{
  //vtkImageReader *reader;
  vtkVolume16Reader *reader;
  vtkContourFilter *iso;
  vtkElevationFilter *elev;
  int myid, numProcs;
  float val;
  int numTris;
  char* fname = reinterpret_cast<char*>(arg);
  
  // Obtain the id of the running process and the total
  // number of processes
  myid = controller->GetLocalProcessId();
  numProcs = controller->GetNumberOfProcesses();
    
  // Create the reader, the data file name might have
  // to be changed depending on where the data files are.
  //reader = vtkImageReader::New();
  reader = vtkVolume16Reader::New();
  reader->SetDataByteOrderToLittleEndian();
  //reader->SetDataExtent(0, 63, 0, 63, 1, 93);
  //reader->SetFilePrefix(fname);
  reader->SetDataDimensions(64,64);
  reader->SetImageRange(1,93);
  reader->SetFilePrefix((char *)arg);//也可以用
  reader->SetDataSpacing(3.2, 3.2, 1.5);

  // Iso-surface.
  iso = vtkContourFilter::New();
  iso->SetInput(reader->GetOutput());
  iso->SetValue(0, ISO_START);
  iso->ComputeScalarsOff();
  iso->ComputeGradientsOff();
  
  // Compute a different color for each process.
  elev = vtkElevationFilter::New();
  elev->SetInput(iso->GetOutput());
  vtkMath::RandomSeed(myid * 100);
  val = vtkMath::Random();
  elev->SetScalarRange(val, val+0.001);

  if (myid != 0) 
    {
    // If I am not the root process

    // Satellite process! Send data through port.
    vtkOutputPort *upPort = vtkOutputPort::New();
    
    // Last, set up a RMI call back to change the iso surface value.
    // This is done so that the root process can let this process
    // know that it wants the contour value to change.
    controller->AddRMI(SetIsoValueRMI, (void *)iso, ISO_VALUE_RMI_TAG);
  
    // connect the port to the output of the pipeline
    upPort->SetInput(elev->GetPolyDataOutput());

    // Multiple ports can go through the same connection.
    // This is used to differentiate ports
    upPort->SetTag(PORT_TAG);

    // Loop which processes RMI requests. 
    // Use vtkMultiProcessController::BREAK_RMI_TAG to break it.
    // The root process with send a ISO_VALUE_RMI_TAG to make this
    // process change it's contour value.
    upPort->WaitForUpdate();
    
    // We are done. Clean up.
    upPort->Delete();
    }
  else
    {
    // If I am the root process

    int i, j;
    vtkAppendPolyData *app = vtkAppendPolyData::New();
    vtkInputPort *downPort;
    vtkRenderer *ren = vtkRenderer::New();
    vtkRenderWindow *renWindow = vtkRenderWindow::New();
    vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
    vtkActor *actor = vtkActor::New();
    vtkTimerLog *timer = vtkTimerLog::New();
    vtkCamera *cam = vtkCamera::New();

    // Add my pipeline's output to the append filter
    app->AddInput(elev->GetPolyDataOutput());

    // ###################### important ####################
    // # This tells the append filter to request pieces from
    // # each of its inputs.  Since each of its inputs comes from
    // # a different process,  each process generates a separate 
    // # piece of the data (data parallelism).
    // # If this is not used, all processes will iso-surface
    // # all the data.
    app->ParallelStreamingOn();//并行制導(dǎo)語句
    
    // This is the main thread: Collect the data and render it.
    for (i = 1; i < numProcs; ++i)
    {
      downPort = vtkInputPort::New();
      downPort->SetRemoteProcessId(i);

      // Multiple ports can go through the same connection.
      // This is used to differentiate ports
      downPort->SetTag(PORT_TAG);

      app->AddInput(downPort->GetPolyDataOutput());

      // Reference already incremented by AddInput(). Delete()
      // will only decrement the count, not destroy the object.
      // The ports will be destroyed when the append filter
      // goes away.
      downPort->Delete();
      downPort = NULL;
    }

    // Create the rendering part of the pipeline
    renWindow->AddRenderer(ren);
    iren->SetRenderWindow(renWindow);
    ren->SetBackground(0.9, 0.9, 0.9);
    renWindow->SetSize( 600, 600);
  
    mapper->SetInput(app->GetOutput());
    actor->SetMapper(mapper);
  
    ren->AddActor(actor);
  
    cam->SetFocalPoint(100, 100, 65);
    cam->SetPosition(100, 450, 65);
    cam->SetViewUp(0, 0, -1);
    cam->SetViewAngle(30);

    cam->SetClippingRange(177.0,536.0);
    ren->SetActiveCamera(cam);
	//renWindow->Render();
  
    // loop through some iso surface values.
    for (j = 0; j < ISO_NUM; ++j)
    {
      // set the local value
      SetIsoValueRMI((void*)iso, NULL, 0, 0);
      for (i = 1; i < numProcs; ++i)
      {
        // trigger the RMI to change the iso surface value.
        controller->TriggerRMI(i, ISO_VALUE_RMI_TAG);   //每個進(jìn)程改變iso   
      }
      
      // Time the rendering. Note that the execution on all processes
      // start only after Update()
      timer->StartTimer();
      app->Update();
      timer->StopTimer();
      numTris = iso->GetOutput()->GetNumberOfCells();
      val = iso->GetValue(0);
      cerr << "Update " << val << " took " << timer->GetElapsedTime() 
           << " seconds to produce " << numTris << " triangles\n";
      
      // now render the results
      renWindow->Render();
    }

    // Tell the other processors to stop processing RMIs.
    for (i = 1; i < numProcs; ++i)
      {
      controller->TriggerRMI(i, vtkMultiProcessController::BREAK_RMI_TAG); 
      }
    
    // Clean up
    app->Delete();
    ren->Delete();
    renWindow->Delete();
    iren->Delete();
    mapper->Delete();
    actor->Delete();
    cam->Delete();
    timer->Delete();
    }
  
  // clean up objects in all processes.
  reader->Delete();
  iso->Delete();
  elev->Delete();
}


int main( int argc, char* argv[] )
{
  vtkMultiProcessController *controller;
  

  // Note that this will create a vtkMPIController if MPI
  // is configured, vtkThreadedController otherwise.
  controller = vtkMultiProcessController::New();

  controller->Initialize(&argc, &argv);

  // Use this method to get the place of the data directory.
  //char* fname = vtkTestUtilities::ExpandDataFileName(argc, argv, "D:/若愚工作室/可視化/piso/ironProt.vtk");
  char *fname = "D:/headsq/quarter";

  //controller->SetSingleMethod(MyMain, reinterpret_cast<void*>(fname));
  controller->SetSingleMethod(MyMain,fname);

  // When using MPI, the number of processes is determined
  // by the external program which launches this application.
  // However, when using threads, we need to set it ourselves.
  if (controller->IsA("vtkThreadedController"))
    {
    // Set the number of processes to 2 for this example.
    controller->SetNumberOfProcesses(8);
    } 
  controller->SingleMethodExecute();

  //delete[] fname;

  controller->Finalize();
  controller->Delete();

  return 0;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
综合激情网...| 亚洲va韩国va欧美va| 日韩视频一区在线观看| 久久久不卡网国产精品二区| 国产福利一区二区三区在线视频| 精品亚洲aⅴ乱码一区二区三区| 精品视频全国免费看| 视频一区二区中文字幕| 91麻豆精品国产91久久久使用方法| 秋霞电影一区二区| 久久精品视频在线看| 91在线视频在线| 亚洲高清不卡在线| 日韩欧美一区二区久久婷婷| 国产精品综合在线视频| 中文字幕人成不卡一区| 在线综合+亚洲+欧美中文字幕| 蜜臂av日日欢夜夜爽一区| 久久精品人人做人人爽97| 色综合久久88色综合天天6| 日韩av午夜在线观看| 国产婷婷色一区二区三区| 91免费版pro下载短视频| 免费观看成人鲁鲁鲁鲁鲁视频| 国产日韩欧美一区二区三区乱码| 色伊人久久综合中文字幕| 日本va欧美va精品发布| 中文字幕成人网| 欧美老人xxxx18| 国产成人免费在线观看不卡| 亚洲精品成人天堂一二三| 日韩女优视频免费观看| 91一区二区三区在线观看| 麻豆高清免费国产一区| 成人欧美一区二区三区在线播放| 在线播放国产精品二区一二区四区 | 国产精品免费人成网站| 欧美曰成人黄网| 高清国产午夜精品久久久久久| 午夜精品福利在线| ...xxx性欧美| 国产视频一区在线观看| 欧美高清一级片在线| 91亚洲精品乱码久久久久久蜜桃| 另类综合日韩欧美亚洲| 亚洲国产欧美另类丝袜| 综合电影一区二区三区| 久久久久久夜精品精品免费| 欧美精品久久99久久在免费线 | 韩国毛片一区二区三区| 亚洲一级在线观看| 最近日韩中文字幕| 国产校园另类小说区| 精品国产一区二区精华| 91精品国产品国语在线不卡| 欧美综合一区二区| 色94色欧美sute亚洲线路一ni| 国产91高潮流白浆在线麻豆| 韩国欧美国产一区| 麻豆成人久久精品二区三区红| 香蕉影视欧美成人| 亚洲成人精品一区| 亚洲成国产人片在线观看| 亚洲专区一二三| 一区二区三区在线观看视频| 国产精品电影一区二区三区| 国产精品美女www爽爽爽| 国产色婷婷亚洲99精品小说| 精品欧美一区二区久久 | 国产一区二区三区不卡在线观看 | 一本到高清视频免费精品| 国产成人午夜精品5599| 国产黄色精品视频| 国产成人精品三级| 顶级嫩模精品视频在线看| 国产美女久久久久| 国产成人av福利| 成人免费视频caoporn| 成人免费精品视频| 色婷婷久久久综合中文字幕| 欧美亚一区二区| 欧美日韩国产片| 日韩色在线观看| 精品91自产拍在线观看一区| 久久久久久久综合狠狠综合| 欧美国产日本韩| 亚洲欧美日韩国产成人精品影院| 亚洲激情男女视频| 日韩高清在线一区| 极品尤物av久久免费看| 成人永久aaa| 色婷婷国产精品| 欧美另类高清zo欧美| 精品久久久久久最新网址| 亚洲国产精品传媒在线观看| 国产精品成人在线观看| 亚洲国产成人av好男人在线观看| 美女视频第一区二区三区免费观看网站| 黄网站免费久久| 99精品视频中文字幕| 欧美酷刑日本凌虐凌虐| 久久综合国产精品| 亚洲丝袜精品丝袜在线| 日本va欧美va精品| 成人av在线电影| 欧美日韩国产a| 国产午夜亚洲精品理论片色戒 | 99re成人精品视频| 91麻豆精品国产自产在线观看一区| 精品国产乱码久久久久久浪潮| 国产精品三级电影| 日本不卡免费在线视频| av在线一区二区| 91精品国产色综合久久不卡蜜臀| 久久精品人人做人人爽人人| 亚洲综合清纯丝袜自拍| 国产精品18久久久久久久久| 欧美性生活久久| 日本一区二区三区高清不卡| 天堂一区二区在线| 99精品国产99久久久久久白柏 | 久久久91精品国产一区二区精品| 一区二区在线观看免费视频播放| 精品伊人久久久久7777人| 一本到三区不卡视频| 久久久99久久| 日本欧美一区二区| 色域天天综合网| 久久精品无码一区二区三区| 日本午夜一区二区| 色就色 综合激情| 中文字幕不卡在线观看| 另类综合日韩欧美亚洲| 欧美日韩国产一级片| 综合久久久久综合| 国产一区二区三区黄视频| 8x福利精品第一导航| 一区二区三区不卡在线观看| 国产成人亚洲综合a∨婷婷图片| 欧美精品在线视频| 一区二区三区中文免费| 成人精品高清在线| 国产日韩影视精品| 精品一区二区影视| 91精品国产一区二区三区香蕉| 亚洲综合av网| 在线视频欧美精品| 国产精品的网站| 成人美女视频在线观看| 国产人妖乱国产精品人妖| 久久99深爱久久99精品| 欧美一区二区免费视频| 天天做天天摸天天爽国产一区| 在线观看中文字幕不卡| 亚洲精品免费视频| 97成人超碰视| 亚洲免费大片在线观看| 91在线小视频| 尤物视频一区二区| 色老头久久综合| 亚洲综合久久久久| 欧美偷拍一区二区| 一区二区三区在线不卡| 99久久精品国产毛片| 亚洲欧洲成人精品av97| 丁香婷婷综合五月| 中文字幕在线一区二区三区| 99re这里都是精品| 一区二区欧美视频| 在线亚洲一区二区| 亚洲一区二区欧美日韩 | 欧美一级片免费看| 日韩影视精彩在线| 精品日韩一区二区三区免费视频| 蜜桃视频在线观看一区二区| 精品少妇一区二区三区免费观看| 蜜臀av一级做a爰片久久| 欧美不卡一二三| 国产成人综合亚洲91猫咪| 国产精品污网站| 91丝袜美女网| 亚洲国产欧美在线| 欧美日本韩国一区二区三区视频| 视频一区二区三区中文字幕| 日韩精品自拍偷拍| 福利91精品一区二区三区| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 亚洲日本一区二区| 欧美午夜影院一区| 免费高清成人在线| 国产亚洲一区二区三区四区 | 蜜臀av性久久久久蜜臀aⅴ| 久久你懂得1024| 色婷婷香蕉在线一区二区| 免费人成在线不卡| 国产精品伦理在线| 欧美日韩日本视频| 国产不卡在线视频| 亚洲一区二区三区影院| 久久亚洲二区三区|