TEST(runtime_vars_data, register_callback) {
  Observable<std::shared_ptr<const RuntimeVarsData>> obj;
  folly::dynamic jsonObj = folly::dynamic::object("key1", "value1")
                                                 ("key2", "value2");
  string json = folly::to<string>(folly::toJson(jsonObj));
  obj.set(std::make_shared<const RuntimeVarsData>(json));
  int counter = 0;
  {
    auto handle = obj.subscribeAndCall(
      [&counter](std::shared_ptr<const RuntimeVarsData>,
                 std::shared_ptr<const RuntimeVarsData>) {
        counter++;
      });
    EXPECT_EQ(counter, 1);
    jsonObj["key2"] = "value3";
    json = folly::to<string>(folly::toJson(jsonObj));
    obj.set(std::make_shared<const RuntimeVarsData>(json));
  }
  EXPECT_EQ(counter, 2);
  auto newJson = folly::format(
         "{{\"key3\": \"value3\","
         "\"key4\": {}}}", json).str();
  obj.set(std::make_shared<const RuntimeVarsData>(newJson));
  EXPECT_EQ(counter, 2);
}
Beispiel #2
0
//Return a list of data points
//Each should take the data average value of each continuous observable
//Each should represent one combination of possible discrete values
vector<DataPoint*> PhaseSpaceBoundary::GetDiscreteCombinations() const
{
	if( storedCombinationID == uniqueID && !StoredCombinations.empty() )
	{
		return StoredCombinations;
	}

	while( !StoredCombinations.empty() )
	{
		if( StoredCombinations.back() != NULL ) delete StoredCombinations.back();
		StoredCombinations.pop_back();
	}

	//Calculate all possible combinations of discrete observables
	vector<string> thisAllNames = this->GetAllNames();
	vector<vector<double> > discreteValues;
	vector<string> discreteNames, continuousNames;
	vector<vector<double> > discreteCombinations = StatisticsFunctions::DiscreteCombinations( &thisAllNames, this, discreteNames, continuousNames, discreteValues );

	(void) continuousNames;

	//Create the data points to return
	vector<DataPoint*> newDataPoints;

	DataPoint* tempPoint = this->GetMidPoint();
	if( tempPoint == NULL ) return newDataPoints;

	for( unsigned int combinationIndex = 0; combinationIndex < discreteCombinations.size(); ++combinationIndex )
	{
		DataPoint* templateDataPoint = new DataPoint( *tempPoint );

		//Output the discrete values for this combination
		for( unsigned int discreteIndex = 0; discreteIndex < discreteNames.size(); ++discreteIndex )
		{
			//Set the data point
			Observable* oldValue = templateDataPoint->GetObservable( discreteNames[discreteIndex] );

			Observable* newValue = new Observable( oldValue->GetName(), discreteCombinations[combinationIndex][discreteIndex], oldValue->GetUnit() );

			templateDataPoint->SetObservable( discreteNames[discreteIndex], newValue );
			delete newValue;
		}

		newDataPoints.push_back( templateDataPoint );
	}

	delete tempPoint;

	StoredCombinations = newDataPoints;

	storedCombinationID = uniqueID; 

	return newDataPoints;
}
Beispiel #3
0
//Use accept/reject method to create data
int Foam::GenerateData( int DataAmount )
{
	//if( newDataSet->GetDataNumber() < DataAmount ) newDataSet->ReserveDataSpace( DataAmount );
	for( int dataIndex = 0; dataIndex < DataAmount; ++dataIndex )
	{
		//Generate the discrete observables, and select the correct Foam generator to use
		int combinationIndex = 0;
		int incrementValue = 1;
		DataPoint * temporaryDataPoint = new DataPoint(allNames);
		for( int discreteIndex = int(discreteNames.size() - 1); discreteIndex >= 0; --discreteIndex )
		{
			//Create the discrete observable
			Observable * temporaryObservable = generationBoundary->GetConstraint( *discreteNames_ref[unsigned(discreteIndex)] )->CreateObservable(rootRandom);
			double currentValue = temporaryObservable->GetValue();
			temporaryDataPoint->SetObservable( *discreteNames_ref2[unsigned(discreteIndex)], temporaryObservable );
			delete temporaryObservable;

			//Calculate the index
			for (unsigned int valueIndex = 0; valueIndex < discreteValues[unsigned(discreteIndex)].size(); ++valueIndex )
			{
				if ( fabs( discreteValues[unsigned(discreteIndex)][valueIndex] - currentValue ) < DOUBLE_TOLERANCE )
				{
					combinationIndex += ( incrementValue * int(valueIndex) );
					incrementValue *= int(discreteValues[unsigned(discreteIndex)].size());
					break;
				}
			}
		}

		//Use the index calculated to select a Foam generator and generate an event with it
		Double_t* generatedEvent = new Double_t[ continuousNames.size() ];
		foamGenerators[unsigned(combinationIndex)]->MakeEvent();
		foamGenerators[unsigned(combinationIndex)]->GetMCvect(generatedEvent);

		//Store the continuous observables
		for (unsigned int continuousIndex = 0; continuousIndex < continuousNames.size(); ++continuousIndex )
		{
			string unit = generationBoundary->GetConstraint( *continuousNames_ref[continuousIndex] )->GetUnit();
			double newValue = minima[continuousIndex] + ( ranges[continuousIndex] * generatedEvent[continuousIndex] );
			temporaryDataPoint->SetObservable( *continuousNames_ref2[continuousIndex], newValue, unit );
			//cout << continuousNames[continuousIndex] << "\t" << newValue << "\t" << 0.0 << "\t" << unit << endl;
		}

		delete[] generatedEvent;
		//	Store the event
		temporaryDataPoint->SetDiscreteIndex(dataIndex);
		newDataSet->AddDataPoint(temporaryDataPoint);
	}

	//cout << "Destroying Generator(s)" << endl;
	//this->RemoveGenerator();
	return DataAmount;
}
vector<DataPoint*> RapidFitIntegrator::getGSLIntegrationPoints( unsigned int number, vector<double> maxima, vector<double> minima, DataPoint* templateDataPoint, vector<string> doIntegrate, PhaseSpaceBoundary* thisBound )
{
	pthread_mutex_lock( &GSL_DATAPOINT_GET_THREADLOCK );

	bool pointsGood = true;
	if( !_global_doEval_points.empty() )
	{
		if( _global_doEval_points[0] != NULL )
		{
			vector<string> allConsts = thisBound->GetDiscreteNames();
			for( unsigned int i=0; i< allConsts.size(); ++i )
			{
				double haveVal = _global_doEval_points[0]->GetObservable( allConsts[i] )->GetValue();
				double wantVal = templateDataPoint->GetObservable( allConsts[i] )->GetValue();

				if( haveVal != wantVal )
				{
					pointsGood = false;
					break;
				}
			}
		}
	}

	if( ( number != _global_doEval_points.size() ) || (( ( _global_range_minima != minima ) || ( _global_range_maxima != maxima ) ) || !pointsGood ) )
	{
		clearGSLIntegrationPoints();
		_global_doEval_points = initGSLDataPoints( number, maxima, minima, templateDataPoint, doIntegrate );
		_global_range_minima = minima;
		_global_range_maxima = maxima;
		_global_observable_names = doIntegrate;
	}

	vector<string> allObs = _global_doEval_points[0]->GetAllNames();
	for( unsigned int i=0; i< _global_doEval_points.size(); ++i )
	{
		DataPoint* thisPoint = _global_doEval_points[i];
		for( unsigned int j=0; j< allObs.size(); ++j )
		{
			Observable* thisObs = thisPoint->GetObservable( j );
			thisObs->SetBinNumber( -1 );
			thisObs->SetBkgBinNumber( -1 );
		}
		thisPoint->ClearPerEventData();
	}

	pthread_mutex_unlock( &GSL_DATAPOINT_GET_THREADLOCK );
	return _global_doEval_points;
}
        double getWeight( DataPoint * x )
        {
       		vector<string> xListOfNames = x->GetAllNames();
			vector<string>::iterator xIter = xListOfNames.begin();
			Observable * xVar = 0;
			double xVal = 1.;
			while ( ( xVar = x->GetObservable( *xIter ) ) ) {
                if ( (*xIter == "fsig_sw") ) {
					xVal = xVar->GetValue();
				}
				++xIter;
				if ( xIter == xListOfNames.end() ) break;
            }
            return xVal;
        }
