OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
FieldView.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  *
7  * Visit http://people.web.psi.ch/adelmann/ for more details
8  *
9  ***************************************************************************/
10 
11 #ifndef FIELD_VIEW_H
12 #define FIELD_VIEW_H
13 
14 //----------------------------------------------------------------------
15 
16 // class FieldView
17 //
18 // The FieldView class produces object which provide a viewing port for the
19 // contents of a 2D Field through the GDL interface. A FielView object must
20 // be constructed with a 2D Field object. Thie FieldView instantiation must
21 // have the same template parameters as the Field being used to construct
22 // the FieldView object. The FieldView runs in parallel by coalescing all
23 // the Field data onto a parent node and redering from that node. The
24 // parent node may be chosen with a constructor argument (the default is
25 // process zero). For small Fields, the data may be scaled up by repeating
26 // values across pixels in the GDL window, the number of pixels to repeat
27 // for a given data point in the field can be set with the scaleX and
28 // scaleY arguments in the constructor. The minSizeX and minSizeY arguments
29 // to the constructor specifies a minimum number of pixels in the x and y
30 // direction. If the data set is small, the scale factors will be increased
31 // to the smallest integer satisfying the requirements specifiec by
32 // minSizeX and minSizeY.
33 //
34 // FieldView objects can also be constructed from 3D Fields given
35 // an axis which is considered perpendicular to the desired 2D plane
36 // of view. For 3D, the view member function requires an unsigned to
37 // specify which slice along the perpendicular axis to slice.
38 //
39 // J.V.W. Reynders - ACL/LANL July 15, 1996
40 
41 // forward declarations
42 template<class T, unsigned D> class LField;
43 template<class T, unsigned D, class M, class C> class Field;
44 template<unsigned D, class T> class UniformCartesian;
45 
46 
47 //----------------------------------------------------------------------
48 template<class T, unsigned Dim,
50  class Centering=typename Mesh::DefaultCentering>
51 class FieldView {
52 
53 public:
54 
55  // attach a 2D Field to a FieldView
57  unsigned scaleX = 4, unsigned scaleY = 4,
58  unsigned minSizeX = 200,
59  unsigned minSizeY = 200,
60  unsigned parent = 0);
61 
62  // attach a 3D Field to a FieldView
63  FieldView(unsigned sliceDim, Field<T,Dim,Mesh,Centering>& f,
64  unsigned scaleX = 4, unsigned scaleY = 4,
65  unsigned minSizeX = 200,
66  unsigned minSizeY = 200,
67  unsigned parent = 0);
68 
69  ~FieldView();
70  void void_view(int& r);
71  void void_view(unsigned, int& r);
72  int view() { int r = 0; void_view(r); return r; }
73  int view(unsigned s) { int r = 0; void_view(s,r); return r; }
74 
75 private:
76  T* Data;
77  int* MapX;
78  int* MapY;
79  int dummy;
82 
83  unsigned SliceDim; // for 3D - select the axis
84  unsigned ScaleX, ScaleY;
85  unsigned MinSizeX, MinSizeY;
86  unsigned Parent;
87  unsigned SizeX, SizeY;
88 
89  // draw all the data together onto the Parent process for viewing
90  void update_2D_data();
91  void update_3D_data(unsigned slice);
92 
93  // form map to fit the data into the viewing port
94  void init_map();
95 
96  // form map to fit the data into the viewing port
97  void void_apply_map(int& r);
98  int apply_map() { int r; void_apply_map(r); return r; }
99 
100 };
101 //----------------------------------------------------------------------
102 
103 #include "Utility/FieldView.hpp"
104 
105 #endif // FIELD_VIEW_H
106 
107 /***************************************************************************
108  * $RCSfile: FieldView.h,v $ $Author: adelmann $
109  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
110  * IPPL_VERSION_ID: $Id: FieldView.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
111  ***************************************************************************/
void void_apply_map(int &r)
Definition: FieldView.hpp:156
int * MapY
Definition: FieldView.h:78
Definition: Mesh.h:35
void update_3D_data(unsigned slice)
Definition: FieldView.hpp:242
Definition: rbendmap.h:8
void update_2D_data()
Definition: FieldView.hpp:180
T * Data
Definition: FieldView.h:76
int apply_map()
Definition: FieldView.h:98
int dummy
Definition: FieldView.h:79
unsigned ScaleX
Definition: FieldView.h:84
unsigned SliceDim
Definition: FieldView.h:83
FieldView(Field< T, Dim, Mesh, Centering > &f, unsigned scaleX=4, unsigned scaleY=4, unsigned minSizeX=200, unsigned minSizeY=200, unsigned parent=0)
Definition: FieldView.hpp:43
Definition: FFT.h:31
unsigned SizeX
Definition: FieldView.h:87
int view(unsigned s)
Definition: FieldView.h:73
int view()
Definition: FieldView.h:72
void void_view(int &r)
Definition: FieldView.hpp:123
unsigned MinSizeY
Definition: FieldView.h:85
unsigned SizeY
Definition: FieldView.h:87
void init_map()
Definition: FieldView.hpp:360
unsigned ScaleY
Definition: FieldView.h:84
LField< T, 2U > * MyLField
Definition: FieldView.h:81
unsigned Parent
Definition: FieldView.h:86
unsigned MinSizeX
Definition: FieldView.h:85
const unsigned Dim
int * MapX
Definition: FieldView.h:77
Field< T, Dim, Mesh, Centering > & MyField
Definition: FieldView.h:80