netgen/libsrc/visualization/soldata.hpp

112 lines
2.7 KiB
C++
Raw Normal View History

2009-01-13 04:40:13 +05:00
#ifndef FILE_SOLDATA
#define FILE_SOLDATA
2009-07-20 14:36:36 +06:00
namespace netgen
2009-01-13 04:40:13 +05:00
{
2009-07-20 14:36:36 +06:00
using namespace std;
2009-07-23 19:02:40 +06:00
class DLL_HEADER SolutionData
2009-07-20 14:36:36 +06:00
{
protected:
string name;
int components;
bool iscomplex;
int multidimcomponent;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
public:
SolutionData (const string & aname,
int acomponents = 1, bool aiscomplex = 0)
: name(aname), components(acomponents), iscomplex(aiscomplex)
{ ; }
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
virtual ~SolutionData ()
{ ; }
2009-01-13 04:40:13 +05:00
2010-07-19 18:00:52 +06:00
int GetComponents()
{
return components;
}
bool IsComplex()
{
return iscomplex;
}
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
virtual bool GetValue (int /* elnr */,
double /* lam1 */, double /* lam2 */, double /* lam3 */,
double * /* values */)
2010-07-19 18:00:52 +06:00
{
return false;
}
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
virtual bool GetValue (int selnr,
const double xref[], const double x[], const double dxdxref[],
2012-04-27 00:22:49 +06:00
double * values)
2010-07-19 18:00:52 +06:00
{
return GetValue (selnr, xref[0], xref[1], xref[2], values);
}
2009-01-13 04:40:13 +05:00
2012-04-27 00:22:49 +06:00
virtual bool GetMultiValue (int elnr, int facetnr, int npts,
const double * xref, int sxref,
const double * x, int sx,
const double * dxdxref, int sdxdxref,
2010-07-19 18:00:52 +06:00
double * values, int svalues)
{
bool res = false;
for (int i = 0; i < npts; i++)
res = GetValue (elnr, &xref[i*sxref], &x[i*sx], &dxdxref[i*sdxdxref], &values[i*svalues]);
return res;
}
2009-01-13 04:40:13 +05:00
2012-04-27 00:22:49 +06:00
virtual bool GetSurfValue (int /* selnr */, int facetnr,
2009-07-20 14:36:36 +06:00
double /* lam1 */, double /* lam2 */,
double * /* values */)
2010-07-19 18:00:52 +06:00
{
return false;
}
2009-01-13 04:40:13 +05:00
2012-04-27 00:22:49 +06:00
virtual bool GetSurfValue (int selnr, int facetnr,
2009-07-20 14:36:36 +06:00
const double xref[], const double x[], const double dxdxref[],
double * values)
2010-07-19 18:00:52 +06:00
{
2012-04-27 00:22:49 +06:00
return GetSurfValue (selnr, facetnr, xref[0], xref[1], values);
2010-07-19 18:00:52 +06:00
}
2009-01-13 04:40:13 +05:00
2012-04-27 00:22:49 +06:00
virtual bool GetMultiSurfValue (int selnr, int facetnr, int npts,
2009-07-20 14:36:36 +06:00
const double * xref, int sxref,
const double * x, int sx,
const double * dxdxref, int sdxdxref,
2010-07-19 18:00:52 +06:00
double * values, int svalues)
{
bool res = false;
for (int i = 0; i < npts; i++)
2012-04-27 00:22:49 +06:00
res = GetSurfValue (selnr, facetnr, &xref[i*sxref], &x[i*sx], &dxdxref[i*sdxdxref], &values[i*svalues]);
2010-07-19 18:00:52 +06:00
return res;
}
2009-01-13 04:40:13 +05:00
2011-09-06 21:26:14 +06:00
virtual int GetNumMultiDimComponents ()
{
return 1;
}
2009-07-20 14:36:36 +06:00
void SetMultiDimComponent (int mc)
2011-09-06 21:26:14 +06:00
{
if (mc >= GetNumMultiDimComponents()) mc = GetNumMultiDimComponents()-1;
if (mc < 0) mc = 0;
multidimcomponent = mc;
}
2009-07-20 14:36:36 +06:00
};
}
2009-01-13 04:40:13 +05:00
#endif