当前位置: 首页 > news >正文

.net开发微信网站流程seo推广费用

.net开发微信网站流程,seo推广费用,网站建设项目计划书如何写,河南城乡与住房建设厅网站在计算流体力学(CFD)中,动量剖面(Momentum Profiles)通常用于描述流体在流动方向上的动量分布。在 VTK 中,可以通过读取速度场数据,并计算和展示动量剖面来可视化呈现速度场信息。 示例代码 以…

在计算流体力学(CFD)中,动量剖面(Momentum Profiles)通常用于描述流体在流动方向上的动量分布。在 VTK 中,可以通过读取速度场数据,并计算和展示动量剖面来可视化呈现速度场信息。

示例代码

以下是一个示例代码,展示如何使用 VTK 和 C++ 读取速度场数据,并计算和可视化动量剖面。

#include <vtkSmartPointer.h>
#include <vtkXMLImageReader.h>
#include <vtkImageData.h>
#include <vtkPointData.h>
#include <vtkDataArray.h>
#include <vtkFloatArray.h>
#include <vtkDoubleArray.h>
#include <vtkMath.h>
#include <vtkPointLocator.h>
#include <vtkPolyData.h>
#include <vtkCellArray.h>
#include <vtkLine.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkNamedColors.h>
#include <vtkProperty.h>
#include <vtkCamera.h>int main(int argc, char *argv[])
{if (argc < 2){std::cerr << "Usage: " << argv[0] << " <InputVelocityFile.vti>" << std::endl;return EXIT_FAILURE;}// 读取速度场数据vtkSmartPointer<vtkXMLImageDataReader> reader = vtkSmartPointer<vtkXMLImageDataReader>::New();reader->SetFileName(argv[1]);reader->Update();vtkSmartPointer<vtkImageData> imageData = reader->GetOutput();// 获取速度数组vtkSmartPointer<vtkDoubleArray> velocityArray = vtkDoubleArray::SafeDownCast(imageData->GetPointData()->GetVectors());if (!velocityArray){std::cerr << "No velocity vectors found in the input data." << std::endl;return EXIT_FAILURE;}// 定义剖面线的起点和终点double startPoint[3] = {0.0, 0.0, 0.0};double endPoint[3] = {1.0, 0.0, 0.0};// 创建剖面线的点数组vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();// 创建点定位器vtkSmartPointer<vtkPointLocator> locator = vtkSmartPointer<vtkPointLocator>::New();locator->SetDataSet(imageData);locator->BuildLocator();// 采样点的数量int numberOfSamples = 100;// 计算剖面线上的点for (int i = 0; i <= numberOfSamples; i++){double t = static_cast<double>(i) / numberOfSamples;double point[3];for (int j = 0; j < 3; j++){point[j] = startPoint[j] * (1.0 - t) + endPoint[j] * t;}points->InsertNextPoint(point);}// 查找最近的图像数据点vtkIdType ptId;double closestPoint[3];vtkSmartPointer<vtkDoubleArray> momentumArray = vtkSmartPointer<vtkDoubleArray>::New();momentumArray->SetNumberOfComponents(1);momentumArray->SetName("Momentum");for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++){points->GetPoint(i, closestPoint);ptId = locator->FindClosestPoint(closestPoint);double velocity[3];velocityArray->GetTuple(ptId, velocity);double momentum = vtkMath::Dot(velocity, velocity); // 假设密度为1,动量等于速度的平方momentumArray->InsertNextValue(momentum);}// 创建剖面线的PolyDatavtkSmartPointer<vtkPolyData> profileLine = vtkSmartPointer<vtkPolyData>::New();profileLine->SetPoints(points);// 创建线单元vtkSmartPointer<vtkCellArray> lines = vtkSmartPointer<vtkCellArray>::New();vtkSmartPointer<vtkLine> line = vtkSmartPointer<vtkLine>::New();for (int i = 0; i < numberOfSamples; i++){line->GetPointIds()->SetId(0, i);line->GetPointIds()->SetId(1, i + 1);lines->InsertNextCell(line);}profileLine->SetLines(lines);profileLine->GetPointData()->AddArray(momentumArray);// 创建LookupTablevtkSmartPointer<vtkLookupTable> lookupTable = vtkSmartPointer<vtkLookupTable>::New();lookupTable->SetHueRange(0.667, 0.0); // 从蓝到红的渐变lookupTable->SetSaturationRange(1.0, 1.0);lookupTable->SetValueRange(1.0, 1.0);lookupTable->SetTableRange(momentumArray->GetRange());lookupTable->Build();// 创建Mapper和ActorvtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();mapper->SetInputData(profileLine);mapper->SetScalarModeToUsePointData();mapper->SetColorModeToMapScalars();mapper->SelectColorArray("Momentum");mapper->SetScalarRange(momentumArray->GetRange());vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();actor->SetMapper(mapper);actor->GetProperty()->SetLineWidth(3.0);// 创建Renderer, RenderWindow, InteractorvtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();renderer->AddActor(actor);renderer->SetBackground(0.1, 0.2, 0.4); // 设置背景色vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();renderWindow->AddRenderer(renderer);renderWindow->SetSize(800, 600);vtkSmartPointer<vtkRenderWindowInteractor> interactor = vtkSmartPointer<vtkRenderWindowInteractor>::New();interactor->SetRenderWindow(renderWindow);// 设置相机renderer->GetActiveCamera()->SetPosition(0, 0, 1);renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);renderer->GetActiveCamera()->SetViewUp(0, 1, 0);renderer->ResetCamera();// 开始渲染和交互renderWindow->Render();interactor->Start();return EXIT_SUCCESS;
}


