Ice Sheet System Model  4.18
Code documentation
Public Member Functions | Data Fields
ControlInput2 Class Reference

#include <ControlInput2.h>

Inheritance diagram for ControlInput2:
Input2 Object

Public Member Functions

 ControlInput2 ()
 
 ControlInput2 (int nbe, int nbv, int input_layout_enum, int interp, int id)
 
 ~ControlInput2 ()
 
Input2copy ()
 
void DeepEcho ()
 
void Echo ()
 
int Id ()
 
void Marshall (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
 
int ObjectEnum ()
 
void SetInput (Input2 *in_input)
 
void SetInput (Input2 *in_input, int timeoffset)
 
ElementInput2GetInput2 (const char *data)
 
void SetControl (int interp, int numindices, int *indices, IssmDouble *values_in, IssmDouble *values_min, IssmDouble *values_max)
 
void SetGradient (int interp, int numindices, int *indices, IssmDouble *values_in)
 
void SetGradient (int interp, int numindices, int *indices, IssmDouble *values_in, int n)
 
TriaInput2GetTriaInput ()
 
PentaInput2GetPentaInput ()
 
- Public Member Functions inherited from Input2
int InstanceEnum ()
 
void ChangeEnum (int newenumtype)
 
virtual ~Input2 ()
 
virtual void Configure (Parameters *parameters)
 
virtual void GetInputAverage (IssmDouble *pvalue)
 
virtual IssmDouble GetInputMax (void)
 
virtual IssmDouble GetInputMaxAbs (void)
 
virtual IssmDouble GetInputMin (void)
 
virtual void GetInputDerivativeValue (IssmDouble *derivativevalues, IssmDouble *xyz_list, Gauss *gauss)
 
virtual void GetInputValue (IssmDouble *pvalue, Gauss *gauss)
 
virtual int GetInputInterpolationType ()
 
virtual SegInput2GetSegInput ()
 
virtual void AXPY (Input2 *xinput, IssmDouble scalar)
 
virtual void PointWiseMult (Input2 *xinput)
 
virtual void Pow (IssmDouble scale_factor)
 
virtual void Scale (IssmDouble scale_factor)
 
virtual int GetResultArraySize (void)
 
virtual int GetResultInterpolation (void)
 
virtual int GetResultNumberOfNodes (void)
 
- Public Member Functions inherited from Object
virtual ~Object ()
 

Data Fields

int control_id
 
int enum_type
 
int layout_enum
 
ElementInput2gradient
 
ElementInput2maxvalues
 
ElementInput2minvalues
 
ElementInput2savedvalues
 
ElementInput2values
 

Detailed Description

Definition at line 13 of file ControlInput2.h.

Constructor & Destructor Documentation

◆ ControlInput2() [1/2]

ControlInput2::ControlInput2 ( )

Definition at line 18 of file ControlInput2.cpp.

18  {/*{{{*/
19  control_id = 0;
20  values = NULL;
21  savedvalues = NULL;
22  minvalues = NULL;
23  maxvalues = NULL;
24  gradient = NULL;
25 }

◆ ControlInput2() [2/2]

ControlInput2::ControlInput2 ( int  nbe,
int  nbv,
int  input_layout_enum,
int  interp,
int  id 
)

Definition at line 27 of file ControlInput2.cpp.

27  {/*{{{*/
28 
29  this->control_id = id;
30  this->layout_enum = input_layout_enum;
31 
32  _assert_(interp==P1Enum);
33 
34  switch(this->layout_enum){
35  case TriaInput2Enum:
36  this->values =new TriaInput2(nbe,nbv,interp);
37  this->savedvalues=new TriaInput2(nbe,nbv,interp);
38  this->minvalues =new TriaInput2(nbe,nbv,interp);
39  this->maxvalues =new TriaInput2(nbe,nbv,interp);
40  this->gradient =new TriaInput2(nbe,nbv,interp);
41  break;
42  case PentaInput2Enum:
43  this->values =new PentaInput2(nbe,nbv,interp);
44  this->savedvalues=new PentaInput2(nbe,nbv,interp);
45  this->minvalues =new PentaInput2(nbe,nbv,interp);
46  this->maxvalues =new PentaInput2(nbe,nbv,interp);
47  this->gradient =new PentaInput2(nbe,nbv,interp);
48  break;
49  default:
50  _error_("Input of Enum \"" << EnumToStringx(input_layout_enum) << "\" not supported yet by ControlInput2");
51  }
52 }

◆ ~ControlInput2()

ControlInput2::~ControlInput2 ( )

Definition at line 54 of file ControlInput2.cpp.

54  {/*{{{*/
55  if(values) delete values;
56  if(savedvalues) delete savedvalues;
57  if(minvalues) delete minvalues;
58  if(maxvalues) delete maxvalues;
59  if(gradient) delete gradient;
60 }

Member Function Documentation

◆ copy()

Input2 * ControlInput2::copy ( void  )
virtual

Implements Input2.

Definition at line 64 of file ControlInput2.cpp.

64  {/*{{{*/
65 
66  ControlInput2* output=NULL;
67 
68  output = new ControlInput2();
69  output->enum_type=this->enum_type;
70  output->control_id=this->control_id;
71  output->layout_enum = this->control_id;
72 
73  if(values) output->values = xDynamicCast<ElementInput2*>(this->values->copy());
74  if(savedvalues) output->savedvalues = xDynamicCast<ElementInput2*>(this->savedvalues->copy());
75  if(minvalues) output->minvalues = xDynamicCast<ElementInput2*>(this->minvalues->copy());
76  if(maxvalues) output->maxvalues = xDynamicCast<ElementInput2*>(this->maxvalues->copy());
77  if(gradient) output->gradient = xDynamicCast<ElementInput2*>(this->gradient->copy());
78 
79  return output;
80 }

◆ DeepEcho()

void ControlInput2::DeepEcho ( void  )
virtual

Implements Object.

Definition at line 82 of file ControlInput2.cpp.

82  {/*{{{*/
83 
84  _printf_("ControlInput2:\n");
85  _printf_(setw(15)<<" ControlInput2 "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<"\n");
86  _printf_(setw(15)<<" ControlInput2 "<<setw(25)<<left<<EnumToStringx(this->layout_enum)<<"\n");
87  _printf_("---values: \n"); if (values) values->Echo();
88  _printf_("---savedvalues: \n");if (savedvalues) savedvalues->Echo();
89  _printf_("---minvalues: \n"); if (minvalues) minvalues->Echo();
90  _printf_("---maxvalues: \n"); if (maxvalues) maxvalues->Echo();
91  _printf_("---gradient: \n"); if (gradient){ gradient->Echo();} else{_printf_(" Not set yet\n");}
92 }

◆ Echo()

void ControlInput2::Echo ( void  )
virtual

Implements Object.

Definition at line 94 of file ControlInput2.cpp.

94  {/*{{{*/
95  this->DeepEcho();
96 }

◆ Id()

int ControlInput2::Id ( void  )
virtual

Implements Object.

Definition at line 98 of file ControlInput2.cpp.

98 { return -1; }/*{{{*/

◆ Marshall()

void ControlInput2::Marshall ( char **  pmarshalled_data,
int *  pmarshalled_data_size,
int  marshall_direction 
)
virtual

Implements Object.

Definition at line 100 of file ControlInput2.cpp.

100  { /*{{{*/
101 
103  _error_("Not implemented");
104 }

◆ ObjectEnum()

int ControlInput2::ObjectEnum ( void  )
virtual

Implements Object.

Definition at line 106 of file ControlInput2.cpp.

106  {/*{{{*/
107 
108  return ControlInput2Enum;
109 
110 }

◆ SetInput() [1/2]

void ControlInput2::SetInput ( Input2 in_input)
inline

Definition at line 38 of file ControlInput2.h.

38 {_error_("not impelemented");};

◆ SetInput() [2/2]

void ControlInput2::SetInput ( Input2 in_input,
int  timeoffset 
)
inline

Definition at line 39 of file ControlInput2.h.

39 {_error_("not impelemented");};

◆ GetInput2()

ElementInput2 * ControlInput2::GetInput2 ( const char *  data)

Definition at line 182 of file ControlInput2.cpp.

182  {/*{{{*/
183 
184  if(strcmp(data,"value")==0){
185  _assert_(values);
186  return values;
187  }
188  else if(strcmp(data,"savedvalues")==0){
190  return values;
191  }
192  else if (strcmp(data,"lowerbound")==0){
194  return minvalues;
195  }
196  else if (strcmp(data,"upperbound")==0){
198  return maxvalues;
199  }
200  else if (strcmp(data,"gradient")==0){
202  return gradient;
203  }
204  else{
205  _error_("Data " << data << " not supported yet");
206  }
207 
208 }

◆ SetControl()

void ControlInput2::SetControl ( int  interp,
int  numindices,
int *  indices,
IssmDouble values_in,
IssmDouble values_min,
IssmDouble values_max 
)

Definition at line 113 of file ControlInput2.cpp.

113  {/*{{{*/
114 
115  _assert_(this);
116 
117  /*Set input*/
118  //TriaInput2* input = xDynamicCast<TriaInput2*>(this->inputs[id]);
119  this->values->SetInput(interp,numindices,indices,values_in);
120  this->minvalues->SetInput(interp,numindices,indices,values_min);
121  this->maxvalues->SetInput(interp,numindices,indices,values_max);
122 }

◆ SetGradient() [1/2]

void ControlInput2::SetGradient ( int  interp,
int  numindices,
int *  indices,
IssmDouble values_in 
)

Definition at line 124 of file ControlInput2.cpp.

124  {/*{{{*/
125 
126  _assert_(this);
127  _assert_(this->gradient);
128  this->gradient->SetInput(interp,numindices,indices,values_in);
129 }

◆ SetGradient() [2/2]

void ControlInput2::SetGradient ( int  interp,
int  numindices,
int *  indices,
IssmDouble values_in,
int  n 
)

Definition at line 131 of file ControlInput2.cpp.

131  {/*{{{*/
132 
133  if(this->values->ObjectEnum()!=TransientInput2Enum)_error_("you are in the wrong place, go home");
134  _assert_(this);
135  _assert_(this->gradient);
136  _error_("S");
137 
138  //TransientInput2* transient_input = xDynamicCast<TransientInput2*>(this->gradient);
139  //TransientInput2* values_input = xDynamicCast<TransientInput2*>(this->values);
140  //if(values_input->numtimesteps==transient_input->numtimesteps){
141  // TransientInput* new_trans_input = new TransientInput2(ControlInputGradEnum);
142  // IssmDouble time = transient_input->GetTimeByOffset(timestep);
143  // for(int i=0;i<transient_input->numtimesteps;i++){
144  // if(transient_input->timesteps[i]==time) new_trans_input->AddTimeInput(xDynamicCast<TriaInput*>(gradient_in),time);
145  // else {
146  // Input2* input = transient_input->GetTimeInput(transient_input->timesteps[i]);
147  // new_trans_input->AddTimeInput(xDynamicCast<TriaInput2*>(input),transient_input->timesteps[i]);
148  // }
149  // }
150  // this->gradient=new_trans_input;
151  //}
152  //else{
153  // IssmDouble time = values_input->GetTimeByOffset(timestep);
154  // transient_input->AddTimeInput(gradient_in,time);
155  //}
156 
157 
158  //NEW??
159  //this->gradient->SetInput(interp,numindices,indices,values_in);
160 }

◆ GetTriaInput()

TriaInput2 * ControlInput2::GetTriaInput ( )
virtual

Reimplemented from Input2.

Definition at line 162 of file ControlInput2.cpp.

162  {/*{{{*/
163 
164  /*Cast and return*/
165  if(this->values->ObjectEnum()!=TriaInput2Enum){
166  _error_("Cannot return a TriaInput2");
167  }
168  return xDynamicCast<TriaInput2*>(this->values);
169 
170 }

◆ GetPentaInput()

PentaInput2 * ControlInput2::GetPentaInput ( )
virtual

Reimplemented from Input2.

Definition at line 172 of file ControlInput2.cpp.

172  {/*{{{*/
173 
174  /*Cast and return*/
175  if(this->values->ObjectEnum()!=PentaInput2Enum){
176  _error_("Cannot return a PentaInput2");
177  }
178  return xDynamicCast<PentaInput2*>(this->values);
179 
180 }

Field Documentation

◆ control_id

int ControlInput2::control_id

Definition at line 16 of file ControlInput2.h.

◆ enum_type

int ControlInput2::enum_type

Definition at line 17 of file ControlInput2.h.

◆ layout_enum

int ControlInput2::layout_enum

Definition at line 18 of file ControlInput2.h.

◆ gradient

ElementInput2* ControlInput2::gradient

Definition at line 19 of file ControlInput2.h.

◆ maxvalues

ElementInput2* ControlInput2::maxvalues

Definition at line 20 of file ControlInput2.h.

◆ minvalues

ElementInput2* ControlInput2::minvalues

Definition at line 21 of file ControlInput2.h.

◆ savedvalues

ElementInput2* ControlInput2::savedvalues

Definition at line 22 of file ControlInput2.h.

◆ values

ElementInput2* ControlInput2::values

Definition at line 23 of file ControlInput2.h.


The documentation for this class was generated from the following files:
ElementInput2::SetInput
virtual void SetInput(int interp_in, int row, IssmDouble value_in)=0
TransientInput2Enum
@ TransientInput2Enum
Definition: EnumDefinitions.h:1315
ControlInput2::ControlInput2
ControlInput2()
Definition: ControlInput2.cpp:18
_assert_
#define _assert_(ignore)
Definition: exceptions.h:37
_printf_
#define _printf_(StreamArgs)
Definition: Print.h:22
MARSHALLING_ENUM
#define MARSHALLING_ENUM(EN)
Definition: Marshalling.h:14
ControlInput2
Definition: ControlInput2.h:13
ControlInput2Enum
@ ControlInput2Enum
Definition: EnumDefinitions.h:1018
P1Enum
@ P1Enum
Definition: EnumDefinitions.h:662
TriaInput2Enum
@ TriaInput2Enum
Definition: EnumDefinitions.h:1124
ControlInput2::savedvalues
ElementInput2 * savedvalues
Definition: ControlInput2.h:22
EnumToStringx
const char * EnumToStringx(int enum_in)
Definition: EnumToStringx.cpp:15
TriaInput2
Definition: TriaInput2.h:8
ElementInput2::Echo
virtual void Echo()=0
PentaInput2
Definition: PentaInput2.h:8
ControlInput2::maxvalues
ElementInput2 * maxvalues
Definition: ControlInput2.h:20
ControlInput2::values
ElementInput2 * values
Definition: ControlInput2.h:23
ControlInput2::minvalues
ElementInput2 * minvalues
Definition: ControlInput2.h:21
ControlInput2::enum_type
int enum_type
Definition: ControlInput2.h:17
PentaInput2Enum
@ PentaInput2Enum
Definition: EnumDefinitions.h:1125
ElementInput2::ObjectEnum
virtual int ObjectEnum()=0
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
ControlInput2::gradient
ElementInput2 * gradient
Definition: ControlInput2.h:19
ElementInput2::copy
virtual Input2 * copy()=0
ControlInput2::layout_enum
int layout_enum
Definition: ControlInput2.h:18
ControlInput2::DeepEcho
void DeepEcho()
Definition: ControlInput2.cpp:82
ControlInput2::control_id
int control_id
Definition: ControlInput2.h:16