Beispiel #6
0
EnvironmentSidebar::EnvironmentSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebarContainer, wxWindow* bottomBarContainer)
: Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer)
{
	wxSizer* waterSizer = new wxGridSizer(2);
	m_MainSizer->Add(waterSizer, wxSizerFlags().Expand());

	waterSizer->Add(new VariableSliderBox(this, _("Water height"), g_EnvironmentSettings.waterheight, 0.f, 1.2f), wxSizerFlags().Expand());
	waterSizer->Add(new VariableSliderBox(this, _("Water shininess"), g_EnvironmentSettings.watershininess, 0.f, 250.f), wxSizerFlags().Expand());

	waterSizer->Add(new VariableSliderBox(this, _("Water waviness"), g_EnvironmentSettings.waterwaviness, 0.f, 10.f), wxSizerFlags().Expand());
	waterSizer->Add(new VariableSliderBox(this, _("Water murkiness"), g_EnvironmentSettings.watermurkiness, 0.f, 1.f), wxSizerFlags().Expand());

	waterSizer->Add(new VariableColourBox(this, _("Water colour"), g_EnvironmentSettings.watercolour), wxSizerFlags().Expand());
	waterSizer->Add(new VariableColourBox(this, _("Water tint"), g_EnvironmentSettings.watertint), wxSizerFlags().Expand());

	waterSizer->Add(new VariableColourBox(this, _("Reflection tint"), g_EnvironmentSettings.waterreflectiontint), wxSizerFlags().Expand());
	waterSizer->Add(new VariableSliderBox(this, _("Refl. tint strength"), g_EnvironmentSettings.waterreflectiontintstrength, 0.f, 1.f), wxSizerFlags().Expand());

	wxSizer* sunSizer = new wxGridSizer(2);
	m_MainSizer->Add(sunSizer, wxSizerFlags().Expand().Border(wxTOP, 8));

	sunSizer->Add(new VariableSliderBox(this, _("Sun rotation"), g_EnvironmentSettings.sunrotation, -M_PIf, M_PIf), wxSizerFlags().Expand());
	sunSizer->Add(new VariableSliderBox(this, _("Sun elevation"), g_EnvironmentSettings.sunelevation, -M_PIf/2, M_PIf/2), wxSizerFlags().Expand());
	sunSizer->Add(new VariableSliderBox(this, _("Sun overbrightness"), g_EnvironmentSettings.sunoverbrightness, 1.0f, 3.0f), wxSizerFlags().Expand());

	sunSizer->Add(m_LightingModelList = new VariableListBox(this, _("Light model"), g_EnvironmentSettings.lightingmodel), wxSizerFlags().Expand());

	m_MainSizer->Add(new LightControl(this, wxSize(150, 150), g_EnvironmentSettings));
	m_MainSizer->Add(m_SkyList = new VariableListBox(this, _("Sky set"), g_EnvironmentSettings.skyset), wxSizerFlags().Expand());
	m_MainSizer->Add(new VariableColourBox(this, _("Sun colour"), g_EnvironmentSettings.suncolour), wxSizerFlags().Expand());
	m_MainSizer->Add(new VariableColourBox(this, _("Terrain ambient colour"), g_EnvironmentSettings.terraincolour), wxSizerFlags().Expand());
	m_MainSizer->Add(new VariableColourBox(this, _("Object ambient colour"), g_EnvironmentSettings.unitcolour), wxSizerFlags().Expand());

	m_Conn = g_EnvironmentSettings.RegisterObserver(0, &SendToGame);
}
		double getDistance(DataPoint * x, DataPoint * y)
		{
			double distance = 0.;
			double diff = 0.;	(void) diff;	//	Unused
			vector<string> xListOfNames = x->GetAllNames();
			vector<string> yListOfNames = y->GetAllNames();
			vector<string>::iterator xIter = xListOfNames.begin();
			vector<string>::iterator yIter = yListOfNames.begin();
			Observable * xVar = 0;
			Observable * yVar = 0;
			double xVal = 0.;
			double yVal = 0.;
			char buffer[100];	(void) buffer;	//	Unused
			while ( (xVar = x->GetObservable( *xIter ) ) && (yVar = y->GetObservable( *yIter ) ) ) {
				//cout << *xIter << endl;
				//if ( (*xIter == "time") ) {
				//	xVal = ( xVar->GetValue() - 1.6 )/1.2;
			    //	yVal = ( yVar->GetValue() - 1.6 )/1.2;
				//}
				if ( (*xIter == "mass") ) {
					xVal = ( xVar->GetValue() - 5200. )/350.;
					yVal = ( yVar->GetValue() - 5200. )/350.;
				}
				else if ( (*xIter == "cosTheta1") ) {
					xVal = ( xVar->GetValue() );
					yVal = ( yVar->GetValue() );
				}
				else if(  (*xIter == "cosTheta2") ) {
					xVal = ( xVar->GetValue() );
					yVal = ( yVar->GetValue() );
				}
				else if ( (*xIter == "phi") ) {
					xVal = ( xVar->GetValue() )/3.14159;
					yVal = ( yVar->GetValue() )/3.14159;
				}
				else {
					xVal = 0.;
					yVal = 0.;
				}
				distance += ( (xVal - yVal)*(xVal - yVal) );
				//sprintf(buffer, " %f %f %f", xVar->GetValue(), yVar->GetValue(), sqrt(distance));
				//cout << (*xIter) << buffer << endl;
				++xIter, ++yIter;
				if ( xIter == xListOfNames.end() || yIter == yListOfNames.end() ) break;
			}
			return sqrt(distance);
		}
