1 | /* |
---|
2 | * ---------------------------------------------------------------------- |
---|
3 | * Rappture::FieldTri2D |
---|
4 | * This is a continuous, linear function defined by a series of |
---|
5 | * points on a 2D unstructured mesh. It's a scalar field defined |
---|
6 | * in 2D space. |
---|
7 | * |
---|
8 | * ====================================================================== |
---|
9 | * AUTHOR: Michael McLennan, Purdue University |
---|
10 | * Copyright (c) 2004-2012 HUBzero Foundation, LLC |
---|
11 | * |
---|
12 | * See the file "license.terms" for information on usage and |
---|
13 | * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
14 | * ====================================================================== |
---|
15 | */ |
---|
16 | #ifndef RPFIELDTRI2D_H |
---|
17 | #define RPFIELDTRI2D_H |
---|
18 | |
---|
19 | #include <math.h> |
---|
20 | #include <vector> |
---|
21 | #include <RpPtr.h> |
---|
22 | #include <RpMeshTri2D.h> |
---|
23 | |
---|
24 | namespace Rappture { |
---|
25 | |
---|
26 | class FieldTri2D { |
---|
27 | public: |
---|
28 | FieldTri2D(); |
---|
29 | FieldTri2D(const MeshTri2D& grid); |
---|
30 | FieldTri2D(const FieldTri2D& field); |
---|
31 | FieldTri2D& operator=(const FieldTri2D& field); |
---|
32 | virtual ~FieldTri2D(); |
---|
33 | |
---|
34 | virtual int size() const; |
---|
35 | virtual Node2D& atNode(int pos); |
---|
36 | virtual double rangeMin(Axis which) const; |
---|
37 | virtual double rangeMax(Axis which) const; |
---|
38 | |
---|
39 | virtual FieldTri2D& define(int nodeId, double f); |
---|
40 | virtual double value(double x, double y, double outside=NAN) const; |
---|
41 | virtual double valueMin() const; |
---|
42 | virtual double valueMax() const; |
---|
43 | |
---|
44 | private: |
---|
45 | std::vector<double> _valuelist; // list of all values, in nodeId order |
---|
46 | double _vmin; // minimum value in _valuelist |
---|
47 | double _vmax; // maximum value in _valuelist |
---|
48 | Ptr<MeshTri2D> _meshPtr; // mesh for all (x,y) points |
---|
49 | int _counter; // counter for generating node IDs |
---|
50 | }; |
---|
51 | |
---|
52 | } // namespace Rappture |
---|
53 | |
---|
54 | #endif |
---|