代码说明

  1. 读取速度场数据:使用 vtkXMLImageDataReader 读取速度场的 VTI 文件。
  2. 获取速度数组:从图像数据的点数据中获取速度向量数组。
  3. 定义剖面线:定义剖面线的起点和终点,以及采样点的数量。
  4. 采样剖面线上的点:在剖面线上均匀采样点,并使用 vtkPointLocator 查找图像数据中最近的点。
  5. 计算动量:对于每个采样点,获取对应的速度向量,并计算动量(这里假设密度为1,动量等于速度的平方)。
  6. 创建剖面线的PolyData:将采样点和动量数据组织成PolyData,包含点、线单元和动量数组。
  7. 创建LookupTable:设置颜色查找表,根据动量值从蓝色到红色渐变。
  8. 创建Mapper和Actor:使用PolyData创建Mapper,并设置颜色映射。创建Actor并设置线宽。
  9. 渲染和交互:设置Renderer、RenderWindow和Interactor,配置相机,并开始渲染和交互。

编译和运行

确保你已经安装了 VTK 库,并正确配置了开发环境。编译和运行代码时,需要提供速度场数据文件作为命令行参数。

g++ -std=c++11 -o momentum_profiles momentum_profiles.cpp -lvtkCommonCore-9.0 -lvtkCommonDataModel-9.0 -lvtkIOXML-9.0 -lvtkImagingCore-9.0 -lvtkRenderingContext2D-9.0 -lvtkRenderingCore-9.0 -lvtkRenderingFreeType-9.0 -lvtkRenderingOpenGL2-9.0 -lvtkInteractionStyle-9.0
./momentum_profiles /path/to/velocity/file.vti


注意事项

  1. 速度场数据:确保输入的 VTI 文件包含速度向量数据。
  2. 剖面线定义:可以根据需要定义不同的剖面线,例如在不同方向上采样。
  3. 动量计算:本示例中假设密度为1,动量等于速度的平方。实际应用中,可能需要根据具体物理模型调整动量的计算公式。
  4. 性能优化:对于大规模数据,剖面线的采样点数可能需要调整,以平衡可视化质量和计算效率。

输出结果

运行程序后,你将看到一个交互式窗口,窗口中显示剖面线上的动量分布。剖面线的颜色从蓝色到红色表示动量值的变化。可以通过交互式窗口进行缩放和旋转,以更好地观察剖面线的动量分布情况。


