示例#1
0
// Broadcast data from Master to all Slaves
bool Parameters::broadcast(ProcessPool& procPool)
{
#ifdef PARALLEL
	if (!procPool.broadcast(name_)) return false;
	if (!procPool.broadcast(description_)) return false;
	if (!procPool.broadcast(&sigma_, 1)) return false;
	if (!procPool.broadcast(&epsilon_, 1)) return false;
	if (!procPool.broadcast(&charge_, 1)) return false;
#endif
	return true;
}
示例#2
0
// Broadcast data
bool VariableValue::broadcast(ProcessPool& procPool)
{
#ifdef PARALLEL
	// Broadcast type first, then value
	int tempType = type_;
	if (!procPool.broadcast(&tempType, 1)) return false;
	type_ = (VariableValue::ValueType) tempType;
	switch (type_)
	{
		case (VariableValue::BooleanType):
			if (!procPool.broadcast(valueB_)) return false;
			break;
		case (VariableValue::IntegerType):
			if (!procPool.broadcast(&valueI_, 1)) return false;
			break;
		case (VariableValue::DoubleType):
			if (!procPool.broadcast(&valueD_, 1)) return false;
			break;
		case (VariableValue::CharType):
			if (!procPool.broadcast(valueC_)) return false;
			break;
		case (VariableValue::IntegerArrayType):
			if (!procPool.broadcast(arrayI_)) return false;
			break;
		case (VariableValue::DoubleArrayType):
			if (!procPool.broadcast(arrayD_)) return false;
			break;
		default:
			Messenger::error("Broadcast of VariableValue failed - type_ %s not accounted for.\n", VariableValue::valueType(type_));
			return false;
	}
#endif
	return true;
}
示例#3
0
// Broadcast data from Master to all Slaves
bool AtomType::broadcast(ProcessPool& procPool)
{
#ifdef PARALLEL
	int index;

	// Send name
	procPool.broadcast(name_);
	
	// Send element
	procPool.broadcast(&element_, 1);
	
	// Get index of Parameters, 
	if (procPool.isMaster()) index = PeriodicTable::element(element_).indexOfParameters(parameters_);
	procPool.broadcast(&index, 1);
	parameters_ = PeriodicTable::element(element_).parameters(index);
#endif
	return true;
}