[Debian-astro-commits] [gyoto] 120/221: Convert Torus to Object/Property
Thibaut Jean-Claude Paumard
thibaut at moszumanska.debian.org
Fri May 22 20:52:39 UTC 2015
This is an automated email from the git hooks/post-receive script.
thibaut pushed a commit to branch master
in repository gyoto.
commit a3c32d0cff9cadcadf4adf97cc972dd1664a13ba
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date: Thu Nov 27 21:09:12 2014 +0100
Convert Torus to Object/Property
---
include/GyotoTorus.h | 12 +---------
lib/Torus.C | 68 +++++++++-------------------------------------------
2 files changed, 12 insertions(+), 68 deletions(-)
diff --git a/include/GyotoTorus.h b/include/GyotoTorus.h
index 277a260..cfc83fd 100644
--- a/include/GyotoTorus.h
+++ b/include/GyotoTorus.h
@@ -66,6 +66,7 @@ class Gyoto::Astrobj::Torus : public Gyoto::Astrobj::Standard {
// Constructors - Destructor
// -------------------------
public:
+ GYOTO_OBJECT;
/**
* kind_ = "Torus", c_ = 3.5, a_=0.5
*/
@@ -141,17 +142,6 @@ class Gyoto::Astrobj::Torus : public Gyoto::Astrobj::Standard {
using Standard::rMax;
virtual double rMax();
-
- //XML I/O
- public:
- virtual int setParameter(std::string name,
- std::string content,
- std::string unit) ;
-
-#ifdef GYOTO_USE_XERCES
- virtual void fillElement(FactoryMessenger *fmp) const ;
- virtual void setParameters(FactoryMessenger *fmp) ;
-#endif
// Outputs
// -------
diff --git a/lib/Torus.C b/lib/Torus.C
index 96eea8d..ebf8c7b 100644
--- a/lib/Torus.C
+++ b/lib/Torus.C
@@ -23,7 +23,7 @@
#include "GyotoBlackBodySpectrum.h"
#include "GyotoPowerLawSpectrum.h"
#include "GyotoMetric.h"
-#include "GyotoPhoton.h"
+#include "GyotoProperty.h"
#include "GyotoFactoryMessenger.h"
#include <float.h>
@@ -35,6 +35,16 @@ using namespace Gyoto;
using namespace Gyoto::Astrobj;
using namespace std;
+GYOTO_PROPERTY_DOUBLE(Torus,
+ LargeRadius, largeRadius, Standard::properties);
+GYOTO_PROPERTY_DOUBLE(Torus,
+ SmallRadius, smallRadius, &LargeRadius);
+GYOTO_PROPERTY_SPECTRUM(Torus,
+ Opacity, opacity, &SmallRadius);
+GYOTO_PROPERTY_SPECTRUM(Torus,
+ Spectrum, spectrum, &Opacity);
+GYOTO_PROPERTY_FINALIZE(Torus, &::Spectrum);
+
Torus::Torus() : Standard("Torus"),
c_(3.5)
{
@@ -154,59 +164,3 @@ void Torus::getVelocity(double const pos[4], double vel[4]) {
}
gg_ -> circularVelocity(pos2, vel);
}
-
-int Torus::setParameter(std::string name,
- std::string content,
- std::string unit) {
- if (name=="LargeRadius") largeRadius(atof(content.c_str()), unit);
- else if (name=="SmallRadius") smallRadius(atof(content.c_str()), unit);
- else return Standard::setParameter(name, content, unit);
- return 0;
-}
-
-
-#ifdef GYOTO_USE_XERCES
-void Torus::fillElement(FactoryMessenger *fmp) const {
- FactoryMessenger * childfmp=NULL;
-
- fmp -> metric (gg_) ;
- fmp -> setParameter ("LargeRadius", c_);
- fmp -> setParameter ("SmallRadius", sqrt(critical_value_));
-
- childfmp = fmp -> makeChild ( "Spectrum" );
- spectrum_ -> fillElement(childfmp);
- delete childfmp;
-
- childfmp = fmp -> makeChild ( "Opacity" );
- opacity_ -> fillElement(childfmp);
- delete childfmp;
-
- Standard::fillElement(fmp);
-}
-
-void Torus::setParameters(FactoryMessenger* fmp) {
-
- string name="", content="", unit="";
- SmartPointer<Metric::Generic> gg = NULL;
- SmartPointer<Spectrum::Generic> sp = NULL;
- FactoryMessenger * child = NULL;
-
- metric(fmp->metric());
-
- while (fmp->getNextParameter(&name, &content, &unit)) {
- if (name=="Spectrum") {
- content = fmp -> getAttribute("kind");
- child = fmp -> getChild();
- spectrum( (*Spectrum::getSubcontractor(content))(child) );
- delete child;
- }
- else if (name=="Opacity") {
- content = fmp -> getAttribute("kind");
- child = fmp -> getChild();
- opacity( (*Spectrum::getSubcontractor(content))(child) );
- delete child;
- }
- else setParameter(name, content, unit);
- }
-}
-#endif
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/gyoto.git
More information about the Debian-astro-commits
mailing list