~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to src/io/Value.hh

  • Committer: logg
  • Date: 2002-09-13 12:55:37 UTC
  • Revision ID: devnull@localhost-20020913125537-gz6ry1id9xsvu6np
Tailorized "2002-09-13 07:55:37 by logg"
Initial revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __VALUE_HH
 
2
#define __VALUE_HH
 
3
 
 
4
#include <stdio.h>
 
5
#include <iostream.h>
 
6
#include <assert.h>
 
7
#include <stdlib.h>
 
8
 
 
9
class Value
 
10
{
 
11
  
 
12
  friend std::ostream &operator<<(std::ostream &os, const Value &v){
 
13
 
 
14
         std::cout << "t = " << v.t << ": [";
 
15
         
 
16
         for (int i=0;i<v.size;i++)
 
17
                std::cout << " " << v.values[i];
 
18
         
 
19
         std::cout << " ]";
 
20
         return os;
 
21
  };
 
22
  
 
23
public:
 
24
 
 
25
  Value(int size);
 
26
  Value(const Value &v);
 
27
 
 
28
  ~Value();
 
29
 
 
30
  int    Size    ();
 
31
  double Time    ();
 
32
  double Get     (int pos);
 
33
  char  *Label   (int pos);
 
34
  
 
35
  void Set      (int pos, double val);
 
36
  void SetTime  (double t);
 
37
  void SetLabel (int pos, const char *string);
 
38
  
 
39
  bool Save(FILE *fp);
 
40
  bool Read(FILE *fp);
 
41
  
 
42
private:
 
43
 
 
44
  int size;
 
45
  double *values;
 
46
  char **labels;
 
47
 
 
48
  
 
49
  double t;
 
50
  
 
51
};
 
52
 
 
53
#endif