fix double<complex> incompatibility

This commit is contained in:
Joachim Schoeberl 2009-08-29 09:29:09 +00:00
parent 1e8d16c1db
commit f3fd0c6bbd
2 changed files with 15 additions and 31 deletions

View File

@ -1180,7 +1180,7 @@ namespace netgen
{ {
if (usetexture == 2) if (usetexture == 2)
for (int ii = 0; ii < npt; ii++) for (int ii = 0; ii < npt; ii++)
drawelem = GetSurfValueComplex (sol, sei, pref[ii](0), pref[ii](1), scalcomp, valuesc[ii].real(), valuesc[ii].imag()); drawelem = GetSurfValueComplex (sol, sei, pref[ii](0), pref[ii](1), scalcomp, valuesc[ii]);
else else
for (int ii = 0; ii < npt; ii++) for (int ii = 0; ii < npt; ii++)
drawelem = GetSurfValue (sol, sei, pref[ii](0), pref[ii](1), scalcomp, values[ii]); drawelem = GetSurfValue (sol, sei, pref[ii](0), pref[ii](1), scalcomp, values[ii]);
@ -2791,11 +2791,9 @@ namespace netgen
bool VisualSceneSolution :: bool VisualSceneSolution ::
GetValueComplex (const SolData * data, ElementIndex elnr, GetValueComplex (const SolData * data, ElementIndex elnr,
double lam1, double lam2, double lam3, double lam1, double lam2, double lam3,
int comp, double & valr, double & vali) const int comp, complex<double> & val) const
{ {
val = 0.0;
valr = 0;
vali = 0;
bool ok = 0; bool ok = 0;
@ -2805,8 +2803,7 @@ namespace netgen
{ {
double values[20]; double values[20];
ok = data->solclass->GetValue (elnr, lam1, lam2, lam3, values); ok = data->solclass->GetValue (elnr, lam1, lam2, lam3, values);
valr = values[comp-1]; val = complex<double> (values[comp-1], values[comp]);
vali = values[comp];
return ok; return ok;
} }
default: default:
@ -2980,18 +2977,10 @@ namespace netgen
complex<double> VisualSceneSolution :: ExtractValueComplex (const SolData * data, int comp, double * values) const complex<double> VisualSceneSolution :: ExtractValueComplex (const SolData * data, int comp, double * values) const
{ {
double valr, vali;
if (!data->iscomplex) if (!data->iscomplex)
{ return values[comp-1];
valr = values[comp-1];
vali = 0;
}
else else
{ return complex<double> (values[comp-1], values[comp]);
valr = values[comp-1];
vali = values[comp];
}
return complex<double> (valr, vali);
} }
@ -3000,7 +2989,7 @@ namespace netgen
bool VisualSceneSolution :: bool VisualSceneSolution ::
GetSurfValueComplex (const SolData * data, SurfaceElementIndex selnr, GetSurfValueComplex (const SolData * data, SurfaceElementIndex selnr,
double lam1, double lam2, double lam1, double lam2,
int comp, double & valr, double & vali) const int comp, complex<double> & val) const
{ {
switch (data->soltype) switch (data->soltype)
{ {
@ -3014,15 +3003,9 @@ namespace netgen
if (ok) if (ok)
{ {
if (!data->iscomplex) if (!data->iscomplex)
{ val = values[comp-1];
valr = values[comp-1];
vali = 0;
}
else else
{ val = complex<double> (values[comp-1], values[comp]);
valr = values[comp-1];
vali = values[comp];
}
} }
return ok; return ok;
@ -4125,7 +4108,8 @@ namespace netgen
elnrs = -1; elnrs = -1;
Point<3> p[3]; Point<3> p[3];
double val[3],vali[3]; double val[3];
complex<double> valc[3];
for (int i = 0; i < trigs.Size(); i++) for (int i = 0; i < trigs.Size(); i++)
{ {
@ -4166,7 +4150,7 @@ namespace netgen
{ {
//double valr, vali; //double valr, vali;
ok = GetValueComplex (sol, trig.elnr, ploc(0), ploc(1), ploc(2), ok = GetValueComplex (sol, trig.elnr, ploc(0), ploc(1), ploc(2),
scalcomp, val[j], vali[j]); scalcomp, valc[j]);
//glTexCoord2f ( valr, vali ); //glTexCoord2f ( valr, vali );
} }
@ -4184,7 +4168,7 @@ namespace netgen
SetOpenGlColor (vals[trig.points[j].locpnr]); SetOpenGlColor (vals[trig.points[j].locpnr]);
} }
else else
glTexCoord2f ( val[j], vali[j] ); glTexCoord2f ( valc[j].real(), valc[j].imag() );
glVertex3dv (p[j]); glVertex3dv (p[j]);
} }

View File

@ -224,7 +224,7 @@ private:
bool GetValueComplex (const SolData * data, ElementIndex elnr, bool GetValueComplex (const SolData * data, ElementIndex elnr,
double lam1, double lam2, double lam3, double lam1, double lam2, double lam3,
int comp, double & valr, double & vali) const; int comp, complex<double> & val) const;
bool GetValues (const SolData * data, ElementIndex elnr, bool GetValues (const SolData * data, ElementIndex elnr,
double lam1, double lam2, double lam3, double lam1, double lam2, double lam3,
@ -245,7 +245,7 @@ private:
bool GetSurfValueComplex (const SolData * data, SurfaceElementIndex elnr, bool GetSurfValueComplex (const SolData * data, SurfaceElementIndex elnr,
double lam1, double lam2, double lam1, double lam2,
int comp, double & valr, double & vali) const; int comp, complex<double> & val) const;
bool GetSurfValues (const SolData * data, SurfaceElementIndex elnr, bool GetSurfValues (const SolData * data, SurfaceElementIndex elnr,
double lam1, double lam2, double lam1, double lam2,