21
void GMSH_EigenvaluesPlugin::getName(char *name) const
23
strcpy(name, "Eigenvalues");
26
void GMSH_EigenvaluesPlugin::getInfos(char *author, char *copyright, char *help_text) const
28
strcpy(author, "C. Geuzaine, J.-F. Remacle");
29
strcpy(copyright, "C. Geuzaine, J.-F. Remacle");
31
"Plugin(Eigenvalues) computes the three real\n"
22
std::string GMSH_EigenvaluesPlugin::getHelp() const
24
return "Plugin(Eigenvalues) computes the three real\n"
32
25
"eigenvalues of each tensor in the view `iView'.\n"
33
26
"If `iView' < 0, the plugin is run on the current view.\n"
35
"Plugin(Eigenvalues) creates three new scalar views.\n");
28
"Plugin(Eigenvalues) creates three new scalar views.\n";
38
31
int GMSH_EigenvaluesPlugin::getNbOptions() const
45
38
return &EigenvaluesOptions_Number[iopt];
48
void GMSH_EigenvaluesPlugin::catchErrorMessage(char *errorMessage) const
50
strcpy(errorMessage, "Eigenvalues failed...");
53
static List_T *incrementList(PViewDataList *data2, int numEdges)
56
case 0: data2->NbSP++; return data2->SP;
57
case 1: data2->NbSL++; return data2->SL;
58
case 3: data2->NbST++; return data2->ST;
59
case 4: data2->NbSQ++; return data2->SQ;
60
case 6: data2->NbSS++; return data2->SS;
61
case 12: data2->NbSH++; return data2->SH;
62
case 9: data2->NbSI++; return data2->SI;
63
case 8: data2->NbSY++; return data2->SY;
41
static std::vector<double> *incrementList(PViewDataList *data2, int type)
44
case TYPE_PNT: data2->NbSP++; return &data2->SP;
45
case TYPE_LIN: data2->NbSL++; return &data2->SL;
46
case TYPE_TRI: data2->NbST++; return &data2->ST;
47
case TYPE_QUA: data2->NbSQ++; return &data2->SQ;
48
case TYPE_TET: data2->NbSS++; return &data2->SS;
49
case TYPE_HEX: data2->NbSH++; return &data2->SH;
50
case TYPE_PRI: data2->NbSI++; return &data2->SI;
51
case TYPE_PYR: data2->NbSY++; return &data2->SY;
91
79
if(data1->skipElement(0, ent, ele)) continue;
92
80
int numComp = data1->getNumComponents(0, ent, ele);
93
81
if(numComp != 9) continue;
94
int numEdges = data1->getNumEdges(0, ent, ele);
95
List_T *outmin = incrementList(dmin, numEdges);
96
List_T *outmid = incrementList(dmid, numEdges);
97
List_T *outmax = incrementList(dmax, numEdges);
82
int type = data1->getType(0, ent, ele);
83
std::vector<double> *outmin = incrementList(dmin, type);
84
std::vector<double> *outmid = incrementList(dmid, type);
85
std::vector<double> *outmax = incrementList(dmax, type);
98
86
if(!outmin || !outmid || !outmax) continue;
99
87
int numNodes = data1->getNumNodes(0, ent, ele);
101
89
for(int nod = 0; nod < numNodes; nod++)
102
data1->getNode(0, ent, ele, nod, xyz[0][nod], xyz[1][nod], xyz[2][nod]);
90
data1->getNode(0, ent, ele, nod, xyz[0][nod], xyz[1][nod], xyz[2][nod]);
103
91
for(int i = 0; i < 3; i++){
104
for(int nod = 0; nod < numNodes; nod++){
105
List_Add(outmin, &xyz[i][nod]);
106
List_Add(outmid, &xyz[i][nod]);
107
List_Add(outmax, &xyz[i][nod]);
92
for(int nod = 0; nod < numNodes; nod++){
93
outmin->push_back(xyz[i][nod]);
94
outmid->push_back(xyz[i][nod]);
95
outmax->push_back(xyz[i][nod]);
110
98
for(int step = 0; step < data1->getNumTimeSteps(); step++){
111
for(int nod = 0; nod < numNodes; nod++){
113
for(int comp = 0; comp < numComp; comp++)
114
data1->getValue(step, ent, ele, nod, comp, val[comp]);
115
double A[3][3] = {{val[0], val[1], val[2]},
116
{val[3], val[4], val[5]},
117
{val[6], val[7], val[8]}};
119
List_Add(outmin, &w[2]);
120
List_Add(outmid, &w[1]);
121
List_Add(outmax, &w[0]);
99
for(int nod = 0; nod < numNodes; nod++){
101
for(int comp = 0; comp < numComp; comp++)
102
data1->getValue(step, ent, ele, nod, comp, val[comp]);
103
double A[3][3] = {{val[0], val[1], val[2]},
104
{val[3], val[4], val[5]},
105
{val[6], val[7], val[8]}};
107
outmin->push_back(w[2]);
108
outmid->push_back(w[1]);
109
outmax->push_back(w[0]);
127
115
for(int i = 0; i < data1->getNumTimeSteps(); i++){
128
116
double time = data1->getTime(i);
129
List_Add(dmin->Time, &time);
130
List_Add(dmid->Time, &time);
131
List_Add(dmax->Time, &time);
117
dmin->Time.push_back(time);
118
dmid->Time.push_back(time);
119
dmax->Time.push_back(time);
133
121
dmin->setName(data1->getName() + "_MinEigenvalues");
134
122
dmin->setFileName(data1->getName() + "_MinEigenvalues.pos");