Beispiel #8
0
void EnvironmentSidebar::OnMapReload()
{
	AtlasMessage::qGetEnvironmentSettings qry_env;
	qry_env.Post();
	g_EnvironmentSettings = qry_env.settings;

	g_EnvironmentSettings.NotifyObservers();
}
Beispiel #9
0
FunctionalRxnClass::FunctionalRxnClass(string name, GlobalFunction *gf, TransformationSet *transformationSet, System *s) :
	BasicRxnClass(name,1,"",transformationSet,s)
{
	this->cf=0;
	this->gf=gf;
	for(int vr=0; vr<gf->getNumOfVarRefs(); vr++) {
		if(gf->getVarRefType(vr)=="Observable") {
			Observable *obs = s->getObservableByName(gf->getVarRefName(vr));
			obs->addDependentRxn(this);
		} else {
			cerr<<"When creating a FunctionalRxnClass of name: "+name+" you provided a function that\n";
			cerr<<"depends on an observable type that I can't yet handle! (which is "+gf->getVarRefType(vr)+"\n";
			cerr<<"try using type: 'MoleculeObservable' for now.\n";
			cerr<<"quiting..."<<endl; exit(1);
		}
	}
}
Beispiel #10
0
void CompositeFunction::setGlobalObservableDependency(ReactionClass *r, System *s) {

	for(int i=0; i<this->n_gfs; i++) {
		GlobalFunction *gf=gfs[i];

		for(int vr=0; vr<gf->getNumOfVarRefs(); vr++) {
			if(gf->getVarRefType(vr)=="Observable") {
				Observable *obs = s->getObservableByName(gf->getVarRefName(vr));
				obs->addDependentRxn(r);
			} else {
				cerr<<"When creating a FunctionalRxnClass of name: "+r->getName()+" you provided a function that\n";
				cerr<<"depends on an observable type that I can't yet handle! (which is "+gf->getVarRefType(vr)+"\n";
				cerr<<"try using type: 'MoleculeObservable' for now.\n";
				cerr<<"quiting..."<<endl; exit(1);
			}
		}
	}
}
Beispiel #11
0
	VariableColourBox(wxWindow* parent, const wxString& label, Shareable<AtlasMessage::Colour>& colour)
		: wxPanel(parent),
		m_Colour(colour)
	{
		m_Conn = g_EnvironmentSettings.RegisterObserver(0, &VariableColourBox::OnSettingsChange, this);

		m_Sizer = new wxStaticBoxSizer(wxVERTICAL, this, label);
		SetSizer(m_Sizer);

		m_Button = new wxButton(this, -1);
		m_Sizer->Add(m_Button, wxSizerFlags().Expand());
	}
Beispiel #12
0
	VariableListBox(wxWindow* parent, const wxString& label, Shareable<std::wstring>& var)
		: wxPanel(parent),
		m_Var(var)
	{
		m_Conn = g_EnvironmentSettings.RegisterObserver(0, &VariableListBox::OnSettingsChange, this);

		m_Sizer = new wxStaticBoxSizer(wxVERTICAL, this, label);
		SetSizer(m_Sizer);

		m_Combo = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY),
		m_Sizer->Add(m_Combo, wxSizerFlags().Expand());
	}
Beispiel #13
0
	VariableSliderBox(wxWindow* parent, const wxString& label, Shareable<float>& var, float min, float max)
		: wxPanel(parent),
		m_Var(var), m_Min(min), m_Max(max)
	{
		m_Conn = g_EnvironmentSettings.RegisterObserver(0, &VariableSliderBox::OnSettingsChange, this);

		m_Sizer = new wxStaticBoxSizer(wxVERTICAL, this, label);
		SetSizer(m_Sizer);

		m_Slider = new wxSlider(this, -1, 0, 0, range);
		m_Sizer->Add(m_Slider, wxSizerFlags().Expand());
	}
Beispiel #14
0
	vector<double> getDistances( DataPoint * x, DataPoint * y )
	{
		vector<double> distances;
		vector<string> xListOfNames = x->GetAllNames();
		vector<string> yListOfNames = y->GetAllNames();
		vector<string>::iterator xIter = xListOfNames.begin();
		vector<string>::iterator yIter = yListOfNames.begin();
		Observable * xVar = 0;
		Observable * yVar = 0;
		while ( (xVar = x->GetObservable( *xIter ) ) && (yVar = y->GetObservable( *yIter ) ) ) {
			if ( (*xIter == "time" ) || (*xIter == "mass" )) {
				//cout << fabs(xVar->GetValue() - yVar->GetValue() ) << endl;
				distances.push_back( fabs(xVar->GetValue() - yVar->GetValue() ) );
			}
			else if ( (*xIter == "cosTheta") ) {
				distances.push_back( fabs(xVar->GetValue() - yVar->GetValue()) );
			}
			/*
			   else if(  (*xIter == "cosPsi") ) {
			   distances.push_back( fabs( xVar->GetValue() - yVar->GetValue() ) );
			   }
			   else if ( (*xIter == "phi") ) {
			   double diff = diffmod2pi( xVar->GetValue() - yVar->GetValue() );
			   distances.push_back( diff );
			   }
			 */
			++xIter, ++yIter;
			if ( xIter == xListOfNames.end() || yIter == yListOfNames.end() ) break;
		}
		return distances;
	}
