From 649d76dce7a90a15d55ec444a9d7b50f5868a6f8 Mon Sep 17 00:00:00 2001 From: Thibaut Paumard Date: Wed, 28 Sep 2016 12:21:32 +0200 Subject: [PATCH 01/11] NEXT 2016/09/28 API * New functionality: the plug-in from which each subcontractor is registered is now tracked, so that it becomes possible to look for a subcontractor matching a specific kind and plug-in. We introduce the function Gyoto::requirePlugin() in addition to Gyoto::loadPlugin(). The subcontractor signature is changed to accept a second parameter, which breaks the API. --- NEWS | 8 + doc/user_guide/GyotoManual.tex | 31 ++- include/GyotoAstrobj.h | 24 +- include/GyotoMetric.h | 20 +- include/GyotoObject.h | 22 +- include/GyotoProperty.h | 9 +- include/GyotoRegister.h | 25 +- include/GyotoSmartPointer.h | 2 +- include/GyotoSpectrometer.h | 26 +- include/GyotoSpectrum.h | 24 +- lib/Astrobj.C | 7 +- lib/ComplexAstrobj.C | 7 +- lib/ComplexSpectrometer.C | 7 +- lib/Factory.C | 12 +- lib/Makefile.am | 3 +- lib/Makefile.in | 238 +++++++++++++++--- lib/Metric.C | 11 +- lib/Object.C | 17 +- lib/Register.C | 54 +++- lib/Screen.C | 7 +- lib/Spectrometer.C | 7 +- lib/Spectrum.C | 7 +- lib/ThinDisk.C | 3 + lib/Utils.C | 13 +- .../doc/examples/gyoto_sample_metrics.py | 2 +- .../doc/examples/gyoto_sample_spectra.py | 2 +- .../doc/examples/gyoto_sample_standard.py | 2 +- .../doc/examples/gyoto_sample_thindisks.py | 2 +- plugins/python/doc/examples/test.py | 2 +- plugins/python/lib/Makefile.am | 2 +- plugins/python/lib/Makefile.in | 2 +- python/example-mpi.py | 2 +- python/example.py | 10 +- python/gyoto.i | 13 +- python/tests/test_metric.py | 2 +- python/tests/test_value.py | 2 +- python/tests_std/test_star.py | 2 +- yorick/gyoto.i | 53 ++-- yorick/gyoto_namespace.i | 2 + yorick/gyoto_utils.C | 38 +++ yorick/stdplug/gyoto_std.i | 2 +- yorick/ygyoto_private.h | 6 +- 42 files changed, 561 insertions(+), 169 deletions(-) diff --git a/NEWS b/NEWS index 1ea6ec89..c85dfde3 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +NEXT 2016/09/28 API + * New functionality: the plug-in from which each subcontractor is + registered is now tracked, so that it becomes possible to look + for a subcontractor matching a specific kind and plug-in. We + introduce the function Gyoto::requirePlugin() in addition to + Gyoto::loadPlugin(). The subcontractor signature is changed to + accept a second parameter, which breaks the API. + 1.1.0 2016/09/12 ABI 4 (5:0:0) * New functionality: provide a plug-in for writing new Metrics, Astrobjs and Spectra in Python. diff --git a/doc/user_guide/GyotoManual.tex b/doc/user_guide/GyotoManual.tex index af1b2944..64ba983d 100644 --- a/doc/user_guide/GyotoManual.tex +++ b/doc/user_guide/GyotoManual.tex @@ -1,4 +1,4 @@ -% Copyright 2014-2015 Frédéric Vincent, Thibaut Paumard +% Copyright 2014-2016 Frédéric Vincent, Thibaut Paumard % % This file is part of Gyoto. % @@ -60,7 +60,7 @@ \section*{\Huge{Quick User Guide for \texttt{GYOTO}}} % Let's enter the date manually. Need to update it at least for each % release. Use git log to find out the last change to the user manual. -\Large{Updated June 22, 2015} +\Large{Updated September 28, 2016} %\today \vspace{4cm} @@ -528,7 +528,7 @@ \subsubsection{Using} gyoto: \begin{code} import gyoto - gyoto.loadPlugin("stdplug") + gyoto.requirePlugin("stdplug") \end{code} Get help on Gyoto: \begin{code} @@ -551,7 +551,7 @@ \subsubsection{Using} for a specific Gyoto plug-in must be imported: \begin{code} import gyoto - gyoto.loadPlugin("stdplug") + gyoto.requirePlugin("stdplug") import gyoto_std st=gyoto_std.Star() \end{code} @@ -1000,15 +1000,20 @@ \subsection{Writing a C++ plug-in} A plug-in is merely a shared library which contains the object code for your new objects, plus a special initialisation function. It is loaded into memory using \texttt{dlopen()} by the function -\texttt{Gyoto::loadPlugin(char const*const name, int nofail)}, -implemented in \texttt{lib/Register.C}. The \texttt{name} argument -will be used twice: +\texttt{Gyoto::loadPlugin(char const*const name, int nofail)} (note +that the upper level function \texttt{Gyoto::requirePlugin(char + const*const name, int nofail)} should be used instead whenever +applicable), implemented in \texttt{lib/Register.C}. The \texttt{name} +argument will be used three times: \begin{itemize} \item the shared library file must be called \texttt{libgyoto-\emph{name}.\$suffix} (\texttt{\$suffix} is usually \texttt{.so} under Linux, \texttt{.dylib} under Mac OS); \item the init function for your plug-in must be called - \texttt{\_\_Gyoto\emph{name}Init}. + \texttt{\_\_Gyoto\emph{name}Init}; +\item each subcontractor registered by the init function (see below) + will be tagged with the plug-in name, so is is later possible to + search for a registered subcontractor by kind name and plugin name. \end{itemize} The role of the init function is to register subcontractors for your @@ -1028,7 +1033,8 @@ \subsection{Writing a C++ plug-in} Likewise, you could register more metrics, astrophysical objects and spectra. Other examples can be seen in the \texttt{lib/StdPlug.C} and -\texttt{lib/LorenePlug.C} files. +\texttt{lib/LorenePlug.C} files, and in the \texttt{plugins/python/} +directory. When building your plug-in, make sure \texttt{MyPlugin.C} ends up compiled with\\ \texttt{lib/Minkowski.C} (in this example) into a single @@ -1041,7 +1047,7 @@ \subsection{Writing a C++ plug-in} \item \texttt{/usr/lib/}. \end{itemize} -\GYOTO\ ships a pkg-config file (\texttt{gyoto.pc}) which stores +\GYOTO\ ships a pkg-config file (\texttt{gyoto.pc}) which contains useful build-time information such as the install prefix and the plug-in suffix. This file gets installed in the standard location, by default \texttt{/usr/local/lib/pkgconfig/gyoto.pc}. @@ -1205,7 +1211,7 @@ \subsection{Using your new plug-in} Finally, the Yorick interface (Sect.~\ref{sect:yorick}) has a function to explicitly load a \GYOTO\ plug-in at run-time: \begin{code} - > gyoto.loadPlugin("myplugin"); + > gyoto.requirePlugin("myplugin"); \end{code} Once the plug-in is loaded, your new object kinds should be registered (that's the purpose of the init function). To check that your objects @@ -1227,8 +1233,7 @@ \subsection{Using your new plug-in} The Yorick interface can load any object from an XML description, an can also initialise any object from its name: \begin{code} - > gyoto.loadPlugin("myplugin"); - > metric = gyoto.Metric("Minkowski"); + > metric = gyoto.Metric("Minkowski", "myplugin"); \end{code} If your object supports any options using the \texttt{setParameter()} method, these options can also be set from within Yorick: diff --git a/include/GyotoAstrobj.h b/include/GyotoAstrobj.h index 74fae00f..0753108f 100644 --- a/include/GyotoAstrobj.h +++ b/include/GyotoAstrobj.h @@ -6,7 +6,7 @@ */ /* - Copyright 2011-2015 Thibaut Paumard, Frederic Vincent + Copyright 2011-2016 Thibaut Paumard, Frederic Vincent This file is part of Gyoto. @@ -59,7 +59,7 @@ namespace Gyoto{ * provided so that you may not have to code anything. */ typedef SmartPointer - Subcontractor_t(Gyoto::FactoryMessenger*); + Subcontractor_t(Gyoto::FactoryMessenger*, std::string); ///< A function to build instances of a specific Astrobj::Generic sub-class /** @@ -73,8 +73,9 @@ namespace Gyoto{ * \tparam T Gyoto::Astrobj::Generic sub-class */ template SmartPointer Subcontractor - (FactoryMessenger* fmp) { + (FactoryMessenger* fmp, std::string plugin) { SmartPointer ao = new T(); + ao -> plugin(plugin) ; #ifdef GYOTO_USE_XERCES if (fmp) ao -> setParameters(fmp); #endif @@ -82,19 +83,26 @@ namespace Gyoto{ } ///< A template for Subcontractor_t functions + /// Query the Astrobj register /** * Query the Astrobj register to get the Astrobj::Subcontractor_t - * correspondig to a given kind name. This function is normally - * called only from the Factory. + * corresponding to a given kind name. This function is normally + * called only from the Factory. If plugin is specified, only a + * subcontractor matching both name and plugin will be returned, + * loading the plug-in if necessary. If plugin is the empty + * string, then the first subcontractor matching name will be + * returned, and the name of the plug-in it belongs to will be + * returned in plugin upon output. * - * \param name e.g. "Star" - * \param errmode 1 to return NULL in case of failure instead of + * \param[in] name e.g. "Star" + * \param[inout] plugin e.g. "stdplug". + * \param[in] errmode 1 to return NULL in case of failure instead of * throwing an Error. * \return pointer to the corresponding subcontractor. */ Gyoto::Astrobj::Subcontractor_t* getSubcontractor(std::string name, + std::string &plugin, int errmode = 0); - ///< Query the Astrobj register /** * Use the Astrobj::initRegister() once in your program to diff --git a/include/GyotoMetric.h b/include/GyotoMetric.h index cefef5c7..20a534e7 100644 --- a/include/GyotoMetric.h +++ b/include/GyotoMetric.h @@ -10,7 +10,7 @@ */ /* - Copyright 2011, 2013 Frederic Vincent, Thibaut Paumard + Copyright 2011, 2013, 2016 Frederic Vincent, Thibaut Paumard This file is part of Gyoto. @@ -55,7 +55,7 @@ namespace Gyoto { * Factory and Subcontractor_t function communicate through a * Gyoto::FactoryMessenger. */ - typedef SmartPointer Subcontractor_t(FactoryMessenger*); + typedef SmartPointer Subcontractor_t(FactoryMessenger*, std::string); /** @@ -67,8 +67,9 @@ namespace Gyoto { * \tparam T Sub-class of Metric::Generic */ template SmartPointer Subcontractor - (FactoryMessenger* fmp) { + (FactoryMessenger* fmp, std::string plugin) { SmartPointer gg = new T(); + gg -> plugin(plugin); #ifdef GYOTO_USE_XERCES if (fmp) gg -> setParameters(fmp); #endif @@ -79,15 +80,22 @@ namespace Gyoto { /** * Query the Metric register to get the Metric::Subcontractor_t * correspondig to a given kind name. This function is normally - * called only from the Factory. + * called only from the Factory. If plugin is specified, only a + * subcontractor matching both name and plugin will be returned, + * loading the plug-in if necessary. If plugin is the empty + * string, then the first subcontractor matching name will be + * returned, and the name of the plug-in it belongs to will be + * returned in plugin upon output. * - * \param name e.g. "KerrBL" - * \param errmode int=0. If errmode==0, failure to find a + * \param[in] name e.g. "KerrBL" + * \param[inout] plugin e.g. "stdplug". + * \param[in] errmode int=0. If errmode==0, failure to find a * registered Metric by that name is an error. Else, simply * return NULL pointer in that case. * \return pointer to the corresponding subcontractor. */ Gyoto::Metric::Subcontractor_t* getSubcontractor(std::string name, + std::string &plugin, int errmode=0); /// The Metric register diff --git a/include/GyotoObject.h b/include/GyotoObject.h index 133ad7a9..8b160026 100644 --- a/include/GyotoObject.h +++ b/include/GyotoObject.h @@ -27,6 +27,7 @@ #define __GyotoObject_H_ #include "GyotoConfig.h" +#include "GyotoSmartPointer.h" #include #include @@ -81,8 +82,12 @@ namespace Gyoto { * a compile-time error. */ #define GYOTO_OBJECT \ - static Property const properties[]; \ - virtual Property const * getProperties() const + static Property const properties[]; \ + virtual Property const * getProperties() const; \ + static const std::string builtinPluginValue; \ + virtual void plugin(std::string const & plugname); \ + virtual std::string plugin() const + /// Object with properties /** @@ -140,11 +145,22 @@ class Gyoto::Object /** * E.g. for an Astrobj, fillElement() will ensure * \code - * ... + * ... * \endcode * is written. */ std::string kind_; + + /// The plug-in that needs to be loaded to access this instance's class + /** + * E.g. for an Astrobj, fillElement() will ensure + * \code + * ... + * \endcode + * is written. + */ + std::string plugin_; + public: GYOTO_OBJECT; /** \fn virtual Property const * Object::getProperties() const diff --git a/include/GyotoProperty.h b/include/GyotoProperty.h index d3671373..9cec5a2c 100644 --- a/include/GyotoProperty.h +++ b/include/GyotoProperty.h @@ -30,6 +30,10 @@ #include #include +#ifndef GYOTO_PLUGIN +#define GYOTO_PLUGIN +#endif + namespace Gyoto { class Object; class Property; @@ -435,7 +439,10 @@ namespace Gyoto { Property(next)}; \ Gyoto::Property const * class::getProperties() const { \ return class::properties; \ - } + } \ + const std::string class::builtinPluginValue ( GYOTO_STRINGIFY(GYOTO_PLUGIN) ); \ + std::string class::plugin() const {if (plugin_ == "") return class::builtinPluginValue; return plugin_;} \ + void class::plugin(std::string const & plugname) {plugin_=plugname;} /// Property that can be set and got using standard methods /** diff --git a/include/GyotoRegister.h b/include/GyotoRegister.h index 6079bebb..1363fa47 100644 --- a/include/GyotoRegister.h +++ b/include/GyotoRegister.h @@ -81,6 +81,8 @@ namespace Gyoto { * an Gyoto::Error. */ void loadPlugin( char const * const plugname, int nofail = 0); + bool havePlugin(std::string plugname); + void requirePlugin(std::string plugname, int nofail = 0); } /** @@ -101,6 +103,8 @@ class Gyoto::Register::Entry { ///< Pointer to the Gyoto::SmartPointee::Subcontractor_t function that produces an object of this kind Register::Entry* next_; ///< Next entry in the register, or NULL + const std::string plugin_; + ///< Plug-in from which this Entry was loaded public: /** * \brief Constructor @@ -114,15 +118,30 @@ class Gyoto::Register::Entry { * \brief Get subcontractor for a given name * * Search through the register for an Entry matching name and return - * the corresponding subcontractor. + * the corresponding subcontractor. If plugin is specified, only a + * subcontractor matching both name and plugin will be returned. + * Note that Gyoto::Entry::getSubcontractor() will not load the + * plug-in for you, contrary to + * e.g. Gyoto::Metric::getSubcontractor(). If plugin is the empty + * string, then the first subcontractor matching name will be + * returned, and the name of the plug-in it belongs to will be + * returned in plugin upon output. * - * \param name Name of the kind to look for. - * \param errmode 1 if getSubContractor() should return NULL upon + * \param[in] name Name of the kind to look for. + * \param[inout] plugin e.g. "stdplug". + * \param[in] errmode 1 if getSubContractor() should return NULL upon * failure. Else a Gyoto::Error is thrown. * \return Pointer to subcontractor function. */ Gyoto::SmartPointee::Subcontractor_t* + getSubcontractor(std::string name, std::string &plugin, int errmode=0); + +#ifndef GYOTO_NO_DEPRECATED +#warning Using deprecated method signature.\ + Define GYOTO_NO_DEPRECATED to disable. +Gyoto::SmartPointee::Subcontractor_t* getSubcontractor(std::string name, int errmode=0); +#endif }; #endif diff --git a/include/GyotoSmartPointer.h b/include/GyotoSmartPointer.h index 9b65518b..e671f93f 100644 --- a/include/GyotoSmartPointer.h +++ b/include/GyotoSmartPointer.h @@ -109,7 +109,7 @@ class Gyoto::SmartPointee * Metric::Register(), Spectrum::Register(). */ typedef Gyoto::SmartPointer - Subcontractor_t(Gyoto::FactoryMessenger*); + Subcontractor_t(Gyoto::FactoryMessenger*, std::string); ///< A subcontractor builds an object upon order from the Factory }; diff --git a/include/GyotoSpectrometer.h b/include/GyotoSpectrometer.h index d30eaf16..6a1a3e05 100644 --- a/include/GyotoSpectrometer.h +++ b/include/GyotoSpectrometer.h @@ -6,7 +6,7 @@ * */ /* - Copyright 2011-2015 Thibaut Paumard + Copyright 2011-2016 Thibaut Paumard This file is part of Gyoto. @@ -93,7 +93,7 @@ namespace Gyoto{ * communicate through a Gyoto::FactoryMessenger. */ typedef SmartPointer - Subcontractor_t(Gyoto::FactoryMessenger*); + Subcontractor_t(Gyoto::FactoryMessenger*, std::string); ///< A function to build instances of a specific Astrobj::Generic sub-class /** @@ -101,15 +101,24 @@ namespace Gyoto{ * * Get the Spectrometer::Subcontractor_t correspondig to a given * kind name. This function is normally called only from the - * Gyoto::Factory. + * Gyoto::Factory. If plugin is specified, only a + * subcontractor matching both name and plugin will be returned, + * loading the plug-in if necessary. If plugin is the empty + * string, then the first subcontractor matching name will be + * returned, and the name of the plug-in it belongs to will be + * returned in plugin upon output. * - * \param name Name of the subclass to build, e.g. "Complex" or "wave". - * \param errmode If name is not registered, getSubcontractor() return NULL - * errmode==1, throws a Gyoto::Error if errmode==0. + * \param[in] name Name of the subclass to build, e.g. "Complex" + * or "wave". + * \param[inout] plugin e.g. "stdplug". + * \param errmode[in] If name is not registered, + * getSubcontractor() return NULL errmode==1, throws a + * Gyoto::Error if errmode==0. * \return pointer to the corresponding subcontractor. */ Gyoto::Spectrometer::Subcontractor_t* getSubcontractor(std::string name, - int errmode = 0); + std::string &plugin, + int errmode = 0); /** * \brief A template for Subcontractor_t functions @@ -121,8 +130,9 @@ namespace Gyoto{ * \tparam T A Spectrometer::Generic sub-class. */ template SmartPointer Subcontractor - (FactoryMessenger* fmp) { + (FactoryMessenger* fmp, std::string plugin) { SmartPointer spectro = new T(); + spectro -> plugin(plugin); #ifdef GYOTO_USE_XERCES if (fmp) spectro -> setParameters(fmp); #endif diff --git a/include/GyotoSpectrum.h b/include/GyotoSpectrum.h index 98fc16b9..252eaf6c 100644 --- a/include/GyotoSpectrum.h +++ b/include/GyotoSpectrum.h @@ -6,7 +6,7 @@ */ /* - Copyright 2011-2012 Thibaut Paumard + Copyright 2011-2016 Thibaut Paumard This file is part of Gyoto. @@ -49,7 +49,7 @@ namespace Gyoto{ * provided so that you may not have to code anything. */ typedef Gyoto::SmartPointer - Subcontractor_t(Gyoto::FactoryMessenger* fmp); + Subcontractor_t(Gyoto::FactoryMessenger* fmp, std::string); /** * \brief Subcontractor template @@ -60,8 +60,9 @@ namespace Gyoto{ * \tparam T Sub-class of Spectrum::Generic */ template SmartPointer Subcontractor - (FactoryMessenger* fmp) { + (FactoryMessenger* fmp, std::string plugin) { SmartPointer sp = new T(); + sp -> plugin(plugin) ; #ifdef GYOTO_USE_XERCES if (fmp) sp -> setParameters(fmp); #endif @@ -86,16 +87,23 @@ namespace Gyoto{ /** * Query the Spectrum register to get the Metric::Subcontractor_t * correspondig to a given kind name. This function is normally - * called only from the Factory. + * called only from the Factory. If plugin is specified, only a + * subcontractor matching both name and plugin will be returned, + * loading the plug-in if necessary. If plugin is the empty + * string, then the first subcontractor matching name will be + * returned, and the name of the plug-in it belongs to will be + * returned in plugin upon output. * - * \param name e.g. "PowerLaw" - * \param errmode int=0. If errmode==0, failure to find a + * \param[in] name e.g. "PowerLaw" + * \param[inout] plugin e.g. "stdplug". + * \param[in] errmode int=0. If errmode==0, failure to find a * registered Spectrum by that name is an error. Else, simply * return NULL pointer in that case. * \return pointer to the corresponding subcontractor. */ - Gyoto::Spectrum::Subcontractor_t* - getSubcontractor(std::string name, int errmode=0); + Gyoto::Spectrum::Subcontractor_t* getSubcontractor(std::string name, + std::string &plugin, + int errmode=0); /// The Spectrum register /** diff --git a/lib/Astrobj.C b/lib/Astrobj.C index 777d4046..5f8a4d63 100644 --- a/lib/Astrobj.C +++ b/lib/Astrobj.C @@ -1,5 +1,5 @@ /* - Copyright 2011-2015 Frederic Vincent, Thibaut Paumard + Copyright 2011-2016 Frederic Vincent, Thibaut Paumard This file is part of Gyoto. @@ -463,10 +463,11 @@ void Gyoto::Astrobj::Register(std::string name, Subcontractor_t* scp){ } Gyoto::Astrobj::Subcontractor_t* -Astrobj::getSubcontractor(std::string name, int errmode) { +Astrobj::getSubcontractor(std::string name, std::string &plugin, int errmode) { + if (plugin!="") Gyoto::requirePlugin(plugin); if (!Gyoto::Astrobj::Register_) throwError("No Astrobj kind registered!"); return (Subcontractor_t*)Gyoto::Astrobj::Register_ - -> getSubcontractor(name, errmode); + -> getSubcontractor(name, plugin, errmode); } Astrobj::Properties::Properties() : diff --git a/lib/ComplexAstrobj.C b/lib/ComplexAstrobj.C index 1fa03db0..b463521c 100644 --- a/lib/ComplexAstrobj.C +++ b/lib/ComplexAstrobj.C @@ -185,7 +185,7 @@ void Complex::setParameters(FactoryMessenger *fmp) { if (debug()) cerr << "DEBUG: in Complex::setParameters()" << endl; - string name="", content="", unit=""; + string name="", content="", unit="", plugin(""); FactoryMessenger * child = NULL; metric( fmp->metric() ); @@ -195,8 +195,9 @@ void Complex::setParameters(FactoryMessenger *fmp) { cerr << "DEBUG: Astrobj::Complex::Subcontractor(): name=" << name << endl; if (name=="SubAstrobj") { content = fmp -> getAttribute("kind"); - child = fmp -> getChild(); - append ((*Astrobj::getSubcontractor(content))(child)); + plugin = fmp -> getAttribute("plugin"); + child = fmp -> getChild(); + append ((*Astrobj::getSubcontractor(content, plugin))(child, plugin)); delete child; } else setParameter(name, content, unit); } diff --git a/lib/ComplexSpectrometer.C b/lib/ComplexSpectrometer.C index 7c2a4a73..fd136a9e 100644 --- a/lib/ComplexSpectrometer.C +++ b/lib/ComplexSpectrometer.C @@ -125,7 +125,7 @@ void Complex::setParameters(FactoryMessenger *fmp) { if (debug()) cerr << "DEBUG: in Complex::setParameters()" << endl; - string name="", content="", unit=""; + string name="", content="", unit="", plugin(""); FactoryMessenger * child = NULL; while (fmp->getNextParameter(&name, &content, &unit)) { @@ -133,8 +133,9 @@ void Complex::setParameters(FactoryMessenger *fmp) { cerr << "DEBUG: Spectrometer::Complex::Subcontractor(): name=" << name << endl; if (name=="SubSpectrometer") { content = fmp -> getAttribute("kind"); - child = fmp -> getChild(); - append ((*Spectrometer::getSubcontractor(content))(child)); + child = fmp -> getChild(); + plugin = fmp -> getAttribute("plugin"); + append ((*Spectrometer::getSubcontractor(content, plugin))(child, plugin)); delete child; } else setParameter(name, content, unit); } diff --git a/lib/Factory.C b/lib/Factory.C index 22bce3e6..d886eb22 100644 --- a/lib/Factory.C +++ b/lib/Factory.C @@ -271,12 +271,11 @@ SmartPointer Factory::metric() { } else MetricDOM = root_; string Plugin = C(MetricDOM->getAttribute(X("plugin"))); - if (Plugin != "") loadPlugin(Plugin.c_str()); string Kind = C(MetricDOM->getAttribute(X("kind"))); FactoryMessenger fm(this, MetricDOM); - gg_= (*Metric::getSubcontractor(Kind))(&fm); + gg_= (*Metric::getSubcontractor(Kind, Plugin))(&fm, Plugin); } @@ -305,14 +304,13 @@ SmartPointer Factory::astrobj(){ delete result; } string Plugin = C(tmpEl->getAttribute(X("plugin"))); - if (Plugin != "") loadPlugin(Plugin.c_str()); string AstrobjKind = Cs(tmpEl->getAttribute(X("kind"))); GYOTO_DEBUG_EXPR(AstrobjKind); FactoryMessenger fm(this, tmpEl); - obj_ = (*Astrobj::getSubcontractor(AstrobjKind))(&fm); + obj_ = (*Astrobj::getSubcontractor(AstrobjKind, Plugin))(&fm, Plugin); } return obj_; @@ -366,13 +364,12 @@ SmartPointer Factory::spectrum(){ delete result; } string Plugin = C(tmpEl->getAttribute(X("plugin"))); - if (Plugin != "") loadPlugin(Plugin.c_str()); string Kind = Cs(tmpEl->getAttribute(X("kind"))); GYOTO_DEBUG_EXPR(Kind); FactoryMessenger fm(this, tmpEl); - return (*Spectrum::getSubcontractor(Kind))(&fm); + return (*Spectrum::getSubcontractor(Kind, Plugin))(&fm, Plugin); } @@ -396,13 +393,12 @@ SmartPointer Factory::spectrometer(){ delete result; } string Plugin = C(tmpEl->getAttribute(X("plugin"))); - if (Plugin != "") loadPlugin(Plugin.c_str()); string Kind = Cs(tmpEl->getAttribute(X("kind"))); GYOTO_DEBUG_EXPR(Kind); FactoryMessenger fm(this, tmpEl); - return (*Spectrometer::getSubcontractor(Kind))(&fm); + return (*Spectrometer::getSubcontractor(Kind, Plugin))(&fm, Plugin); } diff --git a/lib/Makefile.am b/lib/Makefile.am index 46896f4b..78563f81 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -28,6 +28,7 @@ libgyoto@FEATURES@_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(VERSINFO) # STANDARD PLUGIN soverdir=$(pkglibdir)/@sovers@ sover_LTLIBRARIES = libgyoto-stdplug.la +libgyoto_stdplug_la_CPPFLAGS = $(AM_CPPFLAGS) -DGYOTO_PLUGIN=stdplug libgyoto_stdplug_la_SOURCES = KerrBL.C KerrKS.C Minkowski.C \ Star.C StarTrace.C FixedStar.C Torus.C \ PowerLawSpectrum.C BlackBodySpectrum.C \ @@ -52,7 +53,7 @@ sover_LTLIBRARIES += libgyoto-lorene.la endif libgyoto_lorene_la_SOURCES = RotStar3_1.C NumericalMetricLorene.C LorenePlug.C libgyoto_lorene_la_LDFLAGS = -module -export-dynamic $(LORENELDFLAGS) $(AM_LDFLAGS) -avoid-version -libgyoto_lorene_la_CPPFLAGS = $(AM_CPPFLAGS) $(LORENECPPFLAGS) +libgyoto_lorene_la_CPPFLAGS = $(AM_CPPFLAGS) $(LORENECPPFLAGS) -DGYOTO_PLUGIN=lorene # pkg-config file pkgconfigdir=$(libdir)/pkgconfig diff --git a/lib/Makefile.in b/lib/Makefile.in index 23d9d3a1..9f1b7258 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -157,14 +157,26 @@ libgyoto_lorene_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ $(LDFLAGS) -o $@ @HAVE_LORENE_TRUE@am_libgyoto_lorene_la_rpath = -rpath $(soverdir) libgyoto_stdplug_la_LIBADD = -am__objects_1 = PatternDisk.lo PatternDiskBB.lo DynamicalDisk.lo \ - Disk3D.lo DynamicalDisk3D.lo DirectionalDisk.lo -am_libgyoto_stdplug_la_OBJECTS = KerrBL.lo KerrKS.lo Minkowski.lo \ - Star.lo StarTrace.lo FixedStar.lo Torus.lo PowerLawSpectrum.lo \ - BlackBodySpectrum.lo ThermalBremsstrahlungSpectrum.lo \ - ComplexAstrobj.lo UniformSphere.lo PageThorneDisk.lo \ - ThinDiskPL.lo PolishDoughnut.lo ThinDiskIronLine.lo StdPlug.lo \ - $(am__objects_1) +am__objects_1 = libgyoto_stdplug_la-PatternDisk.lo \ + libgyoto_stdplug_la-PatternDiskBB.lo \ + libgyoto_stdplug_la-DynamicalDisk.lo \ + libgyoto_stdplug_la-Disk3D.lo \ + libgyoto_stdplug_la-DynamicalDisk3D.lo \ + libgyoto_stdplug_la-DirectionalDisk.lo +am_libgyoto_stdplug_la_OBJECTS = libgyoto_stdplug_la-KerrBL.lo \ + libgyoto_stdplug_la-KerrKS.lo libgyoto_stdplug_la-Minkowski.lo \ + libgyoto_stdplug_la-Star.lo libgyoto_stdplug_la-StarTrace.lo \ + libgyoto_stdplug_la-FixedStar.lo libgyoto_stdplug_la-Torus.lo \ + libgyoto_stdplug_la-PowerLawSpectrum.lo \ + libgyoto_stdplug_la-BlackBodySpectrum.lo \ + libgyoto_stdplug_la-ThermalBremsstrahlungSpectrum.lo \ + libgyoto_stdplug_la-ComplexAstrobj.lo \ + libgyoto_stdplug_la-UniformSphere.lo \ + libgyoto_stdplug_la-PageThorneDisk.lo \ + libgyoto_stdplug_la-ThinDiskPL.lo \ + libgyoto_stdplug_la-PolishDoughnut.lo \ + libgyoto_stdplug_la-ThinDiskIronLine.lo \ + libgyoto_stdplug_la-StdPlug.lo $(am__objects_1) libgyoto_stdplug_la_OBJECTS = $(am_libgyoto_stdplug_la_OBJECTS) libgyoto_stdplug_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ @@ -468,6 +480,7 @@ libgyoto@FEATURES@_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(VERSINFO) # STANDARD PLUGIN soverdir = $(pkglibdir)/@sovers@ sover_LTLIBRARIES = libgyoto-stdplug.la $(am__append_2) +libgyoto_stdplug_la_CPPFLAGS = $(AM_CPPFLAGS) -DGYOTO_PLUGIN=stdplug libgyoto_stdplug_la_SOURCES = KerrBL.C KerrKS.C Minkowski.C Star.C \ StarTrace.C FixedStar.C Torus.C PowerLawSpectrum.C \ BlackBodySpectrum.C ThermalBremsstrahlungSpectrum.C \ @@ -483,7 +496,7 @@ EXTRA_libgyoto_stdplug_la_SOURCES = $(cfitsio_stdplug_sources) libgyoto_stdplug_la_LDFLAGS = -module -export-dynamic $(AM_LDFLAGS) -avoid-version libgyoto_lorene_la_SOURCES = RotStar3_1.C NumericalMetricLorene.C LorenePlug.C libgyoto_lorene_la_LDFLAGS = -module -export-dynamic $(LORENELDFLAGS) $(AM_LDFLAGS) -avoid-version -libgyoto_lorene_la_CPPFLAGS = $(AM_CPPFLAGS) $(LORENECPPFLAGS) +libgyoto_lorene_la_CPPFLAGS = $(AM_CPPFLAGS) $(LORENECPPFLAGS) -DGYOTO_PLUGIN=lorene # pkg-config file pkgconfigdir = $(libdir)/pkgconfig @@ -613,30 +626,15 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Astrobj.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BlackBodySpectrum.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ComplexAstrobj.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ComplexSpectrometer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Converters.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DirectionalDisk.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Disk3D.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DynamicalDisk.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DynamicalDisk3D.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Factory.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FixedStar.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Functors.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Hooks.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/KerrBL.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/KerrKS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Metric.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Minkowski.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Object.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PageThorneDisk.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PatternDisk.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PatternDiskBB.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Photon.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PolishDoughnut.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PowerLawSpectrum.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Property.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Register.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Scenery.Plo@am__quote@ @@ -645,16 +643,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Spectrometer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Spectrum.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StandardAstrobj.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Star.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StarTrace.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StdPlug.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ThermalBremsstrahlungSpectrum.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ThinDisk.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ThinDiskIronLine.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ThinDiskPL.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Torus.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UniformSpectrometer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UniformSphere.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Utils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Value.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/WIP.Plo@am__quote@ @@ -663,6 +653,29 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_lorene_la-LorenePlug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_lorene_la-NumericalMetricLorene.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_lorene_la-RotStar3_1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-BlackBodySpectrum.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-ComplexAstrobj.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-DirectionalDisk.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-Disk3D.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-DynamicalDisk.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-DynamicalDisk3D.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-FixedStar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-KerrBL.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-KerrKS.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-Minkowski.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-PageThorneDisk.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-PatternDisk.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-PatternDiskBB.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-PolishDoughnut.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-PowerLawSpectrum.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-Star.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-StarTrace.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-StdPlug.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-ThermalBremsstrahlungSpectrum.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-ThinDiskIronLine.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-ThinDiskPL.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-Torus.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-UniformSphere.Plo@am__quote@ .C.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -706,6 +719,167 @@ libgyoto_lorene_la-LorenePlug.lo: LorenePlug.C @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_lorene_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_lorene_la-LorenePlug.lo `test -f 'LorenePlug.C' || echo '$(srcdir)/'`LorenePlug.C +libgyoto_stdplug_la-KerrBL.lo: KerrBL.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-KerrBL.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-KerrBL.Tpo -c -o libgyoto_stdplug_la-KerrBL.lo `test -f 'KerrBL.C' || echo '$(srcdir)/'`KerrBL.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-KerrBL.Tpo $(DEPDIR)/libgyoto_stdplug_la-KerrBL.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='KerrBL.C' object='libgyoto_stdplug_la-KerrBL.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-KerrBL.lo `test -f 'KerrBL.C' || echo '$(srcdir)/'`KerrBL.C + +libgyoto_stdplug_la-KerrKS.lo: KerrKS.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-KerrKS.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-KerrKS.Tpo -c -o libgyoto_stdplug_la-KerrKS.lo `test -f 'KerrKS.C' || echo '$(srcdir)/'`KerrKS.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-KerrKS.Tpo $(DEPDIR)/libgyoto_stdplug_la-KerrKS.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='KerrKS.C' object='libgyoto_stdplug_la-KerrKS.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-KerrKS.lo `test -f 'KerrKS.C' || echo '$(srcdir)/'`KerrKS.C + +libgyoto_stdplug_la-Minkowski.lo: Minkowski.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-Minkowski.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-Minkowski.Tpo -c -o libgyoto_stdplug_la-Minkowski.lo `test -f 'Minkowski.C' || echo '$(srcdir)/'`Minkowski.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-Minkowski.Tpo $(DEPDIR)/libgyoto_stdplug_la-Minkowski.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Minkowski.C' object='libgyoto_stdplug_la-Minkowski.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-Minkowski.lo `test -f 'Minkowski.C' || echo '$(srcdir)/'`Minkowski.C + +libgyoto_stdplug_la-Star.lo: Star.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-Star.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-Star.Tpo -c -o libgyoto_stdplug_la-Star.lo `test -f 'Star.C' || echo '$(srcdir)/'`Star.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-Star.Tpo $(DEPDIR)/libgyoto_stdplug_la-Star.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Star.C' object='libgyoto_stdplug_la-Star.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-Star.lo `test -f 'Star.C' || echo '$(srcdir)/'`Star.C + +libgyoto_stdplug_la-StarTrace.lo: StarTrace.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-StarTrace.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-StarTrace.Tpo -c -o libgyoto_stdplug_la-StarTrace.lo `test -f 'StarTrace.C' || echo '$(srcdir)/'`StarTrace.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-StarTrace.Tpo $(DEPDIR)/libgyoto_stdplug_la-StarTrace.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='StarTrace.C' object='libgyoto_stdplug_la-StarTrace.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-StarTrace.lo `test -f 'StarTrace.C' || echo '$(srcdir)/'`StarTrace.C + +libgyoto_stdplug_la-FixedStar.lo: FixedStar.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-FixedStar.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-FixedStar.Tpo -c -o libgyoto_stdplug_la-FixedStar.lo `test -f 'FixedStar.C' || echo '$(srcdir)/'`FixedStar.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-FixedStar.Tpo $(DEPDIR)/libgyoto_stdplug_la-FixedStar.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='FixedStar.C' object='libgyoto_stdplug_la-FixedStar.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-FixedStar.lo `test -f 'FixedStar.C' || echo '$(srcdir)/'`FixedStar.C + +libgyoto_stdplug_la-Torus.lo: Torus.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-Torus.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-Torus.Tpo -c -o libgyoto_stdplug_la-Torus.lo `test -f 'Torus.C' || echo '$(srcdir)/'`Torus.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-Torus.Tpo $(DEPDIR)/libgyoto_stdplug_la-Torus.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Torus.C' object='libgyoto_stdplug_la-Torus.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-Torus.lo `test -f 'Torus.C' || echo '$(srcdir)/'`Torus.C + +libgyoto_stdplug_la-PowerLawSpectrum.lo: PowerLawSpectrum.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-PowerLawSpectrum.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-PowerLawSpectrum.Tpo -c -o libgyoto_stdplug_la-PowerLawSpectrum.lo `test -f 'PowerLawSpectrum.C' || echo '$(srcdir)/'`PowerLawSpectrum.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-PowerLawSpectrum.Tpo $(DEPDIR)/libgyoto_stdplug_la-PowerLawSpectrum.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='PowerLawSpectrum.C' object='libgyoto_stdplug_la-PowerLawSpectrum.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-PowerLawSpectrum.lo `test -f 'PowerLawSpectrum.C' || echo '$(srcdir)/'`PowerLawSpectrum.C + +libgyoto_stdplug_la-BlackBodySpectrum.lo: BlackBodySpectrum.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-BlackBodySpectrum.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-BlackBodySpectrum.Tpo -c -o libgyoto_stdplug_la-BlackBodySpectrum.lo `test -f 'BlackBodySpectrum.C' || echo '$(srcdir)/'`BlackBodySpectrum.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-BlackBodySpectrum.Tpo $(DEPDIR)/libgyoto_stdplug_la-BlackBodySpectrum.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='BlackBodySpectrum.C' object='libgyoto_stdplug_la-BlackBodySpectrum.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-BlackBodySpectrum.lo `test -f 'BlackBodySpectrum.C' || echo '$(srcdir)/'`BlackBodySpectrum.C + +libgyoto_stdplug_la-ThermalBremsstrahlungSpectrum.lo: ThermalBremsstrahlungSpectrum.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-ThermalBremsstrahlungSpectrum.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-ThermalBremsstrahlungSpectrum.Tpo -c -o libgyoto_stdplug_la-ThermalBremsstrahlungSpectrum.lo `test -f 'ThermalBremsstrahlungSpectrum.C' || echo '$(srcdir)/'`ThermalBremsstrahlungSpectrum.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-ThermalBremsstrahlungSpectrum.Tpo $(DEPDIR)/libgyoto_stdplug_la-ThermalBremsstrahlungSpectrum.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ThermalBremsstrahlungSpectrum.C' object='libgyoto_stdplug_la-ThermalBremsstrahlungSpectrum.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-ThermalBremsstrahlungSpectrum.lo `test -f 'ThermalBremsstrahlungSpectrum.C' || echo '$(srcdir)/'`ThermalBremsstrahlungSpectrum.C + +libgyoto_stdplug_la-ComplexAstrobj.lo: ComplexAstrobj.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-ComplexAstrobj.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-ComplexAstrobj.Tpo -c -o libgyoto_stdplug_la-ComplexAstrobj.lo `test -f 'ComplexAstrobj.C' || echo '$(srcdir)/'`ComplexAstrobj.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-ComplexAstrobj.Tpo $(DEPDIR)/libgyoto_stdplug_la-ComplexAstrobj.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ComplexAstrobj.C' object='libgyoto_stdplug_la-ComplexAstrobj.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-ComplexAstrobj.lo `test -f 'ComplexAstrobj.C' || echo '$(srcdir)/'`ComplexAstrobj.C + +libgyoto_stdplug_la-UniformSphere.lo: UniformSphere.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-UniformSphere.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-UniformSphere.Tpo -c -o libgyoto_stdplug_la-UniformSphere.lo `test -f 'UniformSphere.C' || echo '$(srcdir)/'`UniformSphere.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-UniformSphere.Tpo $(DEPDIR)/libgyoto_stdplug_la-UniformSphere.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='UniformSphere.C' object='libgyoto_stdplug_la-UniformSphere.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-UniformSphere.lo `test -f 'UniformSphere.C' || echo '$(srcdir)/'`UniformSphere.C + +libgyoto_stdplug_la-PageThorneDisk.lo: PageThorneDisk.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-PageThorneDisk.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-PageThorneDisk.Tpo -c -o libgyoto_stdplug_la-PageThorneDisk.lo `test -f 'PageThorneDisk.C' || echo '$(srcdir)/'`PageThorneDisk.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-PageThorneDisk.Tpo $(DEPDIR)/libgyoto_stdplug_la-PageThorneDisk.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='PageThorneDisk.C' object='libgyoto_stdplug_la-PageThorneDisk.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-PageThorneDisk.lo `test -f 'PageThorneDisk.C' || echo '$(srcdir)/'`PageThorneDisk.C + +libgyoto_stdplug_la-ThinDiskPL.lo: ThinDiskPL.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-ThinDiskPL.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-ThinDiskPL.Tpo -c -o libgyoto_stdplug_la-ThinDiskPL.lo `test -f 'ThinDiskPL.C' || echo '$(srcdir)/'`ThinDiskPL.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-ThinDiskPL.Tpo $(DEPDIR)/libgyoto_stdplug_la-ThinDiskPL.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ThinDiskPL.C' object='libgyoto_stdplug_la-ThinDiskPL.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-ThinDiskPL.lo `test -f 'ThinDiskPL.C' || echo '$(srcdir)/'`ThinDiskPL.C + +libgyoto_stdplug_la-PolishDoughnut.lo: PolishDoughnut.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-PolishDoughnut.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-PolishDoughnut.Tpo -c -o libgyoto_stdplug_la-PolishDoughnut.lo `test -f 'PolishDoughnut.C' || echo '$(srcdir)/'`PolishDoughnut.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-PolishDoughnut.Tpo $(DEPDIR)/libgyoto_stdplug_la-PolishDoughnut.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='PolishDoughnut.C' object='libgyoto_stdplug_la-PolishDoughnut.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-PolishDoughnut.lo `test -f 'PolishDoughnut.C' || echo '$(srcdir)/'`PolishDoughnut.C + +libgyoto_stdplug_la-ThinDiskIronLine.lo: ThinDiskIronLine.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-ThinDiskIronLine.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-ThinDiskIronLine.Tpo -c -o libgyoto_stdplug_la-ThinDiskIronLine.lo `test -f 'ThinDiskIronLine.C' || echo '$(srcdir)/'`ThinDiskIronLine.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-ThinDiskIronLine.Tpo $(DEPDIR)/libgyoto_stdplug_la-ThinDiskIronLine.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ThinDiskIronLine.C' object='libgyoto_stdplug_la-ThinDiskIronLine.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-ThinDiskIronLine.lo `test -f 'ThinDiskIronLine.C' || echo '$(srcdir)/'`ThinDiskIronLine.C + +libgyoto_stdplug_la-StdPlug.lo: StdPlug.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-StdPlug.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-StdPlug.Tpo -c -o libgyoto_stdplug_la-StdPlug.lo `test -f 'StdPlug.C' || echo '$(srcdir)/'`StdPlug.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-StdPlug.Tpo $(DEPDIR)/libgyoto_stdplug_la-StdPlug.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='StdPlug.C' object='libgyoto_stdplug_la-StdPlug.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-StdPlug.lo `test -f 'StdPlug.C' || echo '$(srcdir)/'`StdPlug.C + +libgyoto_stdplug_la-PatternDisk.lo: PatternDisk.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-PatternDisk.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-PatternDisk.Tpo -c -o libgyoto_stdplug_la-PatternDisk.lo `test -f 'PatternDisk.C' || echo '$(srcdir)/'`PatternDisk.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-PatternDisk.Tpo $(DEPDIR)/libgyoto_stdplug_la-PatternDisk.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='PatternDisk.C' object='libgyoto_stdplug_la-PatternDisk.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-PatternDisk.lo `test -f 'PatternDisk.C' || echo '$(srcdir)/'`PatternDisk.C + +libgyoto_stdplug_la-PatternDiskBB.lo: PatternDiskBB.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-PatternDiskBB.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-PatternDiskBB.Tpo -c -o libgyoto_stdplug_la-PatternDiskBB.lo `test -f 'PatternDiskBB.C' || echo '$(srcdir)/'`PatternDiskBB.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-PatternDiskBB.Tpo $(DEPDIR)/libgyoto_stdplug_la-PatternDiskBB.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='PatternDiskBB.C' object='libgyoto_stdplug_la-PatternDiskBB.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-PatternDiskBB.lo `test -f 'PatternDiskBB.C' || echo '$(srcdir)/'`PatternDiskBB.C + +libgyoto_stdplug_la-DynamicalDisk.lo: DynamicalDisk.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-DynamicalDisk.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-DynamicalDisk.Tpo -c -o libgyoto_stdplug_la-DynamicalDisk.lo `test -f 'DynamicalDisk.C' || echo '$(srcdir)/'`DynamicalDisk.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-DynamicalDisk.Tpo $(DEPDIR)/libgyoto_stdplug_la-DynamicalDisk.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='DynamicalDisk.C' object='libgyoto_stdplug_la-DynamicalDisk.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-DynamicalDisk.lo `test -f 'DynamicalDisk.C' || echo '$(srcdir)/'`DynamicalDisk.C + +libgyoto_stdplug_la-Disk3D.lo: Disk3D.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-Disk3D.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-Disk3D.Tpo -c -o libgyoto_stdplug_la-Disk3D.lo `test -f 'Disk3D.C' || echo '$(srcdir)/'`Disk3D.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-Disk3D.Tpo $(DEPDIR)/libgyoto_stdplug_la-Disk3D.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Disk3D.C' object='libgyoto_stdplug_la-Disk3D.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-Disk3D.lo `test -f 'Disk3D.C' || echo '$(srcdir)/'`Disk3D.C + +libgyoto_stdplug_la-DynamicalDisk3D.lo: DynamicalDisk3D.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-DynamicalDisk3D.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-DynamicalDisk3D.Tpo -c -o libgyoto_stdplug_la-DynamicalDisk3D.lo `test -f 'DynamicalDisk3D.C' || echo '$(srcdir)/'`DynamicalDisk3D.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-DynamicalDisk3D.Tpo $(DEPDIR)/libgyoto_stdplug_la-DynamicalDisk3D.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='DynamicalDisk3D.C' object='libgyoto_stdplug_la-DynamicalDisk3D.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-DynamicalDisk3D.lo `test -f 'DynamicalDisk3D.C' || echo '$(srcdir)/'`DynamicalDisk3D.C + +libgyoto_stdplug_la-DirectionalDisk.lo: DirectionalDisk.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-DirectionalDisk.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-DirectionalDisk.Tpo -c -o libgyoto_stdplug_la-DirectionalDisk.lo `test -f 'DirectionalDisk.C' || echo '$(srcdir)/'`DirectionalDisk.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-DirectionalDisk.Tpo $(DEPDIR)/libgyoto_stdplug_la-DirectionalDisk.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='DirectionalDisk.C' object='libgyoto_stdplug_la-DirectionalDisk.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-DirectionalDisk.lo `test -f 'DirectionalDisk.C' || echo '$(srcdir)/'`DirectionalDisk.C + mostlyclean-libtool: -rm -f *.lo diff --git a/lib/Metric.C b/lib/Metric.C index 55ec0d46..53b0389c 100644 --- a/lib/Metric.C +++ b/lib/Metric.C @@ -1,5 +1,5 @@ /* - Copyright 2011 Frederic Vincent, Thibaut Paumard + Copyright 2011-2016 Frederic Vincent, Thibaut Paumard This file is part of Gyoto. @@ -569,9 +569,10 @@ void Gyoto::Metric::Register(std::string name, Metric::Subcontractor_t* scp) { } Metric::Subcontractor_t* -Metric::getSubcontractor(std::string name, int errmode) { +Metric::getSubcontractor(std::string name, std::string &plugin, int errmode) { + if (plugin!="") Gyoto::requirePlugin(plugin); if (!Gyoto::Metric::Register_) throwError("No Metric kind registered!"); - return (Metric::Subcontractor_t*)Gyoto::Metric::Register_ - -> getSubcontractor(name, errmode); + Metric::Subcontractor_t *sub=(Metric::Subcontractor_t*)Gyoto::Metric::Register_ + -> getSubcontractor(name, plugin, errmode); + return sub; } - diff --git a/lib/Object.C b/lib/Object.C index e730a042..d7859f86 100644 --- a/lib/Object.C +++ b/lib/Object.C @@ -42,9 +42,9 @@ GYOTO_PROPERTY_START(Gyoto::Object, "Object with properties.") GYOTO_PROPERTY_END(Object, NULL) -Gyoto::Object::Object(std::string const &name):kind_(name) {} -Gyoto::Object::Object():kind_("") {} -Gyoto::Object::Object(Object const &o):kind_(o.kind_) {} +Gyoto::Object::Object(std::string const &name):kind_(name), plugin_("") {} +Gyoto::Object::Object():kind_(""), plugin_("") {} +Gyoto::Object::Object(Object const &o):kind_(o.kind_), plugin_(o.plugin_) {} Gyoto::Object::~Object() {} @@ -320,7 +320,9 @@ void Object::fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const } void Object::fillElement(Gyoto::FactoryMessenger *fmp) const { - fmp -> setSelfAttribute("kind", kind_); + std::string plg(plugin()); + if (plg != "") fmp -> setSelfAttribute("plugin", plg); + if (kind_ != "") fmp -> setSelfAttribute("kind", kind_); Property const * prop = getProperties(); while (prop) { if (*prop) { @@ -347,6 +349,7 @@ void Object::setParameters(Gyoto::FactoryMessenger *fmp) { setParameter(name, content, unit); } else { GYOTO_DEBUG << "'" << name << "' found "<< endl; + std::string plugin(""); switch (prop->type) { case Property::metric_t: set(*prop, fmp->metric()); @@ -360,13 +363,15 @@ void Object::setParameters(Gyoto::FactoryMessenger *fmp) { case Property::spectrum_t: content = fmp -> getAttribute("kind"); child = fmp -> getChild(); - set(*prop, (*Spectrum::getSubcontractor(content))(child) ); + plugin = fmp -> getAttribute("plugin"); + set(*prop, (*Spectrum::getSubcontractor(content, plugin))(child, plugin) ); delete child; break; case Property::spectrometer_t: content = fmp -> getAttribute("kind"); child = fmp -> getChild(); - set(*prop, (*Spectrometer::getSubcontractor(content))(child) ); + plugin = fmp -> getAttribute("plugin"); + set(*prop, (*Spectrometer::getSubcontractor(content, plugin))(child, plugin) ); delete child; break; case Property::filename_t: diff --git a/lib/Register.C b/lib/Register.C index ad151e9a..9d8ce13b 100644 --- a/lib/Register.C +++ b/lib/Register.C @@ -1,5 +1,5 @@ /* - Copyright 2011-2015 Thibaut Paumard + Copyright 2011-2016 Thibaut Paumard This file is part of Gyoto. @@ -32,8 +32,22 @@ using namespace Gyoto; using namespace std; +static std::string GyotoRegisterCurrentPlugin ("built-in"); + +static std::vector GyotoRegisteredPlugins; + typedef void GyotoInitFcn(); +bool Gyoto::havePlugin(std::string name) { + for (size_t i=0; i < GyotoRegisteredPlugins.size(); ++i) + if (GyotoRegisteredPlugins[i]==name) return true; + return false; +} + +void Gyoto::requirePlugin(std::string name, int nofail) { + if (!havePlugin(name)) loadPlugin(name.c_str(), nofail); +} + void Gyoto::loadPlugin(char const*const name, int nofail) { string dlfile = "libgyoto-" ; dlfile += name ; @@ -83,7 +97,11 @@ void Gyoto::loadPlugin(char const*const name, int nofail) { } if ( (err=dlerror()) ) throwError(err); GYOTO_DEBUG << "Calling plug-in init function " << dlfunc << endl; + std::string tmp_name(GyotoRegisterCurrentPlugin); + GyotoRegisterCurrentPlugin = name; (*initfcn)(); + GyotoRegisterCurrentPlugin = tmp_name; + GyotoRegisteredPlugins.insert(GyotoRegisteredPlugins.begin(), name); GYOTO_DEBUG << "Done." << endl; } @@ -96,6 +114,8 @@ void Gyoto::Register::init(char const * cpluglist) { // This cleans and fills Spectometer::Register_ Spectrometer::initRegister(); + GyotoRegisteredPlugins.push_back(GyotoRegisterCurrentPlugin); + // Init units system Units::Init(); @@ -145,22 +165,36 @@ void Gyoto::Register::init(char const * cpluglist) { Register::Entry::Entry(std::string name, Gyoto::SmartPointee::Subcontractor_t* subcontractor, Register::Entry* next) - : name_(name), subcontractor_(subcontractor), next_(next) + : name_(name), subcontractor_(subcontractor), next_(next), plugin_(GyotoRegisterCurrentPlugin) {} Register::Entry::~Entry() { if (next_) delete next_; } +#ifndef GYOTO_NO_DEPRECATED +#warning Embedding deprecated method.\ + Define GYOTO_NO_DEPRECATED to disable. Gyoto::SmartPointee::Subcontractor_t* Register::Entry::getSubcontractor(std::string name, int errmode) { + std::string plugin(""); + return getSubcontractor(name, plugin, errmode); +} +#endif + +Gyoto::SmartPointee::Subcontractor_t* +Register::Entry::getSubcontractor(std::string name, std::string &plugin, int errmode) { # if GYOTO_DEBUG_ENABLED GYOTO_IF_DEBUG GYOTO_DEBUG_EXPR(name); GYOTO_DEBUG_EXPR(errmode); GYOTO_ENDIF_DEBUG # endif - if (name_==name) return subcontractor_; - if (next_) return next_ -> getSubcontractor(name, errmode); + bool any_plugin = (plugin == ""); + if (name_==name && (any_plugin || (plugin_ == plugin))) { + if (any_plugin) plugin=plugin_; + return subcontractor_; + } + if (next_) return next_ -> getSubcontractor(name, plugin, errmode); if (errmode) return NULL; throwError ("Unregistered kind: "+name); return NULL; // will never get there, avoid compilation warning @@ -169,21 +203,25 @@ Register::Entry::getSubcontractor(std::string name, int errmode) { void Gyoto::Register::list() { Register::Entry* entry = NULL; + cout << "List of loaded plug-ins:" << endl; + for (size_t i=0; i < GyotoRegisteredPlugins.size(); ++i) + cout << " " << GyotoRegisteredPlugins[i] << endl; + cout << "List of available Metrics:" << endl; for (entry = Metric::Register_; entry; entry = entry -> next_) - cout << " " << entry -> name_ << endl; + cout << " " << entry -> name_ << " (in plug-in: " << entry -> plugin_ << ")" << endl; cout << "List of available Astrobjs:" << endl; for (entry = Astrobj::Register_; entry; entry = entry -> next_) - cout << " " << entry -> name_ << endl; + cout << " " << entry -> name_ << " (in plug-in: " << entry -> plugin_ << ")" << endl; cout << "List of available Spectra:" << endl; for (entry = Spectrum::Register_; entry; entry = entry -> next_) - cout << " " << entry -> name_ << endl; + cout << " " << entry -> name_ << " (in plug-in: " << entry -> plugin_ << ")" << endl; cout << "List of available Spectrometers:" << endl; for (entry = Spectrometer::Register_; entry; entry = entry -> next_) - cout << " " << entry -> name_ << endl; + cout << " " << entry -> name_ << " (in plug-in: " << entry -> plugin_ << ")" << endl; } diff --git a/lib/Screen.C b/lib/Screen.C index 9bd25e28..a594c586 100644 --- a/lib/Screen.C +++ b/lib/Screen.C @@ -1248,7 +1248,7 @@ void Screen::fillProperty(Gyoto::FactoryMessenger *fmp, SmartPointer Screen::Subcontractor(FactoryMessenger* fmp) { - string name="", content="", unit="", tunit="", aunit="", dunit=""; + string name="", content="", unit="", tunit="", aunit="", dunit="", plugin(""); SmartPointer scr = new Screen(); if (!fmp) return scr; scr -> metric(fmp->metric()); @@ -1291,7 +1291,10 @@ SmartPointer Screen::Subcontractor(FactoryMessenger* fmp) { fov = atof(tc); fov_unit=unit; fov_found=1; } else if (name=="Spectrometer") { - scr -> spectrometer ((Spectrometer::getSubcontractor(fmp->getAttribute("kind")))(fmp->getChild())); + scr -> + spectrometer((Spectrometer::getSubcontractor(fmp->getAttribute("kind"), + plugin)) + (fmp->getChild(), plugin)); } else if (name=="Alpha0"){ alpha0 = atof(tc); alpha0_found=1; aunit=unit; diff --git a/lib/Spectrometer.C b/lib/Spectrometer.C index 13eca782..361f5d77 100644 --- a/lib/Spectrometer.C +++ b/lib/Spectrometer.C @@ -1,5 +1,5 @@ /* - Copyright 2011 Thibaut Paumard + Copyright 2011-2016 Thibaut Paumard This file is part of Gyoto. @@ -68,10 +68,11 @@ void Gyoto::Spectrometer::Register(std::string name, Subcontractor_t* scp){ } Gyoto::Spectrometer::Subcontractor_t* -Spectrometer::getSubcontractor(std::string name, int errmode) { +Spectrometer::getSubcontractor(std::string name, std::string &plugin, int errmode) { + if (plugin!="") Gyoto::requirePlugin(plugin); if (!Gyoto::Spectrometer::Register_) throwError("No Spectrometer kind registered!"); return (Subcontractor_t*)Gyoto::Spectrometer::Register_ - -> getSubcontractor(name, errmode); + -> getSubcontractor(name, plugin, errmode); } Generic::Generic() : diff --git a/lib/Spectrum.C b/lib/Spectrum.C index 78415751..d4f53e95 100644 --- a/lib/Spectrum.C +++ b/lib/Spectrum.C @@ -1,5 +1,5 @@ /* - Copyright 2011 Thibaut Paumard + Copyright 2011-2016 Thibaut Paumard This file is part of Gyoto. @@ -148,10 +148,11 @@ void Gyoto::Spectrum::Register(std::string name, } Spectrum::Subcontractor_t* -Spectrum::getSubcontractor(std::string name, int errmode) { +Spectrum::getSubcontractor(std::string name, std::string &plugin, int errmode) { + if (plugin!="") Gyoto::requirePlugin(plugin); if (!Gyoto::Spectrum::Register_) throwError("No Spectrum kind registered!"); return (Spectrum::Subcontractor_t*)Gyoto::Spectrum::Register_ - -> getSubcontractor(name, errmode); + -> getSubcontractor(name, plugin, errmode); } void Gyoto::Spectrum::initRegister() { diff --git a/lib/ThinDisk.C b/lib/ThinDisk.C index 56c96bf0..3f03dbbe 100644 --- a/lib/ThinDisk.C +++ b/lib/ThinDisk.C @@ -17,6 +17,9 @@ along with Gyoto. If not, see . */ +/* The subcontractor is registered by the stdplug plugin */ +#define GYOTO_PLUGIN stdplug + #include "GyotoPhoton.h" #include "GyotoThinDisk.h" #include "GyotoProperty.h" diff --git a/lib/Utils.C b/lib/Utils.C index f4755ec4..e9b75629 100644 --- a/lib/Utils.C +++ b/lib/Utils.C @@ -111,6 +111,7 @@ double Gyoto::atof(const char * str) } void Gyoto::help(std::string class_name) { + std::string plugin(""); if (class_name.substr(0, 7)=="Gyoto::") class_name=class_name.substr(7); if (class_name=="Scenery") {Scenery().help(); return;} @@ -123,19 +124,23 @@ void Gyoto::help(std::string class_name) { string nspace = class_name.substr(0, pos); class_name = class_name.substr(pos+2); if (nspace=="Astrobj") { - (*Astrobj::getSubcontractor(class_name))(NULL)->help(); + (*Astrobj::getSubcontractor(class_name, plugin)) + (NULL, plugin)->help(); return; } if (nspace=="Metric") { - (*Metric::getSubcontractor(class_name))(NULL)->help(); + (*Metric::getSubcontractor(class_name, plugin)) + (NULL, plugin)->help(); return; } if (nspace=="Spectrum") { - (*Spectrum::getSubcontractor(class_name))(NULL)->help(); + (*Spectrum::getSubcontractor(class_name, plugin)) + (NULL, plugin)->help(); return; } if (nspace=="Spectrometer") { - (*Spectrometer::getSubcontractor(class_name))(NULL)->help(); + (*Spectrometer::getSubcontractor(class_name, plugin)) + (NULL, plugin)->help(); return; } throwError("Unrecognized namespace: "+nspace); diff --git a/plugins/python/doc/examples/gyoto_sample_metrics.py b/plugins/python/doc/examples/gyoto_sample_metrics.py index 4c32c353..ce67e5b4 100644 --- a/plugins/python/doc/examples/gyoto_sample_metrics.py +++ b/plugins/python/doc/examples/gyoto_sample_metrics.py @@ -11,7 +11,7 @@ Synopsis: import gyoto - gyoto.loadPlugin("python") # or python2.7 or python3.4... + gyoto.requirePlugin("python") # or python2.7 or python3.4... gg=gyoto.Metric("Python") gg.set("Module", "gyoto_sample_metric") gg.set("Class", "Minkowski") diff --git a/plugins/python/doc/examples/gyoto_sample_spectra.py b/plugins/python/doc/examples/gyoto_sample_spectra.py index 52427dd4..eee1bdcf 100644 --- a/plugins/python/doc/examples/gyoto_sample_spectra.py +++ b/plugins/python/doc/examples/gyoto_sample_spectra.py @@ -11,7 +11,7 @@ Synopsis: import gyoto - gyoto.loadPlugin("python") # or python2.7 or python3.4... + gyoto.requirePlugin("python") # or python2.7 or python3.4... sp=gyoto.Spectrum("Python") sp.set("Module", "gyoto_sample_spectra") sp.set("Class", "PowerLaw") # or "BlackBody6000" diff --git a/plugins/python/doc/examples/gyoto_sample_standard.py b/plugins/python/doc/examples/gyoto_sample_standard.py index 36c4a64c..e01cb950 100644 --- a/plugins/python/doc/examples/gyoto_sample_standard.py +++ b/plugins/python/doc/examples/gyoto_sample_standard.py @@ -12,7 +12,7 @@ Synopsis: import gyoto - gyoto.loadPlugin("python") # or python2.7 or python3.4... + gyoto.requirePlugin("python") # or python2.7 or python3.4... sp=gyoto.Astrobj("Python::Standard") sp.set("Module", "gyoto_sample_standard") sp.set("Class", "FixedStar") diff --git a/plugins/python/doc/examples/gyoto_sample_thindisks.py b/plugins/python/doc/examples/gyoto_sample_thindisks.py index 9091ea38..caa4b972 100644 --- a/plugins/python/doc/examples/gyoto_sample_thindisks.py +++ b/plugins/python/doc/examples/gyoto_sample_thindisks.py @@ -12,7 +12,7 @@ Synopsis: import gyoto - gyoto.loadPlugin("python") # or python2.7 or python3.4... + gyoto.requirePlugin("python") # or python2.7 or python3.4... td=gyoto.Spectrum("Python::ThinDisk") td.set("Module", "gyoto_sample_thindisks") td.set("Class", "ThinDisk") diff --git a/plugins/python/doc/examples/test.py b/plugins/python/doc/examples/test.py index f91e9169..04e5f58e 100644 --- a/plugins/python/doc/examples/test.py +++ b/plugins/python/doc/examples/test.py @@ -5,7 +5,7 @@ # The name of the Gyoto plug-in that can be loaded in a given Python # session is the same as the name of the Python executable python_plugin = os.path.basename(sys.executable) -gyoto.loadPlugin(python_plugin) +gyoto.requirePlugin(python_plugin) sp=gyoto.Spectrum("Python") sp.set("Module", "gyoto_sample_spectra") diff --git a/plugins/python/lib/Makefile.am b/plugins/python/lib/Makefile.am index d66c79e2..b666068d 100644 --- a/plugins/python/lib/Makefile.am +++ b/plugins/python/lib/Makefile.am @@ -1,6 +1,6 @@ ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = -I@top_srcdir@/include -DGYOTO_NO_DEPRECATED \ - $(PYTHON_INCLUDES) $(NUMPY_CFLAGS) + $(PYTHON_INCLUDES) $(NUMPY_CFLAGS) -DGYOTO_PLUGIN=@pluginname@ AM_LDFLAGS = $(Gyoto_LDFLAGS) -module -export-dynamic \ $(PYTHON_LDFLAGS) $(PYTHON_LIBS) -avoid-version -shared AM_CXXFLAGS = $(Gyoto_CFLAGS) -DGYOTO_PREFIX=\"@prefix@\" \ diff --git a/plugins/python/lib/Makefile.in b/plugins/python/lib/Makefile.in index 6318dc3a..a30d0d9e 100644 --- a/plugins/python/lib/Makefile.in +++ b/plugins/python/lib/Makefile.in @@ -344,7 +344,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = -I@top_srcdir@/include -DGYOTO_NO_DEPRECATED \ - $(PYTHON_INCLUDES) $(NUMPY_CFLAGS) + $(PYTHON_INCLUDES) $(NUMPY_CFLAGS) -DGYOTO_PLUGIN=@pluginname@ AM_LDFLAGS = $(Gyoto_LDFLAGS) -module -export-dynamic \ $(PYTHON_LDFLAGS) $(PYTHON_LIBS) -avoid-version -shared diff --git a/python/example-mpi.py b/python/example-mpi.py index 4568bc9d..5e2d68b6 100644 --- a/python/example-mpi.py +++ b/python/example-mpi.py @@ -27,7 +27,7 @@ import matplotlib as ml import matplotlib.pyplot as plt import gyoto -gyoto.loadPlugin("stdplug") +gyoto.requirePlugin("stdplug") import gyoto_std a=gyoto.Factory("../doc/examples/example-moving-star.xml") diff --git a/python/example.py b/python/example.py index 92696e93..46f9fec9 100644 --- a/python/example.py +++ b/python/example.py @@ -27,7 +27,7 @@ import matplotlib as ml import matplotlib.pyplot as plt import gyoto -gyoto.loadPlugin("stdplug") +gyoto.requirePlugin("stdplug") import gyoto_std # Simple stuff @@ -244,8 +244,8 @@ # Any derived class can be instantiated from its name, as soon as the # corresponding plug-in has been loaded into Gyoto. The standard # plug-in is normally loaded automatically, but this can also be -# forced with gyoto.loadPlugin(): -gyoto.loadPlugin('stdplug') +# forced with gyoto.requirePlugin(): +gyoto.requirePlugin('stdplug') tt=gyoto.Astrobj('Torus') kerr=gyoto.Metric('KerrBL') @@ -263,10 +263,10 @@ # However, we also have Python extensions around the standard Gyoto # plug-ins. Beware that the plug-in must be loaded into Gyoto before # importing the corresponding Python extension: -gyoto.loadPlugin('stdplug') +gyoto.requirePlugin('stdplug') import gyoto_std # And if the lorene plug-in has been compiled: -# gyoto.loadPlugin('lorene') +# gyoto.requirePlugin('lorene') # import gyoto_lorene # It then becomes possible to access the methods specific to derived diff --git a/python/gyoto.i b/python/gyoto.i index 11ffd088..c1353254 100644 --- a/python/gyoto.i +++ b/python/gyoto.i @@ -132,7 +132,7 @@ Gyoto::SmartPointer, gtype * { // Need to mark the base classes as "notabstract" to extend them with // a down-cast constructor %feature("notabstract") Gyoto::klass::Generic; -// Ignore all the actual constructors are these classes are really abstract +// Ignore all the actual constructors as these classes are really abstract %ignore Gyoto::klass::Generic::Generic(Gyoto::klass::Generic const &); %ignore Gyoto::klass::Generic::Generic(const Generic &); %ignore Gyoto::klass::Generic::Generic(const klass::Generic &); @@ -140,11 +140,20 @@ Gyoto::SmartPointer, gtype * { %ignore Gyoto::klass::Generic::Generic(double); %ignore Gyoto::klass::Generic::Generic(kind_t); %ignore Gyoto::klass::Generic::Generic(const std::string); +%ignore Gyoto::klass::Generic::Generic(const int, const std::string &); // Make a pseudo constructor for down-casting. %extend Gyoto::klass::Generic { Generic(std::string nm) { + std::string plugin; Gyoto::SmartPointer pres= - Gyoto::klass::getSubcontractor(nm.c_str())(NULL); + Gyoto::klass::getSubcontractor(nm.c_str(), plugin)(NULL, plugin); + Gyoto::klass::Generic * res = (Gyoto::klass::Generic *)(pres); + if (res) res -> incRefCount(); + return res; + } + Generic(std::string nm, std::string &plugin) { + Gyoto::SmartPointer pres= + Gyoto::klass::getSubcontractor(nm.c_str(), plugin)(NULL, plugin); Gyoto::klass::Generic * res = (Gyoto::klass::Generic *)(pres); if (res) res -> incRefCount(); return res; diff --git a/python/tests/test_metric.py b/python/tests/test_metric.py index d76caeb8..0b2ea144 100644 --- a/python/tests/test_metric.py +++ b/python/tests/test_metric.py @@ -2,7 +2,7 @@ import gyoto import numpy -gyoto.loadPlugin('stdplug') +gyoto.requirePlugin('stdplug') class TestMetric(unittest.TestCase): diff --git a/python/tests/test_value.py b/python/tests/test_value.py index 3bc623a0..012622d1 100644 --- a/python/tests/test_value.py +++ b/python/tests/test_value.py @@ -1,6 +1,6 @@ import unittest import gyoto -gyoto.loadPlugin("stdplug") +gyoto.requirePlugin("stdplug") class TestValue(unittest.TestCase): diff --git a/python/tests_std/test_star.py b/python/tests_std/test_star.py index 936104c9..7415f497 100644 --- a/python/tests_std/test_star.py +++ b/python/tests_std/test_star.py @@ -1,7 +1,7 @@ import numpy import unittest import gyoto -gyoto.loadPlugin('stdplug') +gyoto.requirePlugin('stdplug') import gyoto_std class TestStar(unittest.TestCase): diff --git a/yorick/gyoto.i b/yorick/gyoto.i index 506d4402..4a30ca64 100644 --- a/yorick/gyoto.i +++ b/yorick/gyoto.i @@ -37,9 +37,9 @@ local GYOTO_PLUGINS; GYOTO_PLUGINS=""; GYOTO_NO_STD=1; #include "gyoto.i" - noop, gyoto.loadPlugin("myplugin"); + noop, gyoto.requirePlugin("myplugin"); - SEE ASLO: gyoto.loadPlugin, GYOTO_NO_STD + SEE ASLO: gyoto.requirePlugin, GYOTO_NO_STD */ local GYOTO_PLUGINS; @@ -55,9 +55,9 @@ local GYOTO_PLUGINS; GYOTO_PLUGINS=""; GYOTO_NO_STD=1; #include "gyoto.i" - noop, gyoto.loadPlugin("myplugin"); + noop, gyoto.requirePlugin("myplugin"); - SEE ASLO: gyoto.loadPlugin, GYOTO_PLUGINS + SEE ASLO: gyoto.requirePlugin, GYOTO_PLUGINS */ extern gyoto_haveXerces; @@ -156,27 +156,43 @@ extern __gyoto_setErrorHandler; */ __gyoto_setErrorHandler; +extern gyoto_requirePlugin; extern gyoto_loadPlugin; -/* DOCUMENT gyoto.loadPlugin, plugin[, plugin2[, plugin3]] [, nofail=1] +extern gyoto_havePlugin; +/* DOCUMENT gyoto.requirePlugin, plugin[, plugin2[, plugin3]] [, nofail=1] + gyoto.loadPlugin, plugin[, plugin2[, plugin3]] [, nofail=1] + gyoto.havePlugin(plugin] Load Gyoto plug-ins. INPUTS: - gyoto.loadPlugins() accepts an aribtrary number of positional - arguments, each a string or string array naming individual Gyoto - plugins. For instance, all of the following attempt to load the - plug-ins, stdplug, lorene and myplug: - gyoto.loadPlugin, "stdplug", "lorene", myplug" - gyoto.loadPlugin, ["stdplug", "lorene", myplug"] - gyoto.loadPlugin, "stdplug", ["lorene", myplug"] + gyoto.requirePlugin() and gyoto.loadPlugin() accept an aribtrary + number of positional arguments, each a string or string array + naming individual Gyoto plug-ins. For instance, all of the + following attempt to load the plug-ins, stdplug, lorene and myplug: + + gyoto.requirePlugin, "stdplug", "lorene", myplug" + gyoto.requirePlugin, ["stdplug", "lorene", myplug"] + gyoto.requirePlugin, "stdplug", ["lorene", myplug"] + + In the first (preferred) form, each plug-in is loaded only if it is + not already. In the second form, each plug-in is forcibly loaded, + which has the effect that the classes it implements will be + registered twice. The only use of this feature is to put the + classes of this plug-in first in the registers to make sure they + are the version that is used when instanciating a class without + specifying it's plug-in. In short, this should not be used. + + gyoto.havePlugin("myplug") returns 1 if myplug has already been + loaded, 0 otherwise. KEYWORDS: nofail= if set and true, failure to load a plug-in will not trigger an error. It applies to _all_ plug-ins in the list. EXAMPLE: - gyoto.loadPlugin, "stdplug" - gyoto.loadPlugin, "lorene", nofail=1 + gyoto.requirePlugin, "stdplug" + gyoto.requirePlugin, "lorene", nofail=1 */ extern __gyoto_initRegister; @@ -242,7 +258,13 @@ local gyoto; Arbitrary derived classes can also be instantiated using the base class constructor: - gg = gyoto.Metric("KerrBL"); + gg = gyoto.Metric("KerrBL", [plugin]); + The PLUGIN argument is optional and has two effects: + - it ensures the plug-in PLUGIN is loaded before attempting to + instantiate the object; + - it ensures the class of the newly created object comes from + this plug-in and that another class by the same name in + another plug-in is not inadvertently used. Finally, it is possible to instantiate an object using a buffer containing XML data: @@ -253,7 +275,6 @@ local gyoto; This should be equivalent to gg2 == gg.clone(), see COPYING vs. CLONIG below. - GYOTO OBJECTS BEHAVE LIKE FUNCTIONS ----------------------------------- diff --git a/yorick/gyoto_namespace.i b/yorick/gyoto_namespace.i index 0a5ca46c..4ad4f3f6 100644 --- a/yorick/gyoto_namespace.i +++ b/yorick/gyoto_namespace.i @@ -11,6 +11,8 @@ gyoto=save( MPI_Initialized=gyoto_MPI_Initialized, MPI_Finalized=gyoto_MPI_Finalized, loadPlugin=gyoto_loadPlugin, + requirePlugin=gyoto_requirePlugin, + havePlugin=gyoto_havePlugin, Scenery=gyoto_Scenery, Scenery_rayTrace=gyoto_Scenery_rayTrace, diff --git a/yorick/gyoto_utils.C b/yorick/gyoto_utils.C index 3d4f42c0..2308fdc6 100644 --- a/yorick/gyoto_utils.C +++ b/yorick/gyoto_utils.C @@ -162,6 +162,12 @@ extern "C" { } + void + Y_gyoto_havePlugin(int argc) + { + ypush_long(Gyoto::havePlugin(ygets_q(0))); + } + void Y_gyoto_loadPlugin(int argc) { @@ -194,6 +200,38 @@ extern "C" { // Gyoto::Register::init(); } + void + Y_gyoto_requirePlugin(int argc) + { + // Step 1: determine whether nofail is set (to true) + int nofail=0; + static char const * knames[2] = { "nofail", 0 }; + static long kglobs[2]; + int kiargs[1]; + yarg_kw_init(const_cast(knames), kglobs, kiargs); + int iarg=argc-1; + while (iarg>=0) { + iarg = yarg_kw(iarg, kglobs, kiargs); + iarg--; + } + if (kiargs[0]>=0) {// nofail= present + nofail=yarg_true(kiargs[0]); + } + + // Step 2: load plug-ins + long ntot=0; + long dims[Y_DIMSIZE]; + ystring_t * plugins = 0; + for (iarg=argc-1; iarg>=0; iarg--) { + if (kiargs[0]<0 ||(iarg!=kiargs[0] && iarg!=kiargs[0]+1)) { + plugins = ygeta_q(iarg, &ntot, dims); + for (long i=0; i= 2 && yarg_string(argc-2)) plugin = ygets_q(argc-2); \ OBJ = ypush_##BASE(); \ Gyoto::BASE::Subcontractor_t * sub = \ - Gyoto::BASE::getSubcontractor(fname, 1); \ + Gyoto::BASE::getSubcontractor(fname, plugin, 1); \ if (sub) { \ GYOTO_DEBUG << "found a subcontractor for \"" << fname \ << "\", calling it now\n"; \ - *OBJ = (*sub)(NULL); \ + *OBJ = (*sub)(NULL, plugin); \ } else { \ YGYOTO_BASE_CONSTRUCTOR1_XML(GETBASE); \ } \ From 5f35070ab4371ab0829de38585b635bd3d0cf51f Mon Sep 17 00:00:00 2001 From: Thibaut Paumard Date: Sat, 10 Dec 2016 12:34:15 +0100 Subject: [PATCH 02/11] Merging branch master into track-plugin --- BUGS.md | 47 ++ INSTALL.Gyoto.md | 13 +- Makefile.in | 16 +- NEWS | 4 +- README | 64 --- README.SIGFPE | 24 - README.md | 69 +++ TODO | 3 - TODO.md | 21 + bin/Makefile.am | 3 +- bin/Makefile.in | 6 +- configure | 2 +- configure.ac | 4 +- doc/examples/example-moving-star-CS.xml | 2 +- doc/examples/example-oscil-torus.xml | 68 +++ include/Gyoto.h | 3 + include/GyotoDeformedTorus.h | 77 +++ include/GyotoDynamicalDiskBolometric.h | 79 +++ include/GyotoEquatorialHotSpot.h | 92 ++++ include/GyotoInflateStar.h | 106 ++++ include/GyotoOscilTorus.h | 117 +++++ include/GyotoProperty.h | 52 ++ lib/ChernSimons.C | 2 +- lib/DeformedTorus.C | 323 ++++++++++++ lib/DynamicalDisk.C | 135 ++++- lib/DynamicalDiskBolometric.C | 159 ++++++ lib/EquatorialHotSpot.C | 231 +++++++++ lib/InflateStar.C | 139 +++++ lib/Makefile.am | 9 +- lib/Makefile.in | 62 ++- lib/NumericalMetricLorene.C | 2 +- lib/OscilTorus.C | 490 ++++++++++++++++++ lib/StdPlug.C | 14 + python/gyoto_std.i | 11 + python/gyoto_std_swig.h | 5 + python/tests_std/test_DeformedTorus.py | 16 + .../tests_std/test_DynamicalDiskBolometric.py | 12 + python/tests_std/test_EquatorialHotSpot.py | 18 + python/tests_std/test_InflateStar.py | 16 + python/tests_std/test_OscilTorus.py | 17 + yorick/gyoto.i | 2 +- 41 files changed, 2396 insertions(+), 139 deletions(-) create mode 100644 BUGS.md delete mode 100644 README delete mode 100644 README.SIGFPE create mode 100644 README.md delete mode 100644 TODO create mode 100644 TODO.md create mode 100644 doc/examples/example-oscil-torus.xml create mode 100644 include/GyotoDeformedTorus.h create mode 100644 include/GyotoDynamicalDiskBolometric.h create mode 100644 include/GyotoEquatorialHotSpot.h create mode 100644 include/GyotoInflateStar.h create mode 100644 include/GyotoOscilTorus.h create mode 100644 lib/DeformedTorus.C create mode 100644 lib/DynamicalDiskBolometric.C create mode 100644 lib/EquatorialHotSpot.C create mode 100644 lib/InflateStar.C create mode 100644 lib/OscilTorus.C create mode 100644 python/tests_std/test_DeformedTorus.py create mode 100644 python/tests_std/test_DynamicalDiskBolometric.py create mode 100644 python/tests_std/test_EquatorialHotSpot.py create mode 100644 python/tests_std/test_InflateStar.py create mode 100644 python/tests_std/test_OscilTorus.py diff --git a/BUGS.md b/BUGS.md new file mode 100644 index 00000000..f8659780 --- /dev/null +++ b/BUGS.md @@ -0,0 +1,47 @@ +# Known bugs affecting + +This file is to list known bugs in Gyoto or its dependencies that +significantly affect Gyoto but are not easy to fix or workaround in +Gyoto. + +## Boost.multiprecision 1.62.0 (other nearby versions presumably affected): + +A bug makes multiprecision acos() never return in some +circumstances. This has caused gyoto hanging. As of writing, this is +fixed in the Boost development tree and worked around in the Debian +package for Gyoto. For further details and workarounds, see: + - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844490 + - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844495 + - https://svn.boost.org/trac/boost/ticket/12625 + + -- Thibaut Paumard, Thu Dec 08 2016. + +## Clang/LLVM compiler (all versions), possibly other compilers: + +Gyoto relies on proper delivery of SIGFPE when arithmetic errors occur +(division by zero, floating point overflows...). It does so by +enabling the right exceptions using feenableexcept from GNU fenv.h. + +However, some compilers (clang/llvm, in particular) do not support +setting the floating-point environment and will happily optimize code +assuming that it is safe to divide by zero. We recommend staying away +from these compilers until this issue is fixed: + - https://llvm.org/bugs/show_bug.cgi?id=23707 + - https://llvm.org/bugs/show_bug.cgi?id=8100 + +Alternatively, you may try to reconfigure Gyoto to not use fenv.h +and/or to not use any optimization: make clean ./configure + --without-fenv CFLAGS="-g -O0" CXXFLAGS="-g -O0" make +and see whether it works better for you. + +If you experience such spurious SIGFPE inside the Yorick plug-in, an +ugly workaround is to call gyoto.fedisableexcept() right before the +offending Gyoto call. If at all possible, consider recompiling Gyoto +as explained above. + +Note that loading some plug-ins (e.g. the lorene plug-in) may change +or reset the default floating-point environment. This is the case if +the plug-in, or one of the libraries it links with, has been compiled +with optimizations such as -ffast-math or gfortran. + + -- Thibaut Paumard, Thu Dec 08 2016. diff --git a/INSTALL.Gyoto.md b/INSTALL.Gyoto.md index 04698c76..8ff771c0 100644 --- a/INSTALL.Gyoto.md +++ b/INSTALL.Gyoto.md @@ -75,20 +75,21 @@ The rest of this file details each step. ## 2- Installing the dependencies +Please refer to [BUGS.md](BUGS.md) for known bugs in some versions of the +following dependencies. + Gyoto requires: - - a C++ compiler. GCC 4.9 works very well. Several features require - the C++11 standard. Clang/LLVM is discouraged because it does not - support fenv.h, which sometimes leads to spurious SIFPE in the - Yorick plug-in: - https://llvm.org/bugs/show_bug.cgi?id=23707 + - a C++ compiler. GCC 4.9 and above work very well. Several + features require the C++11 standard. Clang/LLVM is discouraged, + see [BUGS.md](BUGS.md). - xercesc-3 (recommended, required for the executable): http://xerces.apache.org/xerces-c/ - cfitsio (required for the executable and some of the Astrobj): http://heasarc.gsfc.nasa.gov/fitsio/ - libudunits2 (recommended, support for unit conversions): http://www.unidata.ucar.edu/software/udunits/ - - boost >= 1.53 (required, contains the integrators) + - boost >= 1.53 (required, contains the integrators). See [BUGS.md](BUGS.md). http://www.boost.org/ - an MPI implementation (tested with openmpi, optional). MPI uses boost features from boost.mpi, you must use the same version as diff --git a/Makefile.in b/Makefile.in index 3f1ea906..203bb95d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -79,8 +79,7 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = . -DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \ - $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ $(srcdir)/config.h.in $(top_srcdir)/include/GyotoConfig.h.in \ $(top_srcdir)/doc/Makefile.in $(top_srcdir)/doc/doxyfile.in \ @@ -93,8 +92,9 @@ DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \ $(top_srcdir)/python/Makefile.in \ $(top_srcdir)/python/setup.py.in \ $(top_srcdir)/python/setup_std.py.in \ - $(top_srcdir)/python/setup_lorene.py.in COPYING TODO compile \ - config.guess config.sub depcomp install-sh missing ltmain.sh + $(top_srcdir)/python/setup_lorene.py.in AUTHORS COPYING \ + ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \ + install-sh missing ltmain.sh ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ @@ -423,15 +423,15 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ - $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu Makefile + $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/NEWS b/NEWS index 0a939f29..b5e5bd28 100644 --- a/NEWS +++ b/NEWS @@ -6,8 +6,10 @@ NEXT 2016/09/28 API Gyoto::loadPlugin(). The subcontractor signature is changed to accept a second parameter, which breaks the API. -NEXT 2016/12/07 FEATURE +NEXT 2016/12/07 FTR * New Metrics in stdplug: ChernSimons, RezzollaZhidenko. + * New Astrobjs in stdplug: DeformedTorus, DynamicalDiskBolometric, + EquatorialHotSpot, InflateStar, OscilTorus. 1.1.1 2016/10/30 BUG * When Gyoto is configured to be installed in another prefix than diff --git a/README b/README deleted file mode 100644 index 6cc0e1ea..00000000 --- a/README +++ /dev/null @@ -1,64 +0,0 @@ - *** GYOTO *** - - General relativitY Orbit Tracer of Observatoire de Paris - -Gyoto aims at providing a framework for computing orbits and -ray-traced images in General relativity. It consists in a library -(libgyoto), utility programs, and a plug-in for the Yorick programing -language. - -We request that use of Gyoto in scientific publications be properly -acknowledged. Please cite: - - GYOTO: a new general relativistic ray-tracing code, F. H. Vincent, - T. Paumard, E. Gourgoulhon & G. Perrin, Classical and Quantum - Gravity 28, 225011 (2011) [arXiv:1109.4769] - -We also request that Gyoto modifications, extensions or plug-ins -leading to a scientific publication be made public as free software -reasonably fast (within one year after publication of the scientific -paper), for instance by contributing it directly to the Gyoto -code base. Contributors will be listed in the relevant source files as -well as in the AUTHORS file in the package. - - Gyoto is Copyright 2011-2015 Thibaut Paumard, Frédéric Vincent and - Odele Straub (To ease reading on non-UTF8 systems, French accents - are omitted in file headers). - - 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 . - -File python/doxyfile.py is Copyright 2008 Prabhu Ramachandran under -BSD style license. File python/numpy.i is Copyright (c) 2005-2015, -NumPy Developers under BSD 3-clause license. File bin/optionparser.h -is Copyright (C) 2012 Matthias S. Benkmann. See each file for details. - -Refer to the file INSTALL.Gyoto for building and installing Gyoto. - -Several sample files are provided in doc/examples. You can ray-trace -those sceneries with: - - gyoto - -FITS files can be read by a variety of free and proprietary -software. See http://heasarc.gsfc.nasa.gov/docs/heasarc/fits.html. - -Custom metrics and astronomical objects can be added fairly easily by -implementing them as a Gyoto plug-in. This, of course, requires -knowledge of the C++ language. We don't provide yet a complete guide, -but look at the standard plug-in lib/StdPlug.C which includes the Kerr -metric and the standard objects. The Lorene (numerical) metrics are -also implemented as a plug-in, see lib/LorenePlug.C and -lib/Makefile.lorene. - - -- Thibaut Paumard, Tue Aug 30 2011. diff --git a/README.SIGFPE b/README.SIGFPE deleted file mode 100644 index 13647873..00000000 --- a/README.SIGFPE +++ /dev/null @@ -1,24 +0,0 @@ -Gyoto relies on proper delivery of SIGFPE when arithmetic errors occur -(division by zero, floating point overflows...). It does so by -enabling the right exceptions using feenableexcept from GNU fenv.h. - -However, some compilers (clang/llvm, in particular) do not support -setting the floating-point environment and will happily optimize code -assuming that it is safe to divide by zero. We recommend staying away -from these compilers until this issue is fixed: - https://llvm.org/bugs/show_bug.cgi?id=23707 - https://llvm.org/bugs/show_bug.cgi?id=8100 - -Alternatively, you may recompile without any optimization by passing -the right flags during configure: - ./configure CFLAGS="-g -O0" CXXFLAGS="-g -O0" - -If you experience such spurious SIGFPE inside the Yorick plug-in, an -ugly workaround is to call gyoto.fedisableexcept right before the -offending Gyoto call. If at all possible, consider recompiling Gyoto -as explained above. - -Note that loading some plug-ins (e.g. the lorene plug-in) may change -or reset the default floating-point environment. This is the case is -the plug-in, or one of the libraries it links with, has been compiled -with optimizations such as -ffast-math or gfortran. diff --git a/README.md b/README.md new file mode 100644 index 00000000..fd372687 --- /dev/null +++ b/README.md @@ -0,0 +1,69 @@ +# GYOTO: the General relativitY Orbit Tracer of Observatoire de Paris + +## What Gyoto is + +[Gyoto](http://gyoto.obspm.fr/) aims at providing a framework for +computing orbits and ray-traced images in General relativity. It +consists in a library (libgyoto), utility programs, and a plug-in for +the Yorick programing language. + +We request that use of Gyoto in scientific publications be properly +acknowledged. Please cite: + + GYOTO: a new general relativistic ray-tracing code, F. H. Vincent, + T. Paumard, E. Gourgoulhon & G. Perrin, Classical and Quantum + Gravity 28, 225011 (2011) [arXiv:1109.4769] + +We also request that Gyoto modifications, extensions or plug-ins +leading to a scientific publication be made public as free software +reasonably fast (within one year after publication of the scientific +paper), for instance by contributing it directly to the Gyoto +code base. Contributors will be listed in the relevant source files as +well as in the AUTHORS file in the package. + +## Copyright information + +Gyoto is Copyright 2011-2015 Thibaut Paumard, Frédéric Vincent and +Odele Straub (To ease reading on non-UTF8 systems, French accents are +omitted in file headers). + +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](COPYING) along with Gyoto. If not, see +. + +File python/doxyfile.py is Copyright 2008 Prabhu Ramachandran under +BSD style license. File python/numpy.i is Copyright (c) 2005-2015, +NumPy Developers under BSD 3-clause license. File bin/optionparser.h +is Copyright (C) 2012 Matthias S. Benkmann. See each file for details. + +## Installation instructions + +Refer to the file [INSTALL.Gyoto.md](INSTALL.Gyoto.md) for building +and installing Gyoto. + +Several sample files are provided in doc/examples. You can ray-trace +those sceneries with: + + gyoto + +FITS files can be read by a variety of free and proprietary +software. See http://heasarc.gsfc.nasa.gov/docs/heasarc/fits.html. + +## Extending Gyoto + +Custom metrics and astronomical objects can be added fairly easily by +implementing them as a Gyoto plug-in. This, of course, requires +knowledge of the C++ language. The [user +manual](http://gyoto.obspm.fr/GyotoManual.pdf) contains detailed +instructions. + -- Thibaut Paumard, Thu Dec 08 2016. diff --git a/TODO b/TODO deleted file mode 100644 index b1b8daf5..00000000 --- a/TODO +++ /dev/null @@ -1,3 +0,0 @@ -ChernSimons: Document -RezzollaZhidenko: Document and provide example - diff --git a/TODO.md b/TODO.md new file mode 100644 index 00000000..c64aea76 --- /dev/null +++ b/TODO.md @@ -0,0 +1,21 @@ +# Gyoto to-do list + +This file keeps track of some issues that the Gyoto developers should +attend to at their earliest convenience: + +## stdplug: + +All: Add/check doxygen comments in header file and document properties + in C++ source file +ChernSimons: Document +RezzollaZhidenko: Document and provide example +DeformedTorus: Document and provide example +DynamicalDiskBolometric: Document and provide example +EquatorialHotspot: Document and provide example +InflateStar: Document and provide example +OscilTorus: Document +NumericalMetricLorene: stop inheriting from WIP (ABI-breaking) + +## libgyoto: +merge branch track-plugin (ABI-breaking) +implement thread-safety declaration (ABI-breaking) diff --git a/bin/Makefile.am b/bin/Makefile.am index 89074a17..ce176d0c 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -52,7 +52,8 @@ CHECK_RESULTS = \ example-page-thorne-disk-KS.fits \ example-page-thorne-disk-BL-with-basis.fits \ example-torus.fits \ - example-torus-KS.fits + example-torus-KS.fits \ + example-oscil-torus.fits if HAVE_UDUNITS CHECK_RESULTS += \ example-fixed-star-KS.fits \ diff --git a/bin/Makefile.in b/bin/Makefile.in index 0484f0ac..8baa181d 100644 --- a/bin/Makefile.in +++ b/bin/Makefile.in @@ -451,7 +451,7 @@ CHECK_RESULTS = example-thin-disk.fits example-thin-disk-KS.fits \ example-moving-star-CS.fits example-page-thorne-disk-BL.fits \ example-page-thorne-disk-KS.fits \ example-page-thorne-disk-BL-with-basis.fits example-torus.fits \ - example-torus-KS.fits $(am__append_7) + example-torus-KS.fits example-oscil-torus.fits $(am__append_7) CHECK_MPI_RESULTS = $(CHECK_RESULTS:.fits=-mpi.fits) MPIRUN = mpirun CHECK_ENV = LD_LIBRARY_PATH=@top_builddir@/lib/.libs/:$(LD_LIBRARY_PATH) @@ -472,9 +472,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu bin/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu bin/Makefile + $(AUTOMAKE) --foreign bin/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/configure b/configure index a69ba0a7..d0889d6a 100755 --- a/configure +++ b/configure @@ -1576,7 +1576,7 @@ Optional Packages: --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). - --without-fenv do not use fenv.h (see README.SIGFPE) + --without-fenv do not use fenv.h (see BUGS.md) --with-size_t=same|distinct|auto consider size_t as the same as or distinct from unsigned long (auto). Should normally be specified diff --git a/configure.ac b/configure.ac index 050780b5..fe7a5456 100644 --- a/configure.ac +++ b/configure.ac @@ -14,7 +14,7 @@ AC_INIT([Gyoto], [1.1.1], [gyoto@sympa.obspm.fr]) gyoto_test_CXXFLAGS=${CXXFLAGS+set} gyoto_test_CPPFLAGS=${CPPFLAGS+set} AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([foreign]) AC_CONFIG_SRCDIR([include/GyotoKerrKS.h]) AC_CONFIG_MACRO_DIR([m4]) AC_LANG(C++) @@ -67,7 +67,7 @@ AC_SUBST(localpkglibdir) # AC_ARG_WITH([fenv], [AS_HELP_STRING([--without-fenv], - [do not use fenv.h (see README.SIGFPE)],)], + [do not use fenv.h (see BUGS.md)],)], [], [with_fenv=auto]) AS_IF([test "x$with_fenv" != xno], diff --git a/doc/examples/example-moving-star-CS.xml b/doc/examples/example-moving-star-CS.xml index 42edfaa7..9c5277e9 100644 --- a/doc/examples/example-moving-star-CS.xml +++ b/doc/examples/example-moving-star-CS.xml @@ -3,7 +3,7 @@ 0. - 0.5 + 0.5 diff --git a/doc/examples/example-oscil-torus.xml b/doc/examples/example-oscil-torus.xml new file mode 100644 index 00000000..25b5e512 --- /dev/null +++ b/doc/examples/example-oscil-torus.xml @@ -0,0 +1,68 @@ + + + + + 10 + 0. + + + + 1000. 1000. 1.484 0. + + 0.07 + 50 + 1e17 1e17 + + + + + Spectrum + + + 18. + Torus radius: distance from origin to center of torus tube + + 0.0001 + Polytropic constant kappa + + 1.5 + Polytropic index n + + 1. + Central energy density + + 0 + Mode number + + + Only for mode=0, file containing time series of cross section area: + t1 area1 + t2 area2 + ... + tN areaN + Breathing + Perturbation kind, one of Radial Vertical X Plus Breathing + + 0.15 + Perturbation strength + NB: if this factor is >>1 (absurd case) then the image looks strange + as the perturbation 4-vel is ~ the Keplerian 4-vel, so + the redshift distribution (hence the intensity) + is more or less random. + + + Always optically thick + + 50. + + 50. + Increase SafetyValue if you have trouble resolving the + surface of the doughnut. Increasing SafetyValue also + increases computation time. The default value is slightly + more conservative. + + + -1000. + 1 + + diff --git a/include/Gyoto.h b/include/Gyoto.h index e87f6f98..c53cc112 100644 --- a/include/Gyoto.h +++ b/include/Gyoto.h @@ -51,7 +51,10 @@ #include #include #include +#include #include +#include +#include /** * \mainpage Gyoto diff --git a/include/GyotoDeformedTorus.h b/include/GyotoDeformedTorus.h new file mode 100644 index 00000000..faebaa94 --- /dev/null +++ b/include/GyotoDeformedTorus.h @@ -0,0 +1,77 @@ +/** + * \file GyotoDeformedTorus.h + * \brief Slender torus subject to simple time-periodic deformations + * + * The target of ray-traced Gyoto::Photon + */ + +/* + * Copyright (c) 2013 Frederic Vincent + * + * + */ + +#ifndef __DeformedTorus_h +#define __DeformedTorus_h + +#include +#include +#include + + +namespace Gyoto { + namespace Astrobj { + class DeformedTorus; + }; + class FactoryMessenger; + namespace Spectrum { + class Generic; + } +}; + +class Gyoto::Astrobj::DeformedTorus +: public Gyoto::Astrobj::Standard { + friend class Gyoto::SmartPointer; + + private: + SmartPointer gg_; + SmartPointer spectrum_; + double c_; + unsigned long mode_; + double param_beta_; + double param_beta_st_; + double param_eta_; + enum perturb_t {RadialTranslation=1, + VerticalTranslation=2, + Rotation=3, + Expansion=4, + RadialShear=5, + VerticalShear=6, + PureShear=7}; + perturb_t perturb_kind_; + public: + GYOTO_OBJECT; + DeformedTorus(); + DeformedTorus(const DeformedTorus &o); + virtual ~DeformedTorus(); + virtual DeformedTorus * clone() const ; + + // Standard accessors + GYOTO_OBJECT_ACCESSORS(SmartPointer, spectrum); + GYOTO_OBJECT_ACCESSORS(double, largeRadius); + GYOTO_OBJECT_ACCESSORS(double, beta); + GYOTO_OBJECT_ACCESSORS(double, betaSt); + GYOTO_OBJECT_ACCESSORS(double, eta); + GYOTO_OBJECT_ACCESSORS(unsigned long, mode); + GYOTO_OBJECT_ACCESSORS_STRING(perturbKind); + + using Generic::metric; + virtual void metric(Gyoto::SmartPointer); + virtual double operator()(double const coord[4]) ; + ///< Called by Astrobj::Generic::Impact() + virtual void getVelocity(double const pos[4], double vel[4]) ; + /*virtual int Impact(Gyoto::Photon* ph, size_t index, + Astrobj::Properties *data=NULL);*/ + double emission(double nuem,double,double*,double*) const; +#endif +}; diff --git a/include/GyotoDynamicalDiskBolometric.h b/include/GyotoDynamicalDiskBolometric.h new file mode 100644 index 00000000..3fcb188f --- /dev/null +++ b/include/GyotoDynamicalDiskBolometric.h @@ -0,0 +1,79 @@ +/** + * \file GyotoDynamicalDiskBolometric.h + * \brief A geometrically thin, optically thick disk, evolving dynamically + * + * The disk is described by a set of FITS files for a set of different times + */ + +/* + Copyright 2013 Frederic Vincent, Thibaut Paumard + + 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 . +*/ + +#ifndef __GyotoDynamicalDiskBolometric_H_ +#define __GyotoDynamicalDiskBolometric_H_ + +#include +#include +#include +#include + +namespace Gyoto{ + namespace Astrobj { class DynamicalDiskBolometric; } +} + +//#include +#include + +/** + * \class Gyoto::Astrobj::DynamicalDiskBolometric + * \brief Geometrically thin disk read from a set of FITS files + * + * This class describes a PatternDiskBB that evolves dynamically. + * It is described by a set of FITS files. + * + */ +class Gyoto::Astrobj::DynamicalDiskBolometric +: public Astrobj::DynamicalDisk { + friend class Gyoto::SmartPointer; + private: + + // Constructors - Destructor + // ------------------------- + public: + GYOTO_OBJECT; + + DynamicalDiskBolometric(); ///< Standard constructor + + DynamicalDiskBolometric(const DynamicalDiskBolometric& ) ;///< Copy constructor + virtual DynamicalDiskBolometric* clone () const; ///< Cloner + + virtual ~DynamicalDiskBolometric() ; ///< Destructor + + double emission(double nu_em, double dsem, + double *, + double coord_obj[8]) const; + + double bolometricEmission(double dsem, double coord_obj[8]) const; + + void processHitQuantities(Photon* ph, + double* coord_ph_hit, + double* coord_obj_hit, double dt, + Properties* data) const; +}; + +#endif diff --git a/include/GyotoEquatorialHotSpot.h b/include/GyotoEquatorialHotSpot.h new file mode 100644 index 00000000..7e814e1c --- /dev/null +++ b/include/GyotoEquatorialHotSpot.h @@ -0,0 +1,92 @@ +/** + * \file GyotoEquatorialHotSpot.h + * \brief Equatorial hot spot + * + */ + +/* + Copyright 2013 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 . + */ + +#ifndef __GyotoEquatorialHotSpot_h +#define __GyotoEquatorialHotSpot_h + +#include +#include +#include + +namespace Gyoto { + namespace Astrobj { + class EquatorialHotSpot; + }; +}; + +class Gyoto::Astrobj::EquatorialHotSpot +: public Gyoto::Astrobj::ThinDisk, + public Gyoto::Worldline { + friend class Gyoto::SmartPointer; + private: + double sizespot_; + enum beaming_t {IsotropicBeaming=0, NormalBeaming=1, RadialBeaming=2}; + beaming_t beaming_; + double beamangle_; + public: + GYOTO_OBJECT; + GYOTO_WORLDLINE; + using Gyoto::Worldline::deltaMax; + using Gyoto::Astrobj::Generic::deltaMax; + EquatorialHotSpot(); + EquatorialHotSpot(const EquatorialHotSpot &o); + virtual ~EquatorialHotSpot(); + virtual EquatorialHotSpot * clone() const ; + + // Accessors for the Property list + void spotRadSize(double t); + double spotRadSize() const; + + void beaming(std::string const &b); + std::string beaming() const; + + void beamAngle(double t); + double beamAngle() const; + + // + + double getMass() const; + using Generic::metric; + void metric(SmartPointer gg); + void setInitialCondition(double coord[8]); + + void getVelocity(double const pos[4], double vel[4]); + + double emission(double nu_em, double dsem, + double *, + double coord_obj[8]) const; + + // needed for legacy XML files + virtual int setParameter(std::string name, + std::string content, + std::string unit); +#ifdef GYOTO_USE_XERCES + // needed for wait_pos_ + void setParameters(FactoryMessenger* fmp); + virtual void fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const ; +#endif + +#endif +}; diff --git a/include/GyotoInflateStar.h b/include/GyotoInflateStar.h new file mode 100644 index 00000000..9dbde5cc --- /dev/null +++ b/include/GyotoInflateStar.h @@ -0,0 +1,106 @@ +/** + * \file GyotoStar.h + * \brief Mass-less, spherical object following a timelike geodesic + * + * A Gyoto::InflateStar evolves in a Gyoto::Metric following time-like + * geodesics and is a Gyoto::Astrobj::Generic suitable for + * ray-tracing. + */ + +/* + Copyright 2011, 2013 Frederic Vincent, Thibaut Paumard + + 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 . + */ + + +#ifndef __GyotoInflateStar_H_ +#define __GyotoInflateStar_H_ + +namespace Gyoto{ + namespace Astrobj { class InflateStar; } +} + +#include +#include + +#ifdef GYOTO_USE_XERCES +#include +#endif + +#include + +/** + * \class Gyoto::Astrobj::InflateStar + * \brief An Astrobj::Star with growing size + * + */ +class Gyoto::Astrobj::InflateStar : + public Gyoto::Astrobj::Star { + friend class Gyoto::SmartPointer; + + // Data : + // ----- + private: + double timeinflateinit_; ///< coordinate time of starting inflation + double timeinflatestop_; ///< coordinate time of stopping inflation + double radiusstop_; ///< maximum radius of star + // Constructors - Destructor + // ------------------------- + public: + GYOTO_OBJECT; // This object has a (non-inherited) Property list + + /** + * Create InflateStar object with undefined initial conditions. One needs to + * set the coordinate system, the metric, and the initial position + * and velocity before integrating the orbit. setInititialCondition() + * can be used for that. + */ + InflateStar(); ///< Default constructor + + InflateStar(const InflateStar& orig); ///< Copy constructor + virtual InflateStar * clone() const ; + + virtual ~InflateStar() ; ///< Destructor + + GYOTO_OBJECT_ACCESSORS_UNIT(timeInflateInit); + GYOTO_OBJECT_ACCESSORS_UNIT(timeInflateStop); + GYOTO_OBJECT_ACCESSORS_UNIT(radiusStop); + + using Star::radius; + virtual double radiusAt(double t) const; ///< Radius at a given time + virtual double radiusAt(double t, + const std::string &t_unit) const; ///< Radius at a given time + virtual double radiusAt(double t, + const std::string &t_unit, + const std::string &r_unit) const; ///< Radius at a given time + + // Accessors + // --------- + public: + virtual std::string className() const ; ///< "InflateStar" + virtual std::string className_l() const ; ///< "inflate_star" + + public: + + virtual int Impact(Gyoto::Photon* ph, size_t index, + Astrobj::Properties *data=NULL); + virtual double emission(double nu_em, double dsem, + double cp[8], double co[8]=NULL) const; +}; + + +#endif diff --git a/include/GyotoOscilTorus.h b/include/GyotoOscilTorus.h new file mode 100644 index 00000000..7b199ac6 --- /dev/null +++ b/include/GyotoOscilTorus.h @@ -0,0 +1,117 @@ +/** + * \file GyotoOscilTorus.h + * \brief Slender torus subject to realistic Blaes 2006 oscillation modes. + * + * The target of ray-traced Gyoto::Photon + */ + +/* + * Copyright (c) 2013 Frederic Vincent + * + * + */ + +#ifndef __OscilTorus_h +#define __OscilTorus_h + +#include +#include +#include + + +namespace Gyoto { + namespace Astrobj { + class OscilTorus; + }; + class FactoryMessenger; + namespace Spectrum { + class Generic; + } +}; + +class Gyoto::Astrobj::OscilTorus +: public Gyoto::Astrobj::Standard, + public Hook::Listener { + friend class Gyoto::SmartPointer; + + private: + // Members corresponding to properties: + /** + * \brief Large Radius + * + * Distance from the center of the coordinate system to the center + * of the torus tube. The (square of the) radius of a vertical + * cross-section is stored in critical_value_. + */ + double c_; + unsigned long mode_; + double polycst_; ///< Polytropic constant + double polyindex_; ///< Polytropic index + double central_density_; ///< Central density + enum perturb_t {Radial=1, Vertical=2, X=3, Plus=4, Breathing=5}; + perturb_t perturb_kind_; + std::string emitting_area_; ///< Only for mode=0, file containing time series of cross section area + double perturb_intens_; ///< Perturbation intensity + + // Cached values: + SmartPointer kerrbl_; + std::vector tt_; + std::vector area_; // tt_ and area_ contain area of cross section at time tt + size_t nbt_; ///< numberof tt_ + int with_cross_; ///< is 1 if cross section data are given + + double sigma_; ///< perturbation rescaled pulsation + double alpha_; ///< perturbation normalization (oder-unity) + double w1_; ///< factors appearing in perturbed surf func + double w2_; + double omr2_; ///< epicyclic freq at torus center + double omth2_; + double Omegac_; ///< Omega and l at torus center + double lc_; + double g_rr_; ///< metric coef at torus center + double g_thth_; + bool hold_; + + public: + GYOTO_OBJECT; + OscilTorus(); + OscilTorus(const OscilTorus &o); + virtual ~OscilTorus(); + virtual OscilTorus * clone() const ; + + GYOTO_OBJECT_ACCESSORS_UNIT(largeRadius); + GYOTO_OBJECT_ACCESSORS(unsigned long, mode); + GYOTO_OBJECT_ACCESSORS(double, polyCst); + GYOTO_OBJECT_ACCESSORS(double, polyIndex); + GYOTO_OBJECT_ACCESSORS(double, centralDensity); + GYOTO_OBJECT_ACCESSORS_STRING(perturbKind); + GYOTO_OBJECT_ACCESSORS(double, perturbIntens); + GYOTO_OBJECT_ACCESSORS_STRING(emittingArea); + using Generic::metric; + virtual void metric(Gyoto::SmartPointer); + + virtual double operator()(double const coord[4]) ; + virtual void getVelocity(double const pos[4], double vel[4]) ; + double emission(double nuem,double,double*,double*) const; + +#ifdef GYOTO_USE_XERCES + virtual void setParameters(Gyoto::FactoryMessenger *fmp) ; +#endif + + virtual void updateCachedValues(); + void computeXbYb(const double * pos, double & xb, double & yb) ; + + // Hook::Listener API // + public: + /** + * \brief Update cached values + * + * Calls updateCachedValues(). + * + * See Hook::Listener::tell() + */ + virtual void tell(Gyoto::Hook::Teller *msg); + +}; + +#endif diff --git a/include/GyotoProperty.h b/include/GyotoProperty.h index 9cec5a2c..eb30415b 100644 --- a/include/GyotoProperty.h +++ b/include/GyotoProperty.h @@ -55,6 +55,19 @@ namespace Gyoto { void class::method(type v) {member=v;} \ type class::method() const {return member;} +/// Define a pair of accessors to scalar member (double, long, size_t) +/** + * Accessors must also be declared in the class declaration, which can + * be done using #GYOTO_OBJECT_SCALAR_ACCESSORS. + * + * This version allows performing sepcial actions in the accessors, in + * addition to the usual stuff. + * + */ +#define GYOTO_PROPERTY_ACCESSORS_SPECIAL(class, type, member, method, set, get) \ + void class::method(type v) {member=v; set } \ + type class::method() const {get ; return member;} + /// Define 4 accessors to double scalar member in geometrical units /** * Accessors must also be declared in the class declaration, which can @@ -75,6 +88,45 @@ namespace Gyoto { return Units::FromGeometrical(member, u, metric); \ } +/// GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL + GYOTO_PROPERTY_ACCESSORS_SPECIAL +/** + * Accessors must also be declared in the class declaration, which can + * be done using #GYOTO_OBJECT_ACCESSORS_UNIT. + * + * \param class class name + * \param member member holding the value in geometrical unit + * \param method name for accessors + * \metric member or expression yielding metric (which defines the + * geometrical unit) + */ +#define GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL_SPECIAL(class, member, method, metric, set, get) \ + GYOTO_PROPERTY_ACCESSORS_SPECIAL(class, double, member, method, set, get) \ + void class::method(double v, std::string const &u) { \ + member=Units::ToGeometrical(v, u, metric); \ + } \ + double class::method(std::string const &u) const { \ + return Units::FromGeometrical(member, u, metric); \ + } + +/// Define 4 accessors to double scalar member in specified units +/** + * Accessors must also be declared in the class declaration, which can + * be done using #GYOTO_OBJECT_ACCESSORS_UNIT. + * + * \param class class name + * \param member member holding the value in specified unit + * \param method name for accessors + * \unit unit + */ +#define GYOTO_PROPERTY_ACCESSORS_UNIT(class, member, method, unit) \ + GYOTO_PROPERTY_ACCESSORS(class, double, member, method) \ + void class::method(double v, std::string const &u) { \ + method(Units::Converter(u, unit)(v)); \ + } \ + double class::method(std::string const &u) const { \ + return Units::Converter(unit, u)(method()); \ + } + /// Start Property list /** * \param class Class for which we are defining a Property list diff --git a/lib/ChernSimons.C b/lib/ChernSimons.C index b6c4d32d..39f4eb6c 100644 --- a/lib/ChernSimons.C +++ b/lib/ChernSimons.C @@ -31,7 +31,7 @@ using namespace std; /// Properties #include "GyotoProperty.h" GYOTO_PROPERTY_START(ChernSimons, "Chern-Simons 1st order perturbation to KerrBL metric") -GYOTO_PROPERTY_DOUBLE(ChernSimons, ModifCS, dzetaCS, "Chern-Simons coupling constant") +GYOTO_PROPERTY_DOUBLE(ChernSimons, DzetaCS, dzetaCS, "Chern-Simons coupling constant") GYOTO_PROPERTY_END(ChernSimons, KerrBL::properties) // accessor diff --git a/lib/DeformedTorus.C b/lib/DeformedTorus.C new file mode 100644 index 00000000..6f3bb7d3 --- /dev/null +++ b/lib/DeformedTorus.C @@ -0,0 +1,323 @@ +#include "GyotoDeformedTorus.h" +#include "GyotoFactoryMessenger.h" +#include "GyotoUtils.h" +#include "GyotoPhoton.h" +#include "GyotoDefs.h" +#include "GyotoSpectrum.h" + +#include +#include +#include +#include +#include +using namespace Gyoto; +using namespace Gyoto::Astrobj; +using namespace std; + +/// Properties +#include "GyotoProperty.h" +GYOTO_PROPERTY_START(DeformedTorus, "Slender torus subject to simple time-periodic deformations") +GYOTO_PROPERTY_SPECTRUM(DeformedTorus, Spectrum, spectrum) +GYOTO_PROPERTY_DOUBLE(DeformedTorus, LargeRadius, largeRadius) +GYOTO_PROPERTY_DOUBLE(DeformedTorus, Beta, beta) +GYOTO_PROPERTY_DOUBLE(DeformedTorus, BetaSt, betaSt) +GYOTO_PROPERTY_DOUBLE(DeformedTorus, Eta, eta) +GYOTO_PROPERTY_UNSIGNED_LONG(DeformedTorus, Mode, mode) +GYOTO_PROPERTY_STRING(DeformedTorus, PerturbKind, perturbKind) +GYOTO_PROPERTY_END(DeformedTorus, Standard::properties) + +// Accessors +GYOTO_PROPERTY_ACCESSORS(DeformedTorus, SmartPointer, + spectrum_, spectrum) +GYOTO_PROPERTY_ACCESSORS(DeformedTorus, double, c_, largeRadius) +GYOTO_PROPERTY_ACCESSORS_SPECIAL(DeformedTorus, double, param_beta_, beta, + if (param_beta_>=1.) throwError("In DeformedTorus.C: beta should be << 1"); , ) +GYOTO_PROPERTY_ACCESSORS(DeformedTorus, double, + param_beta_st_, betaSt) +GYOTO_PROPERTY_ACCESSORS(DeformedTorus, double, param_eta_, eta) +GYOTO_PROPERTY_ACCESSORS(DeformedTorus, unsigned long, mode_, mode) + +void DeformedTorus::perturbKind(std::string const &k) { + if (k == "RadialTranslation") perturb_kind_ = RadialTranslation; + else if (k == "VerticalTranslation") perturb_kind_ = VerticalTranslation; + else if (k == "Rotation") perturb_kind_ = Rotation; + else if (k == "Expansion") perturb_kind_ = Expansion; + else if (k == "RadialShear") perturb_kind_ = RadialShear; + else if (k == "VerticalShear") perturb_kind_ = VerticalShear; + else if (k == "PureShear") perturb_kind_ = PureShear; + else { + string errmsg="unknown perturbation kind: '"; + errmsg += k + "'"; + throwError(errmsg.c_str()); + } +} +std::string DeformedTorus::perturbKind() const { + switch (perturb_kind_) { + case RadialTranslation: return "RadialTranslation"; + case VerticalTranslation: return "VerticalTranslation"; + case Rotation: return "Rotation"; + case Expansion: return "Expansion"; + case RadialShear: return "RadialShear"; + case VerticalShear: return "VerticalShear"; + case PureShear: return "PureShear"; + default: throwError("Unknown perturbation kind"); + } + return ""; +} + +/// + +Gyoto::Astrobj::DeformedTorus::DeformedTorus() + : Standard("DeformedTorus"), + gg_(NULL), + spectrum_(NULL), + c_(10.8), + mode_(0), + param_beta_(0.01), + param_beta_st_(0.01), + param_eta_(0.01), + perturb_kind_(RadialTranslation) +{ + GYOTO_DEBUG << "Building DeformedTorus" << endl; +} + +Gyoto::Astrobj::DeformedTorus::DeformedTorus(const DeformedTorus &orig) + : Standard(orig), + gg_(NULL), + spectrum_(NULL), + c_(orig.c_), + mode_(orig.mode_), + param_beta_(orig.param_beta_), + param_beta_st_(orig.param_beta_st_), + param_eta_(orig.param_eta_), + perturb_kind_(orig.perturb_kind_) +{ + if (orig.gg_()) { + gg_=orig.gg_->clone(); + Standard::gg_ = gg_; + } + if (orig.spectrum_()) spectrum_ = orig.spectrum_->clone(); + GYOTO_DEBUG << "Copying DeformedTorus" << endl; +} +DeformedTorus * DeformedTorus::clone() const { return new DeformedTorus(*this); } + +Gyoto::Astrobj::DeformedTorus::~DeformedTorus() +{ + GYOTO_DEBUG << "Destroying DeformedTorus" << endl; +} + +double DeformedTorus::operator()(double const pos[4]) { + + // needed: operator()() < 0. <=> inside torus + double posc[4]={0.,c_,M_PI/2.,0.};//don't care about t and phi + double g_rr=gg_->gmunu(posc,1,1);// covar components + double g_thth=gg_->gmunu(posc,2,2); + double aa=gg_->spin(); + double Omegac=1./(pow(c_,1.5)+aa); + double omr2=1.-6./c_+8.*aa*pow(c_,-1.5) + -3.*aa*aa/(c_*c_); + double omth2=1.-4*aa*pow(c_,-1.5) + +3.*aa*aa/(c_*c_); + double x_bar=1./param_beta_ + *sqrt(g_rr)*(pos[1]-c_)/c_; + double xb2=x_bar*x_bar; + double y_bar=1./param_beta_ + *sqrt(g_thth)*(M_PI/2.-pos[2])/c_; + double yb2=y_bar*y_bar; + + double a1=0., a2=0., a3=0., + b1=0., b2=0., b3=0.; + switch (perturb_kind_) { + case 1: // Radial translation + a1=1.;a3=param_eta_*sin(Omegac*pos[0]); + b2=1.; + break; + case 2: // Vertical translation + a1=1.; + b2=1.;b3=param_eta_*sin(Omegac*pos[0]); + break; + case 3: // Rotation + a1=cos(Omegac*pos[0]);a2=sin(Omegac*pos[0]); + b1=-sin(Omegac*pos[0]);b2=cos(Omegac*pos[0]); + break; + case 4: // Expansion + a1=1.+param_eta_*sin(Omegac*pos[0]); + b2=1.+param_eta_*sin(Omegac*pos[0]); + break; + case 5: // Simple shear radial + a1=1.;a2=param_eta_*sin(Omegac*pos[0]); + b2=1.; + break; + case 6: // Simple shear vertical + a1=1.; + b1=param_eta_*sin(Omegac*pos[0]);b2=1.; + break; + case 7: // Pure shear + a1=1.+param_eta_*sin(Omegac*pos[0]); + b2=1./a1; + break; + default: + throwError("In DeformedTorus.C::operator():" + "Unrecognized perturbation kind"); + } + double deforx = a1*x_bar+a2*y_bar+a3; + double defory = b1*x_bar+b2*y_bar+b3; + double ff = omr2*deforx*deforx + +omth2*defory*defory + -1.; + + return ff; +} + +void DeformedTorus::getVelocity(double const pos[4], double vel[4]) +{ + //cout << "pos in getvel: " << pos[2] << " " << pos[3] << endl; + double aa=gg_->spin(); + + // Computations at the torus center for Omegac, lc + double posc[4]={0.,c_,M_PI/2.,0.};//don't care about t and phi + double g_tt=gg_->gmunu(posc,0,0);// covar components + double g_rr=gg_->gmunu(posc,1,1); + double g_thth=gg_->gmunu(posc,2,2); + double g_tp=gg_->gmunu(posc,0,3); + double g_pp=gg_->gmunu(posc,3,3); + double Omegac=1./(pow(c_,1.5)+aa); // Kepler rotation vel + double lc=-(Omegac*g_pp+g_tp)/(Omegac*g_tp+g_tt); // Rescaled ang mom + + // Now computations at the torus surface for gmunu_up coef + double gtt=gg_->gmunu_up(pos,0,0); + double gthth=gg_->gmunu_up(pos,2,2); + double grr=gg_->gmunu_up(pos,1,1); + double gpp=gg_->gmunu_up(pos,3,3); + double gtp=gg_->gmunu_up(pos,0,3); + + // xbar and ybar unperturbed + double xbar=1./param_beta_ + *sqrt(g_rr)*(pos[1]-c_)/c_; + double ybar=1./param_beta_ + *sqrt(g_thth)*(M_PI/2.-pos[2])/c_; + + // dr/dt and dtheta/dt depending on transformation + + double drdt=0., dthdt=0.; + switch (perturb_kind_) { + case 1: // Radial translation + drdt=c_/sqrt(g_rr)*param_beta_*param_eta_ + *Omegac*cos(Omegac*pos[0]); + break; + case 2: // Vertical translation + dthdt=-c_/sqrt(g_thth)*param_beta_*param_eta_ + *Omegac*cos(Omegac*pos[0]); + break; + case 3: // Rotation + { + double x0 = xbar*cos(Omegac*pos[0])-ybar*sin(Omegac*pos[0]), + y0 = xbar*sin(Omegac*pos[0])+ybar*cos(Omegac*pos[0]); + drdt = c_/sqrt(g_rr)*param_beta_*Omegac + *(-sin(Omegac*pos[0])*x0+cos(Omegac*pos[0])*y0); + dthdt = -c_/sqrt(g_thth)*param_beta_*Omegac + *(-cos(Omegac*pos[0])*x0-sin(Omegac*pos[0])*y0); + } + break; + case 4: // Expansion + { + double x0 = xbar/(1.+param_eta_*sin(Omegac*pos[0])), + y0 = ybar/(1.+param_eta_*sin(Omegac*pos[0])); + drdt = c_/sqrt(g_rr)*param_beta_*Omegac*param_eta_ + *cos(Omegac*pos[0])*x0; + dthdt = -c_/sqrt(g_thth)*param_beta_*Omegac*param_eta_ + *cos(Omegac*pos[0])*y0; + } + break; + case 5: // Simple shear radial + { + double y0 = ybar; + drdt = c_/sqrt(g_rr)*param_beta_*Omegac*param_eta_ + *cos(Omegac*pos[0])*y0; + } + break; + case 6: // Simple shear vertical + { + double x0 = xbar; + dthdt = -c_/sqrt(g_thth)*param_beta_*Omegac*param_eta_ + *cos(Omegac*pos[0])*x0; + } + break; + case 7: // Pure shear + { + double x0 = xbar/(1.+param_eta_*sin(Omegac*pos[0])), + y0 = ybar*(1.+param_eta_*sin(Omegac*pos[0])); + drdt = c_/sqrt(g_rr)*param_beta_*Omegac*param_eta_ + *cos(Omegac*pos[0])*x0; + dthdt = -c_/sqrt(g_thth)*param_beta_*Omegac*param_eta_ + *( + -cos(Omegac*pos[0]) + /( (1.+param_eta_*sin(Omegac*pos[0]))* + (1.+param_eta_*sin(Omegac*pos[0])) ) + )*y0; + } + break; + default: + throwError("In DeformedTorus.C::operator():" + "Unrecognized perturbation kind"); + } + + double u_t2 = -1./ + (gtt+lc*lc*gpp-2.*lc*gtp+drdt*drdt*grr+dthdt*dthdt*gthth); + + if (u_t2 < 0.) { + stringstream ss; + ss << "DeformedTorus::getVelocity(pos=["; + for (int i=0; i<3; ++i) ss << pos[i] << ", "; + ss << pos[3] << "]): u_t^2 is negative."; + throwError(ss.str()); + } + + double u_t=-sqrt(u_t2); + double u_p=-lc*u_t; + + vel[0] = gtt*u_t+gtp*u_p; + vel[1] = drdt*vel[0]; + vel[2] = dthdt*vel[0]; + vel[3] = gpp*u_p+gtp*u_t; +} + +void DeformedTorus::metric(Gyoto::SmartPointer met) +{ + if (met->kind() != "KerrBL") + throwError("DeformedTorus::metric(): only KerrBL, please"); + //if (gg_) gg_ -> unhook(this); + gg_ = SmartPointer(met); + Generic::gg_ = gg_; + //if (gg_) gg_ -> hook(this); +} + + + + +/*int DeformedTorus::Impact(Gyoto::Photon* ph, size_t index, + Astrobj::Properties *data) { + double p1[8], p2[8]; + ph->getCoord(index, p1); + ph->getCoord(index+1, p2); + double tmin, minval; + + if (gg_ -> coordKind() == GYOTO_COORDKIND_SPHERICAL){ + //Allows theta and phi to be in the correct range + checkPhiTheta(p1); + checkPhiTheta(p2); + } + + double t1 = p1[0], t2 = p2[0]; + double val1=(*this)(p1), val2=(*this)(p2); + return 0; + }*/ + +double DeformedTorus::emission(double nu_em, double, double *, + double *) const{ + if (flag_radtransf_) + throwError("Radiative transfer not implemented for DeformedTorus."); + //cout << "in flaring emission" << endl; + //return (*spectrum_)(nu_em); + return 1.; +} diff --git a/lib/DynamicalDisk.C b/lib/DynamicalDisk.C index 64a544f9..2b5259c8 100644 --- a/lib/DynamicalDisk.C +++ b/lib/DynamicalDisk.C @@ -51,31 +51,112 @@ GYOTO_PROPERTY_END(DynamicalDisk, PatternDiskBB::properties) DynamicalDisk::DynamicalDisk() : PatternDiskBB(), - tinit_(0.), dt_(1.) + dirname_(NULL), + tinit_(0.), + dt_(1.), + nb_times_(0), + emission_array_(NULL), + opacity_array_(NULL), + velocity_array_(NULL), + radius_array_(NULL), + dnu_array_(NULL), + nu0_array_(NULL), + nnu_array_(NULL), + dphi_array_(NULL), + nphi_array_(NULL), + dr_array_(NULL), + nr_array_(NULL) { GYOTO_DEBUG << "DynamicalDisk Construction" << endl; } DynamicalDisk::DynamicalDisk(const DynamicalDisk& o) : PatternDiskBB(o), - tinit_(o.tinit_), dt_(o.dt_) + dirname_(NULL), + tinit_(o.tinit_), + dt_(o.dt_), + nb_times_(0), + emission_array_(NULL), + opacity_array_(NULL), + velocity_array_(NULL), + radius_array_(NULL), + dnu_array_(NULL), + nu0_array_(NULL), + nnu_array_(NULL), + dphi_array_(NULL), + nphi_array_(NULL), + dr_array_(NULL), + nr_array_(NULL) { GYOTO_DEBUG << "DynamicalDisk Copy" << endl; +#ifdef GYOTO_USE_CFITSIO + if (o.dirname_) { + dirname_ = new char[strlen(o.dirname_)+1]; + strcpy(dirname_,o.dirname_); + } + if (!nb_times_) return; + emission_array_ = new double*[nb_times_] ; + opacity_array_ = new double*[nb_times_] ; + velocity_array_ = new double*[nb_times_] ; + radius_array_ = new double*[nb_times_] ; + dnu_array_ = new double [nb_times_]; + nu0_array_ = new double [nb_times_]; + nnu_array_ = new size_t [nb_times_]; + nphi_array_ = new size_t [nb_times_]; + nr_array_ = new size_t [nb_times_]; + memcpy(dnu_array_, o.dnu_array_, nb_times_*sizeof(double)); + memcpy(nu0_array_, o.nu0_array_, nb_times_*sizeof(double)); + memcpy(nnu_array_, o.nnu_array_, nb_times_*sizeof(size_t)); + memcpy(nnu_array_, o.nnu_array_, nb_times_*sizeof(size_t)); + memcpy(nphi_array_, o.nphi_array_, nb_times_*sizeof(size_t)); + memcpy(nr_array_, o.nr_array_, nb_times_*sizeof(size_t)); + for (int i=1; i<=nb_times_; i++) { + size_t nnu = nnu_array_ [i-1]; + size_t nphi = nphi_array_[i-1]; + size_t nr = nr_array_ [i-1]; + size_t nel1=nnu*nphi*nr, nel2=2*nr*nphi; + emission_array_[i-1] = new double[nel1]; + opacity_array_ [i-1] = new double[nel1]; + velocity_array_[i-1] = new double[nel2]; + radius_array_ [i-1] = new double[nr ]; + memcpy(emission_array_[i-1], o.emission_array_[i-1], nel1*sizeof(double)); + memcpy(opacity_array_ [i-1], o.opacity_array_ [i-1], nel1*sizeof(double)); + memcpy(velocity_array_[i-1], o.velocity_array_[i-1], nel2*sizeof(double)); + memcpy(radius_array_ [i-1], o.radius_array_ [i-1], nr *sizeof(double)); + } +#endif } DynamicalDisk* DynamicalDisk::clone() const { return new DynamicalDisk(*this); } DynamicalDisk::~DynamicalDisk() { GYOTO_DEBUG << "DynamicalDisk Destruction" << endl; - delete [] emission_array_; - delete [] opacity_array_; - delete [] velocity_array_; - delete [] radius_array_; - delete [] dnu_array_; - delete [] nu0_array_; - delete [] nnu_array_; - delete [] nphi_array_; - delete [] nr_array_; + for (int i=1; i<=nb_times_; i++) { + if (emission_array_) delete [] emission_array_[i-1]; + if (opacity_array_) delete [] opacity_array_ [i-1]; + if (velocity_array_) delete [] velocity_array_[i-1]; + if (radius_array_) delete [] radius_array_ [i-1]; + } + if (emission_array_) delete [] emission_array_; + if (opacity_array_) delete [] opacity_array_ ; + if (velocity_array_) delete [] velocity_array_; + if (radius_array_) delete [] radius_array_ ; + if (dnu_array_) delete [] dnu_array_; + if (nu0_array_) delete [] nu0_array_; + if (nnu_array_) delete [] nnu_array_; + if (nphi_array_) delete [] nphi_array_; + if (nr_array_) delete [] nr_array_; + emission_array_ = NULL; + opacity_array_ = NULL; + velocity_array_ = NULL; + radius_array_ = NULL; + dnu_array_ = NULL; + nu0_array_ = NULL; + nnu_array_ = NULL; + nphi_array_ = NULL; + nr_array_ = NULL; + nb_times_ = 0; + if (dirname_) delete dirname_; } double const * DynamicalDisk::getVelocity() const { return PatternDiskBB::getVelocity(); } @@ -139,9 +220,39 @@ double DynamicalDisk::emission(double nu, double dsem, return 0.; } -std::string DynamicalDisk::file() const {return dirname_;} +std::string DynamicalDisk::file() const {return dirname_?dirname_:"";} void DynamicalDisk::file(std::string const &fname) { #ifdef GYOTO_USE_CFITSIO + if (nb_times_) { + // first free current arrays, if any + for (int i=1; i<=nb_times_; i++) { + if (emission_array_) delete [] emission_array_[i-1]; + if (opacity_array_) delete [] opacity_array_ [i-1]; + if (velocity_array_) delete [] velocity_array_[i-1]; + if (radius_array_) delete [] radius_array_ [i-1]; + } + if (emission_array_) delete [] emission_array_; + if (opacity_array_) delete [] opacity_array_ ; + if (velocity_array_) delete [] velocity_array_; + if (radius_array_) delete [] radius_array_ ; + if (dnu_array_) delete [] dnu_array_; + if (nu0_array_) delete [] nu0_array_; + if (nnu_array_) delete [] nnu_array_; + if (nphi_array_) delete [] nphi_array_; + if (nr_array_) delete [] nr_array_; + emission_array_ = NULL; + opacity_array_ = NULL; + velocity_array_ = NULL; + radius_array_ = NULL; + dnu_array_ = NULL; + nu0_array_ = NULL; + nnu_array_ = NULL; + nphi_array_ = NULL; + nr_array_ = NULL; + nb_times_ = 0; + } + + if (dirname_) delete dirname_; dirname_ = new char[strlen(fname.c_str())+1]; strcpy(dirname_,fname.c_str()); DIR *dp; diff --git a/lib/DynamicalDiskBolometric.C b/lib/DynamicalDiskBolometric.C new file mode 100644 index 00000000..2cda7c34 --- /dev/null +++ b/lib/DynamicalDiskBolometric.C @@ -0,0 +1,159 @@ +/* + Copyright 2013, 2016 Frederic Vincent, Thibaut Paumard + + 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 . + */ +#define throwCfitsioError(status) \ + { fits_get_errstatus(status, ermsg); throwError(ermsg); } + +#include "GyotoPhoton.h" +#include "GyotoDynamicalDiskBolometric.h" +#include "GyotoUtils.h" +#include "GyotoFactoryMessenger.h" +#include "GyotoKerrBL.h" +#include "GyotoKerrKS.h" + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace Gyoto; +using namespace Gyoto::Astrobj; + +/// Properties +#include "GyotoProperty.h" +GYOTO_PROPERTY_START(DynamicalDiskBolometric, "DynamicalDisk with bolometric emission") +GYOTO_PROPERTY_END(DynamicalDiskBolometric, DynamicalDisk::properties) + + +DynamicalDiskBolometric::DynamicalDiskBolometric() : + DynamicalDisk() +{ + GYOTO_DEBUG << "DynamicalDiskBolometric Construction" << endl; +} + +DynamicalDiskBolometric::DynamicalDiskBolometric(const DynamicalDiskBolometric& o) : + DynamicalDisk(o) +{ + GYOTO_DEBUG << "DynamicalDiskBolometric Copy" << endl; +} +DynamicalDiskBolometric* DynamicalDiskBolometric::clone() const +{ return new DynamicalDiskBolometric(*this); } + +DynamicalDiskBolometric::~DynamicalDiskBolometric() { + GYOTO_DEBUG << "DynamicalDiskBolometric Destruction" << endl; +} + +double DynamicalDiskBolometric::emission(double nu_em, double dsem, + double *, + double coord_obj[8]) const{ + throwError("In DynamicalDiskBolometric::emission: " + "not implemented"); +} + +double DynamicalDiskBolometric::bolometricEmission(double dsem, + double coord_obj[8]) const{ + // cout << "in bolometricem, will return: " << DynamicalDisk::emission(0.,dsem,coord_obj,coord_obj) << endl; + return DynamicalDisk::emission(0.,dsem,coord_obj,coord_obj); + //never mind about 1st and 3rd elements +} + +void DynamicalDiskBolometric::processHitQuantities(Photon* ph, + double* coord_ph_hit, + double* coord_obj_hit, double dt, + Properties* data) const { +#if GYOTO_DEBUG_ENABLED + GYOTO_DEBUG << endl; +#endif + /* + NB: freqObs is the observer's frequency chosen in + Screen::getRayCoord for the actual computation of the geodesic ; + the physical value of nuobs will be used in spectrum + computations by resorting to the xml specifications of the user + (see below) ; this freqObs is used to transform the null + worldline parameter dlambda (see below) + */ + double freqObs=ph->freqObs(); // this is a useless quantity, always 1 + double dlambda = dt/coord_ph_hit[4]; //dlambda = dt/tdot + double ggredm1 = -gg_->ScalarProd(coord_ph_hit,coord_obj_hit+4, + coord_ph_hit+4);// / 1.; + //this is nu_em/nu_obs + double ggred = 1./ggredm1; //this is nu_obs/nu_em + double dsem = dlambda*ggredm1; // *1. + double inc =0.; + if (data) { +#if GYOTO_DEBUG_ENABLED + GYOTO_DEBUG << "data requested. " + << ", ggredm1=" << ggredm1 + << ", ggred=" << ggred + << endl; +#endif + + if (data->redshift) { + *data->redshift=ggred; +#if GYOTO_DEBUG_ENABLED + GYOTO_DEBUG_EXPR(*data->redshift); +#endif + } + if (data->time) { + *data->time=coord_ph_hit[0]; +#if GYOTO_DEBUG_ENABLED + GYOTO_DEBUG_EXPR(*data->time); +#endif + } + if (data->impactcoords) { + memcpy(data->impactcoords, coord_obj_hit, 8 * sizeof(double)); + memcpy(data->impactcoords+8, coord_ph_hit, 8 * sizeof(double)); + } +#if GYOTO_DEBUG_ENABLED + GYOTO_DEBUG << "dlambda = (dt="<< dt << ")/(tdot="<< coord_ph_hit[4] + << ") = " << dlambda << ", dsem=" << dsem << endl; +#endif + if (data->intensity) throwError("In DynamicalDiskBolometric::process: " + "unimplemented"); + else if (data->user4) { + inc = (bolometricEmission(dsem, coord_obj_hit)) + * (ph -> getTransmission(size_t(-1))) + * ggred*ggred*ggred*ggred; // I/nu^4 invariant + *data->user4 += inc; +#if GYOTO_DEBUG_ENABLED + GYOTO_DEBUG_EXPR(*data->user4); +#endif + + } + if (data->binspectrum) throwError("In DynamicalDiskBolometric::process: " + "unimplemented"); + if (data->spectrum) throwError("In DynamicalDiskBolometric::process: " + "unimplemented"); + /* update photon's transmission */ + ph -> transmit(size_t(-1), + transmission(freqObs*ggredm1, dsem,coord_ph_hit)); + } else { +# if GYOTO_DEBUG_ENABLED + GYOTO_DEBUG << "NO data requested!" << endl; +# endif + } +} diff --git a/lib/EquatorialHotSpot.C b/lib/EquatorialHotSpot.C new file mode 100644 index 00000000..218e82b4 --- /dev/null +++ b/lib/EquatorialHotSpot.C @@ -0,0 +1,231 @@ +/* + Copyright 2013 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 . +*/ +#include "GyotoEquatorialHotSpot.h" +#include "GyotoPhoton.h" +#include "GyotoPageThorneDisk.h" +#include "GyotoUtils.h" +#include "GyotoFactoryMessenger.h" +#include "GyotoKerrBL.h" +#include "GyotoKerrKS.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace Gyoto; +using namespace Gyoto::Astrobj; + +/// Properties +#include "GyotoProperty.h" +GYOTO_PROPERTY_START(EquatorialHotSpot, "Equatorial hot spot with beaming") +GYOTO_PROPERTY_DOUBLE(EquatorialHotSpot, SpotRadSize, spotRadSize) +GYOTO_PROPERTY_STRING(EquatorialHotSpot, BeamingKind, beaming, + "One of: IsotropicBeaming, NormalBeaming, RadialBeaming") +GYOTO_PROPERTY_DOUBLE(EquatorialHotSpot, BeamAngle, beamAngle) +GYOTO_WORLDLINE_PROPERTY_END(EquatorialHotSpot, ThinDisk::properties) + +// accessors +void EquatorialHotSpot::spotRadSize(double t) {sizespot_=t;} +double EquatorialHotSpot::spotRadSize() const {return sizespot_;} + +void EquatorialHotSpot::beaming(std::string const &b) { + if (b=="IsotropicBeaming") beaming_=IsotropicBeaming; + else if (b=="NormalBeaming") beaming_=NormalBeaming; + else if (b=="RadialBeaming") beaming_=RadialBeaming; + else throwError("Unknown beaming kind"); +} +std::string EquatorialHotSpot::beaming() const { + string b; + switch (beaming_) { + case IsotropicBeaming: b="IsotropicBeaming"; break; + case NormalBeaming: b="NormalBeaming"; break; + case RadialBeaming: b="RadialBeaming"; break; + default: throwError("Unknown beaming kind"); + } + return b; +} + +void EquatorialHotSpot::beamAngle(double t) {beamangle_=t;} +double EquatorialHotSpot::beamAngle() const {return beamangle_;} + +// Needed for legacy XML files +int EquatorialHotSpot::setParameter(string name, string content, string unit) { + double coord[8]; + char* tc = const_cast(content.c_str()); + if (name=="InitialCoordinate") { + name=="InitCoord"; + return ThinDisk::setParameter(name, content, unit); + } else if (name=="Position") { + if (FactoryMessenger::parseArray(content, coord, 4) != 4) + throwError("Worldline \"Position\" requires exactly 4 tokens"); + if (init_vel_) { + setInitCoord(coord, init_vel_); + delete[] init_vel_; init_vel_=NULL; + } else setPosition(coord); + wait_pos_ = 0; + } else if (name=="Velocity") { + if (FactoryMessenger::parseArray(content, coord, 3) != 3) + throwError("Worldline \"Velocity\" requires exactly 3 tokens"); + if (wait_pos_) { + if (init_vel_) delete [] init_vel_; + init_vel_ = new double[3]; + memcpy(init_vel_, coord, 3*sizeof(double)); + } else setVelocity(coord); + } else if (name=="NormalBeaming") { + GYOTO_WARNING << "<" << name << "/> is deprecated, please use " + " " << name << " instead"; + beaming(name); + } else if (name=="NormalBeaming" || name=="RadialBeaming") { + GYOTO_WARNING << "<" << name << "/> is deprecated, please use \n"; + GYOTO_WARNING << " " << name << " " << endl; + GYOTO_WARNING << " " << content << "" << endl; + GYOTO_WARNING <<" instead"; + beaming(name); + beamangle_=atof(content.c_str()); + } else return ThinDisk::setParameter(name, content, unit); + return 0; +} + +// Needed for wait_pos_ +#ifdef GYOTO_USE_XERCES +void EquatorialHotSpot::fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const { + if (p.name == "InitCoord") { + if (imin_ <= imax_) { + double coord[8]; + getInitialCoord(coord); + // For massive particule, express initial condition with 3-velocity + double vel[3] = {coord[5]/coord[4], coord[6]/coord[4], coord[7]/coord[4]}; + fmp -> setParameter ("Position", coord, 4); + fmp -> setParameter ("Velocity", vel, 3); + } + return; + } + ThinDisk::fillProperty(fmp, p); +} + +void EquatorialHotSpot::setParameters(FactoryMessenger* fmp) { + wait_pos_ = 1; + ThinDisk::setParameters(fmp); + wait_pos_ = 0; + if (init_vel_) { + delete[] init_vel_; init_vel_=NULL; + throwError("Worldline::setParameters(): " + "Velocity was found but not Position"); + } +} +#endif +/// + +Gyoto::Astrobj::EquatorialHotSpot::EquatorialHotSpot() + : ThinDisk("EquatorialHotSpot"), Worldline(), + sizespot_(0.), beaming_(IsotropicBeaming), beamangle_(0.) +{ + GYOTO_DEBUG << "Building EquatorialHotSpot"; +} + +Gyoto::Astrobj::EquatorialHotSpot::EquatorialHotSpot(const EquatorialHotSpot &o) + : ThinDisk(o), Worldline(o), + sizespot_(o.sizespot_), beaming_(o.beaming_), beamangle_(o.beamangle_) +{ + GYOTO_DEBUG << "Copying EquatorialHotSpot"; +} +EquatorialHotSpot * EquatorialHotSpot::clone() const { + return new EquatorialHotSpot(*this); } + +Gyoto::Astrobj::EquatorialHotSpot::~EquatorialHotSpot() +{ + GYOTO_DEBUG << "Destroying EquatorialHotSpot"; +} + +double EquatorialHotSpot::getMass() const {return 1. ;} + +void EquatorialHotSpot::metric(SmartPointer gg) { + ThinDisk::metric(gg); + Worldline::metric(gg); +} + +void EquatorialHotSpot::setInitialCondition(double coord[8]) { + if (!metric_) throwError("Please set metric before calling " + "EquatorialHotSpot::setInitialCondition(double*)"); + Worldline::setInitialCondition(metric_, coord, 1); +} + +void EquatorialHotSpot::getVelocity(double const pos[4], double vel[4]) { + double coord_spot[4]={pos[0]}; + const_cast(this) + ->getCoord(coord_spot, 1, coord_spot+1, coord_spot+2, coord_spot+3); + gg_ -> circularVelocity(coord_spot, vel, dir_); +} + +double EquatorialHotSpot::emission(double nu_em, double dsem, + double coord_ph[8], + double coord_obj[8]) const{ + double coord_spot[4]={coord_obj[0]}; + const_cast(this) + ->getCartesian(coord_spot, 1, coord_spot+1, coord_spot+2, coord_spot+3); + //above: nasty trick to deal with constness of emission + double xspot=coord_spot[1], yspot=coord_spot[2]; + double rr=coord_obj[1], phi=coord_obj[3]; + double difx=(rr*cos(phi)-xspot), + dify=(rr*sin(phi)-yspot); + double d2 = difx*difx+dify*dify; + double ds2=sizespot_*sizespot_; + if (d2 < ds2){ + // computing the angle (normal,photon tangent) + double gthth=gg_->gmunu(coord_ph,2,2); + double pth=coord_ph[6]; + double uemitter[4]; + const_cast(this) + ->getVelocity(coord_ph,uemitter); + double pscalu=fabs(gg_->ScalarProd(coord_ph,coord_ph+4, + uemitter)); + double cosalpha = 1./pscalu*sqrt(gthth)*fabs(pth); // = |cos(alpha)| + + // emission gaussian width + double sigma2=ds2/16.; // then 0 emission outside sizespot_ (4 sigma dist) + if (fabs(cosalpha)>1.) + throwError("In EquatorialHotSpot::emission:" + " impossible angle"); + + switch (beaming_) { + case IsotropicBeaming: + return exp(-d2/(2*sigma2)); + case NormalBeaming: + return cosalpha*cosalpha*exp(-d2/(2*sigma2)); + case RadialBeaming: + return (1.-cosalpha)*(1.-cosalpha)*exp(-d2/(2*sigma2)); + default: + throwError("In EquatorialHotSpot::emission:" + " incorrect beaming argument"); + } + } + else + { + return 0.; + } +} diff --git a/lib/InflateStar.C b/lib/InflateStar.C new file mode 100644 index 00000000..65dbedf1 --- /dev/null +++ b/lib/InflateStar.C @@ -0,0 +1,139 @@ +/* + 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 . + */ + +#include "GyotoUtils.h" +#include "GyotoInflateStar.h" +#include "GyotoPhoton.h" +#include "GyotoPowerLawSpectrum.h" +#include "GyotoBlackBodySpectrum.h" +#include "GyotoFactoryMessenger.h" + +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace Gyoto; +using namespace Gyoto::Astrobj; + +/// Properties +#include "GyotoProperty.h" +GYOTO_PROPERTY_START(InflateStar, "Star with inflation") +GYOTO_PROPERTY_DOUBLE_UNIT(InflateStar, TimeInflateInit, timeInflateInit, + "Start time of inflation (geometrical units)") +GYOTO_PROPERTY_DOUBLE_UNIT(InflateStar, TimeInflateStop, timeInflateStop, + "End time of inflation (geometrical units)") +GYOTO_PROPERTY_DOUBLE_UNIT(InflateStar, RadiusStop, radiusStop, + "End radius (geometrical units)") +GYOTO_PROPERTY_END(InflateStar, Star::properties) + +GYOTO_PROPERTY_ACCESSORS(InflateStar, double, + timeinflateinit_, timeInflateInit) +double InflateStar::timeInflateInit(const string &unit) const { + return Units::FromGeometricalTime(timeInflateInit(), unit, gg_); +} +void InflateStar::timeInflateInit(double t, const string &unit) { + timeInflateInit(Units::ToGeometricalTime(t, unit, gg_)); +} + +GYOTO_PROPERTY_ACCESSORS(InflateStar, double, + timeinflatestop_, timeInflateStop) +double InflateStar::timeInflateStop(const string &unit) const { + return Units::FromGeometricalTime(timeInflateStop(), unit, gg_); +} +void InflateStar::timeInflateStop(double t, const string &unit) { + timeInflateStop(Units::ToGeometricalTime(t, unit, gg_)); +} + +GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL(InflateStar, radiusstop_, radiusStop, gg_) + +double InflateStar::radiusAt(double time) const { + double radinit = radius(); + double radcur=radinit; + if (time>=timeinflatestop_) radcur=radiusstop_; + else if (time>timeinflateinit_){ + // linear increase of radius in between extreme times + radcur = radinit+(time-timeinflateinit_)/(timeinflatestop_-timeinflateinit_) + *(radiusstop_-radinit); + } + return radcur; +} + +double InflateStar::radiusAt(double time, const string &t_unit) const { + return radiusAt(Units::ToGeometricalTime(time, t_unit, gg_)); +} + +double InflateStar::radiusAt(double time, const string &t_unit, const string &r_unit) const { + return Units::FromGeometrical(radiusAt(time, t_unit), r_unit, gg_); +} + +InflateStar::InflateStar() : + Star(), + timeinflateinit_(0.), timeinflatestop_(0.), radiusstop_(DBL_MAX) +{ + kind_="InflateStar"; +# ifdef GYOTO_DEBUG_ENABLED + GYOTO_DEBUG << "done." << endl; +# endif +} + +InflateStar::InflateStar(const InflateStar& orig) : + Star(orig), + timeinflateinit_(orig.timeinflateinit_), timeinflatestop_(orig.timeinflatestop_), + radiusstop_(orig.radiusstop_) +{ +} + +InflateStar* InflateStar::clone() const { return new InflateStar(*this); } + +InflateStar::~InflateStar() { + if (debug()) cerr << "DEBUG: InflateStar::~InflateStar()\n"; +} + +string InflateStar::className() const { return string("InflateStar"); } +string InflateStar::className_l() const { return string("inflate_star"); } + +int InflateStar::Impact(Gyoto::Photon* ph, size_t index, + Astrobj::Properties *data) { + double p1[8]; + ph->getCoord(index, p1); + double time = p1[0]; + double radinit = radius(); + double radcur=radiusAt(time); + + critical_value_=radcur*radcur; + + return UniformSphere::Impact(ph,index,data); +} + +double InflateStar::emission(double nu_em, double dsem, + double coord_ph[8], double coord_obj[8]) const { + double time = coord_ph[0]; + double radinit = radius(); + double radcur=radiusAt(time); + double volume=radcur*radcur*radcur; + double volumei=radinit*radinit*radinit; + + return volumei/volume * UniformSphere::emission(nu_em, dsem, coord_ph, coord_obj); + +} diff --git a/lib/Makefile.am b/lib/Makefile.am index 5f06898a..104a5498 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -34,17 +34,20 @@ sover_LTLIBRARIES = libgyoto-stdplug.la libgyoto_stdplug_la_CPPFLAGS = $(AM_CPPFLAGS) -DGYOTO_PLUGIN=stdplug libgyoto_stdplug_la_SOURCES = KerrBL.C KerrKS.C Minkowski.C \ ChernSimons.C RezzollaZhidenko.C \ - Star.C StarTrace.C FixedStar.C Torus.C \ + Star.C StarTrace.C FixedStar.C InflateStar.C \ + Torus.C OscilTorus.C \ PowerLawSpectrum.C BlackBodySpectrum.C \ ThermalBremsstrahlungSpectrum.C \ ComplexAstrobj.C UniformSphere.C \ PageThorneDisk.C \ ThinDiskPL.C PolishDoughnut.C ThinDiskIronLine.C\ + DeformedTorus.C EquatorialHotSpot.C \ StdPlug.C # those files need cfitsio for some functionality -cfitsio_stdplug_sources = PatternDisk.C PatternDiskBB.C DynamicalDisk.C \ - Disk3D.C DynamicalDisk3D.C DirectionalDisk.C +cfitsio_stdplug_sources = PatternDisk.C PatternDiskBB.C \ + DynamicalDisk.C DynamicalDiskBolometric.C \ + Disk3D.C DynamicalDisk3D.C DirectionalDisk.C EXTRA_libgyoto_stdplug_la_SOURCES = $(cfitsio_stdplug_sources) libgyoto_stdplug_la_SOURCES += $(cfitsio_stdplug_sources) diff --git a/lib/Makefile.in b/lib/Makefile.in index f35c18fc..9d693ebc 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -161,6 +161,7 @@ libgyoto_stdplug_la_LIBADD = am__objects_1 = libgyoto_stdplug_la-PatternDisk.lo \ libgyoto_stdplug_la-PatternDiskBB.lo \ libgyoto_stdplug_la-DynamicalDisk.lo \ + libgyoto_stdplug_la-DynamicalDiskBolometric.lo \ libgyoto_stdplug_la-Disk3D.lo \ libgyoto_stdplug_la-DynamicalDisk3D.lo \ libgyoto_stdplug_la-DirectionalDisk.lo @@ -169,7 +170,9 @@ am_libgyoto_stdplug_la_OBJECTS = libgyoto_stdplug_la-KerrBL.lo \ libgyoto_stdplug_la-ChernSimons.lo \ libgyoto_stdplug_la-RezzollaZhidenko.lo \ libgyoto_stdplug_la-Star.lo libgyoto_stdplug_la-StarTrace.lo \ - libgyoto_stdplug_la-FixedStar.lo libgyoto_stdplug_la-Torus.lo \ + libgyoto_stdplug_la-FixedStar.lo \ + libgyoto_stdplug_la-InflateStar.lo \ + libgyoto_stdplug_la-Torus.lo libgyoto_stdplug_la-OscilTorus.lo \ libgyoto_stdplug_la-PowerLawSpectrum.lo \ libgyoto_stdplug_la-BlackBodySpectrum.lo \ libgyoto_stdplug_la-ThermalBremsstrahlungSpectrum.lo \ @@ -179,6 +182,8 @@ am_libgyoto_stdplug_la_OBJECTS = libgyoto_stdplug_la-KerrBL.lo \ libgyoto_stdplug_la-ThinDiskPL.lo \ libgyoto_stdplug_la-PolishDoughnut.lo \ libgyoto_stdplug_la-ThinDiskIronLine.lo \ + libgyoto_stdplug_la-DeformedTorus.lo \ + libgyoto_stdplug_la-EquatorialHotSpot.lo \ libgyoto_stdplug_la-StdPlug.lo $(am__objects_1) libgyoto_stdplug_la_OBJECTS = $(am_libgyoto_stdplug_la_OBJECTS) libgyoto_stdplug_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ @@ -488,14 +493,17 @@ sover_LTLIBRARIES = libgyoto-stdplug.la $(am__append_3) libgyoto_stdplug_la_CPPFLAGS = $(AM_CPPFLAGS) -DGYOTO_PLUGIN=stdplug libgyoto_stdplug_la_SOURCES = KerrBL.C KerrKS.C Minkowski.C \ ChernSimons.C RezzollaZhidenko.C Star.C StarTrace.C \ - FixedStar.C Torus.C PowerLawSpectrum.C BlackBodySpectrum.C \ + FixedStar.C InflateStar.C Torus.C OscilTorus.C \ + PowerLawSpectrum.C BlackBodySpectrum.C \ ThermalBremsstrahlungSpectrum.C ComplexAstrobj.C \ UniformSphere.C PageThorneDisk.C ThinDiskPL.C PolishDoughnut.C \ - ThinDiskIronLine.C StdPlug.C $(cfitsio_stdplug_sources) + ThinDiskIronLine.C DeformedTorus.C EquatorialHotSpot.C \ + StdPlug.C $(cfitsio_stdplug_sources) # those files need cfitsio for some functionality -cfitsio_stdplug_sources = PatternDisk.C PatternDiskBB.C DynamicalDisk.C \ - Disk3D.C DynamicalDisk3D.C DirectionalDisk.C +cfitsio_stdplug_sources = PatternDisk.C PatternDiskBB.C \ + DynamicalDisk.C DynamicalDiskBolometric.C \ + Disk3D.C DynamicalDisk3D.C DirectionalDisk.C EXTRA_libgyoto_stdplug_la_SOURCES = $(cfitsio_stdplug_sources) libgyoto_stdplug_la_LDFLAGS = -module -export-dynamic $(AM_LDFLAGS) -avoid-version @@ -519,9 +527,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu lib/Makefile + $(AUTOMAKE) --foreign lib/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -661,14 +669,19 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-BlackBodySpectrum.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-ChernSimons.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-ComplexAstrobj.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-DeformedTorus.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-DirectionalDisk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-Disk3D.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-DynamicalDisk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-DynamicalDisk3D.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-DynamicalDiskBolometric.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-EquatorialHotSpot.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-FixedStar.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-InflateStar.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-KerrBL.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-KerrKS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-Minkowski.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-OscilTorus.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-PageThorneDisk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-PatternDisk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgyoto_stdplug_la-PatternDiskBB.Plo@am__quote@ @@ -782,6 +795,13 @@ libgyoto_stdplug_la-FixedStar.lo: FixedStar.C @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-FixedStar.lo `test -f 'FixedStar.C' || echo '$(srcdir)/'`FixedStar.C +libgyoto_stdplug_la-InflateStar.lo: InflateStar.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-InflateStar.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-InflateStar.Tpo -c -o libgyoto_stdplug_la-InflateStar.lo `test -f 'InflateStar.C' || echo '$(srcdir)/'`InflateStar.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-InflateStar.Tpo $(DEPDIR)/libgyoto_stdplug_la-InflateStar.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='InflateStar.C' object='libgyoto_stdplug_la-InflateStar.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-InflateStar.lo `test -f 'InflateStar.C' || echo '$(srcdir)/'`InflateStar.C + libgyoto_stdplug_la-Torus.lo: Torus.C @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-Torus.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-Torus.Tpo -c -o libgyoto_stdplug_la-Torus.lo `test -f 'Torus.C' || echo '$(srcdir)/'`Torus.C @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-Torus.Tpo $(DEPDIR)/libgyoto_stdplug_la-Torus.Plo @@ -789,6 +809,13 @@ libgyoto_stdplug_la-Torus.lo: Torus.C @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-Torus.lo `test -f 'Torus.C' || echo '$(srcdir)/'`Torus.C +libgyoto_stdplug_la-OscilTorus.lo: OscilTorus.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-OscilTorus.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-OscilTorus.Tpo -c -o libgyoto_stdplug_la-OscilTorus.lo `test -f 'OscilTorus.C' || echo '$(srcdir)/'`OscilTorus.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-OscilTorus.Tpo $(DEPDIR)/libgyoto_stdplug_la-OscilTorus.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='OscilTorus.C' object='libgyoto_stdplug_la-OscilTorus.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-OscilTorus.lo `test -f 'OscilTorus.C' || echo '$(srcdir)/'`OscilTorus.C + libgyoto_stdplug_la-PowerLawSpectrum.lo: PowerLawSpectrum.C @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-PowerLawSpectrum.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-PowerLawSpectrum.Tpo -c -o libgyoto_stdplug_la-PowerLawSpectrum.lo `test -f 'PowerLawSpectrum.C' || echo '$(srcdir)/'`PowerLawSpectrum.C @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-PowerLawSpectrum.Tpo $(DEPDIR)/libgyoto_stdplug_la-PowerLawSpectrum.Plo @@ -852,6 +879,20 @@ libgyoto_stdplug_la-ThinDiskIronLine.lo: ThinDiskIronLine.C @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-ThinDiskIronLine.lo `test -f 'ThinDiskIronLine.C' || echo '$(srcdir)/'`ThinDiskIronLine.C +libgyoto_stdplug_la-DeformedTorus.lo: DeformedTorus.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-DeformedTorus.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-DeformedTorus.Tpo -c -o libgyoto_stdplug_la-DeformedTorus.lo `test -f 'DeformedTorus.C' || echo '$(srcdir)/'`DeformedTorus.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-DeformedTorus.Tpo $(DEPDIR)/libgyoto_stdplug_la-DeformedTorus.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='DeformedTorus.C' object='libgyoto_stdplug_la-DeformedTorus.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-DeformedTorus.lo `test -f 'DeformedTorus.C' || echo '$(srcdir)/'`DeformedTorus.C + +libgyoto_stdplug_la-EquatorialHotSpot.lo: EquatorialHotSpot.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-EquatorialHotSpot.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-EquatorialHotSpot.Tpo -c -o libgyoto_stdplug_la-EquatorialHotSpot.lo `test -f 'EquatorialHotSpot.C' || echo '$(srcdir)/'`EquatorialHotSpot.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-EquatorialHotSpot.Tpo $(DEPDIR)/libgyoto_stdplug_la-EquatorialHotSpot.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='EquatorialHotSpot.C' object='libgyoto_stdplug_la-EquatorialHotSpot.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-EquatorialHotSpot.lo `test -f 'EquatorialHotSpot.C' || echo '$(srcdir)/'`EquatorialHotSpot.C + libgyoto_stdplug_la-StdPlug.lo: StdPlug.C @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-StdPlug.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-StdPlug.Tpo -c -o libgyoto_stdplug_la-StdPlug.lo `test -f 'StdPlug.C' || echo '$(srcdir)/'`StdPlug.C @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-StdPlug.Tpo $(DEPDIR)/libgyoto_stdplug_la-StdPlug.Plo @@ -880,6 +921,13 @@ libgyoto_stdplug_la-DynamicalDisk.lo: DynamicalDisk.C @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-DynamicalDisk.lo `test -f 'DynamicalDisk.C' || echo '$(srcdir)/'`DynamicalDisk.C +libgyoto_stdplug_la-DynamicalDiskBolometric.lo: DynamicalDiskBolometric.C +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-DynamicalDiskBolometric.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-DynamicalDiskBolometric.Tpo -c -o libgyoto_stdplug_la-DynamicalDiskBolometric.lo `test -f 'DynamicalDiskBolometric.C' || echo '$(srcdir)/'`DynamicalDiskBolometric.C +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-DynamicalDiskBolometric.Tpo $(DEPDIR)/libgyoto_stdplug_la-DynamicalDiskBolometric.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='DynamicalDiskBolometric.C' object='libgyoto_stdplug_la-DynamicalDiskBolometric.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgyoto_stdplug_la-DynamicalDiskBolometric.lo `test -f 'DynamicalDiskBolometric.C' || echo '$(srcdir)/'`DynamicalDiskBolometric.C + libgyoto_stdplug_la-Disk3D.lo: Disk3D.C @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgyoto_stdplug_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgyoto_stdplug_la-Disk3D.lo -MD -MP -MF $(DEPDIR)/libgyoto_stdplug_la-Disk3D.Tpo -c -o libgyoto_stdplug_la-Disk3D.lo `test -f 'Disk3D.C' || echo '$(srcdir)/'`Disk3D.C @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgyoto_stdplug_la-Disk3D.Tpo $(DEPDIR)/libgyoto_stdplug_la-Disk3D.Plo diff --git a/lib/NumericalMetricLorene.C b/lib/NumericalMetricLorene.C index 1df2b98d..2594a058 100644 --- a/lib/NumericalMetricLorene.C +++ b/lib/NumericalMetricLorene.C @@ -68,7 +68,7 @@ GYOTO_PROPERTY_END(NumericalMetricLorene, Generic::properties) #define GYOTO_NML_PPHI_TOL 5 // tolerance on p_phi drift, percentage NumericalMetricLorene::NumericalMetricLorene() : - WIP("Metric::NumericalMetricLorene"), + WIP(""), Generic(GYOTO_COORDKIND_SPHERICAL, "NumericalMetricLorene"), filename_(NULL), mapet_(true), diff --git a/lib/OscilTorus.C b/lib/OscilTorus.C new file mode 100644 index 00000000..80d51442 --- /dev/null +++ b/lib/OscilTorus.C @@ -0,0 +1,490 @@ +#include "GyotoOscilTorus.h" +#include "GyotoFactoryMessenger.h" +#include "GyotoUtils.h" +#include "GyotoPhoton.h" +#include "GyotoDefs.h" +#include "GyotoProperty.h" + +#include +#include +#include +#include +#include +#include +#include +#include +using namespace Gyoto; +using namespace Gyoto::Astrobj; +using namespace std; + +GYOTO_PROPERTY_START(OscilTorus, + "Geometrical Torus with oscillations.") +GYOTO_PROPERTY_DOUBLE(OscilTorus, LargeRadius, largeRadius, + "Major radius, distance from centre of tube to centre of torus.") +GYOTO_PROPERTY_UNSIGNED_LONG(OscilTorus, Mode, mode, + "Mode number of oscillations m.") +GYOTO_PROPERTY_DOUBLE(OscilTorus,PolyCst, polyCst, + "Polytropic constant kappa.") +GYOTO_PROPERTY_DOUBLE(OscilTorus,PolyIndex, polyIndex, + "Polytropic index n.") +GYOTO_PROPERTY_DOUBLE(OscilTorus,CentralDensity, centralDensity, + "Central density.") +GYOTO_PROPERTY_STRING(OscilTorus,PerturbKind, perturbKind, + "One of: Radial Vertical X Plus Breathing") +GYOTO_PROPERTY_DOUBLE(OscilTorus, PerturbIntens, perturbIntens, + "Perturbations intensity.") +GYOTO_PROPERTY_FILENAME(OscilTorus, EmittingArea, emittingArea, + "Only for mode=0, file containing time series of cross section area") +GYOTO_PROPERTY_END(OscilTorus, Standard::properties) + +GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL_SPECIAL(OscilTorus, c_, largeRadius, gg_, + updateCachedValues(); , ) +GYOTO_PROPERTY_ACCESSORS(OscilTorus, unsigned long, mode_, mode) +GYOTO_PROPERTY_ACCESSORS(OscilTorus, double, polycst_, polyCst) +GYOTO_PROPERTY_ACCESSORS_SPECIAL(OscilTorus, double, polyindex_, polyIndex, + updateCachedValues(); , ) +GYOTO_PROPERTY_ACCESSORS(OscilTorus, double, central_density_, centralDensity) +GYOTO_PROPERTY_ACCESSORS(OscilTorus, double, perturb_intens_, perturbIntens) + +void OscilTorus::perturbKind(std::string const &k) { + if (k == "Radial") perturb_kind_ = Radial; + else if (k == "Vertical") perturb_kind_ = Vertical; + else if (k == "X") perturb_kind_ = X; + else if (k == "Plus") perturb_kind_ = Plus; + else if (k == "Breathing") perturb_kind_ = Breathing; + else { + string errmsg="unknown perturbation kind: '"; + errmsg += k + "'"; + throwError(errmsg.c_str()); + } + updateCachedValues(); +} +std::string OscilTorus::perturbKind() const { + switch (perturb_kind_) { + case Radial: return "Radial"; + case Vertical: return "Vertical"; + case X: return "X"; + case Plus: return "Plus"; + case Breathing: return "Breathing"; + } +} + +std::string OscilTorus::emittingArea() const {return emitting_area_;} +void OscilTorus::emittingArea(std::string const &f) { + if (f=="") { + with_cross_=0; + tt_.clear(); + area_.clear(); + return; + } + ifstream file(f, ios::in); + if (file) { + with_cross_=1; + double tt, area; + tt_.clear(); + area_.clear(); + while (!file.eof()) { + file >> tt >> area; + if (area) { + tt_.push_back(tt); + area_.push_back(area); + } else { + //this means that last line of file was blank, area is + //never 0, so just forget last line of data + break; + } + file.ignore(numeric_limits::max(), '\n');//next line + } + nbt_=tt_.size(); + } +} + +Gyoto::Astrobj::OscilTorus::OscilTorus() + : Standard("OscilTorus"), + c_(10.8), + mode_(0), + polycst_(0.01), + polyindex_(0.01), + central_density_(0.01), + perturb_kind_(Radial), + perturb_intens_(0.1), + kerrbl_(NULL), + tt_(), + area_(), + nbt_(0), + with_cross_(0), + sigma_(0.), + alpha_(0.), + w1_(0.), + w2_(0.), + omr2_(0.), + omth2_(0.), + Omegac_(0.), + lc_(0.), + g_rr_(0.), + g_thth_(0.), + hold_(false) +{ + GYOTO_DEBUG << "Building OscilTorus" << endl; +} + +Gyoto::Astrobj::OscilTorus::OscilTorus(const OscilTorus &orig) + : Standard(orig), + c_(orig.c_), + mode_(orig.mode_), + polycst_(orig.polycst_), + polyindex_(orig.polyindex_), + central_density_(orig.central_density_), + perturb_kind_(orig.perturb_kind_), + perturb_intens_(orig.perturb_intens_), + kerrbl_(NULL), + tt_(orig.tt_), + area_(orig.area_), + nbt_(orig.nbt_), + with_cross_(orig.with_cross_), + sigma_(orig.sigma_), + alpha_(orig.alpha_), + w1_(orig.w1_), + w2_(orig.w2_), + omr2_(orig.omr2_), + omth2_(orig.omth2_), + Omegac_(orig.Omegac_), + lc_(orig.lc_), + g_rr_(orig.g_rr_), + g_thth_(orig.g_thth_), + hold_(orig.hold_) +{ + GYOTO_DEBUG << "Copying OscilTorus" << endl; + if (gg_) kerrbl_=SmartPointer(gg_); + gg_->hook(this); +} +OscilTorus * OscilTorus::clone() const { return new OscilTorus(*this); } + +Gyoto::Astrobj::OscilTorus::~OscilTorus() +{ + GYOTO_DEBUG << "Destroying OscilTorus" << endl; + if (gg_) gg_->unhook(this); +} + +double OscilTorus::operator()(double const pos[4]) { + // cout << "pos= " << pos[1] << " " << pos[2] << " " << pos[3] << endl; + // if far from the torus center, return any >0 value, + // no hit + // if (fabs(pos[1]-c_)/c_*100. > 50.) return 100.; + // USE RMax IN XML INSTEAD + + double x_bar=0., y_bar=0.; + computeXbYb(pos,x_bar,y_bar); + // cout << "xb,yb= " << x_bar << " " << y_bar << endl; + double uu=0.; // perturbation-dependent factor of surface function + switch (perturb_kind_) { + case Radial: + uu = x_bar; + break; + case Vertical: + uu = y_bar; + break; + case X: + uu = x_bar*y_bar; + break; + case Plus: + case Breathing: + uu = 1+w1_*x_bar*x_bar+w2_*y_bar*y_bar; + break; + default: + throwError("In OscilTorus.C::operator():" + "Unrecognized perturbation kind"); + } + // non-perturbed torus f + double fnoperturb = omr2_*x_bar*x_bar + omth2_*y_bar*y_bar - 1.; + // correction + double correc=perturb_intens_*sigma_*alpha_*uu + *cos(mode_*pos[3] - Omegac_*(sigma_+mode_)*pos[0]); + + double ff = fnoperturb + correc; // perturbed torus f + //cout << "ff= " << ff << endl; + + return ff; +} + +void OscilTorus::getVelocity(double const pos[4], double vel[4]) +{ + + //cout << "in getveloc" << endl; + + double gtt=kerrbl_->gmunu_up(pos,0,0); + double gthth=kerrbl_->gmunu_up(pos,2,2); + double grr=kerrbl_->gmunu_up(pos,1,1); + double gpp=kerrbl_->gmunu_up(pos,3,3); + double gtp=kerrbl_->gmunu_up(pos,0,3); + + // Beta parameter + double poly=(polyindex_+1.)/polyindex_; + double centralp = polycst_*pow(central_density_,poly); + + double x_bar=0., y_bar=0.; + computeXbYb(pos,x_bar,y_bar); + + double vr=0., vth=0.; + switch (perturb_kind_) { + case Radial: + vr = 1.; + break; + case Vertical: + vth = 1.; + break; + case X: + vr = y_bar; + vth = x_bar; + break; + case Plus: + case Breathing: + vr = 2.*w1_*x_bar; + vth = 2.*w2_*y_bar; + break; + default: + throwError("In OscilTorus.C::operator():" + "Unrecognized perturbation kind"); + } + + double u_r = -perturb_intens_*sqrt(centralp/central_density_)*sqrt(g_rr_) + *alpha_*vr + *sin(mode_*pos[3] - Omegac_*(sigma_+mode_)*pos[0]); + + double u_th = perturb_intens_*sqrt(centralp/central_density_)*sqrt(g_thth_) + *alpha_*vth + *sin(mode_*pos[3] - Omegac_*(sigma_+mode_)*pos[0]); + + double u_t2 = (-1.-grr*u_r*u_r-gthth*u_th*u_th)/ + (gtt+lc_*lc_*gpp-2.*lc_*gtp); + + //cout << "num,deno= " << -1.-grr*u_r*u_r-gthth*u_th*u_th << " " << gtt+lc_*lc_*gpp-2.*lc_*gtp << endl; + + if (u_t2 < 0.) { + stringstream ss; + ss << "OscilTorus::getVelocity(pos=["; + for (int i=0; i<3; ++i) ss << pos[i] << ", "; + ss << pos[3] << "]): u_t^2 is negative."; + throwError(ss.str()); + } + + double u_t=-sqrt(u_t2); + double u_p=-lc_*u_t; + + vel[0] = gtt*u_t+gtp*u_p; + vel[1] = grr*u_r; + vel[2] = gthth*u_th; + vel[3] = gpp*u_p+gtp*u_t; +} + +void OscilTorus::computeXbYb(const double * pos, double & xb, double & yb){ + double aa=kerrbl_->spin(); + + // Computations at the torus center for Omegac_, lc_ + double posc[4]={0.,c_,M_PI/2.,0.};//don't care about t and phi + double g_tt=gg_->gmunu(posc,0,0);// covar components + double g_rr_=gg_->gmunu(posc,1,1); + double g_thth_=gg_->gmunu(posc,2,2); + double g_tp=gg_->gmunu(posc,0,3); + double g_pp=gg_->gmunu(posc,3,3); + double Omegac_=1./(pow(c_,1.5)+aa); // Kepler rotation vel + double lc_=-(Omegac_*g_pp+g_tp)/(Omegac_*g_tp+g_tt); // Rescaled ang mom + + // Now computations at the torus surface for gmunu_up coef + double gtt=kerrbl_->gmunu_up(pos,0,0); + double gthth=kerrbl_->gmunu_up(pos,2,2); + double grr=kerrbl_->gmunu_up(pos,1,1); + double gpp=kerrbl_->gmunu_up(pos,3,3); + double gtp=kerrbl_->gmunu_up(pos,0,3); + + // Beta parameter + double poly=(polyindex_+1.)/polyindex_; + double centralp = polycst_*pow(central_density_,poly); + double cs2 = poly*centralp/central_density_; + double ut_central2 = -1/(g_tt+g_pp*Omegac_*Omegac_+2.*g_tp*Omegac_); + double beta2 = 2.*polyindex_*cs2 + /(c_*c_*ut_central2*Omegac_*Omegac_); + if (beta2<=0.) { + throwError("In OscilTorus::computeXbYb(): " + "bad beta parameter"); + } + double beta=sqrt(beta2); + + xb=1./beta + *sqrt(g_rr_)*(pos[1]-c_)/c_; + yb=1./beta + *sqrt(g_thth_)*(M_PI/2.-pos[2])/c_; +} + +void OscilTorus::metric(Gyoto::SmartPointer met) +{ + if (!met) { + if (gg_) gg_->unhook(this); + kerrbl_=NULL; + gg_=NULL; + return; + } + kerrbl_ = Gyoto::SmartPointer(met); + if (!kerrbl_) throwError("OscilTorus::metric(): only KerrBL, please"); + if (gg_) gg_->unhook(this); + Standard::metric(met); + gg_->hook(this); + updateCachedValues(); +} + +void OscilTorus::tell(Hook::Teller* msg) { + if (msg==gg_) updateCachedValues(); +} + +void OscilTorus::updateCachedValues() { + if (hold_ || !gg_ || !c_) return; + double aa=kerrbl_->spin(); + double posc[4]={0.,c_,M_PI/2.,0.};//don't care about t and phi + double g_tt=gg_->gmunu(posc,0,0);// covar components + g_rr_=gg_->gmunu(posc,1,1); + g_thth_=gg_->gmunu(posc,2,2); + double g_tp=gg_->gmunu(posc,0,3); + double g_pp=gg_->gmunu(posc,3,3); + Omegac_=1./(pow(c_,1.5)+aa); // Kepler rotation vel + lc_=-(Omegac_*g_pp+g_tp)/(Omegac_*g_tp+g_tt); // Rescaled ang mom + + // Epicyclic pulsation + omr2_=1.-6./c_+8.*aa*pow(c_,-1.5) + -3.*aa*aa/(c_*c_); + omth2_=1.-4*aa*pow(c_,-1.5) + +3.*aa*aa/(c_*c_); + + if (omr2_<=0. || omth2_<=0.) { + throwError("In OscilTorus::updateCachedValues(): " + "bad epicyclic freq"); + } + double alpha0 = sqrt(polyindex_*sqrt(omr2_)*sqrt(omth2_)/M_PI); + switch (perturb_kind_) { + case Radial: // Radial oscillation + { + sigma_ = sqrt(omr2_); + alpha_ = alpha0*sqrt(2*(polyindex_+1)*omr2_); + break; + } + case Vertical: // Vertical oscillation + { + sigma_ = sqrt(omth2_); + alpha_ = alpha0*sqrt(2*(polyindex_+1)*omth2_); + break; + } + case X: // X mode + { + sigma_ = sqrt(omr2_+omth2_); + alpha_ = alpha0*sqrt(4*(polyindex_+1)*(polyindex_+2)*omr2_*omth2_); + break; + } + case Plus: // + mode + { + double sigmaminus2 = ( + (2.*polyindex_+1)*(omr2_+omth2_) + - sqrt( + 4.*polyindex_*(polyindex_+1) + *(omr2_-omth2_)*(omr2_-omth2_) + +(omr2_+omth2_)*(omr2_+omth2_) + ) + ) / (2.*polyindex_); + sigma_ = sqrt(sigmaminus2); + w1_ = - (omr2_ + *(2.*omth2_+2.*polyindex_*omth2_-polyindex_*sigmaminus2) + ) / (omth2_-omr2_); + w2_ = (omth2_ + *(2.*omr2_+2.*polyindex_*omr2_-polyindex_*sigmaminus2) + ) / (omth2_-omr2_); + alpha_ = alpha0* + sqrt( + (polyindex_+2)*(sigmaminus2-(omr2_+omth2_)) + / + (2.*polyindex_*sigmaminus2-(2.*polyindex_+1)*(omr2_+omth2_)) + ); + break; + } + case Breathing: // breathing mode + { + double sigmaplus2 = ( + (2.*polyindex_+1)*(omr2_+omth2_) + + sqrt( + 4.*polyindex_*(polyindex_+1) + *(omr2_-omth2_)*(omr2_-omth2_) + +(omr2_+omth2_)*(omr2_+omth2_) + ) + ) / (2.*polyindex_); + sigma_ = sqrt(sigmaplus2); + w1_ = - (omr2_ + *(2.*omth2_+2.*polyindex_*omth2_-polyindex_*sigmaplus2) + ) / (omth2_-omr2_); + w2_ = (omth2_ + *(2.*omr2_+2.*polyindex_*omr2_-polyindex_*sigmaplus2) + ) / (omth2_-omr2_); + alpha_ = alpha0* + sqrt( + (polyindex_+2)*(sigmaplus2-(omr2_+omth2_)) + / + (2.*polyindex_*sigmaplus2-(2.*polyindex_+1)*(omr2_+omth2_)) + ); + break; + } + default: + throwError("In OscilTorus.C::setParameter():" + "Unrecognized perturbation kind"); + } +} + +double OscilTorus::emission(double nu_em, double, double * cp, + double *) const{ + //cout << "r,theta,rcosth= " << cp[1] << " " << cp[2] << " " << cp[1]*cos(cp[2]) << endl; + if (flag_radtransf_) + throwError("Radiative transfer not implemented for OscilTorus."); + if (with_cross_){ + /* + If the torus mode under consideration (breathing - and +) + leads to change of volume, surface emitted intensity must be + modulated accordingly. + Simple assumption: I_nu \propto 1/volume + ie: \propto 1/(cross-section area) if mode number m=0 + So here the area of the cross-section is determined + at impact time to modulate the emitted intensity. + */ + if (mode_!=0) { + throwError("In OscilTorus.C::emission:" + "mode=0 is required for area determination"); + } + if (perturb_kind_==Vertical || perturb_kind_==X) + throwError("In OscilTorus::setParamter: bad perturbation kind"); + + // Rescaled time and area determination + double AA = Omegac_*sigma_; // cos modulation is 2pi/AA periodic + double tt=cp[0],tmax=tt_[0], area=-1.; + double myt = tt; + while (myt>2.*M_PI/AA) myt-=2.*M_PI/AA; // myt is in ]0,2pi/AA] + int ii=0; + while (myt>tmax && ii < nbt_-1){ + ii++; + tmax=tt_[ii]; + } + if (ii==0 || ii==nbt_-1){ + area=area_[ii]; + }else{ + area= + area_[ii-1]+(myt-tt_[ii-1])*(area_[ii]-area_[ii-1])/(tt_[ii-1]-tt_[ii]); + } + if (area<=0. || area!=area) throwError("In OscilTorus::emission:" + "bad area value"); + return 1./area; + }else{ + return 1.; + } +} + +#ifdef GYOTO_USE_XERCES +void OscilTorus::setParameters(Gyoto::FactoryMessenger *fmp) { + hold_=true; + Standard::setParameters(fmp); + hold_=false; + updateCachedValues(); +} +#endif diff --git a/lib/StdPlug.C b/lib/StdPlug.C index 3cddd026..694ebc19 100644 --- a/lib/StdPlug.C +++ b/lib/StdPlug.C @@ -29,16 +29,21 @@ #include "GyotoStar.h" #include "GyotoStarTrace.h" #include "GyotoFixedStar.h" +#include "GyotoInflateStar.h" #include "GyotoTorus.h" +#include "GyotoDeformedTorus.h" +#include "GyotoOscilTorus.h" #include "GyotoThinDisk.h" #include "GyotoPageThorneDisk.h" #include "GyotoThinDiskPL.h" #include "GyotoPolishDoughnut.h" #include "GyotoThinDiskIronLine.h" +#include "GyotoEquatorialHotSpot.h" #include "GyotoPatternDisk.h" #include "GyotoPatternDiskBB.h" #include "GyotoDynamicalDisk.h" +#include "GyotoDynamicalDiskBolometric.h" #include "GyotoDisk3D.h" #include "GyotoDynamicalDisk3D.h" #include "GyotoDirectionalDisk.h" @@ -62,7 +67,12 @@ extern "C" void __GyotostdplugInit() { Astrobj::Register("Star", &(Astrobj::Subcontractor)); Astrobj::Register("StarTrace", &(Astrobj::Subcontractor)); Astrobj::Register("FixedStar", &(Astrobj::Subcontractor)); + Astrobj::Register("InflateStar", &(Astrobj::Subcontractor)); Astrobj::Register("Torus", &(Astrobj::Subcontractor)); + Astrobj::Register("OscilTorus", + &(Astrobj::Subcontractor)); + Astrobj::Register("DeformedTorus", + &(Astrobj::Subcontractor)); Astrobj::Register("ThinDisk", &(Astrobj::Subcontractor)); Astrobj::Register("PageThorneDisk", &(Astrobj::Subcontractor)); @@ -72,12 +82,16 @@ extern "C" void __GyotostdplugInit() { &(Astrobj::Subcontractor)); Astrobj::Register("ThinDiskIronLine", &(Astrobj::Subcontractor)); + Astrobj::Register("EquatorialHotSpot", + &(Astrobj::Subcontractor)); Astrobj::Register("PatternDisk", &(Astrobj::Subcontractor)); Astrobj::Register("PatternDiskBB", &(Astrobj::Subcontractor)); Astrobj::Register("DynamicalDisk", &(Astrobj::Subcontractor)); + Astrobj::Register("DynamicalDiskBolometric", + &(Astrobj::Subcontractor)); Astrobj::Register("Disk3D", &(Astrobj::Subcontractor)); Astrobj::Register("DynamicalDisk3D", diff --git a/python/gyoto_std.i b/python/gyoto_std.i index 9db73a90..46230771 100644 --- a/python/gyoto_std.i +++ b/python/gyoto_std.i @@ -37,7 +37,9 @@ GyotoSmPtrTypeMapClassDerived(Astrobj, UniformSphere) GyotoSmPtrTypeMapClassDerived(Astrobj, Star) GyotoSmPtrTypeMapClassDerived(Astrobj, StarTrace) GyotoSmPtrTypeMapClassDerived(Astrobj, FixedStar) +GyotoSmPtrTypeMapClassDerived(Astrobj, InflateStar) GyotoSmPtrTypeMapClassDerived(Astrobj, Torus) +GyotoSmPtrTypeMapClassDerived(Astrobj, OscilTorus) GyotoSmPtrTypeMapClassDerived(Astrobj, PageThorneDisk) GyotoSmPtrTypeMapClassDerived(Astrobj, ThinDiskPL) GyotoSmPtrTypeMapClassDerived(Astrobj, PolishDoughnut) @@ -45,9 +47,12 @@ GyotoSmPtrTypeMapClassDerived(Astrobj, ThinDiskIronLine) GyotoSmPtrTypeMapClassDerived(Astrobj, PatternDisk) GyotoSmPtrTypeMapClassDerived(Astrobj, PatternDiskBB) GyotoSmPtrTypeMapClassDerived(Astrobj, DynamicalDisk) +GyotoSmPtrTypeMapClassDerived(Astrobj, DynamicalDiskBolometric) GyotoSmPtrTypeMapClassDerived(Astrobj, Disk3D) GyotoSmPtrTypeMapClassDerived(Astrobj, DynamicalDisk3D) GyotoSmPtrTypeMapClassDerived(Astrobj, DirectionalDisk) +GyotoSmPtrTypeMapClassDerived(Astrobj, DeformedTorus) +GyotoSmPtrTypeMapClassDerived(Astrobj, EquatorialHotSpot) GyotoSmPtrTypeMapClassDerived(Metric, KerrBL) GyotoSmPtrTypeMapClassDerived(Metric, KerrKS) @@ -82,7 +87,9 @@ GyotoSmPtrClassDerivedPtrHdr(Astrobj, Complex, ComplexAstrobj, GyotoComplexAstro GyotoSmPtrClassDerived(Astrobj, Star) GyotoSmPtrClassDerived(Astrobj, StarTrace) GyotoSmPtrClassDerived(Astrobj, FixedStar) +GyotoSmPtrClassDerived(Astrobj, InflateStar) GyotoSmPtrClassDerived(Astrobj, Torus) +GyotoSmPtrClassDerived(Astrobj, OscilTorus) GyotoSmPtrClassDerived(Astrobj, PageThorneDisk) GyotoSmPtrClassDerived(Astrobj, ThinDiskPL) GyotoSmPtrClassDerived(Astrobj, PolishDoughnut) @@ -90,9 +97,13 @@ GyotoSmPtrClassDerived(Astrobj, ThinDiskIronLine) GyotoSmPtrClassDerived(Astrobj, PatternDisk) GyotoSmPtrClassDerived(Astrobj, PatternDiskBB) GyotoSmPtrClassDerived(Astrobj, DynamicalDisk) +GyotoSmPtrClassDerived(Astrobj, DynamicalDiskBolometric) GyotoSmPtrClassDerived(Astrobj, Disk3D) GyotoSmPtrClassDerived(Astrobj, DynamicalDisk3D) GyotoSmPtrClassDerived(Astrobj, DirectionalDisk) +GyotoSmPtrClassDerived(Astrobj, DeformedTorus) +GyotoSmPtrClassDerived(Astrobj, EquatorialHotSpot) + GyotoSmPtrClassDerived(Metric, KerrBL) GyotoSmPtrClassDerived(Metric, KerrKS) diff --git a/python/gyoto_std_swig.h b/python/gyoto_std_swig.h index 84a92445..c5488b0e 100644 --- a/python/gyoto_std_swig.h +++ b/python/gyoto_std_swig.h @@ -10,7 +10,9 @@ #include "GyotoStar.h" #include "GyotoStarTrace.h" #include "GyotoFixedStar.h" +#include "GyotoInflateStar.h" #include "GyotoTorus.h" +#include "GyotoOscilTorus.h" #include "GyotoThinDisk.h" #include "GyotoPageThorneDisk.h" #include "GyotoThinDiskPL.h" @@ -19,9 +21,12 @@ #include "GyotoPatternDisk.h" #include "GyotoPatternDiskBB.h" #include "GyotoDynamicalDisk.h" +#include "GyotoDynamicalDiskBolometric.h" #include "GyotoDisk3D.h" #include "GyotoDynamicalDisk3D.h" #include "GyotoDirectionalDisk.h" +#include "GyotoDeformedTorus.h" +#include "GyotoEquatorialHotSpot.h" // include Spectrum headers #include "GyotoPowerLawSpectrum.h" diff --git a/python/tests_std/test_DeformedTorus.py b/python/tests_std/test_DeformedTorus.py new file mode 100644 index 00000000..94757661 --- /dev/null +++ b/python/tests_std/test_DeformedTorus.py @@ -0,0 +1,16 @@ +import numpy +import unittest +import gyoto +gyoto.loadPlugin('stdplug') +import gyoto_std + +class TestDeformedTorus(unittest.TestCase): + + def test_DeformedTorus(self): + ao=gyoto.Astrobj("DeformedTorus") + ao=gyoto_std.DeformedTorus() + sp=gyoto_std.BlackBody() + ao.spectrum(sp) + r=4. + ao.largeRadius(r) + self.assertTrue((ao.largeRadius() == r)) diff --git a/python/tests_std/test_DynamicalDiskBolometric.py b/python/tests_std/test_DynamicalDiskBolometric.py new file mode 100644 index 00000000..49b01fe1 --- /dev/null +++ b/python/tests_std/test_DynamicalDiskBolometric.py @@ -0,0 +1,12 @@ +import numpy +import unittest +import gyoto +gyoto.loadPlugin('stdplug') +import gyoto_std + +class TestDynamicalDiskBolometric(unittest.TestCase): + + def test_DynamicalDiskBolometric(self): + ao=gyoto.Astrobj("DynamicalDiskBolometric") + ao=gyoto_std.DynamicalDiskBolometric() + self.assertTrue(True) diff --git a/python/tests_std/test_EquatorialHotSpot.py b/python/tests_std/test_EquatorialHotSpot.py new file mode 100644 index 00000000..e1b7c670 --- /dev/null +++ b/python/tests_std/test_EquatorialHotSpot.py @@ -0,0 +1,18 @@ +import numpy +import unittest +import gyoto +gyoto.loadPlugin('stdplug') +import gyoto_std + +class TestEquatorialHotSpot(unittest.TestCase): + + def test_EquatorialHotSpot(self): + ao=gyoto.Astrobj("EquatorialHotSpot") + ao=gyoto_std.EquatorialHotSpot() + r=4. + ao.spotRadSize(r) + self.assertTrue((ao.spotRadSize() == r)) + kind="RadialBeaming" + ao.beaming(kind) + self.assertTrue((ao.beaming() == kind)) + self.assertRaises(gyoto.Error, ao.beaming, "foo") diff --git a/python/tests_std/test_InflateStar.py b/python/tests_std/test_InflateStar.py new file mode 100644 index 00000000..7ad3a3e0 --- /dev/null +++ b/python/tests_std/test_InflateStar.py @@ -0,0 +1,16 @@ +import numpy +import unittest +import gyoto +gyoto.loadPlugin('stdplug') +import gyoto_std + +class TestInflateStar(unittest.TestCase): + + def test_InflateStar(self): + ao=gyoto.Astrobj("InflateStar") + ao=gyoto_std.InflateStar() + ao.radius(0.) + ao.radiusStop(2.) + ao.timeInflateInit(0.) + ao.timeInflateStop(2.) + self.assertTrue(abs(ao.radiusAt(1.)-1.) < 1e-6) diff --git a/python/tests_std/test_OscilTorus.py b/python/tests_std/test_OscilTorus.py new file mode 100644 index 00000000..f5ff292c --- /dev/null +++ b/python/tests_std/test_OscilTorus.py @@ -0,0 +1,17 @@ +import numpy +import unittest +import gyoto +gyoto.loadPlugin('stdplug') +import gyoto_std + +class TestOscilTorus(unittest.TestCase): + + def test_OscilTorus(self): + ao=gyoto.Astrobj("OscilTorus") + ao=gyoto_std.OscilTorus() + r=4. + ao.largeRadius(r) + self.assertTrue((ao.largeRadius() == r)) + perturbkind="Vertical" + ao.perturbKind(perturbkind) + self.assertTrue((ao.perturbKind() == perturbkind)) diff --git a/yorick/gyoto.i b/yorick/gyoto.i index 00ce27e7..90121998 100644 --- a/yorick/gyoto.i +++ b/yorick/gyoto.i @@ -2094,7 +2094,7 @@ extern gyoto_FE; does. However, it is sometimes impossible to avoid it: depending on the compiler used to build Gyoto and its dependencies, optimizations may be done under the assumption that the code will - always run with all exceptions disabled. See README.SIGFPE in the + always run with all exceptions disabled. See BUGS.md in the Gyoto source code for details. Gyoto therefore provides the following functions to control the From 78608e5a49a349166d15b570ffcec5c9a2754571 Mon Sep 17 00:00:00 2001 From: Thibaut Paumard Date: Sat, 10 Dec 2016 13:15:06 +0100 Subject: [PATCH 03/11] Store plug-in name as given by user When plu-gin name is actually a file name, loadPlugin() determines the actual plug-in name to find out the intilialization function. Nevertherless we prefer to store the file name in that case so users can load several versions of the same plug-in e.g. for testing purposes. --- lib/Register.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Register.C b/lib/Register.C index a89e5a39..8550c93f 100644 --- a/lib/Register.C +++ b/lib/Register.C @@ -137,10 +137,12 @@ void Gyoto::loadPlugin(char const*const nam, int nofail) { if ( (err=dlerror()) ) throwError(err); GYOTO_DEBUG << "Calling plug-in init function " << dlfunc << endl; std::string tmp_name(GyotoRegisterCurrentPlugin); - GyotoRegisterCurrentPlugin = name; + // In case nam is a file name, that's what we wan't to store + GyotoRegisterCurrentPlugin = nam; (*initfcn)(); GyotoRegisterCurrentPlugin = tmp_name; - GyotoRegisteredPlugins.insert(GyotoRegisteredPlugins.begin(), name); + // In case nam is a file name, that's what we wan't to store + GyotoRegisteredPlugins.insert(GyotoRegisteredPlugins.begin(), nam); GYOTO_DEBUG << "Done." << endl; } From 039f3b98a6ddfa3a99470f2a9b50b9bfcabc97e3 Mon Sep 17 00:00:00 2001 From: Thibaut Paumard Date: Sat, 10 Dec 2016 15:53:19 +0100 Subject: [PATCH 04/11] Change subcontractor APIs to use a vector It is now possible to specify several plugins for loading an object. Useful when a plug-in depends on another one. In XML: Plugins are loaded in order and looked into in reverse order for the class. --- include/GyotoAstrobj.h | 8 ++++---- include/GyotoMetric.h | 8 ++++---- include/GyotoObject.h | 10 +++++----- include/GyotoProperty.h | 15 ++++++++++++--- include/GyotoRegister.h | 31 +++++++++++++++++++++++++------ include/GyotoSmartPointer.h | 4 +++- include/GyotoSpectrometer.h | 8 ++++---- include/GyotoSpectrum.h | 8 ++++---- include/GyotoUtils.h | 6 +++++- lib/Astrobj.C | 8 +------- lib/ComplexAstrobj.C | 7 ++++--- lib/ComplexSpectrometer.C | 7 ++++--- lib/Factory.C | 8 ++++---- lib/Metric.C | 9 +-------- lib/Object.C | 27 +++++++++++++++++---------- lib/Screen.C | 5 +++-- lib/Spectrometer.C | 8 +------- lib/Spectrum.C | 8 +------- lib/Utils.C | 32 +++++++++++++++++++++++--------- lib/Value.C | 2 +- python/gyoto.i | 6 ++++-- yorick/ygyoto_private.h | 10 +++++++--- 22 files changed, 137 insertions(+), 98 deletions(-) diff --git a/include/GyotoAstrobj.h b/include/GyotoAstrobj.h index 0753108f..9fe7a8a8 100644 --- a/include/GyotoAstrobj.h +++ b/include/GyotoAstrobj.h @@ -59,7 +59,7 @@ namespace Gyoto{ * provided so that you may not have to code anything. */ typedef SmartPointer - Subcontractor_t(Gyoto::FactoryMessenger*, std::string); + Subcontractor_t(Gyoto::FactoryMessenger*, std::vector const &); ///< A function to build instances of a specific Astrobj::Generic sub-class /** @@ -73,9 +73,9 @@ namespace Gyoto{ * \tparam T Gyoto::Astrobj::Generic sub-class */ template SmartPointer Subcontractor - (FactoryMessenger* fmp, std::string plugin) { + (FactoryMessenger* fmp, std::vector const &plugin) { SmartPointer ao = new T(); - ao -> plugin(plugin) ; + ao -> plugins(plugin) ; #ifdef GYOTO_USE_XERCES if (fmp) ao -> setParameters(fmp); #endif @@ -101,7 +101,7 @@ namespace Gyoto{ * \return pointer to the corresponding subcontractor. */ Gyoto::Astrobj::Subcontractor_t* getSubcontractor(std::string name, - std::string &plugin, + std::vector &plugin, int errmode = 0); /** diff --git a/include/GyotoMetric.h b/include/GyotoMetric.h index b95b334d..0896a6a6 100644 --- a/include/GyotoMetric.h +++ b/include/GyotoMetric.h @@ -55,7 +55,7 @@ namespace Gyoto { * Factory and Subcontractor_t function communicate through a * Gyoto::FactoryMessenger. */ - typedef SmartPointer Subcontractor_t(FactoryMessenger*, std::string); + typedef SmartPointer Subcontractor_t(FactoryMessenger*, std::vector const &); /** @@ -67,9 +67,9 @@ namespace Gyoto { * \tparam T Sub-class of Metric::Generic */ template SmartPointer Subcontractor - (FactoryMessenger* fmp, std::string plugin) { + (FactoryMessenger* fmp, std::vector const &plugins) { SmartPointer gg = new T(); - gg -> plugin(plugin); + gg -> plugins(plugins); #ifdef GYOTO_USE_XERCES if (fmp) gg -> setParameters(fmp); #endif @@ -95,7 +95,7 @@ namespace Gyoto { * \return pointer to the corresponding subcontractor. */ Gyoto::Metric::Subcontractor_t* getSubcontractor(std::string name, - std::string &plugin, + std::vector &plugin, int errmode=0); /// The Metric register diff --git a/include/GyotoObject.h b/include/GyotoObject.h index 8b160026..bb2d391f 100644 --- a/include/GyotoObject.h +++ b/include/GyotoObject.h @@ -85,8 +85,8 @@ namespace Gyoto { static Property const properties[]; \ virtual Property const * getProperties() const; \ static const std::string builtinPluginValue; \ - virtual void plugin(std::string const & plugname); \ - virtual std::string plugin() const + virtual void plugins(std::vector const & plugname); \ + virtual std::vector plugins() const /// Object with properties @@ -151,15 +151,15 @@ class Gyoto::Object */ std::string kind_; - /// The plug-in that needs to be loaded to access this instance's class + /// The plug-ins that needs to be loaded to access this instance's class /** * E.g. for an Astrobj, fillElement() will ensure * \code - * ... + * ... * \endcode * is written. */ - std::string plugin_; + std::vector plugins_; public: GYOTO_OBJECT; diff --git a/include/GyotoProperty.h b/include/GyotoProperty.h index eb30415b..d4633ce7 100644 --- a/include/GyotoProperty.h +++ b/include/GyotoProperty.h @@ -487,14 +487,23 @@ namespace Gyoto { ) /// Define class::properties and class::getProperties() -#define GYOTO_PROPERTY_END(class, next) \ +#define GYOTO_PROPERTY_END(class, next) \ Property(next)}; \ Gyoto::Property const * class::getProperties() const { \ return class::properties; \ } \ const std::string class::builtinPluginValue ( GYOTO_STRINGIFY(GYOTO_PLUGIN) ); \ - std::string class::plugin() const {if (plugin_ == "") return class::builtinPluginValue; return plugin_;} \ - void class::plugin(std::string const & plugname) {plugin_=plugname;} + std::vector class::plugins() const { \ + if (plugins_.size() == 0) { \ + std::vector p; \ + p.push_back(class::builtinPluginValue); \ + return p; \ + } \ + return plugins_; \ + } \ + void class::plugins(std::vector const & plugname) { \ + plugins_=plugname; \ + } /// Property that can be set and got using standard methods /** diff --git a/include/GyotoRegister.h b/include/GyotoRegister.h index 4af94f8c..daeaa2eb 100644 --- a/include/GyotoRegister.h +++ b/include/GyotoRegister.h @@ -136,12 +136,31 @@ class Gyoto::Register::Entry { Gyoto::SmartPointee::Subcontractor_t* getSubcontractor(std::string name, std::string &plugin, int errmode=0); -#ifndef GYOTO_NO_DEPRECATED -#warning Using deprecated method signature.\ - Define GYOTO_NO_DEPRECATED to disable. -Gyoto::SmartPointee::Subcontractor_t* - getSubcontractor(std::string name, int errmode=0); -#endif }; +#define GYOTO_GETSUBCONTRACTOR(space) \ + Gyoto::space::Subcontractor_t* \ + Gyoto::space::getSubcontractor(std::string name, std::vector &plugin, int errmode) { \ + for (size_t i=0; i getSubcontractor(name, plg, errmode); \ + plugin.push_back(plg); \ + } \ + for (size_t i=plugin.size()-1; i>=0 && sctr == NULL; --i) { \ + sctr= \ + (Subcontractor_t*)Gyoto::space::Register_ \ + -> getSubcontractor(name, plugin[i], 1); \ + } \ + if (!errmode && !sctr) throwError ("Kind not found in the specified plug-ins: "+name); \ + return sctr; \ +} + #endif diff --git a/include/GyotoSmartPointer.h b/include/GyotoSmartPointer.h index f34fc6fa..479543b6 100644 --- a/include/GyotoSmartPointer.h +++ b/include/GyotoSmartPointer.h @@ -54,6 +54,8 @@ namespace Gyoto { #include #include #include +#include +#include /** * \brief Can be pointed to by a SmartPointer @@ -109,7 +111,7 @@ class Gyoto::SmartPointee * Metric::Register(), Spectrum::Register(). */ typedef Gyoto::SmartPointer - Subcontractor_t(Gyoto::FactoryMessenger*, std::string); + Subcontractor_t(Gyoto::FactoryMessenger*, std::vector const &); ///< A subcontractor builds an object upon order from the Factory }; diff --git a/include/GyotoSpectrometer.h b/include/GyotoSpectrometer.h index 6a1a3e05..cd315569 100644 --- a/include/GyotoSpectrometer.h +++ b/include/GyotoSpectrometer.h @@ -93,7 +93,7 @@ namespace Gyoto{ * communicate through a Gyoto::FactoryMessenger. */ typedef SmartPointer - Subcontractor_t(Gyoto::FactoryMessenger*, std::string); + Subcontractor_t(Gyoto::FactoryMessenger*, std::vector const &); ///< A function to build instances of a specific Astrobj::Generic sub-class /** @@ -117,7 +117,7 @@ namespace Gyoto{ * \return pointer to the corresponding subcontractor. */ Gyoto::Spectrometer::Subcontractor_t* getSubcontractor(std::string name, - std::string &plugin, + std::vector &plugins, int errmode = 0); /** @@ -130,9 +130,9 @@ namespace Gyoto{ * \tparam T A Spectrometer::Generic sub-class. */ template SmartPointer Subcontractor - (FactoryMessenger* fmp, std::string plugin) { + (FactoryMessenger* fmp, std::vector const &plugins) { SmartPointer spectro = new T(); - spectro -> plugin(plugin); + spectro -> plugins(plugins); #ifdef GYOTO_USE_XERCES if (fmp) spectro -> setParameters(fmp); #endif diff --git a/include/GyotoSpectrum.h b/include/GyotoSpectrum.h index 252eaf6c..a1b0fcc2 100644 --- a/include/GyotoSpectrum.h +++ b/include/GyotoSpectrum.h @@ -49,7 +49,7 @@ namespace Gyoto{ * provided so that you may not have to code anything. */ typedef Gyoto::SmartPointer - Subcontractor_t(Gyoto::FactoryMessenger* fmp, std::string); + Subcontractor_t(Gyoto::FactoryMessenger* fmp, std::vector const &); /** * \brief Subcontractor template @@ -60,9 +60,9 @@ namespace Gyoto{ * \tparam T Sub-class of Spectrum::Generic */ template SmartPointer Subcontractor - (FactoryMessenger* fmp, std::string plugin) { + (FactoryMessenger* fmp, std::vector const & plugins) { SmartPointer sp = new T(); - sp -> plugin(plugin) ; + sp -> plugins(plugins) ; #ifdef GYOTO_USE_XERCES if (fmp) sp -> setParameters(fmp); #endif @@ -102,7 +102,7 @@ namespace Gyoto{ * \return pointer to the corresponding subcontractor. */ Gyoto::Spectrum::Subcontractor_t* getSubcontractor(std::string name, - std::string &plugin, + std::vector &plugins, int errmode=0); /// The Spectrum register diff --git a/include/GyotoUtils.h b/include/GyotoUtils.h index 9f7791f2..0399f35c 100644 --- a/include/GyotoUtils.h +++ b/include/GyotoUtils.h @@ -6,7 +6,7 @@ */ /* - Copyright 2011 Thibaut Paumard + Copyright 2011, 2016 Thibaut Paumard This file is part of Gyoto. @@ -30,6 +30,7 @@ #include "GyotoDefs.h" #include +#include namespace Gyoto { /// Set debug mode @@ -99,6 +100,9 @@ namespace Gyoto { * \param[in] class_name e.g. "Gyoto::Screen", "Gyoto::Astrobj::Torus". */ void help(std::string class_name); + + /// Split string + std::vector split(std::string const &src, std::string const &delim); } #endif diff --git a/lib/Astrobj.C b/lib/Astrobj.C index 5f8a4d63..68265b93 100644 --- a/lib/Astrobj.C +++ b/lib/Astrobj.C @@ -462,13 +462,7 @@ void Gyoto::Astrobj::Register(std::string name, Subcontractor_t* scp){ Gyoto::Astrobj::Register_ = ne; } -Gyoto::Astrobj::Subcontractor_t* -Astrobj::getSubcontractor(std::string name, std::string &plugin, int errmode) { - if (plugin!="") Gyoto::requirePlugin(plugin); - if (!Gyoto::Astrobj::Register_) throwError("No Astrobj kind registered!"); - return (Subcontractor_t*)Gyoto::Astrobj::Register_ - -> getSubcontractor(name, plugin, errmode); -} +GYOTO_GETSUBCONTRACTOR(Astrobj) Astrobj::Properties::Properties() : intensity(NULL), time(NULL), distance(NULL), diff --git a/lib/ComplexAstrobj.C b/lib/ComplexAstrobj.C index b463521c..f3eb3cad 100644 --- a/lib/ComplexAstrobj.C +++ b/lib/ComplexAstrobj.C @@ -1,5 +1,5 @@ /* - Copyright 2011 Thibaut Paumard, Frederic Vincent + Copyright 2011, 2016 Thibaut Paumard, Frederic Vincent This file is part of Gyoto. @@ -185,7 +185,8 @@ void Complex::setParameters(FactoryMessenger *fmp) { if (debug()) cerr << "DEBUG: in Complex::setParameters()" << endl; - string name="", content="", unit="", plugin(""); + string name="", content="", unit=""; + vector plugin; FactoryMessenger * child = NULL; metric( fmp->metric() ); @@ -195,7 +196,7 @@ void Complex::setParameters(FactoryMessenger *fmp) { cerr << "DEBUG: Astrobj::Complex::Subcontractor(): name=" << name << endl; if (name=="SubAstrobj") { content = fmp -> getAttribute("kind"); - plugin = fmp -> getAttribute("plugin"); + plugin = split(fmp -> getAttribute("plugin"), ","); child = fmp -> getChild(); append ((*Astrobj::getSubcontractor(content, plugin))(child, plugin)); delete child; diff --git a/lib/ComplexSpectrometer.C b/lib/ComplexSpectrometer.C index fd136a9e..9a6f9346 100644 --- a/lib/ComplexSpectrometer.C +++ b/lib/ComplexSpectrometer.C @@ -1,5 +1,5 @@ /* - Copyright 2013 Thibaut Paumard, Frederic Vincent + Copyright 2013, 2016 Thibaut Paumard, Frederic Vincent This file is part of Gyoto. @@ -125,7 +125,8 @@ void Complex::setParameters(FactoryMessenger *fmp) { if (debug()) cerr << "DEBUG: in Complex::setParameters()" << endl; - string name="", content="", unit="", plugin(""); + string name="", content="", unit=""; + std::vector plugin; FactoryMessenger * child = NULL; while (fmp->getNextParameter(&name, &content, &unit)) { @@ -134,7 +135,7 @@ void Complex::setParameters(FactoryMessenger *fmp) { if (name=="SubSpectrometer") { content = fmp -> getAttribute("kind"); child = fmp -> getChild(); - plugin = fmp -> getAttribute("plugin"); + plugin = split(fmp -> getAttribute("plugin"), ","); append ((*Spectrometer::getSubcontractor(content, plugin))(child, plugin)); delete child; } else setParameter(name, content, unit); diff --git a/lib/Factory.C b/lib/Factory.C index d886eb22..481d712f 100644 --- a/lib/Factory.C +++ b/lib/Factory.C @@ -270,7 +270,7 @@ SmartPointer Factory::metric() { delete result; } else MetricDOM = root_; - string Plugin = C(MetricDOM->getAttribute(X("plugin"))); + vector Plugin = Gyoto::split(C(MetricDOM->getAttribute(X("plugin"))), ","); string Kind = C(MetricDOM->getAttribute(X("kind"))); FactoryMessenger fm(this, MetricDOM); @@ -303,7 +303,7 @@ SmartPointer Factory::astrobj(){ tmpEl = static_cast< xercesc::DOMElement* >(result -> getNodeValue()); delete result; } - string Plugin = C(tmpEl->getAttribute(X("plugin"))); + vector Plugin = split(C(tmpEl->getAttribute(X("plugin"))), ","); string AstrobjKind = Cs(tmpEl->getAttribute(X("kind"))); GYOTO_DEBUG_EXPR(AstrobjKind); @@ -363,7 +363,7 @@ SmartPointer Factory::spectrum(){ tmpEl = static_cast< xercesc::DOMElement* >(result -> getNodeValue()); delete result; } - string Plugin = C(tmpEl->getAttribute(X("plugin"))); + vector Plugin = split(C(tmpEl->getAttribute(X("plugin"))), ","); string Kind = Cs(tmpEl->getAttribute(X("kind"))); GYOTO_DEBUG_EXPR(Kind); @@ -392,7 +392,7 @@ SmartPointer Factory::spectrometer(){ tmpEl = static_cast< xercesc::DOMElement* >(result -> getNodeValue()); delete result; } - string Plugin = C(tmpEl->getAttribute(X("plugin"))); + vector Plugin = split(C(tmpEl->getAttribute(X("plugin"))), ","); string Kind = Cs(tmpEl->getAttribute(X("kind"))); GYOTO_DEBUG_EXPR(Kind); diff --git a/lib/Metric.C b/lib/Metric.C index 53b0389c..33abcfbd 100644 --- a/lib/Metric.C +++ b/lib/Metric.C @@ -568,11 +568,4 @@ void Gyoto::Metric::Register(std::string name, Metric::Subcontractor_t* scp) { Gyoto::Metric::Register_ = ne; } -Metric::Subcontractor_t* -Metric::getSubcontractor(std::string name, std::string &plugin, int errmode) { - if (plugin!="") Gyoto::requirePlugin(plugin); - if (!Gyoto::Metric::Register_) throwError("No Metric kind registered!"); - Metric::Subcontractor_t *sub=(Metric::Subcontractor_t*)Gyoto::Metric::Register_ - -> getSubcontractor(name, plugin, errmode); - return sub; -} +GYOTO_GETSUBCONTRACTOR(Metric) diff --git a/lib/Object.C b/lib/Object.C index d7859f86..38482abf 100644 --- a/lib/Object.C +++ b/lib/Object.C @@ -42,9 +42,9 @@ GYOTO_PROPERTY_START(Gyoto::Object, "Object with properties.") GYOTO_PROPERTY_END(Object, NULL) -Gyoto::Object::Object(std::string const &name):kind_(name), plugin_("") {} -Gyoto::Object::Object():kind_(""), plugin_("") {} -Gyoto::Object::Object(Object const &o):kind_(o.kind_), plugin_(o.plugin_) {} +Gyoto::Object::Object(std::string const &name):kind_(name), plugins_() {} +Gyoto::Object::Object():kind_(""), plugins_() {} +Gyoto::Object::Object(Object const &o):kind_(o.kind_), plugins_(o.plugins_) {} Gyoto::Object::~Object() {} @@ -320,8 +320,15 @@ void Object::fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const } void Object::fillElement(Gyoto::FactoryMessenger *fmp) const { - std::string plg(plugin()); - if (plg != "") fmp -> setSelfAttribute("plugin", plg); + std::vector const plgs=plugins(); + size_t np=plgs.size(); + if (np) { + std::string plg(plgs[0]); + for (size_t i=1; i setSelfAttribute("plugin", plg); + } if (kind_ != "") fmp -> setSelfAttribute("kind", kind_); Property const * prop = getProperties(); while (prop) { @@ -349,7 +356,7 @@ void Object::setParameters(Gyoto::FactoryMessenger *fmp) { setParameter(name, content, unit); } else { GYOTO_DEBUG << "'" << name << "' found "<< endl; - std::string plugin(""); + std::vector plugins; switch (prop->type) { case Property::metric_t: set(*prop, fmp->metric()); @@ -363,15 +370,15 @@ void Object::setParameters(Gyoto::FactoryMessenger *fmp) { case Property::spectrum_t: content = fmp -> getAttribute("kind"); child = fmp -> getChild(); - plugin = fmp -> getAttribute("plugin"); - set(*prop, (*Spectrum::getSubcontractor(content, plugin))(child, plugin) ); + plugins = Gyoto::split(fmp -> getAttribute("plugin"), ","); + set(*prop, (*Spectrum::getSubcontractor(content, plugins))(child, plugins) ); delete child; break; case Property::spectrometer_t: content = fmp -> getAttribute("kind"); child = fmp -> getChild(); - plugin = fmp -> getAttribute("plugin"); - set(*prop, (*Spectrometer::getSubcontractor(content, plugin))(child, plugin) ); + plugins = Gyoto::split(fmp -> getAttribute("plugin"), ","); + set(*prop, (*Spectrometer::getSubcontractor(content, plugins))(child, plugins) ); delete child; break; case Property::filename_t: diff --git a/lib/Screen.C b/lib/Screen.C index a594c586..899e7a7e 100644 --- a/lib/Screen.C +++ b/lib/Screen.C @@ -1,5 +1,5 @@ /* - Copyright 2011-2015 Thibaut Paumard, Frederic Vincent + Copyright 2011-2016 Thibaut Paumard, Frederic Vincent This file is part of Gyoto. @@ -1248,7 +1248,8 @@ void Screen::fillProperty(Gyoto::FactoryMessenger *fmp, SmartPointer Screen::Subcontractor(FactoryMessenger* fmp) { - string name="", content="", unit="", tunit="", aunit="", dunit="", plugin(""); + string name="", content="", unit="", tunit="", aunit="", dunit=""; + vector plugin; SmartPointer scr = new Screen(); if (!fmp) return scr; scr -> metric(fmp->metric()); diff --git a/lib/Spectrometer.C b/lib/Spectrometer.C index 361f5d77..d7a4a5db 100644 --- a/lib/Spectrometer.C +++ b/lib/Spectrometer.C @@ -67,13 +67,7 @@ void Gyoto::Spectrometer::Register(std::string name, Subcontractor_t* scp){ Gyoto::Spectrometer::Register_ = ne; } -Gyoto::Spectrometer::Subcontractor_t* -Spectrometer::getSubcontractor(std::string name, std::string &plugin, int errmode) { - if (plugin!="") Gyoto::requirePlugin(plugin); - if (!Gyoto::Spectrometer::Register_) throwError("No Spectrometer kind registered!"); - return (Subcontractor_t*)Gyoto::Spectrometer::Register_ - -> getSubcontractor(name, plugin, errmode); -} +GYOTO_GETSUBCONTRACTOR(Spectrometer) Generic::Generic() : SmartPointee(), diff --git a/lib/Spectrum.C b/lib/Spectrum.C index d4f53e95..fa14cb4c 100644 --- a/lib/Spectrum.C +++ b/lib/Spectrum.C @@ -147,13 +147,7 @@ void Gyoto::Spectrum::Register(std::string name, Gyoto::Spectrum::Register_ = ne; } -Spectrum::Subcontractor_t* -Spectrum::getSubcontractor(std::string name, std::string &plugin, int errmode) { - if (plugin!="") Gyoto::requirePlugin(plugin); - if (!Gyoto::Spectrum::Register_) throwError("No Spectrum kind registered!"); - return (Spectrum::Subcontractor_t*)Gyoto::Spectrum::Register_ - -> getSubcontractor(name, plugin, errmode); -} +GYOTO_GETSUBCONTRACTOR(Spectrum) void Gyoto::Spectrum::initRegister() { if (Gyoto::Spectrum::Register_) delete Gyoto::Spectrum::Register_; diff --git a/lib/Utils.C b/lib/Utils.C index e9b75629..2dc73da1 100644 --- a/lib/Utils.C +++ b/lib/Utils.C @@ -111,7 +111,7 @@ double Gyoto::atof(const char * str) } void Gyoto::help(std::string class_name) { - std::string plugin(""); + std::vector plugins; if (class_name.substr(0, 7)=="Gyoto::") class_name=class_name.substr(7); if (class_name=="Scenery") {Scenery().help(); return;} @@ -124,26 +124,40 @@ void Gyoto::help(std::string class_name) { string nspace = class_name.substr(0, pos); class_name = class_name.substr(pos+2); if (nspace=="Astrobj") { - (*Astrobj::getSubcontractor(class_name, plugin)) - (NULL, plugin)->help(); + (*Astrobj::getSubcontractor(class_name, plugins)) + (NULL, plugins)->help(); return; } if (nspace=="Metric") { - (*Metric::getSubcontractor(class_name, plugin)) - (NULL, plugin)->help(); + (*Metric::getSubcontractor(class_name, plugins)) + (NULL, plugins)->help(); return; } if (nspace=="Spectrum") { - (*Spectrum::getSubcontractor(class_name, plugin)) - (NULL, plugin)->help(); + (*Spectrum::getSubcontractor(class_name, plugins)) + (NULL, plugins)->help(); return; } if (nspace=="Spectrometer") { - (*Spectrometer::getSubcontractor(class_name, plugin)) - (NULL, plugin)->help(); + (*Spectrometer::getSubcontractor(class_name, plugins)) + (NULL, plugins)->help(); return; } throwError("Unrecognized namespace: "+nspace); } throwError("Help string not implemented (yet) for "+class_name); } + +std::vector Gyoto::split(std::string const &src, std::string const &delim) { + std::vector res; + size_t pos=0, fpos=0, sz=src.length(); + std::string tmp(""); + while (fpos != string::npos && pos < sz) { + fpos = src.find_first_of(delim, pos); + if (fpos==pos) {++pos; continue;} + cerr << "src.substr(pos, fpos-pos)" << endl; + res.push_back(src.substr(pos, fpos-pos)); + pos = fpos+1; + } + return res; +} diff --git a/lib/Value.C b/lib/Value.C index df6523c9..4f3739e7 100644 --- a/lib/Value.C +++ b/lib/Value.C @@ -1,5 +1,5 @@ /* - Copyright 2014-2015 Thibaut Paumard + Copyright 2014-2016 Thibaut Paumard This file is part of Gyoto. diff --git a/python/gyoto.i b/python/gyoto.i index 07eb7095..2034c870 100644 --- a/python/gyoto.i +++ b/python/gyoto.i @@ -144,14 +144,15 @@ Gyoto::SmartPointer, gtype * { // Make a pseudo constructor for down-casting. %extend Gyoto::klass::Generic { Generic(std::string nm) { - std::string plugin; + std::vector plugin; Gyoto::SmartPointer pres= Gyoto::klass::getSubcontractor(nm.c_str(), plugin)(NULL, plugin); Gyoto::klass::Generic * res = (Gyoto::klass::Generic *)(pres); if (res) res -> incRefCount(); return res; } - Generic(std::string nm, std::string &plugin) { + Generic(std::string nm, std::vector plugin) { + GYOTO_DEBUG_EXPR(plugin.size()); Gyoto::SmartPointer pres= Gyoto::klass::getSubcontractor(nm.c_str(), plugin)(NULL, plugin); Gyoto::klass::Generic * res = (Gyoto::klass::Generic *)(pres); @@ -442,6 +443,7 @@ GyotoSmPtrTypeMapClassDerived(Astrobj, Properties); // Handle std::vector and %include "std_vector.i"; +%template(vector_string) std::vector; %template(vector_double) std::vector; %{ typedef unsigned long unsignedlong; diff --git a/yorick/ygyoto_private.h b/yorick/ygyoto_private.h index 3217c9da..22d853cc 100644 --- a/yorick/ygyoto_private.h +++ b/yorick/ygyoto_private.h @@ -1,5 +1,5 @@ /* - Copyright 2011-2014 Thibaut Paumard + Copyright 2011-2014, 2016 Thibaut Paumard This file is part of Gyoto. @@ -244,8 +244,12 @@ long int __ygyoto_var_idx(size_t id); if (!yarg_string(argc-1)) \ y_error("Cannot allocate object of virtual class " #BASE); \ char * fname = ygets_q(argc-1); \ - std::string plugin(""); \ - if (argc >= 2 && yarg_string(argc-2)) plugin = ygets_q(argc-2); \ + std::vector plugin; \ + if (argc >= 2 && yarg_string(argc-2)) { \ + long ntot=0; \ + ystring_t * plugs = ygeta_q(argc-2, &ntot, NULL); \ + for (size_t i=0; i Date: Sat, 10 Dec 2016 20:44:57 +0100 Subject: [PATCH 05/11] NumericalMetricalLorene is mature: not WIP anymore Stop inheriting from WIP --- TODO.md | 2 -- include/GyotoNumericalMetricLorene.h | 3 +-- lib/NumericalMetricLorene.C | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index c64aea76..723d03a7 100644 --- a/TODO.md +++ b/TODO.md @@ -14,8 +14,6 @@ DynamicalDiskBolometric: Document and provide example EquatorialHotspot: Document and provide example InflateStar: Document and provide example OscilTorus: Document -NumericalMetricLorene: stop inheriting from WIP (ABI-breaking) ## libgyoto: -merge branch track-plugin (ABI-breaking) implement thread-safety declaration (ABI-breaking) diff --git a/include/GyotoNumericalMetricLorene.h b/include/GyotoNumericalMetricLorene.h index 42148c3b..e8ec1b56 100644 --- a/include/GyotoNumericalMetricLorene.h +++ b/include/GyotoNumericalMetricLorene.h @@ -33,7 +33,6 @@ namespace Lorene { #include #include #include -#include #ifdef GYOTO_USE_XERCES #include @@ -46,7 +45,7 @@ namespace Lorene { * stars, collapsing stars, Kerr, boson star e.g. */ class Gyoto::Metric::NumericalMetricLorene -: public WIP, public Gyoto::Metric::Generic +: public Gyoto::Metric::Generic { friend class Gyoto::SmartPointer; diff --git a/lib/NumericalMetricLorene.C b/lib/NumericalMetricLorene.C index 2594a058..8e69405d 100644 --- a/lib/NumericalMetricLorene.C +++ b/lib/NumericalMetricLorene.C @@ -68,7 +68,6 @@ GYOTO_PROPERTY_END(NumericalMetricLorene, Generic::properties) #define GYOTO_NML_PPHI_TOL 5 // tolerance on p_phi drift, percentage NumericalMetricLorene::NumericalMetricLorene() : - WIP(""), Generic(GYOTO_COORDKIND_SPHERICAL, "NumericalMetricLorene"), filename_(NULL), mapet_(true), From 63632ea68aee0e6ff3d2e58d13991ce2148ece06 Mon Sep 17 00:00:00 2001 From: Thibaut Paumard Date: Sun, 11 Dec 2016 19:33:11 +0100 Subject: [PATCH 06/11] Implement thread-safety declaration Thread-unsafe classes declare themselves as such, so that NThreads is ignored when multi-threading would cause erroneous results. --- NEWS | 3 ++ TODO.md | 3 +- include/GyotoComplexAstrobj.h | 3 +- include/GyotoComplexSpectrometer.h | 3 +- include/GyotoDynamicalDisk3D.h | 3 +- include/GyotoNumericalMetricLorene.h | 3 +- include/GyotoObject.h | 37 +++++++++++++++++- include/GyotoPageThorneDisk.h | 3 +- include/GyotoPatternDiskBB.h | 3 +- include/GyotoPhoton.h | 3 +- include/GyotoPolishDoughnut.h | 1 + include/GyotoProperty.h | 8 +++- include/GyotoRotStar3_1.h | 3 +- include/GyotoScenery.h | 1 + include/GyotoScreen.h | 3 +- include/GyotoThinDiskPL.h | 3 +- lib/ComplexAstrobj.C | 8 +++- lib/ComplexSpectrometer.C | 7 +++- lib/DynamicalDisk3D.C | 8 +++- lib/NumericalMetricLorene.C | 5 ++- lib/Object.C | 56 +++++++++++++++++++++++++++- lib/PageThorneDisk.C | 8 +++- lib/PatternDiskBB.C | 8 +++- lib/Photon.C | 9 ++++- lib/PolishDoughnut.C | 7 +++- lib/RotStar3_1.C | 5 ++- lib/Scenery.C | 34 ++++++++++++----- lib/Screen.C | 6 +++ lib/ThinDiskPL.C | 7 +++- plugins/python/include/GyotoPython.h | 4 ++ plugins/python/lib/Metric.C | 2 + plugins/python/lib/Spectrum.C | 2 + plugins/python/lib/Standard.C | 2 + plugins/python/lib/ThinDisk.C | 2 + 34 files changed, 229 insertions(+), 34 deletions(-) diff --git a/NEWS b/NEWS index c4013056..0f88b738 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,9 @@ NEXT 2016/12/10 API introduce the function Gyoto::requirePlugin() in addition to Gyoto::loadPlugin(). The subcontractor signature is changed to accept a second parameter, which breaks the API. + * New functionality: thread-unsafe classes declare themselves as + such, so that NThreads is ignored when multi-threading would + cause erroneous results. 1.1.2 2016/12/10 FTR * New Metrics in stdplug: ChernSimons, RezzollaZhidenko. diff --git a/TODO.md b/TODO.md index 723d03a7..13264112 100644 --- a/TODO.md +++ b/TODO.md @@ -16,4 +16,5 @@ InflateStar: Document and provide example OscilTorus: Document ## libgyoto: -implement thread-safety declaration (ABI-breaking) + +Scenery: Apply Object/Property paradigm diff --git a/include/GyotoComplexAstrobj.h b/include/GyotoComplexAstrobj.h index e770442d..6a460f33 100644 --- a/include/GyotoComplexAstrobj.h +++ b/include/GyotoComplexAstrobj.h @@ -6,7 +6,7 @@ */ /* - Copyright 2011 Thibaut Paumard, Frederic Vincent + Copyright 2011, 2013-2014, 2016 Thibaut Paumard This file is part of Gyoto. @@ -93,6 +93,7 @@ class Gyoto::Astrobj::Complex : public Gyoto::Astrobj::Generic { double step_max_; ///< Maximum δ step inside the Astrobj public: + GYOTO_OBJECT_THREAD_SAFETY; Complex(); ///< Default constructor. Complex(const Complex& ) ; ///< Copy constructor. virtual Complex* clone() const; ///< "Virtual" copy constructor diff --git a/include/GyotoComplexSpectrometer.h b/include/GyotoComplexSpectrometer.h index 0049299d..8e7680cb 100644 --- a/include/GyotoComplexSpectrometer.h +++ b/include/GyotoComplexSpectrometer.h @@ -6,7 +6,7 @@ */ /* - Copyright 2013 Thibaut Paumard, Frederic Vincent + Copyright 2013-2014, 2016 Thibaut Paumard This file is part of Gyoto. @@ -87,6 +87,7 @@ class Gyoto::Spectrometer::Complex public: + GYOTO_OBJECT_THREAD_SAFETY; Complex(); ///< Default constructor. Complex(const Complex& ) ; ///< Copy constructor. diff --git a/include/GyotoDynamicalDisk3D.h b/include/GyotoDynamicalDisk3D.h index a781fde9..dd795928 100644 --- a/include/GyotoDynamicalDisk3D.h +++ b/include/GyotoDynamicalDisk3D.h @@ -7,7 +7,7 @@ */ /* - Copyright 2011-2015 Frederic Vincent, Thibaut Paumard + Copyright 2011-2016 Frederic Vincent, Thibaut Paumard This file is part of Gyoto. @@ -96,6 +96,7 @@ class Gyoto::Astrobj::DynamicalDisk3D : public Astrobj::Disk3D { // ------------------------- public: GYOTO_OBJECT; + GYOTO_OBJECT_THREAD_SAFETY; DynamicalDisk3D(); ///< Standard constructor diff --git a/include/GyotoNumericalMetricLorene.h b/include/GyotoNumericalMetricLorene.h index e8ec1b56..665c2528 100644 --- a/include/GyotoNumericalMetricLorene.h +++ b/include/GyotoNumericalMetricLorene.h @@ -6,7 +6,7 @@ */ /* - * Copyright (c) 2012-2015 Frederic Vincent, Thibaut Paumard + * Copyright (c) 2014-2016 Frederic Vincent, Thibaut Paumard * * */ @@ -79,6 +79,7 @@ class Gyoto::Metric::NumericalMetricLorene public: GYOTO_OBJECT; + GYOTO_OBJECT_THREAD_SAFETY; NumericalMetricLorene(); ///< Constructor NumericalMetricLorene(const NumericalMetricLorene&); ///< Copy constructor virtual NumericalMetricLorene* clone() const ; diff --git a/include/GyotoObject.h b/include/GyotoObject.h index bb2d391f..f7473972 100644 --- a/include/GyotoObject.h +++ b/include/GyotoObject.h @@ -4,7 +4,7 @@ */ /* - Copyright 2014-2015 Thibaut Paumard + Copyright 2014-2016 Thibaut Paumard This file is part of Gyoto. @@ -88,6 +88,16 @@ namespace Gyoto { virtual void plugins(std::vector const & plugname); \ virtual std::vector plugins() const +/// Declare virtual bool isThreadSafe() const +/** + * Use this to declare that the object is not (or not always) thread + * safe. The corresponding definition of isThreadSafe() must exist. If + * the object is always thread unsafe (e.g. Lorene Metrics of Python + * based objects), you can simply use GYOTO_PROPERTY_THREAD_SAFETY in + * the corresponding .C file. + */ +#define GYOTO_OBJECT_THREAD_SAFETY \ + virtual bool isThreadSafe() const /// Object with properties /** @@ -162,6 +172,31 @@ class Gyoto::Object std::vector plugins_; public: + /// Whether this class is thread-safe + /** + * Return True if this object is thread-safe, i.e. if an instance + * and its clone can be used in parallel threads (in the context of + * Scenery::raytrace()). Known objects which are not thread-safe + * include Lorene metrics and everything from the Python plug-in. + * + * The default implementation considers that the class itself is + * thread safe and recurses into the declared properties to check + * whether they are safe too. Classes that abide to the + * Object/Property paradigm and are themselves thread-safe have + * nothing special to do. + * + * Objects that clone children in their copy constructor that are + * not declared as properties must take these children into + * account. + * + * Classes that are never thread-safe must declare it. It acn be + * easily done using GYOTO_OBJECT_THREAD_SAFETY in the class + * declaration and GYOTO_PROPERTY_THREAD_UNSAFE in the class + * definition. + */ + virtual bool isThreadSafe() const; + + GYOTO_OBJECT; /** \fn virtual Property const * Object::getProperties() const * \brief Get list of properties diff --git a/include/GyotoPageThorneDisk.h b/include/GyotoPageThorneDisk.h index 7fef93e3..6f3d4279 100644 --- a/include/GyotoPageThorneDisk.h +++ b/include/GyotoPageThorneDisk.h @@ -12,7 +12,7 @@ */ /* - Copyright 2011-2015 Frederic Vincent, Thibaut Paumard + Copyright 2011-2016 Frederic Vincent, Thibaut Paumard This file is part of Gyoto. @@ -83,6 +83,7 @@ class Gyoto::Astrobj::PageThorneDisk // ------------------------- public: GYOTO_OBJECT; + GYOTO_OBJECT_THREAD_SAFETY; PageThorneDisk(); ///< Standard constructor diff --git a/include/GyotoPatternDiskBB.h b/include/GyotoPatternDiskBB.h index 738d5182..1cc0aa71 100644 --- a/include/GyotoPatternDiskBB.h +++ b/include/GyotoPatternDiskBB.h @@ -7,7 +7,7 @@ */ /* - Copyright 2011-2015 Frederic Vincent, Thibaut Paumard + Copyright 2012-2016 Frederic Vincent, Thibaut Paumard This file is part of Gyoto. @@ -70,6 +70,7 @@ class Gyoto::Astrobj::PatternDiskBB : public Astrobj::PatternDisk { // ------------------------- public: GYOTO_OBJECT; + GYOTO_OBJECT_THREAD_SAFETY; PatternDiskBB(); ///< Standard constructor diff --git a/include/GyotoPhoton.h b/include/GyotoPhoton.h index 311e1cc0..5565e310 100644 --- a/include/GyotoPhoton.h +++ b/include/GyotoPhoton.h @@ -7,7 +7,7 @@ */ /* - Copyright 2011, 2015 Frederic Vincent, Thibaut Paumard + Copyright 2011-2016 Frederic Vincent, Thibaut Paumard This file is part of Gyoto. @@ -96,6 +96,7 @@ class Gyoto::Photon public: GYOTO_OBJECT; + GYOTO_OBJECT_THREAD_SAFETY; GYOTO_WORLDLINE; virtual std::string className() const ; ///< "Photon" virtual std::string className_l() const ; ///< "photon" diff --git a/include/GyotoPolishDoughnut.h b/include/GyotoPolishDoughnut.h index 96f72116..e16a5597 100644 --- a/include/GyotoPolishDoughnut.h +++ b/include/GyotoPolishDoughnut.h @@ -105,6 +105,7 @@ class Gyoto::Astrobj::PolishDoughnut // ------------------------- public: GYOTO_OBJECT; // This object has Properties + GYOTO_OBJECT_THREAD_SAFETY; #ifdef GYOTO_USE_XERCES // We need to filter some properties when writing XML void fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const; diff --git a/include/GyotoProperty.h b/include/GyotoProperty.h index d4633ce7..82842b1e 100644 --- a/include/GyotoProperty.h +++ b/include/GyotoProperty.h @@ -4,7 +4,7 @@ */ /* - Copyright 2014 Thibaut Paumard + Copyright 2014-2016 Thibaut Paumard This file is part of Gyoto. @@ -45,6 +45,12 @@ namespace Gyoto { template class SmartPointer; } +/// Define the class as not beeing thread-safe +/** + * See also GYOTO_OBJECT_THREAD_SAFETY + */ +#define GYOTO_PROPERTY_THREAD_UNSAFE(class) \ + bool class::isThreadSafe() const {return false;} /// Define a pair of accessors to scalar member (double, long, size_t) /** diff --git a/include/GyotoRotStar3_1.h b/include/GyotoRotStar3_1.h index 613374ac..7ab4fd5f 100644 --- a/include/GyotoRotStar3_1.h +++ b/include/GyotoRotStar3_1.h @@ -6,7 +6,7 @@ */ /* - Copyright 2011 Frederic Vincent + Copyright 2011-2014, 2016 Frederic Vincent & Thibaut Paumard This file is part of Gyoto. @@ -61,6 +61,7 @@ class Gyoto::Metric::RotStar3_1 : public Gyoto::Metric::Generic { public: GYOTO_OBJECT; + GYOTO_OBJECT_THREAD_SAFETY; RotStar3_1(); ///< Constructor RotStar3_1(const RotStar3_1& ) ; ///< Copy constructor virtual ~RotStar3_1() ; ///< Destructor diff --git a/include/GyotoScenery.h b/include/GyotoScenery.h index 3d682c0f..4858eb49 100644 --- a/include/GyotoScenery.h +++ b/include/GyotoScenery.h @@ -216,6 +216,7 @@ class Gyoto::Scenery # endif public: + GYOTO_OBJECT_THREAD_SAFETY; # ifdef HAVE_MPI /// Team of processes for MPI /** diff --git a/include/GyotoScreen.h b/include/GyotoScreen.h index 9d529a37..0f29e825 100644 --- a/include/GyotoScreen.h +++ b/include/GyotoScreen.h @@ -5,7 +5,7 @@ */ /* - Copyright 2011-2015 Thibaut Paumard, Frederic Vincent + Copyright 2011-2016 Thibaut Paumard, Frederic Vincent This file is part of Gyoto. @@ -235,6 +235,7 @@ class Gyoto::Screen public: GYOTO_OBJECT; + GYOTO_OBJECT_THREAD_SAFETY; // Constructors - Destructor // ------------------------- diff --git a/include/GyotoThinDiskPL.h b/include/GyotoThinDiskPL.h index 1ea66d2b..df984d15 100644 --- a/include/GyotoThinDiskPL.h +++ b/include/GyotoThinDiskPL.h @@ -6,7 +6,7 @@ */ /* - Copyright 2012-2015 Frederic Vincent, Thibaut Paumard + Copyright 2012-2016 Frederic Vincent, Thibaut Paumard This file is part of Gyoto. @@ -65,6 +65,7 @@ class Gyoto::Astrobj::ThinDiskPL : public Astrobj::ThinDisk { // ------------------------- public: GYOTO_OBJECT; + GYOTO_OBJECT_THREAD_SAFETY; ThinDiskPL(); ///< Standard constructor diff --git a/lib/ComplexAstrobj.C b/lib/ComplexAstrobj.C index f3eb3cad..a183eaa8 100644 --- a/lib/ComplexAstrobj.C +++ b/lib/ComplexAstrobj.C @@ -1,5 +1,5 @@ /* - Copyright 2011, 2016 Thibaut Paumard, Frederic Vincent + Copyright 2011-2014, 2016 Thibaut Paumard This file is part of Gyoto. @@ -57,6 +57,12 @@ Complex::~Complex() if (cardinal_) for (size_t i=0; i< cardinal_; ++i) elements_[i] = NULL; } +bool Complex::isThreadSafe() const { + bool safe = Generic::isThreadSafe(); + for (size_t i=0; i < cardinal_; ++i) safe &= elements_[i] -> isThreadSafe(); + return safe; +} + void Complex::metric(SmartPointer gg) { Generic::metric(gg); diff --git a/lib/ComplexSpectrometer.C b/lib/ComplexSpectrometer.C index 9a6f9346..5fc33f0c 100644 --- a/lib/ComplexSpectrometer.C +++ b/lib/ComplexSpectrometer.C @@ -1,5 +1,5 @@ /* - Copyright 2013, 2016 Thibaut Paumard, Frederic Vincent + Copyright 2013-2014, 2016 Thibaut Paumard This file is part of Gyoto. @@ -52,6 +52,11 @@ Complex::Complex(const Complex& o) : } Complex *Complex::clone() const {return new Complex(*this); } +bool Complex::isThreadSafe() const { + bool safe = Generic::isThreadSafe(); + for (size_t i=0; i < cardinal_; ++i) safe &= elements_[i] -> isThreadSafe(); + return safe; +} Complex::~Complex() { diff --git a/lib/DynamicalDisk3D.C b/lib/DynamicalDisk3D.C index 145268f1..47d58386 100644 --- a/lib/DynamicalDisk3D.C +++ b/lib/DynamicalDisk3D.C @@ -1,5 +1,5 @@ /* - Copyright 2011-2015 Frederic Vincent, Thibaut Paumard + Copyright 2011-2016 Frederic Vincent, Thibaut Paumard This file is part of Gyoto. @@ -124,6 +124,12 @@ DynamicalDisk3D::DynamicalDisk3D(const DynamicalDisk3D& o) : DynamicalDisk3D* DynamicalDisk3D::clone() const { return new DynamicalDisk3D(*this); } +bool DynamicalDisk3D::isThreadSafe() const { + // spectrumBB_ is not handled by a property. + return Disk3D::isThreadSafe() + && (!spectrumBB_ || spectrumBB_ -> isThreadSafe()); +} + DynamicalDisk3D::~DynamicalDisk3D() { GYOTO_DEBUG << "DynamicalDisk3D Destruction" << endl; delete [] emission_array_; diff --git a/lib/NumericalMetricLorene.C b/lib/NumericalMetricLorene.C index 8e69405d..20f2030e 100644 --- a/lib/NumericalMetricLorene.C +++ b/lib/NumericalMetricLorene.C @@ -1,5 +1,5 @@ /* - Copyright 2014-2015 Frederic Vincent, Thibaut Paumard + Copyright 2014-2016 Frederic Vincent, Thibaut Paumard This file is part of Gyoto. @@ -65,6 +65,9 @@ GYOTO_PROPERTY_VECTOR_DOUBLE(NumericalMetricLorene, GYOTO_PROPERTY_FILENAME(NumericalMetricLorene, File, directory) GYOTO_PROPERTY_END(NumericalMetricLorene, Generic::properties) +// Lorene Metrics are not thread-safe +GYOTO_PROPERTY_THREAD_UNSAFE(NumericalMetricLorene) + #define GYOTO_NML_PPHI_TOL 5 // tolerance on p_phi drift, percentage NumericalMetricLorene::NumericalMetricLorene() : diff --git a/lib/Object.C b/lib/Object.C index 38482abf..4cbdf4b2 100644 --- a/lib/Object.C +++ b/lib/Object.C @@ -1,5 +1,5 @@ /* - Copyright 2014-2015 Thibaut Paumard + Copyright 2014-2016 Thibaut Paumard This file is part of Gyoto. @@ -47,6 +47,60 @@ Gyoto::Object::Object():kind_(""), plugins_() {} Gyoto::Object::Object(Object const &o):kind_(o.kind_), plugins_(o.plugins_) {} Gyoto::Object::~Object() {} +bool Object::isThreadSafe() const { + /** + * The default behaviour is to consider that everything is + * thread-safe (for the purpose of threads in + * Gyoto::Scenery::rayTrace()). + * + * For Objects that have other Object as children, we need to + * recursively ask those children whether they are thread-safe and + * accumulate the answer. It can be done in a generic manner as long + * as the Object declares its children as properties, this is what + * we do here. + * + * Objects that are never thread-safe must reimplement this function + * to simply return "false", which can be done with the pair of + * macros GYOTO_OBJECT_THREAD_SAFETY/GYOTO_PROPERTY_THREAD_UNSAFE + * respectively in the class declaration and definition. + * + * Objects that need to clone children that are not declared as + * properties in their copy constructors need to reimplement this + * method to take care of those children. + */ + bool safe = true; + Property const * prop = getProperties(); + SmartPointer child=NULL; + while (prop) { + if (*prop) { + switch (prop -> type) { + case Property::metric_t: + child=SmartPointer(get(*prop)); + break; + case Property::screen_t: + child=SmartPointer(get(prop)); + break; + case Property::astrobj_t: + child=SmartPointer(get(*prop)); + break; + case Property::spectrum_t: + child=SmartPointer(get(*prop)); + break; + case Property::spectrometer_t: + child=SmartPointer(get(*prop)); + break; + default: + child=NULL; + } + if (child) safe &= dynamic_cast(child()) -> isThreadSafe(); + ++prop; + } else { + prop=prop->parent; + } + } + GYOTO_DEBUG_EXPR(safe); + return safe; +} void Object::set(Property const &p, Value val, diff --git a/lib/PageThorneDisk.C b/lib/PageThorneDisk.C index 66809fc4..8ab949ad 100644 --- a/lib/PageThorneDisk.C +++ b/lib/PageThorneDisk.C @@ -78,13 +78,17 @@ PageThorneDisk::PageThorneDisk(const PageThorneDisk& o) : spectrumBB_(NULL) { if (o.spectrumBB_()) spectrumBB_=o.spectrumBB_->clone(); - if (o.gg_()) gg_=o.gg_->clone(); - Generic::gg_=gg_; gg_->hook(this); } PageThorneDisk* PageThorneDisk::clone() const { return new PageThorneDisk(*this); } +bool PageThorneDisk::isThreadSafe() const { + // spectrumBB_ is not a Property + return ThinDisk::isThreadSafe() + && (!spectrumBB_ || spectrumBB_->isThreadSafe()); +} + PageThorneDisk::~PageThorneDisk() { GYOTO_DEBUG<unhook(this); diff --git a/lib/PatternDiskBB.C b/lib/PatternDiskBB.C index d7d05b36..23fc0248 100644 --- a/lib/PatternDiskBB.C +++ b/lib/PatternDiskBB.C @@ -1,5 +1,5 @@ /* - Copyright 2011 Frederic Vincent, Thibaut Paumard + Copyright 2012-2014, 2016 Frederic Vincent, Thibaut Paumard This file is part of Gyoto. @@ -78,6 +78,12 @@ PatternDiskBB::PatternDiskBB(const PatternDiskBB& o) : PatternDiskBB* PatternDiskBB::clone() const { return new PatternDiskBB(*this); } +bool PatternDiskBB::isThreadSafe() const { + // spectrumBB_ is not a Property + return PatternDisk::isThreadSafe() + && (!spectrumBB_ || spectrumBB_->isThreadSafe()); +} + PatternDiskBB::~PatternDiskBB() { GYOTO_DEBUG << "PatternDiskBB Destruction" << endl; } diff --git a/lib/Photon.C b/lib/Photon.C index 75fad29c..6a8e82de 100644 --- a/lib/Photon.C +++ b/lib/Photon.C @@ -1,5 +1,5 @@ /* - Copyright 2011-2015 Frederic Vincent, Thibaut Paumard + Copyright 2011-2016 Frederic Vincent, Thibaut Paumard This file is part of Gyoto. @@ -73,6 +73,13 @@ Photon::Photon(const Photon& o) : Photon * Photon::clone() const { return new Photon(*this); } +bool Photon::isThreadSafe() const { + // spectro_ is not a Property + return + Object::isThreadSafe() + && (!spectro_ || spectro_ -> isThreadSafe()); +} + Photon::Photon(Photon* orig, size_t i0, int dir, double step_max) : Worldline(orig, i0, dir, step_max), SmartPointee(), object_(orig->object_), diff --git a/lib/PolishDoughnut.C b/lib/PolishDoughnut.C index 8224e941..c3b16535 100644 --- a/lib/PolishDoughnut.C +++ b/lib/PolishDoughnut.C @@ -1,5 +1,5 @@ /* - Copyright (c) 2012-2015 Frederic Vincent, Odele Straub, Thibaut Paumard + Copyright (c) 2012-2016 Frederic Vincent, Odele Straub, Thibaut Paumard 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 @@ -151,6 +151,11 @@ PolishDoughnut::PolishDoughnut(const PolishDoughnut& orig) : } PolishDoughnut* PolishDoughnut::clone() const {return new PolishDoughnut(*this);} +bool PolishDoughnut::isThreadSafe() const { + // spectrumBB_ is not a Property + return Standard::isThreadSafe() + && (!spectrumBB_ || spectrumBB_->isThreadSafe()); +} double PolishDoughnut::getL0() const { return l0_; } //void PolishDoughnut::setL0(double l0) { l0_ = l0; } double PolishDoughnut::getWsurface() const { return W_surface_; } diff --git a/lib/RotStar3_1.C b/lib/RotStar3_1.C index a467f4e4..fbeac377 100644 --- a/lib/RotStar3_1.C +++ b/lib/RotStar3_1.C @@ -1,5 +1,5 @@ /* - Copyright 2011 Frederic Vincent + Copyright 2011-2014, 2016 Frederic Vincent & Thibaut Paumard This file is part of Gyoto. @@ -50,6 +50,9 @@ GYOTO_PROPERTY_BOOL(RotStar3_1, GenericIntegrator, SpecificIntegrator, GYOTO_PROPERTY_FILENAME(RotStar3_1, File, file) GYOTO_PROPERTY_END(RotStar3_1, Generic::properties) +// Lorene Metrics are not thread-safe +GYOTO_PROPERTY_THREAD_UNSAFE(RotStar3_1) + RotStar3_1::RotStar3_1() : Generic(GYOTO_COORDKIND_SPHERICAL, "RotStar3_1"), filename_(NULL), diff --git a/lib/Scenery.C b/lib/Scenery.C index 44f129ee..f03e6a01 100644 --- a/lib/Scenery.C +++ b/lib/Scenery.C @@ -1,5 +1,5 @@ /* - Copyright 2011, 2013-2015 Thibaut Paumard, Frederic Vincent + Copyright 2011-2016 Thibaut Paumard, Frederic Vincent This file is part of Gyoto. @@ -68,6 +68,14 @@ GYOTO_PROPERTY_STRING(Scenery, Quantities, requestedQuantitiesString, "Physical quantities to evaluate for each light ray.") GYOTO_WORLDLINE_PROPERTY_END(Scenery, Object::properties) +bool Scenery::isThreadSafe() const { + bool safe=true; + if (metric() ) safe &= metric() -> isThreadSafe(); + if (screen_ ) safe &= screen_ -> isThreadSafe(); + if (astrobj()) safe &= astrobj() -> isThreadSafe(); + return safe; +} + #ifdef GYOTO_USE_XERCES void Scenery::fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const { @@ -604,13 +612,20 @@ void Scenery::rayTrace(Screen::Coord2dSet & ij, pthread_t * threads = NULL; pthread_t pself = pthread_self(); larg.parent = &pself; + bool thread_safe = isThreadSafe(); if (nthreads_ >= 2) { - threads = new pthread_t[nthreads_-1]; - larg.mutex = &mumu; - for (size_t th=0; th < nthreads_-1; ++th) { - if (pthread_create(threads+th, NULL, - SceneryThreadWorker, static_cast(&larg)) < 0) - throwError("Error creating thread"); + if (!thread_safe) { + GYOTO_WARNING << + "Something in this Scenery is not thread-safe: running single-threaded" + << endl; + } else { + threads = new pthread_t[nthreads_-1]; + larg.mutex = &mumu; + for (size_t th=0; th < nthreads_-1; ++th) { + if (pthread_create(threads+th, NULL, + SceneryThreadWorker, static_cast(&larg)) < 0) + throwError("Error creating thread"); + } } } #endif @@ -621,7 +636,7 @@ void Scenery::rayTrace(Screen::Coord2dSet & ij, #ifdef HAVE_PTHREAD // Wait for the child threads - if (nthreads_>=2) + if (thread_safe && nthreads_>=2) for (size_t th=0; th < nthreads_-1; ++th) pthread_join(threads[th], NULL); #endif @@ -631,7 +646,8 @@ void Scenery::rayTrace(Screen::Coord2dSet & ij, GYOTO_MSG << "\nRaytraced "<< ij.size() << " photons in " << end-start - << "s using " << nthreads_ << " thread(s)\n"; + << "s using " << (thread_safe?nthreads_:1) << " thread" + << (thread_safe && nthreads_>1)?"s\n":"\n"; } diff --git a/lib/Screen.C b/lib/Screen.C index 899e7a7e..2fbc9439 100644 --- a/lib/Screen.C +++ b/lib/Screen.C @@ -141,6 +141,12 @@ Screen::Screen(const Screen& o) : } Screen * Screen::clone() const { return new Screen(*this); } +bool Screen::isThreadSafe() const { + return Object::isThreadSafe() + && (!gg_ || gg_ -> isThreadSafe()) + && (!spectro_ || spectro_ -> isThreadSafe()); +} + Screen::~Screen(){if (mask_) delete [] mask_;} std::ostream& Screen::print( std::ostream& o) const { diff --git a/lib/ThinDiskPL.C b/lib/ThinDiskPL.C index 6456707f..3e132eb4 100644 --- a/lib/ThinDiskPL.C +++ b/lib/ThinDiskPL.C @@ -1,5 +1,5 @@ /* - Copyright 2011 Frederic Vincent, Thibaut Paumard + Copyright 2012, 2014, 2016 Frederic Vincent, Thibaut Paumard This file is part of Gyoto. @@ -76,6 +76,11 @@ ThinDiskPL::ThinDiskPL(const ThinDiskPL& o) : ThinDiskPL* ThinDiskPL::clone() const { return new ThinDiskPL(*this); } +bool ThinDiskPL::isThreadSafe() const { + return ThinDisk::isThreadSafe() + && (!spectrumBB_ || spectrumBB_ -> isThreadSafe()); +} + ThinDiskPL::~ThinDiskPL() { if (debug()) cerr << "DEBUG: ThinDiskPL Destruction" << endl; } diff --git a/plugins/python/include/GyotoPython.h b/plugins/python/include/GyotoPython.h index ec62b926..1b79bc59 100644 --- a/plugins/python/include/GyotoPython.h +++ b/plugins/python/include/GyotoPython.h @@ -328,6 +328,7 @@ class Gyoto::Spectrum::Python public: GYOTO_OBJECT; + GYOTO_OBJECT_THREAD_SAFETY; Python(); @@ -391,6 +392,7 @@ class Gyoto::Metric::Python public: GYOTO_OBJECT; + GYOTO_OBJECT_THREAD_SAFETY; Python(); Python(const Python&); ~Python(); @@ -440,6 +442,7 @@ class Gyoto::Astrobj::Python::Standard public: GYOTO_OBJECT; + GYOTO_OBJECT_THREAD_SAFETY; /* Birth and Death*/ Standard(); @@ -505,6 +508,7 @@ class Gyoto::Astrobj::Python::ThinDisk public: GYOTO_OBJECT; + GYOTO_OBJECT_THREAD_SAFETY; /* Birth and Death*/ ThinDisk(); diff --git a/plugins/python/lib/Metric.C b/plugins/python/lib/Metric.C index d7e809fa..87d740b5 100644 --- a/plugins/python/lib/Metric.C +++ b/plugins/python/lib/Metric.C @@ -27,6 +27,8 @@ GYOTO_PROPERTY_BOOL(Metric::Python, Spherical, Cartesian, spherical, "Whether the coordinate system is Spherical or (default) Cartesian.") GYOTO_PROPERTY_END(Metric::Python, Generic::properties) +GYOTO_PROPERTY_THREAD_UNSAFE(Metric::Python) + // Birth and death Gyoto::Metric::Python::Python() : Generic(GYOTO_COORDKIND_CARTESIAN, "Python"), diff --git a/plugins/python/lib/Spectrum.C b/plugins/python/lib/Spectrum.C index fac951da..cd0f605f 100644 --- a/plugins/python/lib/Spectrum.C +++ b/plugins/python/lib/Spectrum.C @@ -20,6 +20,8 @@ GYOTO_PROPERTY_VECTOR_DOUBLE(Gyoto::Spectrum::Python, Parameters, parameters, GYOTO_PROPERTY_END(Gyoto::Spectrum::Python, Gyoto::Spectrum::Generic::properties) +GYOTO_PROPERTY_THREAD_UNSAFE(Gyoto::Spectrum::Python) + Spectrum::Python::Python() : Generic("Python"), Base(), pCall_(NULL), pIntegrate_(NULL), pCall_overloaded_(false) diff --git a/plugins/python/lib/Standard.C b/plugins/python/lib/Standard.C index c8da9ba1..2533b62b 100644 --- a/plugins/python/lib/Standard.C +++ b/plugins/python/lib/Standard.C @@ -28,6 +28,8 @@ GYOTO_PROPERTY_DOUBLE(Gyoto::Astrobj::Python::Standard, "The object is defined by __call__ < this value") GYOTO_PROPERTY_END(Astrobj::Python::Standard, Generic::properties) +GYOTO_PROPERTY_THREAD_UNSAFE(Astrobj::Python::Standard) + // Birth and death Gyoto::Astrobj::Python::Standard::Standard() : Astrobj::Standard("Python::Standard"), diff --git a/plugins/python/lib/ThinDisk.C b/plugins/python/lib/ThinDisk.C index 7ba93614..390cbe7e 100644 --- a/plugins/python/lib/ThinDisk.C +++ b/plugins/python/lib/ThinDisk.C @@ -25,6 +25,8 @@ GYOTO_PROPERTY_VECTOR_DOUBLE(Gyoto::Astrobj::Python::ThinDisk, "Parameters for the class instance.") GYOTO_PROPERTY_END(Astrobj::Python::ThinDisk, Astrobj::ThinDisk::properties) +GYOTO_PROPERTY_THREAD_UNSAFE(Astrobj::Python::ThinDisk) + // Birth and death Gyoto::Astrobj::Python::ThinDisk::ThinDisk() : Astrobj::ThinDisk("Python::ThinDisk"), From 09a179b9d5d070c949d0969221cc4efc0bdcc989 Mon Sep 17 00:00:00 2001 From: Thibaut Paumard Date: Sun, 11 Dec 2016 20:08:45 +0100 Subject: [PATCH 07/11] Remove spurious cerr --- lib/Utils.C | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Utils.C b/lib/Utils.C index 2dc73da1..77a73f6b 100644 --- a/lib/Utils.C +++ b/lib/Utils.C @@ -155,7 +155,6 @@ std::vector Gyoto::split(std::string const &src, std::string const while (fpos != string::npos && pos < sz) { fpos = src.find_first_of(delim, pos); if (fpos==pos) {++pos; continue;} - cerr << "src.substr(pos, fpos-pos)" << endl; res.push_back(src.substr(pos, fpos-pos)); pos = fpos+1; } From 87e8567f6c9bcd263a874bc1f11811556770c276 Mon Sep 17 00:00:00 2001 From: Thibaut Paumard Date: Sun, 11 Dec 2016 20:46:35 +0100 Subject: [PATCH 08/11] Correctly handle empty stry case in OscilTorus::emittingArea() --- lib/OscilTorus.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/OscilTorus.C b/lib/OscilTorus.C index 80d51442..325686a1 100644 --- a/lib/OscilTorus.C +++ b/lib/OscilTorus.C @@ -71,7 +71,8 @@ std::string OscilTorus::perturbKind() const { std::string OscilTorus::emittingArea() const {return emitting_area_;} void OscilTorus::emittingArea(std::string const &f) { - if (f=="") { + if (f=="" || f.substr(f.size()-1) == "/") { + emitting_area_ = ""; with_cross_=0; tt_.clear(); area_.clear(); @@ -96,7 +97,8 @@ void OscilTorus::emittingArea(std::string const &f) { file.ignore(numeric_limits::max(), '\n');//next line } nbt_=tt_.size(); - } + emitting_area_ = f; + } else throwError("Unable to read " + f); } Gyoto::Astrobj::OscilTorus::OscilTorus() From 6ca591a2660e1293b559af6c1e86015d7be0bd48 Mon Sep 17 00:00:00 2001 From: Thibaut Paumard Date: Mon, 12 Dec 2016 10:45:37 +0100 Subject: [PATCH 09/11] Support enroling MPI_COMM_WORLD in python/example-mpi.py Apply the same heuristics and algorithm as in bin/gyoto.C to support mpirun starting the worker process itself. --- python/example-mpi.py | 98 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 92 insertions(+), 6 deletions(-) diff --git a/python/example-mpi.py b/python/example-mpi.py index 5e2d68b6..63860a84 100644 --- a/python/example-mpi.py +++ b/python/example-mpi.py @@ -19,10 +19,85 @@ # You should have received a copy of the GNU General Public License # along with Gyoto. If not, see . +### Explanation: +# +# The script examplifies how to use MPI parallelization with Gyoto +# commanded from Python. It performs the ray-tracing of one of the +# Gyoto examples in doc/examples/ using MPI parallelization. It does +# nothing with the result, uncomment the last few lines if you want to +# display them. +# +# The parallel computing model of Gyoto is MIMD (Multiple Instruction, +# Multiple Data) which allows not caring too much about the details in +# the high level program. We have a single 'manager' process that +# takes care of handling input/output and distributes the work load +# (ray-tracing of individual geodesics) to 'worker' processes, +# instances of gyoto-mpi-worker.VERSION where VERSION is the ABI +# version of Gyoto. +# +# There are two basic scenarios supported in Gyoto to start the +# manager and the workers, plus a cheat that works only under Open +# MPI: +# +# 1- mpirun starts only the rank 0, manager process, which is +# responsible for starting the workers processes using +# MPI_Comm_spawn(); +# +# 2- mpirun starts one instance of the manager process and NWORKER +# instances of the worker process; +# +# 3- only under Open MPI: mpirun/orterun starts NWORKERS+1 instances +# of the manager program, and all these instances except rank 0 +# immediately transform themselves into worker processes using the +# execlp() system call, so we are back in scenario 2 above. +# +### Synopsis: +# +# This script automatically detects how it was started and supports +# the three scenarios above: +# +# 1- mpirun -np 1 python example-mpi.py +# 2- mpirun -np 1 python example-mpi.py : -np NWORKERS gyoto-mpi-worker.VERSION +# 3- orterun -np python example-mpi.py +# +# where NWORKERS is the desired number of workers to use (e.g. 4) and +# VERSION is the gyoto ABI version (e.g. 5 or 5-unreleased). In the +# first form, the script will spawn 4 workers (instances of +# gyoto-mpi-workers.VERSION). In the second form, the script will use +# the NWORKERS instances launched by mpirun. +# +# The third version works only if the MPI environment is Open MPI +# (hence the choice to use the command orterun instead of mpirun in +# the example). In this case, the NWORKERS process with rank > 0 will +# respawn themselves as gyoto-mpi-worker.VERSION using os.execlp(). +# +### Environment: +# +# The system must be able to find libgyoto, the plugins, and the +# command-line utilities gyoto and gyoto-mpi-workers.VERSION, +# therefore you may need to set PATH and LD_LIBRARY_PATH appropriately +# or the like. Make sure the version of gyoto that is found first in +# your path is the right version, i.e. that LD_LIBRARY_PATH and PATH +# are set consistently. +# +### + +# 1- Support scenario 3 above +# +# Check whether we are running under an OpenMPI environment and have a +# rank > 0. In this case, respawn as gyoto, which will itself respawn +# as the right gyoto-mpi-worker.VERSION using exactly the same +# heuristics. Respawning as gyoto instead of gyoto-mpi-worker.VERSION +# saves us from hard-coding VERSION, but is slightly unsafe. Make sure +# the right (ABI-compatible) version of gyoto is first in your PATH! +import os +if os.getenv('OMPI_COMM_WORLD_RANK', '0') != '0': + os.execlp("gyoto", "") -# Let mpi4py initilize the MPI environment: +# 2- Let mpi4py initialize the MPI environment: import mpi4py.MPI +# 3- Prepare Gyoto::Scenery to ray-trace import numpy import matplotlib as ml import matplotlib.pyplot as plt @@ -35,7 +110,7 @@ sc.nThreads(1) sc.astrobj().opticallyThin(False) -# Ray-trace scenery +# 4- Prepare storage for ray-traced quantities # Prepare array for holding results res=sc.screen().resolution() @@ -49,21 +124,32 @@ aop.time=gyoto.array_double.fromnumpy2(time) aop.distance=gyoto.array_double.fromnumpy2(distance) -# Prepare Coord2dSet to select what Photons to launch +# 5- Prepare Coord2dSet to select what Photons to launch ii=gyoto.Range(1, res, 1) jj=gyoto.Range(1, res, 1) grid=gyoto.Grid(ii, jj) +# 6- Autodetect scenario 1 vs. scenarios 2/3 # Spawn processes and clone scenery into them: -sc.mpiSpawn(4) +world = mpi4py.MPI.COMM_WORLD +if (world.size > 1 and world.rank == 0): + # This is scenario 2/3 + # We assume that the other ranks are instances of + # gyoto-mpi-worker.VERSION and enrole them + sc.mpiSpawn(-1) +else: + # This is scenario 1 + # We spawn 4 instances of gyoto-mpi-worker.VERSION + sc.mpiSpawn(4) sc.mpiClone() -# Ray-trace +# 7- Ray-trace sc.rayTrace(grid, aop) -# Terminate workers +# 8- Terminate MPI workers sc.mpiTerminate() +# 9- Do something with the data #plt.imshow(intensity) #plt.show() #plt.imshow(time) From b3052c5f8663e4b6c49256b5041bcd67a91c2d85 Mon Sep 17 00:00:00 2001 From: Thibaut Paumard Date: Mon, 12 Dec 2016 12:57:47 +0100 Subject: [PATCH 10/11] Add --version option to gyoto command-line tool --- bin/Makefile.am | 3 ++- bin/Makefile.in | 4 +++- bin/gyoto.C | 21 ++++++++++++++------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/bin/Makefile.am b/bin/Makefile.am index ce176d0c..6e7ae3ee 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -1,5 +1,6 @@ ACLOCAL_AMFLAGS = -I m4 -AM_CPPFLAGS = -I@top_srcdir@/include $(XERCES_CFLAGS) $(UDUNITS_CFLAGS) $(BOOST_CPPFLAGS) +AM_CPPFLAGS = -I@top_srcdir@/include $(XERCES_CFLAGS) $(UDUNITS_CFLAGS) $(BOOST_CPPFLAGS) \ + -DPACKAGE_STRING="$(PACKAGE_STRING)" AM_LDFLAGS = $(XERCES_LIBS) $(PTHREAD_LIBS) $(LDFLAGS_EXEC) AM_CXXFLAGS = $(PTHREAD_CFLAGS) $(CXXFLAGS_EXEC) CLEANFILES = diff --git a/bin/Makefile.in b/bin/Makefile.in index 8baa181d..f5f9a3dd 100644 --- a/bin/Makefile.in +++ b/bin/Makefile.in @@ -425,7 +425,9 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 -AM_CPPFLAGS = -I@top_srcdir@/include $(XERCES_CFLAGS) $(UDUNITS_CFLAGS) $(BOOST_CPPFLAGS) +AM_CPPFLAGS = -I@top_srcdir@/include $(XERCES_CFLAGS) $(UDUNITS_CFLAGS) $(BOOST_CPPFLAGS) \ + -DPACKAGE_STRING="$(PACKAGE_STRING)" + AM_LDFLAGS = $(XERCES_LIBS) $(PTHREAD_LIBS) $(LDFLAGS_EXEC) \ $(am__append_3) AM_CXXFLAGS = $(PTHREAD_CFLAGS) $(CXXFLAGS_EXEC) diff --git a/bin/gyoto.C b/bin/gyoto.C index bd1c2fb1..24450b8b 100644 --- a/bin/gyoto.C +++ b/bin/gyoto.C @@ -83,15 +83,16 @@ struct Gyoto::Arg: public option::Arg }; enum optionType { DEBUG, QUIET, VERBOSE, SILENT, IMIN, IMAX, JMIN, JMAX, ISTEP, JSTEP, ISPEC, JSPEC}; -enum optionIndex { UNKNOWN, HELP, PLUGINS, LIST, VERBOSITY, NOSIGFPE, RANGE, +enum optionIndex { UNKNOWN, HELP, PLUGINS, LIST, VERSION, VERBOSITY, NOSIGFPE, RANGE, BOUNDARIES, STEPS, IPCT, TIME, TMIN, FOV, RESOLUTION, DISTANCE, PALN, INCLINATION, ARGUMENT, NTHREADS, NPROCESSES, SETPARAMETER, UNIT, XMLWRITE}; const option::Descriptor usage[] = { - {UNKNOWN, 0, "", "",option::Arg::None, "\nUSAGE: gyoto [options] input.xml output.fits\n\n" - "Generic options:\n -- \tStop option processing." }, + {UNKNOWN, 0, "", "",option::Arg::None, "\nUSAGE: gyoto [options] input.xml output.fits\t\n\n" + "Generic options:\t\n -- \tStop option processing." }, {HELP, 0,"h","help",option::Arg::Optional, " --help[=, -h \tWithout argument, print usage and exit. With argument, document class (e.g. \"Screen\", \"Astrobj::Star\") and exit." }, + {VERSION, 0, "", "version", option::Arg::None, " --version, -V \tPrint the Gyoto version."}, {LIST, 0,"l","list",option::Arg::None, " --list, -l \tPrint the Gyoto register of Astrobj, Metrics etc." }, {NOSIGFPE, 0, "", "no-sigfpe",option::Arg::None, " --no-sigfpe \tDo not enable SIGFPE." #if !defined HAVE_FENV_H @@ -194,9 +195,12 @@ int main(int argc, char** argv) { return 1; // Check whether to output usage string - if ((!options[LIST] && (argc == 0 || parse.nonOptionsCount() != 2 || options[UNKNOWN])) || options[HELP] ) { - if (!options[HELP].arg) option::printUsage(std::cout, usage); - if (!options[LIST] && !options[HELP].arg) { + if (options[VERSION] + || (!options[LIST] && (argc == 0 || parse.nonOptionsCount() != 2 || options[UNKNOWN])) || options[HELP] ) { + cout << GYOTO_STRINGIFY(PACKAGE_STRING) << endl + << "ABI compatibility version: " << GYOTO_SOVERS << endl; + if (!options[VERSION] && !options[HELP].arg) option::printUsage(std::cout, usage); + if (!options[VERSION] && !options[LIST] && !options[HELP].arg) { if (options[HELP]) return 0; return 1; } @@ -223,7 +227,8 @@ int main(int argc, char** argv) { if (parse.nonOptionsCount() > 1) pixfile=strdup(parse.nonOptions()[1]); // State copyright - if (!options[LIST] && !options[HELP] && verbose() >= GYOTO_QUIET_VERBOSITY) + if (options[VERSION] + ||(!options[LIST] && !options[HELP] && verbose() >= GYOTO_QUIET_VERBOSITY)) { cout << " Copyright (c) 2011-2015 Frederic Vincent & Thibaut Paumard\n" << " GYOTO is distributed under the terms of the GPL v. 3 license.\n" << " We request that use of Gyoto in scientific publications be " @@ -233,6 +238,8 @@ int main(int argc, char** argv) { << " Classical and Quantum Gravity 28, 225011 (2011) " << "[arXiv:1109.4769]" << endl << endl; + } + if (options[VERSION]) return 0; if (options[PLUGINS]) pluglist = options[PLUGINS].last()->arg?options[PLUGINS].last()->arg:""; From 498e42bc71a5451be5e226a2f3c9b0763d6a4bb2 Mon Sep 17 00:00:00 2001 From: Thibaut Paumard Date: Mon, 12 Dec 2016 14:24:15 +0100 Subject: [PATCH 11/11] Releasing 1.2.0 --- ChangeLog | 94 ++++++++++++++++++- NEWS | 2 +- bin/gyoto.C | 2 +- configure | 24 ++--- configure.ac | 6 +- doc/examples/example-fixedstar-rotstar3_1.xml | 6 +- .../example-movingstar-rotstar3_1.xml | 6 +- plugins/null/README | 2 +- 8 files changed, 119 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1914dfa..735143e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,89 @@ commit unknown Author: Thibaut Paumard -Date: Mon Oct 31 11:08:12 2016 +0100 +Date: Mon, 12 Dec 2016 13:49:58 +0100 + + Releasing 1.2.0 + +commit b3052c5f8663e4b6c49256b5041bcd67a91c2d85 +Author: Thibaut Paumard +Date: Mon Dec 12 12:57:47 2016 +0100 + + Add --version option to gyoto command-line tool + +commit 6ca591a2660e1293b559af6c1e86015d7be0bd48 +Author: Thibaut Paumard +Date: Mon Dec 12 10:45:37 2016 +0100 + + Support enroling MPI_COMM_WORLD in python/example-mpi.py + + Apply the same heuristics and algorithm as in bin/gyoto.C to support + mpirun starting the worker process itself. + +commit 87e8567f6c9bcd263a874bc1f11811556770c276 +Author: Thibaut Paumard +Date: Sun Dec 11 20:46:35 2016 +0100 + + Correctly handle empty stry case in OscilTorus::emittingArea() + +commit 09a179b9d5d070c949d0969221cc4efc0bdcc989 +Author: Thibaut Paumard +Date: Sun Dec 11 20:08:45 2016 +0100 + + Remove spurious cerr + +commit 63632ea68aee0e6ff3d2e58d13991ce2148ece06 +Author: Thibaut Paumard +Date: Sun Dec 11 19:33:11 2016 +0100 + + Implement thread-safety declaration + + Thread-unsafe classes declare themselves as such, so that NThreads is + ignored when multi-threading would cause erroneous results. + +commit b524fef7147c66ec16190b4c8f7e31adbaa1e64c +Author: Thibaut Paumard +Date: Sat Dec 10 20:44:57 2016 +0100 + + NumericalMetricalLorene is mature: not WIP anymore + + Stop inheriting from WIP + +commit 22d3e7f974b8f52dbe40b3776bdb2c90d7e9261c +Author: Thibaut Paumard +Date: Sat Dec 10 18:11:35 2016 +0100 Releasing 1.1.2 +commit 039f3b98a6ddfa3a99470f2a9b50b9bfcabc97e3 +Author: Thibaut Paumard +Date: Sat Dec 10 15:53:19 2016 +0100 + + Change subcontractor APIs to use a vector + + It is now possible to specify several plugins for loading an + object. Useful when a plug-in depends on another one. In XML: + + Plugins are loaded in order and looked into in reverse order + for the class. + +commit 78608e5a49a349166d15b570ffcec5c9a2754571 +Author: Thibaut Paumard +Date: Sat Dec 10 13:15:06 2016 +0100 + + Store plug-in name as given by user + + When plu-gin name is actually a file name, loadPlugin() determines the + actual plug-in name to find out the intilialization + function. Nevertherless we prefer to store the file name in that case + so users can load several versions of the same plug-in e.g. for + testing purposes. + +commit 5f35070ab4371ab0829de38585b635bd3d0cf51f +Author: Thibaut Paumard +Date: Sat Dec 10 12:34:15 2016 +0100 + + Merging branch master into track-plugin + commit b0413450c29b5a2fca5af1ac30c30954e23f4da8 Author: Thibaut Paumard Date: Fri Dec 9 19:18:24 2016 +0100 @@ -338,6 +418,18 @@ Date: Mon Oct 3 11:27:05 2016 +0200 framework. Allow using any two or three-dimensional image or stack of images in the `picture' and `panorama' painters. +commit 649d76dce7a90a15d55ec444a9d7b50f5868a6f8 +Author: Thibaut Paumard +Date: Wed Sep 28 12:21:32 2016 +0200 + + NEXT 2016/09/28 API + * New functionality: the plug-in from which each subcontractor is + registered is now tracked, so that it becomes possible to look + for a subcontractor matching a specific kind and plug-in. We + introduce the function Gyoto::requirePlugin() in addition to + Gyoto::loadPlugin(). The subcontractor signature is changed to + accept a second parameter, which breaks the API. + commit 22c8c78b2388b987ee5afca27706e2d54c4a3c0a Author: Thibaut Paumard Date: Thu Sep 15 22:22:29 2016 +0200 diff --git a/NEWS b/NEWS index 0f88b738..9f2c18bd 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -NEXT 2016/12/10 API +1.2.0 2016/12/12 ABI 6:0:0 * New functionality: the plug-in from which each subcontractor is registered is now tracked, so that it becomes possible to look for a subcontractor matching a specific kind and plug-in. We diff --git a/bin/gyoto.C b/bin/gyoto.C index 24450b8b..7923d451 100644 --- a/bin/gyoto.C +++ b/bin/gyoto.C @@ -229,7 +229,7 @@ int main(int argc, char** argv) { // State copyright if (options[VERSION] ||(!options[LIST] && !options[HELP] && verbose() >= GYOTO_QUIET_VERBOSITY)) { - cout << " Copyright (c) 2011-2015 Frederic Vincent & Thibaut Paumard\n" + cout << " Copyright (c) 2011-2016 Frederic Vincent & Thibaut Paumard\n" << " GYOTO is distributed under the terms of the GPL v. 3 license.\n" << " We request that use of Gyoto in scientific publications be " << " properly \n acknowledged. Please cite:\n" diff --git a/configure b/configure index 294852be..083c9e15 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for Gyoto 1.1.1. +# Generated by GNU Autoconf 2.69 for Gyoto 1.2.0. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Gyoto' PACKAGE_TARNAME='gyoto' -PACKAGE_VERSION='1.1.1' -PACKAGE_STRING='Gyoto 1.1.1' +PACKAGE_VERSION='1.2.0' +PACKAGE_STRING='Gyoto 1.2.0' PACKAGE_BUGREPORT='gyoto@sympa.obspm.fr' PACKAGE_URL='' @@ -1457,7 +1457,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Gyoto 1.1.1 to adapt to many kinds of systems. +\`configure' configures Gyoto 1.2.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1528,7 +1528,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Gyoto 1.1.1:";; + short | recursive ) echo "Configuration of Gyoto 1.2.0:";; esac cat <<\_ACEOF @@ -1723,7 +1723,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Gyoto configure 1.1.1 +Gyoto configure 1.2.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2422,7 +2422,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Gyoto $as_me 1.1.1, which was +It was created by Gyoto $as_me 1.2.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3398,7 +3398,7 @@ fi # Define the identity of the package. PACKAGE='gyoto' - VERSION='1.1.1' + VERSION='1.2.0' cat >>confdefs.h <<_ACEOF @@ -15655,8 +15655,8 @@ ac_config_headers="$ac_config_headers config.h include/GyotoConfig.h" # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html # C: current; R: revision; A: age # Linux library name is: libgyoto.so.(C-A).A.R -VERSINFO_C=5 -VERSINFO_R=2 +VERSINFO_C=6 +VERSINFO_R=0 VERSINFO_A=0 VERSINFO=${VERSINFO_C}:${VERSINFO_R}:${VERSINFO_A} @@ -21319,7 +21319,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Gyoto $as_me 1.1.1, which was +This file was extended by Gyoto $as_me 1.2.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21385,7 +21385,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Gyoto config.status 1.1.1 +Gyoto config.status 1.2.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index d0476297..50625fda 100644 --- a/configure.ac +++ b/configure.ac @@ -10,7 +10,7 @@ dnl without any warranty. AC_PREREQ([2.69]) -AC_INIT([Gyoto], [1.1.1], [gyoto@sympa.obspm.fr]) +AC_INIT([Gyoto], [1.2.0], [gyoto@sympa.obspm.fr]) gyoto_test_CXXFLAGS=${CXXFLAGS+set} gyoto_test_CPPFLAGS=${CPPFLAGS+set} AC_CANONICAL_SYSTEM @@ -26,8 +26,8 @@ AC_SUBST([VERBATIM], []) # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html # C: current; R: revision; A: age # Linux library name is: libgyoto.so.(C-A).A.R -VERSINFO_C=5 -VERSINFO_R=2 +VERSINFO_C=6 +VERSINFO_R=0 VERSINFO_A=0 VERSINFO=${VERSINFO_C}:${VERSINFO_R}:${VERSINFO_A} AC_SUBST([VERSINFO]) diff --git a/doc/examples/example-fixedstar-rotstar3_1.xml b/doc/examples/example-fixedstar-rotstar3_1.xml index 0447dd61..2eba5680 100644 --- a/doc/examples/example-fixedstar-rotstar3_1.xml +++ b/doc/examples/example-fixedstar-rotstar3_1.xml @@ -8,8 +8,10 @@ prefixed with "`pwd`/" : `pwd`/.check-lorene/resu.d - 1 - + + SpecificIntegrator: 3+1D integration; + GenericIntegrator: 4D integration. + diff --git a/doc/examples/example-movingstar-rotstar3_1.xml b/doc/examples/example-movingstar-rotstar3_1.xml index 69fbda6d..1d8f996a 100644 --- a/doc/examples/example-movingstar-rotstar3_1.xml +++ b/doc/examples/example-movingstar-rotstar3_1.xml @@ -7,8 +7,10 @@ prefixed with "`pwd`/" : `pwd`/.check-lorene/resu.d - 1 - + + SpecificIntegrator: 3+1D integration; + GenericIntegrator: 4D integration. + diff --git a/plugins/null/README b/plugins/null/README index 5f0510ca..2d9e76ef 100644 --- a/plugins/null/README +++ b/plugins/null/README @@ -23,7 +23,7 @@ To make your own, - In XML: - On the command line: gyoto -pstdplug,null ... - In Python: - gyoto.loadPlugin('null') + gyoto.requirePlugin('null') - In all cases: export GYOTO_PLUGINS="stdplug,null". For further details, refer to the Gyoto user manual, section entitled