当前位置: 首页>>代码示例>>C++>>正文


C++ DoubleData类代码示例

本文整理汇总了C++中DoubleData的典型用法代码示例。如果您正苦于以下问题:C++ DoubleData类的具体用法?C++ DoubleData怎么用?C++ DoubleData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DoubleData类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fire

void UpdateLigandConcentration::fire (Data *d) {
	// do the correct cast of the data
	DoubleData *conc = (DoubleData *) d;

	DoubleData *ligand = (DoubleData *) agent->getDatabase()->getDataItem("LigandConcentration");
	ligand->setDouble(conc->getDouble());

}
开发者ID:emonet,项目名称:BHIVE,代码行数:8,代码来源:chemotaxisnfsimactions.cpp

示例2: DoubleData

void iPhoneDoubleCopy::eval() {
    DoubleData *src = (DoubleData *)systemEngine->dStack.pop();
    DoubleData *tgt = new DoubleData();
    tgt->clear();
    tgt->set(((DoubleData *)src)->get());
    systemEngine->dStack.push(src);
    systemEngine->dStack.push(tgt);
};
开发者ID:Camelek,项目名称:qtmoko,代码行数:8,代码来源:phoneinstruction.cpp

示例3: step

void MassBalance::step(double dt) {
	IntegerVectorData* agBoundaryIndecies = (IntegerVectorData*)this->getDataFromAgent(this->boundaryIndecies);
	DoubleVectorData* agBoundaryArray = (DoubleVectorData*)this->getDataFromAgent(this->boundaryArray);
	DoubleVectorData* agSubstrateConcentrationArray = (DoubleVectorData*)this->getDataFromAgent(this->substrateConcentrationArray);
	DoubleData* agCellVolume = (DoubleData*)this->getDataFromAgent(this->cellVolume);
	for (int i=0; i < agBoundaryIndecies->getNumElements(); i++) {
		double conc = agSubstrateConcentrationArray->getDouble(agBoundaryIndecies->getInteger(i));
		conc = (agCellVolume->getDouble()*conc+agBoundaryArray->getDouble(i))/agCellVolume->getDouble();
		agSubstrateConcentrationArray->setDouble(conc,agBoundaryIndecies->getInteger(i));
	}
}
开发者ID:devoid,项目名称:BHIVE,代码行数:11,代码来源:MassBalance.cpp

示例4: IsInt

static bool IsInt(hx::Object *inPtr)
{
   if (!inPtr)
      return false;
   if (TCanCast<IntData>(inPtr))
      return true;
   DoubleData *d = dynamic_cast<DoubleData *>(inPtr);
   if (!d)
      return false;
   double val = d->__ToDouble();
   return ((int)val == val);
}
开发者ID:cbatson,项目名称:hxcpp,代码行数:12,代码来源:Dynamic.cpp

示例5: Message

void CellNotifyLigandConcToNFsimMessageGenerator::placeMessage(int destID) {
	Message *msg = new Message();
	msg->setAction(ChemotaxisActionIDs::UPDATE_LIGAND_CONCENTRATION_ACTION_ID);
	msg->setDestinationID(destID);

	// provide argument for message
	DoubleData *parameter = new DoubleData("ligand_concentration", 0);

	// get chemicals out of cells database
	//if(this->db->existsDataItem("Chemical")) cout<<"got it chief"<<endl;
	//else cout<<"nopers"<<endl;
	DoubleVectorData *chem = (DoubleVectorData*) this->db->getDataItem("Chemical");
	parameter->setDouble(chem->getDouble(0));
	cerr << "i am the cell and i am sending " << parameter->getDouble() << " as lig. to nfsim" << endl;
	// get the chemoattractant
	msg->setArgument(parameter);

	// place message
	source->placeMessageInOutbox(msg);

}
开发者ID:emonet,项目名称:BHIVE,代码行数:21,代码来源:chemotaxisMessageGenerator.cpp

示例6: HiveException

