1 | /* |
---|
2 | * ---------------------------------------------------------------------- |
---|
3 | * Rappture::Field1D |
---|
4 | * This is a continuous, linear function defined by a series of |
---|
5 | * points for 1-dimensional structures. It's essentially a string |
---|
6 | * of (x,y) points where the y values can be interpolated at any |
---|
7 | * point within the range of defined values. |
---|
8 | * |
---|
9 | * ====================================================================== |
---|
10 | * AUTHOR: Michael McLennan, Purdue University |
---|
11 | * Copyright (c) 2004-2006 Purdue Research Foundation |
---|
12 | * |
---|
13 | * See the file "license.terms" for information on usage and |
---|
14 | * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
15 | * ====================================================================== |
---|
16 | */ |
---|
17 | #ifndef RPFIELD1D_H |
---|
18 | #define RPFIELD1D_H |
---|
19 | |
---|
20 | #include <RpPtr.h> |
---|
21 | #include <RpMesh1D.h> |
---|
22 | |
---|
23 | namespace Rappture { |
---|
24 | |
---|
25 | class Field1D { |
---|
26 | public: |
---|
27 | Field1D(); |
---|
28 | Field1D(const Ptr<Mesh1D>& meshPtr); |
---|
29 | Field1D(const Field1D& field); |
---|
30 | Field1D& operator=(const Field1D& field); |
---|
31 | virtual ~Field1D(); |
---|
32 | |
---|
33 | virtual int add(double x); |
---|
34 | virtual Field1D& remove(int nodeId); |
---|
35 | virtual Field1D& clear(); |
---|
36 | |
---|
37 | virtual int size() const; |
---|
38 | virtual Node1D& atNode(int pos); |
---|
39 | virtual double rangeMin() const; |
---|
40 | virtual double rangeMax() const; |
---|
41 | |
---|
42 | virtual int define(double x, double y); |
---|
43 | virtual int define(int nodeId, double y); |
---|
44 | virtual double value(double x) const; |
---|
45 | virtual double valueMin() const; |
---|
46 | virtual double valueMax() const; |
---|
47 | |
---|
48 | private: |
---|
49 | std::deque<double> _valuelist; // list of all values, in nodeId order |
---|
50 | double _vmin; // minimum value in _valuelist |
---|
51 | double _vmax; // maximum value in _valuelist |
---|
52 | Ptr<Mesh1D> _meshPtr; // mesh for all x-points |
---|
53 | int _counter; // counter for generating node IDs |
---|
54 | }; |
---|
55 | |
---|
56 | } // namespace Rappture |
---|
57 | |
---|
58 | #endif /*RPFIELD1D_H*/ |
---|