double Bd2JpsiKstar_sWave_Fs::angularFactor( )
{
	double returnValue=0.;

	int globalbin=-1;
	int xbin=-1, ybin=-1, zbin=-1;
	double num_entries_bin=-1.;

	//Observable* cos1Obs = cos1Obs = _datapoint->GetObservable( cosPsiName );
	Observable* cos1Obs = _datapoint->GetObservable( cosPsiName );

	if( cos1Obs->GetBkgBinNumber() != -1 )
	{
		return cos1Obs->GetBkgAcceptance();
	}
	else
	{
		Observable* cos2Obs = _datapoint->GetObservable( cosThetaName );
		Observable* phiObs = _datapoint->GetObservable( phiName );

		//Find global bin number for values of angles, find number of entries per bin, divide by volume per bin and normalise with total number of entries in the histogram
		xbin = xaxis->FindFixBin( cosPsi ); if( xbin > nxbins ) xbin = nxbins; if( xbin == 0 ) xbin = 1;
		ybin = yaxis->FindFixBin( cosTheta ); if( ybin > nybins ) ybin = nybins; if( ybin == 0 ) ybin = 1;
		zbin = zaxis->FindFixBin( phi ); if( zbin > nzbins ) zbin = nzbins; if( zbin == 0 ) zbin = 1;

		globalbin = histo->GetBin( xbin, ybin, zbin );
		num_entries_bin = (double)histo->GetBinContent(globalbin);

		//Angular factor normalized with phase space of histogram and total number of entries in the histogram
		returnValue = (double)num_entries_bin;// / (deltax * deltay * deltaz) / (double)total_num_entries;
		//returnValue = (double)num_entries_bin / histo->Integral();

		cos1Obs->SetBkgBinNumber( xbin ); cos1Obs->SetBkgAcceptance( returnValue );
		cos2Obs->SetBkgBinNumber( ybin ); cos2Obs->SetBkgAcceptance( returnValue );
		phiObs->SetBkgBinNumber( zbin ); phiObs->SetBkgAcceptance( returnValue );
	}

	return returnValue;
}
Beispiel #16
0
	void updatePhaseSpaceBoundary( DataPoint * x, PhaseSpaceBoundary * newPhase, PhaseSpaceBoundary * oldPhase, vector<double> distances )
	{
		vector<string> xListOfNames = x->GetAllNames();
		vector<string>::iterator xIter = xListOfNames.begin();
		Observable * xVar = 0;
		double min = 0., max = 0.;
		int i = 0;
		char buffer[100];	(void) buffer;//	Unused

		while ( ( xVar = x->GetObservable( *xIter ) ) ) {
			if ( *xIter == "time" || *xIter == "cosTheta" || *xIter == "mass"){//|| *xIter == "cosPsi" || *xIter == "phi") {
				min = xVar->GetValue() - distances[ (unsigned)i ];
				max = xVar->GetValue() + distances[ (unsigned)i ];
				if ( min > oldPhase->GetConstraint( *xIter )->GetMinimum() ) ((ObservableContinuousConstraint *)newPhase->GetConstraint( *xIter ))->SetMinimum( min );
				if ( max < oldPhase->GetConstraint( *xIter )->GetMaximum() ) ((ObservableContinuousConstraint *)newPhase->GetConstraint( *xIter ))->SetMaximum( max );
				//cout << *xIter << " " << buffer << endl;
			}
			++xIter;
			if ( xIter == xListOfNames.end() ) break;
			i++;
			}
		}
Beispiel #17
0
void GlobalFunction::prepareForSimulation(System *s)
{
	try {
		p=FuncFactory::create();
		for(unsigned int vr=0; vr<n_varRefs; vr++)
		{
			if(varRefTypes[vr]=="Observable") {
				Observable *obs = s->getObservableByName(varRefNames[vr]);
				if(obs==NULL) {
					cout<<"When creating global function: "<<this->name<<endl<<" could not find the observable: ";
					cout<<varRefNames[vr]<<" of type "<<varRefTypes[vr]<<endl;
					cout<<"Quitting."<<endl;
					exit(1);
				}
				obs->addReferenceToMyself(p);
			} else {
				cout<<"here"<<endl;
				cout<<"Uh oh, an unrecognized argType ("<<varRefTypes[vr]<<") for a function! "<<varRefNames[vr]<<endl;
				cout<<"Try using the type: \"MoleculeObservable\""<<endl;
				cout<<"Quitting because this will give unpredicatable results, or just crash."<<endl;
				exit(1);
			}
		}

		for(unsigned int i=0; i<n_params; i++) {
			p->DefineConst(paramNames[i],s->getParameter(paramNames[i]));
		}
		p->SetExpr(this->funcExpression);

	}
	catch (mu::Parser::exception_type &e)
	{
		cout<<"Error preparing function "<<name<<" in class GlobalFunction!!  This is what happened:"<<endl;
		cout<< "  "<<e.GetMsg() << endl;
		cout<<"Quitting."<<endl;
		exit(1);
	}
}
Beispiel #18
0
	void OnClick(wxCommandEvent& WXUNUSED(evt))
	{
		ColourDialog dlg (this, _T("Scenario Editor/LightingColour"),
			wxColour(m_Colour->r, m_Colour->g, m_Colour->b));

		if (dlg.ShowModal() == wxID_OK)
		{
			wxColour& c = dlg.GetColourData().GetColour();
			m_Colour = AtlasMessage::Colour(c.Red(), c.Green(), c.Blue());
			UpdateButton();

			g_EnvironmentSettings.NotifyObserversExcept(m_Conn);
		}
	}
Beispiel #19
0
EnvironmentSidebar::EnvironmentSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebarContainer, wxWindow* bottomBarContainer)
: Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer)
{
	wxSizer* scrollSizer = new wxBoxSizer(wxVERTICAL);
	wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this);
	scrolledWindow->SetScrollRate(10, 10);
	scrolledWindow->SetSizer(scrollSizer);
	m_MainSizer->Add(scrolledWindow,  wxSizerFlags().Expand().Proportion(1));

	wxSizer* waterSizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _T("Water settings"));
	scrollSizer->Add(waterSizer, wxSizerFlags().Expand());

	waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Water height"), g_EnvironmentSettings.waterheight, 0.f, 1.2f), wxSizerFlags().Expand());
	waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Water shininess"), g_EnvironmentSettings.watershininess, 0.f, 250.f), wxSizerFlags().Expand());
	waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Water waviness"), g_EnvironmentSettings.waterwaviness, 0.f, 10.f), wxSizerFlags().Expand());
	waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Water murkiness"), g_EnvironmentSettings.watermurkiness, 0.f, 1.f), wxSizerFlags().Expand());
	waterSizer->Add(new VariableColourBox(scrolledWindow, _("Water colour"), g_EnvironmentSettings.watercolour), wxSizerFlags().Expand());
	waterSizer->Add(new VariableColourBox(scrolledWindow, _("Water tint"), g_EnvironmentSettings.watertint), wxSizerFlags().Expand());
	waterSizer->Add(new VariableColourBox(scrolledWindow, _("Reflection tint"), g_EnvironmentSettings.waterreflectiontint), wxSizerFlags().Expand());
	waterSizer->Add(new VariableSliderBox(scrolledWindow, _("Reflection tint strength"), g_EnvironmentSettings.waterreflectiontintstrength, 0.f, 1.f), wxSizerFlags().Expand());

	wxSizer* sunSizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _T("Sun / lighting settings"));
	scrollSizer->Add(sunSizer, wxSizerFlags().Expand().Border(wxTOP, 8));

	sunSizer->Add(new VariableSliderBox(scrolledWindow, _("Sun rotation"), g_EnvironmentSettings.sunrotation, -M_PIf, M_PIf), wxSizerFlags().Expand());
	sunSizer->Add(new VariableSliderBox(scrolledWindow, _("Sun elevation"), g_EnvironmentSettings.sunelevation, -M_PIf/2, M_PIf/2), wxSizerFlags().Expand());
	sunSizer->Add(new VariableSliderBox(scrolledWindow, _("Sun overbrightness"), g_EnvironmentSettings.sunoverbrightness, 1.0f, 3.0f), wxSizerFlags().Expand());
	sunSizer->Add(new LightControl(scrolledWindow, wxSize(150, 150), g_EnvironmentSettings));
	sunSizer->Add(new VariableColourBox(scrolledWindow, _("Sun colour"), g_EnvironmentSettings.suncolour), wxSizerFlags().Expand());
	sunSizer->Add(m_SkyList = new VariableListBox(scrolledWindow, _("Sky set"), g_EnvironmentSettings.skyset), wxSizerFlags().Expand());
	sunSizer->Add(new VariableSliderBox(scrolledWindow, _("Fog Factor"), g_EnvironmentSettings.fogfactor, 0.0f, 0.01f), wxSizerFlags().Expand());
	sunSizer->Add(new VariableSliderBox(scrolledWindow, _("Fog Thickness"), g_EnvironmentSettings.fogmax, 0.5f, 0.0f), wxSizerFlags().Expand());
	sunSizer->Add(new VariableColourBox(scrolledWindow, _("Fog colour"), g_EnvironmentSettings.fogcolour), wxSizerFlags().Expand());
	sunSizer->Add(new VariableColourBox(scrolledWindow, _("Terrain ambient colour"), g_EnvironmentSettings.terraincolour), wxSizerFlags().Expand());
	sunSizer->Add(new VariableColourBox(scrolledWindow, _("Object ambient colour"), g_EnvironmentSettings.unitcolour), wxSizerFlags().Expand());
	
	wxSizer* postProcSizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _T("Post-processing settings"));
	scrollSizer->Add(postProcSizer, wxSizerFlags().Expand().Border(wxTOP, 8));

	postProcSizer->Add(m_PostEffectList = new VariableListBox(scrolledWindow, _("Post Effect"), g_EnvironmentSettings.posteffect), wxSizerFlags().Expand());
	postProcSizer->Add(new VariableSliderBox(scrolledWindow, _("Brightness"), g_EnvironmentSettings.brightness, -0.5f, 0.5f), wxSizerFlags().Expand());
	postProcSizer->Add(new VariableSliderBox(scrolledWindow, _("Contrast (HDR)"), g_EnvironmentSettings.contrast, 0.5f, 1.5f), wxSizerFlags().Expand());
	postProcSizer->Add(new VariableSliderBox(scrolledWindow, _("Saturation"), g_EnvironmentSettings.saturation, 0.0f, 1.0f), wxSizerFlags().Expand());
	postProcSizer->Add(new VariableSliderBox(scrolledWindow, _("Bloom"), g_EnvironmentSettings.bloom, 0.2f, 0.0f), wxSizerFlags().Expand());

	m_Conn = g_EnvironmentSettings.RegisterObserver(0, &SendToGame);
}
Beispiel #20
0
void EnvironmentSidebar::OnFirstDisplay()
{
	// Load the list of skies. (Can only be done now rather than in the constructor,
	// after the game has been initialised.)
	AtlasMessage::qGetSkySets qry_skysets;
	qry_skysets.Post();
	m_SkyList->SetChoices(*qry_skysets.skysets);
	
	AtlasMessage::qGetPostEffects qry_effects;
	qry_effects.Post();
	m_PostEffectList->SetChoices(*qry_effects.posteffects);

	AtlasMessage::qGetEnvironmentSettings qry_env;
	qry_env.Post();
	g_EnvironmentSettings = qry_env.settings;

	g_EnvironmentSettings.NotifyObservers();
}
Beispiel #21
0
int main(int argc, char const *argv[]) {
	Observable<std::string> s;

	s.registerObserver("GREEN", bar);
	s.registerObserver("ORANGE", std::bind(foo, 42));
	s.registerObserver("RED", std::bind(foo, 12345));

	s.registerObserver("RED", [&] {
			std::cout << "Hello RED event" << std::endl;
		});

	s.notify("GREEN");
	s.notify("ORANGE");
	s.notify("RED");

	return 0;
}
Beispiel #22
0
void EnvironmentSidebar::OnFirstDisplay()
{
	// Load the list of skies. (Can only be done now rather than in the constructor,
	// after the game has been initialised.)
	AtlasMessage::qGetSkySets qry_skysets;
	qry_skysets.Post();
	m_SkyList->SetChoices(*qry_skysets.skysets);

	AtlasMessage::qGetEnvironmentSettings qry_env;
	qry_env.Post();
	g_EnvironmentSettings = qry_env.settings;


	std::vector<std::wstring> lightingModels;
	lightingModels.push_back(L"standard");
	m_LightingModelList->SetChoices(lightingModels);


	g_EnvironmentSettings.NotifyObservers();
}
Beispiel #23
0
//Returns whether a point is within the boundary
bool PhaseSpaceBoundary::IsPointInBoundary( DataPoint * TestDataPoint, bool silence )
{
	for (unsigned int nameIndex = 0; nameIndex < allNames.size(); ++nameIndex )
	{
		//Check if test Observable exists in the DataPoint
		Observable * testObservable = TestDataPoint->GetObservable( allNames[nameIndex], silence );
		if ( testObservable->GetUnit() == "NameNotFoundError" )
		{
			cerr << "Observable \"" << allNames[nameIndex] << "\" expected but not found" << endl;
			return false;
		}
		else
		{
			//Check if the Observable fits
			if ( !allConstraints[nameIndex]->CheckObservable(testObservable) )
			{
				return false;
			}
			else if( allConstraints[nameIndex]->IsDiscrete() )
			{
				vector<double> temp_vec = allConstraints[nameIndex]->GetValues();
				for( unsigned int i=0; i< temp_vec.size(); ++i )
				{
					if( fabs( testObservable->GetValue() - temp_vec[i] ) < DOUBLE_TOLERANCE_PHASE )
					{
						Observable* temp = new Observable( testObservable->GetName(), temp_vec[i], testObservable->GetUnit() );
						TestDataPoint->SetObservable( testObservable->GetName(), temp );
						delete temp;
					}
				}
			}
		}
	}

	//Point is within the boundary
	return true;
}
Beispiel #24
0
 Observer( Observable<DATA_TYPE>& observable)  : m_observable(observable)    
   {
     observable.addObserver(*this);
   }