void SpecialAgentAccumulateDataAction::fire(Data *d) {
//	cerr << "# inside specialAgentAccumulatedata" << endl;
	if (this->agent == NULL)
		throw HiveException("action was not assigned to an agent", "SpecialAgentAccumulateDataAction::fire(Data *d)");
	if (d->getType().compare("tvectordata_double")!=0)
		throw HiveException("wrong data passed to action", "SpecialAgentAccumulateDataAction::fire(Data *d)");

	//	cerr << "INSIDE SPECIALAGENT FIRE" << endl;
	// convert data argument into correct format
	TVectorData<double> *c = (TVectorData<double> *) d;

	// get the databases from the agent ... do we really need the meta database ?! not really
	// one could do without ... i just thought it would be funny to have a meta database in a special agent
	// called fox mulder ... but i guess that we should remove this ...
	Database *meta = ((SpecialAgent *) agent)->getMetaDatabase();
	Database *db   = agent->getDatabase();
	// get some meta information
	IntegerData *num_adds =  (IntegerData* ) meta->getDataItem("number_of_adds");
	IntegerData *num_cells = (IntegerData* ) meta->getDataItem("total_number_of_cells");
	IntegerData *num_time_steps_between_outputs = (IntegerData* ) meta->getDataItem("number_between_outputs");
	IntegerData *counter = (IntegerData* ) meta->getDataItem("counter");

	// accumulate the data
	if (num_adds->getInteger() == 0) {
		// fill data
		TVectorData<double> *conc = (TVectorData<double> *) db->getDataItem("total_conc");
		for (int i=1; i<c->size(); i++)
			conc->at(i-1) = c->at(i);
	} else {
		TVectorData<double> *conc = (TVectorData<double>*) db->getDataItem("total_conc");
		for (int i=1; i<c->size(); i++)
			conc->at(i-1) = conc->at(i-1) + c->at(i);
	}
	num_adds->setInteger(num_adds->getInteger()+1);
	// check whether output has to be generated
	if (num_adds->getInteger() == num_cells->getInteger() &&
		counter->getInteger() == num_time_steps_between_outputs->getInteger()-1) {
	//	cerr << "JETZT BIN ICH HIER DIRIN UND SOLLTE ETWAS AUSGEBEN!!!" << endl;
		TVectorData<double> *conc = (TVectorData<double>*) db->getDataItem("total_conc");
		DoubleData *gt = (DoubleData* ) meta->getDataItem("global_time");
		DoubleData *dt = (DoubleData* ) meta->getDataItem("time_step");
		// output time;
		*this->out << setw(12) << setfill(' ') << gt->getDouble()*num_time_steps_between_outputs->getInteger();
		// update time
		gt->setDouble(gt->getDouble() + dt->getDouble());
		// output conc vector
		for (int i=0; i<conc->size(); i++)
			*this->out << setw(12) << setfill(' ') << conc->at(i)/num_cells->getInteger();
		*this->out << endl;
		// reset num_adds
		num_adds->setInteger(0);
		// reset counter
		counter->setInteger(0);
	} else if (num_adds->getInteger() == num_cells->getInteger()){
	//	cerr << "hier drin" << endl;
		num_adds->setInteger(0);
		counter->setInteger(counter->getInteger()+1);
	}

}
开发者ID:emonet,项目名称:BHIVE,代码行数:60,代码来源:transwellAction.cpp

示例7: Update

 void ArSuf::Update(const DoubleData &y) {
   double yvalue = y.value();
   if (lags_.size() == reg_suf_->size()) {
     x_.assign(lags_.begin(), lags_.end());
     reg_suf_->add_mixture_data(yvalue, x_, 1.0);
     lags_.push_front(yvalue);
     lags_.pop_back();
   } else if (lags_.size() < reg_suf_->size()) {
     lags_.push_front(yvalue);
   } else {
     report_error("Vector of lags is larger than the AR(p) dimension.");
   }
 }
开发者ID:comenerv,项目名称:Boom,代码行数:13,代码来源:ArModel.cpp

示例8: input

Agent* WorldAgentFactoryI::createAgent() {
	// open up an inputstream
//	cerr << this->inputname << endl;
	ifstream input(this->inputname.c_str());

	// create world agent and get his database
	Agent *world = new Agent();
	Hive::Database *db = world->getDatabase();

	// add the time counter to the world
	DoubleData *localworldtime = new DoubleData("localworldtime",0.0);
	db->addData(localworldtime->getName(),localworldtime);

	DoubleData *eqTime         = new DoubleData("eqTime", 0);
	db->addData(eqTime->getName(), eqTime);

	DoubleData *dt = new DoubleData("dt", 0);
	db->addData(dt);

	IntegerData *numberofcells = new IntegerData("numberofcells", this->numbercells);
	db->addData(numberofcells->getName(), numberofcells);

	// data structure for knowing which cell is stored at which index in the various vectors
	// that the world agent has
	// maps agent_id (key) on to vector index (value)
	MapIntIntData *local_index_map = new MapIntIntData("local_index_map");
	for (int i=0; i<this->numbercells; i++) {
		//assume agent_ids start at 1 (because the world is agent zero)
		local_index_map->insert(i+1,i);

		//cout<<"adding to local index map: ["<<i+1<<"]: => "<<i<<endl;
	}
	db->addData(local_index_map->getName(),local_index_map);

	// maps vector_index (key) onto agent_id
	// this is needed for outputing the positions of the cells
	MapIntIntData *index_agentid_map = new MapIntIntData("indexagentidmap");
	for (int i=0; i<this->numbercells; i++) {
		// again, agent_ids = i+1
		index_agentid_map->insert(i,i+1);
	}
	db->addData(index_agentid_map->getName(), index_agentid_map);

	// add data structure to the world in which it can store the cell positions
	TVectorData<TVectorData<double>* > *cell_positions = new TVectorData<TVectorData<double>* > ("cellpositions","tvectordata_double_matrix");
	cell_positions->reserveSize(this->numbercells);

	// add data_structure for direction and up vector of the individual cells
	TVectorData<TVectorData<double>* > *cell_dir_vecs = new TVectorData<TVectorData<double>* > ("celldirvecs", "tvectordata_doublematrix");
	cell_dir_vecs->reserveSize(this->numbercells);

	TVectorData<TVectorData<double>* > *cell_up_vecs  = new TVectorData<TVectorData<double>* > ("cellupvecs", "tvectordata_doublematrix");
	cell_up_vecs->reserveSize(this->numbercells);

	for (int i=0; i<this->numbercells;i++) {
		(*cell_positions)[i] = new TVectorData<double> ("position", "tvectordata_double");
		(*cell_positions)[i]->reserveSize(3);
		(*cell_dir_vecs)[i]  = new TVectorData<double> ("direction", "tvectordata_double");
		(*cell_dir_vecs)[i]->reserveSize(3);
		/// this needs to be a unit-vector.
		cell_dir_vecs->at(i)->at(0) = 1.; cell_dir_vecs->at(i)->at(1) = 0.; cell_dir_vecs->at(i)->at(2) = 0;
		(*cell_up_vecs)[i]   = new TVectorData<double> ("up", "tvectordata_double");
		(*cell_up_vecs)[i]->reserveSize(3);
		cell_up_vecs->at(i)->at(0) = 0; cell_up_vecs->at(i)->at(1) = 1; cell_up_vecs->at(i)->at(2) = 0;
	}
	db->addData(cell_positions->getName(), cell_positions);
	db->addData(cell_dir_vecs->getName(), cell_dir_vecs);
	db->addData(cell_up_vecs->getName(), cell_up_vecs);

	// data structure storing how much a cell wishes to consume
	// we will also use it to store the actual concentration that gets consumed by the cells
	TVectorData<double> *desired_cell_consumption = new TVectorData<double>("desired_cell_consumption", "tvectordata_double");
	desired_cell_consumption->reserveSize(this->numbercells);
	db->addData(desired_cell_consumption->getName(), desired_cell_consumption);

	// time step for movement of the cells
	DoubleData *movement_dt = new DoubleData("movement_dt",1.);
	db->addData(movement_dt->getName(), movement_dt);

	/// speed of cells (is that the same for all the cells?)
	//	DoubleData *cellspeed = new DoubleData("cellspeed",0.1);
	//	db->addData(cellspeed->getName(), cellspeed);

	TVectorData<double> *cellspeeds = new TVectorData<double>("cellspeeds", "tvector_double");
	cellspeeds->reserveSize(this->numbercells);
	for (int i=0; i<this->numbercells; i++)
		cellspeeds->at(i) = 20.0;
	db->addData(cellspeeds->getName(), cellspeeds);

	TVectorData<int> *cell_wants_to_move = new TVectorData<int>("cell_wants_to_move", "tvector_bool");
	cell_wants_to_move->reserveSize(this->numbercells);
	for (int i=0; i<this->numbercells; i++)
		cell_wants_to_move->at(i) = (int)true;
	db->addData(cell_wants_to_move->getName(), cell_wants_to_move);

	DoubleData *output_interval = new DoubleData("output_interval",this->output_interval);
	db->addData(output_interval->getName(), output_interval);


	BoolData *isGridEnv = new BoolData("is_grid_environment",false);
//.........这里部分代码省略.........
开发者ID:BHIVE,项目名称:BHIVE,代码行数:101,代码来源:worldagentfactoryI.cpp

示例9: Update

 void BS::Update(const DoubleData &d){
   double p = d.value();
   update_raw(p);
 }
开发者ID:comenerv,项目名称:Boom,代码行数:4,代码来源:BetaModel.cpp

示例10: LevyRunLengthSimulator

void BlindAgentNotifyWorldThatNewAgentIsBorn::placeMessage(int destID) {
	//check if I have to give birth or not
	if(birthFlag->getBool())
	{
		birthFlag->setBool(false);

		// if the death simulator determined death, then do not create the birth message
		if(deathFlag->getBool()) return;

		//get the agentfactory, and use it to create an agent
		AgentFactory *af = Registrar::getSystemRegistrar()->getAgentFactory(1);
		Agent *a = af->createAgent();

		// has the same parent
		// NOTE: the parent is the top level agent in the hierarchy of agents,
		// not the agent that gave birth!
		a->setParent(source->getParentId());

		// has the same special agents
		for(unsigned int s=0; s<source->getNumOfSpecialAgents(); s++)
			a->addSpecialAgent(source->getSpecialAgentId(s));

		// needs the same communicator, of course, of course
		a->addCommunicator(source->getCommunicator());

		// set the other properties of agent 'a' based on the source exactly...
		a->copyDatabaseInformationFromExistingAgent(this->source);


		// CLEARLY A HACK!!  CHANGE THIS AT SOME POINT TO DUPLICATE SIMULATORS
		// replace the movement simulator with the correct one
		if (((BoolData*) a->getDatabase()->getDataItem("is_levy"))->getBool()) {
			LevyRunLengthSimulator *levy = new LevyRunLengthSimulator();
			a->replaceSimulator(0,levy);
		} else {
			ExponentialRunLengthSimulator *expo = new ExponentialRunLengthSimulator();
			a->replaceSimulator(0,expo);
		}



		// ANOTHER HACK !! TIME TO NEXT OUTPUT IS OFF WHEN WE GET HERE, SO WE MUST UPDATE
		DoubleData *t  = (DoubleData *) a->getDatabase()->getDataItem("celltime");
		//DoubleData *oi = (DoubleData *) a->getDatabase()->getDataItem("outputinterval");
		//DoubleData *no = (DoubleData*) a->getDatabase()->getDataItem("nextOutputTime");

		DoubleData *dt = (DoubleData *) a->getDatabase()->getDataItem("dt");
		t->setDouble(t->getDouble()-dt->getDouble());


		//register agent a
		Message *specialMssg = new Message();
		specialMssg->setAction(ChemoPopActionIDs::SPECIAL_AGENT_UPDATE_BLIND_AGENT_COUNT_ACTION_ID);
		specialMssg->setArgument(new IntegerData("ChangeInBlindAgentNumber",1));
		Registrar::getSystemRegistrar()->registerNewAgentAndSendMessageToSpecialAgent(a,specialMssg);

		// Now, send the message to the world!!
		Message *msg = new Message();
		msg->setAction(ChemoPopActionIDs::UPDATE_WORLD_BLIND_AGENT_BIRTH_ACTION_ID);
		msg->setDestinationID(destID);

		//pass my agentID (the mother) and the new agent ID (the baby)
		TVectorData<int> *info = new TVectorData<int>("new_cell_info","tvectordata_int");
		info->addElementToEnd(this->source->getAgentId());
		info->addElementToEnd(a->getAgentId()); // get new AgentID !!!
		msg->setArgument(info);

		source->placeMessageInOutbox(msg);

	}
}
开发者ID:BHIVE,项目名称:BHIVE,代码行数:71,代码来源:chemopopMessageGenerator.cpp

示例11: Update

 void ExpSuf::Update(const DoubleData &x) {
   n_ += 1.0;
   sum_ += x.value();
 }
开发者ID:steve-the-bayesian,项目名称:BOOM,代码行数:4,代码来源:ExponentialModel.cpp

示例12: input

Agent* WorldAgentFactoryI::createAgent() {
	// open up an inputstream
	ifstream input(this->inputname.c_str());

	// create world agent and get his database
	Agent *world = new Agent();
	Hive::Database *db = world->getDatabase();

	// add the time counter to the world
	DoubleData *localworldtime = new DoubleData("localworldtime",0.0);
	db->addData(localworldtime->getName(),localworldtime);

	DoubleData *eqTime         = new DoubleData("eqTime", 0);
	db->addData(eqTime->getName(), eqTime);

	DoubleData *dt = new DoubleData("dt", 1.0);
	db->addData(dt);

	IntegerData *numberofcells = new IntegerData("numberofcells", this->numbercells);
	db->addData(numberofcells->getName(), numberofcells);

	// data structure for knowing which cell is stored at which index in the various vectors
	// that the world agent has
	// maps agent_id (key) on to vector index (value)
	MapIntIntData *local_index_map = new MapIntIntData("local_index_map");
	for (int i=0; i<this->numbercells; i++) {
		//assume agent_ids start at 1 (because the world is agent zero)
		local_index_map->insert(i+1,i);
		//cout<<"adding to local index map: ["<<i+1<<"]: => "<<i<<endl;
	}
	db->addData(local_index_map->getName(),local_index_map);

	// maps vector_index (key) onto agent_id
	// this is needed for outputing the positions of the cells
	MapIntIntData *index_agentid_map = new MapIntIntData("indexagentidmap");
	for (int i=0; i<this->numbercells; i++) {
		// again, agent_ids = i+1
		index_agentid_map->insert(i,i+1);
	}
	db->addData(index_agentid_map->getName(), index_agentid_map);

	// ----------------- DATA STRUCTURES FOR CELL MOVEMENT ------------------------------
	// add data structure to the world in which it can store the cell positions
	TVectorData<TVectorData<double>* > *cell_positions = new TVectorData<TVectorData<double>* > ("cellpositions","tvectordata_double_matrix");
	cell_positions->reserveSize(this->numbercells);

	// add data_structure for direction and up vector of the individual cells
	TVectorData<TVectorData<double>* > *cell_dir_vecs = new TVectorData<TVectorData<double>* > ("celldirvecs", "tvectordata_doublematrix");
	cell_dir_vecs->reserveSize(this->numbercells);

	TVectorData<TVectorData<double>* > *cell_up_vecs  = new TVectorData<TVectorData<double>* > ("cellupvecs", "tvectordata_doublematrix");
	cell_up_vecs->reserveSize(this->numbercells);

	for (int i=0; i<this->numbercells;i++) {
		(*cell_positions)[i] = new TVectorData<double> ("position", "tvectordata_double");
		(*cell_positions)[i]->reserveSize(3);
		(*cell_dir_vecs)[i]  = new TVectorData<double> ("direction", "tvectordata_double");
		(*cell_dir_vecs)[i]->reserveSize(3);
		/// this needs to be a unit-vector.
		cell_dir_vecs->at(i)->at(0) = 1.; cell_dir_vecs->at(i)->at(1) = 0.; cell_dir_vecs->at(i)->at(2) = 0;
		(*cell_up_vecs)[i]   = new TVectorData<double> ("up", "tvectordata_double");
		(*cell_up_vecs)[i]->reserveSize(3);
		cell_up_vecs->at(i)->at(0) = 0; cell_up_vecs->at(i)->at(1) = 1; cell_up_vecs->at(i)->at(2) = 0;
	}
	db->addData(cell_positions->getName(), cell_positions);
	db->addData(cell_dir_vecs->getName(), cell_dir_vecs);
	db->addData(cell_up_vecs->getName(), cell_up_vecs);

	// cellspeeds
	TVectorData<double> *cellspeeds = new TVectorData<double>("cellspeeds", "tvector_double");
	cellspeeds->reserveSize(this->numbercells);
	for (int i=0; i<this->numbercells; i++)
		cellspeeds->at(i) = 20.0;
	db->addData(cellspeeds->getName(), cellspeeds);

	// DATA STRUCTURE FOR METABOLISM
	// data structure for storing how much a cell wishes to consume
	// we will also use it to store the actual concentration that gets consumed by the cells
	TVectorData<double> *desired_cell_consumption = new TVectorData<double>("desired_cell_consumption", "tvectordata_double");
	desired_cell_consumption->reserveSize(this->numbercells);
	db->addData(desired_cell_consumption->getName(), desired_cell_consumption);

	// DATA FOR OUTPUT
	DoubleData *output_interval = new DoubleData("output_interval",this->output_interval);
	db->addData(output_interval->getName(), output_interval);

	// SPECIFIC DATA FOR EITHER ECOLIs OR BLIND AGENTS
	// add data structures to the world that are unique to the E.coli model
	if(!this->isBlindAgent) {
		cerr << "# cells are of type: ECOLI" << endl;
		// add data structure to the world in which it can store the swimming states of all the cells
		TVectorData<int> *swimming_states = new TVectorData<int>("swimmingstates", "tvectordata_int");
		swimming_states->reserveSize(this->numbercells);
		db->addData(swimming_states->getName(), swimming_states);

		// add data structure to the world in whihc it stores the old swimming states of all the cells
		TVectorData<int> *last_swimming_states = new TVectorData<int>("lastswimmingstates", "tvectordata_int");
		last_swimming_states->reserveSize(this->numbercells);
		db->addData(last_swimming_states->getName(), last_swimming_states);

//.........这里部分代码省略.........
开发者ID:BHIVE,项目名称:BHIVE,代码行数:101,代码来源:worldagentfactoryI.cpp

示例13: Agent

Agent* BlindAgentFactory::createAgent()
{
	//Create the agent and the Database
	Agent *bond = new Agent();
	Hive::Database *db = bond->getDatabase();

	// //////////////////////////////////////////////////////////////////
	// Create the base Data objects that are needed by the blind agent
	/////////////////////////////////////////////////////////////////////

	// type name
	StringData *mytypename = new StringData("mytypename", "hans");
	db->addData(mytypename->getName(), mytypename);

	// Internal clock
	DoubleData *celltime = new DoubleData("celltime", 0.0);
	db->addData(celltime->getName(), celltime);

	// record the last dt
	DoubleData *dt = new DoubleData("dt", 0);
	db->addData(dt);

	DoubleData *noutt = new DoubleData("nextOutputTime", 0.0);
	db->addData(noutt->getName(), noutt);

	// Equilibration Time  used by chemotaxis model
	DoubleData *eqtime = new DoubleData("eqtime", cpi->getEqTime());
	db->addData(eqtime->getName(), eqtime);

	// Output frequency of data from the cell may or may not be used
	DoubleData *outputinterval_Data = new DoubleData("outputinterval",this->output_interval);
	db->addData(outputinterval_Data->getName(), outputinterval_Data);

	// at the present the world as well as the metabolism simulatots can only handle one ligand profile
	TVectorData<double> *ligands = new TVectorData<double> ("ligands","tvector_double");
	ligands->reserveSize(1);
	ligands->at(0) = 0;
	db->addData(ligands->getName(),ligands);

	// this stores how much  nutrient a cell would like to get from the world
	TVectorData<double> *appetite = new TVectorData<double> ("appetite", "tvector_double");
	appetite->reserveSize(1);
	appetite->at(0) = 0;
	db->addData(appetite->getName(), appetite);


	// parameter that sets the base effeciency at which nutrient is removed and added to energy
	DoubleData *effeciency = new DoubleData("base_effeciency_of_conversion", 1);
	db->addData(effeciency);

	DoubleData *r1 = new DoubleData("r1", 1);
	db->addData(r1);

	// Marker of the generation of the cell
	IntegerData *generationData = new IntegerData("generation",0);
	db->addData(generationData);


	/// flag that will be set by the death simulator, if the cell has to die
	BoolData *death_flag = new BoolData("death_flag", false);
	db->addData(death_flag->getName(), death_flag);

	/// flag that will be set by the birth simulator, if the cell gives rise to offspring
	BoolData *birth_flag = new BoolData("birth_flag", false);
	db->addData(birth_flag->getName(), birth_flag);

	// UPDATED METABOLISM / BIRTH / DEATH SIMULATOR
	// starting or default values, same for all cells
	double starting_essence = 0.5;
	double default_kcat = 5;
	double default_Km   = 0.1;
	double default_essence_cost_for_movement = 0.025;
	double default_mass_threshold_for_birth = 1;
	double default_essence_threshold_for_death = 0.000001;
	double default_background_death_rate_per_unit_time = 0; // not sure whether it is a good idea to have this in the cell.
    double default_yield = 1;
    bool   default_is_levy = false;
    double default_parameter_for_steplength_dist = 1;
    double default_rho = 0.3;
    double default_velocity = 2;
    double default_current_angle = 2.0;
    double default_distance_desired_to_travel = 0.0;
    double default_traveled_distance = 0.0;

	// create the data items storing these parameters
	DoubleData *essence = new DoubleData("essence",starting_essence);
	// kcat and Km are the rescaled variables
	DoubleData *kcat = new DoubleData("kcat",default_kcat);
	DoubleData *Km = new DoubleData("Km",default_Km);
	// this is the parameter alpha
	DoubleData *essence_cost_for_movement = new DoubleData("essence_cost_for_movement",default_essence_cost_for_movement);
	DoubleData *background_death_rate_per_unit_time = new DoubleData("background_death_rate_per_unit_time",default_background_death_rate_per_unit_time);
	// the user will not be able to set the birth threshold it  is always equal to one
	DoubleData *essence_threshold_for_birth = new DoubleData("essence_threshold_for_birth",default_mass_threshold_for_birth);
	DoubleData *essence_threshold_for_death = new DoubleData("essence_threshold_for_death",default_essence_threshold_for_death);
	DoubleData *velocity = new DoubleData("velocity",default_velocity);
	DoubleData *yield = new DoubleData("yield", default_yield);
	BoolData   *is_levy = new BoolData("is_levy", default_is_levy);
	DoubleData *rho = new DoubleData("rho", default_rho);
	DoubleData *parameter_for_steplength_dist =new DoubleData("parameter_for_steplength_dist", default_parameter_for_steplength_dist);
//.........这里部分代码省略.........
开发者ID:BHIVE,项目名称:BHIVE,代码行数:101,代码来源:blindagentfactory.cpp

示例14: update_raw

 void US::Update(const DoubleData &d) { update_raw(d.value()); }
开发者ID:cran,项目名称:Boom,代码行数:1,代码来源:UniformModel.cpp


注:本文中的DoubleData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。