casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Galaxy.h
Go to the documentation of this file.
1 //# Galaxy.h: Simple classes for galaxies and stars
2 //# Copyright (C) 1994,1995,1996,1997,1998,1999
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_GALAXY_H
29 #define TRIALDISPLAY_GALAXY_H
30 
31 #include <casa/aips.h>
32 #include <casa/Arrays/Vector.h>
33 #include <casa/Arrays/Matrix.h>
34 #include <list>
35 
36 namespace casa { //# NAMESPACE CASA - BEGIN
37 
38  class PixelCanvas;
39 
40 // <summary>
41 // Simple class to represent a Galaxy as a collection of Stars.
42 // </summary>
43 
44  class Galaxy {
45 
46  public:
47 
48  enum PLOT_MODE {
51  };
52 
53  // Constructor
55  casacore::Double size, casacore::uInt numStars, casacore::uInt numRings, casacore::Double inclination,
56  casacore::Double positionAngle, casacore::Int xSize, casacore::Int ySize);
57 
58  // Destructor
59  ~Galaxy();
60 
61  // Compute a new position, applying the force of the Galaxies in the List
62  // but do not update current position and velocity
63  void computeStep(std::list<void *>& galaxyList, casacore::Double timeStep,
64  casacore::Double dampingFactor = 1.0);
65 
66  // update position and velocity to new value
67  void update();
68 
69  // Compute a new position for the Stars in this Galaxy
70  void applyForceToStars(std::list<void *>& galaxyList, casacore::Double timeStep,
71  casacore::Double dampingFactor);
72 
73  // Rotate position and velocity
75 
76  // Draw the Galaxy on the PixelCanvas
77  void draw(PixelCanvas *pixelCanvas);
78 
79  // magnitude of the force for this galaxy
81 
82  // Return the Mass of the Galaxy
84 
85  // Return the position of the Galaxy
87 
88  // Return the Velocity of the Galaxy
90 
91  // Set the plot mode
93 
94  void setScale(casacore::Int xSize, casacore::Int ySize) ;
95 
96  private:
97 
98  // The mass of the Galaxy
100 
101  // its size
103 
104  // The position of the Galaxy
106 
107  // The velocity of the Galaxy
109 
110 
111  // The new computed position of the Galaxy
113 
114  // The new computed velocity of the Galaxy
116 
117  // The list of Stars in this Galaxy
118  std::list<void *> itsStarList;
119  // and an iterator for this List
120 
122  // Last offset applied to itsPosition
124  // Last offset applied to itsPosition
126 
129 
130  // Number of the draw list for the current PixelCanvas
132 
134 
136 
138  };
139 
140 // <summary>
141 // Simple class which represents a star as a point mass.
142 // </summary>
143 
144  class Star {
145 
146  public:
147 
148  // Constructor
150  casacore::Int xSize, casacore::Int ySize);
151 
152  // Destructor
153  ~Star();
154 
155  // Draw the current position on the PixelCanvas
156  void draw(PixelCanvas *pixelCanvas);
157 
158  // Compute new position by applying the forces of the Galaxies in the List
159  void applyForce(std::list<void *>& galaxyList, casacore::Double timeStep,
160  casacore::Double dampingFactor);
161 
162  // Rotate position and velocity
164 
165  // Set the plot mode
166  void setPlotMode(Galaxy::PLOT_MODE newPlotMode);
167 
168  void setScale(casacore::Int xSize, casacore::Int ySize) ;
169 
170  private:
171 
172  // Position of the Star
174  // The last drawn position of the Star
176  // Last offset applied to itsPosition
178  // Last offset applied to itsPosition
180 
181  // Velocity of the Star
183 
186 
187  // Number of the draw list for the current PixelCanvas
189 
190  // Temp to check if we are drawing on a new PixelCanvas
192 
194 
196  };
197 
198 
199 } //# NAMESPACE CASA - END
200 
201 #endif
casacore::Vector< casacore::Int > itsOffset
Last offset applied to itsPosition.
Definition: Galaxy.h:177
void applyForce(std::list< void * > &galaxyList, casacore::Double timeStep, casacore::Double dampingFactor)
Compute new position by applying the forces of the Galaxies in the List.
PixelCanvas * itsPixelCanvas
Definition: Galaxy.h:133
Simple class which represents a star as a point mass.
Definition: Galaxy.h:144
int Int
Definition: aipstype.h:50
~Star()
Destructor.
casacore::Vector< casacore::Double > & getVelocity()
Return the Velocity of the Galaxy.
casacore::Double force(casacore::Double distance)
magnitude of the force for this galaxy
Simple class to represent a Galaxy as a collection of Stars.
Definition: Galaxy.h:44
casacore::Double itsSize
its size
Definition: Galaxy.h:102
Galaxy::PLOT_MODE plotMode
Definition: Galaxy.h:135
void setScale(casacore::Int xSize, casacore::Int ySize)
Galaxy::PLOT_MODE plotMode
Definition: Galaxy.h:193
casacore::Int itsXSize
Definition: Galaxy.h:184
casacore::uInt itsDrawList
Number of the draw list for the current PixelCanvas.
Definition: Galaxy.h:131
void update()
update position and velocity to new value
void setPlotMode(Galaxy::PLOT_MODE newPlotMode)
Set the plot mode.
casacore::Vector< casacore::Int > itsPlotPosition
Last offset applied to itsPosition.
Definition: Galaxy.h:179
std::list< void * > itsStarList
The list of Stars in this Galaxy.
Definition: Galaxy.h:118
casacore::Vector< casacore::Double > itsVelocity
The velocity of the Galaxy.
Definition: Galaxy.h:108
void rotate(casacore::Matrix< casacore::Double > &rotMatrix)
Rotate position and velocity.
size_t size() const
casacore::Vector< casacore::Double > itsVelocity
Velocity of the Star.
Definition: Galaxy.h:182
void computeStep(std::list< void * > &galaxyList, casacore::Double timeStep, casacore::Double dampingFactor=1.0)
Compute a new position, applying the force of the Galaxies in the List but do not update current posi...
Star(casacore::Vector< casacore::Double > &position, casacore::Vector< casacore::Double > &velocity, casacore::Int xSize, casacore::Int ySize)
Constructor.
casacore::Int itsYSize
Definition: Galaxy.h:185
Base class defining interface to pixel-based output devices.
Definition: PixelCanvas.h:161
void rotate(casacore::Matrix< casacore::Double > &rotMatrix)
Rotate position and velocity.
casacore::Vector< casacore::Int > oldPosition
The last drawn position of the Star.
Definition: Galaxy.h:175
casacore::Vector< casacore::Double > itsPosition
The position of the Galaxy.
Definition: Galaxy.h:105
casacore::uInt itsDrawList
Number of the draw list for the current PixelCanvas.
Definition: Galaxy.h:188
casacore::Int itsYSize
Definition: Galaxy.h:128
double Double
Definition: aipstype.h:55
casacore::Vector< casacore::Double > & getPosition()
Return the position of the Galaxy.
void setScale(casacore::Int xSize, casacore::Int ySize)
casacore::Bool changedPlotMode
Definition: Galaxy.h:195
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Galaxy(casacore::Vector< casacore::Double > &position, casacore::Vector< casacore::Double > &velocity, casacore::Double mass, casacore::Double size, casacore::uInt numStars, casacore::uInt numRings, casacore::Double inclination, casacore::Double positionAngle, casacore::Int xSize, casacore::Int ySize)
Constructor.
void applyForceToStars(std::list< void * > &galaxyList, casacore::Double timeStep, casacore::Double dampingFactor)
Compute a new position for the Stars in this Galaxy.
casacore::Int itsXSize
Definition: Galaxy.h:127
casacore::Vector< casacore::Int > oldPosition
and an iterator for this List
Definition: Galaxy.h:121
casacore::Vector< casacore::Double > newVelocity
The new computed velocity of the Galaxy.
Definition: Galaxy.h:115
casacore::Vector< casacore::Double > itsPosition
Position of the Star.
Definition: Galaxy.h:173
casacore::Bool changedPlotMode
Definition: Galaxy.h:137
casacore::Vector< casacore::Int > itsPlotPosition
Last offset applied to itsPosition.
Definition: Galaxy.h:125
casacore::Double getMass()
Return the Mass of the Galaxy.
casacore::Double itsMass
The mass of the Galaxy.
Definition: Galaxy.h:99
casacore::Vector< casacore::Double > newPosition
The new computed position of the Galaxy.
Definition: Galaxy.h:112
void draw(PixelCanvas *pixelCanvas)
Draw the Galaxy on the PixelCanvas.
casacore::Vector< casacore::Int > itsOffset
Last offset applied to itsPosition.
Definition: Galaxy.h:123
~Galaxy()
Destructor.
void setPlotMode(Galaxy::PLOT_MODE plotMode)
Set the plot mode.
PixelCanvas * itsPixelCanvas
Temp to check if we are drawing on a new PixelCanvas.
Definition: Galaxy.h:191
void draw(PixelCanvas *pixelCanvas)
Draw the current position on the PixelCanvas.
unsigned int uInt
Definition: aipstype.h:51