Я использую C ++ vtk для визуализации полей в ParaView через UnctructuredGrid.
Если я использую SetVectors дважды, VTK Напишите только последнее векторное поле. < /p>
как написать более одного данных Массив в. с двумя массивами ячеек.
paraview показывает, что файл out.vtu содержит только одну массив поля напряжения сдвига. < /p>
//VTK heaaders
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
int main () {
vtkNew points;
// Make 4 points
points->InsertNextPoint(0., 0., 0.);
points->InsertNextPoint(1., 0., 0.);
points->InsertNextPoint(1., 1, 0);
points->InsertNextPoint(0., 1., 0.);
vtkNew cellArray;
vtkNew quad;
// make single quad
quad->GetPointIds()->SetId(0, 0);
quad->GetPointIds()->SetId(1, 1);
quad->GetPointIds()->SetId(2, 2);
quad->GetPointIds()->SetId(3, 3);
cellArray->InsertNextCell(quad);
vtkNew unstructuredGrid;
unstructuredGrid->SetPoints(points);
unstructuredGrid->SetCells(VTK_QUAD, cellArray);
// Data Arrays
vtkSmartPointer Sigma = vtkSmartPointer::New();
Sigma->SetName("Normal Stress");
Sigma->SetNumberOfComponents(3);
vtkSmartPointer Tau = vtkSmartPointer::New();
Tau->SetName("Shear Stress ");
Tau->SetNumberOfComponents(3);
// insert values to arrays
Sigma->InsertNextValue(100.);
Sigma->InsertNextValue(100.);
Sigma->InsertNextValue(100.);
Tau->InsertNextValue(100.);
Tau->InsertNextValue(100.);
Tau->InsertNextValue(100.);
// insert data array to grid
unstructuredGrid->GetCellData()->SetVectors(Sigma);
// Tau will overwright sigma field
// How to fix it
unstructuredGrid->GetCellData()->SetVectors(Tau);
vtkNew writer;
writer->SetFileName("out.vtu");
writer->SetInputData(unstructuredGrid);
writer->Write();
return 0;
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... cturedgrid
Как установить несколько клеточных массивов для того же VTK VtkunstructuredGrid? ⇐ C++
Программы на C++. Форум разработчиков
1740143110
Anonymous
Я использую C ++ vtk для визуализации полей в ParaView через UnctructuredGrid.
Если я использую SetVectors дважды, VTK Напишите только последнее векторное поле. < /p>
как написать более одного данных Массив в. с двумя массивами ячеек.
paraview показывает, что файл out.vtu содержит только одну массив поля напряжения сдвига. < /p>
//VTK heaaders
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
int main () {
vtkNew points;
// Make 4 points
points->InsertNextPoint(0., 0., 0.);
points->InsertNextPoint(1., 0., 0.);
points->InsertNextPoint(1., 1, 0);
points->InsertNextPoint(0., 1., 0.);
vtkNew cellArray;
vtkNew quad;
// make single quad
quad->GetPointIds()->SetId(0, 0);
quad->GetPointIds()->SetId(1, 1);
quad->GetPointIds()->SetId(2, 2);
quad->GetPointIds()->SetId(3, 3);
cellArray->InsertNextCell(quad);
vtkNew unstructuredGrid;
unstructuredGrid->SetPoints(points);
unstructuredGrid->SetCells(VTK_QUAD, cellArray);
// Data Arrays
vtkSmartPointer Sigma = vtkSmartPointer::New();
Sigma->SetName("Normal Stress");
Sigma->SetNumberOfComponents(3);
vtkSmartPointer Tau = vtkSmartPointer::New();
Tau->SetName("Shear Stress ");
Tau->SetNumberOfComponents(3);
// insert values to arrays
Sigma->InsertNextValue(100.);
Sigma->InsertNextValue(100.);
Sigma->InsertNextValue(100.);
Tau->InsertNextValue(100.);
Tau->InsertNextValue(100.);
Tau->InsertNextValue(100.);
// insert data array to grid
unstructuredGrid->GetCellData()->SetVectors(Sigma);
// Tau will overwright sigma field
// How to fix it
unstructuredGrid->GetCellData()->SetVectors(Tau);
vtkNew writer;
writer->SetFileName("out.vtu");
writer->SetInputData(unstructuredGrid);
writer->Write();
return 0;
}
Подробнее здесь: [url]https://stackoverflow.com/questions/79454347/how-to-set-multiple-cell-array-for-same-vtk-vtkunstructuredgrid[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия