casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NBody.h
Go to the documentation of this file.
1 //# NBody.h: class which provides brute force n-body simulation and display
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef TRIALDISPLAY_NBODY_H
29 #define TRIALDISPLAY_NBODY_H
30 
31 #include <casa/aips.h>
32 #include <casa/Arrays/Vector.h>
33 #include <casa/Quanta/Quantum.h>
34 #include <casa/Containers/Record.h>
40 #include <list>
41 
42 namespace casacore{
43 
44  class Unit;
45  class IPosition;
46 }
47 
48 namespace casa { //# NAMESPACE CASA - BEGIN
49 
50  class WorldCanvas;
51  class WCResampleHandler;
52  class WorldCanvasHolder;
53  class AttributeBuffer;
54  class Attribute;
55 
56 // <summary>
57 // Simple class which provides brute force n-body simulation and display.
58 // </summary>
59 
60 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
61 // </reviewed>
62 
63 // <synopsis>
64 
65 // This class provides a simple object which can (by brute force)
66 // calculated the internal gravitational forces acting on a
67 // self-gravitating set of bodies.
68 // </synopsis>
69 
70  class NBody : public DisplayData {
71 
72  public:
73 
74  // Constructor.
75  NBody();
76 
77  // Destructor.
78  virtual ~NBody();
79 
80  // casacore::Coordinate transformations, called by the WorldCanvasHolder.
81  // <group>
84  // </group>
85 
86  // irrelevant in this part of the tree
87  virtual void setActiveImage(casacore::uInt /*zindex*/) {
88  return;
89  };
90 
91  // Routines which yield information on the axis names and units, and
92  // some miscellaneous information.
93  // <group>
96  virtual const casacore::Unit dataUnit() ;
97  virtual const casacore::RecordInterface& miscInfo() ;
98  // </group>
99 
100  // Return the number of elements in this DisplayData.
101  virtual casacore::uInt nelements(const WorldCanvasHolder& wcHolder) const;
102  virtual casacore::uInt nelements() const;
103 
104  // Add a restriction for item <src>itemNum</src> of this
105  // DisplayData.
106  // <group>
107  virtual void addElementRestrictions(const casacore::uInt itemNum,
108  AttributeBuffer& other);
109  virtual void addElementRestriction(const casacore::uInt itemNum,
110  Attribute& newRestriction,
111  casacore::Bool permanent);
112  // </group>
113 
114  // Set a restriction for item <src>itemNum</src> of this
115  // DisplayData.
116  // <group>
117  virtual void setElementRestrictions(const casacore::uInt itemNum,
118  AttributeBuffer& other);
119  virtual void setElementRestriction(const casacore::uInt itemNum,
120  Attribute& newRestriction);
121  // </group>
122 
123  // Remove a restriction from item <src>itemNum</src>.
124  virtual void removeElementRestriction(const casacore::uInt itemNum,
125  const casacore::String& name);
126 
127  // Clear all restrictions of item <src>itemNum</src> (except the
128  // ones that are permanent of course).
129  virtual void clearElementRestrictions(const casacore::uInt itemNum);
130 
131  // Check if a restriction for item <src>itemNum</src> with name
132  // <src>name</src> exists.
134  const casacore::String& name);
135 
136  // Get a handle to the buffer of restrictions for item
137  // <src>itemNum</src>. Throws an exception of type casacore::AipsError if
138  // <src>itemNum</src> is out of range.
140 
141  // Report the minimum and maximum data values for this DisplayData.
142  // <group>
143  virtual casacore::Double getDataMin();
144  virtual casacore::Double getDataMax();
145  // </group>
146 
147  // sizeControlFunction, called by the WorldCanvasHolder.
148  virtual casacore::Bool sizeControl(WorldCanvasHolder& wcHolder,
149  AttributeBuffer& holderBuf);
150 
151  // Position event handler, called by the WorldCanvasHolder.
152  virtual void positionEH(const WCPositionEvent& ev);
153 
154  // Motion event handler, called by the WorldCanvasHolder.
155  virtual void motionEH(const WCMotionEvent& ev);
156 
157  // Refresh event handler, called by the WorldCanvasHolder.
158  virtual void refreshEH(const WCRefreshEvent& ev);
159 
160  // Clean up, ie. remove cached images etc.
161  virtual void cleanup();
162 
163  // required functions with null implementations
165  return casacore::String("");
166  }
168  return casacore::String("");
169  }
171  return Display::Vector;
172  }
173 
174  private:
175 
176  void setupStars();
177  void cleanupStars();
178  void drawImage(WorldCanvas& wCanvas);
179  void setScale();
180 
181  // General restrictions (already declared in DisplayData.h)
182  // AttributeBuffer restrictions;
183  //true if nothing should be drawn by the NBody
185 
186  // The min and max to use for drawing
189 
195 
196  // internal bookkeeping:
197  // buffer for stroing sizecontrol done by this NBody
199 
200 
201  // Check if this NBody did the sizeControl
203 
204  void drawMovie(WorldCanvas& wCanvas, casacore::Int numSteps, casacore::Double timeStep,
205  casacore::Double dampingFactor);
206 
208 
209  std::list<void *> itsGalaxyList;
210 
211  };
212 
213 
214 } //# NAMESPACE CASA - END
215 
216 #endif
void drawMovie(WorldCanvas &wCanvas, casacore::Int numSteps, casacore::Double timeStep, casacore::Double dampingFactor)
casacore::Record miscInfoDummy
Definition: NBody.h:207
virtual casacore::Vector< casacore::String > worldAxisNames() const
Routines which yield information on the axis names and units, and some miscellaneous information...
int Int
Definition: aipstype.h:50
Class which stores WorldCanvas refresh event information.
DisplayDataType
WorldCanvasHolder - what type of DisplayData is this, need to know for drawing order.
Definition: DisplayEnums.h:355
Buffer for storing Attributes.
virtual casacore::String showValue(const casacore::Vector< casacore::Double > &)
casacore::Format a string containing value information at the given world coordinate ...
Definition: NBody.h:167
virtual casacore::Bool sizeControl(WorldCanvasHolder &wcHolder, AttributeBuffer &holderBuf)
sizeControlFunction, called by the WorldCanvasHolder.
casacore::Int itsYSize
Definition: NBody.h:194
casacore::Bool turnedOff
General restrictions (already declared in DisplayData.h) AttributeBuffer restrictions; true if noth...
Definition: NBody.h:184
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
casacore::Int itsNumSteps
Definition: NBody.h:192
casacore::Int itsXSize
Definition: NBody.h:193
virtual const casacore::RecordInterface & miscInfo()
Arbitrary name-value pairs used in the display classes.
Definition: Attribute.h:144
void setupStars()
casacore::Double dataMax
Definition: NBody.h:188
defines physical units
Definition: Unit.h:189
virtual void addElementRestriction(const casacore::uInt itemNum, Attribute &newRestriction, casacore::Bool permanent)
void drawImage(WorldCanvas &wCanvas)
casacore::Double itsTimeStep
Definition: NBody.h:190
casacore::Double itsDampingFactor
Definition: NBody.h:191
casacore::Double dataMin
The min and max to use for drawing.
Definition: NBody.h:187
NBody()
Constructor.
virtual void clearElementRestrictions(const casacore::uInt itemNum)
Clear all restrictions of item itemNum (except the ones that are permanent of course).
Class which stores WorldCanvas motion event information.
Definition: WCMotionEvent.h:79
virtual void positionEH(const WCPositionEvent &ev)
Position event handler, called by the WorldCanvasHolder.
double Double
Definition: aipstype.h:55
casacore::Bool iDidSizeControl(WorldCanvas &wCanvas)
Check if this NBody did the sizeControl.
AttributeBuffer sizeControlBuf
internal bookkeeping: buffer for stroing sizecontrol done by this NBody
Definition: NBody.h:198
void cleanupStars()
virtual casacore::String showPosition(const casacore::Vector< casacore::Double > &, const casacore::Bool &)
required functions with null implementations
Definition: NBody.h:164
virtual void removeElementRestriction(const casacore::uInt itemNum, const casacore::String &name)
Remove a restriction from item itemNum.
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual void setElementRestrictions(const casacore::uInt itemNum, AttributeBuffer &other)
Set a restriction for item itemNum of this DisplayData.
void setScale()
virtual void setElementRestriction(const casacore::uInt itemNum, Attribute &newRestriction)
virtual casacore::Vector< casacore::String > worldAxisUnits() const
virtual casacore::Double getDataMin()
Report the minimum and maximum data values for this DisplayData.
virtual void motionEH(const WCMotionEvent &ev)
Motion event handler, called by the WorldCanvasHolder.
virtual casacore::Bool existElementRestriction(const casacore::uInt itemNum, const casacore::String &name)
Check if a restriction for item itemNum with name name exists.
Class which stores WorldCanvas position event information.
A holder to interface between DisplayDatas and a WorldCanvas.
virtual casacore::Bool worldToLin(casacore::Vector< casacore::Double > &lin, const casacore::Vector< casacore::Double > &world)
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
virtual void setActiveImage(casacore::uInt)
irrelevant in this part of the tree
Definition: NBody.h:87
virtual void addElementRestrictions(const casacore::uInt itemNum, AttributeBuffer &other)
Add a restriction for item itemNum of this DisplayData.
casacore::Vector data - can go next
Definition: DisplayEnums.h:359
virtual ~NBody()
Destructor.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual casacore::uInt nelements() const
and non-specific
virtual Display::DisplayDataType classType()
Return the DisplayData type; used by the WorldCanvasHolder to determine the order of drawing...
Definition: NBody.h:170
Simple class which provides brute force n-body simulation and display.
Definition: NBody.h:70
virtual const casacore::Unit dataUnit()
Base class for display objects.
Definition: DisplayData.h:317
virtual casacore::Bool linToWorld(casacore::Vector< casacore::Double > &world, const casacore::Vector< casacore::Double > &lin)
casacore::Coordinate transformations, called by the WorldCanvasHolder.
Abstract base class for Record classes.
virtual void refreshEH(const WCRefreshEvent &ev)
Refresh event handler, called by the WorldCanvasHolder.
virtual AttributeBuffer * elementRestrictionBuffer(const casacore::uInt itemNum)
Get a handle to the buffer of restrictions for item itemNum.
virtual casacore::Double getDataMax()
virtual void cleanup()
Clean up, ie.
unsigned int uInt
Definition: aipstype.h:51
std::list< void * > itsGalaxyList
Definition: NBody.h:209
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42