Ice Sheet System Model
4.18
Code documentation
src
c
classes
DependentObject.cpp
Go to the documentation of this file.
1
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 "
./classes.h
"
12
#include "
shared/shared.h
"
13
#include "../modules/modules.h"
14
15
/*DependentObject constructors and destructor*/
16
DependentObject::DependentObject
(){
/*{{{*/
17
this->
name
=NULL;
18
this->
type
=0;
19
this->
index
=-1;
20
this->
response_value
=0.;
21
}
22
/*}}}*/
23
DependentObject::DependentObject
(
char
* in_name,
int
in_type,
int
in_index){
/*{{{*/
24
25
this->
name
=xNew<char>(strlen(in_name)+1); xMemCpy<char>(this->
name
,in_name,strlen(in_name)+1);
26
this->
type
=in_type;
27
this->
index
=in_index;
28
if
(in_type!=0 && in_type!=1)
_error_
(
"cannot create an DependentObject of type "
<< in_type);
29
if
(in_type==1)
_error_
(
"not implemented yet!"
);
30
this->
response_value
=0.;
31
32
}
33
/*}}}*/
34
DependentObject::DependentObject
(
char
* in_name,
int
in_type,
int
in_index,
IssmDouble
in_response){
/*{{{*/
35
36
this->
name
=xNew<char>(strlen(in_name)+1); xMemCpy<char>(this->
name
,in_name,strlen(in_name)+1);
37
this->
type
=in_type;
38
this->
index
=in_index;
39
if
(in_type!=0 && in_type!=1)
_error_
(
"cannot create an DependentObject of type "
<< in_type);
40
if
(in_type==1)
_error_
(
"not implemented yet!"
);
41
this->
response_value
=in_response;
42
43
}
44
/*}}}*/
45
DependentObject::~DependentObject
(){
//destructor/*{{{*/
46
xDelete<char>(this->
name
);
47
}
48
/*}}}*/
49
50
/*Object virtual functions definitions:*/
51
Object
*
DependentObject::copy
(
void
) {
/*{{{*/
52
return
new
DependentObject
(
name
,
type
,
index
,
response_value
);
53
}
/*}}}*/
54
void
DependentObject::DeepEcho
(
void
){
/*{{{*/
55
this->
Echo
();
56
}
57
/*}}}*/
58
void
DependentObject::Echo
(
void
){
/*{{{*/
59
60
_printf_
(
"DependentObject:\n"
);
61
_printf_
(
" name: "
<< this->
name
<<
"\n"
);
62
if
(this->
type
==0)
63
_printf_
(
" type: scalar\n"
);
64
else
if
(this->
type
==1)
65
_printf_
(
" type: vertex\n"
);
66
else
67
_error_
(
" unknown type: "
<< this->
type
);
68
if
(this->
index
>=0)
_printf_
(
" index: "
<< this->
index
<<
"\n"
);
69
}
70
/*}}}*/
71
int
DependentObject::Id
(
void
){
return
-1; }
/*{{{*/
72
/*}}}*/
73
int
DependentObject::ObjectEnum
(
void
){
/*{{{*/
74
75
return
DependentObjectEnum
;
76
77
}
78
/*}}}*/
79
80
/*DependentObject methods: */
81
int
DependentObject::NumDependents
(
void
){
/*{{{*/
82
83
/*Branch according to the type of variable: */
84
if
(
type
==0){
/*scalar:*/
85
return
1;
86
}
87
else
if
(
type
==1){
/* vector:*/
88
_error_
(
"not implemented yet!"
);
89
}
90
else
_error_
(
"should not have a type of "
<<
type
);
91
}
92
/*}}}*/
93
void
DependentObject::Responsex
(
IssmDouble
* poutput_value,
FemModel
*
femmodel
){
/*{{{*/
94
95
/*Is this some special type of response for which we need to go in the output definitions? :*/
96
if
(
StringToEnumx
(this->
name
,
false
)==-1){
97
*poutput_value=
OutputDefinitionsResponsex
(
femmodel
,this->
name
);
98
}
99
else
femmodel->
Responsex
(poutput_value,this->
name
);
100
}
101
/*}}}*/
102
IssmDouble
DependentObject::GetValue
(
void
){
/*{{{*/
103
return
this->
response_value
;
104
}
105
/*}}}*/
106
void
DependentObject::AddValue
(
IssmDouble
in_value){
/*{{{*/
107
this->
response_value
+=in_value;
108
}
109
/*}}}*/
110
void
DependentObject::ResetResponseValue
(){
/*{{{*/
111
this->
response_value
=0.;
112
}
113
/*}}}*/
DependentObject::Echo
void Echo()
Definition:
DependentObject.cpp:58
IssmDouble
double IssmDouble
Definition:
types.h:37
_printf_
#define _printf_(StreamArgs)
Definition:
Print.h:22
DependentObject::type
int type
Definition:
DependentObject.h:20
DependentObject::copy
Object * copy(void)
Definition:
DependentObject.cpp:51
DependentObject::AddValue
void AddValue(IssmDouble in_value)
Definition:
DependentObject.cpp:106
Object
Definition:
Object.h:13
DependentObject::name
char * name
Definition:
DependentObject.h:19
FemModel::Responsex
void Responsex(IssmDouble *presponse, int response_descriptor_enum)
Definition:
FemModel.cpp:2558
DependentObject::Responsex
void Responsex(IssmDouble *poutput_value, FemModel *femmodel)
Definition:
DependentObject.cpp:93
StringToEnumx
int StringToEnumx(const char *string_in, bool notfounderror=true)
Definition:
StringToEnumx.cpp:14
FemModel
Definition:
FemModel.h:31
DependentObject::ObjectEnum
int ObjectEnum()
Definition:
DependentObject.cpp:73
DependentObject::response_value
IssmDouble response_value
Definition:
DependentObject.h:22
_error_
#define _error_(StreamArgs)
Definition:
exceptions.h:49
DependentObject::DependentObject
DependentObject()
Definition:
DependentObject.cpp:16
OutputDefinitionsResponsex
IssmDouble OutputDefinitionsResponsex(FemModel *femmodel, int output_enum)
Definition:
OutputDefinitionsResponsex.cpp:38
DependentObject::Id
int Id()
Definition:
DependentObject.cpp:71
DependentObject::ResetResponseValue
void ResetResponseValue(void)
Definition:
DependentObject.cpp:110
DependentObject::NumDependents
int NumDependents(void)
Definition:
DependentObject.cpp:81
DependentObject::GetValue
IssmDouble GetValue(void)
Definition:
DependentObject.cpp:102
shared.h
DependentObject::~DependentObject
~DependentObject()
Definition:
DependentObject.cpp:45
DependentObject::index
int index
Definition:
DependentObject.h:21
DependentObject::DeepEcho
void DeepEcho()
Definition:
DependentObject.cpp:54
classes.h
DependentObjectEnum
@ DependentObjectEnum
Definition:
EnumDefinitions.h:1035
femmodel
FemModel * femmodel
Definition:
esmfbinders.cpp:16
Generated on Thu Jul 2 2020 08:09:16 for Ice Sheet System Model by
1.8.19