27 return "Plugin(HarmonicToTime) takes the values in the "
28 "time steps `RealPart' and `ImaginaryPart' of "
29 "the view `View', and creates a new view "
31 "`View'[`RealPart'] * cos(p) +- `View'[`ImaginaryPart'] * sin(p)\n"
32 "with\n p = 2*Pi*k/`NumSteps', k = 0, ..., `NumSteps'-1\n"
33 "and 'NumSteps' the total number of time steps\n"
34 "over 'NumPeriods' periods at frequency 'Frequency' [Hz].\n"
35 "The '+' sign is used if `TimeSign'>0, the '-' sign otherwise.\n\n"
36 "If `View' < 0, the plugin is run on the current view.\n\n"
37 "Plugin(HarmonicToTime) creates one new list-based view.";
65 Msg::Error(
"HarmonicToTime plugin cannot be applied to multi-mesh views");
71 Msg::Error(
"Wrong real or imaginary part index");
87 int type = data1->
getType(0, ent, ele);
89 std::vector<double> *out = data2->
incrementList(numComp, type, numNodes);
90 std::vector<double> x(numNodes), y(numNodes),
z(numNodes);
91 std::vector<double> vr(numNodes * numComp), vi(numNodes * numComp);
92 for(
int nod = 0; nod < numNodes; nod++) {
93 data1->
getNode(0, ent, ele, nod, x[nod], y[nod],
z[nod]);
94 for(
int comp = 0; comp < numComp; comp++) {
95 data1->
getValue(rIndex, ent, ele, nod, comp,
96 vr[numComp * nod + comp]);
97 data1->
getValue(iIndex, ent, ele, nod, comp,
98 vi[numComp * nod + comp]);
101 for(
int nod = 0; nod < numNodes; nod++) out->push_back(x[nod]);
102 for(
int nod = 0; nod < numNodes; nod++) out->push_back(y[nod]);
103 for(
int nod = 0; nod < numNodes; nod++) out->push_back(
z[nod]);
104 for(
int k = 0; k < nSteps; k++) {
106 double p = frequency ? 2. * M_PI * nPeriods * k / nSteps : 0.;
107 for(
int nod = 0; nod < numNodes; nod++) {
108 for(
int comp = 0; comp < numComp; comp++) {
109 double val = vr[numComp * nod + comp] * cos(p) +
110 tsign * vi[numComp * nod + comp] * sin(p);
118 for(
int k = 0; k < nSteps; k++) {
120 frequency ? (2. * M_PI * nPeriods * k / frequency / (double)nSteps) : 0.;
121 data2->
Time.push_back(t);