/usr/include/Gyoto/GyotoComplexAstrobj.h is in libgyoto1-dev 0.1.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | /**
* \file GyotoComplexAstrobj.h
* \brief Combine astronomical objects
*
* An astrobj made of several astrobjs
*/
/*
Copyright 2011 Thibaut Paumard, Frederic Vincent
This file is part of Gyoto.
Gyoto 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 3 of the License, or
(at your option) any later version.
Gyoto 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 Gyoto. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GyotoComplexAstrobj_H_
#define __GyotoComplexAstrobj_H_
#include <GyotoAstrobj.h>
namespace Gyoto{
namespace Astrobj {
class Complex;
}
}
/**
* \class Gyoto::Astrobj::Complex
* \brief Complex astronomical object
*
* A Gyoto::Astrobj::Generic whic contain several
* Gyoto::Astrobj::Generic instances. It is essentially a
* SmartPointer<Astrobj::Generic> array, which some methods
* around. Indeed, the operator[](size_t i) method is implemented to
* retrieve the i-th element.
*
* In an XML description, the <Astrobj> section must be unique,
* its kind is "Complex". Each sub-astrobj then appears as a
* <SubAstrobj> subsection:
* \code
* <Astrobj kind = "Complex">
* <SubAstrobj kind = "ThinInfiniteDiskBL"/>
* <SubAstrobj kind = "Star">
* <Radius> 2. </Radius>
* <Velocity> 0. 0. 0.037037 </Velocity>
* <Position> 600. 9. 1.5707999999999999741 0 </Position>
* <Spectrum kind="PowerLaw">
* <Exponent> 0 </Exponent>
* <Constant> 0.001 </Constant>
* </Spectrum>
* <Opacity kind="PowerLaw">
* <Exponent> 0 </Exponent>
* <Constant> 0.01 </Constant>
* </Opacity>
* <OpticallyThin/>
* </SubAstrobj>
* </Astrobj>
* \endcode
*
*/
class Gyoto::Astrobj::Complex : public Gyoto::Astrobj::Generic {
friend class Gyoto::SmartPointer<Gyoto::Astrobj::Complex>;
// Data :
// -----
protected:
/**
* \brief Number of objects
*/
size_t cardinal_;
/**
* \brief Array of Astrobj::Generic
*/
Gyoto::SmartPointer<Gyoto::Astrobj::Generic> * elements_;
/**
* Currently not settable, always equal to GYOTO_DEFAULT_DELTA
*/
double step_max_; ///< Maximum δ step inside the Astrobj
public:
Complex(); ///< Default constructor.
Complex(const Complex& ) ; ///< Copy constructor.
virtual Complex* clone() const; ///< "Virtual" copy constructor
/**
* Frees every SmartPointer<Astrobj::Generic> before freed the array itself.
*/
virtual ~Complex() ; ///< Destructor
// Mutators
// --------
public:
/**
* If the Astrobj::Complex itself does not have a metric already
* assigned, it takes it from the new element. Else, it sets the
* metric in the new element to its own. This ensures that all
* elements use the same metric (this heuristic is not entirely
* fool-proof, it's safer to set the metric directly in the
* Astrobj::Complex).
*/
void append(Gyoto::SmartPointer<Gyoto::Astrobj::Generic> element);
///< Add element at the end of the array.
void remove(size_t i);
///< Remove i-th element from the array.
size_t getCardinal() const;
///< Get the number of elements in the array.
void setMetric(SmartPointer<Metric::Generic> gg);
///< Set metric in each element.
public:
#ifdef GYOTO_USE_XERCES
virtual void fillElement(FactoryMessenger *fmp) const ;
virtual void setParameters(FactoryMessenger *fmp);
#endif
// Outputs
// -------
public:
/**
* Astrobj::Complex::Impact(Gyoto::Photon* ph, size_t index,
* Astrobj::Properties *data) calls the specific implementation of
* Astrobj::Generic::Impact() for each of its
* elements twice: the first time, data is set to NULL so that
* Astrobj::Complex::Impact() only knows whether each object is hit
* by the Photon. If no object is hit, return. If a single object is
* hit, call Impact() again only for this object, passing data this
* time. If several objects are hit, the Photon's trajectory is
* refined so that the step is at most step_max_ and the Impact()
* methods for each of the hit objects are called again for each
* step, passing data. It is therefore important that the
* transmission of the Photon is not touched by Impact() when
* data==NULL.
*
*/
virtual int Impact(Gyoto::Photon* ph, size_t index,
Astrobj::Properties *data=NULL) ;
///< Call Impact() for each of the elements.
/**
* This should work as expected:
* \code
* SmartPointer<Astrobj::Complex> cplx;
* SmartPointer<Astrobj::TypeA> objA;
* SmartPointer<Astrobj::TypeB> objB;
* cplx -> append(objA);
* cplx[0] = objB;
* \endcode
*/
Gyoto::SmartPointer<Gyoto::Astrobj::Generic> operator[](size_t i) ;
///< Retrieve i-th element.
Gyoto::SmartPointer<Gyoto::Astrobj::Generic> const operator[](size_t i) const;
///< Retrieve a const version of the i-th element.
};
#endif
|