/*!\file BoolInput.c
 * \brief: implementation of the BoolInput object
 */

#ifdef HAVE_CONFIG_H
	#include <config.h>
#else
#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
#endif

#include "../classes.h"
#include "../../shared/shared.h"

/*BoolInput constructors and destructor*/
/*FUNCTION BoolInput::BoolInput(){{{*/
BoolInput::BoolInput(){
	return;
}
/*}}}*/
/*FUNCTION BoolInput::BoolInput(int in_enum_type,bool in_value){{{*/
BoolInput::BoolInput(int in_enum_type,bool in_value){

	enum_type=in_enum_type;
	value=in_value;
}
/*}}}*/
/*FUNCTION BoolInput::~BoolInput(){{{*/
BoolInput::~BoolInput(){
	return;
}
/*}}}*/

/*Object virtual functions definitions:*/
/*FUNCTION BoolInput::Echo {{{*/
void BoolInput::Echo(void){
	this->DeepEcho();
}
/*}}}*/
/*FUNCTION BoolInput::DeepEcho{{{*/
void BoolInput::DeepEcho(void){

	_printf_("BoolInput:\n");
	_printf_("   enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
	_printf_("   value: " <<(value?"true":"false") << "\n");
}
/*}}}*/
/*FUNCTION BoolInput::Id{{{*/
int    BoolInput::Id(void){ return -1; }
/*}}}*/
/*FUNCTION BoolInput::ObjectEnum{{{*/
int BoolInput::ObjectEnum(void){

	return BoolInputEnum;

}
/*}}}*/
/*FUNCTION BoolInput::copy{{{*/
Object* BoolInput::copy() {

	return new BoolInput(this->enum_type,this->value);

}
/*}}}*/

/*BoolInput management*/
/*FUNCTION BoolInput::InstanceEnum{{{*/
int BoolInput::InstanceEnum(void){

	return this->enum_type;

}
/*}}}*/
/*FUNCTION BoolInput::SpawnTriaInput{{{*/
Input* BoolInput::SpawnTriaInput(int location){

		/*output*/
		BoolInput* outinput=new BoolInput();

		/*only copy current value*/
		outinput->enum_type=this->enum_type;
		outinput->value=this->value;

		/*Assign output*/
		return outinput;

}
/*}}}*/
/*FUNCTION BoolInput::SpawnResult{{{*/
ElementResult* BoolInput::SpawnResult(int step, IssmDouble time){

	return new BoolElementResult(this->enum_type,this->value,step,time);

}
/*}}}*/

/*Object functions*/
/*FUNCTION BoolInput::GetInputValue(bool* pvalue) {{{*/
void BoolInput::GetInputValue(bool* pvalue){
	*pvalue=value;
}
/*}}}*/
/*FUNCTION BoolInput::GetInputValue(int* pvalue){{{*/
void BoolInput::GetInputValue(int* pvalue){_error_("not supported yet!");}
/*}}}*/
/*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue){{{*/
void BoolInput::GetInputValue(IssmDouble* pvalue){_error_("not supported yet!");}
/*}}}*/
/*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/
void BoolInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error_("not supported yet!");}
/*}}}*/
/*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/
void BoolInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error_("not supported yet!");}
/*}}}*/
/*FUNCTION BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/
void BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error_("not supported yet!");}
/*}}}*/
/*FUNCTION BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/
void BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error_("not supported yet!");}
/*}}}*/
/*FUNCTION BoolInput::ChangeEnum{{{*/
void BoolInput::ChangeEnum(int newenumtype){
	this->enum_type=newenumtype;
}
/*}}}*/
/*FUNCTION BoolInput::SquareMin{{{*/
void BoolInput::SquareMin(IssmDouble* psquaremin,Parameters* parameters){
	/*square of a bool is the bool itself: */
	*psquaremin=value;
}
/*}}}*/
/*FUNCTION BoolInput::Scale{{{*/
void BoolInput::Scale(IssmDouble scale_factor){
	/*a bool cannot be scaled: */
}
/*}}}*/
/*FUNCTION BoolInput::AXPY{{{*/
void BoolInput::AXPY(Input* xinput,IssmDouble scalar){

	BoolInput*  xboolinput=NULL;

	/*xinput is of the same type, so cast it: */
	xboolinput=(BoolInput*)xinput;

	/*Carry out the AXPY operation depending on type:*/
	switch(xinput->ObjectEnum()){

		case BoolInputEnum:
			this->value=reCast<bool,IssmDouble>(this->value+scalar*xboolinput->value);
			return;

		default:
			_error_("not implemented yet");
	}

}
/*}}}*/
/*FUNCTION BoolInput::Extrude{{{*/
void BoolInput::Extrude(void){

	/*do nothing*/
	return;
}
/*}}}*/
/*FUNCTION BoolInput::GetVectorFromInputs{{{*/
void BoolInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){

	_error_("not supporte yet!");

}
/*}}}*/
/*FUNCTION BoolInput::Configure{{{*/
void BoolInput::Configure(Parameters* parameters){
	/*do nothing: */
}
/*}}}*/