Beispiel #25
0
//Constructor with correct argument
MakeFoam::MakeFoam( IPDF * InputPDF, PhaseSpaceBoundary * InputBoundary, DataPoint * InputPoint ) : finishedCells(), centerPoints(), centerValues(), cellIntegrals(), integratePDF(InputPDF)
{
	//Make the container to hold the possible cells
	queue<PhaseSpaceBoundary*> possibleCells;
	PhaseSpaceBoundary* firstCell = InputBoundary;
	possibleCells.push(firstCell);

	//Make a list of observables to integrate over
	vector<string> doIntegrate, dontIntegrate;
	vector<string> pdfDontIntegrate = InputPDF->GetDoNotIntegrateList();
	StatisticsFunctions::DoDontIntegrateLists( InputPDF, InputBoundary, &(pdfDontIntegrate), doIntegrate, dontIntegrate );

	//Continue until all possible cells have been examined
	while ( !possibleCells.empty() )
	{
		//Remove the next possible cell
		PhaseSpaceBoundary* currentCell = possibleCells.front();
		possibleCells.pop();

		//Set up the histogram storage
		vector< vector<double> > histogramBinHeights, histogramBinMiddles, histogramBinMaxes;
		double normalisation = 0.0;
		for (unsigned int observableIndex = 0; observableIndex < doIntegrate.size(); ++observableIndex )
		{
			vector<double> binHeights, binMiddles, binMaxes;
			IConstraint * temporaryConstraint = currentCell->GetConstraint( doIntegrate[observableIndex] );
			double minimum = temporaryConstraint->GetMinimum();
			double delta = ( temporaryConstraint->GetMaximum() - minimum ) / (double)HISTOGRAM_BINS;

			//Loop over bins
			for (int binIndex = 0; binIndex < HISTOGRAM_BINS; ++binIndex )
			{
				binHeights.push_back(0.0);
				binMiddles.push_back( minimum + ( delta * ( binIndex + 0.5 ) ) );
				binMaxes.push_back( minimum + ( delta * ( binIndex + 1.0 ) ) );
			}

			histogramBinHeights.push_back(binHeights);
			histogramBinMiddles.push_back(binMiddles);
			histogramBinMaxes.push_back(binMaxes);
		}

		//MC sample the cell, make projections, sort of
		for (int sampleIndex = 0; sampleIndex < MAXIMUM_SAMPLES; ++sampleIndex )
		{
			//Create a data point within the current cell
			DataPoint samplePoint( InputPoint->GetAllNames() );
			for (unsigned int observableIndex = 0; observableIndex < doIntegrate.size(); ++observableIndex )
			{
				//Generate random values to explore integrable observables
				IConstraint * temporaryConstraint = currentCell->GetConstraint( doIntegrate[observableIndex] );
				samplePoint.SetObservable( doIntegrate[observableIndex], temporaryConstraint->CreateObservable() );
			}
			for (unsigned int observableIndex = 0; observableIndex < dontIntegrate.size(); ++observableIndex )
			{
				//Use given values for unintegrable observables
				Observable * temporaryObservable = new Observable( *(InputPoint->GetObservable( dontIntegrate[observableIndex] )) );
				samplePoint.SetObservable( dontIntegrate[observableIndex], temporaryObservable );
				delete temporaryObservable;
			}

			//Evaluate the function at this point
			double sampleValue = InputPDF->Evaluate( &samplePoint );
			normalisation += sampleValue;

			//Populate the histogram
			for (unsigned int observableIndex = 0; observableIndex < doIntegrate.size(); ++observableIndex )
			{
				double observableValue = samplePoint.GetObservable( doIntegrate[observableIndex] )->GetValue();

				for ( int binIndex = 0; binIndex < HISTOGRAM_BINS; ++binIndex )
				{
					if ( observableValue < histogramBinMaxes[observableIndex][unsigned(binIndex)] )
					{
						histogramBinHeights[observableIndex][unsigned(binIndex)] += sampleValue;
						break;
					}
				}
			}
		}

		//Normalise the histograms
		for (unsigned int observableIndex = 0; observableIndex < doIntegrate.size(); ++observableIndex )
		{
			for ( int binIndex = 0; binIndex < HISTOGRAM_BINS; ++binIndex )
			{
				histogramBinHeights[observableIndex][unsigned(binIndex)] /= normalisation;
			}
		}

		//Find the maximum gradient
		vector<double> midPoints;
		string maximumGradientObservable, unit;
		double maximumGradient=0.;
		double lowPoint=0.;
		double splitPoint=0.;
		double highPoint=0.;
		for (unsigned int observableIndex = 0; observableIndex < doIntegrate.size(); ++observableIndex )
		{
			//Find the size of the cell in this observable
			IConstraint * temporaryConstraint = currentCell->GetConstraint( doIntegrate[observableIndex] );
			double cellMaximum = temporaryConstraint->GetMaximum();
			double cellMinimum = temporaryConstraint->GetMinimum();

			//Store the mid point
			double observableMiddle = cellMinimum + ( ( cellMaximum - cellMinimum ) / 2.0 );
			midPoints.push_back(observableMiddle);

			for ( int binIndex = 1; binIndex < HISTOGRAM_BINS; ++binIndex )
			{
				double gradient = abs( histogramBinHeights[observableIndex][ unsigned(binIndex - 1) ] - histogramBinHeights[observableIndex][unsigned(binIndex)] );

				//Update maximum
				if ( ( observableIndex == 0 && binIndex == 1 ) || gradient > maximumGradient )
				{
					maximumGradient = gradient;
					maximumGradientObservable = doIntegrate[observableIndex];
					unit = temporaryConstraint->GetUnit();
					highPoint = cellMaximum;
					splitPoint = ( histogramBinMiddles[observableIndex][ unsigned(binIndex - 1) ] + histogramBinMiddles[observableIndex][unsigned(binIndex)] ) / 2.0;
					lowPoint = cellMinimum;
				}
			}
		}

		//If the maximum gradient is within tolerance, the cell is finished
		if ( maximumGradient < MAXIMUM_GRADIENT_TOLERANCE )
		{
			//Store the finished cell
			finishedCells.push_back(currentCell);

			//Create a data point at the center of the current cell
			DataPoint* cellCenter = new DataPoint( InputPoint->GetAllNames() );
			for (unsigned int observableIndex = 0; observableIndex < doIntegrate.size(); ++observableIndex )
			{
				//Use the mid points for the integrable values
				Observable * temporaryObservable = cellCenter->GetObservable( doIntegrate[observableIndex] );
				Observable* temporaryObservable2 = new Observable( temporaryObservable->GetName(), midPoints[observableIndex], temporaryObservable->GetUnit() );
				cellCenter->SetObservable( doIntegrate[observableIndex], temporaryObservable2 );
				delete temporaryObservable2;
			}
			for (unsigned int observableIndex = 0; observableIndex < dontIntegrate.size(); ++observableIndex )
			{
				//Use given values for unintegrable observables
				Observable * temporaryObservable = new Observable( *(InputPoint->GetObservable( dontIntegrate[observableIndex] )) );
				cellCenter->SetObservable( dontIntegrate[observableIndex], temporaryObservable );
				delete temporaryObservable;
			}

			//Store the center point
			centerPoints.push_back(cellCenter);
		}
		else
		{
			//Create two cells to replace the current cell
			PhaseSpaceBoundary* daughterCell1 = new PhaseSpaceBoundary( currentCell->GetAllNames() );
			PhaseSpaceBoundary* daughterCell2 = new PhaseSpaceBoundary( currentCell->GetAllNames() );

			for (unsigned int observableIndex = 0; observableIndex < doIntegrate.size(); ++observableIndex )
			{
				IConstraint * temporaryConstraint = currentCell->GetConstraint( doIntegrate[observableIndex] );
				if ( doIntegrate[observableIndex] == maximumGradientObservable )
				{
					//Split the cells on the observable with the greatest gradient
					daughterCell1->SetConstraint( doIntegrate[observableIndex], lowPoint, splitPoint, unit );
					daughterCell2->SetConstraint( doIntegrate[observableIndex], splitPoint, highPoint, unit );
				}
				else
				{
					//Copy the continuous constraint (if it can be integrated, it must be continuous)
					daughterCell1->SetConstraint( doIntegrate[observableIndex], temporaryConstraint->GetMinimum(), temporaryConstraint->GetMaximum(), temporaryConstraint->GetUnit() );
					daughterCell2->SetConstraint( doIntegrate[observableIndex], temporaryConstraint->GetMinimum(), temporaryConstraint->GetMaximum(), temporaryConstraint->GetUnit() );
				}
			}
			for (unsigned int observableIndex = 0; observableIndex < dontIntegrate.size(); ++observableIndex )
			{
				IConstraint * temporaryConstraint = currentCell->GetConstraint( dontIntegrate[observableIndex] );
				if ( temporaryConstraint->IsDiscrete() )
				{
					//Copy the discrete constraint
					daughterCell1->SetConstraint( dontIntegrate[observableIndex], temporaryConstraint->GetValues(), temporaryConstraint->GetUnit() );
					daughterCell2->SetConstraint( dontIntegrate[observableIndex], temporaryConstraint->GetValues(), temporaryConstraint->GetUnit() );
				}
				else
				{
					//Copy the continuous constraint
					daughterCell1->SetConstraint( dontIntegrate[observableIndex], temporaryConstraint->GetMinimum(), temporaryConstraint->GetMaximum(), temporaryConstraint->GetUnit() );
					daughterCell2->SetConstraint( dontIntegrate[observableIndex], temporaryConstraint->GetMinimum(), temporaryConstraint->GetMaximum(), temporaryConstraint->GetUnit() );
				}
			}

			//Add the two new cells to the possibles
			possibleCells.push(daughterCell1);
			possibleCells.push(daughterCell2);
		}

		//Make sure you don't exceed the maximum number of cells
		if ( int(finishedCells.size() + possibleCells.size()) >= MAXIMUM_CELLS )
		{
			cout << "MakeFoam warning: maximum cells reached with " << possibleCells.size() << " unexplored" << endl;

			//Dump out any possible cells into finished, without any further examination
			while ( !possibleCells.empty() )
			{
				//Move the cell from "possible" to "finished"
				PhaseSpaceBoundary* temporaryCell = possibleCells.front();
				possibleCells.pop();
				finishedCells.push_back(temporaryCell);

				//Create a data point at the center of the current cell
				DataPoint* cellCenter = new DataPoint( InputPoint->GetAllNames() );
				for (unsigned int observableIndex = 0; observableIndex < doIntegrate.size(); ++observableIndex )
				{
					//Calculate the cell mid point
					IConstraint * temporaryConstraint = temporaryCell->GetConstraint( doIntegrate[observableIndex] );
					double midPoint = temporaryConstraint->GetMinimum() + ( ( temporaryConstraint->GetMaximum() - temporaryConstraint->GetMinimum() ) / 2  );

					//Use the mid points for the integrable values
					Observable * temporaryObservable = cellCenter->GetObservable( doIntegrate[observableIndex] );
					Observable* temporaryObservable2 = new Observable( temporaryObservable->GetName(), midPoint, temporaryObservable->GetUnit() );
					cellCenter->SetObservable( doIntegrate[observableIndex], temporaryObservable2 );
					delete temporaryObservable2;
				}
				for (unsigned int observableIndex = 0; observableIndex < dontIntegrate.size(); ++observableIndex )
				{
					//Use given values for unintegrable observables
					Observable * temporaryObservable = new Observable( *(InputPoint->GetObservable( dontIntegrate[observableIndex] )) );
					cellCenter->SetObservable( dontIntegrate[observableIndex], temporaryObservable );
					delete temporaryObservable;
				}

				//Store the center point
				centerPoints.push_back(cellCenter);
			}

			//Exit the foam loop
			break;
		}
	}

	//Now all the cells have been made!
	//Make a numerical integrator for the function
	RapidFitIntegrator cellIntegrator( InputPDF, true );

	//Find the function value at the center of each cell, and the integral of the function over the cell
	for (unsigned int cellIndex = 0; cellIndex < finishedCells.size(); ++cellIndex )
	{
		//Integrate the cell
		double integral = cellIntegrator.Integral( InputPoint, finishedCells[cellIndex] );
		cellIntegrals.push_back(integral);

		//Evaluate the function at the center of the cell
		double value = InputPDF->Evaluate( centerPoints[cellIndex] );
		centerValues.push_back(value);
	}
}
Beispiel #26
0
 void registerObserver(pObserver observer) {
      observable.registerObserver(observer);
 }
