summaryrefslogtreecommitdiff
path: root/post/src/trace.h
blob: 718eed5aefaa566a92d34ad8b9b21bd8dc7fe302 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
   This file is part of LPIC++, a particle-in-cell code for
   simulating the interaction of laser light with plasma.

   Copyright (C) 1994-1997 Roland Lichters

   LPIC++ is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License
   as published by the Free Software Foundation; either version 2
   of the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#ifndef TRACE_H
#define TRACE_H

#include <common.h>
#include <fstream>
#include <iomanip>
#include <string.h>
#include <parameter.h>
#include <utilities.h>
#include <ft.h>
#include <math.h>

using namespace std;

class input_trace {
private:
  char errname[filename_size];

public:

  // input from input.post:

  int region;
  int period_start;
  int period_stop;
  int screen;

  int Q_fp, Q_fm, Q_gp, Q_gm;
  int Q_ex, Q_ey, Q_ez, Q_by, Q_bz;
  int Q_Sr, Q_Pr, Q_Si, Q_Pi;
  int Q_de, Q_di, Q_jx, Q_jy, Q_jz;

  // input from arbitrary trace file and derived values
  int traces;                        // to be read from a trace file
  int steps_pp;                      // to be read from a trace file
  int periods;

  readfile rf;
  void save( parameter &p );

  input_trace( parameter &p );
};


//////////////////////////////////////////////////////////////////////////////////////////


class trace {

 private:
  input_trace input;
  FFT ft;                      // class 'Fourier Transforms'

  int region;
  int period;
  int period_start;
  int period_stop;
  int periods;
  int traces;
  float *position;            // position of traces
  int steps_pp;

  int Q;
  float **fp, **fm, **gp, **gm, **ex, **ey, **ez, **by, **bz;
  float **de, **di;
  float **jx, **jy, **jz;
  float *vector_read;

  double **power_spectrum;
  char *power_name, *trace_name;
  ofstream powerfile, tracefile;
  FILE* read_file;
  char *read_name;
  char *path;
  char errname[filename_size];

 public:
       trace          ( parameter &p );
  void read_traces    ( void );
  void transform      ( parameter &p );
  void write_transform( parameter &p, char* appendix );
  void write_traces   ( parameter &p, float** input, char* appendix );

};


#endif