/*!\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_(setw(15)<<"   BoolInput "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<(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 index1,int index2,int index3){

		/*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::SpawnSegInput{{{*/
Input* BoolInput::SpawnSegInput(int index1,int index2){

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

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

		/*Assign output*/
		return outinput;

}
/*}}}*/

/*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,Gauss* gauss){{{*/
void BoolInput::GetInputValue(IssmDouble* pvalue,Gauss* 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: */
}
/*}}}*/