Beispiel #27
0
 void notifyObservers() {
      observable.notifyObservers();
 }
vector<DataPoint*> RapidFitIntegrator::initGSLDataPoints( unsigned int number, vector<double> maxima, vector<double> minima, DataPoint* templateDataPoint, vector<string> doIntegrate )
{
	vector<DataPoint*> doEval_points;
	pthread_mutex_lock( &GSL_DATAPOINT_MANAGEMENT_THREADLOCK );

#ifdef __RAPIDFIT_USE_GSL

	unsigned int nDim = (unsigned) minima.size();

	unsigned int npoint = number;
	vector<double> * integrationPoints = new vector<double>[ nDim ];

	//pthread_mutex_lock( &gsl_mutex );
	//cout << "Allocating GSL Integration Tool. nDim " << nDim << endl;
	gsl_qrng * q = NULL;
	try
	{
		//q = gsl_qrng_alloc( gsl_qrng_sobol, (unsigned)nDim );
		q = gsl_qrng_alloc( gsl_qrng_niederreiter_2, (unsigned)nDim );
	}
	catch(...)
	{
		cout << "Can't Allocate Integration Tool for GSL Integral." << endl;
		cout << " Dim: " << nDim << endl;
		exit(-742);
	}

	if( q == NULL )
	{
		cout << "Can't Allocate Integration Tool for GSL Integral." << endl;
		cout << " Dim: " << nDim << endl;
		exit(-741);
	}

	double* v = new double[ nDim ];
	for( unsigned int i = 0; i < npoint; i++)
	{
		gsl_qrng_get( q, v );
		for( unsigned int j = 0; j < nDim; j++)
		{
			integrationPoints[j].push_back( v[j] );
		}
	}
	delete v;
	gsl_qrng_free(q);
	//cout << "Freed GSL Integration Tool" << endl;
	//pthread_mutex_unlock( &gsl_mutex );

	/*vector<double> minima_v, maxima_v;
	  for( unsigned int i=0; i< nDim; ++i )
	  {
	  minima_v.push_back( minima[i] );
	  maxima_v.push_back( maxima[i] );
	  }*/
	//cout << "Constructing Functions" << endl;
	//IntegratorFunction* quickFunction = new IntegratorFunction( functionToWrap, NewDataPoint, doIntegrate, dontIntegrate, NewBoundary, componentIndex, minima_v, maxima_v );

	for (unsigned int i = 0; i < integrationPoints[0].size(); ++i)
	{
		double* point = new double[ nDim ];
		for ( unsigned int j = 0; j < nDim; j++)
		{
			//cout << doIntegrate[j] << " " << maxima[j] << " " << minima[j] << " " << integrationPoints[j][i] << endl;
			point[j] = integrationPoints[j][i]*(maxima[j]-minima[j])+minima[j];
		}

		DataPoint* thisPoint = new DataPoint( *templateDataPoint );

		thisPoint->ClearPerEventData();
		vector<string> allObs=thisPoint->GetAllNames();
		for( unsigned int j=0; j<allObs.size(); ++j )
		{
			Observable* thisObs = thisPoint->GetObservable( j );
			thisObs->SetBinNumber(-1);
			thisObs->SetBkgBinNumber(-1);
		}

		for( unsigned int k=0; k< doIntegrate.size(); ++k )
		{
			thisPoint->SetObservable( doIntegrate[k], point[k], "noUnitsHere" );
		}

		doEval_points.push_back( thisPoint );
		//result += quickFunction->DoEval( point );
		delete[] point;
	}

	delete[] integrationPoints;
#endif

	(void) maxima; (void) minima; (void) number;
	pthread_mutex_unlock( &GSL_DATAPOINT_MANAGEMENT_THREADLOCK );
	return doEval_points;
}
Beispiel #29
0
void Base::AddSpectator(Observable& observable)
{
    INFO0;
    observable.SetBranchName(BranchName(Stage::trainer));
    spectators_.emplace_back(observable);
}
Beispiel #30
0
void Base::AddVariable(Observable& observable)
{
    INFO0;
    observable.SetBranchName(BranchName(Stage::trainer));
    variables_.emplace_back(observable);
}