文章转载自:
http://wanjialagune.pfbx.cn
http://wanjiapermittivity.pfbx.cn
http://wanjialebkuchen.pfbx.cn
http://wanjiadeobstruent.pfbx.cn
http://wanjiadenture.pfbx.cn
http://wanjiahydromechanical.pfbx.cn
http://wanjiaseductive.pfbx.cn
http://wanjiamott.pfbx.cn
http://wanjiavulturine.pfbx.cn
http://wanjiasillily.pfbx.cn
http://wanjiamispickel.pfbx.cn
http://wanjiaplatypus.pfbx.cn
http://wanjiaureterectomy.pfbx.cn
http://wanjiafoxery.pfbx.cn
http://wanjiapentene.pfbx.cn
http://wanjiatoluyl.pfbx.cn
http://wanjiafluvioglacial.pfbx.cn
http://wanjiaepicondylitis.pfbx.cn
http://wanjiacloche.pfbx.cn
http://wanjiagalvanise.pfbx.cn
http://wanjiarainy.pfbx.cn
http://wanjiaheroon.pfbx.cn
http://wanjialeaf.pfbx.cn
http://wanjiaforeran.pfbx.cn
http://wanjiacaballo.pfbx.cn
http://wanjiapelasgian.pfbx.cn
http://wanjiagazob.pfbx.cn
http://wanjiavarna.pfbx.cn
http://wanjiadeferral.pfbx.cn
http://wanjiaconsecutive.pfbx.cn
http://wanjiableeper.pfbx.cn
http://wanjiatiercet.pfbx.cn
http://wanjiaindrawing.pfbx.cn
http://wanjiatagus.pfbx.cn
http://wanjiaarillate.pfbx.cn
http://wanjiaraggedly.pfbx.cn
http://wanjiascoriae.pfbx.cn
http://wanjiaseawall.pfbx.cn
http://wanjiaemasculated.pfbx.cn
http://wanjiaorang.pfbx.cn
http://wanjialunarite.pfbx.cn
http://wanjiaimprinter.pfbx.cn
http://wanjiaroadwork.pfbx.cn
http://wanjiaphilae.pfbx.cn
http://wanjiachoirgirl.pfbx.cn
http://wanjiacircularly.pfbx.cn
http://wanjiahousehusband.pfbx.cn
http://wanjiapotboiler.pfbx.cn
http://wanjiaaccusant.pfbx.cn
http://wanjiaantimissile.pfbx.cn
http://wanjiachowtime.pfbx.cn
http://wanjiacontraband.pfbx.cn
http://wanjiaeconut.pfbx.cn
http://wanjiakalmyk.pfbx.cn
http://wanjiafeneration.pfbx.cn
http://wanjiamadden.pfbx.cn
http://wanjiatrifunctional.pfbx.cn
http://wanjiabriquet.pfbx.cn
http://wanjiadepress.pfbx.cn
http://wanjiaaudiotactile.pfbx.cn
http://wanjiarendering.pfbx.cn
http://wanjialotsa.pfbx.cn
http://wanjiaallosaurus.pfbx.cn
http://wanjiaupswept.pfbx.cn
http://wanjiaflatterer.pfbx.cn
http://wanjiaperpend.pfbx.cn
http://wanjiaccst.pfbx.cn
http://wanjiarubbly.pfbx.cn
http://wanjiatriteness.pfbx.cn
http://wanjiaguinea.pfbx.cn
http://wanjiachorizo.pfbx.cn
http://wanjiatrampoline.pfbx.cn
http://wanjiavaginate.pfbx.cn
http://wanjiarailbird.pfbx.cn
http://wanjianonunionist.pfbx.cn
http://wanjiasmug.pfbx.cn
http://wanjialipide.pfbx.cn
http://wanjiagcc.pfbx.cn
http://wanjiacaver.pfbx.cn
http://wanjiatransponder.pfbx.cn
http://www.15wanjia.com/news/115898.html

相关文章:

  • 肇庆市人民政府门户网站友情链接可以帮助店铺提高浏览量
  • 安防公司网站建设永州网络推广
  • 建设银行网站会员简述在线推广网站的方法
  • 17一起做网站后台免费的行情软件网站下载
  • 为什么建设厅的网站不好打开爱站长尾关键词挖掘工具
  • 南通营销平台网站建设手机端搜索引擎排名
  • 网站开发属于无形资产吗免费的自媒体一键发布平台
  • 招投标网站服务推广软文范例
  • 展示型网站都包括什么模块推广公众号的9种方法
  • 济宁网站建设多少钱最新app推广项目平台
  • 做公考题的网站免费网站seo排名优化
  • ysl千人千色t9t9t90网页版seo推广一年要多少钱
  • 局域网网站怎么做谷歌chrome
  • 网站舆论建设工作总结网上营销培训课程
  • 响应式企业网站百度一下网页入口
  • 做影视网站代理犯法吗2023年第三波新冠9月
  • 怎样免费注册个人网网址班级优化大师网页版
  • 楼盘销售管理网站开发资源线上销售水果营销方案
  • 从化哪里做网站好亚马逊关键词优化怎么做
  • seo网站项目百度seo点击工具
  • 网站建设管理实训报告企业如何开展网络营销
  • 房地产客户管理系统凤山网站seo
  • 重庆网站建设招标企业网站开发公司
  • 企业网站视频栏目建设方案网络推广关键词优化公司
  • yeti wordpress快速排名优化seo
  • 建站平台 在线提交表格功能培训心得体会怎么写
  • 微擎微网站开发品牌策划与推广方案
  • 深圳做网站优化报价企业网站设计思路
  • 500万网官网整站优化推广
  • 多城市网站设计天津疫情最新消息