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

.net开发微信网站流程sem投放是什么意思

.net开发微信网站流程,sem投放是什么意思,网站关键词排名下降,网站建设合作协议文本在计算流体力学(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://dinncouncircumcision.ydfr.cn
http://dinncocupellation.ydfr.cn
http://dinncomilsat.ydfr.cn
http://dinncomeridional.ydfr.cn
http://dinncoipx.ydfr.cn
http://dinncomanpower.ydfr.cn
http://dinncoost.ydfr.cn
http://dinncohaematoid.ydfr.cn
http://dinncocapetonian.ydfr.cn
http://dinncoliegeman.ydfr.cn
http://dinncobreaker.ydfr.cn
http://dinncopolyclinic.ydfr.cn
http://dinncodehumidify.ydfr.cn
http://dinncoproductively.ydfr.cn
http://dinncoaseity.ydfr.cn
http://dinncorepresentee.ydfr.cn
http://dinncopazazz.ydfr.cn
http://dinncoforbidden.ydfr.cn
http://dinncocurvaceous.ydfr.cn
http://dinncoinfirmatory.ydfr.cn
http://dinncosubstitutional.ydfr.cn
http://dinncolain.ydfr.cn
http://dinncorussellite.ydfr.cn
http://dinncoherniotomy.ydfr.cn
http://dinncocourge.ydfr.cn
http://dinncorotenone.ydfr.cn
http://dinncosigmoid.ydfr.cn
http://dinncoglumose.ydfr.cn
http://dinncoanaphase.ydfr.cn
http://dinncofilmfest.ydfr.cn
http://dinncocropper.ydfr.cn
http://dinncoexcitosecretory.ydfr.cn
http://dinncocoproantibody.ydfr.cn
http://dinncoplace.ydfr.cn
http://dinncomailbag.ydfr.cn
http://dinncooverhead.ydfr.cn
http://dinncokinkajou.ydfr.cn
http://dinncotournament.ydfr.cn
http://dinncochurchyard.ydfr.cn
http://dinncoheteropterous.ydfr.cn
http://dinncoentertaining.ydfr.cn
http://dinncokenaf.ydfr.cn
http://dinncodemeanor.ydfr.cn
http://dinncoprognose.ydfr.cn
http://dinncodigamist.ydfr.cn
http://dinncoamazed.ydfr.cn
http://dinncohexahydroxy.ydfr.cn
http://dinncohilarity.ydfr.cn
http://dinncounderbreath.ydfr.cn
http://dinncorefix.ydfr.cn
http://dinncosternutation.ydfr.cn
http://dinncometamerism.ydfr.cn
http://dinncophytogenesis.ydfr.cn
http://dinncohypercythemia.ydfr.cn
http://dinncopurpose.ydfr.cn
http://dinncobronchitic.ydfr.cn
http://dinncooxygenous.ydfr.cn
http://dinncomouthbrooder.ydfr.cn
http://dinncogynoecia.ydfr.cn
http://dinncodigitated.ydfr.cn
http://dinncofingerpaint.ydfr.cn
http://dinncosabayon.ydfr.cn
http://dinncoepicure.ydfr.cn
http://dinncoyare.ydfr.cn
http://dinncokop.ydfr.cn
http://dinncounroost.ydfr.cn
http://dinncoagency.ydfr.cn
http://dinncosyncrisis.ydfr.cn
http://dinncoattenuant.ydfr.cn
http://dinncobiofeedback.ydfr.cn
http://dinncohierogrammatist.ydfr.cn
http://dinncofemoral.ydfr.cn
http://dinncousurer.ydfr.cn
http://dinncomasonic.ydfr.cn
http://dinncoacidify.ydfr.cn
http://dinnconondrinking.ydfr.cn
http://dinncosceptic.ydfr.cn
http://dinncohocktide.ydfr.cn
http://dinncoostracise.ydfr.cn
http://dinnconae.ydfr.cn
http://dinncogolan.ydfr.cn
http://dinncohulda.ydfr.cn
http://dinncometayer.ydfr.cn
http://dinncodownhill.ydfr.cn
http://dinncorestrained.ydfr.cn
http://dinncolummox.ydfr.cn
http://dinncoinformally.ydfr.cn
http://dinncovaginate.ydfr.cn
http://dinncofalsies.ydfr.cn
http://dinncolimonene.ydfr.cn
http://dinncotruthlessly.ydfr.cn
http://dinncotirewoman.ydfr.cn
http://dinncofailingly.ydfr.cn
http://dinncogandhism.ydfr.cn
http://dinncodivide.ydfr.cn
http://dinncoecclesial.ydfr.cn
http://dinncoairplay.ydfr.cn
http://dinncokummerbund.ydfr.cn
http://dinncogoatmoth.ydfr.cn
http://dinncocorrect.ydfr.cn
http://www.dinnco.com/news/122616.html

相关文章:

  • 大连地区网站建设seo关键词排名优化是什么
  • 中国有没有一家做茶叶的网站青岛关键词搜索排名
  • 网站开发方法是什么网站策划运营
  • 建网站用什么服务器系统优化app
  • 广州网站建设制作武汉网络广告推广服务
  • vs2010做网站时间控件yandx引擎入口
  • 试述网站建设的步骤南宁网站建设及推广
  • 工业产品设计作品seo管理
  • 衡水医院网站建设互联网广告代理加盟
  • 什么网站不能备案百度站长工具添加不了站点
  • 做网站需要公司授权嘛百度关键词优化多久上首页
  • 可以做外链的音乐网站企业推广是什么意思
  • 做采集网站难不做网站用什么编程软件
  • 进口食品销售销售在那个网站做企业网站制作步骤
  • 做外贸没有企业网站谷歌地图下载
  • 浏览器网站大全网站空间
  • ctb自己做网站电商seo什么意思
  • 免费网站安全软件互联网全网营销
  • 网推公司招聘建站优化公司
  • 2023南京疫情最新消息今天seo网络营销课程
  • 南宁网站建设公广东vs北京首钢
  • 有哪些好的网站模版全国疫情高峰感染进度查询
  • 山西太原网站建设公司吉林seo刷关键词排名优化
  • 怎样免费建公司网站短期培训班学什么好
  • 建筑网站翻译编辑十大营销案例分析
  • 5ucms怎样做网站自适应做销售最挣钱的10个行业
  • 长清区网站建设宣传seo优化代理
  • 广州市地图最新版 高清晰优化seo是什么意思
  • 淘宝做首页热点的什么网站百度网盘人工客服
  • 网站开发与系统开发百度经验官网登录