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

#include <Numberedcostfunction.h>

Inheritance diagram for Numberedcostfunction:
Object Definition

Public Member Functions

 Numberedcostfunction ()
 
 Numberedcostfunction (char *in_name, int in_definitionenum, int number_cost_functions_in, int *cost_functions_list_in)
 
 ~Numberedcostfunction ()
 
Objectcopy ()
 
void DeepEcho (void)
 
void Echo (void)
 
int Id (void)
 
void Marshall (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
 
int ObjectEnum (void)
 
int DefinitionEnum ()
 
char * Name ()
 
IssmDouble Response (FemModel *femmodel)
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
- Public Member Functions inherited from Definition
virtual ~Definition ()
 

Data Fields

int definitionenum
 
char * name
 
int number_cost_functions
 
int * cost_functions_list
 

Detailed Description

Definition at line 15 of file Numberedcostfunction.h.

Constructor & Destructor Documentation

◆ Numberedcostfunction() [1/2]

Numberedcostfunction::Numberedcostfunction ( )

Definition at line 33 of file Numberedcostfunction.cpp.

33  {/*{{{*/
34 
35  this->definitionenum = -1;
36  this->name = NULL;
37  this->number_cost_functions = -1;
38  this->cost_functions_list = NULL;
39 
40 }

◆ Numberedcostfunction() [2/2]

Numberedcostfunction::Numberedcostfunction ( char *  in_name,
int  in_definitionenum,
int  number_cost_functions_in,
int *  cost_functions_list_in 
)

Definition at line 42 of file Numberedcostfunction.cpp.

42  {/*{{{*/
43  _assert_(number_cost_functions_in>0);
44  _assert_(cost_functions_list_in);
45 
46  this->definitionenum=in_definitionenum;
47  this->name = xNew<char>(strlen(in_name)+1);
48  xMemCpy<char>(this->name,in_name,strlen(in_name)+1);
49 
50  this->number_cost_functions = number_cost_functions_in;
51  this->cost_functions_list = xNew<int>(number_cost_functions_in);
52 
53  for(int i=0;i<number_cost_functions_in;i++){
54  this->cost_functions_list[i] = cost_functions_list_in[i];
55  }
56 }

◆ ~Numberedcostfunction()

Numberedcostfunction::~Numberedcostfunction ( )

Definition at line 58 of file Numberedcostfunction.cpp.

58  {/*{{{*/
59  xDelete<int>(this->cost_functions_list);
60  if(this->name)xDelete(this->name);
61 }

Member Function Documentation

◆ copy()

Object * Numberedcostfunction::copy ( void  )
virtual

Implements Object.

Definition at line 65 of file Numberedcostfunction.cpp.

65  {/*{{{*/
67  return (Object*)out;
68 }

◆ DeepEcho()

void Numberedcostfunction::DeepEcho ( void  )
virtual

Implements Object.

Definition at line 70 of file Numberedcostfunction.cpp.

70  {/*{{{*/
71  this->Echo();
72 }

◆ Echo()

void Numberedcostfunction::Echo ( void  )
virtual

Implements Object.

Definition at line 74 of file Numberedcostfunction.cpp.

74  {/*{{{*/
75  _printf_(" Numberedcostfunction: " << this->name << " " << this->definitionenum << "\n");
76  _printf_(" number_cost_functions: "<<this->number_cost_functions<<"\n");
77  _printf_(" ");
78  for(int i=0;i<this->number_cost_functions;i++){
79  _printf_(this->cost_functions_list[i]<< " ");
80  }
81  _printf_("\n");
82 }

◆ Id()

int Numberedcostfunction::Id ( void  )
virtual

Implements Object.

Definition at line 84 of file Numberedcostfunction.cpp.

84  {/*{{{*/
85  return -1;
86 }

◆ Marshall()

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

Implements Object.

Definition at line 88 of file Numberedcostfunction.cpp.

88  {/*{{{*/
89  _error_("not implemented yet!");
90 }

◆ ObjectEnum()

int Numberedcostfunction::ObjectEnum ( void  )
virtual

Implements Object.

Definition at line 92 of file Numberedcostfunction.cpp.

92  {/*{{{*/
94 }

◆ DefinitionEnum()

int Numberedcostfunction::DefinitionEnum ( )
virtual

Implements Definition.

Definition at line 98 of file Numberedcostfunction.cpp.

98  {/*{{{*/
99  return this->definitionenum;
100 }

◆ Name()

char * Numberedcostfunction::Name ( )
virtual

Implements Definition.

Definition at line 102 of file Numberedcostfunction.cpp.

102  {/*{{{*/
103 
104  char* name2=xNew<char>(strlen(this->name)+1);
105  xMemCpy(name2,this->name,strlen(this->name)+1);
106 
107  return name2;
108 }

◆ Response()

IssmDouble Numberedcostfunction::Response ( FemModel femmodel)
virtual

Implements Definition.

Definition at line 110 of file Numberedcostfunction.cpp.

110  {/*{{{*/
111 
113 
114  /*output:*/
115  IssmDouble value;
116  IssmDouble value_sum = 0.;
117 
118  /*Scalar control output*/
119  for(int i=0;i<this->number_cost_functions;i++){
120  switch(this->cost_functions_list[i]){
123  break;
125  SurfaceRelVelMisfitx(&value, femmodel->elements,femmodel->nodes,femmodel-> vertices,femmodel-> loads,femmodel-> materials,femmodel->parameters);
126  break;
128  SurfaceLogVelMisfitx(&value,femmodel-> elements,femmodel->nodes,femmodel-> vertices,femmodel-> loads,femmodel-> materials,femmodel->parameters);
129  break;
131  SurfaceLogVxVyMisfitx(&value,femmodel-> elements,femmodel->nodes,femmodel-> vertices,femmodel-> loads,femmodel-> materials,femmodel->parameters);
132  break;
134  ThicknessAbsMisfitx(&value,femmodel-> elements,femmodel->nodes,femmodel-> vertices,femmodel-> loads,femmodel-> materials,femmodel-> parameters);
135  break;
137  ThicknessAlongGradientx(&value,femmodel-> elements,femmodel->nodes,femmodel-> vertices,femmodel-> loads,femmodel-> materials,femmodel-> parameters);
138  break;
140  ThicknessAcrossGradientx(&value,femmodel-> elements,femmodel->nodes,femmodel-> vertices,femmodel-> loads,femmodel-> materials,femmodel-> parameters);
141  break;
143  RheologyBbarAbsGradientx(&value,femmodel-> elements,femmodel->nodes,femmodel-> vertices,femmodel-> loads,femmodel-> materials,femmodel-> parameters);
144  break;
146  DragCoefficientAbsGradientx(&value,femmodel-> elements,femmodel->nodes,femmodel-> vertices,femmodel-> loads,femmodel-> materials,femmodel-> parameters);
147  break;
148  default:
149  _error_("not supported");
150  }
151  _printf0_("#"<<i+1<<": "<<value<<" ");
152  value_sum += value;
153  }
154  _printf0_("\n");
155 
156  /*done:*/
157  return value_sum;
158  }

Field Documentation

◆ definitionenum

int Numberedcostfunction::definitionenum

Definition at line 19 of file Numberedcostfunction.h.

◆ name

char* Numberedcostfunction::name

Definition at line 20 of file Numberedcostfunction.h.

◆ number_cost_functions

int Numberedcostfunction::number_cost_functions

Definition at line 21 of file Numberedcostfunction.h.

◆ cost_functions_list

int* Numberedcostfunction::cost_functions_list

Definition at line 22 of file Numberedcostfunction.h.


The documentation for this class was generated from the following files:
FemModel::vertices
Vertices * vertices
Definition: FemModel.h:49
_assert_
#define _assert_(ignore)
Definition: exceptions.h:37
IssmDouble
double IssmDouble
Definition: types.h:37
_printf0_
#define _printf0_(StreamArgs)
Definition: Print.h:29
_printf_
#define _printf_(StreamArgs)
Definition: Print.h:22
Numberedcostfunction::Echo
void Echo(void)
Definition: Numberedcostfunction.cpp:74
FemModel::parameters
Parameters * parameters
Definition: FemModel.h:46
Numberedcostfunction::name
char * name
Definition: Numberedcostfunction.h:20
ThicknessAbsMisfitx
void ThicknessAbsMisfitx(IssmDouble *pJ, Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters)
Definition: ThicknessAbsMisfitx.cpp:11
SurfaceRelVelMisfitEnum
@ SurfaceRelVelMisfitEnum
Definition: EnumDefinitions.h:828
NumberedcostfunctionEnum
@ NumberedcostfunctionEnum
Definition: EnumDefinitions.h:1203
DragCoefficientAbsGradientEnum
@ DragCoefficientAbsGradientEnum
Definition: EnumDefinitions.h:537
SurfaceLogVxVyMisfitx
void SurfaceLogVxVyMisfitx(IssmDouble *pJ, Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters)
Definition: SurfaceLogVxVyMisfitx.cpp:11
SurfaceLogVxVyMisfitEnum
@ SurfaceLogVxVyMisfitEnum
Definition: EnumDefinitions.h:826
SurfaceAbsVelMisfitEnum
@ SurfaceAbsVelMisfitEnum
Definition: EnumDefinitions.h:818
Numberedcostfunction
Definition: Numberedcostfunction.h:15
Object
Definition: Object.h:13
FemModel::nodes
Nodes * nodes
Definition: FemModel.h:56
xDelete
void xDelete(T **&aT_pp)
Definition: MemOps.h:97
ThicknessAlongGradientx
void ThicknessAlongGradientx(IssmDouble *pJ, Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters)
Definition: ThicknessAlongGradientx.cpp:11
FemModel::materials
Materials * materials
Definition: FemModel.h:45
ThicknessAlongGradientEnum
@ ThicknessAlongGradientEnum
Definition: EnumDefinitions.h:839
SurfaceRelVelMisfitx
void SurfaceRelVelMisfitx(IssmDouble *pJ, Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters)
Definition: SurfaceRelVelMisfitx.cpp:11
SurfaceAbsVelMisfitx
void SurfaceAbsVelMisfitx(IssmDouble *pJ, Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters)
Definition: SurfaceAbsVelMisfitx.cpp:11
ThicknessAbsMisfitEnum
@ ThicknessAbsMisfitEnum
Definition: EnumDefinitions.h:837
FemModel::loads
Loads * loads
Definition: FemModel.h:54
Numberedcostfunction::number_cost_functions
int number_cost_functions
Definition: Numberedcostfunction.h:21
FemModel::elements
Elements * elements
Definition: FemModel.h:44
RheologyBbarAbsGradientx
void RheologyBbarAbsGradientx(IssmDouble *pJ, Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters)
Definition: RheologyBbarAbsGradientx.cpp:11
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
SurfaceLogVelMisfitEnum
@ SurfaceLogVelMisfitEnum
Definition: EnumDefinitions.h:825
Numberedcostfunction::definitionenum
int definitionenum
Definition: Numberedcostfunction.h:19
Numberedcostfunction::Numberedcostfunction
Numberedcostfunction()
Definition: Numberedcostfunction.cpp:33
SurfaceLogVelMisfitx
void SurfaceLogVelMisfitx(IssmDouble *pJ, Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters)
Definition: SurfaceLogVelMisfitx.cpp:10
xMemCpy
T * xMemCpy(T *dest, const T *src, unsigned int size)
Definition: MemOps.h:152
DragCoefficientAbsGradientx
void DragCoefficientAbsGradientx(IssmDouble *pJ, Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters)
Definition: DragCoefficientAbsGradientx.cpp:11
ThicknessAcrossGradientx
void ThicknessAcrossGradientx(IssmDouble *pJ, Elements *elements, Nodes *nodes, Vertices *vertices, Loads *loads, Materials *materials, Parameters *parameters)
Definition: ThicknessAcrossGradientx.cpp:11
RheologyBbarAbsGradientEnum
@ RheologyBbarAbsGradientEnum
Definition: EnumDefinitions.h:674
Numberedcostfunction::cost_functions_list
int * cost_functions_list
Definition: Numberedcostfunction.h:22
ThicknessAcrossGradientEnum
@ ThicknessAcrossGradientEnum
Definition: EnumDefinitions.h:838
femmodel
FemModel * femmodel
Definition: esmfbinders.cpp:16