27 ,mainLayout(new QGridLayout(this))
28 ,pkBox(new
controls::GroupBox(tr(
"&PK forces")))
29 ,pkScaleEdit(new QLineEdit(
"10000"))
30 ,sfBox(new
controls::GroupBox(tr(
"&stacking fault forces")))
31 ,sfScaleEdit(new QLineEdit(
"10000"))
32 ,ltBox(new
controls::GroupBox(tr(
"&line tension forces")))
33 ,ltScaleEdit(new QLineEdit(
"10000"))
34 ,velocityBox(new
controls::GroupBox(tr(
"&velocities")))
35 ,velocityScaleEdit(new QLineEdit(
"100"))
36 ,pkPolydata(vtkSmartPointer<vtkPolyData>::New())
37 ,pkGlyphs(vtkSmartPointer<vtkGlyph3D>::New())
38 ,pkMapper(vtkSmartPointer<vtkPolyDataMapper>::New())
39 ,pkActor(vtkSmartPointer<vtkActor>::New())
40 ,sfPolydata(vtkSmartPointer<vtkPolyData>::New())
41 ,sfGlyphs(vtkSmartPointer<vtkGlyph3D>::New())
42 ,sfMapper(vtkSmartPointer<vtkPolyDataMapper>::New())
43 ,sfActor(vtkSmartPointer<vtkActor>::New())
44 ,ltPolydata(vtkSmartPointer<vtkPolyData>::New())
45 ,ltGlyphs(vtkSmartPointer<vtkGlyph3D>::New())
46 ,ltMapper(vtkSmartPointer<vtkPolyDataMapper>::New())
47 ,ltActor(vtkSmartPointer<vtkActor>::New())
48 ,velocityPolydata(vtkSmartPointer<vtkPolyData>::New())
49 ,velocityGlyphs(vtkSmartPointer<vtkGlyph3D>::New())
50 ,velocityMapper(vtkSmartPointer<vtkPolyDataMapper>::New())
51 ,velocityActor(vtkSmartPointer<vtkActor>::New())
54 pkBox->setCheckable(
true);
55 pkBox->setChecked(
false);
56 pkActor->SetVisibility(
false);
57 QGridLayout *pkLayout =
new QGridLayout();
59 pkLayout, 0,
"Scale", pkScaleEdit,
60 "Display multiplier for Peach-Koehler force arrows at quadrature points. Press Enter to apply.");
61 pkBox->setToolTip(
"Show or hide Peach-Koehler force arrows at quadrature points.");
62 pkBox->setLayout(pkLayout);
64 sfBox->setCheckable(
true);
65 sfBox->setChecked(
false);
66 sfActor->SetVisibility(
false);
67 QGridLayout *sfLayout =
new QGridLayout();
69 sfLayout, 0,
"Scale", sfScaleEdit,
70 "Display multiplier for stacking-fault force arrows at quadrature points. Press Enter to apply.");
71 sfBox->setToolTip(
"Show or hide stacking-fault force arrows at quadrature points.");
72 sfBox->setLayout(sfLayout);
74 ltBox->setCheckable(
true);
75 ltBox->setChecked(
false);
76 ltActor->SetVisibility(
false);
77 QGridLayout *ltLayout =
new QGridLayout();
79 "Display multiplier for line-tension force arrows at quadrature points. Press Enter to apply.");
80 ltBox->setToolTip(
"Show or hide line-tension force arrows at quadrature points.");
81 ltBox->setLayout(ltLayout);
84 velocityBox->setCheckable(
true);
85 velocityBox->setChecked(
false);
86 velocityActor->SetVisibility(
false);
87 QGridLayout *velocityLayout =
new QGridLayout();
89 "Display multiplier for velocity arrows at quadrature points. Press Enter to apply.");
90 velocityBox->setToolTip(
"Show or hide velocity arrows at quadrature points.");
91 velocityBox->setLayout(velocityLayout);
94 mainLayout->addWidget(pkBox,0,0,1,1);
95 mainLayout->addWidget(sfBox,1,0,1,1);
96 mainLayout->addWidget(ltBox,2,0,1,1);
97 mainLayout->addWidget(velocityBox,3,0,1,1);
98 mainLayout->setRowStretch(4, 1);
100 this->setLayout(mainLayout);
102 connect(pkBox,SIGNAL(toggled(
bool)),
this, SLOT(modify()));
103 connect(pkScaleEdit,SIGNAL(returnPressed()),
this, SLOT(modify()));
104 connect(sfBox,SIGNAL(toggled(
bool)),
this, SLOT(modify()));
105 connect(sfScaleEdit,SIGNAL(returnPressed()),
this, SLOT(modify()));
106 connect(ltBox,SIGNAL(toggled(
bool)),
this, SLOT(modify()));
107 connect(ltScaleEdit,SIGNAL(returnPressed()),
this, SLOT(modify()));
108 connect(velocityBox,SIGNAL(toggled(
bool)),
this, SLOT(modify()));
109 connect(velocityScaleEdit,SIGNAL(returnPressed()),
this, SLOT(modify()));
112 pkGlyphs->SetInputData(pkPolydata);
113 pkGlyphs->SetSourceConnection(vtkSmartPointer<vtkArrowSource>::New()->GetOutputPort());
114 pkGlyphs->ScalingOn();
115 pkGlyphs->SetScaleModeToScaleByVector();
116 pkGlyphs->OrientOn();
117 pkGlyphs->ClampingOff();
118 pkGlyphs->SetVectorModeToUseVector();
119 pkGlyphs->SetIndexModeToOff();
120 pkMapper->SetInputConnection(pkGlyphs->GetOutputPort());
121 pkMapper->ScalarVisibilityOff();
122 pkActor->SetMapper(pkMapper);
123 pkActor->GetProperty()->SetColor(0.0, 0.0, 1.0);
124 renderer->AddActor(pkActor);
126 sfGlyphs->SetInputData(sfPolydata);
127 sfGlyphs->SetSourceConnection(vtkSmartPointer<vtkArrowSource>::New()->GetOutputPort());
128 sfGlyphs->ScalingOn();
129 sfGlyphs->SetScaleModeToScaleByVector();
130 sfGlyphs->OrientOn();
131 sfGlyphs->ClampingOff();
132 sfGlyphs->SetVectorModeToUseVector();
133 sfGlyphs->SetIndexModeToOff();
134 sfMapper->SetInputConnection(sfGlyphs->GetOutputPort());
135 sfMapper->ScalarVisibilityOff();
136 sfActor->SetMapper(sfMapper);
137 sfActor->GetProperty()->SetColor(0.0, 1.0, 0.0);
138 renderer->AddActor(sfActor);
140 ltGlyphs->SetInputData(ltPolydata);
141 ltGlyphs->SetSourceConnection(vtkSmartPointer<vtkArrowSource>::New()->GetOutputPort());
142 ltGlyphs->ScalingOn();
143 ltGlyphs->SetScaleModeToScaleByVector();
144 ltGlyphs->OrientOn();
145 ltGlyphs->ClampingOff();
146 ltGlyphs->SetVectorModeToUseVector();
147 ltGlyphs->SetIndexModeToOff();
148 ltMapper->SetInputConnection(ltGlyphs->GetOutputPort());
149 ltMapper->ScalarVisibilityOff();
150 ltActor->SetMapper(ltMapper);
151 ltActor->GetProperty()->SetColor(1.0, 0.0, 0.0);
152 renderer->AddActor(ltActor);
156 velocityGlyphs->SetInputData(velocityPolydata);
157 velocityGlyphs->SetSourceConnection(vtkSmartPointer<vtkArrowSource>::New()->GetOutputPort());
158 velocityGlyphs->ScalingOn();
159 velocityGlyphs->SetScaleModeToScaleByVector();
160 velocityGlyphs->OrientOn();
161 velocityGlyphs->ClampingOff();
162 velocityGlyphs->SetVectorModeToUseVector();
163 velocityGlyphs->SetIndexModeToOff();
164 velocityMapper->SetInputConnection(velocityGlyphs->GetOutputPort());
165 velocityMapper->ScalarVisibilityOff();
166 velocityActor->SetMapper(velocityMapper);
167 velocityActor->GetProperty()->SetColor(0.0, 1.0, 0.0);
168 renderer->AddActor(velocityActor);
175 std::cout<<
"Updating QuadraturePoints..."<<std::flush;
176 const auto t0= std::chrono::system_clock::now();
178 vtkSmartPointer<vtkPoints> nodePoints = vtkSmartPointer<vtkPoints>::New();
180 vtkSmartPointer<vtkDoubleArray> pkForces(vtkSmartPointer<vtkDoubleArray>::New());
181 pkForces->SetNumberOfComponents(3);
183 vtkSmartPointer<vtkDoubleArray> sfForces(vtkSmartPointer<vtkDoubleArray>::New());
184 sfForces->SetNumberOfComponents(3);
186 vtkSmartPointer<vtkDoubleArray> ltForces(vtkSmartPointer<vtkDoubleArray>::New());
187 ltForces->SetNumberOfComponents(3);
190 vtkSmartPointer<vtkDoubleArray> velocities(vtkSmartPointer<vtkDoubleArray>::New());
191 velocities->SetNumberOfComponents(3);
195 nodePoints->InsertNextPoint(qp.r.data());
196 pkForces->InsertNextTuple(qp.pkForce.data());
197 sfForces->InsertNextTuple(qp.stackingFaultForce.data());
198 ltForces->InsertNextTuple(qp.lineTensionForce.data());
199 velocities->InsertNextTuple(qp.velocity.data());
202 pkPolydata->SetPoints(nodePoints);
203 pkPolydata->GetPointData()->SetVectors(pkForces);
204 pkPolydata->Modified();
206 sfPolydata->SetPoints(nodePoints);
207 sfPolydata->GetPointData()->SetVectors(sfForces);
208 sfPolydata->Modified();
210 ltPolydata->SetPoints(nodePoints);
211 ltPolydata->GetPointData()->SetVectors(ltForces);
212 ltPolydata->Modified();
215 velocityPolydata->SetPoints(nodePoints);
216 velocityPolydata->GetPointData()->SetVectors(velocities);
217 velocityPolydata->Modified();