source: issm/branches/trunk-jpl-damage/src/c/classes/objects/Inputs/BoolInput.cpp@ 12878

Last change on this file since 12878 was 12832, checked in by Eric.Larour, 13 years ago

Almost done migrating objects to classes

File size: 4.9 KB
Line 
1/*!\file BoolInput.c
2 * \brief: implementation of the BoolInput object
3 */
4
5#ifdef HAVE_CONFIG_H
6 #include <config.h>
7#else
8#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
9#endif
10
11#include <stdio.h>
12#include <string.h>
13#include "../../classes.h"
14#include "../../../EnumDefinitions/EnumDefinitions.h"
15#include "../../../shared/shared.h"
16#include "../../../Container/Container.h"
17#include "../../../include/include.h"
18
19/*BoolInput constructors and destructor*/
20/*FUNCTION BoolInput::BoolInput(){{{*/
21BoolInput::BoolInput(){
22 return;
23}
24/*}}}*/
25/*FUNCTION BoolInput::BoolInput(IssmDouble* values){{{*/
26BoolInput::BoolInput(int in_enum_type,IssmBool in_value){
27
28 enum_type=in_enum_type;
29 value=in_value;
30}
31/*}}}*/
32/*FUNCTION BoolInput::~BoolInput(){{{*/
33BoolInput::~BoolInput(){
34 return;
35}
36/*}}}*/
37
38/*Object virtual functions definitions:*/
39/*FUNCTION BoolInput::Echo {{{*/
40void BoolInput::Echo(void){
41 this->DeepEcho();
42}
43/*}}}*/
44/*FUNCTION BoolInput::DeepEcho{{{*/
45void BoolInput::DeepEcho(void){
46
47 _printLine_("BoolInput:");
48 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")");
49 _printLine_(" value: " <<(value?"true":"false"));
50}
51/*}}}*/
52/*FUNCTION BoolInput::Id{{{*/
53int BoolInput::Id(void){ return -1; }
54/*}}}*/
55/*FUNCTION BoolInput::MyRank{{{*/
56int BoolInput::MyRank(void){
57 extern int my_rank;
58 return my_rank;
59}
60/*}}}*/
61/*FUNCTION BoolInput::ObjectEnum{{{*/
62int BoolInput::ObjectEnum(void){
63
64 return BoolInputEnum;
65
66}
67/*}}}*/
68/*FUNCTION BoolInput::copy{{{*/
69Object* BoolInput::copy() {
70
71 return new BoolInput(this->enum_type,this->value);
72
73}
74/*}}}*/
75
76/*BoolInput management*/
77/*FUNCTION BoolInput::InstanceEnum{{{*/
78int BoolInput::InstanceEnum(void){
79
80 return this->enum_type;
81
82}
83/*}}}*/
84/*FUNCTION BoolInput::SpawnTriaInput{{{*/
85Input* BoolInput::SpawnTriaInput(int* indices){
86
87 /*output*/
88 BoolInput* outinput=new BoolInput();
89
90 /*only copy current value*/
91 outinput->enum_type=this->enum_type;
92 outinput->value=this->value;
93
94 /*Assign output*/
95 return outinput;
96
97}
98/*}}}*/
99/*FUNCTION BoolInput::SpawnResult{{{*/
100ElementResult* BoolInput::SpawnResult(int step, IssmDouble time){
101
102 return new BoolElementResult(this->enum_type,this->value,step,time);
103
104}
105/*}}}*/
106
107/*Object functions*/
108/*FUNCTION BoolInput::GetInputValue(bool* pvalue) {{{*/
109void BoolInput::GetInputValue(bool* pvalue){
110 *pvalue=value;
111}
112/*}}}*/
113/*FUNCTION BoolInput::GetInputValue(int* pvalue){{{*/
114void BoolInput::GetInputValue(int* pvalue){_error2_("not supported yet!");}
115/*}}}*/
116/*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue){{{*/
117void BoolInput::GetInputValue(IssmDouble* pvalue){_error2_("not supported yet!");}
118/*}}}*/
119/*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){{{*/
120void BoolInput::GetInputValue(IssmDouble* pvalue,GaussTria* gauss){_error2_("not supported yet!");}
121/*}}}*/
122/*FUNCTION BoolInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){{{*/
123void BoolInput::GetInputValue(IssmDouble* pvalue,GaussPenta* gauss){_error2_("not supported yet!");}
124/*}}}*/
125/*FUNCTION BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){{{*/
126void BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussTria* gauss){_error2_("not supported yet!");}
127/*}}}*/
128/*FUNCTION BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){{{*/
129void BoolInput::GetInputDerivativeValue(IssmDouble* derivativevalues, IssmDouble* xyz_list, GaussPenta* gauss){_error2_("not supported yet!");}
130/*}}}*/
131/*FUNCTION BoolInput::ChangeEnum{{{*/
132void BoolInput::ChangeEnum(int newenumtype){
133 this->enum_type=newenumtype;
134}
135/*}}}*/
136/*FUNCTION BoolInput::SquareMin{{{*/
137void BoolInput::SquareMin(IssmDouble* psquaremin, bool process_units,Parameters* parameters){
138 /*square of a bool is the bool itself: */
139 *psquaremin=value;
140}
141/*}}}*/
142/*FUNCTION BoolInput::Scale{{{*/
143void BoolInput::Scale(IssmDouble scale_factor){
144 /*a bool cannot be scaled: */
145}
146/*}}}*/
147/*FUNCTION BoolInput::AXPY{{{*/
148void BoolInput::AXPY(Input* xinput,IssmDouble scalar){
149
150 BoolInput* xboolinput=NULL;
151
152 /*xinput is of the same type, so cast it: */
153 xboolinput=(BoolInput*)xinput;
154
155 /*Carry out the AXPY operation depending on type:*/
156 switch(xinput->ObjectEnum()){
157
158 case BoolInputEnum:
159 this->value=reCast<bool,IssmDouble>(this->value+scalar*xboolinput->value);
160 return;
161
162 default:
163 _error2_("not implemented yet");
164 }
165
166}
167/*}}}*/
168/*FUNCTION BoolInput::Extrude{{{*/
169void BoolInput::Extrude(void){
170
171 /*do nothing*/
172 return;
173}
174/*}}}*/
175/*FUNCTION BoolInput::GetVectorFromInputs{{{*/
176void BoolInput::GetVectorFromInputs(Vector* vector,int* doflist){
177
178 _error2_("not supporte yet!");
179
180}
181/*}}}*/
182/*FUNCTION BoolInput::GetValuesPtr{{{*/
183void BoolInput::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){
184
185 _error2_("not supported yet!");
186
187}
188/*}}}*/
189/*FUNCTION BoolInput::Configure{{{*/
190void BoolInput::Configure(Parameters* parameters){
191 /*do nothing: */
192}
193/*}}}*/
Note: See TracBrowser for help on using the repository browser.