Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
DDFieldWidget.h
Go to the documentation of this file.
1/* This file is part of MODEL, the Mechanics Of Defect Evolution Library.
2 *
3 * Copyright (C) 2011 by Giacomo Po <gpo@ucla.edu>.
4 *
5 * model is distributed without any warranty under the
6 * GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
7 */
8
9#ifndef model_DDFieldWidget_H_
10#define model_DDFieldWidget_H_
11
12#include <map>
13
14#include <Eigen/Dense>
15
16#include <memory>
17#include <QGroupBox>
18#include <QGridLayout>
19#include <QWidget>
20#include <QSpinBox>
21#include <QLineEdit>
22#include <QLabel>
23#include <QPushButton>
24#include <QComboBox>
25#include <QCheckBox>
26#include <QColorDialog>
27#include <vtkSmartPointer.h>
28#include <vtkPolyData.h>
29#include <vtkPolyDataMapper.h>
30#include <vtkActor.h>
31#include <vtkRenderer.h>
32#include <vtkGenericOpenGLRenderWindow.h>
33#include <vtkLookupTable.h>
34#include <vtkScalarBarActor.h>
35#include <vtkTextProperty.h>
36#include <vtkPointData.h>
37#include <vtkTable.h>
38#include <vtkChartXY.h>
39#include <vtkContextScene.h>
40#include <vtkContextActor.h>
41#include <vtkNamedColors.h>
42#include <vtkPlot.h>
43#include <vtkLineSource.h>
44
46#include <SimplicialMesh.h>
47#include <MeshPlane.h>
48#include <TriangularMesh.h>
50#include <Polycrystal.h>
52#include <MeshLine.h>
53
54namespace model
55{
56
58 {
59
61
65 const Eigen::Matrix<double,3,1> P;
66 const ElementType* const ele;
67 std::vector<Eigen::Matrix<double,3,1>> displacement;
68 std::vector<Eigen::Matrix<double,3,3>> stress;
69 std::vector<Eigen::Matrix<double,ClusterDynamicsParameters<3>::mSize,1>> mobileConcentration;
70 std::vector<Eigen::Matrix<double,ClusterDynamicsParameters<3>::iSize,1>> immobileClusters;
71
72 FieldDataPnt(const DefectiveCrystal<3>& defectiveCrystal,const Eigen::Matrix<double,3,1>& Pin,const ElementType* const ele_in);
73 double value(const int& valID,const std::vector<QCheckBox*>& microstructuresCheck) const;
74 void compute(const DefectiveCrystal<3>& defectiveCrystal);
75 };
76
77 struct DDLineField : public QWidget
78 /* */, public std::deque<FieldDataPnt>
79 /* */, public std::deque<double>
80 {
81 Q_OBJECT
82
84 typedef Eigen::Matrix<double,3,1> VectorDim;
85
86
87// MeshLine
88
89 public slots:
90 void resetLine();
91 void modify();
92
93 public:
94
95 QGridLayout* mainLayout;
96 QGroupBox* groupBox;
97 QLineEdit* posEdit;
98 QLineEdit* directionEdit;
99 QLineEdit* numPoinEdit;
100// QColorDialog* clrDialog;
101
102
103
104 vtkGenericOpenGLRenderWindow* const renWin;
105 vtkRenderer* const renderer;
106
107 vtkSmartPointer<vtkChartXY> chart;
108 vtkSmartPointer<vtkContextScene> chartScene;
109 vtkSmartPointer<vtkContextActor> chartActor;
110 vtkSmartPointer<vtkTable> table;
111 vtkSmartPointer<vtkNamedColors> colors;
112 vtkPlot* points;
113
114 vtkSmartPointer<vtkLineSource> lineSource;
115 vtkSmartPointer<vtkPolyDataMapper> lineMapper;
116 vtkSmartPointer<vtkActor> lineActor;
117
119 std::shared_ptr<MeshLine<3>> line;
120
121
122
123
124 DDLineField(vtkGenericOpenGLRenderWindow* const renWin_in,vtkRenderer* const renderer_in,const DefectiveCrystal<3>& defectiveCrystal_in);
125 ~DDLineField();
126 const std::deque<FieldDataPnt>& dataPnts() const;
127 std::deque<FieldDataPnt>& dataPnts();
128 const std::deque<double>& abscissa() const;
129 std::deque<double>& abscissa();
130
131 void compute(const DefectiveCrystal<3>&);
132 void plotField(const int& valID,const std::vector<QCheckBox*>& microstructuresCheck,const QComboBox* const fieldComboBox);
133
134 };
135
136 struct DDPlaneField : public QWidget
137 /* */, public TriangularMesh
138 /* */, public std::deque<FieldDataPnt>
139 {
140
141 Q_OBJECT
142
143 public:
145 typedef Eigen::Matrix<double,3,1> VectorDim;
146
147 QGridLayout* mainLayout;
148 QGroupBox* groupBox;
149
150 QLineEdit* posEdit;
151 QLineEdit* normalEdit;
152 QLineEdit* meshSizeEdit;
153
154 vtkSmartPointer<vtkPolyData> meshPolydata;
155 vtkSmartPointer<vtkPolyDataMapper> meshMapper;
156 vtkSmartPointer<vtkActor> meshActor;
157
158 vtkGenericOpenGLRenderWindow* const renWin;
159 vtkRenderer* const renderer;
161 std::shared_ptr<Plane<3>> plane;
162
163 public slots:
164 void resetPlane();
165 void modify();
166
167 public:
168 DDPlaneField(vtkGenericOpenGLRenderWindow* const renWin_in,vtkRenderer* const renderer_in,const DefectiveCrystal<3>& defectiveCrystal_in);
170 const std::deque<FieldDataPnt>& dataPnts() const;
171 std::deque<FieldDataPnt>& dataPnts();
172 void compute(const DefectiveCrystal<3>&);
173 void plotField(const int& valID,const std::vector<QCheckBox*>& microstructuresCheck,const vtkSmartPointer<vtkLookupTable>& lut);
174 };
175
176 struct DDFieldWidget : public QWidget
177 {
178
179 Q_OBJECT
180
182 typedef Eigen::Matrix<double,3,1> VectorDim;
183
184 QGridLayout* mainLayout;
185 QLabel* boxLabel;
186 QSpinBox* spinBox;
187 QGroupBox* groupBox;
188
190 QSpinBox* linesSpinBox;
191 QGroupBox* linesGroupBox;
192
193
194 QPushButton* computeButton;
195 QComboBox* fieldComboBox;
196
197 std::vector<QCheckBox*> microstructuresCheck;
198
199 QGroupBox* customScaleBox;
200 QLineEdit* minScale;
201 QLineEdit* maxScale;
202 QGroupBox* scaleBarBox;
203 vtkSmartPointer<vtkLookupTable> lut;
204 vtkSmartPointer<vtkScalarBarActor> scalarBar;
205
206 vtkGenericOpenGLRenderWindow* const renWin;
207 vtkRenderer* const renderer;
209
210 private slots:
211 void clearLayout(QLayout *layout);
212 void resetPlanes();
213 void plotField();
214
215 void resetLines();
216
217
218 public slots:
219 void compute();
220
221 public:
222
223 DDFieldWidget(vtkGenericOpenGLRenderWindow* const renWin_in,
224 vtkRenderer* const renderer_in,
225 const DefectiveCrystal<3>& defectiveCrystal_in);
226 };
227
228} // namespace model
229#endif
230
231
232
233
234
235
236
const DefectiveCrystal< 3 > & defectiveCrystal
vtkSmartPointer< vtkLookupTable > lut
DDFieldWidget(vtkGenericOpenGLRenderWindow *const renWin_in, vtkRenderer *const renderer_in, const DefectiveCrystal< 3 > &defectiveCrystal_in)
vtkRenderer *const renderer
QGroupBox * linesGroupBox
Eigen::Matrix< double, 3, 1 > VectorDim
MicrostructureBase< 3 >::ElementType ElementType
std::vector< QCheckBox * > microstructuresCheck
QGridLayout * mainLayout
QComboBox * fieldComboBox
QGroupBox * customScaleBox
vtkSmartPointer< vtkScalarBarActor > scalarBar
vtkGenericOpenGLRenderWindow *const renWin
QPushButton * computeButton
vtkSmartPointer< vtkActor > lineActor
Eigen::Matrix< double, 3, 1 > VectorDim
vtkSmartPointer< vtkContextActor > chartActor
vtkGenericOpenGLRenderWindow *const renWin
void compute(const DefectiveCrystal< 3 > &)
vtkSmartPointer< vtkTable > table
MicrostructureBase< 3 >::ElementType ElementType
vtkSmartPointer< vtkContextScene > chartScene
const std::deque< FieldDataPnt > & dataPnts() const
QLineEdit * directionEdit
void plotField(const int &valID, const std::vector< QCheckBox * > &microstructuresCheck, const QComboBox *const fieldComboBox)
const std::deque< double > & abscissa() const
QGroupBox * groupBox
vtkSmartPointer< vtkNamedColors > colors
std::shared_ptr< MeshLine< 3 > > line
vtkSmartPointer< vtkPolyDataMapper > lineMapper
QLineEdit * numPoinEdit
QLineEdit * posEdit
DDLineField(vtkGenericOpenGLRenderWindow *const renWin_in, vtkRenderer *const renderer_in, const DefectiveCrystal< 3 > &defectiveCrystal_in)
const DefectiveCrystal< 3 > & defectiveCrystal
vtkRenderer *const renderer
QGridLayout * mainLayout
vtkSmartPointer< vtkLineSource > lineSource
vtkSmartPointer< vtkChartXY > chart
void compute(const DefectiveCrystal< 3 > &)
Eigen::Matrix< double, 3, 1 > VectorDim
vtkSmartPointer< vtkActor > meshActor
void plotField(const int &valID, const std::vector< QCheckBox * > &microstructuresCheck, const vtkSmartPointer< vtkLookupTable > &lut)
const std::deque< FieldDataPnt > & dataPnts() const
std::shared_ptr< Plane< 3 > > plane
QLineEdit * meshSizeEdit
DDPlaneField(vtkGenericOpenGLRenderWindow *const renWin_in, vtkRenderer *const renderer_in, const DefectiveCrystal< 3 > &defectiveCrystal_in)
MicrostructureBase< 3 >::ElementType ElementType
const DefectiveCrystal< 3 > & defectiveCrystal
QGridLayout * mainLayout
vtkRenderer *const renderer
vtkGenericOpenGLRenderWindow *const renWin
vtkSmartPointer< vtkPolyDataMapper > meshMapper
vtkSmartPointer< vtkPolyData > meshPolydata
const SymmetricVoigtTraits< 3 > & voigtTraits
std::vector< Eigen::Matrix< double, ClusterDynamicsParameters< 3 >::iSize, 1 > > immobileClusters
MicrostructureBase< 3 >::ElementType ElementType
const ElementType *const ele
const Eigen::Matrix< double, 3, 1 > P
static constexpr int mSize
std::vector< Eigen::Matrix< double, ClusterDynamicsParameters< 3 >::mSize, 1 > > mobileConcentration
double value(const int &valID, const std::vector< QCheckBox * > &microstructuresCheck) const
std::vector< Eigen::Matrix< double, 3, 3 > > stress
FieldDataPnt(const DefectiveCrystal< 3 > &defectiveCrystal, const Eigen::Matrix< double, 3, 1 > &Pin, const ElementType *const ele_in)
std::vector< Eigen::Matrix< double, 3, 1 > > displacement
void compute(const DefectiveCrystal< 3 > &defectiveCrystal)
static constexpr int iSize
DefectiveCrystalBase< dim >::ElementType ElementType